Hi,

An odd problem, and not sure quite how to describe. But here goes....

The quick summary is:  When I cull certain geometry from my scene, an openGL 
shader seems to get applied to the root node (and thus the whole scene) rather 
than just the geometry it belongs on, but ONLY at the start up of the app.  
When those same conditions are in place later, it works just fine. Whats 
happening at start up?

More detailed:  I have two pieces of geometry (geom1, geom2), they both have 
individual shaders applied to them respectively (shad1, shad2).   I have 
keyboard controls to toggle the geometry on and off in the scene.  My first 
hacky attempt at toggling (for quickness, and lack of knowledge of other 
mechanisms), I just translated the geometry out of view to toggle them 'off'.  
So on start up both geoms were 'off' out of view.  But having geom2 out of view 
at startup resulted in shad1 being applied to the root node. When I toggled it 
(or anything else) 'on', all the sudden all shaders were applied appropriately. 
And remained correct for all toggling off and on. I.e, the startup error was 
not reproducable once into the app.  And geom1 and geom2 are totally unrelated. 
Both are children of the root. 

After finding the osgSwitch node, I reworked the code so that the toggling was 
done with SetAllChildrenOff/On() of a switch node parenting each of the geoms.  
If at startup, I set them on initially, all is well. But when I set them off 
for startup (desired), then it starts up with shad1 applied to the root again 
and shading the whole scene. Then if I toggle anything (geom1 or geom2), 
everyting snaps into working order and all is well.

So there's just something at startup when shader geometry is culled initially 
that is confusing the application of the shader, but is fine later.  What is 
going on here?  I dont even know what code to post here, as the shader code 
seems to be ok, since it works in all cases other than startup.

Hope I articulated this clearly. Any ideas?


Thank you!

Cheers,
Phil

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





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

Reply via email to