Anti-aliasing in OSX not working


#1

I’ve read how people use the setGlutDisplayString method to enable anti-aliasing but I’ve been unable to make this work. My main function looks like this:

int main(){
    ofAppGlutWindow window;
    window.setGlutDisplayString("rgb alpha double samples depth");
    ofSetupOpenGL(&window, 1024, 768, OF_FULLSCREEN);
    ofRunApp(new testApp());
}

I’ve tried many versions of the second line and all seem to give the same result. For example:

  • rgb double samples>=4 depth
  • rgb double depth alpha samples
  • rgba double samples>=4
  • rgba double depth alpha samples=4

etc, etc… yet in all versions my ofCircle look like the following (new users can’t post images so I had to break up the URL a little bit):

http:// i824.photobucket.com/albums/zz163/chillfok/jagged_zpsc0a4aa31.png

I’m in OSX 10.9, Xcode 5.11, Openframeworks v0.8.1.


#2

antialiasing is enabled by default since some versions ago so you shouldn’t need to do anything to enable it


#3

have you tried this? worked for me

ofAppGlutWindow window; // create a window
// set width, height, mode (OF_WINDOW or OF_FULLSCREEN)
window.setGlutDisplayString("rgba double samples>=4 depth");
ofSetupOpenGL(&window, 1024, 768, OF_WINDOW);
ofRunApp(new ofApp()); // start the app

#4

@atanyimebutnow thanks. I tried that but the results were exactly the same (well, technically I changed ofApp() to testApp() since my code uses a different class name but that shouldn’t be the problem).

Here’s a link to the project. It’s a modified example from the book “Mastering openFrameworks: Creative Coding Demystified”. I added a very small rotation to the fbo and the edges get blurred a little but still no real anti-alias.

https://www.dropbox.com/sh/3mz6h57z5ti1uei/AAAW8POTQDeUFt9kv1j3cmYla

If anyone running OSX has the time to run this and maybe post a screenshot of one of the edges I would really appreciate it.


#5

if you are using an fbo, then you need to enable antialiasing in the fbo itself, like:

fbo.allocate(w,h,GL_RGBA,4);

where 4 is the number of samples, the bigger that number the better the antialiasing


#6

Ahh there it is. Thanks! The difference is astonishing.