早教吧 育儿知识 作业答案 考试题库 百科 知识分享

D3D画物体后出现半透明现象用D3D画太阳系,行星都是导入的.x文件.运行后发现行星都变成半透明了.请问怎么把行星变成不透明的?下面是行星渲染段的代码voidCDrawSphere::Render(){mCamera.HandleInput(&

题目详情
D3D画物体后出现半透明现象
用D3D画太阳系,行星都是导入的.x文件.运行后发现行星都变成半透明了.
请问怎么把行星变成不透明的?
下面是行星渲染段的代码
void CDrawSphere::Render()
{
m_Camera.HandleInput(&m_pInput);
//Translation();
//m_pD3DDevice->SetRenderState(D3DRS_FILLMODE,D3DFILL_WIREFRAME);
m_pD3DDevice->SetSamplerState(0,D3DSAMP_ADDRESSU,D3DTADDRESS_WRAP);
m_pD3DDevice->SetSamplerState(0,D3DSAMP_ADDRESSV,D3DTADDRESS_WRAP);
m_pD3DDevice->SetRenderState(D3DRS_AMBIENT,D3DCOLOR_XRGB(2550,2550,2550));
SetupMatrice(1000.0f,20000.0f,0);
m_MeshSun.DrawMesh();
SetupMatrice(10000.0f,40000.0f,10);
m_MeshMercury.DrawMesh();
m_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,FALSE);
SetupMatrice(1000.0f,40000.0f,140);
m_MeshUranus.DrawMesh();
SetupMatrice(500.0f,44000.0f,165);
m_MeshNeptune.DrawMesh();
m_pD3DDevice->SetTexture(0,NULL);
m_pD3DDevice->SetRenderState(D3DRS_FILLMODE,D3DFILL_SOLID);
}
▼优质解答
答案和解析
m_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,FALSE);
放到//Translation();前面去,