View Full Version : Ok, I have a new question! =)

06-23-2000, 03:38 PM
My apologies for asking so many questions. And my thanks to everyone who's helped me so far.

Here's the question:

Is it possible to replace multiple calls to glRotate*() with a single matrix?

I mean. Can I take three rotation matrices (one for each axis) multiply them together (on paper) and thereby having ONE matrix than does all three rotations at once. And just update the angle-variables?

So I have a matrix. I put arbitrary angles into the rotation-angles (I named them a,b and c) and then I do the calulations I have in my angle, upon which I multiply it with the current matrix. Will that work?
Can I multiply the product of three rotation matrices with the current matrix and expect to get the same result as multiplying the current matrix with the three rotation matrices sequentially?

06-23-2000, 06:10 PM
Sure you can do this. Just watch the order of your matrix multiplication and it'll be fine.

06-23-2000, 06:27 PM
Yes, you can do this. If you beleive that glRotate may be faster than a regular matrix multiply operation, you can even figure out which axis to rotate around, and how far, and use a single glRotate.

06-24-2000, 09:29 AM
So if I want to substitute an X-rotation, Y-rotation and Z-rotation (in that order) should I create a matrix where I multiply them like XYZ? Because that didn't work =)
I could rotate around Y perfectly, so I'm thinking I should have multiplied them like ZYX instead. Is that right?

BTW, do any of you know of a good camera class? You know, that will simulate a camera and has methods such as "move forward, move left" etc. etc.?
I want an optimized version using a camera matrix and not a class using several transformation functions. I have a camera like that but I want a "clean" camera.