Jump to content
  • Advertisement
Sign in to follow this  
Septimra

glPushMatrix and glPopMatrix Intuition

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

Now that i understand the modelview matrix, i must understand pop and push! :D
When you push and pop a matrix from the stack, what operations are done to make it happen? blink.gif

I no it does 'things to the matrix stack, takes things off and on and stuff'...but how?

W8, i no..When are coordinates multiplied by the current modelview matrix?
Is it when they are created and/or when the current modelview matrix changes?

that would mean, some coordinates are multiplied several timesby the modelview matrix!smile.gif
Am i correct?

Share this post


Link to post
Share on other sites
Advertisement
You don't really need to understand pop and push, this is old and deprecated methodology. You would be much better served by forgetting these deprecated functions and learning correct shader techniques.

But if you're interested, pushing and popping don't actually 'do' anything to the matrix, its just a way to store the matrices to retrieve them later.

glPushMatrix = save this matrix for later
glPopMatrix = I'm done with my current matrix, retrieve the last matrix that I pushed.

Share this post


Link to post
Share on other sites

You don't really need to understand pop and push, this is old and deprecated methodology. You would be much better served by forgetting these deprecated functions and learning correct shader techniques.

But if you're interested, pushing and popping don't actually 'do' anything to the matrix, its just a way to store the matrices to retrieve them later.

glPushMatrix = save this matrix for later
glPopMatrix = I'm done with my current matrix, retrieve the last matrix that I pushed.


http://www.opengl.org/wiki/FAQ#glTranslate.2C_glRotate.2C_glScale

Share this post


Link to post
Share on other sites
[color=#1C2837][size=2]
correct shader techniques. [/quote]
[color="#1C2837"][size=2]What do you mean? How does glPush and glPop effect the shader?
[color="#1C2837"][size=2]Does it not affect the coordinates? Or does it effect both?blink.gif
[color="#1C2837"][size=2]

[color="#1C2837"][size=2]
But if you're interested, pushing and popping don't actually 'do' anything to the matrix, its just a way to store the matrices to retrieve them later.[/quote]
[color="#1C2837"][size=2]I'm srry, i meant, what does it do to the coordinates?

Share this post


Link to post
Share on other sites
Pushing and popping matrices does nothing to neither vertices nor shaders. It just saves and restores the matrices so you can manipulate them and then reverting any changes made at the time you popped them.

Share this post


Link to post
Share on other sites
So, lets say you had a coordinate [1,2,3,1]

loadIdentityMatrix
glpushMatrix
then you scale the matrix x 2
Vertex3f(coordinate)
//now the coordinate is [1,2,3,1] , right?
glPopMatrix
//but now the coordinate is [2,4,6,1], right?

So, im asking is that, when you Pop the matrix does it force the coordinate to be multiplied by the popped matrix, then by the current matrix?
If not, how does it work?mellow.gif
Oh, and what are render functions?blink.gif

Share this post


Link to post
Share on other sites
Why don't you just read the link that haegarr gave you, it actually explains this stuff.

http://fly.cc.fer.hr/~unreal/theredbook/chapter03.html

You obviously have a very poor understanding of how this all works, and while I don't mean that as anything negative towards you, you need to do some research on your own instead of just flooding the forum with 1000 questions.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!