summaryrefslogtreecommitdiffstats
path: root/examples/widgets/rhi/cuberhiwidget/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/rhi/cuberhiwidget/shaders')
-rw-r--r--examples/widgets/rhi/cuberhiwidget/shaders/texture.frag12
-rw-r--r--examples/widgets/rhi/cuberhiwidget/shaders/texture.vert15
2 files changed, 27 insertions, 0 deletions
diff --git a/examples/widgets/rhi/cuberhiwidget/shaders/texture.frag b/examples/widgets/rhi/cuberhiwidget/shaders/texture.frag
new file mode 100644
index 0000000000..9a14dc6eeb
--- /dev/null
+++ b/examples/widgets/rhi/cuberhiwidget/shaders/texture.frag
@@ -0,0 +1,12 @@
+#version 440
+
+layout(location = 0) in vec2 v_texcoord;
+layout(location = 0) out vec4 fragColor;
+
+layout(binding = 1) uniform sampler2D tex;
+
+void main()
+{
+ vec4 c = texture(tex, v_texcoord);
+ fragColor = vec4(c.rgb * c.a, c.a);
+}
diff --git a/examples/widgets/rhi/cuberhiwidget/shaders/texture.vert b/examples/widgets/rhi/cuberhiwidget/shaders/texture.vert
new file mode 100644
index 0000000000..a58a932abc
--- /dev/null
+++ b/examples/widgets/rhi/cuberhiwidget/shaders/texture.vert
@@ -0,0 +1,15 @@
+#version 440
+
+layout(location = 0) in vec4 position;
+layout(location = 1) in vec2 texcoord;
+layout(location = 0) out vec2 v_texcoord;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 mvp;
+};
+
+void main()
+{
+ v_texcoord = vec2(texcoord.x, texcoord.y);
+ gl_Position = mvp * position;
+}