<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Glen,<br>
    <br>
    thanks for the hint. I'm still sticking with version 3.2 and this
    method is not available there.<br>
    I will try to move to the latest version and do like you suggested.<br>
    <br>
    Thanks<br>
    <br>
    - Werner -<br>
    <br>
    <div class="moz-cite-prefix">Am 09.03.2017 um 15:24 schrieb Glenn
      Waldron:<br>
    </div>
    <blockquote
cite="mid:CANfcm6Ykz+oaWs-PX5OS73+uBD-don4Om47GHh51z1_Tprq3xQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">Werner,
        <div>I have never switched render targets at runtime before, but
          I have switched attachments and needed to call
          camera->dirtyAttachmentMap() after calling attach() or
          detach(). Maybe that will work.</div>
      </div>
      <div class="gmail_extra"><br clear="all">
        <div>
          <div class="gmail_signature" data-smartmail="gmail_signature">
            <div dir="ltr">
              <div>Glenn Waldron</div>
            </div>
          </div>
        </div>
        <br>
        <div class="gmail_quote">On Thu, Mar 9, 2017 at 9:10 AM, Werner
          Modenbach <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:Werner.Modenbach@texion.eu" target="_blank">Werner.Modenbach@texion.eu</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000"> Hi all.<br>
              <br>
              Is it possible to redirect the main camera of a view
              temporarily to a FBO?<br>
              It is my intention to get a snapshot of the scene with a
              modified projection matrix.<br>
              I think about something like that:<br>
              <br>
              <span style="color:#800080">osg</span>::<span
                style="color:#800080">ref_ptr</span><<span
                style="color:#800080">osg</span>::<span
                style="color:#800080">Camera</span>> camera =
              view->getCamera();<br>
              osg::Camera::<wbr>RenderTargetImplementation rti =
              camera-><wbr>getRenderTargetImplementation(<wbr>);<br>
              <span style="color:#c0c0c0"> </span><span
                style="color:#800080">osg</span>::<span
                style="color:#800080">Matrixd</span><span
                style="color:#c0c0c0"> </span>projectionMatrix<span
                style="color:#c0c0c0"> </span>=<span
                style="color:#c0c0c0"> </span><span
                style="color:#800000">view</span>->getCamera()-><wbr>getProjectionMatrix();
              camera-><wbr>setRenderTargetImplementation(<span
                style="color:#800080"><wbr>osg</span>::<span
                style="color:#800080">Camera</span>::<span
                style="color:#800080">FRAME_BUFFER_<wbr>OBJECT</span>);
              <span style="color:#c0c0c0"> </span><span
                style="color:#800080">osg</span>::<span
                style="color:#800080">ref_ptr</span><<span
                style="color:#800080">osg</span>::<span
                style="color:#800080">Image> </span>fbImage<span
                style="color:#c0c0c0"> </span>=<span
                style="color:#c0c0c0"> </span><span
                style="color:#808000">new</span><span
                style="color:#c0c0c0"> </span><span
                style="color:#800080">osg</span>::<span
                style="color:#800080">Image</span>;
              <pre style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">fbImage-><span style="font-style:italic;color:#000000">allocateImage</span>(width,<wbr>height,<span style="color:#000080">1</span>,<span style="color:#000080">GL_RGBA</span>,<span style="color:#000080">GL_UNSIGNED_<wbr>BYTE</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">1</span>);

</pre>
    <pre style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">camera->attach(<span style="color:#c0c0c0"> </span><span style="color:#800080">osg</span>::<span style="color:#800080">Camera</span>::<span style="color:#800080">COLOR_BUFFER</span>,<span style="color:#c0c0c0"> </span>fbImage.get(),<span style="color:#c0c0c0"> </span><span style="color:#000080">0</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">0</span>);</pre>
    <pre style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">camera->setProjectionMatrix(<span style="color:#c0c0c0"> </span>projectionMatrix<span style="color:#c0c0c0"> </span>*<span style="color:#c0c0c0"> </span>offsetMatrix<span style="color:#c0c0c0"> </span>);

</pre>
    <span style="color:#c0c0c0"> </span><span style="color:#800000">view</span>-><span style="font-style:italic;color:#000000">frame</span>();

    

    camera-><wbr>setRenderTargetImplementation(<span style="color:#800080"><wbr>rti</span>);

    camera->detach(<span style="color:#800080"> osg</span>::<span style="color:#800080">Camera</span>::<span style="color:#800080">COLOR_BUFFER</span>
    );

    <pre style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">camera->setProjectionMatrix(<span style="color:#c0c0c0"> </span>projectionMatrix<span style="color:#c0c0c0"> </span>);


</pre>
    I tried it but my screen gets updated on the frame()  call with the
    modified projection matrix 

    and the image stays black.

    

    Thanks for any hints.<span class="HOEnZb"><font color="#888888">

    

    - Werner -

    <div class="m_-3766310451060513262moz-signature">

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


______________________________<wbr>_________________

osg-users mailing list

<a moz-do-not-send="true" href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.<wbr>openscenegraph.org</a>

<a moz-do-not-send="true" href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.<wbr>org/listinfo.cgi/osg-users-<wbr>openscenegraph.org</a>


</blockquote></div>
</div>


<fieldset class="mimeAttachmentHeader"></fieldset>
<pre wrap="">_______________________________________________
osg-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a>
<a class="moz-txt-link-freetext" href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a>
</pre>

</blockquote>
</body></html>