How to disable antialiasing when rendering RGBA ofImages into FBO?


I’m rendering many ofImages with binary alpha channels (no grey values) into an FBO. Around the binary alpha mask edges I see what looks like a single pixel fringe that appears to be some automatic antialiasing. I have explicitly disabled MSAA when I allocate my FBO: montage.allocate(maxTextureSize, maxTextureSize, GL_RGBA, 0); // No MSAA

Following is what I end up with (RGB and A). Note the light (near transparent) 1px border in the alpha channel on the right.

I took the same two images and aligned them manually in GIMP to produce what I expect to happen in ofx shown in the following images. Note the lack of border in the alpha channel.

Since this does not seem to be MSAA, and the border is not in the ofImage alpha channels, it seems to be an artifact from rendering into the FBO. I’m using of_v0.9.8_linux64_release.

How can I disable this behaviour?




You need to set the minmag filters as GL_NEAREST, I think there’s a setMinMagFilter in either ofTexture or ofFbo (or in ofFbo’s getTexture)


Thanks @chuckleplant. That did the trick! I set min/mag to GL_NEAREST on the source ofImage. For some reason the destination FBO did not require any changes. Here is what I did: tmpImage.getTextureReference().setTextureMinMagFilter(GL_NEAREST,GL_NEAREST); // Disable AA


Glad I found this.

tmpImage.getTextureReference().setTextureMinMagFilter(GL_NEAREST,GL_NEAREST); // Disable AA

Also worked for me!