Thanks Zach.<br><br>The point is, I need images drawn only once, before game main loop. Prerender example sets up dynamic prerender to texture with usage of callbacks. So every frame prerendering gets called.<br><br>I was wondering if there is a way, to prerender node to a image (or texture). Then when game runs, i would like to display this image on hud.
<br><br>Thanks!<br><br><div><span class="gmail_quote">2007/9/4, Zach Deedler <<a href="mailto:mynamezach@gmail.com">mynamezach@gmail.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">











<div link="blue" vlink="purple" lang="EN-US">

<div>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Hi Ivan,</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">I have this code:</span></font></p>

<p style=""><font color="blue" face="Courier New" size="2"><span style="font-size: 10pt; color: blue;">for</span></font><font face="Courier New" size="2"><span style="font-size: 10pt;">(Viewer::EventHandlerList::iterator
itr = m_poViewer->getEventHandlerList().begin();</span></font></p>

<p style=""><font face="Courier New" size="2"><span style="font-size: 10pt;">            itr !=
m_poViewer->getEventHandlerList().end();</span></font></p>

<p style=""><font face="Courier New" size="2"><span style="font-size: 10pt;">            ++itr){</span></font></p>

<p style=""><font face="Courier New" size="2"><span style="font-size: 10pt;">      ViewerEventHandler*
viewerEventHandler = </span></font></p>

<p style=""><font face="Courier New" size="2"><span style="font-size: 10pt;">         <font color="blue"><span style="color: blue;">dynamic_cast</span></font><ViewerEventHandler*>(itr->get());</span></font></p>

<p style=""><font face="Courier New" size="2"><span style="font-size: 10pt;">      <font color="blue"><span style="color: blue;">if</span></font> (viewerEventHandler){</span></font></p>

<p style=""><font face="Courier New" size="2"><span style="font-size: 10pt;">        
viewerEventHandler->setWriteImageFileName(pszFile);</span></font></p>

<p style=""><font face="Courier New" size="2"><span style="font-size: 10pt;">        
viewerEventHandler->setWriteImageOnNextFrame(<font color="blue"><span style="color: blue;">true</span></font>);</span></font></p>

<p style=""><font face="Courier New" size="2"><span style="font-size: 10pt;">         <font color="blue"><span style="color: blue;">return</span></font> 0;</span></font></p>

<p style=""><font face="Courier New" size="2"><span style="font-size: 10pt;">      }</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt;">   }</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt;"> </span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt;">Maybe you can search the code for
setWriteImageFileName and back track from there?</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt;"> </span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt;">I believe there is a function call to do what you
want for a camera.</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt;"> </span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt;">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.</span></font><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"></span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>

<div>

<div style="text-align: center;" align="center"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">

<hr align="center" size="2" width="100%">

</span></font></div>

<p><b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;">
<a href="mailto:osg-users-bounces@lists.openscenegraph.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">osg-users-bounces@lists.openscenegraph.org</a> [mailto:<a href="mailto:osg-users-bounces@lists.openscenegraph.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
osg-users-bounces@lists.openscenegraph.org</a>]
<b><span style="font-weight: bold;">On Behalf Of </span></b>Ivan Bolcina<br>
<b><span style="font-weight: bold;">Sent:</span></b> Tuesday, September 04, 2007
3:44 PM<br>
<b><span style="font-weight: bold;">To:</span></b> <a href="mailto:osg-users@lists.openscenegraph.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">osg-users@lists.openscenegraph.org</a><br>
<b><span style="font-weight: bold;">Subject:</span></b> [osg-users] Render to
texture</span></font></p>

</div><div><span class="e" id="q_114d21ef9d9ecd6b_1">

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;"> </span></font></p>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;"><br>
Hi.<br>
<br>
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. <br>
<br>
So I need a simple function like this<br>
<br>
osg::Image * CreateTopDownShotOfNode( osg::Node * node);<br>
<br>
The main problem is how to tell osg to render using that camera.<br>
<br>
thx</span></font></p>

</span></div></div>

</div>


<br>_______________________________________________<br>osg-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org
</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
</a><br><br></blockquote></div><br>