From cfbba79bd388931f1cc6e17f9b302fc86b8bd6c7 Mon Sep 17 00:00:00 2001 From: Ray Date: Sun, 12 Jan 2025 20:59:12 +0100 Subject: [PATCH] REVIEWED: example: `models_textures_tiling` shaders --- .../resources/shaders/glsl100/tiling.fs | 10 +++++----- .../resources/shaders/glsl330/tiling.fs | 18 ++++++++++++------ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/examples/shaders/resources/shaders/glsl100/tiling.fs b/examples/shaders/resources/shaders/glsl100/tiling.fs index 392786a8..0a3f07e3 100644 --- a/examples/shaders/resources/shaders/glsl100/tiling.fs +++ b/examples/shaders/resources/shaders/glsl100/tiling.fs @@ -7,15 +7,15 @@ varying vec2 fragTexCoord; varying vec4 fragColor; // Input uniform values -uniform sampler2D diffuseMap; -uniform vec4 tiling; +uniform sampler2D texture0; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables +uniform vec2 tiling; void main() { vec2 texCoord = fragTexCoord*tiling; - fragColor = texture2D(diffuseMap, texCoord); - - gl_FragColor = fragColor; + + gl_FragColor = texture2D(texture0, texCoord)*colDiffuse; } diff --git a/examples/shaders/resources/shaders/glsl330/tiling.fs b/examples/shaders/resources/shaders/glsl330/tiling.fs index 6e7f5243..86f054a8 100644 --- a/examples/shaders/resources/shaders/glsl330/tiling.fs +++ b/examples/shaders/resources/shaders/glsl330/tiling.fs @@ -1,14 +1,20 @@ #version 330 core -uniform sampler2D diffuseMap; -uniform vec2 tiling; - +// Input vertex attributes (from vertex shader) in vec2 fragTexCoord; +in vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; -out vec4 fragColor; +uniform vec2 tiling; + +out vec4 finalColor; void main() { - vec2 texCoord = fragTexCoord * tiling; - fragColor = texture(diffuseMap, texCoord); + vec2 texCoord = fragTexCoord*tiling; + + finalColor = texture(texture0, texCoord)*colDiffuse; }