- Timestamp:
- 06/24/03 17:40:09 (10 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgtexturerectangle/osgtexturerectangle.cpp
r1957 r1983 21 21 #include <osg/Geode> 22 22 23 #include <osg/Group> 23 24 #include <osg/Projection> 24 25 #include <osg/MatrixTransform> 25 26 26 #include <osgText/Text> 27 27 … … 138 138 geom->setUseDisplayList(false); 139 139 140 osg::Geode* geode = new osg::Geode;141 geode->addDrawable(geom);142 143 140 // setup texture 144 141 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);147 142 148 143 // load image 149 144 osg::Image* img = osgDB::readImageFile(filename); 150 145 texture->setImage(img); 151 146 147 // setup state 152 148 osg::StateSet* state = geom->getOrCreateStateSet(); 153 149 state->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON); … … 157 153 158 154 // install 'update' callback 155 osg::Geode* geode = new osg::Geode; 156 geode->addDrawable(geom); 159 157 geode->setUpdateCallback(new TexturePanCallback(geom, img)); 160 158 … … 191 189 192 190 // add text 193 osg::Vec3 pos(1 50.0f, 800.0f, 0.0f);191 osg::Vec3 pos(120.0f, 800.0f, 0.0f); 194 192 const osg::Vec3 delta(0.0f, -80.0f, 0.0f); 195 193 … … 197 195 "TextureRectangle Mini-HOWTO", 198 196 "- 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", 204 202 NULL 205 203 }; … … 227 225 { 228 226 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 } 232 232 233 233 root->addChild(createHUD());
