2D antialiased graphics using OpenGL

Martijn Sipkema msipkema@sipkema-digital.com
Thu, 11 Dec 2003 21:16:50 +0100


> > I've taken a quick look at cairo at if I understand correctly it draws
> > back-to-front
>
> cairo is an immediate mode library, so it draws in whatever order the
> application requests it to.  It exposes the GL_SRC_ALPHA_SATURATE operator
> so that applications may use it if they so choose.  Note that cairo
> doesn't dictate what destination format is used, so applications would
> have to find something suitable before using this operator.  The Render
> extension can use external alpha buffers so that a 16 bit screen can still
> use destination alpha operators.

Oh, ok. I don't think I understand what Cairo does exactly. If it were to do
only PostScript like drawing, then it would always draw back-to-front and
this would require rendering to an auxiliary buffer first and then copying
that
over the existing material when using OpenGL (and the color values would
be already multiplied by the alpha value in the aux buffer). If other than
the
normal compositing is to be provided then this would still mean rendering
to the auxiliary buffer first, since the fundamental object is not a
triangle,
but the stroked/filled path. Am I understanding this correctly?

> > Handling gamma correction in the framebuffer is a pain. Can't we just
> > assume that the framebuffer is gamma corrected?
>
> Heh.  Linear frame buffers need to be 10 to 12 bits per component to avoid
> visible banding in continuous tone images.  Turns out that the weird
> exponential behaviour of the classic CRT matches the intensity response
> curve of the eye well enough that 8 bits per component is usable in that
> space.  A happy coincedence, but it does mean significantly more
> computation to take advantage of it.

But how can one do compositing when gamma is not 1? AFAIK graphics
hardware expects a framebuffer with a gamma of 1, i.e. a smooth shading
will not render gamma corrected in hardware, right?

I'd rather have convenient, fast rendering and suffer slightly worse
resolution
in some color range. If 8 bit per channel is not enough, then the hardware
should provide more. OpenGL rendering clearly expects a gamma == 1
framebuffer I think...

--ms