vispy.gloo.texture.
BaseTexture
Bases: vispy.gloo.globject.GLObject
vispy.gloo.globject.GLObject
A Texture is used to represent a topological set of scalar values.
Texture data in the form of a numpy array (or something that can be turned into one). A tuple with the shape of the texture can also be given.
The format of the texture: ‘luminance’, ‘alpha’, ‘luminance_alpha’, ‘rgb’, or ‘rgba’. If not given the format is chosen automatically based on the number of channels. When the data has one channel, ‘luminance’ is assumed.
Indicates whether texture can be resized. Default True.
Interpolation mode, must be one of: ‘nearest’, ‘linear’. Default ‘nearest’.
Wrapping mode, must be one of: ‘repeat’, ‘clamp_to_edge’, ‘mirrored_repeat’. Default ‘clamp_to_edge’.
Optional. A tuple with the shape of the texture. If data is also a tuple, it will override the value of shape.
data
shape
Internal format to use.
Deprecated version of resizable.
format
The texture format (color channels).
interpolation
Texture interpolation for minification and magnification.
resize
Set the texture size and format
New texture shape in zyx order. Optionally, an extra dimention may be specified to indicate the number of color channels.
The internal (storage) format of the texture: ‘luminance’, ‘alpha’, ‘r8’, ‘r16’, ‘r16f’, ‘r32f’; ‘luminance_alpha’, ‘rg8’, ‘rg16’, ‘rg16f’, ‘rg32f’; ‘rgb’, ‘rgb8’, ‘rgb16’, ‘rgb16f’, ‘rgb32f’; ‘rgba’, ‘rgba8’, ‘rgba16’, ‘rgba16f’, ‘rgba32f’. If None, the internalformat is chosen automatically based on the number of channels. This is a hint which may be ignored by the OpenGL implementation.
set_data
Set texture data
Data to be uploaded
Offset in texture where to start copying data
Since the operation is deferred, data may change before data is actually uploaded to GPU memory. Asking explicitly for a copy will prevent this behavior.
Notes
This operation implicitly resizes the texture to the shape of the data if given offset is None.
Data shape (last dimension indicates number of color channels)
wrapping
Texture wrapping mode
Texture1D
Bases: vispy.gloo.texture.BaseTexture
vispy.gloo.texture.BaseTexture
One dimensional texture
glsl_sample
GLSL function that samples the texture.
glsl_sampler_type
GLSL type of the sampler.
glsl_type
GLSL declaration strings required for a variable to hold this data.
width
Texture width
Texture2D
Two dimensional texture
Texture data shaped as W, or a tuple with the shape for the texture (W).
Optional. A tuple with the shape HxW. If data is also a tuple, it will override the value of shape.
height
Texture height
Texture3D
Three dimensional texture
depth
Texture depth
TextureAtlas
Bases: vispy.gloo.texture.Texture2D
vispy.gloo.texture.Texture2D
Group multiple small data regions into a larger texture.
The algorithm is based on the article by Jukka Jylänki : “A Thousand Ways to Pack the Bin - A Practical Approach to Two-Dimensional Rectangle Bin Packing”, February 27, 2010. More precisely, this is an implementation of the Skyline Bottom-Left algorithm based on C++ sources provided by Jukka Jylänki at: http://clb.demon.fi/files/RectangleBinPack/.
Texture shape (optional).
Texture starting data type (default: float32)
This creates a 2D texture that holds 1D float32 data. An example of simple access:
>>> atlas = TextureAtlas() >>> bounds = atlas.get_free_region(20, 30) >>> atlas.set_region(bounds, np.random.rand(20, 30).T)
get_free_region
Get a free region of given size and allocate it
Width of region to allocate
Height of region to allocate
A newly allocated region as (x, y, w, h) or None (if failed).
TextureCube
Texture Cube
TextureEmulated3D
Two dimensional texture that is emulating a three dimensional texture
This operation implicitely resizes the texture to the shape of the data if given offset is None.