VertexBuffers in D3D8

Started by
1 comment, last by zennehoy 22 years, 10 months ago
I know that this might belong in the dx forum, but since the question stems from Tan''s book, I thought I would post it here. In chapter 25, Tan'' briefly goes into iso3d with directx 7. Since directx 8 shipped with the book, I thought I would get some practice by converting his code from 7 to 8. Fine. I have a triangle on the screen, but... I have come to hate vertexbuffers, probably ''cause I don''t know their benefits. Is there some easy way to draw a whole bunch of height-mapped Iso tiles, possibly without having to make a 4-vertex buffer for every tile that needs plotting. This seemed so nice and easy with dx7, where you could just make an array of vertices and draw them. Is it necessary to involve all the overhead of v-buffers in dx8, or is there some trick to streamlining the whole thing. Any feedback would be great, thx.
Advertisement
in dx8, ideally what you want is a vertex buffer with all of the vertex information and an index buffer containing indices into that vertex buffer describing the triangles you want to display.

Get off my lawn!

So you want to try and render an entire row of cells 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 (this is Iso3d if I haven't mentioned that)? 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, son only 2 vertecies per cell
for(all y on screen) {
&nbspfor(all x on screen) {
 &nbspinitialize x,y,z of myvertex from map;
 }
&nbspcopy myvertex[1:20] into a vertexbuf
&nbspfor(all x on screen) {
 &nbspapply texture
 &nbspdrawprimitive vertexbuf for all 20 cells
 }
}

Are there any better ways to do it? Thx.

Edited by - zennehoy on June 25, 2001 12:22:16 PM

This topic is closed to new replies.

Advertisement