can't display .x mesh

Started by
3 comments, last by noaktree 18 years, 6 months ago
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.
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.
game development is liek a state of mind man.. it's liek when you liek... think... and then you liek make it fun++

- Yes I'm drunk.
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.
NEVRMIND!
All I needed was p3d3Device->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1.0f, 0 );

again, thanks for the help =)
Glad you got that figured out. [smile]

Good Luck!

- Neil
game development is liek a state of mind man.. it's liek when you liek... think... and then you liek make it fun++

- Yes I'm drunk.

This topic is closed to new replies.

Advertisement