2D antialiased graphics using OpenGL

Martijn Sipkema msipkema@sipkema-digital.com
Tue, 9 Dec 2003 20:12:03 +0100


> | When doing 2D graphics using OpenGL one needs to draw front to
> | back using GL_SRC_ALPHA_SATURATE. ...
>
> That's one way to do it.
>
> All the antialiased drawing techniques are approximations.  Each has its
> advantages and disadvantages.  Off the top of my head, here are some of
> the techniques and tradeoffs:
>
> Drawing front-to-back using GL_SRC_ALPHA_SATURATE.

This method requires a destination alpha channel. Does available hardware
have this? I know my O2 has this and I think this method is quite fast on
it, though I haven't done extensive testing. I wonder if say a G400 support
destination alpha.

[...]
> Multipass using accumulation buffering.

I don't think this one is best suited for 2d...

[...]
> Multipass using blending.

Could you explain this one a little more?

[...]
> Full-scene antialiasing using hardware assist (typically
> multisampling, sometimes supersampling).  Advantages:  Very
> fast; works for all primitives, interrelationships, and
> rendering models; well-supported in current hardware.
> Disadvantages:  Some extra memory required (typically less than
> for software supersampling or accumulation buffering); yields
> decent-quality results but some people may not find them
> acceptable for small text.  (Very high-quality results are
> achieved on high-end systems, but not relevant in this
> discussion.)

I think, in theory, multisampling could also sample so as to improve
display on an LCD monitor. This is one of the best ways to do
antialiasing for 2d and 3d graphics I think, if supported by the
hardware.

Multisampling could also be used for font antiasliasing (using
texture maps for fonts).

> At the moment I'm interested in multipass using blending.  It seems to
> be the most flexible option with low memory requirements and good
> hardware support.  It handles intersections and near-approaches
> correctly, which compositing-based systems often can't, so it looks good
> for scenes with combined text and graphics.  It does place limitations
> on the rendering model, though, and I have no idea whether the toolkit
> and apps folks have thought about whether those would be acceptable.

I'm not familiar with this technique. Of the others drawing front-to-back
using GL_SRC_ALPHA_SATURATE and multisampling seem most
attractive, but the first needs destination alpha and I think aux buffers
too
to be useful.

--ms