OpenGL texture can be a pain to manage ourself, except if you know perfectly all the OpenGL API :).
Bases: object
Handle a OpenGL texture. This class can be used to create simple texture or complex texture based on ImageData.
Bind the texture to current opengl state
Blit a buffer into a texture.
Parameters:
- pbuffer : str
Image data
- size : tuple, default to texture size
Size of the image (width, height)
- fmt : str, default to ‘rgb’
Image format, can be one of ‘rgb’, ‘rgba’, ‘bgr’, ‘bgra’
- pos : tuple, default to (0, 0)
Position to blit in the texture
- buffertype : str, default to ‘ubyte’
Type of the data buffer, can be one of ‘ubyte’, ‘ushort’, ‘uint’, ‘byte’, ‘short’, ‘int’, ‘float’
Replace a whole texture with a image data
texture_create(size=None, fmt=None, buffertype=None, rectangle=False, mipmap=False) Create a texture based on size.
Parameters:
- size: tuple, default to (128, 128)
Size of the texture
- fmt: str, default to ‘rgba’
Internal format of the texture. Can be ‘rgba’ or ‘rgb’
- rectangle: bool, default to False
If True, it will use special opengl command for creating a rectangle texture. It’s not available on OpenGL ES, but can be used for desktop. If we are on OpenGL ES platform, this parameter will be ignored.
- mipmap: bool, default to False
If True, it will automatically generate mipmap texture.
texture_create_from_data(im, rectangle=True, mipmap=False) Create a texture from an ImageData class
Do the appropriate glDisable()
Do the appropriate glEnable()
Flip tex_coords for vertical displaying
Get/set the GL_TEXTURE_MAG_FILTER property
Get/set the GL_TEXTURE_MIN_FILTER property
Get/set the UV position inside texture
Get/set the UV size inside texture.
Warning
The size can be negative is the texture is flipped.
Get/set the GL_TEXTURE_WRAP_S,T property
Bases: kivy.graphics.texture.Texture
Handle a region of a Texture class. Useful for non power-of-2 texture handling.