PDA

View Full Version : using gllookat for two world view points



oshvartz
03-11-2003, 05:37 AM
hellow

i want to open two windows of the same world
how sould i define the camera so it will look
like one window

thanks offir

nexusone
03-11-2003, 06:13 AM
You draw the scene twice, once with one view to window 1.
Then switch the drawing context to the second window and change the view and render to it.

You should define two variable in which to store the camera view for each window.

If you are using glut I have an example of two windows being rendered to with the same scene but diffrent view.

e-mail me and I will send it too you.



Originally posted by oshvartz:
hellow

i want to open two windows of the same world
how sould i define the camera so it will look
like one window

thanks offir

oliii
03-12-2003, 06:30 PM
void render1()
{
glViewport(0, windowheight/2, windowwidth, windowheight);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(........);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(.........);

RenderScene();
}

void render2()
{
glViewport(0, 0, windowwidth, windowheight/2);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(........);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(.........);

RenderScene();
}

void Display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

render2();
render1();
glutSwapBuffers();
}



simple http://www.opengl.org/discussion_boards/ubb/smile.gif

glViewport does all the work, don't forget to reset the matrix stacks at each rendering, just to make sure...

Split screen goodness in 10 lines of code

[This message has been edited by oliii (edited 03-12-2003).]