I am not sure if it is a question or an opinion that needs to be shaped by the users here, But here we go.
The question : Should i run openGL in version 1.1 compatibility profile even if i want to support the latest version and extensions? More info ahead.
Some functions requires you to provide an openGL version that you may want to support, Most common usage if you want to support openGL core profile or version 3.0 and above. Examples :
SDL :
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR/MINOR_VERSION, major/minor version);
GLX :
glXCreateContextAttribsARB, GLX_CONTEXT_MAJOR_VERSION_ARB, GLX_CONTEXT_MINOR_VERSION_ARB
I had some issues (a few actually) with openGL versioning and extension families.
Issue #1 - Query OpenGL version : It started with Mesa3D Mesa 7.11 if i recall correctly, Trying to query the GL_VERSION from it, I got :
"Mesa 7.11 OpenGL 2.1 Profile"
Knowing glew as well as other project parsers, They are only looking for the first dot in the string, And return the number that the dot is within, as a string (that you may choose to convert to a floating point)
From Glew 1.9.0 : Code snippet The example stated above did return "openGL" version 7.0 which was actually the MESA3D Driver version, Which made me consider it to be unreliable.
Issue #2 - Extensions (MISSING, OK?) with the same MESA3D driver as before : 7.11, Running Glewinfo (glew 1.9.0) gave me the following :
GL_ARB_texture_storage: MISSING OK
glTexStorage1D: OK
glTexStorage2D: OK
glTexStorage3D: OK
glTextureStorage1DEXT: OK
glTextureStorage2DEXT: OK
glTextureStorage3DEXT: OK
Please note that trying to retrieve (import) the functions address from the "GL_ARB_texture_storage" API resulted in a failure (NULL pointer).
My way to resolve the two issues stated above, is to initialize openGL as version 1.1 in compatibility mode, And just brute force my way by checking every API family that i may require, If openGL works as a set of API's that are standalone in their own way, yet working together, Shouldn't we treat them in such a way, code wise, instead of assuming they are there if you have a core version? Once again with MESA3D 7.11 openGL 2.1, I am still able to use openGL 3.0 functions such as "glGenerateMipmap"
**The way i am trying to avoid versions and extension strings is by : **
1.)initialize openGL 1.1 in compatibility mode.
2.)Scan for the API's you may need by importing the core functions.
3.)If you can't get the core functions, Try to get the functions by their extensions (if they exist) (No need for string comparison with an extension list "GL_EXTENSIONS")
4.)If you can't get the functions, Try to emulate them by writing your own.
5.)If none of the methods mentioned above work, Just give up.
6.)If anything from the methods mentioned above work, Run a sanity test and make sure the functions work correctly, Such as : glGetError and assertions for calls that should work.
Do you consider it be safe/efficient? Am i missing something by calling a minimal version and trying to brute force my way in? is there a way i can improve it? *Sidenote - I am aware that openGL core profile remove outdated functions, but you can just choose not to use them yourself, If your driver support the latest version. I am also aware that openGL may try to emulate functions that are outside of the current version, Depends on your driver, You may still be able to use glGenerateMipmap (openGL 3.0 function) with openGL 2.1
Issue #3 - naming conventions, Core, ARB and glew.** I am not sure yet how the name conventions work, For example : it seems that you have in "GL_ARB_debug_output" the function "glDebugMessageCallbackARB" and glDebugMessageCallback in GL version 4.3, Seems alright, But looking at the example above in issue #2, you may see inside "GL_ARB_texture_storage" the function : glTexStorage1D, No ARB suffix.
My question is, How do i know if the API is still waiting to be approved by the board, or if it is part of the core already, Judging by the headers and function names.
Sorry for the wall of text, Some input on the subjects will be appreciated.