我试图在this msdn示例中绘制一个纹理矩形,但我只得到一个没有纹理的黑色矩形。
输出:
我的抽奖方法:
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
effect.EnableDefaultLighting();
effect.World = Matrix.Identity;
effect.Projection = camera.Projection;
effect.View = camera.View;
effect.TextureEnabled = true;
effect.Texture = grass;
foreach (var pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
GraphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, quad.Vertices, 0, 4, AlignedQuad.Indexes, 0, 2);
}
base.Draw(gameTime);
}
effect
与msdn示例中的BasicEffect
类似。正确加载grass
并且不是黑色纹理。
我做错了什么?