(data)
Load texture data in a bound texture buffer.
Load texture data in a bound texture buffer.
Load texture data in a bound texture buffer .
def load(data):
        """Load texture data in a bound texture buffer."""
        # 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)
        # print ndim, shape, data.shape
        # load data in the buffer
        if ndim == 1:
            gl.glTexImage1D(textype, 0, component_type, shape[1], 0, component_type,
                            gl.GL_UNSIGNED_BYTE, data)
        elif ndim == 2:
            # width, height == shape[1], shape[0]: Thanks to the Confusion Club
            gl.glTexImage2D(textype, 0, component_type, shape[1], shape[0], 0,
                            component_type, gl.GL_UNSIGNED_BYTE, data)
def load ( 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 ) # print ndim, shape, data.shape # load data in the buffer if ndim == 1 : gl . glTexImage1D ( textype , 0 , component_type , shape [ 1 ] , 0 , component_type , gl . GL_UNSIGNED_BYTE , data ) elif ndim == 2 : # width, height == shape[1], shape[0]: Thanks to the Confusion Club gl . glTexImage2D ( textype , 0 , component_type , shape [ 1 ] , shape [ 0 ] , 0 , component_type , gl . GL_UNSIGNED_BYTE , data )