Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Z-order: keeping an openGL window on top

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2006
    Posts
    25

    Z-order: keeping an openGL window on top

    I have 2 openGL windows, among many other windows, in my C++ application.

    These 2 openGL windows, we'll call BIG, and SMALL. I've positioned SMALL window over the BIG window. I'd like the SMALL window to NEVER hide behind the BIG window. NEVER. NEVER. NEVER. Of course, anytime I put the cursor in the BIG window, for example to rotate the model in the BIG window, the SMALL window hides behind the big window.

    Is there any way to prevent this from happening, so that SMALL ALWAYS stays in front of BIG, even when BIG is the active window.

    Thanks.

  2. #2
    Intern Contributor
    Join Date
    Apr 2005
    Location
    Prague, Czech Republic
    Posts
    89

    Re: Z-order: keeping an openGL window on top

    this is an OS specific question and it really isnt related to OpenGL at all..

    edit: I see you are using win32 api.. so you can at least post this post into OpenGL under Windows section .. however you would probably receive the best answers in some forum directly related to win32 programming ( or by using google )
    Try function SetWindowPos ..it can change z-order of the windows

  3. #3
    Junior Member Newbie
    Join Date
    Oct 2006
    Posts
    25

    Re: Z-order: keeping an openGL window on top

    Yeah. I've been fiddling with SetWindowPos, but the moment the BIG window becomes active (like by clicking around inside it), the SMALL window goes behind the BIG window, and thus becomes hidden. I'll try your suggestion of posting to a windows forum. Thanks for your help.

  4. #4
    Junior Member Newbie
    Join Date
    Oct 2006
    Posts
    25

    Re: Z-order: keeping an openGL window on top

    I found the solution, for anyone interested. To make the SMALL window, (which is located over the BIG window), I call ptrSmallWnd->BringWindowToTop() from the BIG window's DrawScene(). Thus, each time the BIG window is done drawing itself, the SMALL window moves to the top of the Z order, so it's visible again.

  5. #5
    Advanced Member Frequent Contributor
    Join Date
    Feb 2006
    Location
    Sweden
    Posts
    748

    Re: Z-order: keeping an openGL window on top

    So why don't you merge the two windows, you can render the smaller window within the bigger one, it's a much nicer solution.
    NeHe lesson 42 deals with multiple viewports.

  6. #6
    Advanced Member Frequent Contributor
    Join Date
    Apr 2000
    Location
    Melbourne,Victoria,Australia
    Posts
    767

    Re: Z-order: keeping an openGL window on top

    Create the smaller window as a child of the "BIG" window.

  7. #7
    Junior Member Newbie
    Join Date
    Oct 2006
    Posts
    25

    Re: Z-order: keeping an openGL window on top

    rgpc, thanks for the suggestion. would making the SMALL window a child of the BIG window keep the SMALL window from getting pushed under the BIG window, in the Z order?

  8. #8
    Junior Member Newbie
    Join Date
    Oct 2006
    Posts
    25

    Re: Z-order: keeping an openGL window on top

    zeoverlord, I'm going to look into the multiple viewports idea. thanks. Having not done that before, I figured it was trickier than simply creating 2 separate windows (BIG and SMALL), and placing one on top of the other.

  9. #9
    Junior Member Newbie
    Join Date
    Apr 2002
    Location
    Houston, Tx, USA
    Posts
    25

    Re: Z-order: keeping an openGL window on top

    Just create the small window with the WS_POPOP style, and it will float above all the other non-popup windows. WS_POPUP is often used for modal windows so they stay on top, but you can use the style for non-modal windows too.

  10. #10
    Junior Member Newbie
    Join Date
    Oct 2006
    Posts
    25

    Re: Z-order: keeping an openGL window on top

    gstrickler, I tried making the window style WS_POPUP, but alas, the SMALL window still hides behind the BIG window, each time the BIG window is clicked. Darn.

Posting Permissions

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