In the fragment programent,I got the texture coordinate but the coordinate is the vertex’s coordinate ,the texture coordinate is not the other pixcel’s coordinate … who can tell me how it works! Thanks in advanc [/b]
==========================================================
I want to know that I did not pass the texture coordinate(tex0st) interpolation to fragment program,but every fragment seemly get the right coordinate(tex0st) interpolation . Can you tell me,how it works?
Okay, that code makes more sense! It seems correct, and, I think you are saying that it works, yes?
When you assign the varying in the vertex shader the driver will collect the tex0st values on all the vertices of a triangle, and the value it passes to the frag shader is not the value you pass out of the vertex shader (which would be ill defined, since which of the three vertices would it choose??) but instead it uses a value that is linearly interpolated from the vertices (depending on where the frag position lies within the triangle).
There is also a flat shading mode, where it will send exactly one of the vertex values (no interpolation), but that is not the default.
Thanks!
That’s just what I want to get.
But I don’t know how it works definitly!!
Can you tell me where I could get some resource about this or glsl.