5

I need in antialiasing in iPhone 3G (OpenGL ES1.1), NOT iPhone 3Gs with OpenGL ES.2.0. I've draw 3d model and have next: pixels on the edges of the model look like teeth.

I've try set any filters for texture, but this filters making ONLY texture INSIDE look better.

How can i make good antialising ? May be i should use any smooth for drawing triangles ? If yes, then how it possible in OpenGL ES1.1 ?

thanks.

genpfault
  • 51,148
  • 11
  • 85
  • 139
Sergey Kopanev
  • 1,496
  • 3
  • 17
  • 29

4 Answers4

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 epatel's suggestion: 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
4

You can render into a larger FBO and then use that as a texture on a square.

Have a look at this article for an explanation.

epatel
  • 45,805
  • 17
  • 110
  • 144
2

Check out the EGL_SAMPLE_BUFFERS and EGL_SAMPLES parameters to eglChooseConfig(), as well as glEnable(GL_MULTISAMPLE).

EDIT: Hrm, apparently you're out of luck, at least as far as standardized approaches go. As mentioned in that thread you can render to a large off-screen texture and scale to a smaller on-screen quad or jitter the view matrix several times.

genpfault
  • 51,148
  • 11
  • 85
  • 139
  • Thanks, but openGL on the iPhone has no support eglChooseConfig(). Or am I mistaken? But when i set GL_LINE_SMOOTH and use glDrawArrays with GL_LINE_STRIP i have SUPER antialiased line. But when i set GL_TRIANGLES then this effects is disappear. – Sergey Kopanev Feb 11 '10 at 15:17
  • Looks like you're right. Odd. Anyway, found a thread with some alternative approaches and edited the answer. – genpfault Feb 11 '10 at 15:46
  • genpfault, may be. i've googled more sites and feeling that there is only one way - try to use this http://www.gamedev.net/community/forums/topic.asp?topic_id=548956 or similar. – Sergey Kopanev Feb 11 '10 at 17:28
2

We found another way to achieve this. If you edit your textures and add for example a 2 pixel frame of transparent pixels, the colored pixels in the texture are blended with the transparent pixels when necessary giving a basic anti-aliasing effect. You can read the full article here in our blog.

The advantage of this approach is that you are not rendering a bigger image, or copying a buffer, or even worse, making a texture from a buffer, so there is no impact in performance.

Dreamwalker
  • 3,032
  • 4
  • 30
  • 60
Rula
  • 121
  • 5