Thanks.
I tried this glReadBuffer command but mistakenly used:
glReadBuffer(itr->first)
instead of glReadBuffer(GL_COLOR_ATTACHMENT0_EXT + (itr->first -
osg::CameraNode::COLOR_BUFFER0)

thanks a lot, u have enlightened me :)

Guy.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of J.P.
Delport
Sent: Wednesday, February 13, 2008 12:05 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] MRT

Hi,

I'm afraid I cannot answer your question without looking at exactly at 
what I've done, so I'm just supplying you with an example that worked 
for me. It allowed read back of >1 float textures. I also attach the 
original email.

There were modified patches sent after this email to submissions (I 
think by John Donovan), but it still needed work. Time...

cheers
jp

original mail:
----8<----
Subject: Re: [osg-users] Multiple render targets
Date: Fri, 14 Sep 2007 14:53:04 +0200
From: J.P. Delport <[EMAIL PROTECTED]>
To: OpenSceneGraph Users <[email protected]>
References: <[EMAIL PROTECTED]> 
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>

Hi,

OK, here goes.

Attached you will find a modified RenderStage.cpp. I see that I modified
OSG version 6386, so hopefully you can merge the changes with the latest
SVN version. RenderStage lives in src/osgUtil.

You can either look at the diff to latest version, or search for "JP" in
the file.

The hacky part is this: You call in your code e.g.
camera->setDrawBuffer(GL_COLOR_ATTACHMENT3_EXT);
this sets up 4 draw buffers, 0 to 3.

If you call e.g.
camera->setDrawBuffer(GL_COLOR_ATTACHMENT1_EXT);
it will set up 2 buffers.

You must also call camera->setReadBuffer(GL_COLOR_ATTACHMENT0_EXT); for
enabling readback.

You can attach readback images as per normal (>1 possible), see the
example I attach.

The example shows how I used MRT with 4 textures with floats, one shader
just creates 4 textures, the other combines them again.

What needs to be done to get to a patch:

In short, I'm abusing GL_COLOR_ATTACHMENT* values to get my intention to
use MRT into RenderStage.

We need some mechanism to store/assign more than one drawbuffer inside
"camera" and possibly a flag to indicate we want MRT. RenderStage can
then inherit/query these values to properly call glDrawBuffer(s).

If you have time, give it a bash.

cheers
jp


Guy wrote:
> Hello all,
> 
>  I've read in the mailing list that some people made some patches to
use 
> MRT.
> 
> I also did the same, instead of changing the RenderStage, I changed
the 
> FrameBufferObject apply function (does MRT possible without FBO??)
> 
> Anyway, the textures I attach to get the right values, but the images
I 
> attach do not.
> 
> In RenderStage, only the last image of the camera attachments is being

> copied with readPixels.
> 
> So I patched the RenderStage too, going over all camera attachments
and 
> trying to read the images. But readPixels read from the frame buffer,
so 
> for those attachments I attached also a texture and applied the
texture 
> with the state of the renderstage, and then tried
readFromCurrentTexture 
> (with fixing the image class to read correctly when using float) but
the 
> images data was the same (the data on the frame buffer) even that the 
> textures where different.
> 
>  
> 
> Can anyone explain how to read the data to the images (or any other
way 
> to get the data from the MRT to the RAM)?
> 
>  
> 
> Thanks,
> 
>  Guy.
> 
> 
>
------------------------------------------------------------------------
> 
> _______________________________________________
> osg-users mailing list
> [email protected]
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g

-- 
This message is subject to the CSIR's copyright terms and conditions,
e-mail legal notice, and implemented Open Document Format (ODF)
standard. 
The full disclaimer details can be found at
http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by
MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for
their support.

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to