[compiz] Re: [PATCH] Transparent cube

Vasek Potocek vasek.potocek at post.cz
Sun Apr 29 06:46:54 PDT 2007


Dennis Kasprzyk napsal:
> Am Samstag, 28. April 2007 15:35 schrieb Vasek Potocek:
>> Hello,
>>
>> is there any way of utilizing OpenGL's depth test instead of the paint
>> order? If I understand it well, the aim here is to get it looking _like_
>> with depth test. I understand that shifting windows by an "infinitesimal"
>> offset in the z direction would lead to various problems, but isn't is
>> possible to persuade OpenGL somehow to use different coordinate for the
>> depth test than for the perspective projection? (It would require a little
>> bit more math than I outlined here, but should be possible.)
>>
>> V.
> For transparency effects you can't use a depth test, you have to paint the 
> whole screen from back to front.
> 
> Dennis

I'm sorry, I really forgot about the problem with transparency x depth test. However, I still think this is soluble: 
what about using the cubeCheckFTB function for deciding which glBlendFunc to use? Normally we'd need to multiply the 
color drawn both by SRC_ALPHA and ONE_MINUS_DST_ALPHA, which is not possible well enough, but thanks to compiz' 
alpha-premultiply demand (fix me if it's not so), we could just choose glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); (as 
it is done now) when drawing in front of all and glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE); if drawing behind all. No 
other situation should arise in cube + 3D with BTF (and no other situation would be soluble at all even the original 
way, however).

I hacked together a little demo showing this, see the attachment and comments in it.

One problem I can see is this needs the support for alpha bitplanes, which is not so automatic, could we rely on it in 
Linux implementations?

V.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: order.c
Type: text/x-csrc
Size: 7360 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/compiz/attachments/20070429/cd148b56/order.c


More information about the compiz mailing list