PDA

View Full Version : 2 sets of coordinates



ltrain_riders
12-03-2002, 08:42 AM
How do I create another set of coordinates so I have 2? I want to use the second one so I can move that around in my project.

mikael_aronsson
12-03-2002, 10:36 AM
Hi !

You can save the current transformation and later restore it with the glPush/glPop/Matrix() functions.

And if that's not enough you can reload the transformation matrix at any time you want.

Mikael

nexusone
12-03-2002, 11:59 AM
How about this

// Coord system 1
int world_x, world_y, world_z;
int world_rotate_x,world_rotate_y,world_rotate_z;

// Coord system 2
int object_x, object_y, object_z;
int object_rotate_x,object_rotate_y,object_rotate_z;

glTranslatef(world_x, world_y, world_z);
glRotatef(world_rotate_x, 1.0, 0.0, 0.0);
glRotatef(world_rotate_y, 0.0, 1.0, 0.0);
glRotatef(world_rotate_z, 0.0, 0.0, 1.0);


glPushMatrix();
glTranslatef(object_x, object_y, object_z);
glRotatef(object_rotate_x, 1.0, 0.0, 0.0);
glRotatef(object_rotate_y, 0.0, 1.0, 0.0);
glRotatef(object_rotate_z, 0.0, 0.0, 1.0);
Draw_object();
glPopMatrix();


Originally posted by ltrain_riders:
How do I create another set of coordinates so I have 2? I want to use the second one so I can move that around in my project.