(data)
return ndim, ncomponents, component_type
Return information about texture data.
Return information about texture data.
Return information about texture data .
def get_info(data):
        """Return information about texture data."""
        # find shape, ndim, ncomponents
        shape = data.shape
        if shape[0] == 1:
            ndim = 1
        elif shape[0] > 1:
            ndim = 2
        # ndim = 2
        ncomponents = shape[2]
        # ncomponents==1 ==> GL_R, 3 ==> GL_RGB, 4 ==> GL_RGBA
        component_type = getattr(gl, ["GL_INTENSITY8", None, "GL_RGB", "GL_RGBA"] \
                                            [ncomponents - 1])
        return ndim, ncomponents, component_type
def get_info ( data ) : # find shape, ndim, ncomponents shape = data . shape if shape [ 0 ] == 1 : ndim = 1 elif shape [ 0 ] > 1 : ndim = 2 # ndim = 2 ncomponents = shape [ 2 ] # ncomponents==1 ==> GL_R, 3 ==> GL_RGB, 4 ==> GL_RGBA component_type = getattr ( gl , [ "GL_INTENSITY8" , None , "GL_RGB" , "GL_RGBA" ] [ ncomponents - 1 ] ) return ndim , ncomponents , component_type