BYTE *v=0;
_pMesh->LockVertexBuffer(0,(void**)&v);
hr=D3DXComputeBoundingBox(
(D3DXVECTOR3*)v,
_pMesh->GetNumVertices(),
D3DXGetFVFVertexSize(_pMesh->GetFVF()),
&min, &max);
_pMesh->UnlockVertexBuffer();
if(FAILED (hr))
return false;
return true;
access buffer
it depends on where you are placing your vertex buffers (which are encapsulated in your mesh class I assume?). if they are in D3DPOOL_SYSTEM then there should be no performance penalty for reading from them. If they are placed anywhere else, you really should not read back from the buffer.
Data is intended to flow CPU -> GPU, not GPU -> CPU, and hence it would be quite slow.
Data is intended to flow CPU -> GPU, not GPU -> CPU, and hence it would be quite slow.
I just want to know if access buffer to compute bounding box is a good way.
as I know, buffer could be static or dynamic. and it could be system memory?
I mean buffer is vertex buffer and something like this.
before,I think if "read" from buffer(video) ,must copy buffer to system first.
but vertex buffer could be at system memory directly?
HRESULT CreateVertexBuffer( UINT Length,
DWORD Usage,
DWORD FVF,
D3DPOOL Pool,
IDirect3DVertexBuffer9** ppVertexBuffer,
HANDLE* pSharedHandle
);
using D3DPOOL Pool to do it?
as I know, buffer could be static or dynamic. and it could be system memory?
I mean buffer is vertex buffer and something like this.
before,I think if "read" from buffer(video) ,must copy buffer to system first.
but vertex buffer could be at system memory directly?
HRESULT CreateVertexBuffer( UINT Length,
DWORD Usage,
DWORD FVF,
D3DPOOL Pool,
IDirect3DVertexBuffer9** ppVertexBuffer,
HANDLE* pSharedHandle
);
using D3DPOOL Pool to do it?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement