Changeset 8430
- Timestamp:
- 06/12/08 17:57:36
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
OpenSceneGraph-TrainingMaterials/trunk/Sources/Exercises/06_nodes/6h_TexGenNode/6h_TexGenNode.cpp
r8100 r8430 2 2 #include <osg/ClipNode> 3 3 #include <osg/PositionAttitudeTransform> 4 #include <osg/Texture2D> 4 5 5 6 #include <osgDB/ReadFile> … … 48 49 if (!model) 49 50 { 50 std::cout<<"Usage: 6h_TexGenNode earth/earth.ive"<<std::endl;51 std::cout<<"Usage: 6h_TexGenNode Earth/earth.ive"<<std::endl; 51 52 return 1; 52 53 } … … 56 57 // the projection should be from above looking down the Z axis, with the 57 58 // the projected texture covering about 1/4 of the model. 59 60 osg::Image* image = osgDB::readImageFile("Images/lz.rgb"); 61 if (!image) 62 { 63 std::cout<<"Could not load Images/lz.rgb"<<std::endl; 64 return 1; 65 } 66 67 osg::Group* group = new osg::Group; 68 69 group->addChild(model.get()); 70 71 osg::StateSet* stateset = group->getOrCreateStateSet(); 72 stateset->setTextureAttributeAndModes(0,new osg::Texture2D(image), osg::StateAttribute::ON); 73 74 viewer.setSceneData(group); 58 75 } 59 76
