Hi,
I am trying to draw a room by drawing a bunch of polygons. I would also like to move around the room. I have managed to do these successfully but the problem is when I move around, the walls flicker and disappear. I understand there is a problem with my gluLookAt’s zNear and zFar but how do I fix it as I move? btw, this code is an update by frame rate per second… so it is updates like 10 times per second or whatever is chosen.
code is roughly like this
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60*zoom, 1.0, 0, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(eye[0], eye[1], eye[2], at[0], at[1], at[2], v_up[0], v_up[1], v_up[2]);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
// load and draw all polygons and disable depthtest and cull face…
thanks in advance
K