On 03/12/2012 02:02 PM, Jason Daly wrote:
You can also define a function in one shader, and have it called from
another shader. This way, you can switch behavior by using different
implementations of the same function. Shader A implements the shader's
main() function and defines the prototype for function foo(), which is
called in main(). Function foo() is implemented in both shader A and
shader B, using the prototype defined in shader A, but each having
different code. In one case, you attach shaders A and C to the program,
and in the other case, you attach shaders B and C.
Hang on, I messed that up :-)
I meant shader A defines main() and the prototype for foo(). Shaders B
and C each define an implementation of foo(), with different sets of
code. In one case, you attach shaders A and B to the program, and in
the other, you attach shaders A and C. This allows foo() to behave
differently, depending on which shader (e.g.: which implementation of
foo() ) is attached to the program.
Sorry for the confusion :-)
--"J"
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org