I have two functions that are supposed to create two viewports on a single window. For some reason it only draws one of them. Can anyone help me? Here is some of the code:
void RenderScene(void)
{
glViewport(0,0,100,100);
glOrtho(-1000,1000,-1000,1000,1000,-1000);
glBegin(GL_LINES);
glColor3f(0,0,1);
glVertex3f(1000,10,0);
glVertex3f(-10,10,0);
glEnd();
}
void RenderScene2(void)
{
glViewport(100,100,100,100);
glOrtho(-1000,1000,-1000,1000,1000,-1000);
glBegin(GL_LINES);
glColor3f(1,0,0);
glVertex3f(1000,20,0);
glVertex3f(-10,20,0);
glEnd();
}
and in my winProc WM_PAINT case:
RenderScene2();
SwapBuffers(hDC);
ValidateRect(hWnd,NULL);
RenderScene();
SwapBuffers(hDC);
ValidateRect(hWnd,NULL);
The window this draws to is a 600x800 full screen window with windows in 600x800 resolution. This code only draws the RenderScene2() code.
Also can someone tell me if glClearColor() clears the entire window or just the current viewport? How do I clear just the current viewport when it does not take up the entire screen? Thanks.