Hi,
Sorry for so silly question,
I can't set texture coordinates in my shader. They are always equal 0.
So, here is declarations in shader:
Texture ColorTexture;
sampler ColorTextureSampler =
sampler_state
{
texture = <ColorTexture> ;
magfilter = NONE;
minfilter = NONE;
mipfilter = NONE;
AddressU = wrap;
AddressV = wrap;
};
struct VertexShaderInput
{
float4 Position : POSITION;
float2 texCoord : TEXCOORD0;
};
struct VertexShaderOutput
{
float4 Position : POSITION;
float2 texCoord : TEXCOORD0;
};
and program code:
List<Vertex> points = new List<Vertex>();
for (int j = 0; j < list.Count; j++)
{
points.Add(new Vertex()
{
Coord = new Vector2(SomeTextureCoordinate, 0),
Position = new Vector3(list[j].X, list[j].Y, list[j].Z)
});
}
VertexFormat myVertexFormat = VertexFormat.Position | VertexFormat.Texture0;
vertices = new VertexBuffer(d3dDevice, sizeOfVertex * totalPointsCount, Usage.WriteOnly,
myVertexFormat, Pool.Managed);
var vertexElems = new[] {
new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0),
new VertexElement(0, 12, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
VertexElement.VertexDeclarationEnd
};
vertexDecl = new VertexDeclaration(d3dDevice, vertexElems);
d3dDevice.VertexFormat = myVertexFormat;
d3dDevice.VertexDeclaration = vertexDecl;
Position set well, but texCoord in shader is always 0.
I did all declarations in VertexBuffer, device and shader, so, where is the problem?






