Hi,

Can anybody let me know, how to use a depth-stencil texture.
I am trying to cover a triangle with a DEPTH_STENCIL texture, but I only see black image, I am posting my code snippet below. please let me know where am I going wrong.

Also, if someone has a working example in GL/GLES can please post it here.

Thanks

Code :
GLuint depthstencil[WIDTH*HEIGHt];
 
/* populating some data in the texture. */
for(i=0; i < HEIGHT; i++)
{
    for(j=0; j < WIDTH; j++)
    {
        depthstencil[i*WIDTH+j] = 0xffff - i - j;
    } 
}
 
/* creating the texture*/
glActiveTexture(GL_TEXTURE1);
glGenTextures(1,&depth);
glBindTexture(GL_TEXTURE_2D, depth);
glTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH24_STENCIL8,FBO_WIDTH,FBO_HEIGHT,0,GL_DEPTH_STENCIL,GL_UNSIGNED_INT_24_8,depthstencil);
 
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
 
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE);