### Constructor

# Cogl SubTexture new

#### Declaration [src]

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

#### Description [src]

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 `CoglTexture` interface because it’s not a low level texture that hardware can understand natively.

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

#### Parameters

`ctx`

  Type: `CoglContext`

  A `CoglContext` pointer.

  The data is owned by the caller of the function.

`parent_texture`

  Type: `CoglTexture`

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

  The data is owned by the caller of the function.

`sub_x`

  Type: `int`

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

`sub_y`

  Type: `int`

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

`sub_width`

  Type: `int`

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

`sub_height`

  Type: `int`

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

#### Return value

Type: `CoglTexture`

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

The caller of the function takes ownership of the data, and is responsible for freeing it.