Jump to content
  • Advertisement
Sign in to follow this  
HalcyonX

OpenGL OpenGL matrix calculations

This topic is 4848 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im trying to simulate the way OpenGL handles matrices, namely how at every transformation, the axis are always aligned with the way you are facing (ie. -z is front, +x is right, +y is up). How is this done? I tried using matrices with euler angles, but then i realized that that always rotates around the global axis. So how does OpenGL do its rotations? Does it actually rotate the axis at every rotation, and then use quaternions? Or is there a simpler way? Thanks. edit: hmmm.. after a little more research, it seems that this is exactly euler angles. So then, my implementation of it is somehow wrong. Currently, im taking the rotational matrices and multiplying them together. But it seems that this isnt correct. So what is the correct way to implement euler angles? Thanks. edit2: just to clarify, what im trying to do is so that rotating the point (0,0,-1) 45 degrees about the y axis, and then 45 degrees about the x axis, should result in (-0.5,0.5,-0.5). My current implementation gives me (-0.707,0.5,-0.5). [Edited by - HalcyonX on August 7, 2005 3:16:28 AM]

Share this post


Link to post
Share on other sites
Advertisement
hmmm... i checked out the opengl2.0 spec, and it seems like they're just multiplying the rotation matrices together too. Shouldnt that make it rotate around the global axes then? But how come their glRotate() function works like yaw/pitch/roll?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
It does rotate around the axes. But because of how matrix multiplication happens to work, if you call glTranslate, then glRotate, the rotation actually occurs first. So the object will be rotated as if it were at 0,0,0 and _then_ translated to where you specify. Reverse the order of the calls and you'll see it rotate around the axes instead of acting like yaw/pitch/roll.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!