Hi, I'm new here, and don't have a ton of experience with OSG.
I'm trying to draw a simple volume and would like to know what is the most appropriate way to do so. All shapes I will be drawing will have two faces (front and back) with equal number of sides and the corresponding connected sides. Basically, they will be extruded shapes where the front and back faces are not necessarily the same dimensions or parallel, though they will have the same basic shape. The method I tried is found at http://www.openscenegraph.org/documentation/NPSTutorials/osgGeometry.html. My function differs in that I am passing in two vectors: one with the coordinates of the front face and one for the back face. They are both ordered to draw the faces counter clockwise (CCW) as viewed from the outside. The volume object will be only one color, so I don't care about setting different colors for each vertex or face. The problem is that after it draws the volume the sides are not distinguishable from one another. Rotating the camera allows me to see that the shape is correct. The color only shows up if you are viewing from one angle. Rotating 180 degrees results in the volume displaying completely black. I have tried replacing the code to add the color with the following: /////////////////////////////////////////////////////////////////////////////// // Grab the state set of the node, this will a StateSet if one does not exist osg::ref_ptr<osg::StateSet> state (geometry->getOrCreateStateSet()); //Creating the material object osg::ref_ptr<osg::Material> mat (new osg::Material); mat->setShininess(osg::Material::FRONT_AND_BACK,96.f); //Specifying the yellow colour of the object mat->setDiffuse(osg::Material::FRONT,osg::Vec4(.9f,.9f,.2f,1.0f)); //Attaching the newly defined state set object to the node state set state->setAttribute(mat.get()); /////////////////////////////////////////////////////////////////////////////// This is a much easier way to give color to the volume, but I still have the same problem with the color only being visible from below the volume. I've changed the faces in both the setShininess and setDiffuse to both BACK and FRONT_AND_BACK with no luck. I've also looked at the osgshape example included with the download. This draws a three-sided pyramid- which seems very similar to what I want to do- using a ConvexHull object. I tried using this, but it seems that this method draws only triangles. The colors show up correctly, though. Am I on the right track? Is there an easier or more efficient way to draw a 3d object given the coordinates of all vertices? ... Thank you! Cheers, Evan ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=15117#15117 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

