Re: [osg-users] Preferred method for per-context uniforms

2013-10-24 Thread Robert Osfield
Hi Arelien, On 24 October 2013 15:11, Aurelien Albert wrote: > Will this works with shared contexts ? > Shared context will have the same ContextID's but they will have seperate osg::State and osg::GraphicsContexts, as well as seperate CullVisitor etc. You can use an internal map for any of the

Re: [osg-users] Preferred method for per-context uniforms

2013-10-24 Thread Aurelien Albert
Hi Robert, > The CullVisitor::getRenderInfo() method could be used to access to the > osg::State object and hence ContextID that is relevant to the current cull > traversal. Will this works with shared contexts ? Thank you! Cheers, Aurelien -- Read this topic online here:

Re: [osg-users] Preferred method for per-context uniforms

2013-10-24 Thread Robert Osfield
On 24 October 2013 14:41, Glenn Waldron wrote: > Well, Paul did ask for per-context uniforms. But re-reading the original > post, it's evident that the GC ID is not available during cull anyway ... > so scratch that idea :) > The CullVisitor::getRenderInfo() method could be used to access to the

Re: [osg-users] Preferred method for per-context uniforms

2013-10-24 Thread Glenn Waldron
Well, Paul did ask for per-context uniforms. But re-reading the original post, it's evident that the GC ID is not available during cull anyway ... so scratch that idea :) Glenn Waldron / @glennwaldron On Thu, Oct 24, 2013 at 9:14 AM, Aurelien Albert < aurelien.alb...@alyotech.fr> wrote: > Hi,

Re: [osg-users] Preferred method for per-context uniforms

2013-10-24 Thread Aurelien Albert
Hi, > And then index that by the GC ID if it's available through the > cv->getCurrentCamera(). That's a bit different for my solution : - in my idea, you get "per-view" uniforms : even if multiple views runs with the same graphics context, you still have different uniforms - in your idea, y

Re: [osg-users] Preferred method for per-context uniforms

2013-10-24 Thread Glenn Waldron
Another idea would be a subclass of Uniform (MultiplexingUniform?) that you can program per context. Or, a variation on Aurelien's approach would be to use: osg::buffered_object> multiUniform; And then index that by the GC ID if it's available through the cv->getCurrentCamera(). This would be

Re: [osg-users] Preferred method for per-context uniforms

2013-10-24 Thread Aurelien Albert
Hi, At cull traversal, I do the following (this is pseudo-code!) : Code: cullTraversal(pCullVisitor) { // Get per-view-data perViewData = getOrCreatePerViewData(pCullVisitor); // Compute "dynamic" uniforms perViewData.pDynamicUniform_1->set(value); perViewData.pDynamicUnifor

Re: [osg-users] Preferred method for per-context uniforms

2013-10-24 Thread Gaëtan André
Hi, I am also interesting in this topic. How do you push 'dynamic" Uniforms at cull traversal ? Does it work well of multi-threading is activated ? Cheers, Gaëtan 2013/10/24 Aurelien Albert > Hi, > > > > If you have just a single uniform value per context then I'd simply > place the Uniform

Re: [osg-users] Preferred method for per-context uniforms

2013-10-24 Thread Aurelien Albert
Hi, > If you have just a single uniform value per context then I'd simply place the > Uniform on the each if the viiewer's osg::Camera's StateSet, such that each > Camera assigned to each Context gets it's own state inherited down including > the Uniform. > Some nodes have a cull callback.

Re: [osg-users] Preferred method for per-context uniforms

2013-10-23 Thread Lionel Lagarde
Hi, We have to manage some similar problems. We have different shaders and different uniforms in the same scene graph. Some nodes have a cull callback. During the cull traversal, the callback identify the current view/context and push the corresponding state set in the render graph, traverse

Re: [osg-users] Preferred method for per-context uniforms

2013-10-23 Thread Robert Osfield
HI Paul, If you have just a single uniform value per context then I'd simply place the Uniform on the each if the viiewer's osg::Camera's StateSet, such that each Camera assigned to each Context gets it's own state inherited down including the Uniform. If you want to put a vector of Uniform in th

[osg-users] Preferred method for per-context uniforms

2013-10-23 Thread Paul Martz
Hi all -- I've been inactive with OSG lately, but from time to time get called back. Given my lack of recent experience, I would appreciate your help with this issue. I have a multicontext/multidisplay app that needs to compute a uniform during cull, and it will have a different value for each con