Results 1 to 5 of 5

Thread: Muliple OpenGL Contexts in Windows

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2001
    Posts
    8

    Muliple OpenGL Contexts in Windows

    My program works fine when all of my drawing
    is to the client area of the main window.
    But when I create a STATIC control and
    try to send OpenGL commands to it, the
    commands appear to go nowhere. Does
    anyone have sample code showing how to draw
    to multiple windows (PC Windows)?
    Thank you.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,595

    Re: Muliple OpenGL Contexts in Windows

    Hi !

    Each window you want to render into needs it's own context, you use wglCreateContext to do that, one for each window you need to render to.

    When you want to render to a specific window you call wglMakeCurrent to make that context the one to use at the moment.

    That's all, be careful if you are using multithreading though.

    The msdn docs on the wgl functions should give you the information you need.

    Mikael

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2001
    Posts
    8

    Re: Muliple OpenGL Contexts in Windows

    Mikael,

    Thanks. Just after I posted my question, I
    saw in the OpenGL overview for Windows a
    statement that OpenGL can write ONLY to the
    client area of a non-child Window, not to a
    Control, which perhaps explains why what I
    tried did not work. Have you actually been
    able to use OpenGL to draw into a Control,
    for example, a "STATIC"?

    - Bob

  4. #4
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,595

    Re: Muliple OpenGL Contexts in Windows

    Hi !

    That could be tricky, but you can always create your own control to do it, you also do the rendering into the dialogbox itself:
    http://codeguru.earthweb.com/opengl/..._mapping.shtml

    Mikael

  5. #5
    Junior Member Newbie
    Join Date
    Dec 2001
    Posts
    8

    Re: Muliple OpenGL Contexts in Windows

    Mikael,

    Thanks for the reference to codeguru.
    I see I will need to create a sub-class
    of Dialog to make this work.

    - Bob

Similar Threads

  1. Replies: 2
    Last Post: 10-30-2013, 07:13 PM
  2. Windows 8: creating OpenGL contexts and win32
    By raybender in forum OpenGL: Windows
    Replies: 1
    Last Post: 05-31-2012, 05:22 PM
  3. Multiple Windows & Rendering Contexts
    By Rennie Johnson in forum OpenGL: Windows
    Replies: 2
    Last Post: 09-08-2007, 11:55 PM
  4. Multiple Rendering Contexts in Windows...
    By xenovore in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 12-01-2000, 05:07 AM
  5. Device Contexts in Windows
    By imported_ben in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 06-23-2000, 01:19 PM

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