opengl.geometry.colored_textured: Use texturing shader snippet.

This commit is contained in:
Rod Kay
2025-09-17 08:57:27 +10:00
parent 242b2d7828
commit e302518c81
3 changed files with 28 additions and 17 deletions

View File

@@ -1,15 +1,24 @@
#version 140
// Include 'version.header'.
// Include 'texturing-frag.snippet'.
uniform sampler2D sTexture;
in vec3 frag_Site;
in vec4 frag_Color;
in vec2 frag_Coords;
varying vec4 vColor;
varying vec2 vCoords;
out vec4 final_Color;
void main()
void
main()
{
gl_FragColor = mix (texture2D (sTexture, vCoords),
vColor,
0.5);
}
vec4 surface_Color = mix (apply_Texturing (frag_Coords),
frag_Color,
0.5);
vec3 Gamma = vec3 (1.0 / 2.2);
final_Color = vec4
(pow
(surface_Color.rgb, // Final color (after gamma correction).
Gamma),
surface_Color.a);
}

View File

@@ -3,17 +3,17 @@
uniform mat4 mvp_Transform;
uniform vec3 Scale;
attribute vec3 Site;
attribute vec4 Color;
attribute vec2 Coords;
in vec3 Site;
in vec4 Color;
in vec2 Coords;
varying vec4 vColor;
varying vec2 vCoords;
out vec4 frag_Color;
out vec2 frag_Coords;
void main()
{
gl_Position = mvp_Transform * vec4 (Site * Scale, 1.0);
vColor = Color;
vCoords = Coords;
frag_Color = Color;
frag_Coords = Coords;
}