PDA

View Full Version : problem with refresh rate on multiple viewports



El
01-16-2004, 09:52 AM
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!!! http://www.opengl.org/discussion_boards/ubb/smile.gif

xtwombly
01-16-2004, 10:28 AM
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).

knackered
01-16-2004, 10:32 AM
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.

El
01-19-2004, 07:20 AM
Thanks! its working now.....