Hi Carsten,

I've added the following lines at line 1438 in FBOViewport.cpp.

else if(getReadBuffer() && depthTex)
                        {
                                ImagePtr texImg = depthTex->getImage();

                                if((texImg->getWidth () != getStorageWidth ()) 
||
                                        (texImg->getHeight() != 
getStorageHeight()) ||
                    (texImg->getData  () == NULL              )   )
                                {
                    SINFO << "FBOViewport::render: (Re)Allocating image "
                          << "for read-back."
                          << endLog;
                
                    texImg->set(texImg->getPixelFormat(),
                                getStorageWidth(),
                                getStorageHeight()       );
                }

                                glReadBuffer(GL_DEPTH_ATTACHMENT_EXT);
                glReadPixels(0, 0, 
                             getStorageWidth(), 
                             getStorageHeight(),
                             texImg->getPixelFormat(), 
                             texImg->getDataType(),
                             texImg->editData());
                glReadBuffer(GL_NONE);
                        }

I had no chance to test yet, but I'll do tomorrow. I'm not sure about the FBO 
emulation passage, as I have no idea what it should do? Do you think there has 
to be something similar inserted?

Best regards,
Michael

-------- Original-Nachricht --------
> Datum: Tue, 14 Dec 2010 09:25:29 -0600
> Von: Carsten Neumann <carsten_neum...@gmx.net>
> An: opensg-users@lists.sourceforge.net
> Betreff: Re: [Opensg-users] OpenSG1.8 - FBOViewport Reading Depth Buffer

>       Hello Michael,
> 
> On 12/14/2010 08:34 AM, Michael Raab wrote:
> > was there a special reason why FBOViewport doesn't read back depth
> buffer values?
> 
> don't think so, just nobody implemented it at the time.
> 
> > Looking at the code it seems to me that changing the code around line
> 1013 - 1049 in OSGFBOViewport.cpp may do the trick, expecting that
> texturechunk internal format is something like GL_DEPTH_COMPONENT.
> 
> yes, but note that lines 1013ff is the readback for emulating an FBO, 
> the code path that uses a real FBO is at lines 1438ff.
> 
> > What about the image format, that seems to be a litte bit more tricky.
> 
> doesn't the OpenGL spec for FBOs say anything on the format/data type 
> for reading the depth attachment? The FBOViewport only has to check if 
> the image has a compatible format/data type to read depth data into. 
> Sorry, not certain I understand the question.
> 
>       Cheers,
>               Carsten
> 
> ------------------------------------------------------------------------------
> Lotusphere 2011
> Register now for Lotusphere 2011 and learn how
> to connect the dots, take your collaborative environment
> to the next level, and enter the era of Social Business.
> http://p.sf.net/sfu/lotusphere-d2d
> _______________________________________________
> Opensg-users mailing list
> Opensg-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/opensg-users

-- 
GRATIS! Movie-FLAT mit über 300 Videos. 
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to