summaryrefslogtreecommitdiff
path: root/resources/shaders/texture.frag
diff options
context:
space:
mode:
authorSebastian Park <SebPark03@gmail.com>2024-04-23 00:30:37 -0400
committerSebastian Park <SebPark03@gmail.com>2024-04-23 00:30:37 -0400
commitf2d61fc06387ccb22ecb5cb6c42210736ac64c9f (patch)
tree9191e1e91a79514a5231dc6e50c2ecc4feb03b16 /resources/shaders/texture.frag
parentb4be9e522b51b01c7870821648e85f97c1fdb09b (diff)
Get ground textures working, but not yet abstracted to the shape class.
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;
+ }
+}