Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Getting a Point From Transformations

  1. #1

    Getting a Point From Transformations

    In my code, I use about 20 different transformations(translation, rotation, scaling)for a few points. I don't want to do all the matrix arithmetic because 1. it takes too much CPU power 2. I don't know where all the operations are. Is there any way to get the value of a point by getting your modelview matrix from glGetFloatv()?

    Basically, let's say that I have the identity matrix:


    Now I want to get the point of the origin on this matrix:

    x = getx(0);
    y = gety(0);
    z = getz(0);

    How would I create these 3 functions?

  2. #2
    Junior Member Regular Contributor
    Join Date
    Apr 2002
    St. Louis, MO USA

    Re: Getting a Point From Transformations

    Yes, just get the modelview matrix with glGetDoublev, then multiply the point by the matrix. Just look up how to multiply a matrix by a point and make a function to do it. Its not very hard.

    Also, lots of calls to glRotate, glTranslate, and glScale are usually a sign of bad program design. This usually indicates that the program is not separating physics code from drawing code properly. You will find out once you try to do any collision detection why this is so.

  3. #3

    Re: Getting a Point From Transformations

    Actually, I am doing collision detection. The transformations are pretty much unavoidable because I am trying to do run-time bone animation. Your method worked well. Thank you.

Posting Permissions

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