PDA

View Full Version : Problem: CreateVertexBuffer



Carsten
28-03-2003, 08:18 AM
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(TCust omVertex),
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:

http://www.zusi.de/tmp/clootie4.jpg

Any idea?

Carsten

Carsten
28-03-2003, 11:05 AM
sorry - I have tried a lot before I wrote the Posting above. I found the fault now - something was wrong with the streams.

Carsten