[osg-users] Value of a variable in shaders?
Robert Osfield
robert.osfield at gmail.com
Fri Sep 28 01:41:18 PDT 2018
Hi Marlin,
On Fri, 28 Sep 2018 at 07:40, Robert Osfield <robert.osfield at gmail.com> wrote:
> To pass data into shaders you have use a combination of uniforms (osg::Unfiorm), textures (osg::Textre*) and vertex attributes. With recent 3.4.x onwards you also have the option of passing in constants via #prama(tic) shader composition system that passes #define values into the compilation of shaders.
Seems I mis-read your question :-)
Testing internal values in shader is an easy thing to do, what I end
up doing is build up shaders bit by bit making sure each bit works on
it's own before I assemble it into a more complex shader. When I want
to test values I usually just set the fragment colour value, though
often this will have a processed version of the value to make it
visible. You can use #ifdef's in shaders to toggle the debug code
paths and even toggle these paths on/off via the
osg::StateSet::setDefine("ENABLE_DEBUG");
Robert.
More information about the osg-users
mailing list