Changeset 9442
- Timestamp:
- 01/05/09 18:06:09 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgpoints/osgpoints.cpp
r7648 r9442 25 25 #include <osg/Texture2D> 26 26 #include <osg/PointSprite> 27 #include <osg/PolygonMode> 27 28 28 29 #include <iostream> … … 116 117 arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); 117 118 arguments.getApplicationUsage()->addCommandLineOption("--sprites","Point sprites."); 118 119 arguments.getApplicationUsage()->addCommandLineOption("--points","Sets the polygon mode to GL_POINT for front and back faces."); 120 119 121 120 122 // construct the viewer. … … 133 135 bool usePointSprites = false; 134 136 while (arguments.read("--sprites")) { usePointSprites = true; }; 137 138 bool forcePointMode = false; 139 while (arguments.read("--points")) { forcePointMode = true; }; 135 140 136 141 if (arguments.argc()<=1) … … 159 164 160 165 166 osg::StateSet* stateset = loadedModel->getOrCreateStateSet(); 161 167 if (usePointSprites) 162 168 { 163 osg::StateSet* stateset = loadedModel->getOrCreateStateSet();164 165 169 /// Setup cool blending 166 170 osg::BlendFunc *fn = new osg::BlendFunc(); … … 175 179 tex->setImage(osgDB::readImageFile("Images/particle.rgb")); 176 180 stateset->setTextureAttributeAndModes(0, tex, osg::StateAttribute::ON); 181 } 182 183 if( forcePointMode ) 184 { 185 /// Set polygon mode to GL_POINT 186 osg::PolygonMode *pm = new osg::PolygonMode( 187 osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::POINT ); 188 stateset->setAttributeAndModes( pm, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); 177 189 } 178 190
