Using osg & third party libraries, I have added a cone to my application in the 
specified color. However, I have not been able to get the cone to be anything 
other than opaque. Is this possible or am I doing something wrong?
Code:
static osg::Cone* cone = NULL;
float height = 1000.0; // for now
double coneHeading = 0.0; // for now, pointing North
double angle = 90.0; // for now, parallel to ground

double radius = height * tan(osg::DegreesToRadians(22.5 / 2.0));
// the center of the cone, by default is the center of mass (1/4 from center of 
base to apex)
cone = new osg::Cone(osg::Vec3(0.0f, 0.0f, 0.0f), radius, height);
// adjust the center to be at the apex according to the angle of rotation
osg::Quat quaternion(
    osg::DegreesToRadians(angle), osg::Vec3(1, 0, 0), // rotate so parallel to 
ground +/- some
    osg::DegreesToRadians(0.0), osg::Vec3(0, 1, 0),
    osg::DegreesToRadians(-coneHeading), osg::Vec3(0, 0, 1)); // rotate so 
pointing North
osg::Vec3 center = quaternion * osg::Vec3(0.0f, 0.0f, -(height * 0.75f));
cone->setCenter(center);
cone->setRotation(quaternion);
osg::Geode* geode = new osg::Geode;
osg::ShapeDrawable* drawable = new osg::ShapeDrawable(cone);
drawable->setColor(osg::Vec4f(1.0, 0.0, 0.0, 0.2));
geode->addDrawable(drawable); 



------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=45098#45098





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to