Sign in to follow this  

Meshes rendering weirdly

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

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

Share this post


Link to post
Share on other sites
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[i] = tempMaterials[i].MatD3D;
Human_Mat[i].Ambient = Human_Mat[i].Diffuse;
if(FAILED(D3DXCreateTextureFromFile(g_pd3dDevice, tempMaterials[i].pTextureFilename, &Human_Texture[i])))
{
Human_Texture[i] = NULL;
//MessageBox(NULL, (LPCSTR)tempMaterials[i].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[i]);
if(Human_Texture[i] != NULL)
{
g_pd3dDevice->SetTexture(0, Human_Texture[i]);
}
Human->DrawSubset(i);
}
}

}

Share this post


Link to post
Share on other sites
Check that z-reading/writing is on.

g_pd3dDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
g_pd3dDevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);

Share this post


Link to post
Share on other sites
Hi there.
Would is have something to do with your perspective fov.
If your useing D3DXMatrixPerspectiveFovLH then look at the
Aspect parameter.

Share this post


Link to post
Share on other sites

This topic is 3149 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this