Using GLKit to do super simple antialiasing

I’ve been doing some work with OpenGL ES recently and I was getting irritated that lines produced tended to have very jagged edges. After exploring for a while I discovered that iOS has supported multi-sampling since iOS 4 however it takes quite a lot of code which I didn’t really fancy having to implement, especially because I was already using GLKit and therefore not using render or frame buffers. I didn’t want to have to blur line edges either, I just wanted full screen antialiasing.
It turns out that iOS 5 and above support antialiasing if you are using a GLKView:

GLKView *glkView = (GLKView*)self.view;
glkView.drawableMultisample = GLKViewDrawableMultisample4X;

Incredibly I didn’t detect any performance lag – I can quite happily achieve 60fps on a retina device with 100,000 triangles!


2 thoughts on “Using GLKit to do super simple antialiasing

  1. Works great on device. When enabling multisample4x on the simulator however, it has a huge performance impact. Zooming in on the image it appears as though multisample in that case actually becomes 4x supersampling since texels on the inside of a triangles are also anti-aliased which I would not expect from multi-sampling.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s