Added love.graphics.setColorMask(r, g, b, a) and love.graphics.getColorMask()

setColorMask enables or disables specific color components when rendering and clearing the screen.
For example, setColorMask(true, false, true, true) will prevent the green component of the color of all rendered objects from being written to the current frame buffer.
setColorMask is a wrapper for http://www.opengl.org/sdk/docs/man2/xhtml/glColorMask.xml

--HG--
branch : love.graphics.setColorMask
This commit is contained in:
Alex Szpakowski
2013-02-26 11:24:30 -04:00
parent 0be26b7678
commit e5670e69b3
4 changed files with 66 additions and 2 deletions
+16
View File
@@ -76,6 +76,9 @@ struct DisplayState
bool scissor;
GLint scissorBox[4];
// Color mask.
bool colorMask[4];
// Window info.
std::string caption;
bool mouseVisible;
@@ -94,6 +97,7 @@ struct DisplayState
pointSize = 1.0f;
pointStyle = Graphics::POINT_SMOOTH;
scissor = false;
colorMask[0] = colorMask[1] = colorMask[2] = colorMask[3] = true;
caption = "";
mouseVisible = true;
}
@@ -303,6 +307,17 @@ public:
**/
Font *getFont() const;
/**
* Sets the enabled color components when rendering.
**/
void setColorMask(bool r, bool g, bool b, bool a);
/**
* Gets the current color mask.
* Returns an array of 4 booleans representing the mask.
**/
const bool *getColorMask() const;
/**
* Sets the current blend mode.
**/
@@ -521,6 +536,7 @@ private:
float lineWidth;
GLint matrixLimit;
GLint userMatrices;
bool colorMask[4];
int getRenderHeight() const;
}; // Graphics