Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

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

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2003
    Posts
    2

    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
    VC + OpenGL

  2. #2
    Junior Member Regular Contributor
    Join Date
    May 2003
    Location
    New York
    Posts
    194

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

    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

  3. #3
    Junior Member Newbie
    Join Date
    Oct 2003
    Posts
    2

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

    Originally posted by Cyranose:
    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
    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!
    VC + OpenGL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •