Jump to content
  • Advertisement
Sign in to follow this  
tmason

OpenGL Request for Advice - Needing two OpenGL windows to display to...

This topic is 1513 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

For an Oculus Rift project I need to have two windows open.

The first window is the Oculus Rift window which needs to have the highest framerate possible.

The second window needs to be displayed on screen and it is not a priority window but needs to display what is going on in the first window.

I read up on creating multiple contexts with OpenGL but from what I gather that kills framerate.

I was thinking that somehow I can do a glBltFrameBuffer from the Oculus Rift window's output to a smaller display that goes on the user's main display but is that the best way to go?

Thank you for your time.

Share this post


Link to post
Share on other sites
Advertisement
You can have one context, two windows.
Just switch the hDC (1st argument) with the wglMakeCurrent/glxMakeCurrent call but use the same context (2nd argument).

It works **much** better than having two contexts.
The tricky part though, is VSync. You probably want to call swapbuffers once, not twice (i.e. one per window). This tends to be driver specific (i.e. do it wrong and the framerate will be 30fps, do it right, and framerate will be 60fps). You'll have to do some experimentation.

For this method to work, both windows must have the exact same pixel format and antialising options (can have different resolutions though), otherwise the wglMakeCurrent call will fail when you try the second hDC.

Share this post


Link to post
Share on other sites

You can have one context, two windows.
Just switch the hDC (1st argument) with the wglMakeCurrent/glxMakeCurrent call but use the same context (2nd argument).

It works **much** better than having two contexts.
The tricky part though, is VSync. You probably want to call swapbuffers once, not twice (i.e. one per window). This tends to be driver specific (i.e. do it wrong and the framerate will be 30fps, do it right, and framerate will be 60fps). You'll have to do some experimentation.

For this method to work, both windows must have the exact same pixel format and antialising options (can have different resolutions though), otherwise the wglMakeCurrent call will fail when you try the second hDC.

 

Cool; seems like a working way to go.

 

I'll give this a try and report back via another thread...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!