(self, name, data)
Update data for a texture variable.
Update data for a texture variable.
Update data for a texture variable .
def update_texture(self, name, data):
        """Update data for a texture variable."""
        variable = self.get_variable(name)
        
        if variable['buffer'] < 0:
            log_debug(("Variable '%s' could not be loaded, probably because "
                      "it is not used in the shaders") % name)
            return
        
        prevshape = variable['data'].shape
        variable['data'] = data
        # handle size changing
        if data.shape != prevshape:
            # delete old buffers
            # Texture.delete(variable['buffer'])
            variable['ndim'], variable['ncomponents'], _ = Texture.get_info(data)
            # create new buffer
            # variable['buffer'] = Texture.create(variable['ndim'],
                # mipmap=variable.get('mipmap', None),
                # minfilter=variable.get('minfilter', None),
                # magfilter=variable.get('magfilter', None),)
            # load data
            Texture.bind(variable['buffer'], variable['ndim'])
            Texture.load(data)
        else:
            # update data
            Texture.bind(variable['buffer'], variable['ndim'])
            Texture.update(data)
def update_texture ( self , name , data ) : variable = self . get_variable ( name ) if variable [ 'buffer' ] < 0 : log_debug ( ( "Variable '%s' could not be loaded, probably because " "it is not used in the shaders" ) % name ) return prevshape = variable [ 'data' ] . shape variable [ 'data' ] = data # handle size changing if data . shape != prevshape : # delete old buffers # Texture.delete(variable['buffer']) variable [ 'ndim' ] , variable [ 'ncomponents' ] , _ = Texture . get_info ( data ) # create new buffer # variable['buffer'] = Texture.create(variable['ndim'], # mipmap=variable.get('mipmap', None), # minfilter=variable.get('minfilter', None), # magfilter=variable.get('magfilter', None),) # load data Texture . bind ( variable [ 'buffer' ] , variable [ 'ndim' ] ) Texture . load ( data ) else : # update data Texture . bind ( variable [ 'buffer' ] , variable [ 'ndim' ] ) Texture . update ( data )