]> git.localhorst.tv Git - blank.git/commitdiff
fancy crosshair
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 23 Jul 2015 08:34:49 +0000 (10:34 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 23 Jul 2015 15:28:41 +0000 (17:28 +0200)
don't use on .5 gray ;)

src/app/init.cpp
src/app/init.hpp
src/graphics/shader.cpp
src/ui/ui.cpp

index 6fa2dfd6c0b9722c2856de9cc528ac035fdaac7b..9c97c9f4b31432b212149efc1e2d30338eb317d0 100644 (file)
@@ -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);
 }
 
index cd0d9be481121ee80d55b87c9cdb9eada719cff3..f0777c85d5e4161b5f4926f37798f70a598a7a12 100644 (file)
@@ -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;
index 41c1faf57f33be1cfdec0b90a05c767e3f0486a6..c38f9af2d15177ab65e514044eb736faad9f0f14 100644 (file)
@@ -321,7 +321,7 @@ BlockLighting::BlockLighting()
 void BlockLighting::Activate() noexcept {
        GLContext::EnableDepthTest();
        GLContext::EnableBackfaceCulling();
-       GLContext::DisableAlphaBlending();
+       GLContext::DisableBlending();
        program.Use();
 }
 
index 8e48f143b5c006f7aea3db4db9563b3c9cc05058..4775999310d1bb6b2bdd44998725597a6011539e 100644 (file)
@@ -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();