You didn’t check your framebuffer for completeness. If you had, it would have given you GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT, which tells you that all of the attachments to the framebuffer must have the same number of samples. So if you attach a multisample depth buffer, you must also attach a multisample color buffer that has the same number of samples.
Since you want to use the color buffer as a texture, this will require being able to create a multisample texture. This functionality is core in OpenGL 3.3, and is available through the ARB_texture_multisample extension. But it’s going to complicate your shader code.
Well, the return value is GL_FRAMEBUFFER_COMPLETE_EXT.Note that I haven’t created and attached a multisample color buffer to the FBO. I just attach a 2D texture to color buffer 0.
How should I create a multisample texture?
But I have enabled multisampling without creating a multisample texture( I set the parameters of the 2D texture using glTexImage2D function ). So why should I use multisample texture?