I get black scene while using FBO+multisampling

Hi there
The following code works fine:


	glGenTextures(1, &m_Texture );								
	glBindTexture(GL_TEXTURE_2D, m_Texture );					
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
	glTexImage2D(GL_TEXTURE_2D, 0, channels, size, size, 0, type, GL_UNSIGNED_BYTE, NULL );

	m_fboID = g_render.GenerateFBO();
	g_render.BindFBO( m_fboID );
	g_render.Attach2DTextureToFBOColor( m_bloomTexture );
	m_rbID = g_render.GenerateRenderBuffer();
	g_render.BindRenderBuffer( m_rbID );
	glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, size, size );

	g_render.AttachDepthToFBO( m_rbID );
	g_render.BindFBO(0);
	g_render.BindRenderBuffer(0);


Now I’m trying to replace the glRenderbufferStorageEXT function with glRenderbufferStorageMultisampleEXT to enable multisampling:


glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, 4, GL_DEPTH_COMPONENT24, size, size);

Now I get a black texture.So what’s wrong with my code?

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?

I understood what’s wrong in my code. Regarding this article I must use 2 FBOs.

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?