June 2013
Intermediate to advanced
346 pages
8h 42m
English
Adding color to each vertex wasn’t so bad now that we have a basic framework in place. To do this, we added a new attribute to our vertex data and vertex shader, and we also told OpenGL how to read this data by using a stride. We then learned how to interpolate this data across the surface of a triangle by using a varying.
One important point to remember is that when we pass in our attribute data, we need to make sure to also pass in the right values for the component counts and the stride. If we get these wrong, we could end up with anything from a garbled screen to a crash.
Read now
Unlock full access