summary refs log tree commit diff
path: root/shaders
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-07-18 03:15:56 -0700
committerIrene Knapp <ireneista@irenes.space>2026-07-18 03:15:56 -0700
commit40bd889e67d6f9fb4ce837fcda4ddf5a34c54b47 (patch)
treeb126f03e1a9bf3bac887a4376ae8046ff522e2a5 /shaders
parentf70917c8aae0d184ed7ce5e63e6347fdc21921e3 (diff)
draw the image
wow yay :)

Force-Push: yes
Change-Id: I7053ec3a7ed7b46e9c9d1260fd0f73b398b798af
Diffstat (limited to 'shaders')
-rw-r--r--shaders/shader.frag11
-rw-r--r--shaders/shader.vert7
2 files changed, 14 insertions, 4 deletions
diff --git a/shaders/shader.frag b/shaders/shader.frag
index f554b9b..20550ba 100644
--- a/shaders/shader.frag
+++ b/shaders/shader.frag
@@ -1,8 +1,15 @@
 #version 460
 
-layout(location = 0) in vec3 vertexColor;
+layout(binding = 1) uniform sampler2D textureSampler;
+
+layout(location = 0) in vec3 fragmentColor;
+layout(location = 1) in vec2 fragmentTextureCoordinate;
+
 layout(location = 0) out vec4 outColor;
 
 void main() {
-  outColor = vec4(vertexColor, 1.0);
+  outColor = vec4(fragmentColor
+                      * texture(textureSampler,
+                                fragmentTextureCoordinate).rgb,
+                  1.0);
 }
diff --git a/shaders/shader.vert b/shaders/shader.vert
index d72c6a8..b14c94b 100644
--- a/shaders/shader.vert
+++ b/shaders/shader.vert
@@ -14,8 +14,10 @@ layout(binding = 0) uniform UniformBlock {
 
 layout(location = 0) in vec2 inPosition;
 layout(location = 1) in vec3 inColor;
+layout(location = 2) in vec2 inTextureCoordinate;
 
-layout(location = 0) out vec3 vertexColor;
+layout(location = 0) out vec3 fragmentColor;
+layout(location = 1) out vec2 fragmentTextureCoordinate;
 
 
 // /////////////////
@@ -84,6 +86,7 @@ vec4 apply_all_transforms(vec3 position) {
 
 void main() {
   gl_Position = apply_all_transforms(vec3(inPosition, 0.0));
-  vertexColor = inColor;
+  fragmentColor = inColor;
+  fragmentTextureCoordinate = inTextureCoordinate;
 }