-
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
-
Member
Regular Contributor
Re: fix background
Just draw the axis _before_ you do the rotations/translations. Remember, rotations/translations apply only to objects drawn thereafter.
Morglum
-
Re: fix background
I tried but it's didn't visible, how come?
-
Member
Regular Contributor
Re: fix background
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
draw_the_axis ();
glTranslatef(... //translation applied to the object
glRotatef(... // rotation applied to the object
draw_the_object ();
swap_buffers (); // or any other post-render stuff
}
-
Member
Regular Contributor
Re: fix background
Yeah, the way Morglum said would work... But you could also call glLoadIdentity() right before drawing your axis...
so
glLoadIdentity();
rotate();
.
.
draw stuff
glLoadIdentity()
darwAxis();
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules