This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Tips & Tricks: Viewing Transforms

Note: This was originally posted on 27th October 2009 at http://forums.arm.com

How OpenGL ES handles matrices...
When you multiply the position vector with several matrices to achieve transformations such as translation, rotation, scaling or projection, the effect when applying the resulting matrix on a position vector is as if the individual matrix multiplication operations were performed from right to left.
The usual sequence of matrices is, from left to right:
1. Projection matrix
2. View matrix
3. Any number of model transformation matrices, from most global to most local.
You must then multiply the resulting matrix by the vertex position with the matrix on the left.
Parents
  • Note: This was originally posted on 27th October 2009 at http://forums.arm.com

    How OpenGL ES handles matrices
    It is common practice to present transformation matrices in row major order. However, when storing one or two-dimensional arrays in the C programming language, OpenGL ES assumes matrices are stored in column major order.
    When matrices are written as constants, they appear transposed. This applies to constants in an application program in addition to shader programs.
    Example of a translation matrix:

    [font="Courier New"]float move_matrix[]={
    1.0f, 0.0f, 0.0f, 0.0f,
    0.0f, 1.0f, 0.0f, 0.0f,
    0.0f, 0.0f, 1.0f, 0.0f,
    x,    y,    z,    1.0f
    };[/font]


    equals...

    [font="Courier New"]
    1 0 0 X
    0 1 0 Y
    0 0 1 Z
    0 0 0 1[/font]
Reply
  • Note: This was originally posted on 27th October 2009 at http://forums.arm.com

    How OpenGL ES handles matrices
    It is common practice to present transformation matrices in row major order. However, when storing one or two-dimensional arrays in the C programming language, OpenGL ES assumes matrices are stored in column major order.
    When matrices are written as constants, they appear transposed. This applies to constants in an application program in addition to shader programs.
    Example of a translation matrix:

    [font="Courier New"]float move_matrix[]={
    1.0f, 0.0f, 0.0f, 0.0f,
    0.0f, 1.0f, 0.0f, 0.0f,
    0.0f, 0.0f, 1.0f, 0.0f,
    x,    y,    z,    1.0f
    };[/font]


    equals...

    [font="Courier New"]
    1 0 0 X
    0 1 0 Y
    0 0 1 Z
    0 0 0 1[/font]
Children
No data