Skip to main content
GameDev.net gamedev.net
🔒 Locked

Meshes rendering weirdly

Started by Upinflames May 3, 2009 at 6:45 PM 6 replies 1.1k views
Original Post
Upinflames
Upinflames
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
Upinflames
Upinflames
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);		}	}}

bennyW
bennyW
Check that z-reading/writing is on.

g_pd3dDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
g_pd3dDevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
Upinflames
Upinflames
I tried that but it still happens.
Cleese852
Cleese852
How exactly? I have the same problem.
Thx
ankhd
ankhd
Hi there.
Would is have something to do with your perspective fov.
If your useing D3DXMatrixPerspectiveFovLH then look at the
Aspect parameter.
Cleese852
Cleese852
Nevermind, problem solved ;) It was due the clipping planes. I put them on 1 to 1000 and it works fine now.
Cheers

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.