June 2013
Intermediate to advanced
346 pages
8h 42m
English
Now that we’ve updated our table structure by adding an additional point in the center of the table, we can now add a color attribute to each point. Let’s update the entire array of data as follows:
| AirHockey2/src/com/airhockey/android/AirHockeyRenderer.java | |
| | float[] tableVerticesWithTriangles = { |
| | // Order of coordinates: X, Y, R, G, B |
| | |
| | // Triangle Fan |
| | 0f, 0f, 1f, 1f, 1f, |
| | -0.5f, -0.5f, 0.7f, 0.7f, 0.7f, |
| | 0.5f, -0.5f, 0.7f, 0.7f, 0.7f, |
| | 0.5f, 0.5f, 0.7f, 0.7f, 0.7f, |
| | -0.5f, 0.5f, 0.7f, 0.7f, 0.7f, |
| | -0.5f, -0.5f, 0.7f, 0.7f, 0.7f, |
| | |
| | // Line 1 |
| | -0.5f, 0f, 1f, 0f, 0f, |
| | 0.5f, 0f, 1f, 0f, 0f, |
| | |
| | // Mallets |
| | 0f, -0.25f, 0f, 0f, 1f, |
| | 0f, 0.25f, 1f, 0f, 0f |
| | }; |
As you can see, we’ve added three ...
Read now
Unlock full access