<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi all,<br>
    <br>
    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 <br>
    What I do:<br>
    <br>
    <pre><span style=" color:#c0c0c0;">        </span><tt><span style=" color:#808000;">if</span></tt><tt><span style=" color:#c0c0c0;"> </span></tt><tt>(!</tt><tt><span style=" color:#800000;">renderImage</span></tt><tt>.</tt><tt><span style=" color:#00677c;">valid</span></tt><tt>())</tt><tt><span style=" color:#c0c0c0;"> </span></tt><tt>{
</tt></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:#800000;">renderImage</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;">Image</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:#800000;">renderImage</span>-><span style=" font-style:italic; color:#00677c;">allocateImage</span>(<span style=" color:#800000;">width</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">height</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">1</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">GL_RGBA</span>,<span style=" color:#c0c0c0;"> </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;"><span style=" color:#c0c0c0;">            </span><span style=" color:#800000;">renderImage</span>-><span style=" color:#00677c;">setInternalTextureFormat</span>(<span style=" color:#000080;">GL_RGBA8</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;">if</span><span style=" color:#c0c0c0;"> </span>(<span style=" color:#800000;">includeDepth</span><span style=" color:#c0c0c0;"> </span>&&<span style=" color:#c0c0c0;"> </span>!<span style=" color:#800000;">depthImage</span>.<span style=" color:#00677c;">valid</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:#800000;">depthImage</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;">Image</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:#800000;">depthImage</span>-><span style=" font-style:italic; color:#00677c;">allocateImage</span>(<span style=" color:#800000;">width</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">height</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">1</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">GL_DEPTH_COMPONENT</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">GL_FLOAT</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;"><span style=" color:#c0c0c0;">            </span><span style=" color:#800000;">renderImage</span>-><span style=" color:#00677c;">setInternalTextureFormat</span>(<span style=" color:#000080;">GL_LUMINANCE32F_ARB</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;">
<span style=" color:#c0c0c0;">        </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(!<span style=" color:#800000;">includeDepth</span>)
<span style=" color:#c0c0c0;">            </span><span style=" color:#800000;">renderCamera</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">view</span>-><span style=" color:#00677c;">createRTTCameraImage</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><span style=" color:#000080;">0</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">renderImage</span>.<span style=" color:#00677c;">get</span>(),<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">true</span>);
<span style=" color:#c0c0c0;">        </span><span style=" color:#808000;">else</span>
<span style=" color:#c0c0c0;">            </span><span style=" color:#800000;">renderCamera</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">view</span>-><span style=" color:#00677c;">createRTTCameraGBufferImage</span>(<span style=" color:#800080;">osg</span>::<span style=" color:#800080;">Camera</span>::<span style=" color:#800080;">COLOR_BUFFER0</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">renderImage</span>.<span style=" color:#00677c;">get</span>(),<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">osg</span>::<span style=" color:#800080;">Camera</span>::<span style=" color:#800080;">DEPTH_BUFFER</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">depthImage</span>.<span style=" color:#00677c;">get</span>(),
<span style=" color:#c0c0c0;">                                                            </span><span style=" color:#800080;">osg</span>::<span style=" color:#800080;">Camera</span>::<span style=" color:#800080;">COLOR_BUFFER1</span>,<span style=" color:#c0c0c0;"> </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:#808000;">true</span>);

</pre>
    The definition of createRTT...<br>
    <br>
    <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><tt><span style=" color:#800080;">osg</span></tt><tt>::</tt><tt><span style=" color:#800080;">Camera</span></tt><tt><span style=" color:#c0c0c0;"> </span></tt><tt>*</tt><tt><span style=" font-weight:600; color:#00677c;">createRTTCameraGBufferImage</span></tt><tt>(</tt><tt><span style=" color:#800080;">osg</span></tt><tt>::</tt><tt><span style=" color:#800080;">Camera</span></tt><tt>::</tt><tt><span style=" color:#800080;">BufferComponent</span></tt><tt><span style=" color:#c0c0c0;"> </span></tt><tt>_bufferType1,</tt><tt><span style=" color:#c0c0c0;"> </span></tt><tt><span style=" color:#800080;">osg</span></tt><tt>::</tt><tt><span style=" color:#800080;">Image</span></tt><tt><span style=" color:#c0c0c0;"> </span></tt><tt>*_image1,
</tt><span style=" color:#c0c0c0;">                                        </span><span style=" color:#800080;">osg</span>::<span style=" color:#800080;">Camera</span>::<span style=" color:#800080;">BufferComponent</span><span style=" color:#c0c0c0;"> </span>_bufferType2,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">osg</span>::<span style=" color:#800080;">Image</span><span style=" color:#c0c0c0;"> </span>*_image2,</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:#800080;">osg</span>::<span style=" color:#800080;">Camera</span>::<span style=" color:#800080;">BufferComponent</span><span style=" color:#c0c0c0;"> </span>_bufferType3,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">osg</span>::<span style=" color:#800080;">Image</span><span style=" color:#c0c0c0;"> </span>*_image3,</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;">int</span><span style=" color:#c0c0c0;"> </span>_orderNumber,<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">bool</span><span style=" color:#c0c0c0;"> </span>_isAbsolute,<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">bool</span><span style=" color:#c0c0c0;"> </span>_withScreenQuad<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">true</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>
    <br>
    When rendering without depth, I get a correct color channel image.<br>
    When rendering both, color and depth, the depth image is OK but the
    color image seems having only the red color information.<br>
    Are there any limitations in using 2 images?<br>
    <br>
    Has anybody else had such an effect already or can anybody give me a
    hint?<br>
    <br>
    Many thanks in advance<br>
    <br>
    - Werner -<br>
    <br>
    Many thanks in advance.<br>
  </body>
</html>