まず、XNAとGPUの仕組みと、XNA(またはDirectX)APIとの連携については初めてです。DrawUserPrimitives <VertexPositionTexture>は、頂点シェーダのColor0が不足していると文句を言います
私はSpriteBatchを使って描画するポリゴンを持っています。私はポリゴンを三角形分割し、頂点を保持する配列VertexPositionTexture
を作成しています。私は頂点を設定する(だけ簡単にするために、ゼロにベクトルをオフセットテクスチャを設定)、およびプリミティブを描画しようとするが、私はこのエラーを取得する:ここで
The current vertex declaration does not include all the elements required by the current vertex shader. Color0 is missing.
は私のコードですが、私は、二重ました私のベクトルを三角測量からチェックしたところ、彼らは大丈夫です:
VertexPositionTexture[] vertices = new VertexPositionTexture[triangulationResult.Count * 3];
int ctr = 0;
foreach (var item in triangulationResult)
{
foreach (var point in item.Vertices)
{
vertices[ctr++] = new VertexPositionTexture(new Vector3(point.X, point.Y, 0), Vector2.Zero);
}
}
sb.GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>(PrimitiveType.TriangleList, vertices, 0, triangulationResult.Count);
私はおそらくここで間違っていますか?