Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

antialiasing iPhone OpenGLES

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.

like image 996
Sergey Kopanev Avatar asked Feb 10 '10 09:02

Sergey Kopanev


4 Answers

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.

like image 59
benzado Avatar answered Nov 19 '22 11:11

benzado


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.

like image 21
epatel Avatar answered Nov 19 '22 12:11

epatel


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.

like image 2
genpfault Avatar answered Nov 19 '22 12:11

genpfault


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.

like image 2
Rula Avatar answered Nov 19 '22 11:11

Rula