def _tessellate_error(code): # Called when an error occurs. e, s, i = gluErrorString(code), "", 0 while e[i]: s += chr(e[i]) i += 1 raise Exception(s)
def errcheck(result=None, func=None, arguments=None): if _debug_gl_trace: try: name = func.__name__ except AttributeError: name = repr(func) if _debug_gl_trace_args: trace_args = ', '.join([repr(arg)[:20] for arg in arguments]) print '%s(%s)' % (name, trace_args) else: print name from pyglet import gl context = gl.current_context if not context: raise GLException('No GL context; create a Window first') if not context._gl_begin: error = gl.glGetError() # special cases if error: msg = (ctypes.cast(gl.gluErrorString(error), ctypes.c_char_p).value or ('Error %s' % error)) try: msg += ' (%s %s)' % (func.name, arguments) except AttributeError: msg += ' (%s)' % (func) raise GLException(msg) return result
def errcheck(result = None, func = None, arguments = None): if _debug_gl_trace: try: name = func.__name__ except AttributeError: name = repr(func) if _debug_gl_trace_args: trace_args = ', '.join([repr(arg)[:20] for arg in arguments]) print '%s(%s)' % (name, trace_args) else: print name from pyglet import gl context = gl.current_context if not context: raise GLException('No GL context; create a Window first') if not context._gl_begin: error = gl.glGetError() # special cases if error: msg = (ctypes.cast(gl.gluErrorString(error), ctypes.c_char_p).value or ('Error %s' % error)) try: msg += ' (%s %s)' % (func.name, arguments) except AttributeError: msg += ' (%s)' % (func) raise GLException(msg) return result
def errorCallback(code): ptr = gluErrorString(code) err = '' idx = 0 while ptr[idx]: err += chr(ptr[idx]) idx += 1 self.warn("GLU Tesselation Error: " + err)
def my_errcheck(result, func, arguments): from pyglet import gl error = gl.glGetError() if error and error != 1286: # HACK: The 1286(INVALID_FRAMEBUFFER_OPERATION) error again! # This time I DIDN'T EVEN USE FBO! ATI!! msg = ctypes.cast(gl.gluErrorString(error), ctypes.c_char_p).value raise gl.GLException((error, msg)) return result
def errcheck(result, func, arguments): from pyglet.gl import get_current_context context = get_current_context() if not context: raise GLException('No GL context; create a Window first') if not context._gl_begin: from pyglet.gl import glGetError, gluErrorString error = glGetError() if error: message = ctypes.cast(gluErrorString(error), ctypes.c_char_p).value raise GLException(message) return result
def errcheck(result, func, arguments): if _debug_gl_trace: try: name = func.__name__ except AttributeError: name = repr(func) if _debug_gl_trace_args: trace_args = ', '.join([repr(arg)[:20] for arg in arguments]) print('%s(%s)' % (name, trace_args)) else: print(name) from pyglet import gl context = gl.current_context if not context: raise GLException('No GL context; create a Window first') error = gl.glGetError() if error: msg = ctypes.cast(gl.gluErrorString(error), ctypes.c_char_p).value raise GLException(msg) return result
def errcheck(result, func, arguments): if _debug_gl_trace: try: name = func.__name__ except AttributeError: name = repr(func) if _debug_gl_trace_args: trace_args = ', '.join([repr(arg)[:20] for arg in arguments]) print('%s(%s)' % (name, trace_args)) else: print(name) from pyglet import gl context = gl.current_context if not context: raise GLException('No GL context; create a Window first') if not context._gl_begin: error = gl.glGetError() if error: msg = ctypes.cast(gl.gluErrorString(error), ctypes.c_char_p).value raise GLException(msg) return result