• Advertisement

Archived

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

locking vertex buffer problem

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

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
Advertisement
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

  • Advertisement