Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

slyterence

Speed difference between manually unrotating and saving matrices

This topic is 5715 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

Hi I''d just like to know whether it''s faster to : a) glPushMatrix() before I rotate, translate and then draw objects, and then glPopMatrix(), or, b) Translate and rotate, draw, rotate by a negative angle, and then translate by a negative vector. Also, if one method is faster (or if there''s a third alternative), i''d like to know how much faster. Thanks $£¥ We scratch our eternal itch A twentieth century bitch We are grateful for Our Iron Lung

Share this post


Link to post
Share on other sites
Advertisement
Funny thing is I asked this exact same question a couple months ago. I''ll give you the answer I got.

Using Push and PopMatrix() is much quicker than translating. The reason is that you are doing a ton of uneccesary math by undoing all of your translations. The *Matrix() functions merely add a new matrix to the stack to be used, and then remove it.

Hope I remembered all that correctly

Share this post


Link to post
Share on other sites
Actualy there is 3rd alternative that is faster than both. Build complete trnaformation (translatio/rotation/scale) matrix on CPU then send it in one glMultMatrix call instead of bunch of glTranslate/Rotate/Scale calls..

You should never let your fears become the boundaries of your dreams.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Another reason not to translate back is that the more transforms are applied to a matrix, the more error it accumulates.

Share this post


Link to post
Share on other sites
Wow! You''re saying that a general purpose CPU is faster than a specifically made hardware device?

karg

Share this post


Link to post
Share on other sites
Every ttime you rotate/translate OpenGL builds a matrix and applies it to the modelview matrix, making it quite expensive if you do this unnessecarily...

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!