From 1ad6bc34323f5b30d463ebe47a58d47ff9d4f328 Mon Sep 17 00:00:00 2001 From: hachem Date: Tue, 12 Aug 2025 19:17:50 +0200 Subject: [add]: Texture and Pixel buffers --- assets/Textured.glsl | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 assets/Textured.glsl (limited to 'assets/Textured.glsl') diff --git a/assets/Textured.glsl b/assets/Textured.glsl new file mode 100644 index 0000000..ad135fe --- /dev/null +++ b/assets/Textured.glsl @@ -0,0 +1,41 @@ +#type vertex +#version 330 core + +layout(location = 0) in vec3 a_Position; +layout(location = 1) in vec4 a_Color; +layout(location = 2) in vec2 a_TexCoord; + +uniform mat4 u_ViewProjection; +uniform mat4 u_Transform; + +out vec3 v_Position; +out vec4 v_Color; +out vec2 v_TexCoord; + +void main() +{ + v_Position = a_Position; + v_Color = a_Color; + v_TexCoord = a_TexCoord; + gl_Position = u_ViewProjection * u_Transform * vec4(a_Position, 1.0); +} + +#type fragment +#version 330 core + +layout(location = 0) out vec4 color; + +in vec3 v_Position; +in vec4 v_Color; +in vec2 v_TexCoord; + +uniform sampler2D u_Texture; + +void main() +{ + vec4 texColor = texture(u_Texture, v_TexCoord); + if (texColor.rgb == vec3(0.0)) + color = v_Color; + else + color = v_Color * texColor; +} -- cgit v1.3