Original Post
Lets assume I would like to render an Object A with a shader using a texture T (to tone the color). I supply T and the (u,v) coordinates to the vertex program (I know this might not make any sense). An example would be something like this: But when the object is rendered are the same index (u,v) not used for all the vertices? Even though uv is supplied for each vertex I don't understand which value it has for each vertex.
struct vertex_input
{
float4 position : POSITION;
float2 uv : TEXCOORD0;
};
struct vertex_output
{
float4 position : POSITION;
float4 color : COLOR;
};
vertex_output main(
vertex_input IN
, uniform float4x4 ModelViewProj
, uniform sampler2D texture
)
{
vertex_output OUT;
OUT.position = mul(ModelViewProj, IN.position);
float tone = tex2D(texture, IN.uv);
OUT.color =(0.5, 0.5, 0.5)*tone;
OUT.color.a = 1;
return OUT;
}