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 4 of 4

Thread: problem with refresh rate on multiple viewports

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2004
    Posts
    6

    problem with refresh rate on multiple viewports

    I've managed to create two viewports in the same window, but the problem is that both viewports keep blinking. seems to be a problem with the buffer or something like that... any suggestions?

    my code goes something like this
    glViewport (0, glnHeight/2, glnWidth, glnHeight/2);
    glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    //
    glMatrixMode (GL_MODELVIEW);
    glLoadIdentity ();

    updateCamera(oAibo0->oCabeza->GetBody());
    updateTrans(&xtrans, &ytrans, &ztrans);
    glTranslatef (xtrans, -ztrans, -ytrans);
    glRotatef (xrot,1.0f, 0.0f, 0.0f);
    //here goes the drawing of the model
    dJointGroupEmpty (contactgroup);
    glFlush();
    SwapBuffers (hdc);

    and the same thing for the other viewport

    seems to be a problem with the
    glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    help!!!

  2. #2
    Junior Member Newbie
    Join Date
    Mar 2002
    Location
    Moffett Field, CA
    Posts
    11

    Re: problem with refresh rate on multiple viewports

    Only perform glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) once - prior to calling the first glViewport. Then, don't call SwapBuffers(hdc) until after you have finished drawing in the second viewport.

    Also, make sure Sync to Vertical is switched on in your video driver (I doubt that this is the issue).

  3. #3
    Senior Member OpenGL Guru knackered's Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    3,032

    Re: problem with refresh rate on multiple viewports

    Also, use the glScissor function to define the same region as each glViewport before rendering into that viewport, and glEnable(GL_SCISSOR_TEST). This will ensure your scene is clipped correctly in the viewports.
    Knackered

  4. #4
    Junior Member Newbie
    Join Date
    Jan 2004
    Posts
    6

    Re: problem with refresh rate on multiple viewports

    Thanks! its working now.....

Posting Permissions

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