Jump to content
  • Advertisement
Sign in to follow this  
squashed_bug

[.net] Multiple SimpleOpenGlControl [SOLVED]

This topic is 3845 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

Im writing a Level Editor, using Tao for opengl and need multiple SimpleOpenGlControl's (multiple instances of opengl). The problem is when I make a gl call I have no idea which opengl context the call goes to. Thank in advance. [SOLVED] SimpleOpenGlControl.MakeCurrent() does the trick [Edited by - squashed_bug on July 26, 2006 11:02:15 PM]

Share this post


Link to post
Share on other sites
Advertisement
Hi, I have the same problem. Could you or someone else please explain how exactly I can handle this behaviour with this method?

Share this post


Link to post
Share on other sites
In OpenGL, there is the concept of the "current OpenGL context". While may create multiple concurrent OpenGL contexts, only one can be current in a given thread.

OpenGL commands only affect the current context. To redirect OpenGL commands to a different context, you have to make that context current in the relevant thread, by using the wgl/glxMakeCurrent family of functions. SimpleOpenGlControl provides a method called MakeCurrent() which, as you can imagine, makes the context associated with that SimpleOpenGlControl current.

The easiest way to handle this with SimpleOpenGlControl is to place a call to MakeCurrent() at the top of each event handler that calls OpenGL functions. Note, however, that MakeCurrent() is a costly function so you should try to find ways to minimizes this kind of context switching (easier said than done).

Share this post


Link to post
Share on other sites
The other approach is to use clipping and render the scene more than once. I think NeHe has a couple good examples of doing a single window with multiple views.

Share this post


Link to post
Share on other sites
Thanx. Performance is not such a big problem, cause it will be just a small tool without shaders or something like that.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!