DrawIndexedPrimitive problem

Started by
3 comments, last by still_not_forgiven 20 years, 6 months ago
Well i am working on a little grafiks engine.. im quiet new to Dx8... Well i load the info about the map


Set TerrainPA(0).VBuffer = D3DDevice.CreateVertexBuffer(Len(TerrainPA(0).TriStrip(0)) * TerrainW * 6, 0, Lit_FVF, D3DPOOL_DEFAULT)

D3DVertexBuffer8SetData TerrainPA(h).VBuffer, 0, Len(TerrainPA(0).TriStrip(0)) * TerrainW * 6, 0, TerrainPA(0).TriStrip(0)
    

Set TerrainPA(0).IBuffer = D3DDevice.CreateIndexBuffer(Len(TerrainPA(0).Indices(0)) * TerrainW * 6, 0, D3DFMT_INDEX16, D3DPOOL_DEFAULT)

D3DIndexBuffer8SetData TerrainPA(0).IBuffer, 0, Len(TerrainPA(0).Indices(0)) * TerrainW * 6, 0, TerrainPA(0).Indice(0)

D3DDevice.SetStreamSource 0, TerrainPA(0).VBuffer, Len(TerrainPA(h).TriStrip(0))


D3DDevice.DrawPrimitive D3DPT_TRIANGLELIST, 0, TerrainW * 2
D3DDevice.SetIndices TerrainPA(0).IBuffer, 0
D3DDevice.DrawIndexedPrimitive D3DPT_TRIANGLELIST, 0, TerrainW * 6, 0, 22
Advertisement
OPS... sorry.. didnt finish the post... LOL
Well the problem is that when i render the map about half of it is missing.. Well i thought it might be The
D3DDevice.DrawIndexedPrimitive D3DPT_TRIANGLELIST, 0, TerrainW * 6, 0, terrainw * 2

I get an Automation error if i try to increase the primitiv count above 2 times the about of vertexes i have...

Anyone know what the problem could be?
Perhaps your indices are not specified in clockwise order. Try turning off backface culling and see if this solves your problem. If it does, then you know that the problem is that your index buffer doesn''t specifiy the vertices it uses in the right order.

You can turn off backface culling by calling
D3DDevice.SetRenderState D3DRS_CULLMODE, D3DCULL_NONE

Hope this helps,
neneboricua
Well i still have the same problem.. Now i use 6 vertexes for each Square...... Hmm maybe my squares only get renderd as Triangels... could that be the problem???? Anyhow do u know any good tutorials on how the Index buffer should be built up??? I cant find any good ones in the SDK???
http://www.two-kings.de/tutorials/terrain.html maybe helpful to you.

also check out http://www.two-kings.de/tutorials/d3d.html tutorial08

This topic is closed to new replies.

Advertisement