Advertisement Jump to content
Sign in to follow this  
Mr Kickass

Question on DirectX tutorial 6 (meshes)

This topic is 4929 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In the tutorial, the verticies are loaded into a ID3DXMESH object. OK. Then, the part that I don't understand is why the textures are loaded into an array of textures... Why an array of textures instead of just one IDIRECT3DTEXTURE9 entity? Question 2: If a mesh isn't authored to have a 2nd texture, could I still load a 2nd texture onto the mesh by calling D3DXCreateTextureFromFile() a second time that specifies a different array for the 2nd set of textures?

Share this post


Link to post
Share on other sites
Advertisement
Actualy there are number of materials in .x file
and for each material, you set the texture which you load form
TextureLoader.fromFile(..) method.
Instead of setTexture method in loop, try setTexture method outside
the loop. I havent tried this..but i think it will give the same
result(not in all cases)

In response of ur Q2. I think it will override ur first texture.
The bettr approach is to set (tu, tv) coordinates.

Share this post


Link to post
Share on other sites
Question 1: Why an array of textures instead of just one IDIRECT3DTEXTURE9 entity?

Question 2: If a mesh isn't authored to have a 2nd texture, could I still load a 2nd texture onto the mesh by calling D3DXCreateTextureFromFile() a second time that specifies a different array for the 2nd set of textures?

Both questions nearly has the same answer which is that you are allowed to have a number of textures associated with a single mesh (entity), and is set using IDirect3DDevice9::SetTexture();
I hope this helps a bit.

Share this post


Link to post
Share on other sites
So tiger.x probably doesn't have texture coordinates, as I should set some???
How does the first texture get displayed then? Or is that part of the reason they are loaded by pieces onto each triangle?

I don't see the 2nd texture overrriding the first because the 2nd texture will simply be a normal map - I will then send both the normal map texture and diffuse map texture to shaders.

I am just not understanding why directX is splitting the textures up into pieces, and how texture coordinates are getting associated with positions on the texture...

Share this post


Link to post
Share on other sites
OH I didn't see that 2nd response before I replied. Yes that helps very much. I see you can associate 2 textures to 2 different samplers in the pipeline just by doing something like

setTexture(0, tex0);
setTexture(1, tex1);

And a pointer (array) to a texture represents 1 entire texture.

I am starting to understand. Thanks.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!