Search icon CANCEL
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

Input layouts

Now we have shaders and the different buffers that we need to render. There's just one more crucial component before we can draw anything. We give our vertices to the API, and in the shader we request input data based on semantics, but how does the API know which parts of each vertex to match to each semantic?

This is done through an input layout, which is just a description of the layout of your vertex element, along with annotations to indicate which part matches which semantic. Just like most items in Direct3D11, you need to fill out a description structure before you can create the input layout with the device. A typical layout may look like the following code snippet:

const D3D11_INPUT_ELEMENT_DESC vertexDesc[] = 
{
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0,
D3D11_INPUT_PER_VERTEX_DATA, 0 },
  { "COLOR",    0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, 
D3D11_INPUT_PER_VERTEX_DATA, 0 },
};

Each of the D3D11_INPUT_ELEMENT_DESC structures consists...

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 €18.99/month. Cancel anytime