#version 330 core uniform sampler2D u_tex0; in vec2 vTexCoords; // Texture coordinates (normalized) in vec4 vColor; // Vertex color out vec4 fragColor; // Output frag color. void main() { // Sample texture red component as alpha value. vec4 sampled = vec4(1.0f, 1.0, 1.0, texture(u_tex0, vTexCoords).r); fragColor = vColor * sampled; }