EDIT: Second stab at solving this problem. Maybe the FBO isn't initialized properly?
My own version of the FBO init code:
RenderTarget::RenderTarget( unsigned int a_Width, unsigned int a_Height, int a_Colors/* = 1*/, bool a_Depth/* = true*/)
{
m_Width = a_Width;
m_Height = a_Height;
m_Ratio = (float)m_Width / (float)m_Height;
// this function returns the width and height if a system doesn't have
// non-power of two texture support
GetTextureSizes(&m_TexWidth, m_Width, &m_TexHeight, m_Height);
m_TextureColors = a_Colors;
m_TextureTotal = a_Colors;
if (a_Depth) { m_TextureTotal++; }
m_Texture = new GLuint[m_TextureTotal];
glGenTextures(m_TextureTotal, m_Texture);
m_TexDepth = NULL;
glGenFramebuffersEXT(1, &m_Target);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_Target);
glEnable(GL_TEXTURE_2D);
int i = 0;
for (; i < a_Colors; i++)
{
glBindTexture(GL_TEXTURE_2D, m_Texture[i]);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_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);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, m_TexWidth, m_TexHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT + i, GL_TEXTURE_2D, m_Texture[i], 0);
}
if (a_Depth)
{
m_TexDepth = m_Texture[i];
glBindTexture(GL_TEXTURE_2D, m_TexDepth);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
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);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, m_TexWidth, m_TexHeight, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, m_TexDepth, 0);
}
glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D);
GLenum status;
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
{
int i = 0;
}
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
}
As you can see, I attach a depth texture, not a depth render target.