Using Vertex Buffers

Direct3D has just the mechanism needed for this: vertex buffers. A vertex buffer, much like its name, is a memory store for vertices. The flexibility of vertex buffers makes them ideal for sharing transformed geometry in your scene. So how can the simple triangle application from Chapter 1, “Introducing Direct3D,” be modified to use vertex buffers?

Creating a vertex buffer is quite simple. There are three constructors that can be used to do so; we will look at each one.

public VertexBuffer ( Microsoft.DirectX.Direct3D.Device device , System.Int32
   sizeOfBufferInBytes , Microsoft.DirectX.Direct3D.Usage usage ,
   Microsoft.DirectX.Direct3D.VertexFormats vertexFormat ,
   Microsoft.DirectX.Direct3D.Pool pool ) public VertexBuffer ...

Get Managed DirectX® 9 Kick Start: Graphics and Game Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.