Hello.
This is what i use for depth texture creation:
osg::Texture2D* texture2D = new osg::Texture2D;
texture2D->setTextureSize(tex_width, tex_height);
texture2D->setInternalFormat(GL_RGBA);
texture2D->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
texture2D->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
texture2D->setWrap( osg::Texture::WRAP_S, osg::Texture::REPEAT );
texture2D->setWrap( osg::Texture::WRAP_R, osg::Texture::REPEAT );
texture2D->setInternalFormat(GL_DEPTH_COMPONENT);
I have also attached an image which shows that the fragment shader result.
If you watch closely in the middle, you will notice that the image is
separated into 4 pieces.
What i do is creating a UnitInOut which receives the depth buffer and
writing each pixel result to gl_FragData[0].
As you can see in the picture, i paint as red the pixels which have depth
value 1.
But when i access these pixels while another pixel is being iterated, i get
different depth value.
Why is this happening ?
thnx.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org