change camera view in a display list

how could i change the camera view in a display list?
i tried this code but it only displays the first camera view




where is the error?

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)? ).

after glEndList() i call glCallList(1) for the first time. i call it again in the last line!

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.

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.

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!