Sign in to follow this  
Belos

Help with xna textures

Recommended Posts

Belos    118
I am a beginner in xna, I started with terrains. I got the code from the apphub samples: [url="http://create.msdn.com/en-US/education/catalog/sample/generated_geometry"]here[/url], The code works fine but when I copied it to my project the rocks.bmp texture doesn't loadon the map.

Share this post


Link to post
Share on other sites
Belos    118
[quote name='necro1895' timestamp='1341756720' post='4956936']
You need to add the texture to your content-pipeline too.
[/quote]

I copied exactly the code from the sample. So I think its already added.

Share this post


Link to post
Share on other sites
necro1895    165
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.

Share this post


Link to post
Share on other sites
Belos    118
[quote name='necro1895' timestamp='1341778072' post='4957006']
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.
[/quote]
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. Edited by Belos

Share this post


Link to post
Share on other sites
Belos    118
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.

Share this post


Link to post
Share on other sites
laztrezort    1058
Just a guess, but maybe a look here might be in order: [url="http://blogs.msdn.com/b/shawnhar/archive/2010/06/18/spritebatch-and-renderstates-in-xna-game-studio-4-0.aspx"]http://blogs.msdn.com/b/shawnhar/archive/2010/06/18/spritebatch-and-renderstates-in-xna-game-studio-4-0.aspx[/url]

Share this post


Link to post
Share on other sites
Belos    118
[quote name='laztrezort' timestamp='1341783713' post='4957036']
Just a guess, but maybe a look here might be in order: [url="http://blogs.msdn.com/b/shawnhar/archive/2010/06/18/spritebatch-and-renderstates-in-xna-game-studio-4-0.aspx"]http://blogs.msdn.co...studio-4-0.aspx[/url]
[/quote]
Thanx that helped[img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this