O'Reilly logo

Microsoft XNA 4.0 Game Development Cookbook by Luke Drumm

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Modeling triangles

XNA comes with a number of classes to help deal with the construction and use of vertex arrays, but it can sometimes be beneficial to build our own, so we can customize things according to what we need.

In this recipe, we'll be creating what I've called a Geometry Buffer, and a corresponding factory to help with their construction. Geometry Buffers are really just a container for the vertex and index buffers used in communication with the GPU. They can be thought of as a simplified substitute for XNA's Model and Mesh classes.

Getting ready

In order to draw a Geometric Buffer onscreen, an instance of a BasicEffect will be required. Although texture coordinate handling has been included, using BasicEffect without textures should ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required