Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actual__SKYe

Posted 08 July 2013 - 10:24 PM

If you use GLEW, you can type:



//Initialize GLEW
if(glewInit() != GLEW_OK)
{
    //On failure
}

If this fails, then normally, the context has yet to be created.

 

Another way, is to call

glGetError()

If the context has yet to be created, then it will always return GL_INVALID_OPERATION (1282).

Note, however that multiple errors issued by OpenGL calls are saved by OpenGL, so the spec says that glGetError() should always be called in a loop, until it returns GL_NO_ERROR.

Since other OpenGL calls may have triggered an invalid operation, to be sure, you could call glGetError() a large number of times in a row (1000 maybe?), and if the last return value is still GL_INVALID_OPERATION, then you know the context is not created.

 

Hope it helps.


#1__SKYe

Posted 08 July 2013 - 10:16 PM

If you use GLEW, you can type:

//Initialize GLEW
if(glewInit() != GLEW_OK)
{
    //On failure
}

If this fails, then normally, the context has yet to be created.


PARTNERS