Hi Chuck,

I do bind an image with a float texture without clamping in my code... 
You do need to specify proper internal and source formats, like
GL_FLOAT when you call osg::Image::allocateImage() and GL_FLOAT_R32_NV
/ GL_RED when you create the texture.


guillaume


-----Original Message-----
From: [EMAIL PROTECTED] on behalf of Chuck Seberino
Sent: Tue 10/3/2006 2:20 PM
To: 'osg users'
Subject: RE: [osg-users] Retrieving texture contents from ARB float FBO RTT
 
Robert,

 

I worked with osgprerender to see if I could get the osg::Image readback to
work.  Unfortunately it seems that using that approach, versus attaching a
texture, causes the results to be clamped to within [0,1].  The whole reason
for using the ARB format and FBO was to get the full floating point range.
I believe that using a texture attachment is the only way around the
clamping.

 

Aside from patching osg::Image to properly handle the ARB texture format, my
only course seems to be using glReadPixels while the FBO Texture is active.
I looked into this, but like I said before, there doesn't seem to be an easy
(clean) way to get this.  I have a post draw for the camera node that has
access to the SceneView pointer.  From there I can get the RenderStage.  My
camera is being drawn in a preRender, so it's RenderStage is tucked into the
preRenderList - of which there is no public access.  There doesn't seem to
be a way for me to get the fbo handle so that I can enable it and read the
texels.

 

Looking at the code for RenderStage, there already seems to be code ready to
do glReadPixels.  I just need to give it a valid osg::Image via setImage.
So it looks like my big holdup is in figuring out and acquiring the
RenderStage handle that applies to my CameraNode.  Any suggestions?

 

Chuck

-----Original Message-----
From: Robert Osfield [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 02, 2006 1:25 AM
To: osg users
Subject: Re: [osg-users] Retrieving texture contents from ARB float FBO RTT

 

Hi Chuck,

On 10/2/06, Chuck Seberino <[EMAIL PROTECTED]> wrote:

I have some code that sets up a CameraNode with a FBO as the target.  The
texture attached to the FBO has a format of GL_RGB32F_ARB.  This seems to
work just great.  

The problem is that I want to be able to read in the value of the texture as
an osg::Image after drawing.  I have used
image->readImageFromCurrentTexture(), but osg::Image doesn't know about the
ARB formats when performing the bit size calculations.  Is this a deficiency
in computNumComponents() or is there something I am missing?  Even hacking
that method to calculate it correctly doesn't solve things.  I didn't get a
chance to dig deeper to see what the next roadblock was.


Missing support for the ARB pixel formats is obviously one missing element
that will need addressing, as for what other gotcha's could be causing
problems its hard to point point without digging into to debugging myself. 

 

Is there a better way to grab the texture back into main memory?  In
OpenGL-land I would call glReadPixels while the FBO was active, but there
doesn't seem to be an easy way to do that in OSG either.


The osgprerender example provides a path that attaches an osg::Image to the
CameraNode, and this gets read back in automatically so you can probably use
this.  There is also support for post draw callback on CameraNode that you
could use to implement your own glReadPixels call. 

Could you modify osgprerender to use the pixel format you are having problem
with and if this recreates the problem then send the modified file along to
me and I'll have a go at debugging it.

Robert. 


<<winmail.dat>>

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to