Cogl.TextureRectangle¶
- Implementations:
None
Methods¶
- Inherited:
class |
|
class |
|
class |
|
Virtual Methods¶
None
Properties¶
None
Signals¶
None
Fields¶
None
Class Details¶
- class Cogl.TextureRectangle¶
- Bases:
- classmethod new_from_bitmap(bitmap)¶
- Parameters:
bitmap (
Cogl.Bitmap
) – ACogl.Bitmap
- Returns:
A pointer to a new
Cogl.TextureRectangle
texture.- Return type:
Allocates a new
Cogl.TextureRectangle
texture which will be initialized with the pixel data from bitmap. This texture is a low-level texture that the GPU can sample from directly unlike high-level textures such asCogl.Texture2DSliced
andCogl.AtlasTexture
.Unlike for
Cogl.Texture2D
textures, coordinates forCogl.TextureRectangle
textures should not be normalized. So instead of using the coordinate (1, 1) to sample the bottom right corner of a rectangle texture you would use (width, height) where width and height are the width and height of the texture. If you want to sample from a rectangle texture from GLSL you should use the sampler2DRect sampler type. Applications wanting to useCogl.TextureRectangle
should first check for theCogl.FeatureID.OGL_FEATURE_ID_TEXTURE_RECTANGLE
feature usingCogl.has_feature
(). The storage for the texture is not allocated before this function returns. You can callCogl.Texture.allocate
() to explicitly allocate the underlying storage or preferably let Cogl automatically allocate storage lazily when it may know more about how the texture is going to be used and can optimize how it is allocated.New in version 2.0.
- classmethod new_from_foreign(ctx, gl_handle, width, height, format)¶
- Parameters:
ctx (
Cogl.Context
) – ACogl.Context
gl_handle (
int
) – A GL handle for a GL_TEXTURE_RECTANGLE texture objectwidth (
int
) – Width of the foreign GL textureheight (
int
) – Height of the foreign GL textureformat (
Cogl.PixelFormat
) – The format of the texture
- Returns:
A new
Cogl.TextureRectangle
texture- Return type:
Wraps an existing GL_TEXTURE_RECTANGLE texture object as a
Cogl.TextureRectangle
. This can be used for integrating Cogl with software using OpenGL directly.Unlike for
Cogl.Texture2D
textures, coordinates forCogl.TextureRectangle
textures should not be normalized. So instead of using the coordinate (1, 1) to sample the bottom right corner of a rectangle texture you would use (width, height) where width and height are the width and height of the texture. The results are undefined for passing an invalid gl_handle or if width or height don’t have the correct texture geometry. If you want to sample from a rectangle texture from GLSL you should use the sampler2DRect sampler type. Applications wanting to useCogl.TextureRectangle
should first check for theCogl.FeatureID.OGL_FEATURE_ID_TEXTURE_RECTANGLE
feature usingCogl.has_feature
(). The texture is still configurable until it has been allocated so for example you can declare whether the texture is premultiplied withCogl.Texture.set_premultiplied
().
- classmethod new_with_size(ctx, width, height)¶
- Parameters:
ctx (
Cogl.Context
) – ACogl.Context
pointerwidth (
int
) – The texture width to allocateheight (
int
) – The texture height to allocate
- Returns:
A pointer to a new
Cogl.TextureRectangle
object with no storage allocated yet.- Return type:
Creates a new
Cogl.TextureRectangle
texture with a given width, and height. This texture is a low-level texture that the GPU can sample from directly unlike high-level textures such asCogl.Texture2DSliced
andCogl.AtlasTexture
.Unlike for
Cogl.Texture2D
textures, coordinates forCogl.TextureRectangle
textures should not be normalized. So instead of using the coordinate (1, 1) to sample the bottom right corner of a rectangle texture you would use (width, height) where width and height are the width and height of the texture. If you want to sample from a rectangle texture from GLSL you should use the sampler2DRect sampler type. Applications wanting to useCogl.TextureRectangle
should first check for theCogl.FeatureID.OGL_FEATURE_ID_TEXTURE_RECTANGLE
feature usingCogl.has_feature
(). The storage for the texture is not allocated before this function returns. You can callCogl.Texture.allocate
() to explicitly allocate the underlying storage or preferably let Cogl automatically allocate storage lazily when it may know more about how the texture is going to be used and can optimize how it is allocated.New in version 1.10.