Disfigurement When Rotating Objects
glRotatef,glTranslatef, and glScalef use hardware acceleration that glMultMatrixf cant use. You might be better off just using those simple functions rather then having to deal with matrix math. Especially if you dont need to do anything besides those simple transformations.
EDIT: To answer your question, you can use 'Concatenation of Transformations', Simply multiplying the matrices together will result in a new matrix that you can use. However you have to be careful because order matters. For example if you wanted to combine those three rotation matrices i gave you, you would multiply Rz * Ry * Rx. Im pretty sure in order to combine Translations,Scaling, and rotations you do: Scaling * Translation * Rotation
EDIT: To answer your question, you can use 'Concatenation of Transformations', Simply multiplying the matrices together will result in a new matrix that you can use. However you have to be careful because order matters. For example if you wanted to combine those three rotation matrices i gave you, you would multiply Rz * Ry * Rx. Im pretty sure in order to combine Translations,Scaling, and rotations you do: Scaling * Translation * Rotation
There was a long silence...
'I claim them all,' said the Savage at last.
Ok one thing I don't understand is this:
hangt5 Wrote:resultant = Rz* pointWhat is resultant? The new point? Thanks for helping me out with all the matrices too.
resultant = ry * resultant
resultant = rx * resultant
Nick Wrote:Ok one thing I don't understand is this:
What is resultant? The new point? Thanks for helping me out with all the matrices too.
Yup, basically you have to multiply your point by the Rz matrix. Then that new point by the Ry matrix, then that new point by the Rx matrix... which results in your final point
There was a long silence...
'I claim them all,' said the Savage at last.
Check those links I posted here. They have a wealth of information.
Multiplying matrices to concatenate rotations is much more expensive than multiplying quaternions. Just bear that in mind if performance becomes a concern at some point in your project.
Multiplying matrices to concatenate rotations is much more expensive than multiplying quaternions. Just bear that in mind if performance becomes a concern at some point in your project.
I was wondering why you were resistant to using glRotate. To obtain a matrix that you can use yourself you can do something like this.
This will give you a transformation matrix that you can use to transform your own vertex list if you want without having to deal with any of the component transformation matrices, and at the same time, you can leverage OpenGL's optimizations. I'm sure that it's making use of veclib or something while if you do the matrix operations in your own code ...
But if you're doing a FPS where the gun is stationary relative to the camera, have you considered just drawing the gun before you perform any model view transformations? That way, you don't have to worry about transforming its geometry at all.
Code:
double matrix16[16];
glMatrixMode(GL_MODELVIEW)
glPushMatrix()  to save the current model matrix state
glLoadIdentity()  to load the identity matrix onto the stack top
glTranslate  do your transforms in whatever order you like
glRotate
glScale
glGetParameterd(GL_MODELVIEW_MATRIX, matrix16)  to retrieve the matrix
glPopMatrix()
This will give you a transformation matrix that you can use to transform your own vertex list if you want without having to deal with any of the component transformation matrices, and at the same time, you can leverage OpenGL's optimizations. I'm sure that it's making use of veclib or something while if you do the matrix operations in your own code ...
But if you're doing a FPS where the gun is stationary relative to the camera, have you considered just drawing the gun before you perform any model view transformations? That way, you don't have to worry about transforming its geometry at all.
Possibly Related Threads...
Thread:  Author  Replies:  Views:  Last Post  
Rotating a triangle to vertical.  Joseph Duchesne  5  3,807 
Apr 14, 2006 05:18 PM Last Post: unknown 

Rotating Images in Classic  Josh  3  5,229 
Jul 18, 2002 09:01 AM Last Post: aarku 