[osg-users] Issue on sharing shaders between objects
hellhound at binary-revolution.org
hellhound at binary-revolution.org
Mon Jun 2 00:54:49 PDT 2008
Hello,
i've successfully implemented a simple dot3 object shading for my scene and
it works fine with single objects. Now i try to share the shaders between
different objects in the scene and got some trouble:
To share the shaders i've one osg::Program, where i've added two osg::Shader
objects. The osg::Program instance is shared between the objects and applied
to their osg::StateSet objects. The required osg::Uniform objects are created
explicit for each object and bind to their osg::StateSet in a separated process.
So only the osg::Program and osg::Shader are Shared (later i will share the
equal uniforms too).
The shader works, but it's effected on all objects equals to the object where
the osg::Program has applied first. I.e. i've added two normal mapped cubes in
the scene. When i set the light between both cubes i expect that both cube faces
are enlighted arround the light, but on the 2nd cube the thame face of the first
cube is enlighted...
Have i consider something special for the sharing of (object) shaders between
objects?
Best regards,
Christian
More information about the osg-users
mailing list