OpenGL Error Codes: Difference between revisions

From OpenGL Wiki
Jump to navigation Jump to search
Zyx 2000 (talk | contribs)
m Categorized
Update for more info.
Line 2: Line 2:


'''Error Codes''' returned by <code>glGetError()</code>:
'''Error Codes''' returned by <code>glGetError()</code>:
{|
|-
! Error Code !! Description
|-
| GL_INVALID_ENUM || Given when an enumeration parameter contains an enum that is not allowed for that function
|-
| GL_INVALID_VALUE || Given when a numerical parameter does not conform to the range requirements that the function places upon it
|-
| GL_INVALID_OPERATION || Given when the function in question cannot be executed because of state that has been set in the context
|-
| GL_OUT_OF_MEMORY || Given when performing an operation that can allocate memory, when the memory in question cannot be allocated
|-
| GL_INVALID_FRAMEBUFFER_OPERATION || (See note below)
|-
| GL_STACK_OVERFLOW* || Given when a stack pushing operation causes a stack to overflow the limit of that stack's size.
|-
| GL_STACK_UNDERFLOW* || Given when a stack popping operation is given when the stack is already at its lowest point.
|-
| GL_TABLE_TOO_LARGE || This error code is a part of the GL_ARB_imaging extention
|}


Error codes marked with an asterisk are deprecated and can only be returned when using deprecated functionality.
* {{code|GL_INVALID_ENUM}}: 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.
* {{code|GL_INVALID_VALUE}}: Given when a value parameter is not a leval 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.
* {{code|GL_INVALID_OPERATION}}: 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.
* {{code|GL_OUT_OF_MEMORY}}: 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.
* {{code|GL_INVALID_FRAMEBUFFER_OPERATION}}: Given when doing anything that would attempt to read from or write/render to a framebuffer that is [[Framebuffer Objects#Framebuffer Completeness|not complete, as defined here]].
* {{code|GL_STACK_OVERFLOW}}<sup>1</sup>: Given when a stack pushing operation cannot be done because it would overflow the limit of that stack's size.
* {{code|GL_STACK_UNDERFLOW}}<sup>1</sup>: Given when a stack popping operation cannot be done because the stack is already at its lowest point.
* {{code|GL_TABLE_TOO_LARGE}}<sup>1</sup>: Part of the ARB_imaging extension.


[[Framebuffer Objects]] have their own error codes for codes for testing framebuffer completeness. The meaning of these codes is defined in the [[Framebuffer Objects#Framebuffer Completeness|section on framebuffer completeness]].
<sup>1</sup>: These functions are deprecated.


[[Category: General OpenGL]]
[[Category: General OpenGL]]

Revision as of 00:09, 29 August 2011

In OpenGL, the function glGetError() tells you if an error has occurred in a program; for example, if you pass an invalid value to a function. When an error occurs, an error code is saved by the implementation. This error code will be the return value of glGetError() next time it is called.

Error Codes returned by glGetError():

  • GL_INVALID_ENUM: 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: Given when a value parameter is not a leval 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: 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_OUT_OF_MEMORY: 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: Given when doing anything that would attempt to read from or write/render to a framebuffer that is not complete, as defined here.
  • GL_STACK_OVERFLOW1: Given when a stack pushing operation cannot be done because it would overflow the limit of that stack's size.
  • GL_STACK_UNDERFLOW1: Given when a stack popping operation cannot be done because the stack is already at its lowest point.
  • GL_TABLE_TOO_LARGE1: Part of the ARB_imaging extension.

1: These functions are deprecated.