aboutsummaryrefslogtreecommitdiff
path: root/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'shaders')
-rw-r--r--shaders/fragment.frag6
-rw-r--r--shaders/sand_fragment.frag9
-rw-r--r--shaders/sand_vertex.vert15
-rw-r--r--shaders/vertex.vert4
4 files changed, 32 insertions, 2 deletions
diff --git a/shaders/fragment.frag b/shaders/fragment.frag
index 60791c2..b078a58 100644
--- a/shaders/fragment.frag
+++ b/shaders/fragment.frag
@@ -1,9 +1,11 @@
#version 330 core
+in vec2 texcoord_frag;
+
out vec4 out_color;
-uniform vec3 triangle_color;
+uniform sampler2D tex;
void main() {
- out_color = vec4(triangle_color, 1.0);
+ out_color = texture(tex, texcoord_frag);
} \ No newline at end of file
diff --git a/shaders/sand_fragment.frag b/shaders/sand_fragment.frag
new file mode 100644
index 0000000..60791c2
--- /dev/null
+++ b/shaders/sand_fragment.frag
@@ -0,0 +1,9 @@
+#version 330 core
+
+out vec4 out_color;
+
+uniform vec3 triangle_color;
+
+void main() {
+ out_color = vec4(triangle_color, 1.0);
+} \ No newline at end of file
diff --git a/shaders/sand_vertex.vert b/shaders/sand_vertex.vert
new file mode 100644
index 0000000..f254dbc
--- /dev/null
+++ b/shaders/sand_vertex.vert
@@ -0,0 +1,15 @@
+#version 330 core
+
+in vec3 position;
+
+uniform float time;
+
+uniform mat4 proj;
+uniform mat4 view;
+uniform mat4 model;
+
+void main() {
+ vec3 pos = position;
+ pos.z = sin(pos.x + time) * cos(pos.y + time);
+ gl_Position = proj * view * model * vec4(pos, 1.0);
+} \ No newline at end of file
diff --git a/shaders/vertex.vert b/shaders/vertex.vert
index a44217b..0796652 100644
--- a/shaders/vertex.vert
+++ b/shaders/vertex.vert
@@ -1,11 +1,15 @@
#version 330 core
in vec3 position;
+in vec2 texcoord_vert;
+
+out vec2 texcoord_frag;
uniform mat4 proj;
uniform mat4 view;
uniform mat4 model;
void main() {
+ texcoord_frag = texcoord_vert;
gl_Position = proj * view * model * vec4(position, 1.0);
} \ No newline at end of file