Hi All, Im doing some tests with FBOs and so and im getting some troubles defining proper pixel formats and so. I have a couple of questions, some od them perhaps are more OpenGL related, but i am not able to find responses :-(
First of them is regarding depth Textures. Im trying to render the depthBuffer to a texture using a FBO. Altought I get a B/W texture, it doesn looks correct (perhaps im wrong). The texture has a white background and the objects in the scene get darker. Thje problem is that when i get closer to the object, everything starts turning white. I supose that if the depthBuffer goes from 0 to 1 and 1 is the far plane, objects should become darker when they are close... I also tried chaning texture's pixels formats, but this seemed to do no effect on the rendered image... I dont know if im doing anything wrong and how the texture's internal format and source types affect to the RTT, as i get exactly the same result. I tried these formats:GL_DEPTH_COMPONENT32, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT16 and GL_DEPTH24_STENCIL8_EXT Here is some code: Code: depthTexture = new osg::Texture2D; depthTexture->setTextureSize(textureWidth, textureHeight); depthTexture->setInternalFormat(GL_DEPTH24_STENCIL8_EXT); depthTexture->setSourceFormat(GL_DEPTH_COMPONENT); //depthTexture->setSourceType(GL_FLOAT); depthTexture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST); depthTexture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST); depthTexture->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_EDGE); depthTexture->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_EDGE); ... camShot->attach(osg::Camera::DEPTH_BUFFER, depthTexture); camShot->addChild(root); rttPlaneGroup->addChild(camShot.get()); ... osg::StateSet* stateset = new osg::StateSet; stateset->setTextureAttributeAndModes(0, depthTexture.get(), osg::StateAttribute::ON); rttPlaneGroup->setStateSet(stateset); ... Also i dont exactly know hoe to use FBOExtensions. Just defining the right pixel formats is enough if the graphics card supports it? The second question is about MRTs. I tried to do a deferred rendered, for wich i use 1 MRT with 4 render targets. I assume (im not sure) that the pixels formats of the 4 renderTargets have to be of the same bits (for ex. 32 bits). What i dont know is if the pixel formats have to be all the same. I tried to change the pixel format of the depth texture to GL_DEPTH_COMPONENT32 but this made the FBO to set up incorrectly (may be because in a MRT all RTTs have to be defined as COLORBUFFERS??) The question is: How do i mix pixel formats in a MRT? it is possible? Sorry if the questions are too much OGL related, but im a bit lost with pixelFormats. Cheers, J. ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=14533#14533 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

