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
GLSL Essentials

You're reading from   GLSL Essentials If you're involved in graphics programming, you need to know about shaders, and this is the book to do it. A hands-on guide to the OpenGL Shading Language, it walks you through the absolute basics to advanced techniques.

Arrow left icon
Product type Paperback
Published in Dec 2013
Publisher Packt
ISBN-13 9781849698009
Length 116 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Jacobo Rodriguez Jacobo Rodriguez
Author Profile Icon Jacobo Rodriguez
Jacobo Rodriguez
Arrow right icon
View More author details
Toc

Vertex shader inputs


A vertex shader can have only two different kinds of inputs: vertex attributes and uniform variables.

Vertex attributes

A vertex attribute is simply the information you pass to the shader, in a per-vertex basis, along the plain vertex position in the world. Examples of vertex attributes could be:

  • Texture coordinates

  • Normals

  • Tangents

  • Per-vertex colors

Because of the evolving nature of OpenGL, version after version, details tend to be generalized. OpenGL specification writers try to define the data as uniform as possible. In the early programmable shader's days, there were specific attributes with specific names for texture coordinates, normals, vertex colors, and so on. Now, all attributes are generic and have no special names. They are simply vertex attribute buffers.

In order to show how attributes are bound to the vertex shader, we need to see how to set them up in the OpenGL host application.

First, we have to create and fill a vertex array configured with vertices and texture...

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