You might need to explicitly ask for alpha when you create the context. Grep for
DisplaySettings / read through its header.
-Paul
Dženan Zukić wrote:
Hi,
I am using the following code to save contents of the framebuffer into a file:
[code]vis->getCamera()->setClearColor(osg::Vec4(0.5f,0.5f,1.0f,0.0f)); //in
constructor
class MyPostDrawCallback : public osg::Camera::DrawCallback
{
private:
int _w, _h;
std::string fn;
public:
MyPostDrawCallback(int w, int h, std::string filename): _w(w), _h(h),
fn(filename) {}
void operator () ( const osg::Camera& cam ) const
{
osg::ref_ptr<osg::Image> rImage = new osg::Image;
rImage->readPixels( 0, 0, _w, _h, GL_RGBA, GL_UNSIGNED_BYTE );
osgDB::writeImageFile( *rImage, fn );
}
};
void MainLogic::screenshot(std::string filename)
{
mainForm.vis->getCamera()->setPostDrawCallback(
new MyPostDrawCallback(mainForm.vis->width(),
mainForm.vis->height(), filename));
mainForm.vis->frame();
mainForm.vis->getCamera()->setPostDrawCallback(0);
}[/code]
I expected that setting the clear color alpha to 0 would result in transparent
background in the saved .png file. It is not so. Is that even possible, and if
it is, how?
Thank you!
Cheers,
Dženan[/code]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=30778#30778
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org