On 6/6/07, Antonio Bleile <[EMAIL PROTECTED]> wrote: > Hi, > > I'd like to render my scene into a FBO, as > output I'd like to have the color buffer and the > depth buffer into two separated textures. As far > as I understand FBO's that should work. And as > far as I could see from the OpenSG code, it should > work in OpenSG as well ;) So I tried to extend the > 29FBOTexture.cpp sample.... > > I created a texture that can hold the depth info > like this: > > TextureChunkPtr fboDepthTexture = TextureChunk::create(); > [...] > // setup depth texture > ImagePtr imgDepth = Image::create(); > beginEditCP(imgDepth); > imgDepth->set(GL_DEPTH_COMPONENT_ARB, ::fboWidth, ::fboHeight); > endEditCP(imgDepth); > beginEditCP(fboDepthTexture); > fboDepthTexture->setMinFilter(GL_LINEAR); > fboDepthTexture->setMagFilter(GL_LINEAR); > fboDepthTexture->setTarget(GL_TEXTURE_2D); > fboDepthTexture->setInternalFormat(GL_DEPTH_COMPONENT_ARB); > fboDepthTexture->setExternalFormat(GL_DEPTH_COMPONENT_ARB); > fboDepthTexture->setImage(imgDepth); > endEditCP(fboDepthTexture);
I can only speak to how it works in 2.0...but this is basically how I set up my TextureObjChunk for the FBO: img->set(OSG::Image::OSG_RGB_PF, size, size); depth_tex->setImage(img); depth_tex->setMinFilter(GL_LINEAR); depth_tex->setMagFilter(GL_LINEAR); depth_tex->setWrapS(GL_CLAMP_TO_EDGE); depth_tex->setWrapT(GL_CLAMP_TO_EDGE); depth_tex->setExternalFormat(GL_DEPTH_COMPONENT); depth_tex->setInternalFormat(GL_DEPTH_COMPONENT32); depth_tex->setCompareMode(GL_NONE); depth_tex->setCompareFunc(GL_LEQUAL); depth_tex->setDepthMode(GL_INTENSITY); Its not an apples to apples comparison but I hope that helps a bit. Also, in 2.0 you have to do the depth and color attachments separate. -Dan ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Opensg-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensg-users
