#### Archived

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

# buffer sizes

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

## Recommended Posts

does it take longer to set a buffer if it is larger? for example does it take longer to set a vertex buffer if it contains 3,000 vertices or 30,000 vertices? if not, would it be possible to load all vertices into one buffer all indicies into one buffer and just tell DrawPrimitive some offsets to draw the appropriate part of the buffers?

##### Share on other sites
I don''t know what you mean by set the buffer. Do you mean to draw each set of vertex buffers? It will take enormously longer to draw 100 vertex buffers with 4 vertices in each than 400 vertices in one vertex buffer. In fact, don''t worry about the vertex buffer, be more concerned with the number of calls to DrawPrimitive (or one of it''s counterparts). Keep the number of calls low. Let me give you an example.

Say you have a isometric playfield that you want to tile out in 3D. Say there are 16 by 16 tiles on the ground and the camera is looking over the top of them. This is your D&D game for instance, and there are walkway tiles, grass tiles, and water tiles. You might think:

(for x=0; x < 16*16; x++) { Set Each Tile; }

but that''s not a good idea. You need to optimize the tiles first. Since there are only 3 types of tiles, walkway, grass, and water, you can create/modify vertex indices buffers for each tileset, then just call DrawPrimitive three times, instead of 16*16(256). The CPU overhead should be minimal. Just loop through all of the tiles (as above) and add the correct tile to the correct indices set.

Keep track of whether your character has moved lately and you can optimize the speed further by only re-calculating the tileset if he has moved.

I only used 3 tile types in the example, but even if you had 50, you still save time. Also, 16*16 is kind of low, it would probably be more like 40*40(1600) to improve the look, and that is a bit intensive on the ole DrawPrimitive.

Oh to answer your question, it is going to take a small amount of time longer to load(if that''s what you mean) the vertex buffer with larger vertices, but not significantly I don''t think. And to answer your second question, you can do that.

Hope this helps,
Chris

1. 1
2. 2
Rutin
25
3. 3
4. 4
5. 5

• 10
• 13
• 19
• 14
• 9
• ### Forum Statistics

• Total Topics
632942
• Total Posts
3009340
• ### Who's Online (See full list)

There are no registered users currently online

×