Hi Peter

You can attach an image to the camera doing the rtt.

osg::Image *image = new osg::Image;
image->allocateImage(tex_width, tex_height, 1, GL_RGBA, GL_UNSIGNED_BYTE);

// attach the image so its copied on each frame.
camera->attach(osg::Camera::COLOR_BUFFER, image);

Rafa.



On Tue, Aug 25, 2009 at 12:22 PM, Peter Wraae Marino<osgh...@gmail.com> wrote:
> Hi Maxim ,
>
> I believe the readPixels is reading from the framebuffer and not the
> texture (or am I mistaken??)
> remember a RTT usually means I have 2 or more cameras in my scene...
> where one is used
> to do the RTT... so this can lead to a question how would osg::Image
> know which buffer to read from?
>
> Peter
>
> On Tue, Aug 25, 2009 at 12:16 PM, Maxim Gammer<maxgam...@gmail.com> wrote:
>> Hi...
>>
>> osg::ref_ptr<osg::Image> image = new osg::Image;
>>
>> image->readPixels..... example
>>
>> if (osgDB::writeImageFile(*image,_filename))
>>
>> {
>>
>> std::cout << "Saved screen image to `"<<_filename<<"`"<< std::endl;
>>
>> }
>>
>> 2009/8/25 Peter Wraae Marino <osgh...@gmail.com>
>>>
>>> Hi osgUsers,
>>>
>>> I have a question about texture to file. Currently I have render to
>>> texture (RTT) and would like to save this texture to a file. Is there
>>> a straight forward method of doing this?
>>>
>>> anyone?
>>>
>>> --
>>> Regards,
>>> Peter Wraae Marino
>>>
>>> www.osghelp.com - OpenSceneGraph support site
>>> _______________________________________________
>>> osg-users mailing list
>>> osg-users@lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>>
>> --
>> Maxim Gammer
>>
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
>
>
> --
> Regards,
> Peter Wraae Marino
>
> www.osghelp.com - OpenSceneGraph support site
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Rafael Gaitán Linares
Instituto de Automática e Informática Industrial  http://www.ai2.upv.es
Ciudad Politécnica de la Innovación
Universidad Politécnica de Valencia
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to