Results 1 to 4 of 4

Thread: Multiple OpenGL rendering contexts

  1. #1

    Multiple OpenGL rendering contexts

    Has anyone used multiple windows/rendering contexts?

    I'm working on a map editor for my project and I wanted to add a preview window for the material editor, so that the textures/shaders can be seen in action right away.

    However, I haven't figured out the way to deal with the contexts, should I have a thread running for each context and use that for drawing on that particular context? I tried using one thread for both contexts and I keep getting "invalid operation" OpenGL errors. When using application idle event everything works but a bit choppy, the animation etc. isn't smooth enough this way.

    I'm doing this in Delphi/Windows, but a cross-platform friendly method would be nice to have.
    If you develop an idiot proof system, the nature develops better idiots.

  2. #2

    Multiple OpenGL rendering contexts

    Don't you just use wglMakeCurrent to change contexts between each rendering and remember to share resources for all the contexts? I would do that and just render each context on each idle event

    That's the only way I can think of pulling it. And I have no idea how you would manage contexts on another platform
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

  3. #3
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Multiple OpenGL rendering contexts

    Im using DirectX and make 4 directx instances (yes, I know I should use swap chaining...), 1 3D view, a top, left and front view. I suggest to look for some swap channing or something...
    I think NeHe has some tutorials on it. http://nehe.gamedev.net/
    NecroSOFT - End of line -

  4. #4

    Multiple OpenGL rendering contexts

    I modified the OpenGL window class that I used to share the textures and display lists.

    For now I'll use the application idle event for rendering. Everything seems to work ok and I haven't got any OpenGL errors anymore.

    Guess I'll have a look on this in Lazarus to see how it could be done in a cross-platform way.
    If you develop an idiot proof system, the nature develops better idiots.

Bookmarks

Posting Permissions

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