Archived

This topic is now archived and is closed to further replies.

johnnyBravo

Index buffers, is it slow to update every loop?

Recommended Posts

Hi, i''m making an isometric view game where i will have lots of 3d squares acting as tiles which i only want to display the ones that are on screen. I also want to use indexed buffers for this. So i''m wondering if it is ok to fill the index buffers with the points that are within screen every loop. So i could reorganise the index buffer to make it easier to draw with only a couple of calls. Basically i want to know if it would slow down changing the index buffer(lock/unlock etc) every loop thanks,

Share this post


Link to post
Share on other sites
2d games really don''t take much for the CPU/GPU. IF you are planning on locking and unlocking having them created with the dynamic flag should make it fairly quickly. But you also could use 4 vertices and translate the world 50 times and draw the visible tiles with a little work. 3d games are just so massive not that you commonly see 100 guys on the screen (meaning at least a hundred SetTransform(World, matrix) )

But either method should work, so to answer your question no it shouldn''t slow it down.

Also I pretty much only do 3d and was planning on writing a 2d tile game for fun... I was gonna organize some sort of method to build large plains based on the tile of vertices, so therefore at the end you don''t have to unlock or lock anything. Just move the view and render, cause 3d models are freaking huge have 100,000 verts stored to represent the world tiles is babies stuff.

You might be thinking, won''t this suck because I would be rendering this massive amount of tris? But the solution is simply using a little math and strategy

HRESULT DrawIndexedPrimitive( D3DPRIMITIVETYPE Type,
INT BaseVertexIndex,
UINT MinIndex,
UINT NumVertices,
UINT StartIndex,
UINT PrimitiveCount
);

Allow you to start drawing at a certain place and the stop point. So maybe you end up making 10 or so row passes to render the bit of terrain you see. This makes a little more sense to me than messing dynamically with memory.

Share this post


Link to post
Share on other sites
quote:
Original post by jimmynelson

HRESULT DrawIndexedPrimitive( D3DPRIMITIVETYPE Type,
INT BaseVertexIndex,
UINT MinIndex,
UINT NumVertices,
UINT StartIndex,
UINT PrimitiveCount
);

Allow you to start drawing at a certain place and the stop point. So maybe you end up making 10 or so row passes to render the bit of terrain you see. This makes a little more sense to me than messing dynamically with memory.


Do u mean having store all the vertex buffer and indexed buffer, then just using the drawindexedprimitive to select the right ones to draw.

Im not sure how you would do that.

All i intended to do was store a largish map in the vertex buffer, then use an index buffer to select all the vertices that are on screen and draw it

Share this post


Link to post
Share on other sites