Changeset 10731 for OpenSceneGraph/trunk/examples/osgshape/osgshape.cpp
- Timestamp:
- 11/10/09 13:01:28 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgshape/osgshape.cpp
r6941 r10731 21 21 #include <osg/Material> 22 22 #include <osg/Texture2D> 23 #include <osgUtil/ShaderGen> 23 24 24 25 #include <osgViewer/Viewer> 25 26 26 27 #include <osgDB/ReadFile> 28 #include <osgDB/WriteFile> 27 29 28 30 #include <osg/Math> … … 35 37 osg::Geode* geode = new osg::Geode(); 36 38 39 37 40 // --------------------------------------- 38 41 // Set up a StateSet to texture the objects … … 41 44 42 45 osg::Image* image = osgDB::readImageFile( "Images/lz.rgb" ); 43 44 46 if (image) 45 47 { 46 48 osg::Texture2D* texture = new osg::Texture2D; 47 49 texture->setImage(image); 48 stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON); 50 texture->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR); 51 stateset->setTextureAttributeAndModes(0,texture, osg::StateAttribute::ON); 49 52 } 50 53 54 stateset->setMode(GL_LIGHTING, osg::StateAttribute::ON); 55 51 56 geode->setStateSet( stateset ); 57 52 58 53 59 float radius = 0.8f; … … 99 105 mesh->setIndices(indices); 100 106 geode->addDrawable(new osg::ShapeDrawable(mesh)); 101 107 102 108 return geode; 103 109 }
