Re: [osg-users] What is the right way to save a FBO texture to disk?

2012-06-06 Thread Robert Osfield
Hi John, I haven't done what you want before but the way I'd tackle it would be to use a Camera post draw callback to call state.applyAttribute(texture); then image-readImageFromCurrentTexture(..). Robert. On 5 June 2012 22:08, John Kaniarz john.kani...@us.army.mil wrote: My program has 4

Re: [osg-users] What is the right way to save a FBO texture to disk?

2012-06-06 Thread John Kaniarz
Thanks, I'll try that. Do I need to unapply the texture state when I'm done? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48076#48076 ___ osg-users mailing list osg-users@lists.openscenegraph.org

Re: [osg-users] What is the right way to save a FBO texture to disk?

2012-06-06 Thread Robert Osfield
On 6 June 2012 15:20, John Kaniarz john.kani...@us.army.mil wrote: Thanks, I'll try that. Do I need to unapply the texture state when I'm done? In theory osg::State should unapply it next time it does an State::apply() of the current state. Robert.

Re: [osg-users] What is the right way to save a FBO texture to disk?

2012-06-06 Thread John Kaniarz
It captured a texture, but not the texture I was looking for. Code: osg::State * state=renderInfo.getState(); state-applyAttribute(texture); osg::Image *image=new Image(); image-readImageFromCurrentTexture(renderInfo.getContextID(),false,GL_UNSIGNED_BYTE); osgDB::writeImageFile(*image,snap.png);

Re: [osg-users] What is the right way to save a FBO texture to disk?

2012-06-06 Thread Robert Osfield
On 6 June 2012 15:57, John Kaniarz john.kani...@us.army.mil wrote: It captured a texture, but not the texture I was looking for. Code: osg::State * state=renderInfo.getState(); state-applyAttribute(texture); osg::Image *image=new Image();

Re: [osg-users] What is the right way to save a FBO texture to disk?

2012-06-06 Thread John Kaniarz
I got it working. The issue is that readImageFromCurrentTexture() doesn't support TextureRectangle. I modified my program to use a Texture2D instead and it works now. Adding TextureRectangle support to Image doesn't look like it would be too hard except that GL_TEXTURE_BINDING_RECTANGLE isn't

[osg-users] What is the right way to save a FBO texture to disk?

2012-06-05 Thread John Kaniarz
My program has 4 render to texture cameras that get composited into the frame buffer via custom shader. I want to make a screen capture of one of the texture as a response to an event. Attaching an Image to the camera works, but it copies the data to system memory after every frame. Not just