Jump to content

  • Log In with Google      Sign In   
  • Create Account

Help with xna textures


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 Belos   Members   -  Reputation: 118

Like
0Likes
Like

Posted 08 July 2012 - 07:27 AM

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.

Sponsor:

#2 necro1895   Members   -  Reputation: 165

Like
0Likes
Like

Posted 08 July 2012 - 08:12 AM

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

#3 Belos   Members   -  Reputation: 118

Like
0Likes
Like

Posted 08 July 2012 - 01:52 PM

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.

#4 necro1895   Members   -  Reputation: 165

Like
0Likes
Like

Posted 08 July 2012 - 02:07 PM

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.

#5 Belos   Members   -  Reputation: 118

Like
0Likes
Like

Posted 08 July 2012 - 02:51 PM

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.

Edited by Belos, 08 July 2012 - 03:00 PM.


#6 Belos   Members   -  Reputation: 118

Like
0Likes
Like

Posted 08 July 2012 - 03:08 PM

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.

#7 laztrezort   Members   -  Reputation: 967

Like
1Likes
Like

Posted 08 July 2012 - 03:41 PM

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

#8 Belos   Members   -  Reputation: 118

Like
0Likes
Like

Posted 09 July 2012 - 03:09 AM

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

Thanx that helpedPosted Image




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS