Hello,
rajiv: The different parameters are your positions of the ‘camera’ in each viewport.
If you have two viewports. In the first viewport you look at your objects as if you’re standing in front of it, and in the second you have the same objects, now looking at it from the right. Then your display function should be something like this:
// Setup orthogonal projection matrix.
glViewport(0, 0, width/2, height);
glMatrixMode(GL_MODELVIEW);
// Setup modelview matrix (e.g. using gluLookAt() if you want).
gluLookAt (0, 0, 5, // eye coordinates
0, 0, 0, // center coordinates
0, 1, 0); // up vector
DrawLeftWindowStuff();
glMatrixMode(GL_PROJECTION);// Setup orthogonal projection matrix again (unnecessary, I think?)
glViewport(width/2, 0, width/2, height);
glMatrixMode(GL_MODELVIEW);
gluLookAt (5, 0, 0, // eye coordinates
0, 0, 0, // center coordinates
0, 1, 0); // up vector
DrawRightWindowStuff();
ffish: (just to make sure that I understand it all): Am I correct that instead of the gluLookAt functions in the code above can be substituted like this:
gluLookAt (0, 0, 5, // eye coordinates
0, 0, 0, // center coordinates
0, 1, 0); // up vector
is the same as:
glLoadIdentity();
glTranslatef (0, 0, -5);
and
gluLookAt (5, 0, 0, // eye coordinates
0, 0, 0, // center coordinates
0, 1, 0); // up vector
is the same as (I hope I am doing this in the correct order):
glLoadIdentity();
glRotatef(90, 0, 1, 0);
glTranslatef(0, 0, -5);
Regards,
Ritchie