you have to render the scene first then save the image. Have a look at
osgprerender examples. Mimic the code and save the image from the Camera
DrawCallback

Nick

http://www.linkedin.com/in/tnick


On Fri, Jan 22, 2010 at 3:27 AM, Danny Lesnik <[email protected]> wrote:

> Hi,
>
>
> I tried the following code
>
>
> Code:
>
>        osg::ref_ptr<osg::Image> shot = new osg::Image();
>        shot->allocateImage(640, 480, 24, GL_RGB, GL_UNSIGNED_BYTE);
> osg::ref_ptr<osg::Camera> camera = _viewer->getCamera();
> _viewer->frame();
> camera->attach(osg::Camera::COLOR_BUFFER, shot.get());
> osgDB::writeImageFile(*shot, "test.png" );
>
>
>
>
> but still black image. How can I solve the issue.
>
> Thank you!
>
> Cheers,
> Danny
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=23033#23033
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to