Sign in to follow this  
Anddos

rendering a mesh .x that has a bitmap materials

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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 ,

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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? ,

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this