Why run xserver on the OpenGL API?
Marcelo E. Magallon
mmagallo@debian.org
Sat, 3 Jan 2004 23:23:48 -0600
On Tue, Nov 25, 2003 at 03:44:35PM -0800, Keith Packard wrote:
> operations not supported by GL that might make good candidates (plane
> masks, per-component alpha, conjoint/ disjoint compositing
> operators).
Hmm... I can't think of a simple way of emulating plane masks. For a
mask m, and source and destination fragments s and d, you want, as far
as I understand the operation of X plane masks:
d' = (s | ~m) & d
which is doable, but in three passes
1 draw d
copy to tex
2 draw m
GL_COLOR_LOGIC_OP -> GL_OR_REVERSE
draw s
copy to tex
3 draw d from tex
GL_COLOR_LOGIC_OP -> GL_AND
draw (s| ~m) from tex
but not many implementations hardware accelerate this.
As for per-component alpha, I guess you mean per component weighting
factors. That's certainly doable, it's called GL_blend_func_separate
and it's part of OpenGL 1.5 (AFAIR). It's not commonly supported in
hardware (or better said, only recent commodity hardware supports it).
And all the operators in the Duff & Porter paper can be implemented
with OpenGL as long as you can change the order of rendering (i.e., if
"A" and "B" are fixed -- that is, always the source and destination
images -- you need to reverse the order for some operators, or use
destination alpha, which might or might not be so nice). It's just a
matter of playing with the blending factors.
Cheers,
Marcelo