Re: [osg-users] Save the image from computer shader

2016-10-17 Thread Robert Osfield
HI Liu,

I'm not the author of the osgcomputeshaders example so can't off the
top of my head put your code snippet in context.  If the text2D is a
texture that is being written to then it won't have an osg::Image
assigned to it, the data will just reside on the GPU.  You need to use
a post or final draw callback with a glRealPixels or
osg::Image::readPixels() if you want to retrieve that data from the
GPU.

Robert


On 15 October 2016 at 17:58, liu ming <81792...@qq.com> wrote:
> Hi,
>
> I am learning  the osg example "osgcomputeshaders",I have a problem that how 
> can I save the image(the result of a computation) from shaders to my folder ? 
> I use the code :
>
>
> Code:
>while(!viewer.done())
> {
>
> viewer.frame();
>
> osgDB::writeImageFile(*(tex2D->getImage(0)),"abc.jpg");
> }
>
>
>
> but it do not work,Could somebody give some suggestions ?
>
> Thank you!
>
> Cheers,
> liu
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=69019#69019
>
>
>
>
>
> ___
> 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


[osg-users] Save the image from computer shader

2016-10-15 Thread liu ming
Hi,

I am learning  the osg example "osgcomputeshaders",I have a problem that how 
can I save the image(the result of a computation) from shaders to my folder ? I 
use the code :

 
Code:
   while(!viewer.done())
{

viewer.frame();

osgDB::writeImageFile(*(tex2D->getImage(0)),"abc.jpg");
}



but it do not work,Could somebody give some suggestions ?

Thank you!

Cheers,
liu

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org