[osg-users] Save the image from computer shader

Robert Osfield robert.osfield at gmail.com
Mon Oct 17 00:49:20 PDT 2016


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 <81792534 at 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 at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



More information about the osg-users mailing list