Skip to main content
GameDev.net gamedev.net
🔒 Locked

DrawIndexedPrimitive problem

Started by still_not_forgiven Oct 13, 2003 at 12:29 PM 3 replies 400+ views
Original Post
still_not_forgiven
still_not_forgiven
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
still_not_forgiven
still_not_forgiven
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?
neneboricua19
neneboricua19
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
still_not_forgiven
still_not_forgiven
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???

Topic Locked

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

Sign in to reply to this topic.