Sub Textures

Sub Textures — Functions for creating and manipulating sub-textures.

Synopsis

                    CoglSubTexture;
#define             cogl_sub_texture_new
#define             cogl_is_sub_texture

Description

These functions allow high-level textures to be created that represent a sub-region of another texture. For example these can be used to implement custom texture atlasing schemes.

Details

CoglSubTexture

typedef struct _CoglSubTexture CoglSubTexture;

cogl_sub_texture_new

#define cogl_sub_texture_new cogl_sub_texture_new_EXP

Creates a high-level CoglSubTexture representing a sub-region of any other CoglTexture. The sub-region must strictly lye within the bounds of the parent_texture. The returned texture implements the CoglMetaTexture interface because it's not a low level texture that hardware can understand natively.

Note

Remember: Unless you are using high level drawing APIs such as cogl_rectangle() or other APIs documented to understand the CoglMetaTexture interface then you need to use the CoglMetaTexture interface to resolve a CoglSubTexture into a low-level texture before drawing.

context :

A CoglContext pointer

parent_texture :

The full texture containing a sub-region you want to make a CoglSubTexture from.

sub_x :

The top-left x coordinate of the parent region to make a texture from.

sub_y :

The top-left y coordinate of the parent region to make a texture from.

sub_width :

The width of the parent region to make a texture from.

sub_height :

The height of the parent region to make a texture from.

Returns :

A newly allocated CoglSubTexture representing a sub-region of parent_texture.

Since 1.10

Stability Level: Unstable


cogl_is_sub_texture

#define cogl_is_sub_texture cogl_is_sub_texture_EXP

Checks whether object is a CoglSubTexture.

object :

a CoglObject

Returns :

TRUE if the passed object represents a CoglSubTexture and FALSE otherwise.

Since 1.10

Stability Level: Unstable