9

I have a problem with different visual results when using a FBO compared to the default framebuffer:

I render my OpenGL scene into a framebuffer object, because I use this for color picking. The thing is that if I render the scene directly to the default framebuffer, the output on the screen is quite smooth, meaning the edges of my objects look a bit like if they were anti-aliased. When I render the scene into the FBO and afterwards use the output to texture a quad that spans the whole viewport, the objects have very hard edges where you can easily see every single colored pixel that belongs to the objects.

Good:

dtizcto7.png

Bad:

wy7hg754.png

At the moment I have no idea what the reason for this could be. I am not using some kind of anti-aliasing.

System:
Fedora 18 x64
Intel HD Graphics 4000 and Nvidia GT 740M (same result)

Edit1:

As stated by Damon and Steven Lu, there is probably some kind of anti-aliasing enabled by the system by default. I couldn't figure out so far how to disable this feature.
The thing is that I was just curious why this setting only had an effect on the default framebuffer and not the one handled by the FBO. To get anti-aliased edges for the FBO too, I will probably have to implement my own AA method.

genpfault
  • 51,148
  • 11
  • 85
  • 139
Tim
  • 135
  • 1
  • 12
  • 11
    This looks perfectly normal. You have probably enabled MSAA in the grasphic card's control panel (some setting like "override application" or "force always on"), which is why the render-to-screen looks antialiased. Rendering to a FBO does not use multisampling, unless you explicitly tell OpenGL to do so by adding multisample attachments. – Damon May 13 '13 at 13:13
  • 2
    @Damon: Answers. Post *answers*, not comments. – Nicol Bolas May 13 '13 at 13:35
  • What's wrong with posting a comment? If you're so certain his comment is accurate and answers the question completely, post it yourself. –  May 13 '13 at 13:58
  • @Damon: Thx, I thought of that too, but I the Intel Graphics relies on Mesa and the Nvidia card brings its own OpenGL implementation as far as I know. The consequence would be that this should effect only one of them. Edit: Is there a way to check whether AA is enabled or not? – Tim May 13 '13 at 14:46
  • It must then be some setting your program or environment sets that enables AA on the frame buffer. – Steven Lu May 13 '13 at 21:03
  • Also notice how the shade of the background and cube are different. Gamma correction/sRGB conversion issues? – Steven Lu May 13 '13 at 21:04
  • @Steven Lu: I fixed the shading issue. There was an error in my fragment shader which did one calculation twice. – Tim May 14 '13 at 10:32
  • Are you still unable to isolate the reason why non-FBO rendering is anti-aliased? Check anything render target related, anything in the drivers. – Steven Lu May 14 '13 at 14:22
  • I was searching for a while but couldn't find something usefull. The Intel driver seems to have nothing to tweak at all and the Nvidia driver is a bit buggy because of my attempt to use Linux and Nvidia Optimus together. That the scene is anti-aliased as default is not that problematic. I just thought it would be nice to have the FBO anti-aliased too. I'm working on this now. – Tim May 14 '13 at 14:34

1 Answers1

8

Once you draw your scene into custom FBO the externally defined MSAA level doesn't apply anymore.You must configure your FBO to have Multi-sample texture or render buffer attachments setting number of sample levels along the way.Here is a reference.

Michael IV
  • 11,016
  • 12
  • 92
  • 223