openGL multisampled FBO and Floating Point Texture

Hi,

I am currently trying to figure out a way to do Multisampling with floating point textures on an FBO but I don’t really get it to work. Is that possible?

For Floating point textures I set my FBO up like that:


// Setup our FBO
	glGenFramebuffersEXT(1, &fbo);
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
	
	glGenTextures(1, (GLuint *)textureName); 
    
        glEnable(GL_TEXTURE_2D);
	

		glBindTexture(GL_TEXTURE_2D, (GLuint)textureName[0]);
			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, (width), (height), 0, GL_RGBA, GL_FLOAT, NULL);
			glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
			glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
			glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, (GLuint)textureName[0], 0);

//setup Depthbuffer:
		glGenRenderbuffersEXT(1, &depthBuffer);
		glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depthBuffer);
		glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, width, height);
		glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthBuffer);

For Multisampling on the FBO I generate another FBO for blitting:


glGenRenderbuffersEXT(1, &mcolorBuffer);
		glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, mcolorBuffer);
		glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, 3, GL_RGBA, width, height);
		
		glGenRenderbuffersEXT(1, &mdepthBuffer);
		glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, mdepthBuffer);
		glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, 3, GL_DEPTH_COMPONENT24, width, height);
		
		glGenFramebuffersEXT(1, &mfbo);
		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mfbo);
		glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, mcolorBuffer);
		glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, mdepthBuffer);

So basically everything works as long as I don’t use a floating point texture when using multisampling. What can I do to use both at the same time? Any ideas?

When I put GL_RGBA16F_ARB as the format for the multisampled FBO it still does not work. Weirdness.

By the way, I am on a First generation Mac Book Pro with an ATI Radeon x1600. Could it be that the card simply does not support multisampling on floating point targets?

I have not checked your actual code but I had similar problems on my mac last year. The problems had to do with the driver. Most was solved in the 10.5.6 update.

Head over to the Mac-section and you will find that thread.

I think the X1xxx-Series from ATI only supports GL_NEAREST filtering for float textures, maybe that’s the problem:
http://www.gamedev.net/community/forums/topic.asp?topic_id=349685

You can emulate the bilinear filter in the shader.

(I’m not sure about about the multisampling with floating point FBO, but remember that the game Oblivion could do MSAA with HDR on X1900 Cards using Direct3D9).

hmm thank you but the floating point part works fine as long as I don’t use multisampling. GL_Nearest does not help in that case. I will try it on a newer mac, thanks :slight_smile:

I just tried it on a new Mac Book Pro and it works just fine. The ATI Radeon x1600 in my old Mac Book Pro seems to be too old to handle it. (or in apples case it could also be the drivers, who knows)