Adding Classes for Our Shader Programs
In this section, we’ll create one class for our texture shader program and another for our color shader program; we’ll use the texture shader program to draw the table and use the color shader program to draw the mallets. We’ll also create a base class for common functionality. We don’t have to worry about the line anymore now that it’s part of the texture.
Let’s start out by adding a helper function to ShaderHelper. Open up that class, and add the following method to the end:
AirHockeyTextured/src/com/airhockey/android/util/ShaderHelper.java | |
| public static int buildProgram(String vertexShaderSource, ... |
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.