Show
Ignore:
Timestamp:
06/24/03 17:40:09 (11 years ago)
Author:
don
Message:

*** empty log message ***

Files:
1 modified

Legend:

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

    r1957 r1983  
    2121#include <osg/Geode> 
    2222 
     23#include <osg/Group> 
    2324#include <osg/Projection> 
    2425#include <osg/MatrixTransform> 
    25  
    2626#include <osgText/Text> 
    2727 
     
    138138    geom->setUseDisplayList(false); 
    139139 
    140     osg::Geode* geode = new osg::Geode; 
    141     geode->addDrawable(geom); 
    142  
    143140    // setup texture 
    144141    osg::TextureRectangle* texture = new osg::TextureRectangle; 
    145     texture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP); 
    146     texture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP); 
    147142 
    148143    // load image 
    149144    osg::Image* img = osgDB::readImageFile(filename); 
    150145    texture->setImage(img); 
    151      
     146 
     147    // setup state 
    152148    osg::StateSet* state = geom->getOrCreateStateSet(); 
    153149    state->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON); 
     
    157153 
    158154    // install 'update' callback 
     155    osg::Geode* geode = new osg::Geode; 
     156    geode->addDrawable(geom); 
    159157    geode->setUpdateCallback(new TexturePanCallback(geom, img)); 
    160158     
     
    191189 
    192190    // add text 
    193     osg::Vec3 pos(150.0f, 800.0f, 0.0f); 
     191    osg::Vec3 pos(120.0f, 800.0f, 0.0f); 
    194192    const osg::Vec3 delta(0.0f, -80.0f, 0.0f); 
    195193 
     
    197195        "TextureRectangle Mini-HOWTO", 
    198196        "- essentially behaves like Texture2D, *except* that:", 
    199         "- tex coords must be non-normalized (0..width) instead of (0..1)", 
    200         "- wrap mode must be CLAMP, CLAMP_TO_EDGE, or CLAMP_TO_BORDER", 
    201         "- repeating wrap modes are *not* supported", 
    202         "- texture border is *not* supported", 
    203         "- texture mipmaps are *not* supported", 
     197        "- tex coords must be non-normalized (0..pixel) instead of (0..1)", 
     198        "- wrap modes must be CLAMP, CLAMP_TO_EDGE, or CLAMP_TO_BORDER\n  repeating wrap modes are not supported", 
     199        "- filter modes must be NEAREST or LINEAR since\n  mipmaps are not supported", 
     200        "- texture borders are not supported", 
     201        "- defaults should be fine", 
    204202        NULL 
    205203    }; 
     
    227225{ 
    228226    osg::Group* root = new osg::Group; 
    229      
    230     osg::BoundingBox bb(0.0f,0.0f,0.0f,1.0f,1.0f,1.0f); 
    231     root->addChild(createRectangle(bb, filename)); // XXX 
     227 
     228    if (filename != "X") { 
     229        osg::BoundingBox bb(0.0f,0.0f,0.0f,1.0f,1.0f,1.0f); 
     230        root->addChild(createRectangle(bb, filename)); // XXX 
     231    } 
    232232 
    233233    root->addChild(createHUD());