[osg-users] Render to texture

Zach Deedler mynamezach at gmail.com
Tue Sep 4 13:02:34 PDT 2007


Hi Ivan,

 

I have this code:

for(Viewer::EventHandlerList::iterator itr =
m_poViewer->getEventHandlerList().begin();

            itr != m_poViewer->getEventHandlerList().end();

            ++itr){

      ViewerEventHandler* viewerEventHandler = 

         dynamic_cast<ViewerEventHandler*>(itr->get());

      if (viewerEventHandler){

         viewerEventHandler->setWriteImageFileName(pszFile);

         viewerEventHandler->setWriteImageOnNextFrame(true);

         return 0;

      }

   }

 

Maybe you can search the code for setWriteImageFileName and back track from
there?

 

I believe there is a function call to do what you want for a camera.

 

Also, osgprerender renders a scene to a texture every frame.  If you did
that then you can probably just save off the texture by calling an
osg::Texture or osg::Image call.

 

  _____  

From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Ivan
Bolcina
Sent: Tuesday, September 04, 2007 3:44 PM
To: osg-users at lists.openscenegraph.org
Subject: [osg-users] Render to texture

 


Hi.

I just want to render a simple node to a texture. All the examples are using
callbacks, osg viewer,etc.. I don't understand all that, I just want to set
up geometry, projection and new camera and then take one shoot with camera
and that's it. 

So I need a simple function like this

osg::Image * CreateTopDownShotOfNode( osg::Node * node);

The main problem is how to tell osg to render using that camera.

thx

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20070904/7fb35a73/attachment-0003.htm>


More information about the osg-users mailing list