Hi Shuiying, You will need to use an RGBA colour buffer, so make sure your are creating a graphics context with a alpha value of 8 set. See osgcamera example for an example of manually setting up the graphics context.
Robert. On Wed, Oct 26, 2011 at 1:17 PM, wang shuiying <[email protected]> wrote: > Hello, > > I try to write information of other things rather than that of color > into gl_FragColor through programmable fragment shader. > > e.g. gl_FragColor = vec4(0.1,0.2,0.3,0.2); > > However, whatever value I set gl_color.a(the fourth element above) > through fragment shader, I get the value of 1 when access the frame > buffer. > > I tried to work out this problem by adding following code : > > osg::ColorMask* cm = new osg::ColorMask(true,true,true,true); > > > NodeOfRenderingObject->getOrCreateStateSet()->setAttributeAndModes(cm,osg::StateAttribute::ON); > > > NodeOfRenderingCamera->getOrCreateStateSet()->setAttributeAndModes(cm,osg::StateAttribute::ON); > > But the corresponding value of gl_color.a in frame buffer remains to be 1. > > > Could anybody give any advice? > > Thank you very much in advance! > > Best regards > > Shuiying > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

