PDA

View Full Version : multiple views Flicker



Michael S.
12-21-2009, 04:04 PM
hey, i'am trying to get my OpenGL window divided into two view so i used glviewport(); but after running the program the views flicker and i want to know what is the problem to solve it , here is a part of my display function just need a solution to the flickering problem

glViewport(0,0,GetSystemMetrics(SM_CXFULLSCREEN),G etSystemMetrics(SM_CYFULLSCREEN)-350);
glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
gluOrtho2D(0.0, 840.0, 0.0, 380.0);
Drawpanel();
glViewport(0,GetSystemMetrics(SM_CYFULLSCREEN)-350,GetSystemMetrics(SM_CXFULLSCREEN),GetSystemMet rics(SM_CYFULLSCREEN)-(GetSystemMetrics(SM_CYFULLSCREEN)-350));
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60.0,1.0,1,20000000);
glMatrixMode(GL_MODELVIEW);
glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do
glEnable(GL_DEPTH_TEST); // Enables Depth Testing
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glLoadIdentity();
plane();
updateCamera();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
runway();
glDrawSky();
glDrawSun();
glDrawTerrain();

zed
12-21-2009, 08:07 PM
does it flicker always or only when u use glviewport() or something else

possible causes of flicker

not using a doublebuffer window
not enabling vsync

Ido_Ilan
12-22-2009, 04:17 AM
Hi,

glClear() is not affected by glViewPort().
I suggest you move the glClear() before the two viewports are rendered.

Ido