I’m wondering how the OpenGL pipeline deals with the scenario of moving the camera around during the drawing of a single scene. I’m not saying it’s a good idea to do this but I’d like to know what the end result would be.
If I call gluLookAt() and place it at (0,0,15) and point it down the -Z axis and draw a series of triangles, then call it again and point it down the +Z axis and draw a different series of triangles, what is finally drawn on the screen? Both triangle series or just the most recent one?
For instance, I’m thinking of something like this:
glClear(GL_COLOR_BUFFER_BIT); gluLookAt(0,0,15,0,0,0,0,1,0); //eye at 0,0,15 looking at origin glBegin(GL_TRIANGLES); //... glEnd(); gluLookAt(0,0,-15,0,0,0,0,1,0); //eye at 0,0,-15 looking at origin glBegin(GL_TRIANGLES); //... glEnd(); //... glutSwapBuffers();
Let’s assume the two sets of triangles do not overlap when viewed from their respective directions. What will I see on the screen after the buffer swap?