Move EnableDepthTest functionality into a bool alpha_blend var on ImmediateDraw.

This commit is contained in:
Dr. Chat
2016-02-16 18:24:37 -06:00
parent e77af94c7c
commit 253e164753
4 changed files with 14 additions and 22 deletions

View File

@@ -228,6 +228,14 @@ void GLImmediateDrawer::Draw(const ImmediateDraw& draw) {
glDisable(GL_SCISSOR_TEST);
}
if (draw.alpha_blend) {
glEnablei(GL_BLEND, 0);
glBlendEquationi(0, GL_FUNC_ADD);
glBlendFunci(0, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
} else {
glDisablei(GL_BLEND, 0);
}
if (draw.texture_handle) {
glBindTextureUnit(0, static_cast<GLuint>(draw.texture_handle));
} else {
@@ -270,16 +278,6 @@ void GLImmediateDrawer::End() {
}
}
void GLImmediateDrawer::EnableAlphaTest(bool enable) {
if (enable) {
glEnablei(GL_BLEND, 0);
glBlendEquationi(0, GL_FUNC_ADD);
glBlendFunci(0, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
} else {
glDisablei(GL_BLEND, 0);
}
}
} // namespace gl
} // namespace ui
} // namespace xe

View File

@@ -37,8 +37,6 @@ class GLImmediateDrawer : public ImmediateDrawer {
void EndDrawBatch() override;
void End() override;
void EnableAlphaTest(bool enable);
private:
void InitializeShaders();