Multisampling is not working with FBO (Frame Buffer Object)

I noticed that whenever i use a Frame Buffer Object FBO to apply a post processing effect to my whole scene multisampling is disabled. here’s some sample code:

sceneFBO.bindFBO(); // binds my fbo to scene


gl.glGetIntegerv(GL.GL_SAMPLE_BUFFERS, buf, 0);
System.out.println("number of sample buffers is " + buf[0]);
gl.glGetIntegerv(GL.GL_SAMPLES, sbuf, 0);
System.out.println("number of samples is " + sbuf[0]);

      // draw stuff here

sceneFBO.unbindFBO(); // unbinds it.

gl.glGetIntegerv(GL.GL_SAMPLE_BUFFERS, buf, 0); and gl.glGetIntegerv(GL.GL_SAMPLES, sbuf, 0); both return values of 0 but if i disable my FBO they return 1 and 16 which is what i have my GLcapabilities set to. How do i get multisampling or any sort of anti-aliasing to work while using an FBO?

At the moment, the standard FBO extension can’t support multi-sampling. (I think it has an extension or the option in opengl 3.0, but I’m not sure). When you bind a fbo, you switch around the active drawing buffer, so any request for information on the drawn buffer will return numbers meaningful for the fbo and not the window.

I’m not sure how you’d get full scene antialiasing done with fbos unless you went with a traditional approach:
Use primitive aliasing, which is a little tricky to get setup correctly for polygon meshes

or

Render the scene multiple times with the camera adjusted by a very small amount (< pixel). This approach usually works with an accumulation buffer, but I don’t know how much support they have, or if they work with fbos.

Thanks for the quick reply i actually found and answer shortly after i posted :stuck_out_tongue: . You need to use glRenderbufferStorageMultisampleEXT that is mentioned in this post:

http://www.gamedev.net/community/forums/topic.asp?topic_id=468653

I was able to implement the c code to jogl without difficulty. works flawlessly.

Yep, that’s what I was trying to remember.