Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: using gllookat for two world view points

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2003
    Location
    a,a,a
    Posts
    3

    using gllookat for two world view points

    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

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,096

    Re: using gllookat for two world view points

    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

  3. #3
    Intern Contributor
    Join Date
    Jan 2003
    Location
    coventry
    Posts
    72

    Re: using gllookat for two world view points

    Code :
     
    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

    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).]
    ----------------------------
    Non!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •