Hi Robert,
I have just unpacked the zip file, but am not sure yet what I'm going to be
looking at. These are mods that provide what functionality, what should I
be expecting the example to do?
The idea here is to load any osg supported node file and then convert all the
FFP StateAttributes to shaders. For example:
osg::ref_ptr<osg::Node> node = osgDB::readNodeFiles(arguments);
and then with ...
osgEx::ShaderComposerHelper sch;
sch.apply(node.get());
... you can convert all FFP attributes found in scene to shaders. Then the
shader composition must be enabled:
osgViewer::ViewerBase::Windows windows;
viewer.getWindows(windows);
for(osgViewer::ViewerBase::Windows::iterator itr = windows.begin();
itr != windows.end();
++itr)
{
(*itr)->getState()->setShaderCompositionEnabled(true);
(*itr)->getState()->setUseModelViewAndProjectionUniforms(true);
(*itr)->getState()->setUseVertexAttributeAliasing(true);
(*itr)->getState()->setShaderComposer(new osgEx::ShaderComposer);
}
.. and at this point all you have are one or more shader programs and then the
viewer can be run as usual.
At the time, I wasn't able to find node file that containing all the various
FFP attributes, so the example is a bit crowded with the code for the test
scene .
If you are trying to compile the example, then you will first need to checkout
SVN revision 13962 and then overwrite the files and enable OSG_EXPERIMENTAL
option in cmake. You can find complete FFP emulation shader in
examples/osgshadercomposerhelper/ShaderInjections.cpp.glsl, which is the main
source to feed the shader composer.
Robert Milharcic
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org