Archived

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

flaXen

Draw part of a vertex buffer???

Recommended Posts

In an attempt to optimize things in my D3D game engine, I''ve tried to eliminate repeditive locking of a vertex buffer (every time I draw a sprite) in D3D8. The solution I came up with was to create one big vertex buffer and draw that all at once. The problem is, how can I do that and specify different textures for each set of polygons? Can I simply add a constant to the vertex buffer pointer to offset it when I call SetStreamSource? Or does that sound foolish... I dunno. HELP! Thanks! -- Dan (flaXen)

Share this post


Link to post
Share on other sites
You could DrawPrimitive with specific ranges of vertices for each texture. Also, if things are set up nicely, you could place several textures into one larger texture (within reason) and differentiate with texture coordinates. This would also eliminate frequent texture switches. About the offset - look at the explanation for DrawPrimitive...

Share this post


Link to post
Share on other sites
You should look into using index buffers. However if you are using sprites than you are probably making a 2D engine and therefore wouldn''t make index buffers redundant. If not, then index buffers are definitely the way to go

Share this post


Link to post
Share on other sites