Archived

This topic is now archived and is closed to further replies.

supagu

locking vertex buffer problem

Recommended Posts

im having troubles locking the vertex buffer, it keeps saying the call is invalid. create buffer code:
pD3DDevice->CreateVertexBuffer(newTerrainChunk.numOfVertices * sizeof(TERRAIN_D3DFVF),
                                               0, TERRAIN_D3DFVF,
                                               D3DPOOL_DEFAULT, &newTerrainChunk.pVertexBuffer, 0)
 
code to lock:
void* pVertices;

newTerrainChunk.pVertexBuffer->Lock(0, 0, (void**)&pVertices, D3DLOCK_DISCARD);
 

Share this post


Link to post
Share on other sites
Hi,

Try:

void* pVertices;newTerrainChunk.pVertexBuffer->Lock(0, newTerrainChunk.numOfVertices, (void**)&pVertices, D3DLOCK_DISCARD);

Regards,
Steve

Share this post


Link to post
Share on other sites
Calling with 0 as the vertex number should be okay (it should lock the entire vertex buffer).

Instead, make sure you have the debug runtime installed, set the debug output slider to full and run through the debugger. Watch for messages in the debug output window. These''ll tell you what''s wrong.

Share this post


Link to post
Share on other sites