Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Construct a uniform 3x3 Matrix

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2010
    Posts
    5

    Construct a uniform 3x3 Matrix

    I have this 3x3 rotation matrix created in the main code that I want to send to the the vertex shader using glGetUniformLocationARB and glUniformMatrix3fvARB and the inparameters of the glUniformMatrix3fvARB are the uniform location variable, count variable, transpose variable and the array which is supposed to represent the whole matrix.

    And I am not sure how to assign the values from the rotation matrix to the array at the right way. If the matrix has the size 3x3 then the length of the array should be at 9.

    If the matrix has the values:

    |1 2 3|
    |4 5 6|
    |7 8 9|

    Should the array be assigned at this way:

    {1 2 3 4 5 6 7 8 9} ?

  2. #2
    Junior Member Regular Contributor
    Join Date
    Mar 2009
    Posts
    152

    Re: Construct a uniform 3x3 Matrix

    if (transpose == GL_TRUE)
    array should be 1 2 3 4 5 6 7 8 9 (row major)
    else
    array should be 1 4 7 2 5 8 3 6 9 (column major)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •