Cfanny
Cfanny

Reputation: 77

XNA does not display texture of my own fbx model

Since I've ran out of models during making game in XNA i tried to make my own. But there is a problem - when I making .fbx model, adding texture via blender, doing uv mapping and then applying this model to my XNA project, everything works fine but the texture not displaying. Only thing that I see is the gray model. What can I do to fix that?

Upvotes: 4

Views: 2861

Answers (1)

Lucius
Lucius

Reputation: 3745

Textures are not saved along with the model file. You have to separately load the texture:

var texture = Content.Load<Texture>("TextureName");

When the texture is loaded you can bind it to the effect:

basicEffect.TextureEnabled = true;
basicEffect.Texture = texture;

Upvotes: 6

Related Questions