shaders/default.frag
author František Kučera <franta-hg@frantovo.cz>
Wed, 27 Dec 2023 10:34:12 +0100
branchv_0
changeset 30 02972f051744
parent 28 4cbd9c0beb4c
permissions -rw-r--r--
import PDF loading code from the OHP3D private prototype
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
#version 330 core
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
2
3faef2f5128e better GLSL variable names
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
     3
uniform  sampler2D  uTexture;
28
4cbd9c0beb4c pass texture xattr 'shader-shark.texture.scale' to the shaders as 'uTextureScale' + update variable locations on each shader reload
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
     4
uniform  float      uTextureScale;
2
3faef2f5128e better GLSL variable names
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
     5
in       vec2       vTextureXY;
14
ceeb36fad818 transparency/alpha: simple binary transparent/opaque, no blending, just discard some fragments
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
     6
out      vec4       fColor;
0
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
14
ceeb36fad818 transparency/alpha: simple binary transparent/opaque, no blending, just discard some fragments
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
     8
vec4 grayscale(vec4 original) {
4
9aba96f0b001 fragment shader: add grayscale() function
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
     9
	const vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);
14
ceeb36fad818 transparency/alpha: simple binary transparent/opaque, no blending, just discard some fragments
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    10
	float luminance = dot(original.rgb, luminanceWeighting);
ceeb36fad818 transparency/alpha: simple binary transparent/opaque, no blending, just discard some fragments
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    11
	return vec4(vec3(luminance), original.a);
4
9aba96f0b001 fragment shader: add grayscale() function
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    12
}
9aba96f0b001 fragment shader: add grayscale() function
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    13
18
c4384f43c739 new shader: phosphor-basic.frag
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    14
void main() {
14
ceeb36fad818 transparency/alpha: simple binary transparent/opaque, no blending, just discard some fragments
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    15
	fColor = texture(uTexture, vTextureXY).rgba;
4
9aba96f0b001 fragment shader: add grayscale() function
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    16
	// fColor = grayscale(fColor);
14
ceeb36fad818 transparency/alpha: simple binary transparent/opaque, no blending, just discard some fragments
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    17
	// fColor *= vec4(0.8, 1., 0.2, 1.);
ceeb36fad818 transparency/alpha: simple binary transparent/opaque, no blending, just discard some fragments
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    18
15
1eb7cfefbeea transparency/alpha: blending
František Kučera <franta-hg@frantovo.cz>
parents: 14
diff changeset
    19
	// if (fColor.a < 0.1) discard;
20
0899e966993e process all X11 event waiting in the queue in the same cycle
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
    20
	// Pretty, pretty, pretty, pretty, Peggy Sue
0
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
}