Hi,

look at the osgprerender example where an image is attached to the RTT 
camera. Search for ->attach. You do not need to call readImage yourself.

rgds
jp

Guerrero, Michael (CIV) wrote:
> After looking into this further, it seemed that using glGetTexImage 
> would be able to copy from a texture used as a render target (FBO).  I 
> have tried this only to be left with a black texture that never gets 
> filled in.  I know that function works by grabbing whatever texture is 
> currently bound and returning its data.  Using osg, the way to do this 
> seemed to be the following:
> 
>  
> 
> osg::GraphicsContext *context = cam->getGraphicsContext();
> 
> osg::State *currentState = context->getState();
> 
>  
> 
> currentState->setActiveTextureUnit(0);
> 
> currentState->applyTextureAttribute(0, mColorTexture);
> 
>  
> 
> osg::ref_ptr<osg::Image> imageCapture = new osg::Image;
> 
> imageCapture->readImageFromCurrentTexture(0, false);
> 
>  
> 
> Unfortunately imageCapture is entirely filled with zeros.
> 
>  
> 
> Anyone have some ideas or experience with this sort of thing?
> 
>  
> 
> Thanks,
> 
> Michael Guerrero
> 
>  
> 
> ------------------------------------------------------------------------
> 
> *From:* Guerrero, Michael (CIV)
> *Sent:* Tuesday, April 01, 2008 2:23 PM
> *To:* OpenSceneGraph Users
> *Subject:* [osg-users] Getting the Image from a Texture2D used as a 
> render target
> 
>  
> 
> Hi, I’m trying to retrieve texture data that I have rendered from video 
> memory back to main memory.  I was initially hoping I could set up a 
> render target as usual and then just call GetImage on the Texture2D but 
> that doesn’t work.  Is there any easy way to do this?
> 
>  
> 
> Thanks,
> 
> Michael Guerrero
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail 
legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at 
http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their 
support.

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to