PDA

View Full Version : glRotatef()



Rajveer
04-05-2002, 07:36 AM
I'm using glRotatef() in my program and its causes some of my later steps to get messed up. I'm getting the feeling that this is because glRotatef() also rotates the coordinate system along with the scene. Is there a way to rotate the shape without rotating the coordinate system?

nexusone
04-05-2002, 08:03 AM
Try this:

glPushMatrix()
glTranslate / rotate

draw object.

glPopMatrix()


Originally posted by Rajveer:
I'm using glRotatef() in my program and its causes some of my later steps to get messed up. I'm getting the feeling that this is because glRotatef() also rotates the coordinate system along with the scene. Is there a way to rotate the shape without rotating the coordinate system?

Rajveer
04-05-2002, 08:56 AM
Okay, I just read about glPushMatrix() and glPopMatrix(). From my understanding, if I was to put the following two lines one after another in my program:

glPushMatrix();
glPopMatrix();

They would cancel each other out and it should have no effect on my program. Am I right about this? Because for some reason, when I wrote those two lines in my program (just to see what would happen) my entire drawing scene disappeared.

nexusone
04-05-2002, 10:28 AM
I am sorry, I thought you would understand I ment for them to be place between the object you are rotating..... http://www.opengl.org/discussion_boards/ubb/smile.gif

glPushMatrix() // move past drawing information to the matrix stack.

glRotate
glTranslate
Draw something

glPopMatrix() // Move past drawing information back into current scene.

Yes if you put them without anything between them nothing should happen.
glPushMatrix()
glPopMatrix()

If the scene did not show up after using these commands then there is a problem in how you are calling the opengl commands.


Originally posted by Rajveer:
Okay, I just read about glPushMatrix() and glPopMatrix(). From my understanding, if I was to put the following two lines one after another in my program:

glPushMatrix();
glPopMatrix();

They would cancel each other out and it should have no effect on my program. Am I right about this? Because for some reason, when I wrote those two lines in my program (just to see what would happen) my entire drawing scene disappeared.



[This message has been edited by nexusone (edited 04-05-2002).]