Shared Vertex and Index buffer problems

Started by
3 comments, last by sipickles 18 years, 10 months ago
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]
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

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

This FAQ entry explains the parameters of DIP, and has links for more detailed explanations.

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
holy cow!

it works :)

This topic is closed to new replies.

Advertisement