A Review

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.

Get OpenGL ES 2 for Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.