>  It doesn't sound reasonable that the Collada loader has created one drawable 
> for all the geometry that shares a shader group across different high-level 
> objects, unless it and you can be sure that you never need to manipulate the 
> objects position, etc. seperately. On the other hand, it is entirely 
> reasonable that the loader created one StateSet for that shader group, 
> sharing the StateSet between all the drawables containing geometry that uses 
> the shader group. If you're making changes to a StateSet that's used by one 
> of these drawables, you'll see it in all the others that use it. If you're 
> using getOrCreateStateSet to get a state set from one of these drawables and 
> then bang on it, you're changing the shared state set.
> 
 

You're absolutely right.  My problem is an assumption that I made after I 
initially experimented with binding a stateset to a drawable.  At the time I 
just used getOrCreateStateSet after finding the drawable, then modified it.  I 
mistakenly thought I was pointing to a single drawable, since it seemed to 
impact them all, but I realize now I was modifying the stateset that was 
already shared between the drawables.  Based on this assumption, when I wrote 
my node visitor to find a drawable, I used the logic that I could stop 
traversing as soon as I found the drawable, since it referenced all of the 
faces associated with a shader group.  This worked ok for a while, but when I 
changed the code to start sharing statesets and started using setStateSet, I 
was really only setting the SS for a single drawable when I assumed I was 
setting it for all.

So I suppose my choices are to a) continue to just find the one drawable and 
modify the stateset that's already applied to it using getOrCreateStateSet(), 
or b) just search for all of the drawables with that name and use setStateSet() 
to apply the stateset we create.  

The problem with the first method is that it assumes whatever plugin we use to 
load the geometry is going to create a shared stateset for us automagically.  
We are fairly set on using collada, but I think I'm going to go with option B 
to be safe.  

In any case, I appreciate the response.  It has helped clear up what was really 
happening.

Thanks!

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=24509#24509





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to