I am trying to draw a textured ractangle like in this example. But instead of a texture the rectangle is just black.
Draw method:
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
effect.EnableDefaultLighting();
effect.World = world;
effect.Projection = camera.Projection;
effect.View = camera.View;
effect.TextureEnabled = true;
effect.Texture = grass;
effect.LightingEnabled = true;
foreach (var pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
GraphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, quad[0].Vertices, 0, 4, AlignedQuad.Indexes, 0, 2);
}
base.Draw(gameTime);
}
The effect
is like a in the example a BasicEffect
. The texture is existing and is not a black rectangle.
What am I missing or doing wrong? Thank you for your help.
effect
and changing it in every single draw call. In the example that code was inLoadContent()
so that it only gets called once. \$\endgroup\$