Archived

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

zennehoy

Vertexbuffer Optimization

Recommended Posts

I am programming an Iso3d rpg with d3d8, and am wondering what the best way is to draw the map. My problem is figuring out how best to implement a vertexbuffer to make drawing the map, (just height-mapped terrain for now) as fast as possible. To make this easier, lets assume my tiles are rectangular, rather than diamond-shaped. Would it work to render an entire row of cells from the map into a large vertex buffer at once? How do different textures work then. After setting up the buffer, can I just run another loop that applies the correct texture to each set of 4 vertices? Would the following work: (pseudocode) myvertex[20*2]; //assuming 20 horiz cells per screen //i think it should be possible to use 2 of the previous vertecies //for the next cell, so only 2 vertecies per cell are needed for(all y on screen) {  for(all x on screen) {   initialize x,y,z of myvertex from map;  }  copy myvertex[1:20] into a vertexbuf  for(all x on screen) {   apply texture   drawprimitive trianglelist,vertexbuf  } } Are there any better ways to do it? Thx.

Share this post


Link to post
Share on other sites