I want to create a depth texture ( copy the depth buffer to a texture).
I have already create a FBO and create four texture attach to GL_COLOR_ATTACHMENT0_EXT - GL_COLOR_ATTACHMENT3_EXT (use draw buffers). It works well.
Here comes the question.: Now I want to attach a texture to GL_DEPTH_ATTACHMENT_EXT . how should I call the glTexImage2D for the depth texture .
I do it like this :
glTexImage2D(GL_TEXTURE_2D, 0, 1, m_Width, m_Height, 0, GL_FLOAT, GL_LUMINANCE, NULL);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, m_depthTextureID, 0);
but it failed. when i check the FBO state returns error code GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT