can sombody explain push pop matrix...
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.
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"
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"
"If patience is a virtue, and ignorance is bliss, you can have a pretty good life if you're stupid and willing to wait"
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement