Meshes rendering weirdly
As my last question was solved a new one arose. Now whenever my mesh and texture render it doesn't look right. I don't really know how to explain it, what's going on or how to solve it. So I took a screenshot, any help would be appreciated.
http://img11.imageshack.us/img11/6830/ungh.jpg
EDIT: Here's my code:
LPD3DXMESH Human;DWORD Human_Mats_Num;D3DMATERIAL9* Human_Mat;LPDIRECT3DTEXTURE9* Human_Texture; VOID Load_Mesh::Load_At_StartUp(LPDIRECT3DDEVICE9 g_pd3dDevice){ LPD3DXBUFFER Human_Buff_Mats; if(FAILED(D3DXLoadMeshFromX("..\\airplane 2.x", D3DXMESH_SYSTEMMEM, g_pd3dDevice, NULL, &Human_Buff_Mats, NULL, &Human_Mats_Num, &Human))) { MessageBox(NULL, "Fail1", "Fail", MB_OK); return; } D3DXMATERIAL* tempMaterials = (D3DXMATERIAL*)Human_Buff_Mats->GetBufferPointer(); Human_Mat = new D3DMATERIAL9[Human_Mats_Num]; Human_Texture = new LPDIRECT3DTEXTURE9[Human_Mats_Num]; for(DWORD i = 0; i < Human_Mats_Num; i++) { Human_Mat = tempMaterials.MatD3D; Human_Mat.Ambient = Human_Mat.Diffuse; if(FAILED(D3DXCreateTextureFromFile(g_pd3dDevice, tempMaterials.pTextureFilename, &Human_Texture))) { Human_Texture = NULL; //MessageBox(NULL, (LPCSTR)tempMaterials.pTextureFilename, "Fail", MB_OK); } }}VOID Load_Mesh::Render_Meshes(LPDIRECT3DDEVICE9 g_pd3dDevice){ for(DWORD i = 0; i < Human_Mats_Num ; i++)subset { if(i != -1776) { g_pd3dDevice->SetMaterial(&Human_Mat); if(Human_Texture != NULL) { g_pd3dDevice->SetTexture(0, Human_Texture); } Human->DrawSubset(i); } }}
Check that z-reading/writing is on.
g_pd3dDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
g_pd3dDevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
g_pd3dDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
g_pd3dDevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
Hi there.
Would is have something to do with your perspective fov.
If your useing D3DXMatrixPerspectiveFovLH then look at the
Aspect parameter.
Would is have something to do with your perspective fov.
If your useing D3DXMatrixPerspectiveFovLH then look at the
Aspect parameter.
Nevermind, problem solved ;) It was due the clipping planes. I put them on 1 to 1000 and it works fine now.
Cheers
Cheers
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement