Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenGL: Objects are smooth if normally drawn, but edged when rendering to FBO

Tags:

opengl

fbo

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.

like image 702
TimV Avatar asked May 13 '13 13:05

TimV


1 Answers

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.

like image 51
Michael IV Avatar answered Oct 21 '22 10:10

Michael IV