[cairo] Antialiasing not working with glitz
David Reveman
c99drn at cs.umu.se
Mon May 3 00:52:20 PDT 2004
On Sun, 2004-05-02 at 21:23 -0400, Keith Packard wrote:
> Around 14 o'clock on May 2, David Reveman wrote:
>
> > GL_POLYGON_SMOOTH can never be used with glitz as it requires use of
> > special operators to produce correct results when drawing complex
> > objects.
>
> Could you do what Render does and use an intermediate alpha buffer?
> Render all of the polygons to that buffer with a saturating add operation
> and then use that to paint the final figure.
This is what we did in glitz earlier. Intermediate alpha buffers are
still used for drawing polygons but only in very rare occasions.
A short explanation of how cairo draws polygons with glitz; Whenever a
polygon is solid, cairo just draws it directly using
glitz_fill_trapezoids. If the polygon is not solid (alpha != 1 or fill
with source surface or fill with gradient) cairo uses
glitz_composite_trapezoids (using fill_trapezoids with alpha != 1
results in incorrect drawing when polygons are overlapping). Depending
on the hardware capabilities glitz_composite_trapezoids uses two
different methods for drawing polygons. 1. Draw all polygons to the
stencil buffer and then use the stencil buffer for clipping when
compositing the source surface. 2. Use an intermediate alpha buffer,
draw polygons into this buffer and then use it to composite the source
surface.
We can never use GL_POLYGON_SMOOTH with glitz_fill_trapezoids as it
would require using saturate add operator (we like to use
glitz_fill_trapezoids as it's without question the fastest way for
drawing polygons). We can of course not use GL_POLYGON_SMOOTH when
drawing polygons to the stencil buffer and this method is used whenever
a stencil buffer is available as it's much faster than using an
intermediate buffer. When using an intermediate buffer, we can use
GL_POLYGON_SMOOTH and we did this earlier in glitz but removed it as it
made anti-aliasing inconsistent. Polygon rendering using an intermediate
buffer in glitz currently requires pbuffer support.
Maybe it's possible to create a composite_trapezoids method that uses
the depth buffer and GL_POLYGON_SMOOTH, that will work. But I think it's
going to be hard to get polygon rendering using this method as fast as
when we're allowed to use glitz_fill_trapezoids.
One important thing why we don't like to use GL_POLYGON_SMOOTH:
It's not supported by all cards/drivers and there's no way we can
actually know it the driver will use GL_POLYGON_SMOOTH or just ignore
it.
-David
--
David Reveman <c99drn at cs.umu.se>
More information about the cairo
mailing list