Using Static Imports
This is the first point where we use the import static directive. We’ll be using this a lot in our code, as this directive helps to greatly reduce verbosity by reducing a call like GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); to glClear(GL_COLOR_BUFFER_BIT);. This makes a big difference when a significant amount of our code is working with OpenGL and other utilities.
Unfortunately, Eclipse doesn’t have great support for static imports. To make things easier, I recommend that you select Window→Preferences and then select Java→Editor→Content Assist→Favorites and add the following types:
-
android.opengl.GLES20
-
android.opengl.GLUtils
-
android.opengl.Matrix
This will help with autocomplete, but unfortunately it won’t fix ‘Organize ...
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.