[osg-users] Setting alpha channel in Frag Shader does not work.

Steven Powers osgforum at tevs.eu
Thu Mar 12 12:27:24 PDT 2009


Camera Set up:
       
Code:

                _image = new osg::Image();
                _image->allocateImage(_camera->getViewport()->width(),_camera->getViewport()->height(), 1, GL_RGBA, GL_FLOAT);
            }
            _image->setInternalTextureFormat(GL_RGBA32F_ARB);
            _image->setPixelFormat(GL_RGBA);
            _image->setDataType(GL_FLOAT);

            //redirect rendering to frame buffer object
            _camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
            _camera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER0),_image.get());
            _camera->setRenderOrder(osg::Camera::PRE_RENDER);




In the shader I set: 

Code:
 gl_FragData[0] =vec4(0.12, 5, 0.000705882, 1); 



I can retrieve the RGB values. 
However, if I set the alpha channel to anything but 1 ie:

Code:
gl_FragData[0] =vec4(0.12, 5, 0.000705882, .5);



I seem to get random values. 

Any idea why this is happening?

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








More information about the osg-users mailing list