View Full Version : fix background
I try to draw the coordinate system, x,y,z axis on the screen and want to freeze that there, and when I rotate an object like a square(vertex(1.0)....) the coordinate system stay the same, just the square get rotate,translate and scale? I try but it's rotate the axis(make by vertex3f) also.... Any one got any idea, how to do that ? thx
05-01-2002, 11:38 PM
Just draw the axis _before_ you do the rotations/translations. Remember, rotations/translations apply only to objects drawn thereafter.
I tried but it's didn't visible, how come?
05-03-2002, 08:54 AM
Maybe you've drawn the axis too early... Your rendering code should look like :
void display_scene ()
glClear (... //and other pre-render stuff
glLoadIdentity (); // This must be done before drawing anything - even the axis
glTranslatef(... //translation applied to the object
glRotatef(... // rotation applied to the object
swap_buffers (); // or any other post-render stuff
05-03-2002, 09:26 AM
Yeah, the way Morglum said would work... But you could also call glLoadIdentity() right before drawing your axis...
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.