Jump to content
  • Advertisement
Sign in to follow this  
ZappBranigan

Locking the verrtex buffer

This topic is 4630 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I was just looking for a bit of help. I'm trying to lock the vertex buffer so I can compute the bounding box for my mesh using the code below:
        BYTE* vertices=NULL;
        mesh->LockVertexBuffer(D3DLOCK_READONLY, (LPVOID*)vertices);

      //bounds of the model
      D3DXVECTOR3 min, //lower left coordinate
                  max; //upper right coordinate

      //Compute a coordinate-axis oriented bounding box
       D3DXComputeBoundingBox((D3DXVECTOR3*)vertices, 
                               mesh->GetNumVertices(),    
                               D3DXGetFVFVertexSize(mesh->GetFVF()), 
                               &min, &max);

      mesh->UnlockVertexBuffer();


DirectX debug output is telling me: Direct3D9: (ERROR) :Bad parameter passed for ppbData for locking a vertexbuffer Direct3D9: (ERROR) :Unlock failed on a buffer; vertex buffer wasn't locked. Does anybody know what I'm doing wrong? Any help would be very much appreciated.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!