Add clear colour to GL state manager
This commit is contained in:
@@ -34,6 +34,8 @@ struct GLStateManager {
|
||||
bool redMask, greenMask, blueMask, alphaMask;
|
||||
bool depthMask;
|
||||
|
||||
float clearRed, clearBlue, clearGreen, clearAlpha;
|
||||
|
||||
GLuint stencilMask;
|
||||
GLuint boundVAO;
|
||||
GLuint boundVBO;
|
||||
@@ -44,6 +46,7 @@ struct GLStateManager {
|
||||
|
||||
void reset();
|
||||
void resetBlend();
|
||||
void resetClearing();
|
||||
void resetClipping();
|
||||
void resetColourMask();
|
||||
void resetDepth();
|
||||
@@ -209,8 +212,19 @@ struct GLStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
void setClearColour(float r, float g, float b, float a) {
|
||||
if (clearRed != r || clearGreen != g || clearBlue != b || clearAlpha != a) {
|
||||
clearRed = r;
|
||||
clearGreen = g;
|
||||
clearBlue = b;
|
||||
clearAlpha = a;
|
||||
|
||||
OpenGL::setClearColor(r, g, b, a);
|
||||
}
|
||||
}
|
||||
|
||||
void setDepthFunc(OpenGL::DepthFunc func) { setDepthFunc(static_cast<GLenum>(func)); }
|
||||
};
|
||||
|
||||
static_assert(std::is_trivially_constructible<GLStateManager>(), "OpenGL State Manager class is not trivially constructible!");
|
||||
static_assert(std::is_trivially_destructible<GLStateManager>(), "OpenGL State Manager class is not trivially destructible!");
|
||||
static_assert(std::is_trivially_destructible<GLStateManager>(), "OpenGL State Manager class is not trivially destructible!");
|
||||
Reference in New Issue
Block a user