Help end child hunger

When working with the newest OpenGL functionality most of us rely on third party libs to make the functions available to us. Some examples of these third party libs are GLEW and GLEE.

These libs do a wonderful job and most of the time they save us a lot of work. However, sometimes strange things happen. Consider an application that has requested an OpenGL context version 3.3, with the core profile, using GLEW version 1.5.8.

When calling

GLuint k = glGetUniformBlockIndex(p,"Matrices");

The application crashes with an Unhandled exception. The reason is that glGetUniformBlockIndex has not been loaded in GLEW.

According to GLEW documentation:

GLEW obtains information on the supported extensions from the graphics driver. Experimental or pre-release drivers, however, might not report every available extension through the standard mechanism, in which case GLEW will report it unsupported.

I would expect not to have this issue since I’m using the latest release drivers from nVidia, which clearly state that they support OpenGL 3.3 on my GPU.

Anyway, fortunately GLEW documentation also tells us how to solve the problem:

To circumvent this situation, the glewExperimental global switch can be turned on by setting it to GL_TRUE before calling glewInit(), which ensures that all extensions with valid entry points will be exposed.

Basically, instead of calling only glewInit() just write:

glewExperimental= GL_TRUE;
glewInit();

And that should solve it :-)

© 2014 Lighthouse3d.com Suffusion theme by Sayontan Sinha