Sign in to follow this  

Locking the verrtex buffer

This topic is 4415 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

This topic is 4415 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this