예제 #1
0
 def format_description( self, property, value ):
     """Format description using GLU's gluErrorString"""
     if value is None and self.err is not None:
         try:
             from OpenGL.GLU import gluErrorString
             self.description = value = gluErrorString( self.err )
         except Exception, err:
             return None
예제 #2
0
 def format_description(self, property, value):
     """Format description using GLU's gluErrorString"""
     if value is None and self.err is not None:
         try:
             from OpenGL.GLU import gluErrorString
             self.description = value = gluErrorString(self.err)
         except Exception, err:
             return None
예제 #3
0
    def finalize(self):
        """Links and validates earlier compiled shader program."""
        glLinkProgram(self.shader_program)
        if not glGetProgramiv(self.shader_program, GL_LINK_STATUS):
            info = glGetProgramInfoLog(self.shader_program)
            raise ShaderProgramError("program linkage error: %s" %
                                     info.decode())

        glValidateProgram(self.shader_program)
        if not glGetProgramiv(self.shader_program, GL_VALIDATE_STATUS):
            info = glGetProgramInfoLog(self.shader_program)
            raise ShaderProgramError("program validation error: %s" %
                                     info.decode())

        # delete the intermediate shader objects
        for shader_object in self.shader_objects:
            glDeleteShader(shader_object)

        self.shader_objects.clear()

        e = glGetError()
        if e != GL_NO_ERROR:
            raise ShaderProgramError("error occurred: %s" % gluErrorString(e))
예제 #4
0
    def __init__(self):
        self.tess = gluNewTess()
        self.primitives = []  # [[gl_type, vertices, idx]...]
        self.vertices = []  # Vertices for the current shape
        self.type = None  # Type for the current shape

        gl_mode_map = {
            GL_TRIANGLE_FAN: 'triangle_fan',
            GL_TRIANGLE_STRIP: 'triangle_strip',
            GL_TRIANGLES: 'triangles',
            GL_LINE_LOOP: 'line_loop'
        }

        def end_shape_handler():
            curr_obj = [
                gl_mode_map[self.type], self.vertices,
                np.arange(len(self.vertices), dtype=np.uint32)
            ]
            self.primitives.append(curr_obj)

        def begin_shape_handler(x):
            self.type = x
            self.vertices = []

        def vertex_handler(v):
            self.vertices.append(v)

        def combine_handler(new_vert, _, __):
            return new_vert

        # Register Callbacks
        gluTessCallback(self.tess, GLU_TESS_VERTEX, vertex_handler)
        gluTessCallback(self.tess, GLU_TESS_END, end_shape_handler)
        gluTessCallback(self.tess, GLU_TESS_ERROR,
                        lambda x: print("Error", gluErrorString(x)))
        gluTessCallback(self.tess, GLU_TESS_BEGIN, begin_shape_handler)
        gluTessCallback(self.tess, GLU_TESS_COMBINE, combine_handler)
예제 #5
0
def check_glerror(message='check_glerror'):
    '''Print OpenGL error message'''
    err = glGetError()
    print('{}: {}'.format(message, gluErrorString(err)))
예제 #6
0
파일: squirtle.py 프로젝트: Markitox/pymt
 def errorCallback(code):
     err = gluErrorString(code)
     pymt_logger.warning('Squirtle: GLU Tesselation Error: ' + err)
예제 #7
0
파일: bezier.py 프로젝트: gavine199/pymt
 def tess_error(code):
     err = gluErrorString(code)
     pymt_logger.warning('BezierPath: GLU Tesselation Error: %s' % str(err))
예제 #8
0
 def mcheckError(self, txt=None):
     err = glGetError()
     if err != GL_NO_ERROR:
         if txt: print txt, ':',
         print gluErrorString(err)
예제 #9
0
 def errorCallback(code):
     err = gluErrorString(code)
     pymt_logger.warning('Squirtle: GLU Tesselation Error: ' + err)