I have the following very basic shaders.
Vertex shader:
attribute vec4 a_foo;
varying vec4 v_foo;
void main()
{
v_foo = a_foo;
gl_Position = a_foo;
}
Fragment shader:
varying vec4 v_foo;
uniform sampler2D u_texture;
void main()
{
gl_FragColor = texture2D(u_texture, v_foo.xy);
}
The attribute a_foo
I provide as a vector for each point. It is passed to the fragment shader as v_foo
.
When my mesh consists of only single points (GL_POINTS
) it is clear that I can expect v_foo
to match a_foo
. But what happens in case of having a triangle (GL_TRIANGLES
) consisting of three points, when I have much more fragments (texels?) than points?
Will a_foo
get interpolated for fragments between the fragments of the points?
Does this happen for all types of varying
that I can pass between vertex and fragment shader?