<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi Robert,<br>
    <br>
    I'd really like doing that. Unfortunately I'm on Windows and the
    only development environment is Qt.<br>
    So I cannot even create a small project outside Qt.<br>
    But honestly I tend to believe it's something in OSG.<br>
    Really the only difference in the 2 versions is the additional
    attachment of the depth image.<br>
    <br>
    I'm sorry.<br>
    <br>
    - Werner -<br>
    <br>
    <div class="moz-cite-prefix">Am 27.06.2018 um 16:04 schrieb Robert
      Osfield:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAFN7Y+XeERJoRQShhn07qXuUiR7ESMxKjJ++1YHKuXMtupaNQQ@mail.gmail.com">
      <pre wrap="">HI Werner,

The code looks OK. I don't see any reason why attaching an image to
both the colour and depth attachments wouldn't work, it's not
something I have tested out though.

There is chance it's an OSG bug, but perhaps there is something in
your setup that isn't quite right.  It's impossible to know from what
info I have.  Could you create a small test program that tests out
assigning an image to colour and depth buffers and if this fails then
share this so others like myself can have a look at it and either spot
an error on the OSG side or in your code.  If it works then this
simple case might shine a light on what you are doing differently.

Robert.
On Wed, 27 Jun 2018 at 14:52, 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 Robert,

I'm sorry, I thougth it's OK like that.
Find the definition of the "unknown" method below.
I think this shrinks the code to be just OSG, except createScreenQuad() but that should not really matter.

Thanks

- Werner -

Am 27.06.2018 um 15:44 schrieb Robert Osfield:

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:

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) {

    osg::ref_ptr<osg::Camera> camera = new osg::Camera;

    camera->getOrCreateStateSet()->setGlobalDefaults();

    camera->setClearColor(osg::Vec4());

    camera->setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

    camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);

    camera->setRenderOrder(osg::Camera::PRE_RENDER, _orderNumber);

    if (_image1) {

        camera->setViewport(0, 0, _image1->s(), _image1->t());

        camera->attach(_bufferType1, _image1);

    }

    if (_image2) {

        camera->setViewport(0, 0, _image2->s(), _image2->t());

        camera->attach(_bufferType2, _image2 );

    }

    if (_image3) {

        camera->setViewport(0, 0, _image3->s(), _image3->t());

        camera->attach(_bufferType3, _image3);

    }

    if (_isAbsolute) {

        camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);

        camera->setProjectionMatrix(osg::Matrix::ortho2D(0.0, 1.0, 0.0, 1.0));

        camera->setViewMatrix(osg::Matrix::identity());

        if (_withScreenQuad) {

            camera->addChild(createScreenQuad(1.0f, 1.0f));

        }

    }

    return camera.release();

}

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>

_______________________________________________
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>


--
TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen
Phone: +49 241 475757-0
Fax: +49 241 475757-29
Web: <a class="moz-txt-link-freetext" href="http://texion.eu">http://texion.eu</a>
eMail: <a class="moz-txt-link-abbreviated" href="mailto:info@texion.eu">info@texion.eu</a>
_______________________________________________
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>