OpenGL.error
Implementation of OpenGL errors/exceptions
Note that OpenGL-ctypes will also throw standard errors,
such as TypeError or ValueError when appropriate.
ErrorChecker is an _ErrorChecker instance that allows you
to register a new error-checking function for use
throughout the system.
Classes
class _ErrorChecker(
object
):
Per-API error-checking object
Attributes:
_registeredChecker -- the checking function enabled when
not doing onBegin/onEnd processing
_currentChecker -- currently active checking function
__init__(
self
,
platform
,
baseOperation
= None
,
noErrorResult
= 0
)
Initialize from a platform module/reference
glCheckError(
self
,
result
,
baseOperation
= None
,
cArguments
= None
,
*
args
)
Base GL Error checker compatible with new ctypes errcheck protocol
This function will raise a GLError with just the calling information
available at the C-calling level, i.e. the error code, cArguments,
baseOperation and result. Higher-level code is responsible for any
extra annotations.
Note:
glCheckError relies on glBegin/glEnd interactions to
prevent glGetError being called during a glBegin/glEnd
sequence. If you are calling glBegin/glEnd in C you
should call onBegin and onEnd appropriately.
Raised to indicate that operation requires data-copying
if you set:
OpenGL.ERROR_ON_COPY = True
before importing OpenGL.GL, this error will be raised when
a passed argument would require a copy to be made.
OpenGL core error implementation class
Primary purpose of this error class is to allow for
annotating an error with more details about the calling
environment so that it's easier to debug errors in the
wrapping process.
Attributes:
- err
- the OpenGL error code for the error
- result
- the OpenGL result code for the operation
- baseOperation
- the "function" being called
- pyArgs
- the translated set of Python arguments
- cArgs
- the Python objects matching 1:1 the C arguments
- cArguments
- ctypes-level arguments to the operation, often raw integers for pointers and the like
- description
- OpenGL description of the error (textual)
Raised to indicate that there is no currently active context
Technically almost *any* OpenGL call can segfault if there is
no active context. The OpenGL.CHECK_CONTEXT flag, if enabled
will cause this error to be raised whenever a GL or GLU call is
issued (via PyOpenGL) if there is no currently valid context.
class NullFunctionError(
Error
):
Error raised when an undefined function is called