<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Sebastion,<br>
    <br>
    thanks for the quick reply.<br>
    What do you mean by composing to the same FBO? As i wrote attaching
    the <br>
    FBO to the child cameras the same way as with the main camera just
    delivers a black fbImage. <br>
    <br>
    Concerning the screen capture example:<br>
    I remember an easier version where a slave camera was created with a
    pbuffer context and then<br>
    an image attached like thgat:<br>
    <br>
    <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;">PixelBufferObject</span>><span
      style=" color:#c0c0c0;"> </span>pbo=<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;">PixelBufferObject</span>(image.get());
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">image->setPixelBufferObject(pbo.get());</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">image-><span style=" font-style:italic; color:#000000;">allocateImage</span>(width,height,<span style=" color:#000080;">1</span>,<span style=" color:#000080;">GL_RGBA</span>,<span style=" color:#000080;">GL_UNSIGNED_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; -qt-block-indent:0; 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>image.get());</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">pbuffer->realize();</pre>
    <pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
</pre>
    This seams more convenient than fiddling with gl functions.<br>
    I still have that version but it also shows only the rendered model.<br>
    Is it possible that the rendering is just not completed after the
    viewer->frame() call?<br>
    Is it necessary having a finalDrawCallback instead?<br>
    <br>
    Thanks again<br>
    <br>
    - Werner -<br>
    <br>
    <div class="moz-cite-prefix">Am 15.03.2017 um 11:28 schrieb
      Sebastian Messerschmidt:<br>
    </div>
    <blockquote cite="mid:1ac6bdce-1321-2050-8f18-d7581446d3d6@gmx.de"
      type="cite">
      <br>
      Hi Werner,
      <br>
      <br>
      <br>
      from diagonal reading:
      <br>
      <br>
      You could make all cameras composing to the same FBO and get the
      texture in a final pass that can either put the image to
      Framebuffer or read back the texture. Also take a look at the
      screenshot example (using pbuffer) and the various draw callbacks.
      <br>
      <br>
      Cheers
      <br>
      Sebastian
      <br>
      <br>
      <br>
      <blockquote type="cite">Hi all.
        <br>
        <br>
        I have a problem understanding how cameras handle render
        targets.
        <br>
        My special case:
        <br>
        I have a standard camera on a view.
        <br>
        The root node of the scene is a group with the following
        children:
        <br>
        <br>
        - my model
        <br>
        - hud camera for wallpaper
        <br>
        - hud camera for text
        <br>
        - more cameras for special cases
        <br>
        <br>
        All the cameras are children of the group node and do
        POST_RENDER operation.
        <br>
        <br>
        I need snapshots of the complete scene from various camera
        positions.
        <br>
        What I do:
        <br>
        <br>
        osg::ref_ptr<osg::Camera>camera=view->getCamera();
        <br>
        <br>
        osg::ref_ptr<osg::Image>fbImage=newosg::Image;
        <br>
        <br>
fbImage->allocateImage(width,height,1,GL_RGBA,GL_UNSIGNED_BYTE,1);
        <br>
        <br>
osg::Camera::RenderTargetImplementationrti=camera->getRenderTargetImplementation();
        <br>
camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
        <br>
        camera->attach(osg::Camera::COLOR_BUFFER,fbImage.get(),0,0);
        <br>
        camera->dirtyAttachmentMap();
        <br>
        <br>
        Then I do snapshots with the modified projection matrix of the
        camera.
        <br>
        After each snapshot I read the contents of the fbImage.
        <br>
        <br>
        I reset everything to the initial status by:
        <br>
        <br>
        camera->setRenderTargetImplementation(rti);
        <br>
        <br>
        camera->detach(osg::Camera::COLOR_BUFFER);
        <br>
        <br>
        camera->dirtyAttachmentMap();
        <br>
        <br>
        <br>
        Unfortunately the fbImage always only contains my model but not
        the
        <br>
        child cameras renderings.
        <br>
        Attaching the fbImage to the child cameras as well gives me just
        a black
        <br>
        fbImage.
        <br>
        Of course the child cameras do not clear the color buffer.
        <br>
        <br>
        What is the proper way of receiving the complete rendering? I
        also tried
        <br>
        already
        <br>
        installing a slave camera to the main camera but that also gives
        me only
        <br>
        the rendered model.
        <br>
        And rendering to the fbImage by installing an additional child
        camera
        <br>
        with POST_RENDER instead
        <br>
        of a slave camera leads to the same result.
        <br>
        <br>
        Rendering to screen is perfect, but to fbImage is not.
        <br>
        It seems I'm blind on some basic functionality and all my
        research
        <br>
        doesn't open my eyes.
        <br>
        <br>
        I instantly hope for some help.
        <br>
        <br>
        Thanks
        <br>
        <br>
        - Werner -
        <br>
        <br>
        <br>
        _______________________________________________
        <br>
        osg-users mailing list
        <br>
        <a class="moz-txt-link-abbreviated" href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a>
        <br>
<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>
        <br>
        <br>
      </blockquote>
      _______________________________________________
      <br>
      osg-users mailing list
      <br>
      <a class="moz-txt-link-abbreviated" href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a>
      <br>
<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>
      <br>
    </blockquote>
    <br>
    <div class="moz-signature">-- <br>
      <b>TE<span style="color:red;">X</span>ION Software Solutions,
        Rotter Bruch 26a, D-52068 Aachen</b><br>
      Phone: +49 241 475757-0<br>
      Fax: +49 241 475757-29<br>
      Web: <a class="moz-txt-link-freetext" href="http://texion.eu">http://texion.eu</a><br>
      eMail: <a class="moz-txt-link-abbreviated" href="mailto:info@texion.eu">info@texion.eu</a><br>
    </div>
  </body>
</html>