Results 1 to 4 of 4

Thread: Multiple Rendering Contexts in Windows...

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2000
    Posts
    11

    Multiple Rendering Contexts in Windows...

    Hi,

    I need to render to multiple windows/contexts...it looks like I need to call MakeCurrent() for each window before I call the render function. This seems a waste if the RC is already current.

    Is there a way to check if a RC is current? I would like to be able to do something like this:

    if (!IsCurrent(hglrc)) {
    MakeCurrent(hglrc);
    }

    If someone could shed some light on rendering to multiple windows, I would greatly appreciate it.

    Thanks much!

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: Multiple Rendering Contexts in Windows...

    I'm not sure if there is any function to check if the current window's RC is the current one, but you could just put the wglMakeCurrent call in one of the window messages like WM_SETFOCUS, or WM_ACTIVATE. Then if your app loses focus, the RC is made current when it gets focus back. I wouldn't think that this would incur much of a performance hit. If you need multiple windows to be rendered to at the same time despite the focus, this might not work for you, though.
    Deiussum
    Software Engineer and OpenGL enthusiast

  3. #3
    Junior Member Newbie
    Join Date
    Nov 2000
    Posts
    11

    Re: Multiple Rendering Contexts in Windows...

    Originally posted by Deiussum:
    I'm not sure if there is any function to check if the current window's RC is the current one, but you could just put the wglMakeCurrent call in one of the window messages like WM_SETFOCUS, or WM_ACTIVATE. Then if your app loses focus, the RC is made current when it gets focus back. I wouldn't think that this would incur much of a performance hit. If you need multiple windows to be rendered to at the same time despite the focus, this might not work for you, though.
    Okay, yeah, calling wglMakeCurrent() in the OnSetFocus or whatever makes sense for a window that only gets updated if it's currently active. Thanks for the tip.

    However, I do need to have other windows that are rendering continuously. Sounds like maybe I'm stuck calling wglMakeCurrent() within the rendering loop.

  4. #4
    Junior Member Newbie
    Join Date
    Dec 2000
    Location
    Berlin, Germany
    Posts
    2

    Re: Multiple Rendering Contexts in Windows...

    Originally posted by xenovore:
    Hi,

    I need to render to multiple windows/contexts...it looks like I need to call MakeCurrent() for each window before I call the render function. This seems a waste if the RC is already current.

    Is there a way to check if a RC is current? I would like to be able to do something like this:

    if (!IsCurrent(hglrc)) {
    MakeCurrent(hglrc);
    }

    If someone could shed some light on rendering to multiple windows, I would greatly appreciate it.

    Thanks much!
    Try using wglGetCurrentContext()

Similar Threads

  1. Multiple Windows & Rendering Contexts
    By Rennie Johnson in forum OpenGL: Windows
    Replies: 2
    Last Post: 09-08-2007, 11:55 PM
  2. Multiple Rendering Contexts
    By dannyhut in forum OpenGL: Windows
    Replies: 2
    Last Post: 02-10-2007, 06:15 PM
  3. Multiple rendering contexts problems
    By Jason666 in forum OpenGL: Advanced Coding
    Replies: 24
    Last Post: 11-24-2004, 06:15 PM
  4. multiple rendering contexts?
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 08-15-2002, 05:13 AM
  5. Problems with multiple rendering contexts and windows!
    By [DUD]Knoen in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 07-05-2000, 07:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean