- Timestamp:
- 07/25/05 15:05:57 (8 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgprerendercubemap/osgprerendercubemap.cpp
r4395 r4414 188 188 189 189 190 osg::Group* createShadowedScene(osg::Node* reflectedSubgraph, osg::RefNodePath reflectorNodePath, unsigned int unit, const osg::Vec4& clearColor )190 osg::Group* createShadowedScene(osg::Node* reflectedSubgraph, osg::RefNodePath reflectorNodePath, unsigned int unit, const osg::Vec4& clearColor, unsigned tex_width, unsigned tex_height, osg::CameraNode::RenderTargetImplementation renderImplementation) 191 191 { 192 192 193 193 osg::Group* group = new osg::Group; 194 195 unsigned int tex_width = 512;196 unsigned int tex_height = 512;197 194 198 195 osg::TextureCubeMap* texture = new osg::TextureCubeMap; … … 221 218 222 219 // tell the camera to use OpenGL frame buffer object where supported. 223 camera->setRenderTargetImplmentation( osg::CameraNode::FRAME_BUFFER_OBJECT);220 camera->setRenderTargetImplmentation(renderImplementation); 224 221 225 222 // attach the texture and use it as the color buffer. … … 277 274 arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()); 278 275 arguments.getApplicationUsage()->addCommandLineOption("-h or --help", "Display this information"); 276 arguments.getApplicationUsage()->addCommandLineOption("--fbo","Use Frame Buffer Object for render to texture, where supported."); 277 arguments.getApplicationUsage()->addCommandLineOption("--fb","Use FrameBuffer for render to texture."); 278 arguments.getApplicationUsage()->addCommandLineOption("--pbuffer","Use Pixel Buffer for render to texture, where supported."); 279 arguments.getApplicationUsage()->addCommandLineOption("--window","Use a seperate Window for render to texture."); 280 arguments.getApplicationUsage()->addCommandLineOption("--width","Set the width of the render to texture"); 281 arguments.getApplicationUsage()->addCommandLineOption("--height","Set the height of the render to texture"); 279 282 280 283 // construct the viewer. … … 293 296 return 1; 294 297 } 298 299 unsigned tex_width = 512; 300 unsigned tex_height = 512; 301 while (arguments.read("--width", tex_width)) {} 302 while (arguments.read("--height", tex_height)) {} 303 304 osg::CameraNode::RenderTargetImplementation renderImplementation = osg::CameraNode::FRAME_BUFFER_OBJECT; 305 306 while (arguments.read("--fbo")) { renderImplementation = osg::CameraNode::FRAME_BUFFER_OBJECT; } 307 while (arguments.read("--pbuffer")) { renderImplementation = osg::CameraNode::PIXEL_BUFFER; } 308 while (arguments.read("--fb")) { renderImplementation = osg::CameraNode::FRAME_BUFFER; } 309 while (arguments.read("--window")) { renderImplementation = osg::CameraNode::SEPERATE_WINDOW; } 310 295 311 296 312 // any option left unread are converted into errors to write out later. … … 310 326 if (!reflectedSubgraph.valid()) return 1; 311 327 312 ref_ptr<Group> reflectedScene = createShadowedScene(reflectedSubgraph.get(),createReflector(),0, viewer.getClearColor()); 328 ref_ptr<Group> reflectedScene = createShadowedScene(reflectedSubgraph.get(), createReflector(), 0, viewer.getClearColor(), 329 tex_width, tex_height, renderImplementation); 313 330 314 331 scene->addChild(reflectedScene.get());
