(self)
Initialize all variables, after the shaders have compiled.
Initialize all variables, after the shaders have compiled.
Initialize all variables after the shaders have compiled .
def initialize_variables(self):
        """Initialize all variables, after the shaders have compiled."""
        # find out whether indexing is used or not, because in this case
        # the slicing needs to be deactivated
        if self.get_variables('index'):
            # deactivate slicing
            self.slicer = self.noslicer
            log_debug("deactivating slicing because there's an indexed buffer")
            self.use_index = True
        else:
            self.use_index = False
        # initialize all variables
        for var in self.get_variables():
            shader_type = var['shader_type']
            # skip varying
            if shader_type == 'varying':
                continue
            name = var['name']
            # call initialize_***(name) to initialize that variable
            getattr(self, 'initialize_%s' % shader_type)(name)
        # special case for uniforms: need to load them the first time
        uniforms = self.get_variables('uniform')
        self.set_data(**dict([(v['name'], v.get('data', None)) for v in uniforms]))
def initialize_variables ( self ) : # find out whether indexing is used or not, because in this case # the slicing needs to be deactivated if self . get_variables ( 'index' ) : # deactivate slicing self . slicer = self . noslicer log_debug ( "deactivating slicing because there's an indexed buffer" ) self . use_index = True else : self . use_index = False # initialize all variables for var in self . get_variables ( ) : shader_type = var [ 'shader_type' ] # skip varying if shader_type == 'varying' : continue name = var [ 'name' ] # call initialize_***(name) to initialize that variable getattr ( self , 'initialize_%s' % shader_type ) ( name ) # special case for uniforms: need to load them the first time uniforms = self . get_variables ( 'uniform' ) self . set_data ( * * dict ( [ ( v [ 'name' ] , v . get ( 'data' , None ) ) for v in uniforms ] ) )