From d1adb313e62ba138c68515a9eadd7de13e6847d5 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sun, 13 Sep 2020 09:57:00 +0200 Subject: [PATCH] Improved the opacity shader. --- resources/shaders/glsl/opacity.glsl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/shaders/glsl/opacity.glsl b/resources/shaders/glsl/opacity.glsl index a63dda14f..5e71d3b34 100644 --- a/resources/shaders/glsl/opacity.glsl +++ b/resources/shaders/glsl/opacity.glsl @@ -28,9 +28,8 @@ varying vec2 vTexCoord; void main() { vec4 color = texture2D(myTexture, vTexCoord); - float alpha = clamp(color.a-(1-opacity), 0.0, 1.0); - gl_FragColor = vec4(color.rgb, alpha); + gl_FragColor = vec4(color.rgb, color.a * opacity); } #endif