diff options
Diffstat (limited to 'resources/shaders/texture.frag')
-rw-r--r-- | resources/shaders/texture.frag | 24 |
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; + } +} |