glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
-void GLContext::DisableAlphaBlending() noexcept {
+void GLContext::EnableInvertBlending() noexcept {
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
+}
+
+void GLContext::DisableBlending() noexcept {
glDisable(GL_BLEND);
}
static void EnableDepthTest() noexcept;
static void EnableBackfaceCulling() noexcept;
static void EnableAlphaBlending() noexcept;
- static void DisableAlphaBlending() noexcept;
+ static void EnableInvertBlending() noexcept;
+ static void DisableBlending() noexcept;
static void Clear() noexcept;
static void ClearDepthBuffer() noexcept;
void BlockLighting::Activate() noexcept {
GLContext::EnableDepthTest();
GLContext::EnableBackfaceCulling();
- GLContext::DisableAlphaBlending();
+ GLContext::DisableBlending();
program.Use();
}
world_prog.SetFogDensity(0.0f);
GLContext::ClearDepthBuffer();
+ GLContext::EnableInvertBlending();
world_prog.SetMVP(crosshair_transform, view, projection);
crosshair.Draw();
if (block_visible) {
+ GLContext::DisableBlending();
world_prog.SetM(block_transform);
block.Draw();