Cogl.MatrixStack.new
Description: Reference for Cogl.MatrixStack.new

### Constructor

# Cogl MatrixStacknew

#### Declaration [src]

    CoglMatrixStack*
    cogl_matrix_stack_new (
      CoglContext* ctx
    )

#### Description [src]

Allocates a new `CoglMatrixStack` that can be used to build up transformations relating to objects in a scenegraph like hierarchy. (See the description of `CoglMatrixStack` and `CoglMatrixEntry` for more details of what a matrix stack is best suited for)

When a `CoglMatrixStack` is first allocated it is conceptually positioned at the root of your scenegraph hierarchy. As you traverse your scenegraph then you should call `cogl_matrix_stack_push()` whenever you move down a level and `cogl_matrix_stack_pop()` whenever you move back up a level towards the root.

Once you have allocated a `CoglMatrixStack` you can get a reference to the current transformation for the current position in the hierarchy by calling cogl_matrix_stack_get_entry().

Once you have allocated a `CoglMatrixStack` you can apply operations such as rotate, scale and translate to modify the current transform for the current position in the hierarchy by calling cogl_matrix_stack_rotate(), `cogl_matrix_stack_scale()` and cogl_matrix_stack_translate().

#### Parameters

`ctx`

  Type: `CoglContext`

  A `CoglContext`.

  The data is owned by the caller of the function.

#### Return value

Type: `CoglMatrixStack`

A newly allocated `CoglMatrixStack`.

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