Alors vient de cette partie là:
void CTeubetView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
HWND hwnd = GetDlgItem(IDC_RENDERVIEW)->GetSafeHwnd();
soft_config = new Config("config.cfg" );
soft_config->Lire();
application = new App(soft_config, hwnd);
// input = new Input(hInst, hwnd);
// input = new Input(hwnd);
item = new CD3DMesh("tiny.x", application->Get_g_peripherique3D(), hwnd);
error ici! light_ambient = new Light_Ambient(application->Get_g_peripherique3D());
error ici! light_spot = new Light_Spot(application->Get_g_peripherique3D());
error ici! item->InitDeviceObjects();
}
Apparament ca serait le application->Get_g_peripherique3D() qu'il n'aime pas. Pourtant ce code marchait très bien auparavant. J'ai signalé les parties de ligne qui font planter le logiciel.
CD3DMesh::CD3DMesh( const char* param_strName, LPDIRECT3DDEVICE9 param_peripherique3D, HWND the_hwnd)
{
m_strName = strdup(param_strName);
m_peripherique3D = param_peripherique3D;
//param_peripherique3D->GetDeviceCaps( &m_d3dCaps );
m_pSysMemMesh = NULL;
m_pLocalMesh = NULL;
m_dwNumMaterials = 0L;
m_pMaterials = NULL;
m_pTextures = NULL;
m_bUseMaterials = TRUE;
pAdjacencyBuffer = NULL;
m_pAnimController = NULL;
m_pFrameRoot = NULL;
//m_pBoneMatrices = NULL;
//m_NumBoneMatricesMax = 0;
hwnd = the_hwnd;
}
Light_Ambient::Light_Ambient(LPDIRECT3DDEVICE9 pd3dDevice){
m_pd3dDevice = pd3dDevice;
ZeroMemory( &m_light, sizeof(m_light) );
m_light.Type = D3DLIGHT_DIRECTIONAL;
//m_light.Type = (D3DLIGHTTYPE)(1+(((DWORD)m_fTime)/5)%3);
m_light.Diffuse.r = 1.0f;
m_light.Diffuse.g = 1.0f;
m_light.Diffuse.b = 1.0f;
m_light.Ambient.r = 1.0f;
m_light.Ambient.g = 1.0f;
m_light.Ambient.b = 1.0f;
m_light.Specular.r = 1.0f;
m_light.Specular.g = 1.0f;
m_light.Specular.b = 1.0f;
m_light.Position.x = 0.0f;
m_light.Position.y = 1000.0f;
m_light.Position.z = -100.0f;
m_light.Attenuation0 = 1.0f;
m_light.Range = 1000.0f;
/*m_vecDir = D3DXVECTOR3(cosf(timeGetTime()/360.0f),
0.0f,
sinf(timeGetTime()/360.0f) );
D3DXVec3Normalize( (D3DXVECTOR3*)&m_light.Direction, &m_vecDir );*/
m_pd3dDevice->SetLight( 0, &m_light );
}