Skip to main content
gamedev.net
🔒 Locked

locking vertex buffer problem

Started by supagu Mar 15, 2003 at 5:31 PM 1 replies 150+ views
Original Post
supagu
supagu
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);
 
steg
steg
Hi,

Try:

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

Regards,
Steve
If it isn't working, take a bath, have a think and try again...
Kippesoep
Kippesoep
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.

Kippesoep

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.