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),GetSystemMetrics(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),GetSystemMetrics(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();