diff --git a/assets/cubyz/shaders/graphics/Image.fs b/assets/cubyz/shaders/graphics/Image.fs index b2e522e3..47b4e2f5 100644 --- a/assets/cubyz/shaders/graphics/Image.fs +++ b/assets/cubyz/shaders/graphics/Image.fs @@ -7,5 +7,8 @@ flat in vec4 fColor; in vec2 uv; void main() { - frag_color = texture(image, uv) * fColor; + frag_color = texture(image, uv)*fColor; + if(frag_color.a == 0) { + discard; + } } diff --git a/src/gui/windows/crosshair.zig b/src/gui/windows/crosshair.zig index 37ec041e..c4a107c7 100644 --- a/src/gui/windows/crosshair.zig +++ b/src/gui/windows/crosshair.zig @@ -10,6 +10,8 @@ const gui = @import("../gui.zig"); const GuiWindow = gui.GuiWindow; const GuiComponent = gui.GuiComponent; +const c = main.graphics.c; + const size: f32 = 64; pub var window = GuiWindow{ .contentSize = Vec2f{size, size}, @@ -33,5 +35,9 @@ pub fn deinit() void { pub fn render() void { texture.bindTo(0); graphics.draw.setColor(0xffffffff); + c.glBlendFunc(c.GL_ONE, c.GL_ONE); + c.glBlendEquation(c.GL_FUNC_SUBTRACT); graphics.draw.boundImage(.{0, 0}, .{size, size}); + c.glBlendFunc(c.GL_SRC_ALPHA, c.GL_ONE_MINUS_SRC_ALPHA); + c.glBlendEquation(c.GL_FUNC_ADD); }