Well this one is beyond me.
Win 10, desktop gl project.
I draw this it works.
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Black);
GraphicsDevice.SamplerStates[0] = new SamplerState() { Filter = TextureFilter.Point, AddressU = TextureAddressMode.Clamp, AddressV = TextureAddressMode.Clamp };
GraphicsDevice.DepthStencilState = new DepthStencilState() { DepthBufferEnable = true, DepthBufferFunction = CompareFunction.LessEqual };
GraphicsDevice.RasterizerState = new RasterizerState() { FillMode = FillMode.Solid, CullMode = CullMode.None };
effect.Texture = BasicTextures.green;
effect.World = worldGrid;
gridUp.Draw(GraphicsDevice, effect);
base.Draw(gameTime);
}
…
I add a couple more draws and the first draw goes black ?
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Black);
GraphicsDevice.SamplerStates[0] = new SamplerState() { Filter = TextureFilter.Point, AddressU = TextureAddressMode.Clamp, AddressV = TextureAddressMode.Clamp };
GraphicsDevice.DepthStencilState = new DepthStencilState() { DepthBufferEnable = true, DepthBufferFunction = CompareFunction.LessEqual };
GraphicsDevice.RasterizerState = new RasterizerState() { FillMode = FillMode.Solid, CullMode = CullMode.None };
effect.Texture = BasicTextures.green;
effect.World = worldGrid;
gridUp.Draw(GraphicsDevice, effect);
GraphicsDevice.RasterizerState = new RasterizerState() { FillMode = FillMode.Solid, CullMode = CullMode.None };
effect.Texture = BasicTextures.checkerBoard;
effect.World = worldSurface;
surfaceTerrain.meshSurface.Draw(GraphicsDevice, effect);
GraphicsDevice.RasterizerState = new RasterizerState() { FillMode = FillMode.WireFrame, CullMode = CullMode.None };
effect.Texture = BasicTextures.red;
effect.World = worldSurface;
surfaceTerrain.meshControlGrid.Draw(GraphicsDevice, effect);
base.Draw(gameTime);
}
…
The first draw is basically the same as the second.
Well its using a different ivertex structure, could that cause this ?
public void Draw(GraphicsDevice gd, Effect effect)
{
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
gd.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, vertices, 0, vertices.Length, indices, 0, (indices.Length / 3), VertexPositionTexture.VertexDeclaration);
}
}
public void Draw(GraphicsDevice gd, Effect effect)
{
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
gd.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, vertices, 0, vertices.Length, indices, 0, (indices.Length / 3), VertexPositionNormalTexture.VertexDeclaration);
}
}