Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to achieve full-scene antialiasing on the iPhone

I would like to achieve FSAA on my OpenGL ES app on the iPhone.

Currently I do this by rendering the scene to a texture that is twice the width and height of the screen. I then use the nice function:

void glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height);

to draw the image resized to the screen resolution.

Is there a better way to do this?

Update Bounty Added I was wondering, given that its now Jan 2010, whether there is a better way to do this on v3.1 3GS phones, etc.

like image 504
Frank Krueger Avatar asked Jan 11 '09 06:01

Frank Krueger


2 Answers

For Gran Turismo on the PSP, the developers achieved an effect similar to anti-aliasing by moving the image back and forth one pixel per frame (demonstration can be found here: http://www.gtplanet.net/why-gran-turismo-psp-looks-so-good/) so if the iPhone doesn't support what you're looking for that's an option.

like image 133
ehdv Avatar answered Sep 20 '22 17:09

ehdv


As of iOS 4.0, full-screen anti-aliasing is directly supported via an Apple extension to OpenGL. The basic concept is similar to what you are already doing: render the scene onto a larger framebuffer, then copy that down to a screen-sized framebuffer, then copy that buffer to the screen. The difference is, instead of creating a texture and rendering it onto a quad, the copy/sample operation is performed by a single function call (specifically, glResolveMultisampleFramebufferAPPLE()).

For details on how to set up the buffers and modify your drawing code, you can read a tutorial on the Gando Games blog which is written for OpenGL ES 1.1; there is also a note on Apple's Developer Forums explaining the same thing.

Thanks to Bersaelor for pointing this out in another SO question.

like image 29
benzado Avatar answered Sep 23 '22 17:09

benzado