Show
Ignore:
Timestamp:
09/04/06 14:52:09 (8 years ago)
Author:
robert
Message:

Cleaned up the texture setup code.

Files:
1 modified

Legend:

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

    r5522 r5523  
    132132    geom->setUseDisplayList(false); 
    133133 
    134     // setup texture 
    135     osg::TextureRectangle* texture = new osg::TextureRectangle; 
    136  
    137134    // load image 
    138135    osg::Image* img = osgDB::readImageFile(filename); 
    139     texture->setImage(img); 
     136 
     137    // setup texture 
     138    osg::TextureRectangle* texture = new osg::TextureRectangle(img); 
     139 
     140    osg::TexMat* texmat = new osg::TexMat; 
     141    texmat->setScaleByTextureRectangleSize(true); 
    140142 
    141143    // setup state 
    142144    osg::StateSet* state = geom->getOrCreateStateSet(); 
    143145    state->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON); 
    144  
    145     // setup state 
    146     osg::TexMat* texmat = new osg::TexMat; 
    147     texmat->setScaleByTextureRectangleSize(true); 
    148146    state->setTextureAttributeAndModes(0, texmat, osg::StateAttribute::ON); 
    149147