I’ve searched through the forum and the documentation and could not find much about it other than a brief mention of glut not supporting fsaa.

Is there an easy way to enable antialiasing with OF? Like smooth(); in processing?


in the graphics example there is smoothing, but it only works for lines. A hack it to draw filled and then unfilled (with smoothing enabled) to smooth shapes like circles, polygons, etc.

there are some other tricks for smoothing and we are looking at solutions for the problems you mentioned. I imagine in later releases we’ll have FSAA or the likes…

take care,

hi zach

can you give me ha hint for some of these FSAA tricks? I Have a sketch with some tilted ofImages and black background and they are pretty unsmooth :cry:

greetings ascorbin

A slow old school trick is to render your scene at 2x or 4x the resolution you want it at, then scale down to the original size. I’ve never done it myself using C - but use it regularly in Quartz Composer and works quite well. You could probably use FBO’s for this…

how bout using glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST) ?
maybe it only works when creating polygons (i.e. shapes created with ofBeginShape()) ?

I’ve had luck adding GLUT_MULTISAMPLE to the flags in glutInitDisplayMode() function that gets called in ofSetupOpenGL in ofAppRunner.cpp

at least on my mac

Hey! Thanks a lot! thats it! :lol: (on mac powerbook with GeForce 8600M GT)

i found that instead of:


glutInitDisplayString( "rgba double samples>=4 ");

makes it even nicer.

yeah that looks a LOT better


Wow, this is REALLY great! thanks alot!

From looking around if you’re using GLUT, you’ll need to use glutDisplayModeString instead of glutInitDisplayMode to get FSAA. So great find.

[EDIT] I wonder what kind of a speed hit this thing takes? Anyone done a test?


i would guess that it really depends on your machine and your graphics card.

i tried it at work on one of the new g5’s and noticed almost no difference at all, up until i got to rgba double samples>=16

(although really the amount of passes that make it look better vs. performance bottoms out around 8)

I allready noticed a difference with 4 passes. I do it at fullscreen though and I am on an old first gen MBP.

Well I’m on a g4 1.5ghz powerbook so I might be staying away from this until I upgrade my computer. Too bad you cant just turn it on/off as the app is running. I guess for individual shapes I might just do the outline trick.


I just found our that using glutInitDisplayString( "rgba double samples>=4 "); instead of glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_ALPHA | GLUT_MULTISAMPLE); makes depth testing and maskin impossible.

Any other Ideas?

Hm, …
not tested, but there are some more options for glutinitdisplayString.

see here ->…-.3GLUT.xml

so, maybe something like glutInitDisplayString( "rgb double depth alpha samples>=4 "); could work


I’ve got a problem when I try to replace glutInitDisplayMode with glutInitDisplayString - the console comes up with “GLUT: Fatal error in openframeworks: pixel format with necessary capabilities not found.” any ideas?

you shouldnt be replacing glutInitDisplayMode,
just add the line:

glutInitDisplayString( "rgba double samples>=4 ");

still not working; i think it’s a problem with my graphics card or smtg, it’s about 4 years old

I just got round to trying this and it works like a beaut. To re-iterate I replaced the line in ofAppRunning.cpp | void ofSetupOpenGL(…):



glutInitDisplayString( "rgba double samples>=4 ");  

To Zach and Theo, are there any plans in the near future let us define this from main.cpp or any other means?

As far as I understand glutInitDisplayString completely replaces glutInitDisplayMode.
glutInitDisplayString( "rgb double depth alpha samples>=4 ");

use this string to set up an ordinary window having depth buffer plus multisampling. If youd only use glutInitDisplayString( "rgba double samples>=4 "); you’d have no depth buffer at all.