Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
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
Ejemplo n.º 5
0
 def errorCallback(code):
     ptr = gluErrorString(code)
     err = ''
     idx = 0
     while ptr[idx]:
         err += chr(ptr[idx])
         idx += 1
     self.warn("GLU Tesselation Error: " + err)
Ejemplo n.º 6
0
 def errorCallback(code):
     ptr = gluErrorString(code)
     err = ''
     idx = 0
     while ptr[idx]:
         err += chr(ptr[idx])
         idx += 1
     self.warn("GLU Tesselation Error: " + err)
Ejemplo n.º 7
0
 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
Ejemplo n.º 8
0
 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
Ejemplo n.º 9
0
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
Ejemplo n.º 10
0
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
Ejemplo n.º 11
0
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
Ejemplo n.º 12
0
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