hi,
how can i read the depth buffer?
thanks.
hi,
how can i read the depth buffer?
thanks.
glReadPixels is what you need.
Depends on what you want to do but if your hardware supports it:
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);//GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_NEAREST);// GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8_EXT, _iWidth, _iHeight, 0,
GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, NULL);
and then bind to an fbo…
After rending you can read this as a texture.
what kind of texturization is it?
I want to read the depth buffer to know the distance on a line. at the moment i use
glreadpixel(0,height/2,width,1,GL_DEPTH…,GL_FLOAT,pointer);
but the array is not so good i try to change the SCALE and BIAS, but i have no idea…
maybe i have to use GL_BYTE?
thanks