Cogl.TextureRectangle

g Cogl.Object Cogl.Object Cogl.TextureRectangle Cogl.TextureRectangle Cogl.Object->Cogl.TextureRectangle Cogl.Texture Cogl.Texture Cogl.Texture->Cogl.TextureRectangle GObject.GInterface GObject.GInterface GObject.GInterface->Cogl.Texture

Implementations:

None

Methods

Inherited:

Cogl.Object (2), Cogl.Texture (14)

class

new_from_bitmap (bitmap)

class

new_from_foreign (ctx, gl_handle, width, height, format)

class

new_with_size (ctx, width, height)

Virtual Methods

None

Properties

None

Signals

None

Fields

None

Class Details

class Cogl.TextureRectangle
Bases:

Cogl.Object, Cogl.Texture

classmethod new_from_bitmap(bitmap)
Parameters:

bitmap (Cogl.Bitmap) – A Cogl.Bitmap

Returns:

A pointer to a new Cogl.TextureRectangle texture.

Return type:

Cogl.TextureRectangle

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 as Cogl.Texture2DSliced and Cogl.AtlasTexture.

Unlike for Cogl.Texture2D textures, coordinates for Cogl.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 use Cogl.TextureRectangle should first check for the Cogl.FeatureID.OGL_FEATURE_ID_TEXTURE_RECTANGLE feature using Cogl.has_feature(). The storage for the texture is not allocated before this function returns. You can call Cogl.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) – A Cogl.Context

  • gl_handle (int) – A GL handle for a GL_TEXTURE_RECTANGLE texture object

  • width (int) – Width of the foreign GL texture

  • height (int) – Height of the foreign GL texture

  • format (Cogl.PixelFormat) – The format of the texture

Returns:

A new Cogl.TextureRectangle texture

Return type:

Cogl.TextureRectangle

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 for Cogl.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 use Cogl.TextureRectangle should first check for the Cogl.FeatureID.OGL_FEATURE_ID_TEXTURE_RECTANGLE feature using Cogl.has_feature(). The texture is still configurable until it has been allocated so for example you can declare whether the texture is premultiplied with Cogl.Texture.set_premultiplied().

classmethod new_with_size(ctx, width, height)
Parameters:
Returns:

A pointer to a new Cogl.TextureRectangle object with no storage allocated yet.

Return type:

Cogl.TextureRectangle

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 as Cogl.Texture2DSliced and Cogl.AtlasTexture.

Unlike for Cogl.Texture2D textures, coordinates for Cogl.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 use Cogl.TextureRectangle should first check for the Cogl.FeatureID.OGL_FEATURE_ID_TEXTURE_RECTANGLE feature using Cogl.has_feature(). The storage for the texture is not allocated before this function returns. You can call Cogl.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.