(self)
Set the OpenGL options.
Set the OpenGL options.
Set the OpenGL options .
def set_renderer_options(self):
        """Set the OpenGL options."""
        options = self.scene.get('renderer_options', {})
        
        # use vertex buffer object
        gl.glEnableClientState(gl.GL_VERTEX_ARRAY)

        # used for multisampling (antialiasing)
        if options.get('antialiasing', None):
            gl.glEnable(gl.GL_MULTISAMPLE)
            
        # used for sprites
        if options.get('sprites', True):
            gl.glEnable(gl.GL_VERTEX_PROGRAM_POINT_SIZE)
            gl.glEnable(gl.GL_POINT_SPRITE)
        
        # enable transparency
        if options.get('transparency', True):
            gl.glEnable(gl.GL_BLEND)
            blendfunc = options.get('transparency_blendfunc',
                ('SRC_ALPHA', 'ONE_MINUS_SRC_ALPHA')
                # ('ONE_MINUS_DST_ALPHA', 'ONE')
                )
            blendfunc = [getattr(gl, 'GL_' + x) for x in blendfunc]
            gl.glBlendFunc(*blendfunc)
            
        # enable depth buffer, necessary for 3D rendering
        if options.get('activate3D', None):
            gl.glEnable(gl.GL_DEPTH_TEST)
            gl.glDepthMask(gl.GL_TRUE)
            gl.glDepthFunc(gl.GL_LEQUAL)
            gl.glDepthRange(0.0, 1.0)
            # TODO: always enable??
            gl.glClearDepth(1.0)
    
        # Paint the background with the specified color (black by default)
        background = options.get('background', (0, 0, 0, 0))
        gl.glClearColor(*background)
def set_renderer_options ( self ) : options = self . scene . get ( 'renderer_options' , { } ) # use vertex buffer object gl . glEnableClientState ( gl . GL_VERTEX_ARRAY ) # used for multisampling (antialiasing) if options . get ( 'antialiasing' , None ) : gl . glEnable ( gl . GL_MULTISAMPLE ) # used for sprites if options . get ( 'sprites' , True ) : gl . glEnable ( gl . GL_VERTEX_PROGRAM_POINT_SIZE ) gl . glEnable ( gl . GL_POINT_SPRITE ) # enable transparency if options . get ( 'transparency' , True ) : gl . glEnable ( gl . GL_BLEND ) blendfunc = options . get ( 'transparency_blendfunc' , ( 'SRC_ALPHA' , 'ONE_MINUS_SRC_ALPHA' ) # ('ONE_MINUS_DST_ALPHA', 'ONE') ) blendfunc = [ getattr ( gl , 'GL_' + x ) for x in blendfunc ] gl . glBlendFunc ( * blendfunc ) # enable depth buffer, necessary for 3D rendering if options . get ( 'activate3D' , None ) : gl . glEnable ( gl . GL_DEPTH_TEST ) gl . glDepthMask ( gl . GL_TRUE ) gl . glDepthFunc ( gl . GL_LEQUAL ) gl . glDepthRange ( 0.0 , 1.0 ) # TODO: always enable?? gl . glClearDepth ( 1.0 ) # Paint the background with the specified color (black by default) background = options . get ( 'background' , ( 0 , 0 , 0 , 0 ) ) gl . glClearColor ( * background )