[cairo] Re: [Mesa3d-dev] Points in Cairo Glitz paper
David Reveman
c99drn at cs.umu.se
Sun Apr 25 17:49:08 PDT 2004
On Sun, 2004-04-25 at 11:01 -0600, Marcelo E. Magallon wrote:
> On Wed, Apr 21, 2004 at 08:11:53AM -0700, Jon Smirl wrote:
>
> > The best way to do this would be to perform compositing with a mask
> > surface directly without the creation of an intermediate surface.
> > Even though the fixed OpenGL pipeline does not seem to allow for such
> > an operation, glitz is able to do this on hardware that supports
> > fragment programs.
>
> Hmm...
>
> Glitz does this:
>
> !!ARBfp1.0
> TEMP color;
>
> /* temporary */
> TEMP mask;
>
> /* src texture */
> TEX color, fragment.texcoord[0], texture[0], 2D;
>
> /* pd operation */
> TEX mask, fragment.texcoord[1], texture[1], 2D;
> MUL result.color, color, mask.a;
>
> END
>
> which can also be expressed in OpenGL as:
>
> glActiveTexture(GL_TEXTURE0_ARB);
> glEnable(GL_TEXTURE_2D);
> glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
> glActiveTexture(GL_TEXTURE1_ARB);
> glEnable(GL_TEXTURE_2D);
> glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
>
> by loading the mask in GL_LUMINANCE format and binding the object to
> texture unit 1.
This would be the ideal solution for surfaces that only contain an alpha
channel (which are the surfaces mostly used as mask surfaces). It may
not be that good with surfaces that contain all four color channels
(pbuffers used with "render to texture" especially).
With the above working for alpha-channel surfaces we can get efficient
text rendering with cairo's OpenGL backend only by using
multi-texturing.
>
> I didn't take a closer look at the convolution operation and I'm not
> sure if the imaging extensions are capable of providing equal
> functionality.
I've actually tried using the imaging extensions for convolution
filtering but it turned out terribly slow.
- David
--
David Reveman <c99drn at cs.umu.se>
More information about the cairo
mailing list