Results 1 to 2 of 2

Thread: Threads and OpenGL

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2002

    Threads and OpenGL

    I have a really simple need for threads in my application (WIN32):
    Open a window from the main application -> Render a scene in that window.
    I'd like to support multiple windows. Unfortunately, I see no simple way of doing this without using a separate thread per window - particularly being that each thread can have at most ONE rendering context. Has anybody out there done this before? I'm really pressed for time so some good, detailed info - or better yet source code - would really help.
    Also, I've read "when using multiple threads the modified message pump (using PeekMessage) should be replaced with the usual GetMessage/TranslateMessage combination." Could someone explain this? We're talking about the message pump in the main application ( or associated with the spawned window ), right?
    Thanks for the help.

  2. #2
    Member Newbie
    Join Date
    Oct 2002
    Rijeka, Croatia

    Re: Threads and OpenGL

    Rendering contexts are similar to device context. That means that each window with a handle has a DC, that also means that each window can be rendered separately.

    Use glMakeCurrent(handle, RC) to set current
    rendering context for OpenGL engine. Mind this: there is only one engine. CURRENT RC
    defines the output of the engine.


    glMakeCurrent (handle, RC1);
    // draw in window 1
    glMakeCurrent (handle, RC2);
    // draw in window 2;

Similar Threads

  1. OpenGL with threads
    By rakeshthp in forum OpenGL: Windows
    Replies: 8
    Last Post: 07-05-2013, 08:15 PM
  2. integrating threads with OpenGL
    By wikaman1 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-19-2012, 08:48 PM
  3. OpenGL VBO within multiple threads
    By Tiberiu in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-19-2012, 06:51 AM
  4. OpenGL and multiple threads
    By def in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 03-30-2004, 05:23 AM
  5. threads, Linux, OpenGL, ...
    By RAYtracer__ DREAMWALKER in forum OpenGL: Linux
    Replies: 0
    Last Post: 04-30-2001, 07:07 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