PDA

View Full Version : glScalef() PushMatrix, PopMatrix()



Abacaxi
06-30-2005, 12:34 PM
I am just wondering when do you have to use the Push and Pop Matrix...in the openGL book examples it uses throughout the drawPicture program...

Also, where do I put glScalef() to scale the lines that I am drawing? Can I scale down the lines? If so can you show me a simple code that would do such thing after calling RenderScene from Main()?

Last question, my backround appears the same as the desktop....what am I doing wrong here? I can't seem to know how to fix it.

Thanks in advance for your response.

06-30-2005, 02:28 PM
I am just wondering when do you have to use the Push and Pop Matrix...in the openGL book examples it uses throughout the drawPicture program...push/pop give you a way to save and restore the state of your matrices while you load other matrices onto the stack. it stricly a convenience thing. you could just as well create your matrices and load them with glLoadMatrix. it's up to you, but i think the push/pop thing is very handly, especially for hierarchical structures.


Also, where do I put glScalef() to scale the lines that I am drawing? Can I scale down the lines? If so can you show me a simple code that would do such thing after calling RenderScene from Main()?more often than not you'll probably want scaling applied first, before rotations and translations. so in opengl, this means calling glScale last, right before you issue geometry commands like glVertex.


my backround appears the same as the desktop....what am I doing wrong here?are you actually clearing the frame buffer and swapping buffers? are you using glut?