Hi all,

I try to implement two textures adding with depth test.

But I encounter a problem.

I need to generate depth and color texture when I draw scene.

I create one Frame Buffer Object and bind color texture to COLOR_ATTACHMENT0 and depth texture to DEPTH_ATTACHMENT.

But it doesn't work.
//------------------ Pesudo Code
//---- initialize
My texture parameter setting is :
glBindTexture(GL_TEXTURE_2D,depth_tex_id);

texture_param.SetMagFilterMode(TextureMagFilterMod eList::LINEAR);
texture_param.SetMinFilterMode(TextureMinFilterMod eList::LINEAR);
texture_param.SetTexCoordSAxisWrapMode(TextureWarp ModeList::CLAMP_TO_EDGE);
texture_param.SetTexCoordTAxisWrapMode(TextureWarp ModeList::CLAMP_TO_EDGE);
texture_param.SetTextureComparedMode(TextureCompar edModeList::NONE);
texture_param.SetTextureComparedFunction(ComparedF unctionList::LEQUAL);
texture_param.SetTextureDepthTextureMode(TextureDe pthTextureModeList::INTENSITY);

glTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT,w, h,0,GL_DEPTH_COMPONENT,GL_UNSIGNED_SHORT,0);

glBindTexture(GL_TEXTURE_2D,color_tex_id);
//......
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,w,h,0,GL_RGBA ,GL_UNSIGNED_CHAR,0);

glBindFrameBuffer(...);

glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATT ACHMENT0, GL_TEXTURE_2D, color_tex_id, 0); //level
glFramebufferTexture2D(GL_FRAMEBUFFER,GL_DEPTH_ATT ACHMENT, GL_TEXTURE_2D, depth_tex_id, 0); //level
//---- rendering
glBindFrameBuffer(...);
clear depth and color
DrawScene();
glBindFrameBuffer(GL_FRAME_BUFFER,0);

Thanks.