• Advertisement
Sign in to follow this  

Simple transformation question glTranslate vs glPushMatrix

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

Which one is more efficient: glTranslate(x, y, z) // Draw some stuff glTranslate(-x, -y, -z) or : glPushMatrix() glTranslate(x, y, z) // Draw some stuff glPopMatrix()

Share this post


Link to post
Share on other sites
Advertisement
I use the above code.
But I think the difference is negligible. (Even if you have to call it a lot of times).
And maybe it is platform dependent too. Try to measure it and return with the result...

Share this post


Link to post
Share on other sites
When round off errors starts to accumulate, it is no longer a question of efficiency, but a question of why the first one doesn't produce a good or desired result but the second does.

Personally, I would go with the second regardless of efficiency, simply because there's no risk of accumulating errors as you do your inverse operations to restore the previous state.

Share this post


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

  • Advertisement