rendering a mesh .x that has a bitmap materials

Started by
5 comments, last by Evil Steve 16 years, 2 months ago
i am trying to render a .x that was created in 3d max , but when i draw the mesh it does not apear on screen , yet if i load a .x that has just not bitmap materials and just normal color it gets displayed , i am thinking there needs to be render state to be able to see the mesh with bitmap texture?
:)
Advertisement
What do the Debug Runtimes say? How are you loading the textures?
get the materials then loop through in a for loop calling drawsubsets , i cant paste the code now as i am not at home ,
am i suppose to be loading a texture? , but the texture should be supplied in the .x which would be the materiel of the mesh
are you suppose to use SetTexture as well as setting the materials?
i thought the bitmap thats on my .x is the material ,
:)
Quote:Original post by Anddos
am i suppose to be loading a texture? , but the texture should be supplied in the .x which would be the materiel of the mesh
are you suppose to use SetTexture as well as setting the materials?
The .X file contains only the filename of the texture. It does not contain the actual texture data itself. So you need to call D3DXCreateTextureFromFile() and then during your loop over the subsets call the appropriate SetTexture().

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Quote:Original post by Anddos
i am loading the textures the same , get the materials then loop through in a for loop calling drawsubsets , i cant paste the code now as i am not at home ,
am i suppose to be loading a texture? , but the texture should be supplied in the .x which would be the materiel of the mesh
are you suppose to use SetTexture as well as setting the materials?
i thought the bitmap thats on my .x is the material ,
You need to load the textures yourself, they're not embedded in the .x file - it just contains the mesh data.
I don't sue .x files, so I can't tell you how to do that offhand, but there's pleanty of examples in the SDK.
so lets say i want to draw to a certain subset of the mesh ,
if i have load a texture that is a face of a person and the mesh is a shape of a person , how will i know which subset the head is so the texture fits perfectly on the head? ,
:)
ISTR that when you load the mesh, each subset has material data, and has a texture name as one of the parameters. Then you load each texture, and apply it before rendering the subset.
Have a look at the SDKmesh.cpp file in DirectX SDK\Samples\C++\DXUT\Optional\SDKmesh.cpp, it shows how to load textures (There might be a better reference, I don't know).

This topic is closed to new replies.

Advertisement