How can I render multiple child windows at the same time?

Hi all:
I want to render multiple child windows at the same time,like the game “Need For Speed”,there are main window,little map window and back-view window in the screen.

Thanks!

           singler

Originally posted by singler:
Hi all:
I want to render multiple child windows at the same time,like the game “Need For Speed”,there are main window,little map window and back-view window in the screen.

Simple answer: see glViewport and possibly glScissor. Your viewport need not be the whole window. You can render your scene, map, or whatever more than once with different glViewport parameters. If you want the child window to be non-rectangular, it’s slightly tricker, but not by much. Lookup stencil masks and/or render-to-texture in that case.

Note: glClear may ignore the viewport, scissoring, and/or stencil masks, so you generally want to clear the whole window first before doing the sub-window renders.

Avi

Originally posted by Cyranose:
[b] Simple answer: see glViewport and possibly glScissor. Your viewport need not be the whole window. You can render your scene, map, or whatever more than once with different glViewport parameters. If you want the child window to be non-rectangular, it’s slightly tricker, but not by much. Lookup stencil masks and/or render-to-texture in that case.

Note: glClear may ignore the viewport, scissoring, and/or stencil masks, so you generally want to clear the whole window first before doing the sub-window renders.

Avi[/b]

Thank you at first!
I created two view windows on the CWnd control with glViewport():

void DrawMainWin()
{

glViewport(0,0,(int)m_fWinWidth,(int)m_fWinHeight); //is a big view window,full CWnd
glClearColor(1,0,0,1);//backgroup color

}

void DrawLeftWin()
{

glViewport(0,3*(int)m_fWinHeight / 4,(int)m_fWinWidth / 4, (int)m_fWinHeight / 4); //is little view window at left-top
glClearColor(1,1,1,1); //backgroup color

}

But when I render the two windows by call DrawMainWin() and DrawLeftWin() at the same time,the screen is too palpitatly! and I want to set differ backgroup color at the two windows,but I failed!