[AD] al_set_color_mask function?

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


I had to use glColorMask [1] a few times in my A5 code recently, mainly
to control the alpha channel when drawing into a temporary bitmap.

Since blending is done after fragment shaders and ultimately controls
the final RGBA output, not even shaders can be used for the same
effect (and the function is therefore available even in the most recent
OpenGL versions, ES 2.x and normal 4.x).

So, I'd like a function in Allegro which allows this as well:

al_set_color_mask(bool red, green, blue, alpha)

It would be a state just like blending. Each component set to false
would be ignored in all drawing. By default they all would be true
of course.

In DirectX D3DRS_COLORWRITEENABLE [2] seems to be the equivalent
(although I have no idea how to set it there). But I'm not too
concerned about DX support, it would be a somewhat obscure function
anyway. Also wouldn't matter much if we can't easily support it in
software.

So, is it ok to add that function (initially just for OpenGL), or
is it a case where direct use of OpenGL/DirectX seems more appropriate?

[1] http://www.opengl.org/sdk/docs/man/xhtml/glColorMask.xml
[2] http://msdn.microsoft.com/en-us/library/windows/desktop/bb172599%28v=vs.85%29.aspx




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/