summaryrefslogtreecommitdiff
path: root/resources/shaders/texture.frag
diff options
context:
space:
mode:
authorSebastian Park <SebPark03@gmail.com>2024-04-23 12:06:00 -0400
committerSebastian Park <SebPark03@gmail.com>2024-04-23 12:06:00 -0400
commit12ec81fd1624e9b06e03d9a53a1873f63fe99c3b (patch)
treedb528688bbf888cf0f147a698d061f5c7ae89560 /resources/shaders/texture.frag
parenta556b45abf18f1bd509daaf63b66b7d55e9fd291 (diff)
parent6a5806b82c44a2cae481a6015d1a0f390e4b8445 (diff)
Merge branch 'shaders'
Diffstat (limited to 'resources/shaders/texture.frag')
-rw-r--r--resources/shaders/texture.frag24
1 files changed, 24 insertions, 0 deletions
diff --git a/resources/shaders/texture.frag b/resources/shaders/texture.frag
new file mode 100644
index 0000000..c7a5956
--- /dev/null
+++ b/resources/shaders/texture.frag
@@ -0,0 +1,24 @@
+#version 330 core
+
+// TASK 16: Create a UV coordinate in variable
+in vec2 uv;
+
+// TASK 8: Add a sampler2D uniform
+uniform sampler2D sampler;
+
+// TASK 29: Add a bool on whether or not to filter the texture
+uniform bool filtered;
+
+out vec4 fragColor;
+
+void main()
+{
+ // TASK 17: Set fragColor using the sampler2D at the UV coordinate
+ fragColor = texture(sampler, uv);
+
+ // TASK 33: Invert fragColor's r, g, and b color channels if your bool is true
+ if(filtered){
+ fragColor = vec4(1) - fragColor;
+ fragColor.w = 1;
+ }
+}