Hi Roger,
Mea culpa. I just missed it. I thought you had to override shaders in
the constructor.Thinking back I now remember that I had noticed the
setXXShader methods a while back I guess I had just forgotten them. I
assume that you still have to override the init to set up additonal
uniforms.
Not even. As I said, uniforms can be set anywhere you need them in your
scene graph (in the stateset of any node/drawable). The strategy we
chose was to have default values set at the root (so that the uniform
always has a valid value in the shader) and then if we need to set
different values for a given object, we can.
Examples of uniforms we have:
- lighting enabled (bool)
- active lights (bool array of 8 bools)
- fog enabled (bool)
- shadows enabled (bool)
- shadow casting light (int)
etc.
We could also have:
- fog type (int mapping to 0 = GL_LINEAR, 1 = GL_EXP and 2 = GL_EXP2)
- texgen type (int array where for each texture unit a type is given, 0
being off)
etc.
For some uniforms it makes no sense to have different values at
different points in the graph (fog type for example, though disabling
fog for specific objects makes sense) but that's how we manage this.
The point is that (at a high level anyways) a uniform variable is like
any other state attribute. It's added to a stateset (any stateset) and
can change value at any point in the graph.
Hope this helps,
J-S
--
______________________________________________________
Jean-Sebastien Guay [email protected]
http://www.cm-labs.com/
http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org