Textures¶
A texture is an OpenGL Object that contains one or more images that all have the same image format. A texture can be used in two ways. It can be the source of a texture access from a Shader, or it can be used as a render target.
Read more on framebuffers on OpenGL Wiki
Example usage:
... fragment = ''' uniform sampler2D texture; varying vec2 v_texcoord; void main() { gl_FragColor = texture2D(texture, v_texcoord); } ''' ... quad = gloo.Program(vertex, fragment, count=4) quad['texture'] = data.get('lena.png') ...
Content
- Texture — Generic texture methods
- Texture1D — One dimensional texture
- TextureFloat1D — One dimensional float texture
- Texture2D — Two dimensional texture
- TextureFloat2D — Two dimensional float texture
- TextureAtlas — Two dimensional texture atlas
- DepthTexture — Depth texture
- TextureCube — Texture cube
Texture¶
-
class
glumpy.gloo.
Texture
(target)¶ Bases:
glumpy.gloo.gpudata.GPUData
,glumpy.gloo.globject.GLObject
Generic texture
-
cpu_format
¶ Texture CPU format (read/write).
Depending on integer or float textures, one of:
- gl.GL_RED / gl.GLR32F
- gl.GL_RG / gl.GL_RG32F
- gl.GL_RGB / gl.GL_RGB32F
- gl.GL_RGBA / gl.GL_RGBA32F
-
gpu_format
¶ Texture GPU format (read/write).
Depending on integer or float textures, one of:
- gl.GL_RED / gl.GLR32F
- gl.GL_RG / gl.GL_RG32F
- gl.GL_RGB / gl.GL_RGB32F
- gl.GL_RGBA / gl.GL_RGBA32F
-
interpolation
¶ Texture interpolation for minification and magnification.
-
wrapping
¶ Texture wrapping mode
-
Texture1D¶
TextureFloat1D¶
Texture2D¶
TextureFloat2D¶
-
class
glumpy.gloo.
TextureFloat2D
¶ Bases:
glumpy.gloo.texture.Texture2D
2D float texture
TextureAtlas¶
-
class
glumpy.gloo.
Atlas
¶ Bases:
glumpy.gloo.texture.Texture2D
Texture Atlas (two dimensional)
Parameters
- data : ndarray
- Texture data (optional)
- shape : tuple of integers
- Texture shape (optional)
- dtype : dtype
- Texture data type (optional)
- store : bool
- Specify whether this object stores a reference to the data, allowing the data to be updated regardless of striding. Note that modifying the data after passing it here might result in undesired behavior, unless a copy is given. Default True.
- format : ENUM
- The format of the texture: GL_LUMINANCE, ALPHA, GL_LUMINANCE_ALPHA, or GL_RGB, GL_RGBA. If not given the format is chosen automatically based on the number of channels. When the data has one channel, GL_LUMINANCE is assumed.