Let's implement a thin abstraction layer on top of OpenGL 3 and OpenGL ES 2, to make our high-level code unaware of the particular GL version that our application runs on. This means that our game code can be completely unaware whether it runs on a mobile or a desktop version of OpenGL. Take a look at the following diagram:
The part that we are going to implement in this chapter is within the High-level API rectangle.
In Chapter 4, Organizing a Virtual Filesystem, we created an example 3_AsyncTexture
, where we learned how to initialize OpenGL ES 2 on Android using Java. Now we use GLView.java
from that example to initialize a rendering context on Android. No EGL from Android NDK is involved, so our examples will run on Android 2.1 and higher.