PDA

View Full Version : placement of object in a scene



nexusone
02-04-2002, 07:54 AM
I can do translation and rotation of one object without any problems, but when I put multiple objects they do not end up where I expect them too.
It is like I am translating from my prevous translation and not 0,0,0 for which I would like to translate.
My guess is I am not using the matrix correctly.

example:

for(i=0;i<5;i++)
glPushMatrix()
glRotatef(object[i].angle[0], 1,0,0); rotate X
glRotatef(object[i].angle[1], 0,1,0); rotate Y
glRotatef(object[i].angle[2], 0,0,1); rotate Z
glTranslatef(object[i].pos[0],object[i].pos[1],object[i].pos[2]);
glBegin();
Drawobject(object[i].obj);
glEnd();
glPopMatrix();

Furrage
02-04-2002, 08:51 AM
call glLoadIdentity() after glPushMatrix().