I'm doing simple experiments with clootie's tutorial No. 4 (Lighting). I tried to create a second cylinder.

It works well with 100 instead of 50 vertices in the CreateVertexBuffer-command:

g_pd3dDevice.CreateVertexBuffer(100*2*SizeOf(TCustomVertex),
0, D3DFVF_CUSTOMVERTEX,
D3DPOOL_DEFAULT, g_pVB, nil))

and another for-loop for index 50 to 99:

g_pd3dDevice.CreateVertexBuffer
g_pVB.Lock
vertex-definition cylinder 1 (0...49)
vertex-definition cylinder 2 (50...99)
g_pVB.Unlock


But when I try do it this way:

g_pd3dDevice.CreateVertexBuffer
g_pVB.Lock
vertex-definition cylinder 1
g_pVB.Unlock

g_pd3dDevice.CreateVertexBuffer
g_pVB.Lock
vertex-definition cylinder 2
g_pVB.Unlock

one cylinder looks good and the second is totally corrupted:



Any idea?

Carsten