Texture

class pyrender.Texture(name=None, sampler=None, source=None, source_channels=None, width=None, height=None, tex_type=GL_TEXTURE_2D, data_format=GL_UNSIGNED_BYTE)[source]

Bases: object

A texture and its sampler.

Parameters:
  • name (str, optional) – The user-defined name of this object.
  • sampler (Sampler) – The sampler used by this texture.
  • source ((h,w,c) uint8 or (h,w,c) float or PIL.Image.Image) – The image used by this texture. If None, the texture is created empty and width and height must be specified.
  • source_channels (str) – Either D, R, RG, GB, RGB, or RGBA. Indicates the channels to extract from source. Any missing channels will be filled with 1.0.
  • width (int, optional) – For empty textures, the width of the texture buffer.
  • height (int, optional) – For empty textures, the height of the texture buffer.
  • tex_type (int) – Either GL_TEXTURE_2D or GL_TEXTURE_CUBE.
  • data_format (int) – For now, just GL_FLOAT.

Attributes Summary

data_format The format of the texture data.
height The height of the texture buffer.
name The user-defined name of this object.
sampler The sampler used by this texture.
source The image used in this texture.
source_channels The channels that were extracted from the original source.
tex_type The type of the texture.
width The width of the texture buffer.

Methods Summary

delete() Remove this texture from the OpenGL context.
is_transparent([cutoff]) bool : If True, the texture is partially transparent.

Attributes Documentation

data_format

The format of the texture data.

Type:int
height

The height of the texture buffer.

Type:int
name

The user-defined name of this object.

Type:str
sampler

The sampler used by this texture.

Type:Sampler
source

The image used in this texture.

Type:(h,w,c) uint8 or float or PIL.Image.Image
source_channels

The channels that were extracted from the original source.

Type:str
tex_type

The type of the texture.

Type:int
width

The width of the texture buffer.

Type:int

Methods Documentation

delete()[source]

Remove this texture from the OpenGL context.

is_transparent(cutoff=1.0)[source]

bool : If True, the texture is partially transparent.