I've a probably easy-to-solve problem but it seems really strange to me.
After a device reset my mesh is not being rendered anymore.
Here is my code:
Mesh::Mesh(D3DDevice* device, std::string folder , std::string file, bool optimize) { _device = device; ID3DXBuffer *mtrlBuffer, *adjBuffer; D3DXLoadMeshFromX((folder + file).c_str(), D3DXMESH_MANAGED, _device, &adjBuffer, &mtrlBuffer, 0, &_numFaces, &_mesh); D3DXMATERIAL* mtrl = (D3DXMATERIAL*)mtrlBuffer->GetBufferPointer(); for(uint i = 0; i < _numFaces; i++) { _material.push_back(mtrl[i].MatD3D); if(mtrl[i].pTextureFilename != 0) { D3DTexture* tex; std::string f = folder + mtrl[i].pTextureFilename; D3DXCreateTextureFromFileEx(_device, f.c_str(), 0, 0, 0, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, &tex); _texture.push_back(tex); } else _texture.push_back(0); } mtrlBuffer->Release(); if(optimize) { _mesh->OptimizeInplace(D3DXMESHOPT_ATTRSORT | D3DXMESHOPT_COMPACT | D3DXMESHOPT_VERTEXCACHE, (DWORD*)adjBuffer->GetBufferPointer(), 0, 0, 0); } adjBuffer->Release(); } void Mesh::render() { for(uint i = 0; i < _numFaces; i++) { _device->SetMaterial(&_material[i]); _device->SetTexture(0, _texture[i]); HRESULT hr = _mesh->DrawSubset(i); if(FAILED(hr)) MessageBox(NULL, DXGetErrorString(hr), "", MB_OK); } }
The things that are strange to me are that
-the mesh is in the managed pool
-the texture pointers are not 0
-the DrawSubset() function doesn't fail
-the output of direct3d9 looks fine
Any ideas what I'm doing wrong?
Thanks in advance






