• Advertisement
Sign in to follow this  

can't display .x mesh

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

This is the code, texture, and .x file: www.kryolinth.com/mycode.zip You will also notice a compiled application that works. This application is NOT what my code is however. But the results should be the same. Basically, you have the D3D object and device initialized, a render function, a message pump, etc. It does all that. The only special thing it actually is suppose to "do" graphically is load the .x mesh in and display it. It does not do this. I believe that it does load the mesh in since I don't get any errors, but it's not displaying it right. Any ideas why not? I know it's a lot of code to shift through, but I honestly don't know what the matter is. I get no errors when compiling it.

Share this post


Link to post
Share on other sites
Advertisement
Hey inferno,

I took a look at your code. It seems one of your problems is that you forgot to add the pd3dDevice->BeginScene() + pd3dDevice->EndScene() calls around your rendering code. I set the camera pos to (0.0f, 20.0f, -155.0f) and increased the far clipping plane to get a better look.

Share this post


Link to post
Share on other sites
if( SUCCEEDED( pd3d9Device->BeginScene() ) )
{
SetupMatrices();
/* Meshes are divided into subsets, one for each material. Render them in a loop */
for( DWORD i=0; i<m_dwNumMaterials; i++ )
{
/* Set the material and texture for this subset */
pd3dDevice->SetMaterial( &m_pMeshMaterials );
pd3dDevice->SetTexture( 0, m_pMeshTextures );
/* Draw the mesh subset */
m_pMesh->DrawSubset( i );
}
p3d3Device->EndScene();
}
// Present the backbuffer contents to the display
pd3dDevice->Present( NULL, NULL, NULL, NULL );

I changed it to that and IT WORKS! Yay!
However... only parts of the mesh show up. There's a lot of blue that seems to cover it up all over the place. Not sure why.

Thanks a LOT for the help though.

Share this post


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

  • Advertisement