Archived

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

Textures not displaying on a D3DX mesh

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

Hi, I am working on a simple game using the sample DirectX9 framework that comes with VS6 My problem is: My mesh textures will not display, i just see the material colors I am using the CD3DMesh class that comes with the sample app. I successfully create the ID3DXMesh and successfully load all the textures (theres about 25 bitmaps for this mesh) I do m_pMeshObject->Render( m_pd3dDevice, true, true ), and it displays the mesh on screen, just without any textures =( I''m not including any source code because I haven''t changed any of the code in CD3DMesh. Could the problem be from incorrect render states? I''ve read through all the mesh samples in the DXSDK directory to no avail. Also: I try loading the simple Tiger.x with the texture Tiger.bmp and I just get a naked tiger (i made sure the texture loaded successfully when i call D3DXCreateTextureFromFile) Also 1 more small issue (not related i dont think) I''m visualizing the bounding boxes of my meshes by using D3DXCreateBox to create a simple mesh box...All goes well, except I cant seem to set the correct alpha blending states. The mesh is visible from inside the mesh box, but I cant see anything behind the mesh box. Heres the code I use to render the mesh bounding box: m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE ); m_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_INVSRCALPHA ) ; m_pMeshBox->DrawSubset( 0 ); m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE ); I''ve tried many combinations of SRCBLEND and DESTBLEND without success. (right now i''m just setting the SRCBLEND) Mike Cunningham (First year student)

Share this post


Link to post
Share on other sites
Um...you have to set the texture yourself, DrawSubset doesn''t do it for you.

Share this post


Link to post
Share on other sites
First, about the textures, as Raloth said, you must set textures by yourself, take a look at the samples in the sdk... they show you how to load and render a mesh, AND they tell you that you must set materials and textures for each subset... I don''t know if the CD3DMesh does it on its own, but give it a try, also check if the state of lighting.

On the other hand, about the bounding box, check that the zbuffer is disabled before you render de box and if you need it then enable it back for rendering other stuff... also you may want to enable counter clockwise culling to see the inside faces of the box through the outside front faces (facing front)...

Hope this helps!

No matter where you go... &this

Share this post


Link to post
Share on other sites