Search code examples
iosopengl-esopengl-es-2.0antialiasing

How draw antialiasing lines over texture in OpenGL ES?


I have texture (background image) and i trying draw antialiasing lines.

If i do these steps:

1) draw texture, draw shapes, glReadPixels() -> ugly lines

2) draw texture, draw shapes, glResolveMultisampleFramebufferAPPLE(), glReadPixels() -> slow performance

Can i make something like this?

framebuffer1: draw texture

framebuffer2: draw shapes, glResolveMultisampleFramebufferAPPLE()

then merge frame buffers, glReadPixels()


Solution

  • I would do this in three passes. First draw your lines normally with a frame buffer object with an assigned texture. Use this texture in a second pass with an FXAA (Fast approximate Anti-Aliasing) shader on another frame buffer object with a texture attached to it. At last you merge the resulting texture from the FXAA pass with the background image you mentioned.