(data)
Update a texture.
Update a texture.
Update a texture .
def update(data):
        """Update a texture."""
        # convert data in a array of uint8 in [0, 255]
        data = Texture.convert_data(data)
        shape = data.shape
        # get texture info
        ndim, ncomponents, component_type = Texture.get_info(data)
        textype = getattr(gl, "GL_TEXTURE_%dD" % ndim)
        # update buffer
        if ndim == 1:
            gl.glTexSubImage1D(textype, 0, 0, shape[1],
                               component_type, gl.GL_UNSIGNED_BYTE, data)
        elif ndim == 2:
            gl.glTexSubImage2D(textype, 0, 0, 0, shape[1], shape[0],
                               component_type, gl.GL_UNSIGNED_BYTE, data)
def update ( data ) : # convert data in a array of uint8 in [0, 255] data = Texture . convert_data ( data ) shape = data . shape # get texture info ndim , ncomponents , component_type = Texture . get_info ( data ) textype = getattr ( gl , "GL_TEXTURE_%dD" % ndim ) # update buffer if ndim == 1 : gl . glTexSubImage1D ( textype , 0 , 0 , shape [ 1 ] , component_type , gl . GL_UNSIGNED_BYTE , data ) elif ndim == 2 : gl . glTexSubImage2D ( textype , 0 , 0 , 0 , shape [ 1 ] , shape [ 0 ] , component_type , gl . GL_UNSIGNED_BYTE , data )