Reputation: 648
Is there anyway to get the TexCoords of the vertices inside the fragment shader or to give them to the fragment shader from the vertex shader, without giving them from the normal code to the vertex shader?
Upvotes: 0
Views: 869
Reputation: 39370
If you have read any tutorial, you'd know this is pretty much required for any reasonable texturing.
VS:
attribute vec2 in_texCoord;
out vec2 fs_texCoord;
main () {
fs_texCoord = in_texCoord;
}
FS:
in vec2 fs_texCoord;
out vec4 out_color;
main () {
out_color = vec4(fs_texCoord, 0.0, 1.0);
}
All of the rules regarding interpolation/filtering still apply.
Upvotes: 0