Jump to content
  • Advertisement


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


can sombody explain push pop matrix...

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

For some reason imjust not understanding...i just realized that prior project of mine when 180 degrees on the x that when you turn y it goes the other direction. i know pop push matrix fix that, but i dont know why or how to use it.

Share this post

Link to post
Share on other sites
Well, I am not quite sure on what you are saying, but I will explain what push/pop matrix does.

When you are doing coordinate transformations, the matrix that you are operating on is modified. I.E. if you translate along an axis (and do whatever you want), that is now the new origin for further transformations. The same thing occurs when you rotate. so for example you rotate the coordinate system and thats all, a later translation along the x axis will be different than not rotating and then translating along the x axis. A solution to this problem is to use the glPushMatrix() and glPopMatrix().
When you use glPushMatrix(), you put the specified matrix onto a stack so that after doing your transformations you can call glPopMatrix() to get back to where you were before. Of course you could just manually trace back through your steps to avoid calling these functions, but these are much simpler and faster.

"If patience is a virtue, and ignorance is bliss, you can have a pretty good life if you''re stupid and willing to wait"

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!