• Advertisement
Sign in to follow this  

Shared Vertex and Index buffer problems

This topic is 4623 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
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
Sign in to follow this  

  • Advertisement