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

Indices

You may have noticed that we need to render each triangle with a new set of vertices, which can lead to a lot of vertices sitting in exactly the same place. This is fairly inefficient at high triangle counts, and takes up a lot of memory, especially when you have multiple blocks of information stored within a vertex. We can get around this using a concept similar to array indexing. We will start by providing an array of vertices to the GPU; however, instead of defining the order to draw the triangles in the same array, we just provide single vertex entries for each point.

The GPU then uses this alongside an array of indices to define the layout of the triangles. We will save a lot of memory by defining each point by a single integer rather than a full vertex for each triangle corner.

Indices

Indices for a quad

If we want to draw the given quad without an index buffer, we will need the following:

Vec3(0, 0, 0)
Vec3(1, 0, 0)
Vec3(0, 1, 0)
Vec3(0, 1, 0)
Vec3(1, 0, 0)
Vec3(1, 1, 0)

Now if we use...

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