OpenGL.error
index
/var/pylive/OpenGL-ctypes/OpenGL/error.py

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.

 
Modules
       
OpenGL.platform

 
Classes
       
object
_ErrorChecker
Exception
Error
CopyError
GLError
GLUError
GLUTError
NullFunctionError

 
class CopyError(Error)
    Raised to indicate that operation requires data-copying
 
Currently only supported by the numpy array formathandler,
if you set:
 
        OpenGL.arrays.numpymodule.NumpyHandler.ERROR_ON_COPY = True 
 
this error will be raised when the Numpy handler is passed
a numpy array that requires copying to be passed to ctypes.
 
 
Method resolution order:
CopyError
Error
Exception

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class Error(Exception)
    Base class for all PyOpenGL-specific exception classes
 
  Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class GLError(Error)
    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)
 
 
Method resolution order:
GLError
Error
Exception

Methods defined here:
__init__(self, err=None, result=None, cArguments=None, baseOperation=None, pyArgs=None, cArgs=None, description=None)
Initialise the GLError, storing metadata for later display
__repr__(self)
Produce a much shorter version of the error as a string
__str__(self)
Create a fully formatted representation of the error
format_baseOperation(self, property, value)
Format a baseOperation reference for display
format_description(self, property, value)
Format description using GLU's gluErrorString
shortRepr(self, value, firstLevel=True)
Retrieve short representation of the given value

Data and other attributes defined here:
DISPLAY_ORDER = ('err', 'description', 'baseOperation', 'pyArgs', 'cArgs', 'cArguments', 'result')

Methods inherited from Exception:
__getitem__(...)

 
class GLUError(Error)
    GLU error implementation class
 
 
Method resolution order:
GLUError
Error
Exception

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class GLUTError(Error)
    GLUT error implementation class
 
 
Method resolution order:
GLUTError
Error
Exception

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class NullFunctionError(Error)
    Error raised when an undefined function is called
 
 
Method resolution order:
NullFunctionError
Error
Exception

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class _ErrorChecker(object)
    Global error-checking object
 
Attributes:
        _registeredChecker -- the checking function enabled when 
                not doing onBegin/onEnd processing
        safeGetError -- platform safeGetError function as callable method
        _currentChecker -- currently active checking function
 
  Methods defined here:
currentChecker(self)
Return the current error-checking function
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.
nullGetError(self)
Used as error-checker when inside begin/end set
onBegin(self, target=None)
Called by glBegin to record the fact that glGetError won't work
onEnd(self, target=None)
Called by glEnd to record the fact that glGetError will work
registerChecker(self, checker=None)
Explicitly register an error checker
 
This allows you to, for instance, disable error checking 
entirely.  onBegin and onEnd will switch between 
nullGetError and the value registered here.  If checker 
is None then the default

Static methods defined here:
safeGetError = glGetError(...)

Data and other attributes defined here:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of '_ErrorChecker' objects>
list of weak references to the object (if defined)

 
Functions
       
glCheckError(self, result, baseOperation=None, cArguments=None, *args) method of _ErrorChecker instance
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.
onBegin(self, target=None) method of _ErrorChecker instance
Called by glBegin to record the fact that glGetError won't work
onEnd(self, target=None) method of _ErrorChecker instance
Called by glEnd to record the fact that glGetError will work

 
Data
        ErrorChecker = <OpenGL.error._ErrorChecker object>
__all__ = ('Error', 'GLError', 'GLUError', 'GLUTError', 'glCheckError')