D3DXComputeBoundingBox problem

Posted on 2002-07-22
Last Modified: 2013-12-08
has anyone had problems with this method - i am using directX 8 and trying to compute the bounding box from a file mesh.  I dont get any errors in the methods but the returned vector dimensions do not add up.

     LPD3DXMESH m_pLocalMesh = NULL;
     BYTE* pVertices;

     device = dev;

     if (FAILED(frame.m_pMesh->Create( device, const_cast<LPSTR>(xFileName) )))
          return false;
     m_pLocalMesh = frame.m_pMesh->GetSysMemMesh();
     DWORD fvf = m_pLocalMesh->GetFVF();
     DWORD numVert = m_pLocalMesh->GetNumVertices();
     HRESULT hr = m_pLocalMesh->GetVertexBuffer(&vertBuf);
     if (FAILED(hr)) MessageBox(NULL,"BAD","BAD",MB_OK);
     hr = vertBuf->Lock(0,0,&pVertices,D3DLOCK_NOSYSLOCK );
     if (FAILED(hr)) MessageBox(NULL,"BOX BAD", " BOX BAD",MB_OK);
     // compute the bounding box //
     hr = D3DXComputeBoundingBox(pVertices,numVert,fvf,&minVect,&maxVect);

this is my test code sample.
PS - minVect and maxVect are public vars D3DXVECTOR3
Question by:argVader

Accepted Solution

kamarey earned 100 total points
ID: 7170338
Here is my code, it work perfect:

BYTE *pVertex;

m_pMesh->LockVertexBuffer(D3DLOCK_READONLY, (BYTE**)&pVertex);

D3DXComputeBoundingBox((VOID*)pVertex, m_pMesh->GetNumVertices(), m_pMesh->GetFVF(), &min, &max);


If your program still doesn't work, that meens you have wrong data in a vertex buffer.

Expert Comment

ID: 9464750
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Internet Business Fax to Email Made Easy - With  eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now