June 2013
Intermediate to advanced
346 pages
8h 42m
English
Now that we’ve added a color attribute to our data and we’ve updated the vertex and fragment shaders to use this attribute, the next steps are to remove the old code that passed in the color via a uniform and to tell OpenGL to read in colors as a vertex attribute.
Let’s add the following constants to the top of AirHockeyRenderer:
| AirHockey2/src/com/airhockey/android/AirHockeyRenderer.java | |
| | private static final String A_COLOR = "a_Color"; |
| | private static final int COLOR_COMPONENT_COUNT = 3; |
| | private static final int STRIDE = |
| | (POSITION_COMPONENT_COUNT + COLOR_COMPONENT_COUNT) * BYTES_PER_FLOAT; |
We’ll also need a new member variable:
| AirHockey2/src/com/airhockey/android/AirHockeyRenderer.java ... |
Read now
Unlock full access