I want to render my scene to a framebuffer and store the RGBA values in a texture. For this, I attach a texture to GL_COLOR_ATTACHMENT0. When I define a GL_DEPTH_ATTACHMENT texture as well, everything is rendered with the correct depth. However, if I leave out the depth attachment (because I don't need it in a later stage), wrong depth values are output, if I further use the RGBA texture (e.g. when blitting the framebuffer to another one).
Is this correct behavior, i.e. do I always need to specify a depth attachment?
edit: wrong depth values: By attaching a GL_COLOR_ATTACHMENT0, a color texture (e.g. RGBA) is output. Without a depth attachment, the colors are at the wrong "depth", in the sense that the pixels of an object behind a wall are rendered, although the corresponding pixels of the wall should be rendered instead.