I’m working on an application that looks like this:
http://img511.imageshack.us/img511/3230/immagine1yi2.png
In the central zone I’m gonna render the scene, while on the small panel on the right (under the “immagine” label) I want to show the texture associated to the selected object from the main scene.
Since the main rendering frame and the panel on the right have different window handles, I thought it would be cool to use two rendering contexts.
But why I need an OpenGL rendering context for showing just a texture? Well, that’s simple: the textures can also be created on the fly by a shader, so I won’t have a physical copy of it and simply fill a picture box with it.
The application is written in C# and uses an OpenGL rendering engine (also made by me) written in C++ as a DLL. So, I can easily create two instances of the rendering engine and use it in this way (simply put):
while(true){
Application.DoEvents();
Engine1.grabContext(); //wglMakeCurrent(…);
Engine1.renderScene();
Engine2.grabContext();
Engine2.renderScene();
}
but doing two wglMakeCurrent for each frame is fugly and also causes a HUGE drop on performance.
Can you suggest an alternative way? Someone told me to use glScissors but I can’t see how this helps me (I’m not rendering in the same frame!).
Thanks!
Michele