diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2020-07-07 23:12:04 -0300 |
---|---|---|
committer | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2020-07-07 23:12:04 -0300 |
commit | ab30228b1a57053323363674fa7f137c0329a180 (patch) | |
tree | 50849a3680d61a2428665cc1035f1f4215870acb /Project/Basic.shader | |
parent | 6c0e98a2727d07e1fbb38b78c27d68e98ad09465 (diff) | |
download | PSP.git-ab30228b1a57053323363674fa7f137c0329a180.tar.gz PSP.git-ab30228b1a57053323363674fa7f137c0329a180.tar.xz PSP.git-ab30228b1a57053323363674fa7f137c0329a180.zip |
Voltage heat map implemented
Voltage heat map implemented using modern OpenGL =)
New external library required:
-GLEW
-GLFW
-GLM (incorporeted at the source)
Old memory leaks fixed =)
Diffstat (limited to 'Project/Basic.shader')
-rw-r--r-- | Project/Basic.shader | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Project/Basic.shader b/Project/Basic.shader new file mode 100644 index 0000000..a46dc97 --- /dev/null +++ b/Project/Basic.shader @@ -0,0 +1,30 @@ +#shader vertex +#version 330 core + +layout(location = 0) in vec4 position; +layout(location = 1) in vec3 colour; + +uniform mat4 u_mvpMatrix; + +void main() +{ + gl_Position = u_mvpMatrix * position; +}; + +#shader fragment +#version 330 core + +layout(location = 0) out vec4 color; + +vec3 hsl2rgb(in vec3 c) +{ + vec3 rgb = clamp(abs(mod(c.x * 6.0 + vec3(0.0, 4.0, 2.0), 6.0) - 3.0) - 1.0, 0.0, 1.0); + + return c.z + c.y * (rgb - 0.5) * (1.0 - abs(2.0 * c.z - 1.0)); +} + +void main() +{ + vec3 colorRGB = hsl2rgb(vec3(gl_FragCoord.z * 0.8, 1.0, 0.5)); + color = vec4(colorRGB, 1.0); +}; |