It would be great to improve the glewGetExtension implementation to support OpenGL 3 core profile as it is really simple.
if OpenGL version < 3.0
use old implementation
else using the new method:
GLint n, i;
glGetIntegerv(GL_NUM_EXTENSIONS, &n);
for (i = 0; i < n; i++)
printf("%s\n", glGetStringi(GL_EXTENSIONS, i);
Thanks!
See also ID: 2835552 (Feature Request)
Is it still useful for Core context purposes to take this first step?
Or is it just going to annoy people to not go the whole mile?
The first step? If you say first step for the current glewGetExtension implementation then its not what I meant.
The idea is that there are 2 ways to check extensions : glGetString(GL_EXTENSIONS); for OpenGL 2.1 and glGetStringi(GL_EXTENSIONS, i) for OpenGL 3 >
glGetString has some issues that lead the ARB to deprecated it when use with GL_EXTENSIONS. There is no alternative ways with OpenGL 2.1 so that it has to be used.
With OpenGL 3.0 we now have glGetStringi(GL_EXTENSIONS, i) which is the only valid function for OpenGL core profile and I think it's quite wise to use it for all OpenGL 3 > versions.
Checking the OpenGL version is quite easy:
glGetIntegerv(GL_MAJOR_VERSION, &MajorVersionContext);
glGetIntegerv(GL_MINOR_VERSION, &MinorVersionContext);
But GL_MAJOR_VERSION and GL_MINOR_VERSION are only OpenGL 3.0 values I think.
Checking if glDrawElementsInstanced is null should be a reliable way to check if the OpenGL context is an OpenGL 3.0 > context.
For people is make no change, they will still use glewGetExtension the same way except that is will work we core profile unlike currently.
Yeah fixing that INVALID_ENUM error would be cool :)
See also:
https://github.com/nigels-com/glew/pull/24
Fixed in the upcoming 2.0.0 release of GLEW,