yzhyakyhh 发表于 2014-7-21 16:42:43

osg如何才能将glsl着色器渲染过之后的纹理贴图导出为png文件?

osg如何才能将glsl着色器渲染过之后的纹理贴图导出为png文件?

the_mercury 发表于 2014-7-23 12:48:38

osg::ref_ptr<osgDB::ReaderWriter> readerWriter = new osgDB::ReaderWriter();

osg::ref_ptr<osg::Texture2D> texture = …;// your texture
osg::ref_ptr<osg::Image> image = texture->getImage();

// file_name with a suffix of .png
readerWriter->writeImage(image, file_name);


上面的代码就行了.

yzhyakyhh 发表于 2014-7-29 17:54:52

虽然使用了the_mercury您的代码提示之后仍然没有成功的将glsl着色之后的纹理贴图效果导出来,但还是谢谢你的回复。我再去找找其他的方法试试看。

heishuijing2222 发表于 2016-3-18 11:42:51

可以创建FBO绑定一张纹理,作为GLSL PASS的输出,然后把这个纹理写成png
页: [1]
查看完整版本: osg如何才能将glsl着色器渲染过之后的纹理贴图导出为png文件?