Changeset 305 for osgVisual/trunk/src/distortion
- Timestamp:
- Jul 19, 2011, 9:47:13 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/trunk/src/distortion/visual_distortion.cpp
r247 r305 97 97 OSG_NOTIFY(osg::WARN) << "WARNING: Unable to parse Frustum values from '" << pre_cfg<<channelname<<post_cfg << "' -- continue without valid frustum values." << std::endl; 98 98 } 99 if( attr_name == "renderimplementation" ) 100 { 101 if(attr_value=="fbo") 102 renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT; 103 if(attr_value=="pbuffer") 104 renderImplementation = osg::Camera::PIXEL_BUFFER; 105 if(attr_value=="pbuffer-rtt") 106 renderImplementation = osg::Camera::PIXEL_BUFFER_RTT; 107 if(attr_value=="fb") 108 renderImplementation = osg::Camera::FRAME_BUFFER; 109 if(attr_value=="window") 110 renderImplementation = osg::Camera::SEPERATE_WINDOW; 111 } 112 if( attr_name == "width" ) 99 if( attr_name == "width" ) 113 100 { 114 101 std::stringstream sstr(attr_value); … … 185 172 tex_width = 2048; 186 173 tex_height = 2048; 187 renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT;188 useTextureRectangle = false;189 174 useShaderDistortion = false; 190 175 useHDR = false; … … 270 255 271 256 // texture to render to and to use for rendering of flag. 272 osg::Texture* texture = 0; 273 if (useTextureRectangle) 274 { 275 osg::TextureRectangle* textureRect = new osg::TextureRectangle; 276 textureRect->setTextureSize(tex_width, tex_height); 277 textureRect->setInternalFormat(GL_RGBA); 278 textureRect->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR); 279 textureRect->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR); 280 281 texture = textureRect; 282 } 283 else 284 { 285 osg::Texture2D* texture2D = new osg::Texture2D; 286 texture2D->setTextureSize(tex_width, tex_height); 287 texture2D->setInternalFormat(GL_RGBA); 288 texture2D->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR); 289 texture2D->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR); 290 291 texture = texture2D; 292 } 257 //osg::Texture* texture = 0; 258 osg::Texture2D* texture = new osg::Texture2D; 259 texture->setTextureSize(tex_width, tex_height); 260 texture->setInternalFormat(GL_RGBA); 261 texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR); 262 texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR); 263 264 //texture = texture2D; 293 265 294 266 if (useHDR) … … 328 300 osg::Vec3 yAxis(0.0f,1.0f,0.0f); 329 301 osg::Vec3 zAxis(0.0f,0.0f,1.0f); 330 float height = 1024.0f;331 float width = 1280.0f;302 float width = 1600.0f; 303 float height = 900.0f; 332 304 int noSteps = 128; 333 305 if (useShaderDistortion) … … 423 395 camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); 424 396 camera->setViewMatrix(osg::Matrix::identity()); 425 //sceneCamera->setProjectionMatrixAsOrtho2D(0,viewer->getCamera()->getViewport()->width(),0,viewer->getCamera()->getViewport()->height()); 426 camera->setProjectionMatrixAsOrtho2D(0,1280,0,1024); 427 /** \todo: use screen size dynamically */ 428 397 camera->setProjectionMatrixAsOrtho2D(0,1600,0,900); /** \todo: use screen size dynamically */ 398 429 399 // set the camera to render before the main camera. 430 400 camera->setRenderOrder(osg::Camera::POST_RENDER, 200); 431 401 432 402 // only clear the depth buffer 433 403 camera->setClearMask(0); … … 495 465 496 466 // tell the camera to use OpenGL frame buffer object where supported. 497 camera->setRenderTargetImplementation( renderImplementation);467 camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); 498 468 499 469 // attach the texture and use it as the color buffer. 500 camera->attach(osg::Camera::COLOR_BUFFER, texture); // No Multisampling/Antialiasing501 //camera->attach(osg::Camera::COLOR_BUFFER, texture, 0, 0, false, 4, 4); // 4x Multisampling/Antialiasing470 //camera->attach(osg::Camera::COLOR_BUFFER, texture); // No Multisampling/Antialiasing 471 camera->attach(osg::Camera::COLOR_BUFFER, texture, 0, 0, false, 4, 4); // 4x Multisampling/Antialiasing 502 472 503 473 // add subgraph to render
Note: See TracChangeset
for help on using the changeset viewer.