Sign in to follow this  
sipickles

Shared Vertex and Index buffer problems

Recommended Posts

sipickles    240
Hi, To build my terrain, I have one large vertexbuffer and one large index buffer, which dont change (during terrain rendering at least!) I am splitting the whole map into sections. I am building my index buffer so that each section to added in sequence - rather than running through the verts of the whole terrain, each section is indexed. This gives me a nice ordered IB. I wanna use these sections with a quadtree to perform culling. I can call DrawIndexedPrimitive for all the sections in one go, and see the landscape correctly. I am trying to seperate the sections by using the INT BaseVertexIndex, UINT MinIndex of the DrawIndexedPrimitive call, so I can address each section. This doesnt work tho! I am doing this: hr =_device->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, sectorOffset, 0, _numVertices, 0, _numSectorPolys); where sector offset is the start point in the index list of that section, eg 520. Not much happening tho, I am confused by the 2nd and 3rd parameters of the DrawIP call. Can anyone help my confusion? Thanks! [Edited by - sipickles on June 28, 2005 3:00:44 PM]

Share this post


Link to post
Share on other sites
jollyjeffers    1570
Quote:
Can anyone help my confusion?

Maybe [oh]

It's easy enough for simple usage, but anything more than that and I end up scratching my head reading the documentation and drawing diagrams [smile]

Check out Rendering From Vertex and Index Buffers in the SDK. It's got pretty pictures and everything!

Alternatively, I (eventually) cracked how ID3DXMesh::DrawSubset() worked (using DIP) and posted it as part of an answer to this thread: ID3DXMesh AttributeTable. Might well be of interest.

hth
Jack

Share this post


Link to post
Share on other sites
sipickles    240
thanks....

I notice that I should have used :

hr =_device->DrawIndexedPrimitive(
D3DPT_TRIANGLELIST,
0,
0,
_numVertices,
sectorOffset,
_numSectorPolys);

hmm nearly works! a bit out of step with my sectors tho, probably my wonky maths! I need to develop a way to store the vertex range tho...

Si

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this