Hello all,
I want to render a scene to a texture. Here is my implementation of the texture and the camera. osg::Texture2D* texture = new osg::Texture2D; texture ->setTextureSize(700, 525); texture ->setInternalFormat(GL_RGBA); texture ->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR); texture ->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR); // create camera RenderToTexture osg::Camera* camera = new osg::Camera; // copy camera->addChild( ); camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); camera->setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); camera->setClearColor(clearColor); camera->setViewport(0,0,700,525); // set the camera to render befor the main camera camera->setRenderOrder(osg::Camera::PRE_RENDER, order); // tell the camera to use OpenGL frame buffer object where supported camera->setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT ); // attach the texture and use it as the color buffer camera->attach(osg::Camera::COLOR_BUFFER, texture, 0, 0); // add camera to root root->addChild(camera); Now, my Problem is that I would like the render the depth buffer information in the alpha cannel of the texture. But it doesnt work. :-( All pixel of the alpha cannel are white??!! Can everybody help me? Cheers, Martin
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org