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: glViewPort doent work twice

  1. #1
    Guest

    glViewPort doent work twice

    I want to draw a scene from 2 different points on view.

    But when I do :

    glViewPort(0,0,w/2,h);
    display();
    glViewPort(w/2,0,w/2,h);
    display();
    glutSwapBuffer();

    it only draws in the SECOND ViewPort : (w/2,0,w/2,h)
    And when I write
    glViewPort(0,0,w/2,h/2);
    display();
    glViewPort(0,h/2,w/2,h/2);
    display();
    glviewport(w/2,0,w/2,h/2);
    display();
    glViewPort(w/2,h/2,w/2,h/2);
    display();
    glutSwapBuffers();

    It also draws only un the LAST ViewPort : (w/2,h/2,w/2,h/2).

    Can you help me? Thank you very much.

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,982

    Re: glViewPort doent work twice

    You probably call glClear in your display function. glClear will clear the entire client area, and not only the part specified by glViewport. What happens when you draw your second viewport is that you clear the entire client area, and the first viewport is erased (same for third and fourth viewport, any previsously drawing will be cleared). If you want to limit the area of glClear, you must use glScissor also.

  3. #3
    Guest

    Re: glViewPort doent work twice

    Thank you!!! That was the solution!!! Great!


Posting Permissions

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