<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi Robert,<br>
    <br>
    I'm sorry, I thougth it's OK like that.<br>
    Find the definition of the "unknown" method below.<br>
    I think this shrinks the code to be just OSG, except
    createScreenQuad() but that should not really matter.<br>
    <br>
    Thanks<br>
    <br>
    - Werner -<br>
    <br>
    <div class="moz-cite-prefix">Am 27.06.2018 um 15:44 schrieb Robert
      Osfield:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAFN7Y+WDMVyD2aO83kV6zLi8+B4TGUWm85Gd=aYK3dJKx4i4_Q@mail.gmail.com">
      <pre wrap="">Hi Werner,

You appear to be included reference to calls and classes that aren't
in the OpenSceneGraph, are you using a 3rd party library that is
providing these?

At this point I can't see a way of helping you as there bit doing the
set up are unknown to us.

Robert.
On Wed, 27 Jun 2018 at 13:53, Werner Modenbach
<a class="moz-txt-link-rfc2396E" href="mailto:Werner.Modenbach@texion.eu"><Werner.Modenbach@texion.eu></a> wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">
Hi all,

I found a strange behavior of a GBufferCamera. I want to get the color channel in one image and the depth channel in another image.When
What I do:

        if (!renderImage.valid()) {

            renderImage = new osg::Image;

            renderImage->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1);

            renderImage->setInternalTextureFormat(GL_RGBA8);

        }

        if (includeDepth && !depthImage.valid()) {

            depthImage = new osg::Image;

            depthImage->allocateImage(width, height, 1, GL_DEPTH_COMPONENT, GL_FLOAT, 1);

            renderImage->setInternalTextureFormat(GL_LUMINANCE32F_ARB);

        }

        if (!includeDepth)
            renderCamera = view->createRTTCameraImage(osg::Camera::COLOR_BUFFER, 0, renderImage.get(), true);
        else
            renderCamera = view->createRTTCameraGBufferImage(osg::Camera::COLOR_BUFFER0, renderImage.get(), osg::Camera::DEPTH_BUFFER, depthImage.get(),
                                                            osg::Camera::COLOR_BUFFER1, 0, 0, true);

The definition of createRTT...

    osg::Camera *createRTTCameraGBufferImage(osg::Camera::BufferComponent _bufferType1, osg::Image *_image1,
                                        osg::Camera::BufferComponent _bufferType2, osg::Image *_image2,
                                        osg::Camera::BufferComponent _bufferType3, osg::Image *_image3,
                                        int _orderNumber, bool _isAbsolute, bool _withScreenQuad = true) {</pre>
      </blockquote>
    </blockquote>
    <pre><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;">Camera</span>><span style=" color:#c0c0c0;"> </span><span style=" color:#092e64;">camera</span><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;">Camera</span>;
</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#092e64;">camera</span>-><span style=" color:#00677c;">getOrCreateStateSet</span>()-><span style=" color:#00677c;">setGlobalDefaults</span>();</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#092e64;">camera</span>-><span style=" color:#00677c;">setClearColor</span>(<span style=" color:#800080;">osg</span>::<span style=" color:#800080;">Vec4</span>());</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#092e64;">camera</span>-><span style=" color:#00677c;">setClearMask</span>(<span style=" color:#000080;">GL_COLOR_BUFFER_BIT</span>|<span style=" color:#000080;">GL_DEPTH_BUFFER_BIT</span>);</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#092e64;">camera</span>-><span style=" color:#00677c;">setRenderTargetImplementation</span>(<span style=" color:#800080;">osg</span>::<span style=" color:#800080;">Camera</span>::<span style=" color:#800080;">FRAME_BUFFER_OBJECT</span>);</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#092e64;">camera</span>-><span style=" color:#00677c;">setRenderOrder</span>(<span style=" color:#800080;">osg</span>::<span style=" color:#800080;">Camera</span>::<span style=" color:#800080;">PRE_RENDER</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#092e64;">_orderNumber</span>);</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(<span style=" color:#092e64;">_image1</span>)<span style=" color:#c0c0c0;"> </span>{</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#092e64;">camera</span>-><span style=" color:#00677c;">setViewport</span>(<span style=" color:#000080;">0</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#092e64;">_image1</span>-><span style=" color:#00677c;">s</span>(),<span style=" color:#c0c0c0;"> </span><span style=" color:#092e64;">_image1</span>-><span style=" color:#00677c;">t</span>());</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#092e64;">camera</span>-><span style=" color:#00677c;">attach</span>(<span style=" color:#092e64;">_bufferType1</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#092e64;">_image1</span>);</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">    </span>}</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>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(<span style=" color:#092e64;">_image2</span>)<span style=" color:#c0c0c0;"> </span>{</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#092e64;">camera</span>-><span style=" color:#00677c;">setViewport</span>(<span style=" color:#000080;">0</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#092e64;">_image2</span>-><span style=" color:#00677c;">s</span>(),<span style=" color:#c0c0c0;"> </span><span style=" color:#092e64;">_image2</span>-><span style=" color:#00677c;">t</span>());</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#092e64;">camera</span>-><span style=" color:#00677c;">attach</span>(<span style=" color:#092e64;">_bufferType2</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#092e64;">_image2</span><span style=" color:#c0c0c0;"> </span>);</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">    </span>}</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>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(<span style=" color:#092e64;">_image3</span>)<span style=" color:#c0c0c0;"> </span>{</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#092e64;">camera</span>-><span style=" color:#00677c;">setViewport</span>(<span style=" color:#000080;">0</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#092e64;">_image3</span>-><span style=" color:#00677c;">s</span>(),<span style=" color:#c0c0c0;"> </span><span style=" color:#092e64;">_image3</span>-><span style=" color:#00677c;">t</span>());</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#092e64;">camera</span>-><span style=" color:#00677c;">attach</span>(<span style=" color:#092e64;">_bufferType3</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#092e64;">_image3</span>);</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">    </span>}</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>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(<span style=" color:#092e64;">_isAbsolute</span>)<span style=" color:#c0c0c0;"> </span>{</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#092e64;">camera</span>-><span style=" color:#00677c;">setReferenceFrame</span>(<span style=" color:#800080;">osg</span>::<span style=" color:#800080;">Transform</span>::<span style=" color:#800080;">ABSOLUTE_RF</span>);</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#092e64;">camera</span>-><span style=" color:#00677c;">setProjectionMatrix</span>(<span style=" color:#800080;">osg</span>::<span style=" color:#800080;">Matrix</span>::<span style=" color:#00677c;">ortho2D</span>(<span style=" color:#000080;">0.0</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">1.0</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0.0</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">1.0</span>));</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#092e64;">camera</span>-><span style=" color:#00677c;">setViewMatrix</span>(<span style=" color:#800080;">osg</span>::<span style=" color:#800080;">Matrix</span>::<span style=" color:#00677c;">identity</span>());</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(<span style=" color:#092e64;">_withScreenQuad</span>)<span style=" color:#c0c0c0;"> </span>{</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">            </span><span style=" color:#092e64;">camera</span>-><span style=" font-style:italic; color:#00677c;">addChild</span>(<span style=" color:#00677c;">createScreenQuad</span>(<span style=" color:#000080;">1.0f</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">1.0f</span>));</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span>}</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">    </span>}</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span><span style=" color:#092e64;">camera</span>.<span style=" color:#00677c;">release</span>();</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">}</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>
    <blockquote type="cite"
cite="mid:CAFN7Y+WDMVyD2aO83kV6zLi8+B4TGUWm85Gd=aYK3dJKx4i4_Q@mail.gmail.com">
      <blockquote type="cite">
        <pre wrap="">


When rendering without depth, I get a correct color channel image.
When rendering both, color and depth, the depth image is OK but the color image seems having only the red color information.
Are there any limitations in using 2 images?

Has anybody else had such an effect already or can anybody give me a hint?

Many thanks in advance

- Werner -

Many thanks in advance.
_______________________________________________
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>
      <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>
    <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>