O'Reilly logo

OpenGL ES 2 for Android by Kevin Brothaler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

images/Textures/ShaderHierarchy.png

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required