From: Daniel Karbach Date: Thu, 23 Jul 2015 08:34:49 +0000 (+0200) Subject: fancy crosshair X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=2c2c02796e9df82d0cda12b59aad638d40b4e8b4;p=blank.git fancy crosshair don't use on .5 gray ;) --- diff --git a/src/app/init.cpp b/src/app/init.cpp index 6fa2dfd..9c97c9f 100644 --- a/src/app/init.cpp +++ b/src/app/init.cpp @@ -175,7 +175,12 @@ void GLContext::EnableAlphaBlending() noexcept { 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); } diff --git a/src/app/init.hpp b/src/app/init.hpp index cd0d9be..f0777c8 100644 --- a/src/app/init.hpp +++ b/src/app/init.hpp @@ -97,7 +97,8 @@ public: 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; diff --git a/src/graphics/shader.cpp b/src/graphics/shader.cpp index 41c1faf..c38f9af 100644 --- a/src/graphics/shader.cpp +++ b/src/graphics/shader.cpp @@ -321,7 +321,7 @@ BlockLighting::BlockLighting() void BlockLighting::Activate() noexcept { GLContext::EnableDepthTest(); GLContext::EnableBackfaceCulling(); - GLContext::DisableAlphaBlending(); + GLContext::DisableBlending(); program.Use(); } diff --git a/src/ui/ui.cpp b/src/ui/ui.cpp index 8e48f14..4775999 100644 --- a/src/ui/ui.cpp +++ b/src/ui/ui.cpp @@ -89,10 +89,12 @@ void HUD::Render(DirectionalLighting &world_prog, BlendedSprite &sprite_prog) no 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();