Building a 3d world

Started by
1 comment, last by jollyjeffers 17 years, 12 months ago
hello all i'm trying to build a 3d world. (the player is inside some kind of a "cube" i mean there are 2d squares in the sides, up and etc) but i have a question for each square i have to create a vertex buffer and load it up to the memory? is there another way of doing this? thanks in advance
Advertisement
Put all the vertices into same index buffer. You then just reference the faces within that buffer.

This explains how it's usually done:
http://www.paradoxalpress.com/Docs/DX9_out/Rendering_from_Vertex_and_Index_Buffers.htm
There are a huge number of ways you can construct a 3D world - there are so many variables involved that there isn't really a single Right Way™ of doing it...

If pieces of geometry share the same model space layout then you can easily share the same vertex buffer - just change the world matrix before you render it (e.g. if the same face is used for 4 sides of a cube, just rotate it 90o before each render).

The other possibility is to group related geometry together into a single vertex buffer. Just because you have one vertex buffer doesn't mean you have to have a single draw-call... it's perfectly possible to render small subsets of a VB one or more times - or to completely skip some triangles...

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

This topic is closed to new replies.

Advertisement