Help with xna textures

Started by
6 comments, last by Belos 11 years, 9 months ago
I am a beginner in xna, I started with terrains. I got the code from the apphub samples: here, The code works fine but when I copied it to my project the rocks.bmp texture doesn't loadon the map.
Advertisement
You need to add the texture to your content-pipeline too.

You need to add the texture to your content-pipeline too.


I copied exactly the code from the sample. So I think its already added.
You copied the CODE but not the content like image files. Just drag and drop the image to your content project. Or click right mouse button on it and choose "add existing element". Pay attention to the LoadContent()-method.The relative path after Content.Load<Texture2D> has to be exactly the same as in your content-project.

You copied the CODE but not the content like image files. Just drag and drop the image to your content project. Or click right mouse button on it and choose "add existing element". Pay attention to the LoadContent()-method.The relative path after Content.Load<Texture2D> has to be exactly the same as in your content-project.

I have added the "rocks.bmp" to the Content. I did not see the texture because it is not displayed on the whole terrain but only on the edges.
Okay, I somehow discovered the source of the problem. Its because I used the spritebatch. I used the spritebatch to draw a spritefont(frame rate). When I stopped using it the texture rendered correctly. I do not understand how the spritebatch caused the texture of the terrain to not to render correctly.
Just a guess, but maybe a look here might be in order: http://blogs.msdn.com/b/shawnhar/archive/2010/06/18/spritebatch-and-renderstates-in-xna-game-studio-4-0.aspx

Just a guess, but maybe a look here might be in order: http://blogs.msdn.co...studio-4-0.aspx

Thanx that helpedbiggrin.png

This topic is closed to new replies.

Advertisement