OpenGL error getting glgeterror ()

Transfer: http://blog.csdn.net/u010270148/article/details/52934295

An OpenGL Error is caused if the function arguments do not match the current context Settings. It is represented by error code. In the vast majority of cases, the OpenGL functions produces errors and this will not work. A few work.

The
OpenGL Error is stored in a queue until the Error is processed. So, if you don’t check for errors regularly, you won’t know that a function call has triggered an error. Therefore, error detection should be checked periodically to ensure that the details of the error are known.

gets the next OpenGL Error in the queue and removes it from the queue. If GL_NO_ERROR is returned, the team is empty.

GLenum glGetError ()

if all OpenGL errors are obtained

for(GLenum err; (err = glGetError()) ! = GL_NO_ERROR;)

{

//Process/log the error.

}

all return values are:

GL_NO_ERROR
(0) No error value currently

GL_INVALID_ENUM
(1280) Returns GL_INVALID_OPERATION only if an invalid enumeration parameter is used, if the specified environment is used

GL_INVALID_VALUE
(1281) Returns GL_INVALID_OPERATION only if an invalid value parameter is used, if the specified environment is used

GL_INVALID_OPERATION
The :(1282) command’s state set is invalid for the specified argument.

GL_STACK_OVERFLOW
:(1283) a stack push operation exceeds the stack size.

GL_STACK_UNDERFLOW
(1284) The push – out operation reaches the bottom of the stack.

GL_OUT_OF_MEMORY
(1285) cannot allocate enough memory.

GL_INVALID_FRAMEBUFFER_OPERATION
(1286) when the operation is not ready for the true cache.

GL_CONTEXT_LOST
(1287) OpenGL Context is lost due to graphics card reset.

Read More: