[Scummvm-devel] 16bit alpha blending
Marcus Comstedt
marcus at mc.pp.se
Sun Feb 20 13:16:31 CET 2011
Hi all.
I was idly pondering a bit about the 16bit support we now have, and
suddenly realized that while it is possible for the engine to select
a pixel mode which has an alpha channel, it can not select or even
query what blending function it has. It can reasonably expect some
kind of "over" function by default, but is it with pre-multiplied
alpha (glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)) or without
(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA))? For the overlay
we used pre-multiplied alpha because it made the software blending
in e.g. VectorRendererSpec<PixelType>::blendPixelPtr() simple and
efficient both for overlays with and without alpha. But I don't think
anything has been said about alpha outside the overlay.
This is probably a non-issue for the main game surface, because there
is nothing to blend it against (I disable alpha blending for this
surface in the DC backend), but for the cursor surface it could make
a difference.
So should we take some kind of policy decision on which kind of alpha
blending a pixelformat with alpha has, or allow the backend to provide
multiple and let the engine choose?
// Marcus
More information about the Scummvm-devel
mailing list