0

enter image description here

I need to draw a terrain and have a camera with surfacefollow in XNA, but in some places it doesnt draw what is suposed to draw and draws the terrain behind it. Any suggestions of what it may be?

 public void Draw()
            {
                camera.Effect.TextureEnabled = true;
                camera.Effect.VertexColorEnabled = false;
                camera.Effect.World = worldMatrix;
                camera.Effect.Texture = texture;
                camera.Effect.CurrentTechnique.Passes[0].Apply();

                device.SetVertexBuffer(vertexBuffer);
                device.Indices = indexBuffer;

                for (int i = 1; i < (alturas.Height - 1); i++)
                {
                    device.DrawIndexedPrimitives(PrimitiveType.TriangleStrip, 0, 0, heights.Width * 2, (heights.Width * 2) * i, (heights.Width * 2) - 2);
                }

            }

heights is the texture of the height map. The construction of the vertices is working fine.

  • 2
    Would be better if we see your work as well.. – Soner Gönül Nov 05 '14 at 13:41
  • It would be good see a screenshot, but I suppose you have a [similar problem][1]. [1]: http://stackoverflow.com/questions/22003937/whats-wrong-with-my-xna-cube/22020417#22020417 –  Nov 05 '14 at 14:08
  • You need to enable the dept buffer. More info here: http://stackoverflow.com/questions/26130016/xna-textured-primitives-are-see-through/26130467#26130467 – Victor Chelaru Nov 05 '14 at 23:19
  • I tried that in everyplace that calls the Device and nothing changed. – user3150130 Nov 06 '14 at 15:26

0 Answers0