PDA

View Full Version : Object movement



redknite
10-18-2000, 07:35 PM
Ok, im having aproblem moving objects. I load them all from disk, and they are all relative to {0,0,0} so obviously i need to move them. Currently i use this method

glMatrixMode(GL_MODELVIEW_MATRIX);
glPushMatrix();

glTranslatef(mx, my, mz);

// Draw object here
glPopMatrix();

but if i draw 2 objects one after the other like this

Obj1->Draw(0,0,0)
Obj2->Draw(10,10,10)

the first one is drawn fine, but the 2nd one follows the camera. I thought it might be that i need to reset the modelview matrix before drawing(glLoadIdentity) but if i do that my camera doesnt move at all. and objects are drawn in weird places. Any ideas? thanks

~ Chris

Antonio
10-20-2000, 04:31 PM
shouldn't you be doing

glMatrixMode(GL_MODELVIEW);

instead of

glMatrixMode(GL_MODELVIEW_MATRIX); ?


Antonio www.fatech.com/tech (http://www.fatech.com/tech)