[osg-users] RTT With Background Alpha
osgforum at tevs.eu
Mon Apr 11 14:03:26 PDT 2011
Thanks for the link JP. I didn't see anything drastically different in what you were doing, so I started fiddling around with a bunch of the different parameters that MAY have something to do with the issue.
After no success there, I realized what I needed was an osg::TexEnv. I created a TexEnv with the DECAL mode and the black background (that should have been transparent) became transparent as I envisioned.
The table about halfway down this page (http://www.opengl.org/sdk/docs/man/xhtml/glTexEnv.xml) helped me understand what was happening. I'm not sure what 'TexEnv' is used if one isn't set, but it appears the same as when a MODULATE TexEnv is used. GL_MODULATE multiplies the existing and incoming alpha values, losing the transparency (even though I would think the alpha would stay at zero - zero times something is still zero, right??).
Anyhow, you can try adding the following lines to the osgprerender example if you're interested in what I was going for:
osg::TexEnv* texenv = new osg::TexEnv( osg::TexEnv::DECAL );
stateset->setTextureAttributeAndModes( 1, texenv );
The only thing remaining that I'd like to do is to have the alpha from newer texture renders 'darken' the existing alpha. If you remember, I disabled clearing the color buffer, so I'd like my overlay to darken if there are repeated passes over a particular area of the texture (I'm only using solid colors, so it would look a bit better than it would with the cessna 8) ).
Is this possible using the color buffer as I am, or would I have to implement a shader to get this to work?
Thanks for the help guys!
Read this topic online here:
More information about the osg-users