So, heres the situation, my fbo works very well when i only render the color texture, but when i try to also render a depth texture the color texture goes all white, so what should i do? Heres the code:
// Color Texture
glGenTextures(1,texture);
glBindTexture(GL_TEXTURE_2D,*texture);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, def.Width, def.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glBindTexture(GL_TEXTURE_2D,0);
// Depth Texture
glGenTextures(1,depth);
glBindTexture(GL_TEXTURE_2D, *depth);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, def.Width, def.Height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0);
glBindTexture(GL_TEXTURE_2D,0);
// Framebuffer
glGenFramebuffersEXT(1,fbo);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,*fbo);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,GL_TEXTURE_2D, *texture, 0);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, *depth, 0); // <- With this the color texture becomes all white, without it everything works perfectly!
glBindFramebufferEXT(GL_FRAMEBUFFER,0);
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
MessageBox(0,"Looks like we are having problems with Post Processing...","Did it work?!",MB_OK);
What should i do? Remembering everything works well without the function i pointed above in the code!