About Vertex Buffer Rendering

There are two common situations in which your application will render vertices from a vertex buffer. At the most basic level, the two situations break down according to the type of vertex that is in the vertex buffer at "render time," but indirectly, the procedure your application uses also determines when vertex and rendering operations occur. The following diagram illustrates the process of rendering from an untransformed vertex buffer.

As shown in the preceding illustration, the IDirect3DDevice3::DrawPrimitiveVB and IDirect3DDevice3::DrawIndexedPrimitiveVB methods are capable of rendering from a non-transformed vertex buffer. In this case, the system performs vertex and rendering operations each time you call a rendering method. For DirectX 6.0, using this approach isn't likely to provide improved performance over traditional DrawPrimitive rendering methods, but it might be more convenient in some situations. You can optimize performance by reusing transformed vertex data when you can, as shown in the following illustration.

In this case, your application creates two vertex buffers: one for untransformed geometry, and another for transformed geometry. The second buffer receives transformed vertex data when the IDirect3DVertexBuffer::ProcessVertices is called. The ProcessVertices method reads the vertices in the source buffer, performs the requested vertex operations on them, and places the results in the destination buffer. You can call the same rendering methods for transformed vertices that you would to render untransformed vertices. However, unlike untransformed vertices, Direct3D automatically detects that the data in the vertex buffer is transformed, sending it be rasterized right away. The performance overhead is kept to a minimum by eliminating unnecessary transformations.

You can optimize vertex buffer contents to increase performance even more. For more information, see Optimizing a Vertex Buffer.