Clutter::Cogl::Matrix(3) A 4x4 transformation matrix

SYNOPSIS


my $matrix = Clutter::Cogl::Matrix->init_identity();
$matrix->rotate(90.0, 0, 0, 0);
$matrix->scale(2.0, 2.0, 0);

DESCRIPTION

A Clutter::Cogl::Matrix holds a 4x4 transform matrix. This is a single precision, column-major matrix which means it is compatible with what OpenGL expects.

A lMatrix can represent transforms such as, rotations, scaling, translation, sheering, and linear projections. You can combine these transforms by multiplying multiple matrices in the order you want them applied.

The transformation of a vertex (x, y, z, w) by a Clutter::Cogl::Matrix is given by:

    x_new = xx * x + xy * y + xz * z + xw * w
    y_new = yx * x + yy * y + yz * z + yw * w
    z_new = zx * x + zy * y + zz * z + zw * w
    w_new = wx * x + wy * y + wz * z + ww * w

Where w is normally 1

Note: You must consider the members of the Clutter::Cogl::Matrix structure read only, and all matrix modifications must be done via the Matrix API. This allows Cogl to annotate the matrices internally. Violation of this will give undefined results. If you need to initialize a matrix with a constant other than the identity matrix you can use cogl_matrix_init_from_array().

METHODS

array = $matrix->get_array

Converts matrix to an array of 16 floating point values which can be passed to OpenGL.

$matrix->frustum ($left, $right, $bottom, $top, $z_near, $z_far)

  • $left (double)
  • $right (double)
  • $bottom (double)
  • $top (double)
  • $z_near (double)
  • $z_far (double)

matrix = Clutter::Cogl::Matrix->init_identity

matrix = $op1->multiply ($op2)

  • $op2 (matrix)

$matrix->ortho ($left, $right, $bottom, $top, $z_near, $z_far)

  • $left (double)
  • $right (double)
  • $bottom (double)
  • $top (double)
  • $z_near (double)
  • $z_far (double)

$matrix->perspective ($fov_y, $aspect, $z_near, $z_far)

  • $fov_y (double)
  • $aspect (double)
  • $z_near (double)
  • $z_far (double)

$matrix->rotate ($angle, $x, $y, $z)

  • $angle (double)
  • $x (double)
  • $y (double)
  • $z (double)

$matrix->scale ($sx, $sy, $sz)

  • $sx (double)
  • $sy (double)
  • $sz (double)

(x, y, z, w) = $matrix->transform_point (x, y, z, w)

  • $x (double)
  • $y (double)
  • $z (double)
  • $w (double)

$matrix->translate ($x, $y, $z)

  • $x (double)
  • $y (double)
  • $z (double)

COPYRIGHT

Copyright (C) 2006, 2007, 2008 OpenedHand Ltd

Copyright (C) 2009 Intel Corporation

This module is free software; you can redistribute it and/or modify it under the terms of either:

  • the GNU Lesser General Public Library version 2.1; or
  • the Artistic License, version 2.0.

See Clutter for the full copyright notice.