Locking the verrtex buffer

Recommended Posts

ZappBranigan    122
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;

//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.

should be