Results 1 to 4 of 4

Thread: Best way to get Multiple OpenGL Windows in Win32

  1. #1
    Senior Member Regular Contributor
    Join Date
    Jan 2002
    Location
    Kingston, Jamaica, W.I.
    Posts
    282

    Best way to get Multiple OpenGL Windows in Win32

    I was trying to create multiple windows in OpenGL by creating an OpenGLwnd class derived from CWnd and then defining as many as I needed as children of my main window. However only the last one will render and it does not render properly. I remember vaguely that the device context may be locked to one window. Is this the source of the problem? If so what solutions exist?

    I was thinking of trying multiple viewports, but was wondering if switching between viewports will create too much overhead?

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

    Re: Best way to get Multiple OpenGL Windows in Win32

    Hi !

    Yes !, you must use wglMakeCurrent(...) before you render anything in your OpenGL windows to select the context to use.

    It does have some overhead, if just need 4 viewports or something like that I would say it's better to use one window and split it up with glViewport().

    This has been discussed in the past on this list so if you do a search you will find more about it.

    Mikael

  3. #3
    Senior Member Regular Contributor
    Join Date
    Jan 2002
    Location
    Kingston, Jamaica, W.I.
    Posts
    282

    Re: Best way to get Multiple OpenGL Windows in Win32

    Thanks. Much appreciated.

  4. #4
    Senior Member Regular Contributor
    Join Date
    Jan 2002
    Location
    Kingston, Jamaica, W.I.
    Posts
    282

    Re: Best way to get Multiple OpenGL Windows in Win32

    Just a follow up. If I create two windows via Viewports and double buffering is enabled, I will have to redraw each viewport each frame? If so, does it mean that swapbuffers clears out the back buffer each time it is called, hence previous images can't be reused?

    If this is true, what if I have an image where only a small section of it changes at a time? I was hoping to just change that section (no depth buffer being used) instead of redrawing the image. The section is random, so it makes a mess of display lists. Also the entire image it takes long to display (9 secs) since I don't have an OpenGL compliant card (I am hoping to make the program useable on PC's without OpenGL acceleration). The section that changes is typically less than 10 tri's which draws in no time. I've heard about auxillary buffers so theoretically I can update an auxillary buffer that won't get redrawn then blit the image to the back buffer. However I understand that not all PCs support an auxillary buffer.

    What's the best thing to do then?

Similar Threads

  1. C++ Win32 multiple GL windows
    By Herr Bohm in forum OpenGL: Basic Coding
    Replies: 11
    Last Post: 03-29-2007, 07:40 AM
  2. c++ win32 multiple windows
    By Herr Bohm in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 09-11-2006, 12:41 PM
  3. Using OpenGL with Child Windows (Win32)
    By AcidInjury in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-05-2003, 08:09 AM
  4. choosing multiple fonts using VC++ win32 API in openGL
    By kashif saeed in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-24-2003, 10:55 AM
  5. win32, child windows, opengl
    By totoronet in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-05-2001, 10:59 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