- Timestamp:
- 04/25/07 17:32:33 (6 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgparametric/osgparametric.cpp
r6108 r6554 14 14 15 15 #include <osgViewer/Viewer> 16 #include <osgViewer/StatsHandler> 16 17 17 18 #include <iostream> … … 88 89 }; 89 90 90 osg::Node* createModel(const std::string& shader, const std::string& textureFileName, const std::string& terrainFileName )91 osg::Node* createModel(const std::string& shader, const std::string& textureFileName, const std::string& terrainFileName, bool dynamic, bool vbo) 91 92 { 92 93 osg::Geode* geode = new osg::Geode; … … 113 114 114 115 osg::Uniform* coeff = new osg::Uniform("coeff",osg::Vec4(1.0,-1.0f,-1.0f,1.0f)); 115 coeff->setUpdateCallback(new UniformVarying);116 116 117 stateset->addUniform(coeff); 117 stateset->setDataVariance(osg::Object::DYNAMIC); 118 119 if (dynamic) 120 { 121 coeff->setUpdateCallback(new UniformVarying); 122 coeff->setDataVariance(osg::Object::DYNAMIC); 123 stateset->setDataVariance(osg::Object::DYNAMIC); 124 } 125 118 126 } 119 127 else if (shader=="matrix") … … 226 234 } 227 235 228 // geom->setUseVertexBufferObjects(true);236 geom->setUseVertexBufferObjects(vbo); 229 237 230 238 return geode; … … 244 252 osgViewer::Viewer viewer; 245 253 254 // add the stats handler 255 viewer.addEventHandler(new osgViewer::StatsHandler); 256 246 257 std::string shader("simple"); 247 258 while(arguments.read("-s",shader)) {} … … 253 264 while(arguments.read("-d",terrainFileName)) {} 254 265 266 bool dynamic = true; 267 while(arguments.read("--static")) { dynamic = false; } 268 269 bool vbo = false; 270 while(arguments.read("--vbo")) { vbo = true; } 271 255 272 // if user request help write it out to cout. 256 273 if (arguments.read("-h") || arguments.read("--help")) … … 259 276 return 1; 260 277 } 261 278 262 279 // load the nodes from the commandline arguments. 263 osg::Node* model = createModel(shader,textureFileName,terrainFileName );280 osg::Node* model = createModel(shader,textureFileName,terrainFileName, dynamic, vbo); 264 281 if (!model) 265 282 {
