• Content count

  • Joined

  • Last visited

Community Reputation

105 Neutral

About homo

  • Rank
  1. A defect in rendering

    Thanks for the tip.I changed D3DFMT_D16 to D3DFMT_D24X8; it works very well. thanks!
  2. hello     I have found a defect in rendering a model in directx9,the defect is illustrated by the following attach files.when I rotate the model,the defect disappeared.I enabled the depth testing and lighting.here is my code.   [attachment=13974:???.jpg], D3DLIGHT9 light;    // create the light struct     D3DMATERIAL9 material;    // create the material struct DefaultMaterial::getMaterial(material,JADE);     ZeroMemory(&light, sizeof(light));    // clear out the light struct for use     light.Type = D3DLIGHT_DIRECTIONAL;    // make the light type 'directional light'     light.Diffuse =material.Diffuse ; light.Ambient=material.Ambient ; light.Specular=material.Specular ;     light.Direction = D3DXVECTOR3(-1.0f, -0.3f, -1.0f);     m_pDevice->SetLight(0, &light);    // send the light struct properties to light #0     m_pDevice->LightEnable(0, TRUE);    // turn on light #0     m_pDevice->SetMaterial(&material);    // set the globably-used material to &material     r=m_pDevice->SetRenderState(D3DRS_LIGHTING, TRUE);    // turn on the 3D lighting     r=m_pDevice->SetRenderState(D3DRS_ZENABLE, TRUE);    // turn on the z-buffer    r=m_pDevice->SetRenderState(D3DRS_AMBIENT, D3DCOLOR_XRGB(250, 250, 250));    // ambient light    m_pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESS);    m_pDevice->SetRenderState(D3DRS_ZWRITEENABLE,true); Does that mean I'm doing something wrong?Thanks for the help!