PDA

View Full Version : change camera view in a display list



Mirkowhat
01-24-2011, 10:38 AM
how could i change the camera view in a display list?
i tried this code but it only displays the first camera view

gluLookAt(100,100,100,0,0,0,0,1,0);

glNewList(1,gl.GL_COMPILE);
createBox(100);
glEndList();
glCallList(1);

glViewport(300,0,300,300);
gluLookAt(100,500,100,0,0,0,0,1,0);
glCallList(1);

where is the error?

carsten neumann
01-24-2011, 10:42 AM
You only render one view (the one with the glCallList call), the first one only compiles the display list, but does not render anything (did you mean glNewList(1, GL_COMPILE_AND_EXECUTE)? ).

Mirkowhat
01-24-2011, 11:00 AM
after glEndList() i call glCallList(1) for the first time. i call it again in the last line!

carsten neumann
01-24-2011, 11:12 AM
sorry, I'm blind. Is your window at least 600 pixels wide (that is what you need for your glViewport call)?

If that is not the problem, it is probably somewhere in code you did not post.

Dan Bartlett
01-24-2011, 11:15 AM
What does the code in createBox() do? If it calls glLoadIdentity() for example, then the gluLookAt will be ignored in both cases.

Otherwise, putting "glLoadIdentity();" before the 2nd gluLookAt call might help, since you're calling gluLookAt twice without resetting the modelview matrix.

Mirkowhat
01-24-2011, 11:42 AM
createBox() doesn't call glLoadIdentity(), it creates a simple box. i tried to put glLoadIdentity() before the 2nd gluLookAt but it only reflects horizontally the image, but still can't change camera view. the window's size is 600*300. on the first half there is the gluLookAt(100,100,100,0,0,0,0,1,0) camera view(that is what i wanted), but on the second half i see the same image of the first half!