I’m using OpenGL to draw a charting app. I have three viewports, two to draw the X and Y axis stuff, the third to draw in the charting area. I draw a box enclosing the third viewport but the box flickers(not the stuff inside just the box) during operation. I am using the following to draw the box.
glPushMatrix();
glViewport(50, 50, cx - 100, cy - 100); // 3rd viewport
// SetOrtho
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho( xMin, xMax, yMin, yMax, -zMax, zMax);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
// DrawAxisBox
glLineWidth(1.0f);
glBegin(GL_LINE_STRIP);
glVertex3f(xMin, yMin, 0.0f);
glVertex3f(xMin, yMax, 0.0f);
glVertex3f(xMax, yMax, 0.0f);
glVertex3f(xMax, yMin, 0.0f);
glVertex3f(xMin, yMin, 0.0f);
glEnd();
glPopMatrix();