Search code examples
copenglopengl-3

Unable to retrieve version information from OpenGL 3.2 / 3.3


I've followed the basic instructions here:

http://www.opengl.org/wiki/Tutorial:_OpenGL_3.1_The_First_Triangle_%28C%2B%2B/Win%29#Rendering_Context_Creation

The only thing I've tweaked is the creation of the context to be 3.2 or 3.3:

const int attributes[] =
{
    WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
    WGL_CONTEXT_MINOR_VERSION_ARB, 2,
    WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
    0
};

And then after the creation of the context (which returns TRUE for success) I check the version with:

// Double check the version (old way)
const GLubyte *const pszGLVersion = glGetString(GL_VERSION);

// Double check the version (new way)
GLint glVersion[2];
glGetIntegerv(GL_MAJOR_VERSION, &glVersion[0]);
glGetIntegerv(GL_MINOR_VERSION, &glVersion[1]);

However, pszGLVersion is NULL, and glVersion[0] and glVersion[1] are both left uninitialised!

Why does the creation of an OpenGL 3.2 & 3.3 context succeed, but then fail to get version information?


Solution

  • I think the reason I can't get the version information out is because my graphics card doesn't support 3.2 or 3.3.