The standard way to modify aloha in OpenGL fixed function (non-shader)
rendering is to use glBlendColor and set a blending function of
GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR.
 
Hope that helps.
 
Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com <http://www.skew-matrix.com/> 
+1 303 859 9466
 


  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Nicholas
Bannister
Sent: Wednesday, August 27, 2008 9:00 AM
To: [email protected]
Subject: [osg-users] *.osg File Transparency


ORIGINAL:

I have loaded a *.osg file and I am using and osg::StateSet and
setting a material to have an alpha value of 0.5 to set the
transparency.
The problem is that it comes out only transparent on one side and
completely Grey scale.

I suspect that that the Materials set within the *.osg file are
overriding and/or interfering with my settings.
How do I go about setting the global transparency, and thus overriding
any local transparency settings, front and back faces, while still
maintaining all the the colors of all the child nodes from the osg
file.

this is what i have

node = osgDB::readNodeFile( qPrintable(fullPathCopy) );


if (!node)
       return false;

osg::StateSet* state = node->getOrCreateStateSet();
state->setMode(GL_BLEND,osg:: 
StateAttribute::ON|
osg::StateAttribute::OVERRIDE);
osg::Material* mat = new osg::Material;
mat->setAlpha(osg::Material::FRONT_AND_BACK, 0.8);
state->setAttributeAndModes(mat,osg::StateAttribute::ON |
osg::StateAttribute::OVERRIDE);
osg::BlendFunc* bf = new osg::BlendFunc(osg::BlendFunc::SRC_ALPHA,
osg::BlendFunc::ONE_MINUS_SRC_ALPHA );
state->setAttributeAndModes(bf);
state->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
state->setMode(GL_LIGHTING, osg::StateAttribute::ON);
node->setState


NEW:

after playing with the code a little bit, i realize that what i want to be
able to do
is override ONLY the transparency and have all the colors remain the same.
So the parent node transparency override ONLY the child node transparency,
but not the child nodes color.


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

Reply via email to