Cleaned up the texture setup code.

This commit is contained in:
Robert Osfield 2006-09-04 12:52:09 +00:00
parent f0277df858
commit 5212d66cab

View File

@ -131,20 +131,18 @@ osg::Node* createRectangle(osg::BoundingBox& bb,
// disable display list so our modified tex coordinates show up
geom->setUseDisplayList(false);
// setup texture
osg::TextureRectangle* texture = new osg::TextureRectangle;
// load image
osg::Image* img = osgDB::readImageFile(filename);
texture->setImage(img);
// setup texture
osg::TextureRectangle* texture = new osg::TextureRectangle(img);
osg::TexMat* texmat = new osg::TexMat;
texmat->setScaleByTextureRectangleSize(true);
// setup state
osg::StateSet* state = geom->getOrCreateStateSet();
state->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);
// setup state
osg::TexMat* texmat = new osg::TexMat;
texmat->setScaleByTextureRectangleSize(true);
state->setTextureAttributeAndModes(0, texmat, osg::StateAttribute::ON);
// turn off lighting