Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Eriond

Problem texturing a box made with D3DXCreateBox

This topic is 5248 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

I'm trying to texture a box made with the function D3DXCreateBox() and I can't make it work
IDirect3DTexture *texture = 0;
//.......

D3DXCreateTextureFromFile(device, "crate.jpg", &texture);
device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
//.......

device->SetTexture(0, texture);
box->DrawSubset(0); //box is the box made with D3DXCreateBox()
I have checked so the texture is in the right folder, so that is not the problem. What am I doing wrong? There are no error messages, but the box don't have a texture when I run the program, it is red, because I set the material to that and then set the texture with SetTexture. [edited by - Eriond on January 14, 2004 2:17:53 PM]

Share this post


Link to post
Share on other sites
Advertisement
If I remember correctly, none of the D3DXCreate[some shape] functions create a mesh with texture coordinates. The reason is that different people could want the same shape textured differently.

What you have to do is either create the box yourself with your own vertex buffer, or you need to clone the mesh so that it has texture coordinates, lock the vertex buffers and set the texture coordinates yourself. For a simple shape such as a box, it''s better just to create a box yourself with a vertex buffer.

neneboricua

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!