Difference between revisions of "OpenGL Error"

From OpenGL.org
Jump to: navigation, search
m (Redirected page to GL Error Codes)
(Creating a page for describing the interactions of functions with OpenGL errors.)
Line 1: Line 1:
#REDIRECT [[GL Error Codes]]
+
If the parameters of a function call do not match the set of parameters allowed by OpenGL, or do not interact reasonably with state that is already set in the [[OpenGL Context|context]], then an '''OpenGL Error''' will result. The errors are presented as an error code.
 +
 
 +
With the exception of the [[OpenGL Object#Multi bind|multi-bind functions]], all OpenGL functions that emit an error will have no effect. No OpenGL state will be changed, no rendering will be initiated. It will be as if the function had not been called.
 +
 
 +
{{stub}}
 +
 
 +
__TOC__
 +
 
 +
== Testing for errors ==
 +
 
 +
== Meaning of errors ==
 +
 
 +
The {{apifunc|glGetError}} function returns one of the following error codes, or {{enum|GL_NO_ERROR}} if no (more) errors are available. Each error code represents a category of user error.
 +
 
 +
; {{enum|GL_INVALID_ENUM}}, 0x0500
 +
: Given when an enumeration parameter is not a legal enumeration for that function. This is given only for local problems; if the spec allows the enumeration in certain circumstances, and other parameters or state dictate those circumstances, then {{enum|GL_INVALID_OPERATION}} is the result instead.
 +
; {{enum|GL_INVALID_VALUE}}, 0x0501
 +
: Given when a value parameter is not a legal value for that function. This is only given for local problems; if the spec allows the value in certain circumstances, and other parameters or state dictate those circumstances, then GL_INVALID_OPERATION is the result instead.
 +
; {{enum|GL_INVALID_OPERATION}}, 0x0502
 +
: Given when the set of state for a command is not legal for the parameters given to that command. It is also given for commands where combinations of parameters define what the legal parameters are.
 +
; {{enum|GL_STACK_OVERFLOW}}, 0x0503
 +
: Given when a stack pushing operation cannot be done because it would overflow the limit of that stack's size.
 +
; {{enum|GL_STACK_UNDERFLOW}}, 0x0504
 +
: Given when a stack popping operation cannot be done because the stack is already at its lowest point.
 +
; {{enum|GL_OUT_OF_MEMORY}}, 0x0505
 +
: Given when performing an operation that can allocate memory, but the memory cannot be allocated. The results of OpenGL functions that return this error are undefined; it is allowable for partial operations to happen.
 +
; {{enum|GL_INVALID_FRAMEBUFFER_OPERATION}}, 0x0506
 +
: Given when doing anything that would attempt to read from or write/render to a framebuffer that is [[Framebuffer Objects#Framebuffer Completeness|not complete.]]
 +
; {{enum|GL_TABLE_TOO_LARGE}}<sup>1</sup>, 0x8031
 +
: Part of the {{extref|imaging}} extension.
 +
 
 +
<sup>1</sup>: These error codes are [[Deprecation|deprecated]] in 3.0 and removed in 3.1 [[Core And Compatibility in Contexts|core]] and above.
 +
 
 +
[[Category:Debugging]]
 +
[[Category:General OpenGL]]

Revision as of 07:06, 27 July 2013

If the parameters of a function call do not match the set of parameters allowed by OpenGL, or do not interact reasonably with state that is already set in the context, then an OpenGL Error will result. The errors are presented as an error code.

With the exception of the multi-bind functions, all OpenGL functions that emit an error will have no effect. No OpenGL state will be changed, no rendering will be initiated. It will be as if the function had not been called.

Testing for errors

Meaning of errors

The glGetError function returns one of the following error codes, or GL_NO_ERROR if no (more) errors are available. Each error code represents a category of user error.

GL_INVALID_ENUM, 0x0500
Given when an enumeration parameter is not a legal enumeration for that function. This is given only for local problems; if the spec allows the enumeration in certain circumstances, and other parameters or state dictate those circumstances, then GL_INVALID_OPERATION is the result instead.
GL_INVALID_VALUE, 0x0501
Given when a value parameter is not a legal value for that function. This is only given for local problems; if the spec allows the value in certain circumstances, and other parameters or state dictate those circumstances, then GL_INVALID_OPERATION is the result instead.
GL_INVALID_OPERATION, 0x0502
Given when the set of state for a command is not legal for the parameters given to that command. It is also given for commands where combinations of parameters define what the legal parameters are.
GL_STACK_OVERFLOW, 0x0503
Given when a stack pushing operation cannot be done because it would overflow the limit of that stack's size.
GL_STACK_UNDERFLOW, 0x0504
Given when a stack popping operation cannot be done because the stack is already at its lowest point.
GL_OUT_OF_MEMORY, 0x0505
Given when performing an operation that can allocate memory, but the memory cannot be allocated. The results of OpenGL functions that return this error are undefined; it is allowable for partial operations to happen.
GL_INVALID_FRAMEBUFFER_OPERATION, 0x0506
Given when doing anything that would attempt to read from or write/render to a framebuffer that is not complete.
GL_TABLE_TOO_LARGE1, 0x8031
Part of the ARB_imaging extension.

1: These error codes are deprecated in 3.0 and removed in 3.1 core and above.