Sub Textures

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

Synopsis

                    CoglSubTexture;
CoglSubTexture *    cogl_sub_texture_new                (CoglContext *ctx,
                                                         CoglTexture *parent_texture,
                                                         int sub_x,
                                                         int sub_y,
                                                         int sub_width,
                                                         int sub_height);
CoglBool            cogl_is_sub_texture                 (void *object);

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 ()

CoglSubTexture *    cogl_sub_texture_new                (CoglContext *ctx,
                                                         CoglTexture *parent_texture,
                                                         int sub_x,
                                                         int sub_y,
                                                         int sub_width,
                                                         int sub_height);

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.

ctx :

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. [transfer full]

Since 1.10

Stability Level: Unstable


cogl_is_sub_texture ()

CoglBool            cogl_is_sub_texture                 (void *object);

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