PDA

View Full Version : display list + 3d model



Andrew Waller
01-22-2006, 06:39 AM
Hi everyone,

I have a room stored in a display list I can move around this room fine without any problems what so ever.

when I put a 3d model into this room how ever when I move around the room the 3 model also follows me around.

The 3D model is also stored in a display list.
when displaying the model Im simply using the

glLoadIdentity();
glTranslated(0,0,-10);
glCallList(Model1);

This is obviously not the right way of placing this model in the room can anybody shed some light on how I can better place the model in the room.

jide
01-22-2006, 07:22 AM
I actually can advise you not to load the identity matrix several times in a single render. Use it only once before setting your camera then play with push/pop matrix and translate and rotate, ie:


glMatrixMode (GL_MODELVIEW);
glLoadIdentity();
gluLookAt (whereami.x,whereami.y,whereami.z, whereilook.x,whereilook.y,whereilook.z, 0,1,0);

glPushMatrix();
// the the room
glPopMatrix();

glPushMatrix();
glTranslatef (tx,ty,tx);
// draw the model
glPopMatrix();That should suffice.