summaryrefslogtreecommitdiff
path: root/src/render/Shaders.hpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-04-05 14:42:57 +0200
committerGitHub <noreply@github.com>2022-04-05 14:42:57 +0200
commit2313de589ecfb6664fea79c1e2f7aa991cf477cb (patch)
treee7bd36a4f99ea53efdbddca301a66939dde9cd98 /src/render/Shaders.hpp
parent281b4f83a0f3a7be15136803c81a488d7a768a95 (diff)
parentbd5c056a601842c41816448b82cf5367e21ea0ad (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.hpp69
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;
+})#";