Horde3D http://horde3d.org/forums/ |
|
[solved] Multiple windows: Context sharing http://horde3d.org/forums/viewtopic.php?f=3&t=358 |
Page 1 of 1 |
Author: | Codepoet [ 04.06.2008, 14:53 ] |
Post subject: | [solved] Multiple windows: Context sharing |
While debugging a problem with my code I realized that the whole engine state is not shared across contexts: In the primary window backface culling is active, in the secondary it's disabled. Quote: Every window in pyglet has its own OpenGL context. Each context has its own OpenGL state, including the matrix stacks and current flags. However, contexts can optionally share their objects with one or more other contexts. Shareable objects include: Textures Display lists Shader programs Vertex and pixel buffer objects Framebuffer objects (this is not pyglet specific) More infos This means that a part of the initialization of the renderer has to be done per Context instead of once per application to get the state right. I'd suggest adding a function "Horde3D::initContext" which initializes the current context and is called automatically by "Horde3D::init" to initialize the initial context. Affected code: egRenderer.cpp, init: only "Init Opengl states" egRendererBase.cpp, init more? I'm not sure in which way the EngineOptions are affected by this bug. |
Author: | marciano [ 04.06.2008, 20:42 ] |
Post subject: | Re: Multiple windows: Context sharing |
You are right, Horde currently expects to be run in a single context. Your proposition is a possibility to fix this, another option would be that you can call 'init' a second time and the function just (re)sets the states in that case. |
Author: | Codepoet [ 04.06.2008, 21:18 ] |
Post subject: | Re: Multiple windows: Context sharing |
That's an even better idea. |
Author: | marciano [ 08.06.2008, 15:15 ] |
Post subject: | Re: Multiple windows: Context sharing |
Did you already have a chance to try out if it is really enough to set the mentioned states in order to use a second context? |
Author: | Codepoet [ 08.06.2008, 15:58 ] |
Post subject: | Re: Multiple windows: Context sharing |
I've done no further tests. I'm using a multi window setup with shared contexts and calling Horde3D::resize before drawing to a window. It just works, I even didn't see any problems until I realized that the culling is handled differently depending on the context. When I do "Init OpenGL states" by hand after creating a new shared context culling works the same on all contexts. So as long as the contexts are shared setting these states should fix the problem. |
Author: | Volker [ 13.06.2008, 11:16 ] |
Post subject: | Re: Multiple windows: Context sharing |
In the current SVN trunk, init now reinitializes the states if Horde3D has been initialized before. |
Author: | Codepoet [ 13.06.2008, 11:50 ] |
Post subject: | Re: Multiple windows: Context sharing |
I've just tested it and it works |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |