Show
Ignore:
Timestamp:
06/15/11 11:35:25 (2 years ago)
Author:
robert
Message:

From Anthousis Andreadis, added multiple sampling test for multiple rendering targets which is activated by the --ms command line option.

Files:
1 modified

Legend:

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

    r12292 r12531  
    195195// Here a scene consisting of a single quad is created. This scene is viewed by the screen camera. 
    196196// The quad is textured using a shader and the multiple textures generated in the RTT stage. 
    197 osg::Node* createScene(osg::Node* cam_subgraph, unsigned int tex_width, unsigned int tex_height, bool useHDR, bool useImage) 
     197osg::Node* createScene(osg::Node* cam_subgraph, unsigned int tex_width, unsigned int tex_height, bool useHDR, bool useImage, bool useMultiSample) 
    198198{ 
    199199    if (!cam_subgraph) return 0; 
     
    349349        // attach the textures to use 
    350350        for (int i=0; i<NUM_TEXTURES; i++) { 
    351             camera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER0+i), textureRect[i]); 
     351            if (useMultiSample) 
     352                camera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER0+i), textureRect[i], 0, 0, false, 4, 4); 
     353            else 
     354                camera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER0+i), textureRect[i]); 
     355 
     356                 
    352357        } 
    353358      
     
    417422    while (arguments.read("--image")) { useImage = true; } 
    418423 
     424    bool useMultiSample = false; 
     425    while (arguments.read("--ms")) { useMultiSample = true; } 
     426 
    419427    osg::Group* subGraph = createRTTQuad(tex_width, tex_height, useHDR); 
    420428 
    421429    osg::Group* rootNode = new osg::Group(); 
    422     rootNode->addChild(createScene(subGraph, tex_width, tex_height, useHDR, useImage)); 
     430    rootNode->addChild(createScene(subGraph, tex_width, tex_height, useHDR, useImage, useMultiSample)); 
    423431 
    424432    // add model to the viewer.