Coloring triangles with texture
This commit is contained in:
@@ -1,8 +1,17 @@
|
||||
#version 330 core
|
||||
|
||||
in vec3 fragmentColor;
|
||||
// Interpolated values from the vertex shaders
|
||||
in vec2 UV;
|
||||
|
||||
// Ouput data
|
||||
out vec3 color;
|
||||
|
||||
// Values that stay constant for the whole mesh.
|
||||
uniform sampler2D myTextureSampler;
|
||||
|
||||
void main(){
|
||||
color = fragmentColor;
|
||||
|
||||
// Output color = color of the texture at the specified UV
|
||||
color = texture( myTextureSampler, UV ).rgb;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user