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: Matrix4x4 question

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

    Matrix4x4 question

    Hi,

    Just a little matrix4x4 question...

    I have made some matrix code and started testing it.
    I tried this:
    Matrix4 a;
    a.RotateXYZ(45.0, 0.0, 0.0);
    Matrix4 b;
    b.Translate(5.0, 5.0, -20.0);
    m = a * b;
    glLoadMatrixd(m.m);
    (As you can see, this is cpp. Matrix4 is a 4x4 matrix class)
    Then I see an object in the upper corner.
    I do get the same result when I try this:
    glTranslatef(5.0, 5.0, -20.0);
    glRotatef(45.0, 1.0, 0.0, 0.0);

    Does this make sense, as I (in my code) first rotate and then translate,
    but in the second example I first translate, and then rotate...

    Thanks,

    Steven

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Feb 2001
    Location
    Switzerland
    Posts
    1,840

    Re: Matrix4x4 question

    how bout m = b * a ? it should then be the same.. this is the logic of matrizes... funny, not?

    its simply cause the first transformation is done at the right part of the equation, means every vertex going through m goes first through a, then trough b ( in my example ) ( or otherway round, HELP, psycho! ) but its simply like that.. if you read redbook and mathbooks then you will see that everything is ok
    http://davepermen.net - if i could stay true to my heart, i would feel totally free

Posting Permissions

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