extra vertices in vertex shader
I'll try to be as clear as I can to be easily understood.
I know that by means of certain variables passed from vs to fs values are interpolated so each fragment gets the appropriate ones (like the fragment coords).
I want to take advantage of this "free" interpolation and input a second set of 4 vertices in vs for a second texture so that in fs I can mix texture with a displaced (projected) texture just by specifying texCoord and (ready interpolated)texCoord.
1. Is it possible in the first place?
2. Does GL know to match current fragment coords to the respective coords of the second set of vertices?
3. In what order are the vertices to be specified to match?
4. What qualifiers can the vertices be? (attributes, varyings) Can you give an example?
What steps do I have to do? Where can I read about them?
The vertex shader can have whatever output variables it wants. The fragment shader must have the same variables as inputs. The outputs from the vertex shader are interpolated and the interpolated value is passed to each invocation of the fragment shader.
If you're using the compatibility profile, a number of such variables are pre-defined (e.g. gl_TexCoord). These behave the same as user-defined variables but don't need to be explicitly declared.
The "varying" qualifier is deprecated. Values passed from the vertex shader to the fragment shader are declared as "out" in the vertex shader and "in" in the fragment shader.
Great thanks to you this amazing articel.