From 1f3d06c5816c2c4d09b36af988f9544eeb0b2af5 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sun, 13 Mar 2011 00:22:52 +0000 Subject: [PATCH] =?UTF-8?q?video:=208=C3=978=20Bresenham=20dithering=20(st?= =?UTF-8?q?ill=20deactivated).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/video.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/video.cpp b/src/video.cpp index 6e090a18..5bfa2e52 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -87,16 +87,26 @@ static char const *fragmentshader = #else " vec4 col = texture2D(in_Texture, vec2(gl_TexCoord[0]));\n" #if 0 + " float mul = 2.0;\n" " float dx1 = mod(gl_FragCoord.x, 2.0);\n" " float dy1 = mod(gl_FragCoord.y, 2.0);\n" " float t1 = mod(3.0 * dx1 + 2.0 * dy1, 4.0);\n" " float dx2 = mod(floor(gl_FragCoord.x * 0.5), 2.0);\n" " float dy2 = mod(floor(gl_FragCoord.y * 0.5), 2.0);\n" " float t2 = mod(3.0 * dx2 + 2.0 * dy2, 4.0);\n" - " float t = (1.0 + 4.0 * t1 + t2) / 17.0;\n" - " col.x = col.x > t ? 1.0 : 0.0;\n" - " col.y = col.y > t ? 1.0 : 0.0;\n" - " col.z = col.z > t ? 1.0 : 0.0;\n" + " float dx3 = mod(floor(gl_FragCoord.x * 0.25), 2.0);\n" + " float dy3 = mod(floor(gl_FragCoord.y * 0.25), 2.0);\n" + " float t3 = mod(3.0 * dx3 + 2.0 * dy3, 4.0);\n" + " float t = (1.0 + 16.0 * t1 + 4.0 * t2 + t3) / 65.0;\n" + " float fracx = fract(col.x * mul);\n" + " float fracy = fract(col.y * mul);\n" + " float fracz = fract(col.z * mul);\n" + " fracx = fracx > t ? 1.0 : 0.0;\n" + " fracy = fracy > t ? 1.0 : 0.0;\n" + " fracz = fracz > t ? 1.0 : 0.0;\n" + " col.x = (floor(col.x * mul) + fracx) / mul;\n" + " col.y = (floor(col.y * mul) + fracy) / mul;\n" + " col.z = (floor(col.z * mul) + fracz) / mul;\n" #endif " gl_FragColor = col;\n" #endif