Made the use of the new projection and modelview matrix uniforms optional

This commit is contained in:
Robert Osfield
2009-10-11 06:05:19 +00:00
parent f479eb174c
commit 9e2567cb88
5 changed files with 45 additions and 6 deletions

View File

@@ -20,6 +20,7 @@
#include <osgDB/ReadFile>
#include <osgDB/WriteFile>
#include <osgViewer/Viewer>
#include <osgGA/TrackballManipulator>
class ConvertToVertexAttibArrays : public osg::NodeVisitor
{
@@ -329,5 +330,19 @@ int main(int argc, char *argv[])
// add a viewport to the viewer and attach the scene graph.
viewer.setSceneData(loadedModel.get());
viewer.setCameraManipulator(new osgGA::TrackballManipulator());
viewer.realize();
// switch on the uniforms that track the modelview and projection matrices
osgViewer::Viewer::Windows windows;
viewer.getWindows(windows);
for(osgViewer::Viewer::Windows::iterator itr = windows.begin();
itr != windows.end();
++itr)
{
(*itr)->getState()->setUseModelViewAndProjectionUniforms(true);
}
return viewer.run();
}