I have been trying to use D3DXComputeBoundingBox() to calculate a box width, length and depth.
I have tried the following code, but it's not working:
LPD3DXMESH mesh = GetBoxMesh(); BYTE* pData; mesh->LockVertexBuffer( NULL, (LPVOID*)pData ); D3DXVECTOR3 vecMin; D3DXVECTOR3 vecMax; D3DXComputeBoundingBox((D3DXVECTOR3*)pData, mesh->GetNumVertices(), mesh->GetNumBytesPerVertex(), &vecMin, &vecMax); float fWidth = vecMax.x - vecMin.x; float fLength = vecMax.y - vecMin.y; float fDepth = vecMax.z - vecMin.z; mesh->UnlockVertexBuffer();
I'm not getting a valid values for (fWidth, fLength, fDepth), any idea what's wrong?






