diff --git a/src/osg/ShapeDrawable.cpp b/src/osg/ShapeDrawable.cpp index 2a10a3a8e..7245443da 100644 --- a/src/osg/ShapeDrawable.cpp +++ b/src/osg/ShapeDrawable.cpp @@ -61,10 +61,14 @@ class DrawShapeVisitor : public ConstShapeVisitor void DrawShapeVisitor::apply(const Sphere& sphere) { + glPushMatrix(); glTranslatef(sphere.getCenter().x(),sphere.getCenter().y(),sphere.getCenter().z()); + bool drawFrontFace = _hints ? _hints->getCreateFrontFace() : true; + bool drawBackFace = _hints ? _hints->getCreateBackFace() : false; + unsigned int numSegments = 40; unsigned int numRows = 20; if (_hints && _hints->getDetailRatio() != 1.0f) { @@ -83,70 +87,144 @@ void DrawShapeVisitor::apply(const Sphere& sphere) float angleDelta = osg::PI*2.0f/(float)numSegments; float texCoordHorzDelta = 1.0f/(float)numSegments; - float lBase=-osg::PI*0.5f; - float rBase=0.0f; - float zBase=-sphere.getRadius(); - float vBase=0.0f; - float nzBase=-1.0f; - float nRatioBase=0.0f; - - for(unsigned int rowi=0; rowi