Changeset 362


Ignore:
Timestamp:
Apr 22, 2012, 9:05:32 PM (13 years ago)
Author:
Torben Dannhauer
Message:
 
Location:
experimental/distortionNG
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • experimental/distortionNG/extViewer.cpp

    r361 r362  
    2121#include <osg/Switch>
    2222#include <osg/PolygonOffset>
     23#include <osg/PolygonMode>
    2324#include <osg/Texture2D>
    2425#include <osg/TextureRectangle>
     
    269270                osg::Geode* meshGeode = new osg::Geode();
    270271                root->addChild(meshGeode, true);        // Child #0  (adds mesh,shader,.. so camera renders mesh (and  thus render the scene))
    271                
    272272
    273273                // new we need to add the scene texture to the mesh, we do so by creating a
    274         // StateSet to contain the Texture StateAttribute.
     274        // Modify StateSet to contain the Texture StateAttribute.
    275275            osg::StateSet* stateset = meshGeode->getOrCreateStateSet();
    276276        stateset->setTextureAttributeAndModes(_distortionSet->getTexUnitScene(), sceneTexture,osg::StateAttribute::ON);
    277277        stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
     278                // Modify StateSet to protectit agaiunst state changes by the stateset Manipulator
     279                osg::PolygonMode* polyModeObj = new osg::PolygonMode;
     280        stateset->setAttribute(polyModeObj, osg::StateAttribute::PROTECTED|osg::StateAttribute::ON);
    278281
    279282                osg::TexMat* texmat = new osg::TexMat;
  • experimental/distortionNG/main.cpp

    r361 r362  
    8787    // add the state manipulator
    8888    viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
    89         //viewer.addEventHandler( new osgGA::StateSetManipulator);
    9089       
    9190    // add the stats handler
     
    122121                }
    123122    }
     123        viewer.setSceneData( rootnode );
    124124
    125125        // run the viewers main loop
     
    199199 * Laden des Containers.
    200200 * reset distortion funktioniert.
    201  * statesetmanipulator muss auf die scene, nicht auf mesh losgehen.
    202  *
    203201 * Anwenden der distortion auf die Meshknoten oder die texturekoordinaten
    204202 *
    205  * alternativ:
    206203 * - umstellung der koordinaten auf [0-1]
     204 * oder alternativ:
    207205 * - speichern der hieght und width im container so daß das mesh an andere Bildschirmgrößen angepasst werden kann.
    208206 
Note: See TracChangeset for help on using the changeset viewer.