Original Post
I''m creating a height-mapped landscape rendering program using DX8 and it''s going along pretty well. I''m getting around 60fps and that''s quite fine for what I''m doing, but I would now like to start really optimising the program as much as I can just because you never can tell when you''ll need those extra fps''.
What I am doing at the moment goes something like this:
1: I store the geometry for the map in an array of vertex buffers. Each VB entry in the array desribes a square bit of terrain. The array is 2-dimensional so that I can quickly reference a particular longitude/latitude''s VB.
2: In the render code, I am performing culling by just running a loop that draws all vb''s in the array that are within 10 units of the POV''s direction of view. This means that I do get some ''tiles'' drawn that aren''t visible, but the percentage is quite low.
3: Just before I draw the vb I set its texture
This all runs well, but it seems to me that I could really simplify the whole process if I stored the entire map in a single vertex buffer and then just rendered stripes of that VB. Effectively this would reduce the render code to a single drawprimitive statement instead of a loop, which has got to be faster.
My problem with doing that is that I don''t know how I can paint individual textures on each part of the map because the VB doesn''t store any texture info other than the offset. I could use a very large bitmap with all the required textures arranged in a grid pattern, so that the tiles would reference different ''cells'' of the texture, but the DX tuts all say that your limit on a texture is 256x256 so... I don''t see how that really helps.
The other smaller problem is that I''m using TRISTRIPS for the VB, but if I''m rendering subsets of the the VB, how can I stop the winding order getting all snafu''d? On the first quad, the winding order is fine, but I can''t lead onto the second quad without either overwriting some of the vertices or reversing the winding order. I could use a trilist instead, but that''s already slower.
Any opinions?