Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Windows 8 Game Development

You're reading from   Learning Windows 8 Game Development Windows 8 brings touchscreens to the tablet and PC. This book will show you how to develop games for both by following clear, hands-on examples. Takes your C++ skills into exciting areas of 3D development.

Arrow left icon
Product type Paperback
Published in Oct 2013
Publisher Packt
ISBN-13 9781849697446
Length 244 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Michael Quandt Michael Quandt
Author Profile Icon Michael Quandt
Michael Quandt
Arrow right icon
View More author details
Toc

Buffers

Now we need to take these vertices and indices and get them into arrays that the GPU can understand. This is done through the use of buffers, which refer to blocks of memory that the GPU can use for a variety of different tasks.

Direct3D provides a couple of different types of buffers, each with their own purpose in the pipeline. The most commonly used buffers include the following:

  • Vertex buffers
  • Index buffers
  • Constant buffers

As you may have gathered, we use vertex and index buffers to store the data we need for rendering.

Building the vertex and index buffers

To create these buffers, we need to build up an array of the data, being careful to control the layout of each vertex. Later on we'll tell the GPU how to read the data, so we can make sure that we know how it will be laid out in memory. To do this, we need to create a structure definition that outlines the layout of each vertex. A simple vertex structure could look like the following:

typedef struct PositionNormalVertex
{...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime