diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-04-05 14:42:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-05 14:42:57 +0200 |
| commit | 2313de589ecfb6664fea79c1e2f7aa991cf477cb (patch) | |
| tree | e7bd36a4f99ea53efdbddca301a66939dde9cd98 /src/render/Shaders.hpp | |
| parent | 281b4f83a0f3a7be15136803c81a488d7a768a95 (diff) | |
| parent | bd5c056a601842c41816448b82cf5367e21ea0ad (diff) | |
Merge pull request #14 from vaxerski/custom-renderer-wlr
Added a custom wlr renderer
Diffstat (limited to 'src/render/Shaders.hpp')
| -rw-r--r-- | src/render/Shaders.hpp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/render/Shaders.hpp b/src/render/Shaders.hpp new file mode 100644 index 00000000..a9140aca --- /dev/null +++ b/src/render/Shaders.hpp @@ -0,0 +1,69 @@ +#pragma once + +#include <string> + +inline const std::string QUADVERTSRC = R"#( +uniform mat3 proj; +uniform vec4 color; +attribute vec2 pos; +attribute vec2 texcoord; +varying vec4 v_color; +varying vec2 v_texcoord; + +void main() { + gl_Position = vec4(proj * vec3(pos, 1.0), 1.0); + v_color = color; + v_texcoord = texcoord; +})#"; + +inline const std::string QUADFRAGSRC = R"#( +precision mediump float; +varying vec4 v_color; +varying vec2 v_texcoord; + +void main() { + gl_FragColor = v_color; +})#"; + +inline const std::string TEXVERTSRC = R"#( +uniform mat3 proj; +attribute vec2 pos; +attribute vec2 texcoord; +varying vec2 v_texcoord; + +void main() { + gl_Position = vec4(proj * vec3(pos, 1.0), 1.0); + v_texcoord = texcoord; +})#"; + +inline const std::string TEXFRAGSRCRGBA = R"#( +precision mediump float; +varying vec2 v_texcoord; +uniform sampler2D tex; +uniform float alpha; + +void main() { + gl_FragColor = texture2D(tex, v_texcoord) * alpha; +})#"; + +inline const std::string TEXFRAGSRCRGBX = R"#( +precision mediump float; +varying vec2 v_texcoord; +uniform sampler2D tex; +uniform float alpha; + +void main() { + gl_FragColor = vec4(texture2D(tex, v_texcoord).rgb, 1.0) * alpha; +})#"; + +inline const std::string TEXFRAGSRCEXT = R"#( +#extension GL_OES_EGL_image_external : require + +precision mediump float; +varying vec2 v_texcoord; +uniform samplerExternalOES texture0; +uniform float alpha; + +void main() { + gl_FragColor = texture2D(texture0, v_texcoord) * alpha; +})#"; |
