Horde3D

Next-Generation Graphics Engine
It is currently 24.11.2024, 23:37

All times are UTC + 1 hour




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: 04.06.2008, 14:53 
Offline

Joined: 14.04.2008, 15:06
Posts: 183
Location: Germany
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.


Top
 Profile  
Reply with quote  
PostPosted: 04.06.2008, 20:42 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
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.


Top
 Profile  
Reply with quote  
PostPosted: 04.06.2008, 21:18 
Offline

Joined: 14.04.2008, 15:06
Posts: 183
Location: Germany
That's an even better idea.


Top
 Profile  
Reply with quote  
PostPosted: 08.06.2008, 15:15 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
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?


Top
 Profile  
Reply with quote  
PostPosted: 08.06.2008, 15:58 
Offline

Joined: 14.04.2008, 15:06
Posts: 183
Location: Germany
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.


Top
 Profile  
Reply with quote  
PostPosted: 13.06.2008, 11:16 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
In the current SVN trunk, init now reinitializes the states if Horde3D has been initialized before.


Top
 Profile  
Reply with quote  
PostPosted: 13.06.2008, 11:50 
Offline

Joined: 14.04.2008, 15:06
Posts: 183
Location: Germany
I've just tested it and it works :)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group