From Gnash Project Wiki

Jump to: navigation, search

We need to enable anti-aliasing in the OpenGL renderer. The OpenGL specification refers to it as smoothing. Anti-aliasing in OpenGL is implemented using blending. Therefore, if you alter the blending settings, you alter the anti-aliasing.

In the OpenGL renderer, an artefact is either drawn as a line (strip) or as a triangle (classified as a polygon) strip. Line anti-aliasing is already enabled:


In Flash, some polygons (shapes) are outlined. That's great because the outlines take care of anti-aliasing. However, many polygons don't have outlines. So we have to enable polygon anti-aliasing similarly:


However, it's more complex than that. A flash shape in OpenGL is most likely represented as a set of triangles. If you simply enable polygon anti-aliasing, every triangle in the shape will be anti-aliased against the next -- you will be able to see that the shape is made from triangles.

Another anti-aliasing strategy is to draw all objects as if they were lines. This will allow OpenGL to take advantage of line smoothing (which is already enabled). A drawback is that everything starts to look surprisingly... linear.

A third option that I came up with is to draw the outlines of shapes that don't have Flash-defined outlines. This information should be available from the triangle coordinates which are currently passed to the OpenGL renderer. And since lines do have anti-aliasing, our problems would be solved. This is the poor man's anti-aliasing (and may well be worth keeping for around people running software Mesa), because this only works for shapes with solid fills.

A more popular technique is provided by the ARB_multisample OpenGL extension. This is as easy to use as polygon or line smoothing. Unfortunately, GtkGLExt does not yet support this extension! Since the program in which you want to use multisampling must know about it before window creation, we cannot do this without GtkGLExt. So unless we replace GtkGLExt, this is not an option for us (the vast majority of our users rely on GTK).

The last technique I'm describing here is using the accumulation buffer. This may be our best option at this point, because it is relatively well-supported -- and it is the only true anti-aliasing technique so far.