shaders: dynamic line count derived from the texture resolution v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Wed, 06 Dec 2023 22:54:24 +0100
branchv_0
changeset 21 bcc53967ab3c
parent 20 0899e966993e
child 22 12262f2420de
shaders: dynamic line count derived from the texture resolution
shaders/phosphor-basic.frag
shaders/scanlines-basic.frag
--- a/shaders/phosphor-basic.frag	Tue Dec 05 22:55:25 2023 +0100
+++ b/shaders/phosphor-basic.frag	Wed Dec 06 22:54:24 2023 +0100
@@ -26,10 +26,10 @@
 	// fColor = invert(fColor);
 	fColor = (fColor-rand(vTextureXY)*0.3) * 1.6;
 
-	float lineCount = 200.;
+	float lineCount = textureSize(uTexture, 0).y;
 	fColor.xyz *= abs(sin(radians(vTextureXY.y * 180. * lineCount)));
 
-	// float columnCount = 320;
+	// float columnCount = textureSize(uTexture, 0).x;
 	// fColor.xyz *=
 	//  clamp(abs(sin(radians(vTextureXY.x * 180. * columnCount)))+0.6, 0., 1.);
 
--- a/shaders/scanlines-basic.frag	Tue Dec 05 22:55:25 2023 +0100
+++ b/shaders/scanlines-basic.frag	Wed Dec 06 22:54:24 2023 +0100
@@ -7,6 +7,6 @@
 void main() {
 	fColor = texture(uTexture, vTextureXY).rgba;
 
-	float lineCount = 200.;
+	float lineCount = textureSize(uTexture, 0).y;
 	fColor.xyz *= abs(sin(radians(vTextureXY.y * 180. * lineCount)));
 }