Export (0) Print
Expand All

Error Handling

When OpenGL detects an error, it records a current error code. The function that caused the error is ignored, so it has no effect on the OpenGL state or on the framebuffer contents. (If the error recorded was GL_OUT_OF_MEMORY, however, the results of the function are undefined.) Once recorded, the current error code isn't cleared until you call the glGetError query function, which returns the current error code.

Implementations of OpenGL may return multiple current error codes, each of which remains set until queried. The glGetError function returns GL_NO_ERROR once you've queried all the current error codes or if there is no error. Therefore, if you obtain an error code, call glGetError until GL_NO_ERROR is returned to be sure you've discovered all the errors. For the list of error codes, see OpenGL error codes.

You can use the gluErrorString GLU function to obtain a descriptive string corresponding to the error code passed in. For more information on gluErrorString, see Handling Errors.

Note   GLU functions often return error values if an error is detected. Also, the OpenGL Utility library defines the error codes GLU_INVALID_ENUM, GLU_INVALID_VALUE, and GLU_OUT_OF_MEMORY, which have the same meaning as the related OpenGL error codes.

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

ADD
Show:
© 2014 Microsoft