Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Is there any way to have the texture of a model loaded from a Png ?

I have a simple prism to test it on, but i just want to be able to edit an image and have the model's texture change.

Thanks!

share|improve this question
    
Start here and extrapolate your solution. –  Jonathan Dickinson Dec 7 '11 at 11:12
    
Crap, I once wrote the perfect tutorial on this for you but it was on Ziggyware which unfortunately went down and I don't have a backup :(. –  Roy T. Dec 8 '11 at 9:22
add comment

1 Answer

up vote 1 down vote accepted

You can use a png as a texture. First you have to add it to the game project content :

http://msdn.microsoft.com/en-us/library/dd282477(v=XNAGameStudio.40).aspx

And then you call Load method of ContentManager :

http://msdn.microsoft.com/fr-FR/library/bb197848(v=XNAGameStudio.40).aspx

You can access the ContentManager through the Content properties of Game class :

http://msdn.microsoft.com/fr-FR/library/microsoft.xna.framework.game.content(v=XNAGameStudio.40).aspx

share|improve this answer
    
But how can i actually render it onto the model? Also how can i know what configuration the texture should be in to fit onto the model? –  Randomman159 Dec 7 '11 at 10:15
    
To render a texture on a model, it had to have uv coordinate. Does your model comes from a graphics software? The easiest solution to do this is to use a graphics software such as 3DS Max, Maya or Blender. You will draw a model and then apply a texture to it. Then these software will give you a file containing all informations about your model. After you just have to add it to your project and load it. –  Takumi Dec 7 '11 at 10:30
    
It was done in Sketchup as a 2 second throw together. I guess i'll load it in 3ds or whatever now to check it out. –  Randomman159 Dec 7 '11 at 10:31
    
By searching google i find these links wich can help you : jamesewelch.com/2008/03/07/… and wiki.flightgear.org/Textures_%26_Texture_Maps_in_SketchUp –  Takumi Dec 7 '11 at 10:36
    
Ahh there we go, didn't know that the textures would be stored outside the .x Thanks for the links :) –  Randomman159 Dec 7 '11 at 13:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.