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);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();

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);
SwapBuffers (hdc);

and the same thing for the other viewport

seems to be a problem with the


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).

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.

Thanks! its working now…