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:

glTranslatef(-5.0f,2.0f,3.0f);
glRotatef(30,1,0,0);
glTranslatef(0.0f,0.0f,1.0f);
glScalef(2.0f,1.0f,1.0f);

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?

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.

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.