Ignore:
Timestamp:
Mar 16, 2012, 11:15:58 PM (13 years ago)
Author:
Torben Dannhauer
Message:
 
Location:
experimental/distortionNG
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • experimental/distortionNG/extViewer.cpp

    r337 r338  
    313313                geode->addDrawable(distortionMesh);
    314314
    315                 if (intensityMap && !applyIntensityMapAsColours)
    316                 {
    317                         //// create shaders for distortion
    318                         //osg::Program* distortProgram = new osg::Program;
    319                         //distortProgram->setName( "distortion" );
    320                         //osg::Shader* vShader = osg::Shader::readShaderFile( osg::Shader::VERTEX, "shader.vert" );
    321                         //vShader->setName("intensityMapVertShader");
    322                         //osg::Shader* fShader = osg::Shader::readShaderFile( osg::Shader::FRAGMENT, "shader.frag" );
    323                         //fShader->setName("intensityMapFragShader");
    324 
    325                         //if ( vShader && fShader )
    326                         //{
    327                         //      //distortProgram->addShader( vShader );
    328                         //      distortProgram->addShader( fShader );
    329                         //      stateset->addUniform( new osg::Uniform("sceneTexture", 0) );
    330                         //      stateset->addUniform( new osg::Uniform("intensityMapTexture", 1) );
    331                         //      stateset->setAttributeAndModes(distortProgram, osg::StateAttribute::ON);
    332                         //}
    333                 }
    334 
    335 
    336315        osg::ref_ptr<osg::Camera> camera = new osg::Camera;
    337316        camera->setGraphicsContext(gc.get());
     
    350329        camera->setViewMatrix(osg::Matrix::identity());
    351330
    352                 //// selector
    353                 //geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
    354                 //geode->getOrCreateStateSet()->setAttributeAndModes( new osg::PolygonOffset(1.0f, 1.0f) );
    355                 //osg::ref_ptr<distortionHandler> selector = new distortionHandler( camera, distortionMesh );
     331                // selector
     332                geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
     333                geode->getOrCreateStateSet()->setAttributeAndModes( new osg::PolygonOffset(1.0f, 1.0f) );
     334                osg::ref_ptr<distortionHandler> selector = new distortionHandler( camera, distortionMesh );
    356335                osg::ref_ptr<osg::Group> root = new osg::Group;
    357336                root->addChild(geode);
    358                 //root->addChild(selector->createVertexHighlighter());
    359                 //addEventHandler( selector.get() );
     337                root->addChild(selector->createVertexHighlighter());
     338                addEventHandler( selector.get() );
    360339                camera->addChild(root);
    361                 //// Avoid that the highlighter is culled away
    362                 //osg::CullSettings::CullingMode mode = camera->getCullingMode();
    363                 //camera->setCullingMode( mode & (~osg::CullSettings::SMALL_FEATURE_CULLING) );
     340                // Avoid that the highlighter is culled away
     341                osg::CullSettings::CullingMode mode = camera->getCullingMode();
     342                camera->setCullingMode( mode & (~osg::CullSettings::SMALL_FEATURE_CULLING) );
    364343
    365344
  • experimental/distortionNG/shader.frag

    r336 r338  
    11uniform sampler2DRect sceneTexture;
    22uniform sampler2DRect intensityMapTexture;
    3 in varying vec2 texcoord_scene;
    4 in varying vec2 texcoord_intensityMap;
     3varying vec2 texcoord_scene;
     4varying vec2 texcoord_intensityMap;
    55
    66void main(void)
  • experimental/distortionNG/shader.vert

    r335 r338  
    1 out varying vec2 texcoord_scene;
    2 out varying vec2 texcoord_intensityMap;
     1varying vec2 texcoord_scene;
     2varying vec2 texcoord_intensityMap;
    33
    44void main()
    55{
    66        gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
    7         texcoord_scene = vec2(gl_MultiTexCoord0);
    8         texcoord_intensityMap = vec2(gl_MultiTexCoord1);
     7        texcoord_scene = vec2(gl_MultiTexCoord0.xy);
     8        texcoord_intensityMap = vec2(gl_MultiTexCoord1.xy);
    99}
Note: See TracChangeset for help on using the changeset viewer.