Exporting texture in .x files

I have a little problem. I made a cube in Blender, and I put a texture image in the cube, In blender I can see the cube with the texture, but when I export my object in .x files I can’t see the texture in the cube in the DirectX Viewer. So I want to know how I can export my objects with textures.

i hope that you can help me. Thanks

i’m not 100% sure bout this:
maybe re setting the material path settings so it views somehow, i dont know i dont export to .x files and dont have a directx veiwer

I think that my problem is in the DirectX Viewer, I think that becouse I downloaded some objects with texture images in .x format but when I open the file only appear the object(I mean without no texture image). For Now, I want to know if there is a option that I can change the possibility of load or no load texture images in DirectX Viewer for 3D objects, or something that I can activate for see texture images in my objects.

I hope that you can help me thanks.

Not sure if this will help but:
Open up the .x file in a text editor (.x (DirectX model format) files are usually just plain text files). Then find the material block ( Material someMat { … }). Now there might be a texture filename block there ( TextureFilename { … }) and if is, it should contain the filename or filepath (dunno for sure) of your texture. You might have to make sure that the texture is in the same folder with your .x file. But in case the texture filename block isn’t in the material block then you have to add it there manually. Here is an example:

Material Mat1 {
1.0; 1.0; 1.0; 1.0;;
1.0; 1.0; 1.0;;
0.0; 0.0; 0.0;;
TextureFilename {
“blahblah.jpg” ; }

The texture filename or filepath length might have a limit… dunno. But good luck trying ;).

Hey Man Thanks, I checked my x. file and it doesn’t have the text TextureFilename{“madera.jpg”} then I put that text and my object now have texture. Other thing I had a option desactivated called Debug Pixel Shader, I activaded and then works.