(self, name, data=None)
Load data for an uniform variable.
Load data for an uniform variable.
Load data for an uniform variable .
def load_uniform(self, name, data=None):
        """Load data for an uniform variable."""
        variable = self.get_variable(name)
        location = variable['location']
        
        if location < 0:
            log_debug(("Variable '%s' could not be loaded, probably because "
                      "it is not used in the shaders") % name)
            return
        
        if data is None:
            data = variable.get('data', None)
        if data is not None:
            ndim = variable['ndim']
            size = variable.get('size', None)
            # one value
            if not size:
                # scalar or vector
                if type(ndim) == int or type(ndim) == long:
                    if ndim == 1:
                        Uniform.load_scalar(location, data)
                    else:
                        Uniform.load_vector(location, data)
                # matrix 
                elif type(ndim) == tuple:
                    Uniform.load_matrix(location, data)
            # array
            else:
                # scalar or vector
                if type(ndim) == int or type(ndim) == long:
                    Uniform.load_array(location, data)
def load_uniform ( self , name , data = None ) : variable = self . get_variable ( name ) location = variable [ 'location' ] if location < 0 : log_debug ( ( "Variable '%s' could not be loaded, probably because " "it is not used in the shaders" ) % name ) return if data is None : data = variable . get ( 'data' , None ) if data is not None : ndim = variable [ 'ndim' ] size = variable . get ( 'size' , None ) # one value if not size : # scalar or vector if type ( ndim ) == int or type ( ndim ) == long : if ndim == 1 : Uniform . load_scalar ( location , data ) else : Uniform . load_vector ( location , data ) # matrix  elif type ( ndim ) == tuple : Uniform . load_matrix ( location , data ) # array else : # scalar or vector if type ( ndim ) == int or type ( ndim ) == long : Uniform . load_array ( location , data )