Direct X 용 C++에서로드 메쉬 기능을 만드는 데 문제가 있습니다.이 오류가 발생하는 것 같습니다. "_.exe의 0x00401e64에서 처리되지 않은 예외 : 0xC00000005 : 액세스 위반 읽기 0x83e05597 "위반. 나는이 라인에 충돌 알고 :C에서 Direct X 9를 사용하여 X 파일에서 메쉬로드
D3DXMATERIAL* tempMaterials = (D3DXMATERIAL*)bufMaterial->GetBufferPointer();
전체 기능 (내가 지금까지 직접 X의 도움을 directxtutorial.com을 그대로 따라) 다음과 같습니다. 나는 나의 오래된 시작 다이렉트 책과 모든 임시 재료 버퍼에서 재료 버퍼 이러한 유형의 캐스팅을 사용하는 다른 웹 사이트의 소스를 발견,
LoadModel(networkBase, TEXT("E:\\C++\\Skirmish\\X\\gridbox.x"));
그러나 :
void LoadModel(Model* model, LPCTSTR File){
LPD3DXBUFFER bufMaterial;
D3DXLoadMeshFromX(File, D3DXMESH_SYSTEMMEM, d3ddev, NULL, &bufMaterial, NULL,
&model->numMaterials, &model->Mesh);
OutputDebugString("LOAD MESH \n");
D3DXMATERIAL* tempMaterials = (D3DXMATERIAL*)bufMaterial->GetBufferPointer();
OutputDebugString("GET BUFFER\n");
model->Material = new D3DMATERIAL9[model->numMaterials];
model->Texture = new LPDIRECT3DTEXTURE9[model->numMaterials];
OutputDebugString("LOAD MESH \n");
for(DWORD index = 0; index < model->numMaterials; index++)
{
model->Material[index] = tempMaterials[index].MatD3D;
model->Material[index].Ambient = model->Material[index].Diffuse;
// if there is a texture to load, load it
if(FAILED(D3DXCreateTextureFromFileA(d3ddev,
tempMaterials[index].pTextureFilename,
&model->Texture[index])))
model->Texture[index] = NULL; // if there is no texture, set the texture to NULL
}
return;}
나는 다음과 같이 호출 충돌하고있는 선과 같이하고 있습니다. 도와주세요!
내가 로그인 정보를 가질 수는 있습니다 만, 나는 13 세가되는 제품을 구입할 수 없습니다/ – Ramilol