Show
Ignore:
Timestamp:
06/18/08 16:21:22 (7 years ago)
Author:
robert
Message:

Added --fbo-samples value and --color-samples value command line paramters for enabling fbo multisampling

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgprerender/osgprerender.cpp

    r8217 r8448  
    201201 
    202202 
    203 osg::Node* createPreRenderSubGraph(osg::Node* subgraph, unsigned tex_width, unsigned tex_height, osg::Camera::RenderTargetImplementation renderImplementation, bool useImage, bool useTextureRectangle, bool useHDR) 
     203osg::Node* createPreRenderSubGraph(osg::Node* subgraph,  
     204                                   unsigned tex_width, unsigned tex_height,  
     205                                   osg::Camera::RenderTargetImplementation renderImplementation,  
     206                                   bool useImage, bool useTextureRectangle, bool useHDR,  
     207                                   unsigned int samples, unsigned int colorSamples) 
    204208{ 
    205209    if (!subgraph) return 0; 
     
    360364 
    361365            // attach the image so its copied on each frame. 
    362             camera->attach(osg::Camera::COLOR_BUFFER, image); 
     366            camera->attach(osg::Camera::COLOR_BUFFER, image, 
     367                           samples, colorSamples); 
    363368             
    364369            camera->setPostDrawCallback(new MyCameraPostDrawCallback(image)); 
     
    377382        { 
    378383            // attach the texture and use it as the color buffer. 
    379             camera->attach(osg::Camera::COLOR_BUFFER, texture); 
     384            camera->attach(osg::Camera::COLOR_BUFFER, texture,  
     385                           0, 0, false, 
     386                           samples, colorSamples); 
    380387        } 
    381388 
     
    428435    } 
    429436 
    430     unsigned tex_width = 1024; 
    431     unsigned tex_height = 512; 
     437    unsigned int tex_width = 1024; 
     438    unsigned int tex_height = 512; 
     439    unsigned int samples = 0; 
     440    unsigned int colorSamples = 0; 
     441     
    432442    while (arguments.read("--width", tex_width)) {} 
    433443    while (arguments.read("--height", tex_height)) {} 
     
    440450    while (arguments.read("--fb")) { renderImplementation = osg::Camera::FRAME_BUFFER; } 
    441451    while (arguments.read("--window")) { renderImplementation = osg::Camera::SEPERATE_WINDOW; } 
     452    while (arguments.read("--fbo-samples", samples)) {} 
     453    while (arguments.read("--color-samples", colorSamples)) {} 
    442454 
    443455    bool useImage = false; 
     
    470482 
    471483    osg::Group* rootNode = new osg::Group(); 
    472     rootNode->addChild(createPreRenderSubGraph(loadedModelTransform,tex_width,tex_height, renderImplementation, useImage, useTextureRectangle, useHDR)); 
     484    rootNode->addChild(createPreRenderSubGraph(loadedModelTransform,tex_width,tex_height, renderImplementation, useImage, useTextureRectangle, useHDR, samples, colorSamples)); 
    473485 
    474486    // add model to the viewer.