13

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.

Frank Krueger
  • 69,552
  • 46
  • 163
  • 208

4 Answers4

8

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.

ehdv
  • 4,483
  • 7
  • 32
  • 47
8

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.

Community
  • 1
  • 1
benzado
  • 82,288
  • 22
  • 110
  • 138
3

Technically iPhone's GPU (PowerVR MBX Lite) should support anti-aliasing. However, it seems that current Apple's OpenGL ES drivers (as of Jan 2009) don't expose this capability. So doing "manual AA" just like you do is pretty much the only way.

NeARAZ
  • 5,965
  • 27
  • 28
2

http://iphonedevelopment.blogspot.com/2009/06/opengl-es-2-shaders.html?showComment=1245770504079#c6001476340022842908

iPhone OS 3.0 + OpenGL ES 2.0. Is anyone seeing better anti-aliasing?

Sounds like you can't do it in hardware since you don't render to the framebuffer, only a texture that the iPhone composites for you.

Community
  • 1
  • 1
MSN
  • 53,214
  • 7
  • 75
  • 105
  • I really like that blog-link. The explanation on why the AA-feature is not exposed by the driver does make total sense and helped me to understand the reasoning. Thank you for posting it. – Till Feb 25 '10 at 21:41