Show
Ignore:
Timestamp:
03/25/09 00:17:05 (6 years ago)
Author:
robert
Message:

Added support for image streams

Files:
1 modified

Legend:

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

    r9124 r9967  
    2323#include <osgUtil/Optimizer> 
    2424 
     25#include <osg/ImageStream> 
    2526#include <osg/Geode> 
    2627#include <osg/Notify> 
     
    3637osg::Geode* createSectorForImage(osg::Image* image, osg::TexMat* texmat, float s,float t, float radius, float height, float length) 
    3738{ 
     39    bool flip = image->getOrigin()==osg::Image::TOP_LEFT; 
    3840 
    3941    int numSegments = 20; 
     
    7577        coords->push_back(osg::Vec3(sinf(angle)*radius,cosf(angle)*radius,-height*0.5f)); // bottom. 
    7678         
    77         tcoords->push_back(osg::Vec2(angle/ThetaZero+0.5f,1.0f)); // top 
    78         tcoords->push_back(osg::Vec2(angle/ThetaZero+0.5f,0.0f)); // bottom. 
     79        tcoords->push_back(osg::Vec2(angle/ThetaZero+0.5f, flip ? 0.0f : 1.0f)); // top 
     80        tcoords->push_back(osg::Vec2(angle/ThetaZero+0.5f, flip ? 1.0f : 0.0f)); // bottom. 
    7981 
    8082    } 
     
    107109        if (imageLeft.valid() && imageRight.valid()) 
    108110        { 
     111            osg::ImageStream* streamLeft = dynamic_cast<osg::ImageStream*>(imageLeft.get()); 
     112            if (streamLeft) streamLeft->play(); 
     113         
     114            osg::ImageStream* streamRight = dynamic_cast<osg::ImageStream*>(imageRight.get()); 
     115            if (streamRight) streamRight->play(); 
     116             
     117         
    109118            float average_s = (imageLeft->s()+imageRight->s())*0.5f; 
    110119            float average_t = (imageLeft->t()+imageRight->t())*0.5f;