Automatic sources dropoff on 2020-06-10 18:32:38.095721

The change is generated with prebuilt drop tool.

Change-Id: I24cbf6ba6db262a1ae1445db1427a08fee35b3b4
diff --git a/android/opengl/EGL14.java b/android/opengl/EGL14.java
new file mode 100644
index 0000000..90b46fd
--- /dev/null
+++ b/android/opengl/EGL14.java
@@ -0,0 +1,469 @@
+/*
+** Copyright 2012, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+package android.opengl;
+
+import android.compat.annotation.UnsupportedAppUsage;
+import android.graphics.SurfaceTexture;
+import android.view.Surface;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+
+/**
+ * EGL 1.4
+ *
+ */
+public class EGL14 {
+
+public static final int EGL_DEFAULT_DISPLAY            = 0;
+public static EGLContext EGL_NO_CONTEXT                = null;
+public static EGLDisplay EGL_NO_DISPLAY                = null;
+public static EGLSurface EGL_NO_SURFACE                = null;
+
+public static final int EGL_FALSE                          = 0;
+public static final int EGL_TRUE                           = 1;
+public static final int EGL_SUCCESS                        = 0x3000;
+public static final int EGL_NOT_INITIALIZED                = 0x3001;
+public static final int EGL_BAD_ACCESS                     = 0x3002;
+public static final int EGL_BAD_ALLOC                      = 0x3003;
+public static final int EGL_BAD_ATTRIBUTE                  = 0x3004;
+public static final int EGL_BAD_CONFIG                     = 0x3005;
+public static final int EGL_BAD_CONTEXT                    = 0x3006;
+public static final int EGL_BAD_CURRENT_SURFACE            = 0x3007;
+public static final int EGL_BAD_DISPLAY                    = 0x3008;
+public static final int EGL_BAD_MATCH                      = 0x3009;
+public static final int EGL_BAD_NATIVE_PIXMAP              = 0x300A;
+public static final int EGL_BAD_NATIVE_WINDOW              = 0x300B;
+public static final int EGL_BAD_PARAMETER                  = 0x300C;
+public static final int EGL_BAD_SURFACE                    = 0x300D;
+public static final int EGL_CONTEXT_LOST                   = 0x300E;
+public static final int EGL_BUFFER_SIZE                    = 0x3020;
+public static final int EGL_ALPHA_SIZE                     = 0x3021;
+public static final int EGL_BLUE_SIZE                      = 0x3022;
+public static final int EGL_GREEN_SIZE                     = 0x3023;
+public static final int EGL_RED_SIZE                       = 0x3024;
+public static final int EGL_DEPTH_SIZE                     = 0x3025;
+public static final int EGL_STENCIL_SIZE                   = 0x3026;
+public static final int EGL_CONFIG_CAVEAT                  = 0x3027;
+public static final int EGL_CONFIG_ID                      = 0x3028;
+public static final int EGL_LEVEL                          = 0x3029;
+public static final int EGL_MAX_PBUFFER_HEIGHT             = 0x302A;
+public static final int EGL_MAX_PBUFFER_PIXELS             = 0x302B;
+public static final int EGL_MAX_PBUFFER_WIDTH              = 0x302C;
+public static final int EGL_NATIVE_RENDERABLE              = 0x302D;
+public static final int EGL_NATIVE_VISUAL_ID               = 0x302E;
+public static final int EGL_NATIVE_VISUAL_TYPE             = 0x302F;
+public static final int EGL_SAMPLES                        = 0x3031;
+public static final int EGL_SAMPLE_BUFFERS                 = 0x3032;
+public static final int EGL_SURFACE_TYPE                   = 0x3033;
+public static final int EGL_TRANSPARENT_TYPE               = 0x3034;
+public static final int EGL_TRANSPARENT_BLUE_VALUE         = 0x3035;
+public static final int EGL_TRANSPARENT_GREEN_VALUE        = 0x3036;
+public static final int EGL_TRANSPARENT_RED_VALUE          = 0x3037;
+public static final int EGL_NONE                           = 0x3038;
+public static final int EGL_BIND_TO_TEXTURE_RGB            = 0x3039;
+public static final int EGL_BIND_TO_TEXTURE_RGBA           = 0x303A;
+public static final int EGL_MIN_SWAP_INTERVAL              = 0x303B;
+public static final int EGL_MAX_SWAP_INTERVAL              = 0x303C;
+public static final int EGL_LUMINANCE_SIZE                 = 0x303D;
+public static final int EGL_ALPHA_MASK_SIZE                = 0x303E;
+public static final int EGL_COLOR_BUFFER_TYPE              = 0x303F;
+public static final int EGL_RENDERABLE_TYPE                = 0x3040;
+public static final int EGL_MATCH_NATIVE_PIXMAP            = 0x3041;
+public static final int EGL_CONFORMANT                     = 0x3042;
+public static final int EGL_SLOW_CONFIG                    = 0x3050;
+public static final int EGL_NON_CONFORMANT_CONFIG          = 0x3051;
+public static final int EGL_TRANSPARENT_RGB                = 0x3052;
+public static final int EGL_RGB_BUFFER                     = 0x308E;
+public static final int EGL_LUMINANCE_BUFFER               = 0x308F;
+public static final int EGL_NO_TEXTURE                     = 0x305C;
+public static final int EGL_TEXTURE_RGB                    = 0x305D;
+public static final int EGL_TEXTURE_RGBA                   = 0x305E;
+public static final int EGL_TEXTURE_2D                     = 0x305F;
+public static final int EGL_PBUFFER_BIT                    = 0x0001;
+public static final int EGL_PIXMAP_BIT                     = 0x0002;
+public static final int EGL_WINDOW_BIT                     = 0x0004;
+public static final int EGL_VG_COLORSPACE_LINEAR_BIT       = 0x0020;
+public static final int EGL_VG_ALPHA_FORMAT_PRE_BIT        = 0x0040;
+public static final int EGL_MULTISAMPLE_RESOLVE_BOX_BIT    = 0x0200;
+public static final int EGL_SWAP_BEHAVIOR_PRESERVED_BIT    = 0x0400;
+public static final int EGL_OPENGL_ES_BIT                  = 0x0001;
+public static final int EGL_OPENVG_BIT                     = 0x0002;
+public static final int EGL_OPENGL_ES2_BIT                 = 0x0004;
+public static final int EGL_OPENGL_BIT                     = 0x0008;
+public static final int EGL_VENDOR                         = 0x3053;
+public static final int EGL_VERSION                        = 0x3054;
+public static final int EGL_EXTENSIONS                     = 0x3055;
+public static final int EGL_CLIENT_APIS                    = 0x308D;
+public static final int EGL_HEIGHT                         = 0x3056;
+public static final int EGL_WIDTH                          = 0x3057;
+public static final int EGL_LARGEST_PBUFFER                = 0x3058;
+public static final int EGL_TEXTURE_FORMAT                 = 0x3080;
+public static final int EGL_TEXTURE_TARGET                 = 0x3081;
+public static final int EGL_MIPMAP_TEXTURE                 = 0x3082;
+public static final int EGL_MIPMAP_LEVEL                   = 0x3083;
+public static final int EGL_RENDER_BUFFER                  = 0x3086;
+public static final int EGL_VG_COLORSPACE                  = 0x3087;
+public static final int EGL_VG_ALPHA_FORMAT                = 0x3088;
+public static final int EGL_HORIZONTAL_RESOLUTION          = 0x3090;
+public static final int EGL_VERTICAL_RESOLUTION            = 0x3091;
+public static final int EGL_PIXEL_ASPECT_RATIO             = 0x3092;
+public static final int EGL_SWAP_BEHAVIOR                  = 0x3093;
+public static final int EGL_MULTISAMPLE_RESOLVE            = 0x3099;
+public static final int EGL_BACK_BUFFER                    = 0x3084;
+public static final int EGL_SINGLE_BUFFER                  = 0x3085;
+public static final int EGL_VG_COLORSPACE_sRGB             = 0x3089;
+public static final int EGL_VG_COLORSPACE_LINEAR           = 0x308A;
+public static final int EGL_VG_ALPHA_FORMAT_NONPRE         = 0x308B;
+public static final int EGL_VG_ALPHA_FORMAT_PRE            = 0x308C;
+public static final int EGL_DISPLAY_SCALING                = 10000;
+public static final int EGL_BUFFER_PRESERVED               = 0x3094;
+public static final int EGL_BUFFER_DESTROYED               = 0x3095;
+public static final int EGL_OPENVG_IMAGE                   = 0x3096;
+public static final int EGL_CONTEXT_CLIENT_TYPE            = 0x3097;
+public static final int EGL_CONTEXT_CLIENT_VERSION         = 0x3098;
+public static final int EGL_MULTISAMPLE_RESOLVE_DEFAULT    = 0x309A;
+public static final int EGL_MULTISAMPLE_RESOLVE_BOX        = 0x309B;
+public static final int EGL_OPENGL_ES_API                  = 0x30A0;
+public static final int EGL_OPENVG_API                     = 0x30A1;
+public static final int EGL_OPENGL_API                     = 0x30A2;
+public static final int EGL_DRAW                           = 0x3059;
+public static final int EGL_READ                           = 0x305A;
+public static final int EGL_CORE_NATIVE_ENGINE             = 0x305B;
+
+    native private static void _nativeClassInit();
+    static {
+        _nativeClassInit();
+    }
+    // C function EGLint eglGetError ( void )
+
+    public static native int eglGetError(
+    );
+
+    // C function EGLDisplay eglGetDisplay ( EGLNativeDisplayType display_id )
+
+    public static native EGLDisplay eglGetDisplay(
+        int display_id
+    );
+
+    /**
+     * {@hide}
+     */
+    @UnsupportedAppUsage
+    public static native EGLDisplay eglGetDisplay(
+        long display_id
+    );
+
+    // C function EGLBoolean eglInitialize ( EGLDisplay dpy, EGLint *major, EGLint *minor )
+
+    public static native boolean eglInitialize(
+        EGLDisplay dpy,
+        int[] major,
+        int majorOffset,
+        int[] minor,
+        int minorOffset
+    );
+
+    // C function EGLBoolean eglTerminate ( EGLDisplay dpy )
+
+    public static native boolean eglTerminate(
+        EGLDisplay dpy
+    );
+
+    // C function const char * eglQueryString ( EGLDisplay dpy, EGLint name )
+
+    public static native String eglQueryString(
+        EGLDisplay dpy,
+        int name
+    );
+    // C function EGLBoolean eglGetConfigs ( EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config )
+
+    public static native boolean eglGetConfigs(
+        EGLDisplay dpy,
+        EGLConfig[] configs,
+        int configsOffset,
+        int config_size,
+        int[] num_config,
+        int num_configOffset
+    );
+
+    // C function EGLBoolean eglChooseConfig ( EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config )
+
+    public static native boolean eglChooseConfig(
+        EGLDisplay dpy,
+        int[] attrib_list,
+        int attrib_listOffset,
+        EGLConfig[] configs,
+        int configsOffset,
+        int config_size,
+        int[] num_config,
+        int num_configOffset
+    );
+
+    // C function EGLBoolean eglGetConfigAttrib ( EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value )
+
+    public static native boolean eglGetConfigAttrib(
+        EGLDisplay dpy,
+        EGLConfig config,
+        int attribute,
+        int[] value,
+        int offset
+    );
+
+    // C function EGLSurface eglCreateWindowSurface ( EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list )
+
+    private static native EGLSurface _eglCreateWindowSurface(
+        EGLDisplay dpy,
+        EGLConfig config,
+        Object win,
+        int[] attrib_list,
+        int offset
+    );
+
+    private static native EGLSurface _eglCreateWindowSurfaceTexture(
+        EGLDisplay dpy,
+        EGLConfig config,
+        Object win,
+        int[] attrib_list,
+        int offset
+    );
+
+    public static EGLSurface eglCreateWindowSurface(EGLDisplay dpy,
+        EGLConfig config,
+        Object win,
+        int[] attrib_list,
+        int offset
+    ){
+        Surface sur = null;
+        if (win instanceof SurfaceView) {
+            SurfaceView surfaceView = (SurfaceView)win;
+            sur = surfaceView.getHolder().getSurface();
+        } else if (win instanceof SurfaceHolder) {
+            SurfaceHolder holder = (SurfaceHolder)win;
+            sur = holder.getSurface();
+        } else if (win instanceof Surface) {
+            sur = (Surface) win;
+        }
+
+        EGLSurface surface;
+        if (sur != null) {
+            surface = _eglCreateWindowSurface(dpy, config, sur, attrib_list, offset);
+        } else if (win instanceof SurfaceTexture) {
+            surface = _eglCreateWindowSurfaceTexture(dpy, config,
+                    win, attrib_list, offset);
+        } else {
+            throw new java.lang.UnsupportedOperationException(
+                "eglCreateWindowSurface() can only be called with an instance of " +
+                "Surface, SurfaceView, SurfaceTexture or SurfaceHolder at the moment, " +
+                "this will be fixed later.");
+        }
+
+        return surface;
+    }
+    // C function EGLSurface eglCreatePbufferSurface ( EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list )
+
+    public static native EGLSurface eglCreatePbufferSurface(
+        EGLDisplay dpy,
+        EGLConfig config,
+        int[] attrib_list,
+        int offset
+    );
+
+    // C function EGLSurface eglCreatePixmapSurface ( EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list )
+
+    @Deprecated
+    public static native EGLSurface eglCreatePixmapSurface(
+        EGLDisplay dpy,
+        EGLConfig config,
+        int pixmap,
+        int[] attrib_list,
+        int offset
+    );
+
+    // C function EGLBoolean eglDestroySurface ( EGLDisplay dpy, EGLSurface surface )
+
+    public static native boolean eglDestroySurface(
+        EGLDisplay dpy,
+        EGLSurface surface
+    );
+
+    // C function EGLBoolean eglQuerySurface ( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value )
+
+    public static native boolean eglQuerySurface(
+        EGLDisplay dpy,
+        EGLSurface surface,
+        int attribute,
+        int[] value,
+        int offset
+    );
+
+    // C function EGLBoolean eglBindAPI ( EGLenum api )
+
+    public static native boolean eglBindAPI(
+        int api
+    );
+
+    // C function EGLenum eglQueryAPI ( void )
+
+    public static native int eglQueryAPI(
+    );
+
+    // C function EGLBoolean eglWaitClient ( void )
+
+    public static native boolean eglWaitClient(
+    );
+
+    // C function EGLBoolean eglReleaseThread ( void )
+
+    public static native boolean eglReleaseThread(
+    );
+
+    // C function EGLSurface eglCreatePbufferFromClientBuffer ( EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list )
+    // TODO Deprecate the below method
+    public static native EGLSurface eglCreatePbufferFromClientBuffer(
+        EGLDisplay dpy,
+        int buftype,
+        int buffer,
+        EGLConfig config,
+        int[] attrib_list,
+        int offset
+    );
+    // TODO Unhide the below method
+    /**
+     * {@hide}
+     */
+    public static native EGLSurface eglCreatePbufferFromClientBuffer(
+        EGLDisplay dpy,
+        int buftype,
+        long buffer,
+        EGLConfig config,
+        int[] attrib_list,
+        int offset
+    );
+
+    // C function EGLBoolean eglSurfaceAttrib ( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value )
+
+    public static native boolean eglSurfaceAttrib(
+        EGLDisplay dpy,
+        EGLSurface surface,
+        int attribute,
+        int value
+    );
+
+    // C function EGLBoolean eglBindTexImage ( EGLDisplay dpy, EGLSurface surface, EGLint buffer )
+
+    public static native boolean eglBindTexImage(
+        EGLDisplay dpy,
+        EGLSurface surface,
+        int buffer
+    );
+
+    // C function EGLBoolean eglReleaseTexImage ( EGLDisplay dpy, EGLSurface surface, EGLint buffer )
+
+    public static native boolean eglReleaseTexImage(
+        EGLDisplay dpy,
+        EGLSurface surface,
+        int buffer
+    );
+
+    // C function EGLBoolean eglSwapInterval ( EGLDisplay dpy, EGLint interval )
+
+    public static native boolean eglSwapInterval(
+        EGLDisplay dpy,
+        int interval
+    );
+
+    // C function EGLContext eglCreateContext ( EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list )
+
+    public static native EGLContext eglCreateContext(
+        EGLDisplay dpy,
+        EGLConfig config,
+        EGLContext share_context,
+        int[] attrib_list,
+        int offset
+    );
+
+    // C function EGLBoolean eglDestroyContext ( EGLDisplay dpy, EGLContext ctx )
+
+    public static native boolean eglDestroyContext(
+        EGLDisplay dpy,
+        EGLContext ctx
+    );
+
+    // C function EGLBoolean eglMakeCurrent ( EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx )
+
+    public static native boolean eglMakeCurrent(
+        EGLDisplay dpy,
+        EGLSurface draw,
+        EGLSurface read,
+        EGLContext ctx
+    );
+
+    // C function EGLContext eglGetCurrentContext ( void )
+
+    public static native EGLContext eglGetCurrentContext(
+    );
+
+    // C function EGLSurface eglGetCurrentSurface ( EGLint readdraw )
+
+    public static native EGLSurface eglGetCurrentSurface(
+        int readdraw
+    );
+
+    // C function EGLDisplay eglGetCurrentDisplay ( void )
+
+    public static native EGLDisplay eglGetCurrentDisplay(
+    );
+
+    // C function EGLBoolean eglQueryContext ( EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value )
+
+    public static native boolean eglQueryContext(
+        EGLDisplay dpy,
+        EGLContext ctx,
+        int attribute,
+        int[] value,
+        int offset
+    );
+
+    // C function EGLBoolean eglWaitGL ( void )
+
+    public static native boolean eglWaitGL(
+    );
+
+    // C function EGLBoolean eglWaitNative ( EGLint engine )
+
+    public static native boolean eglWaitNative(
+        int engine
+    );
+
+    // C function EGLBoolean eglSwapBuffers ( EGLDisplay dpy, EGLSurface surface )
+
+    public static native boolean eglSwapBuffers(
+        EGLDisplay dpy,
+        EGLSurface surface
+    );
+
+    // C function EGLBoolean eglCopyBuffers ( EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target )
+
+    public static native boolean eglCopyBuffers(
+        EGLDisplay dpy,
+        EGLSurface surface,
+        int target
+    );
+
+}
diff --git a/android/opengl/EGL15.java b/android/opengl/EGL15.java
new file mode 100644
index 0000000..93acc67
--- /dev/null
+++ b/android/opengl/EGL15.java
@@ -0,0 +1,172 @@
+/*
+** Copyright 2018, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+package android.opengl;
+
+/**
+ * EGL 1.5
+ *
+ */
+public final class EGL15 {
+
+    private EGL15() {};
+
+    public static final int EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT            = 0x00000001;
+    public static final int EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT   = 0x00000002;
+    public static final int EGL_OPENGL_ES3_BIT                             = 0x00000040;
+    public static final int EGL_SYNC_FLUSH_COMMANDS_BIT                    = 0x0001;
+    public static final int EGL_GL_COLORSPACE_SRGB                         = 0x3089;
+    public static final int EGL_GL_COLORSPACE_LINEAR                       = 0x308A;
+    public static final int EGL_CONTEXT_MAJOR_VERSION                      = 0x3098;
+    public static final int EGL_CL_EVENT_HANDLE                            = 0x309C;
+    public static final int EGL_GL_COLORSPACE                              = 0x309D;
+    public static final int EGL_GL_TEXTURE_2D                              = 0x30B1;
+    public static final int EGL_GL_TEXTURE_3D                              = 0x30B2;
+    public static final int EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X             = 0x30B3;
+    public static final int EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X             = 0x30B4;
+    public static final int EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y             = 0x30B5;
+    public static final int EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y             = 0x30B6;
+    public static final int EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z             = 0x30B7;
+    public static final int EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z             = 0x30B8;
+    public static final int EGL_GL_RENDERBUFFER                            = 0x30B9;
+    public static final int EGL_GL_TEXTURE_LEVEL                           = 0x30BC;
+    public static final int EGL_GL_TEXTURE_ZOFFSET                         = 0x30BD;
+    public static final int EGL_IMAGE_PRESERVED                            = 0x30D2;
+    public static final int EGL_SYNC_PRIOR_COMMANDS_COMPLETE               = 0x30F0;
+    public static final int EGL_SYNC_STATUS                                = 0x30F1;
+    public static final int EGL_SIGNALED                                   = 0x30F2;
+    public static final int EGL_UNSIGNALED                                 = 0x30F3;
+    public static final int EGL_TIMEOUT_EXPIRED                            = 0x30F5;
+    public static final int EGL_CONDITION_SATISFIED                        = 0x30F6;
+    public static final int EGL_SYNC_TYPE                                  = 0x30F7;
+    public static final int EGL_SYNC_CONDITION                             = 0x30F8;
+    public static final int EGL_SYNC_FENCE                                 = 0x30F9;
+    public static final int EGL_CONTEXT_MINOR_VERSION                      = 0x30FB;
+    public static final int EGL_CONTEXT_OPENGL_PROFILE_MASK                = 0x30FD;
+    public static final int EGL_SYNC_CL_EVENT                              = 0x30FE;
+    public static final int EGL_SYNC_CL_EVENT_COMPLETE                     = 0x30FF;
+    public static final int EGL_CONTEXT_OPENGL_DEBUG                       = 0x31B0;
+    public static final int EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE          = 0x31B1;
+    public static final int EGL_CONTEXT_OPENGL_ROBUST_ACCESS               = 0x31B2;
+    public static final int EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY = 0x31BD;
+    public static final int EGL_NO_RESET_NOTIFICATION                      = 0x31BE;
+    public static final int EGL_LOSE_CONTEXT_ON_RESET                      = 0x31BF;
+    public static final int EGL_PLATFORM_ANDROID_KHR                       = 0x3141;
+    public static final long EGL_FOREVER                                   = 0xFFFFFFFFFFFFFFFFL;
+    public static final EGLImage EGL_NO_IMAGE                              = null;
+    public static final EGLSync EGL_NO_SYNC                                = null;
+    public static final EGLContext EGL_NO_CONTEXT                          = null;
+    public static final EGLDisplay EGL_NO_DISPLAY                          = null;
+    public static final EGLSurface EGL_NO_SURFACE                          = null;
+
+    native private static void _nativeClassInit();
+    static {
+        _nativeClassInit();
+    }
+    // C function EGLSync eglCreateSync ( EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list )
+
+    public static native EGLSync eglCreateSync(
+        EGLDisplay dpy,
+        int type,
+        long[] attrib_list,
+        int offset
+    );
+
+    /**
+    * C function EGLBoolean eglGetSyncAttrib ( EGLDisplay dpy, EGLSync sync, EGLint attribute,
+    *                                          EGLAttrib *value )
+    */
+
+    public static native boolean eglGetSyncAttrib(
+            EGLDisplay dpy,
+            EGLSync sync,
+            int attribute,
+            long[] value,
+            int offset
+    );
+
+    // C function EGLBoolean eglDestroySync ( EGLDisplay dpy, EGLSync sync )
+
+    public static native boolean eglDestroySync(
+        EGLDisplay dpy,
+        EGLSync sync
+    );
+
+    // C function EGLint eglClientWaitSync ( EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout )
+
+    public static native int eglClientWaitSync(
+        EGLDisplay dpy,
+        EGLSync sync,
+        int flags,
+        long timeout
+    );
+
+    // C function EGLDisplay eglGetPlatformDisplay ( EGLenum platform, EGLAttrib native_display, const EGLAttrib *attrib_list )
+
+    public static native EGLDisplay eglGetPlatformDisplay(
+        int platform,
+        long native_display,
+        long[] attrib_list,
+        int offset
+    );
+
+    // C function EGLSurface eglCreatePlatformWindowSurface ( EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list )
+
+    public static native EGLSurface eglCreatePlatformWindowSurface(
+        EGLDisplay dpy,
+        EGLConfig config,
+        java.nio.Buffer native_window,
+        long[] attrib_list,
+        int offset
+    );
+
+    // C function EGLSurface eglCreatePlatformPixmapSurface ( EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list )
+
+    public static native EGLSurface eglCreatePlatformPixmapSurface(
+        EGLDisplay dpy,
+        EGLConfig config,
+        java.nio.Buffer native_pixmap,
+        long[] attrib_list,
+        int offset
+    );
+
+    // C function EGLBoolean eglWaitSync ( EGLDisplay dpy, EGLSync sync, EGLint flags )
+
+    public static native boolean eglWaitSync(
+        EGLDisplay dpy,
+        EGLSync sync,
+        int flags
+    );
+
+    // C function EGLImage eglCreateImage ( EGLDisplay dpy, EGLContext context, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list )
+
+    public static native EGLImage eglCreateImage(
+        EGLDisplay dpy,
+        EGLContext context,
+        int target,
+        long buffer,
+        long[] attrib_list,
+        int offset
+    );
+
+    // C function EGLBoolean eglDestroyImage ( EGLDisplay dpy, EGLImage image )
+
+    public static native boolean eglDestroyImage(
+        EGLDisplay dpy,
+        EGLImage image
+    );
+
+}
diff --git a/android/opengl/EGLConfig.java b/android/opengl/EGLConfig.java
new file mode 100644
index 0000000..9881070
--- /dev/null
+++ b/android/opengl/EGLConfig.java
@@ -0,0 +1,37 @@
+/*
+**
+** Copyright 2012, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+package android.opengl;
+
+/**
+ * Wrapper class for native EGLConfig objects.
+ *
+ */
+public class EGLConfig extends EGLObjectHandle {
+    private EGLConfig(long handle) {
+        super(handle);
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof EGLConfig)) return false;
+
+        EGLConfig that = (EGLConfig) o;
+        return getNativeHandle() == that.getNativeHandle();
+    }
+}
diff --git a/android/opengl/EGLContext.java b/android/opengl/EGLContext.java
new file mode 100644
index 0000000..f791e7e
--- /dev/null
+++ b/android/opengl/EGLContext.java
@@ -0,0 +1,37 @@
+/*
+**
+** Copyright 2012, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+package android.opengl;
+
+/**
+ * Wrapper class for native EGLContext objects.
+ *
+ */
+public class EGLContext extends EGLObjectHandle {
+    private EGLContext(long handle) {
+        super(handle);
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof EGLContext)) return false;
+
+        EGLContext that = (EGLContext) o;
+        return getNativeHandle() == that.getNativeHandle();
+    }
+}
diff --git a/android/opengl/EGLDisplay.java b/android/opengl/EGLDisplay.java
new file mode 100644
index 0000000..e872761
--- /dev/null
+++ b/android/opengl/EGLDisplay.java
@@ -0,0 +1,37 @@
+/*
+**
+** Copyright 2012, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+package android.opengl;
+
+/**
+ * Wrapper class for native EGLDisplay objects.
+ *
+ */
+public class EGLDisplay extends EGLObjectHandle {
+    private EGLDisplay(long handle) {
+        super(handle);
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof EGLDisplay)) return false;
+
+        EGLDisplay that = (EGLDisplay) o;
+        return getNativeHandle() == that.getNativeHandle();
+    }
+}
diff --git a/android/opengl/EGLExt.java b/android/opengl/EGLExt.java
new file mode 100644
index 0000000..74b64ea
--- /dev/null
+++ b/android/opengl/EGLExt.java
@@ -0,0 +1,46 @@
+/*
+** Copyright 2013, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+package android.opengl;
+
+/**
+ * EGL Extensions
+ */
+public class EGLExt {
+
+    // EGL_KHR_create_context
+    public static final int EGL_CONTEXT_MAJOR_VERSION_KHR   = 0x3098;
+    public static final int EGL_CONTEXT_MINOR_VERSION_KHR   = 0x30FB;
+    public static final int EGL_CONTEXT_FLAGS_KHR           = 0x30FC;
+    public static final int EGL_OPENGL_ES3_BIT_KHR          = 0x0040;
+    public static final int EGL_RECORDABLE_ANDROID          = 0x3142;
+
+    native private static void _nativeClassInit();
+    static {
+        _nativeClassInit();
+    }
+
+    // C function EGLBoolean eglPresentationTimeANDROID ( EGLDisplay dpy, EGLSurface sur, EGLnsecsANDROID time )
+
+    public static native boolean eglPresentationTimeANDROID(
+        EGLDisplay dpy,
+        EGLSurface sur,
+        long time
+    );
+
+}
diff --git a/android/opengl/EGLImage.java b/android/opengl/EGLImage.java
new file mode 100644
index 0000000..731ce72
--- /dev/null
+++ b/android/opengl/EGLImage.java
@@ -0,0 +1,37 @@
+/*
+**
+** Copyright 2018, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+package android.opengl;
+
+/**
+ * Wrapper class for native EGLImage objects.
+ *
+ */
+public class EGLImage extends EGLObjectHandle {
+    private EGLImage(long handle) {
+        super(handle);
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof EGLImage)) return false;
+
+        EGLImage that = (EGLImage) o;
+        return getNativeHandle() == that.getNativeHandle();
+    }
+}
diff --git a/android/opengl/EGLLogWrapper.java b/android/opengl/EGLLogWrapper.java
new file mode 100644
index 0000000..c677957
--- /dev/null
+++ b/android/opengl/EGLLogWrapper.java
@@ -0,0 +1,571 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.opengl;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import javax.microedition.khronos.egl.EGL;
+import javax.microedition.khronos.egl.EGL10;
+import javax.microedition.khronos.egl.EGL11;
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.egl.EGLContext;
+import javax.microedition.khronos.egl.EGLDisplay;
+import javax.microedition.khronos.egl.EGLSurface;
+
+class EGLLogWrapper implements EGL11 {
+    private EGL10 mEgl10;
+    Writer mLog;
+    boolean mLogArgumentNames;
+    boolean mCheckError;
+    private int mArgCount;
+
+
+    public EGLLogWrapper(EGL egl, int configFlags, Writer log) {
+        mEgl10 = (EGL10) egl;
+        mLog = log;
+        mLogArgumentNames =
+            (GLDebugHelper.CONFIG_LOG_ARGUMENT_NAMES & configFlags) != 0;
+        mCheckError =
+            (GLDebugHelper.CONFIG_CHECK_GL_ERROR & configFlags) != 0;
+    }
+
+    public boolean eglChooseConfig(EGLDisplay display, int[] attrib_list,
+            EGLConfig[] configs, int config_size, int[] num_config) {
+        begin("eglChooseConfig");
+        arg("display", display);
+        arg("attrib_list", attrib_list);
+        arg("config_size", config_size);
+        end();
+
+        boolean result = mEgl10.eglChooseConfig(display, attrib_list, configs,
+                config_size, num_config);
+        arg("configs", configs);
+        arg("num_config", num_config);
+        returns(result);
+        checkError();
+        return result;
+    }
+
+    public boolean eglCopyBuffers(EGLDisplay display, EGLSurface surface,
+            Object native_pixmap) {
+        begin("eglCopyBuffers");
+        arg("display", display);
+        arg("surface", surface);
+        arg("native_pixmap", native_pixmap);
+        end();
+
+        boolean result = mEgl10.eglCopyBuffers(display, surface, native_pixmap);
+        returns(result);
+        checkError();
+        return result;
+    }
+
+    public EGLContext eglCreateContext(EGLDisplay display, EGLConfig config,
+            EGLContext share_context, int[] attrib_list) {
+        begin("eglCreateContext");
+        arg("display", display);
+        arg("config", config);
+        arg("share_context", share_context);
+        arg("attrib_list", attrib_list);
+        end();
+
+        EGLContext result = mEgl10.eglCreateContext(display, config,
+                share_context, attrib_list);
+        returns(result);
+        checkError();
+        return result;
+    }
+
+    public EGLSurface eglCreatePbufferSurface(EGLDisplay display,
+            EGLConfig config, int[] attrib_list) {
+        begin("eglCreatePbufferSurface");
+        arg("display", display);
+        arg("config", config);
+        arg("attrib_list", attrib_list);
+        end();
+
+        EGLSurface result = mEgl10.eglCreatePbufferSurface(display, config,
+                attrib_list);
+        returns(result);
+        checkError();
+        return result;
+    }
+
+    public EGLSurface eglCreatePixmapSurface(EGLDisplay display,
+            EGLConfig config, Object native_pixmap, int[] attrib_list) {
+        begin("eglCreatePixmapSurface");
+        arg("display", display);
+        arg("config", config);
+        arg("native_pixmap", native_pixmap);
+        arg("attrib_list", attrib_list);
+        end();
+
+        EGLSurface result = mEgl10.eglCreatePixmapSurface(display, config,
+                native_pixmap, attrib_list);
+        returns(result);
+        checkError();
+        return result;
+        }
+
+    public EGLSurface eglCreateWindowSurface(EGLDisplay display,
+            EGLConfig config, Object native_window, int[] attrib_list) {
+        begin("eglCreateWindowSurface");
+        arg("display", display);
+        arg("config", config);
+        arg("native_window", native_window);
+        arg("attrib_list", attrib_list);
+        end();
+
+        EGLSurface result = mEgl10.eglCreateWindowSurface(display, config,
+                native_window, attrib_list);
+        returns(result);
+        checkError();
+        return result;
+    }
+
+    public boolean eglDestroyContext(EGLDisplay display, EGLContext context) {
+        begin("eglDestroyContext");
+        arg("display", display);
+        arg("context", context);
+        end();
+
+        boolean result = mEgl10.eglDestroyContext(display, context);
+        returns(result);
+        checkError();
+        return result;
+    }
+
+    public boolean eglDestroySurface(EGLDisplay display, EGLSurface surface) {
+        begin("eglDestroySurface");
+        arg("display", display);
+        arg("surface", surface);
+        end();
+
+        boolean result = mEgl10.eglDestroySurface(display, surface);
+        returns(result);
+        checkError();
+        return result;
+    }
+
+    public boolean eglGetConfigAttrib(EGLDisplay display, EGLConfig config,
+            int attribute, int[] value) {
+        begin("eglGetConfigAttrib");
+        arg("display", display);
+        arg("config", config);
+        arg("attribute", attribute);
+        end();
+        boolean result = mEgl10.eglGetConfigAttrib(display, config, attribute,
+                value);
+        arg("value", value);
+        returns(result);
+        checkError();
+        return false;
+    }
+
+    public boolean eglGetConfigs(EGLDisplay display, EGLConfig[] configs,
+            int config_size, int[] num_config) {
+        begin("eglGetConfigs");
+        arg("display", display);
+        arg("config_size", config_size);
+        end();
+
+        boolean result = mEgl10.eglGetConfigs(display, configs, config_size,
+                num_config);
+        arg("configs", configs);
+        arg("num_config", num_config);
+        returns(result);
+        checkError();
+        return result;
+    }
+
+    public EGLContext eglGetCurrentContext() {
+        begin("eglGetCurrentContext");
+        end();
+
+        EGLContext result = mEgl10.eglGetCurrentContext();
+        returns(result);
+
+        checkError();
+        return result;
+    }
+
+    public EGLDisplay eglGetCurrentDisplay() {
+        begin("eglGetCurrentDisplay");
+        end();
+
+        EGLDisplay result = mEgl10.eglGetCurrentDisplay();
+        returns(result);
+
+        checkError();
+        return result;
+    }
+
+    public EGLSurface eglGetCurrentSurface(int readdraw) {
+        begin("eglGetCurrentSurface");
+        arg("readdraw", readdraw);
+        end();
+
+        EGLSurface result = mEgl10.eglGetCurrentSurface(readdraw);
+        returns(result);
+
+        checkError();
+        return result;
+    }
+
+    public EGLDisplay eglGetDisplay(Object native_display) {
+        begin("eglGetDisplay");
+        arg("native_display", native_display);
+        end();
+
+        EGLDisplay result = mEgl10.eglGetDisplay(native_display);
+        returns(result);
+
+        checkError();
+        return result;
+    }
+
+    public int eglGetError() {
+        begin("eglGetError");
+        end();
+
+        int result = mEgl10.eglGetError();
+        returns(getErrorString(result));
+
+        return result;
+    }
+
+    public boolean eglInitialize(EGLDisplay display, int[] major_minor) {
+        begin("eglInitialize");
+        arg("display", display);
+        end();
+        boolean result = mEgl10.eglInitialize(display, major_minor);
+        returns(result);
+        arg("major_minor", major_minor);
+        checkError();
+        return result;
+    }
+
+    public boolean eglMakeCurrent(EGLDisplay display, EGLSurface draw,
+            EGLSurface read, EGLContext context) {
+        begin("eglMakeCurrent");
+        arg("display", display);
+        arg("draw", draw);
+        arg("read", read);
+        arg("context", context);
+        end();
+        boolean result = mEgl10.eglMakeCurrent(display, draw, read, context);
+        returns(result);
+        checkError();
+        return result;
+    }
+
+    public boolean eglQueryContext(EGLDisplay display, EGLContext context,
+            int attribute, int[] value) {
+        begin("eglQueryContext");
+        arg("display", display);
+        arg("context", context);
+        arg("attribute", attribute);
+        end();
+        boolean result = mEgl10.eglQueryContext(display, context, attribute,
+                value);
+        returns(value[0]);
+        returns(result);
+        checkError();
+        return result;
+    }
+
+    public String eglQueryString(EGLDisplay display, int name) {
+        begin("eglQueryString");
+        arg("display", display);
+        arg("name", name);
+        end();
+        String result = mEgl10.eglQueryString(display, name);
+        returns(result);
+        checkError();
+        return result;
+    }
+
+    public boolean eglQuerySurface(EGLDisplay display, EGLSurface surface,
+            int attribute, int[] value) {
+        begin("eglQuerySurface");
+        arg("display", display);
+        arg("surface", surface);
+        arg("attribute", attribute);
+        end();
+        boolean result = mEgl10.eglQuerySurface(display, surface, attribute,
+                value);
+        returns(value[0]);
+        returns(result);
+        checkError();
+        return result;
+    }
+    
+    /** @hide **/
+    public boolean eglReleaseThread() {
+        begin("eglReleaseThread");
+        end();
+        boolean result = mEgl10.eglReleaseThread();
+        returns(result);
+        checkError();
+        return result;
+    }
+
+    public boolean eglSwapBuffers(EGLDisplay display, EGLSurface surface) {
+        begin("eglSwapBuffers");
+        arg("display", display);
+        arg("surface", surface);
+        end();
+        boolean result = mEgl10.eglSwapBuffers(display, surface);
+        returns(result);
+        checkError();
+        return result;
+    }
+
+    public boolean eglTerminate(EGLDisplay display) {
+        begin("eglTerminate");
+        arg("display", display);
+        end();
+        boolean result = mEgl10.eglTerminate(display);
+        returns(result);
+        checkError();
+        return result;
+    }
+
+    public boolean eglWaitGL() {
+        begin("eglWaitGL");
+        end();
+        boolean result = mEgl10.eglWaitGL();
+        returns(result);
+        checkError();
+        return result;
+    }
+
+    public boolean eglWaitNative(int engine, Object bindTarget) {
+        begin("eglWaitNative");
+        arg("engine", engine);
+        arg("bindTarget", bindTarget);
+        end();
+        boolean result = mEgl10.eglWaitNative(engine, bindTarget);
+        returns(result);
+        checkError();
+        return result;
+    }
+
+    private void checkError() {
+        int eglError;
+        if ((eglError = mEgl10.eglGetError()) != EGL_SUCCESS) {
+            String errorMessage = "eglError: " + getErrorString(eglError);
+            logLine(errorMessage);
+            if (mCheckError) {
+                throw new GLException(eglError, errorMessage);
+            }
+        }
+    }
+
+    private void logLine(String message) {
+        log(message + '\n');
+    }
+
+    private void log(String message) {
+        try {
+            mLog.write(message);
+        } catch (IOException e) {
+            // Ignore exception, keep on trying
+        }
+    }
+
+    private void begin(String name) {
+        log(name + '(');
+        mArgCount = 0;
+    }
+
+    private void arg(String name, String value) {
+        if (mArgCount++ > 0) {
+            log(", ");
+        }
+        if (mLogArgumentNames) {
+            log(name + "=");
+        }
+        log(value);
+    }
+
+    private void end() {
+        log(");\n");
+        flush();
+    }
+
+    private void flush() {
+        try {
+            mLog.flush();
+        } catch (IOException e) {
+            mLog = null;
+        }
+    }
+
+    private void arg(String name, int value) {
+        arg(name, Integer.toString(value));
+    }
+
+    private void arg(String name, Object object) {
+        arg(name, toString(object));
+    }
+
+    private void arg(String name, EGLDisplay object) {
+        if (object == EGL10.EGL_DEFAULT_DISPLAY) {
+            arg(name, "EGL10.EGL_DEFAULT_DISPLAY");
+        } else if (object == EGL_NO_DISPLAY) {
+            arg(name, "EGL10.EGL_NO_DISPLAY");
+        } else {
+            arg(name, toString(object));
+        }
+    }
+
+    private void arg(String name, EGLContext object) {
+        if (object == EGL10.EGL_NO_CONTEXT) {
+            arg(name, "EGL10.EGL_NO_CONTEXT");
+        } else {
+            arg(name, toString(object));
+        }
+    }
+
+    private void arg(String name, EGLSurface object) {
+        if (object == EGL10.EGL_NO_SURFACE) {
+            arg(name, "EGL10.EGL_NO_SURFACE");
+        } else {
+            arg(name, toString(object));
+        }
+    }
+
+    private void returns(String result) {
+        log(" returns " + result + ";\n");
+        flush();
+    }
+
+    private void returns(int result) {
+        returns(Integer.toString(result));
+    }
+
+    private void returns(boolean result) {
+        returns(Boolean.toString(result));
+    }
+
+    private void returns(Object result) {
+        returns(toString(result));
+    }
+
+    private String toString(Object obj) {
+        if (obj == null) {
+            return "null";
+        } else {
+            return obj.toString();
+        }
+    }
+
+    private void arg(String name, int[] arr) {
+        if (arr == null) {
+            arg(name, "null");
+        } else {
+            arg(name, toString(arr.length, arr, 0));
+        }
+    }
+
+    private void arg(String name, Object[] arr) {
+        if (arr == null) {
+            arg(name, "null");
+        } else {
+            arg(name, toString(arr.length, arr, 0));
+        }
+    }
+
+    private String toString(int n, int[] arr, int offset) {
+        StringBuilder buf = new StringBuilder();
+        buf.append("{\n");
+        int arrLen = arr.length;
+        for (int i = 0; i < n; i++) {
+            int index = offset + i;
+            buf.append(" [" + index + "] = ");
+            if (index < 0 || index >= arrLen) {
+                buf.append("out of bounds");
+            } else {
+                buf.append(arr[index]);
+            }
+            buf.append('\n');
+        }
+        buf.append("}");
+        return buf.toString();
+    }
+
+    private String toString(int n, Object[] arr, int offset) {
+        StringBuilder buf = new StringBuilder();
+        buf.append("{\n");
+        int arrLen = arr.length;
+        for (int i = 0; i < n; i++) {
+            int index = offset + i;
+            buf.append(" [" + index + "] = ");
+            if (index < 0 || index >= arrLen) {
+                buf.append("out of bounds");
+            } else {
+                buf.append(arr[index]);
+            }
+            buf.append('\n');
+        }
+        buf.append("}");
+        return buf.toString();
+    }
+
+    private static String getHex(int value) {
+        return "0x" + Integer.toHexString(value);
+    }
+
+    public static String getErrorString(int error) {
+        switch (error) {
+        case EGL_SUCCESS:
+            return "EGL_SUCCESS";
+        case EGL_NOT_INITIALIZED:
+            return "EGL_NOT_INITIALIZED";
+        case EGL_BAD_ACCESS:
+            return "EGL_BAD_ACCESS";
+        case EGL_BAD_ALLOC:
+            return "EGL_BAD_ALLOC";
+        case EGL_BAD_ATTRIBUTE:
+            return "EGL_BAD_ATTRIBUTE";
+        case EGL_BAD_CONFIG:
+            return "EGL_BAD_CONFIG";
+        case EGL_BAD_CONTEXT:
+            return "EGL_BAD_CONTEXT";
+        case EGL_BAD_CURRENT_SURFACE:
+            return "EGL_BAD_CURRENT_SURFACE";
+        case EGL_BAD_DISPLAY:
+            return "EGL_BAD_DISPLAY";
+        case EGL_BAD_MATCH:
+            return "EGL_BAD_MATCH";
+        case EGL_BAD_NATIVE_PIXMAP:
+            return "EGL_BAD_NATIVE_PIXMAP";
+        case EGL_BAD_NATIVE_WINDOW:
+            return "EGL_BAD_NATIVE_WINDOW";
+        case EGL_BAD_PARAMETER:
+            return "EGL_BAD_PARAMETER";
+        case EGL_BAD_SURFACE:
+            return "EGL_BAD_SURFACE";
+        case EGL11.EGL_CONTEXT_LOST:
+            return "EGL_CONTEXT_LOST";
+        default:
+            return getHex(error);
+        }
+    }
+}
diff --git a/android/opengl/EGLObjectHandle.java b/android/opengl/EGLObjectHandle.java
new file mode 100644
index 0000000..f961eb7
--- /dev/null
+++ b/android/opengl/EGLObjectHandle.java
@@ -0,0 +1,70 @@
+/*
+**
+** Copyright 2012, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+package android.opengl;
+
+/**
+ * Base class for wrapped EGL objects.
+ *
+ */
+public abstract class EGLObjectHandle {
+    private final long mHandle;
+
+    /**
+     * @deprecated Use {@link #EGLObjectHandle(long)} instead. Handles
+     *     on 64 bit platforms will be wider than java ints.
+     */
+    @Deprecated
+    protected EGLObjectHandle(int handle) {
+        mHandle = handle;
+    }
+    protected EGLObjectHandle(long handle) {
+        mHandle = handle;
+    }
+    /**
+     * @deprecated Use {@link #getNativeHandle()} instead. Handles on
+     *     64 bit platforms will be wider than java ints.
+     */
+    @Deprecated
+    public int getHandle() {
+        if ((mHandle & 0xffffffffL) != mHandle) {
+            throw new UnsupportedOperationException();
+        }
+        return (int)mHandle;
+    }
+    /**
+     * Returns the native handle of the wrapped EGL object. This handle can be
+     * cast to the corresponding native type on the native side.
+     *
+     * For example, EGLDisplay dpy = (EGLDisplay)handle;
+     *
+     * @return the native handle of the wrapped EGL object.
+     */
+    public long getNativeHandle() {
+        return mHandle;
+    }
+    @Override
+    public int hashCode() {
+        /*
+         * Based on the algorithm suggested in
+         * http://developer.android.com/reference/java/lang/Object.html
+         */
+        int result = 17;
+        result = 31 * result + (int) (mHandle ^ (mHandle >>> 32));
+        return result;
+    }
+}
diff --git a/android/opengl/EGLSurface.java b/android/opengl/EGLSurface.java
new file mode 100644
index 0000000..c200f72
--- /dev/null
+++ b/android/opengl/EGLSurface.java
@@ -0,0 +1,37 @@
+/*
+**
+** Copyright 2012, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+package android.opengl;
+
+/**
+ * Wrapper class for native EGLSurface objects.
+ *
+ */
+public class EGLSurface extends EGLObjectHandle {
+    private EGLSurface(long handle) {
+        super(handle);
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof EGLSurface)) return false;
+
+        EGLSurface that = (EGLSurface) o;
+        return getNativeHandle() == that.getNativeHandle();
+    }
+}
diff --git a/android/opengl/EGLSync.java b/android/opengl/EGLSync.java
new file mode 100644
index 0000000..472f9e7
--- /dev/null
+++ b/android/opengl/EGLSync.java
@@ -0,0 +1,37 @@
+/*
+**
+** Copyright 2018, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+package android.opengl;
+
+/**
+ * Wrapper class for native EGLSync objects.
+ *
+ */
+public class EGLSync extends EGLObjectHandle {
+    private EGLSync(long handle) {
+        super(handle);
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof EGLSync)) return false;
+
+        EGLSync that = (EGLSync) o;
+        return getNativeHandle() == that.getNativeHandle();
+    }
+}
diff --git a/android/opengl/ETC1.java b/android/opengl/ETC1.java
new file mode 100644
index 0000000..fb5f9b4
--- /dev/null
+++ b/android/opengl/ETC1.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.opengl;
+
+import java.nio.Buffer;
+
+/**
+ * Methods for encoding and decoding ETC1 textures.
+ * <p>
+ * The standard for the ETC1 texture format can be found at
+ * http://www.khronos.org/registry/gles/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt
+ * <p>
+ * The PKM file format is of a 16-byte header that describes the image bounds
+ * followed by the encoded ETC1 texture data.
+ * <p>
+ * @see ETC1Util
+ */
+public class ETC1 {
+
+    /**
+     * Size in bytes of an encoded block.
+     */
+    public static final int ENCODED_BLOCK_SIZE = 8;
+
+    /**
+     * Size in bytes of a decoded block.
+     */
+    public static final int DECODED_BLOCK_SIZE = 48;
+
+    /**
+     * Size of a PKM file header, in bytes.
+     */
+    public static final int ETC_PKM_HEADER_SIZE = 16;
+
+    /**
+     * Accepted by the internalformat parameter of glCompressedTexImage2D.
+     */
+    public static final int ETC1_RGB8_OES = 0x8D64;
+
+    /**
+     * Encode a block of pixels.
+     *
+     * @param in a native order direct buffer of size DECODED_BLOCK_SIZE that represent a
+     * 4 x 4 square of 3-byte pixels in form R, G, B. Byte (3 * (x + 4 * y) is the R
+     * value of pixel (x, y).
+     *
+     * @param validPixelMask is a 16-bit mask where bit (1 << (x + y * 4)) indicates whether
+     * the corresponding (x,y) pixel is valid. Invalid pixel color values are ignored when compressing.
+     *
+     * @param out a native order direct buffer of size ENCODED_BLOCK_SIZE that receives the
+     * ETC1 compressed version of the data.
+     *
+     */
+    public static native void encodeBlock(Buffer in, int validPixelMask, Buffer out);
+
+    /**
+     * Decode a block of pixels.
+     *
+     * @param in a native order direct buffer of size ENCODED_BLOCK_SIZE that contains the
+     * ETC1 compressed version of the data.
+     *
+     * @param out a native order direct buffer of size DECODED_BLOCK_SIZE that will receive
+     * the decoded data. The data represents a
+     * 4 x 4 square of 3-byte pixels in form R, G, B. Byte (3 * (x + 4 * y) is the R
+     * value of pixel (x, y).
+     */
+    public static native void decodeBlock(Buffer in, Buffer out);
+
+    /**
+     * Return the size of the encoded image data (does not include size of PKM header).
+     */
+    public static native int getEncodedDataSize(int width, int height);
+
+    /**
+     * Encode an entire image.
+     * @param in a native order direct buffer of the image data. Formatted such that
+     *           pixel (x,y) is at pIn + pixelSize * x + stride * y;
+     * @param out a native order direct buffer of the encoded data.
+     * Must be large enough to store entire encoded image.
+     * @param pixelSize must be 2 or 3. 2 is an GL_UNSIGNED_SHORT_5_6_5 image,
+     * 3 is a GL_BYTE RGB image.
+     */
+    public static native void encodeImage(Buffer in, int width, int height,
+            int pixelSize, int stride, Buffer out);
+
+    /**
+     * Decode an entire image.
+     * @param in native order direct buffer of the encoded data.
+     * @param out native order direct buffer of the image data. Will be written such that
+     * pixel (x,y) is at pIn + pixelSize * x + stride * y. Must be
+     * large enough to store entire image.
+     * @param pixelSize must be 2 or 3. 2 is an GL_UNSIGNED_SHORT_5_6_5 image,
+     * 3 is a GL_BYTE RGB image.
+     */
+    public static native void decodeImage(Buffer in, Buffer out,
+            int width, int height, int pixelSize, int stride);
+
+    /**
+     * Format a PKM header
+     * @param header native order direct buffer of the header.
+     * @param width the width of the image in pixels.
+     * @param height the height of the image in pixels.
+     */
+    public static native void formatHeader(Buffer header, int width, int height);
+
+    /**
+     * Check if a PKM header is correctly formatted.
+     * @param header native order direct buffer of the header.
+     */
+    public static native boolean isValid(Buffer header);
+
+    /**
+     * Read the image width from a PKM header
+     * @param header native order direct buffer of the header.
+     */
+    public static native int getWidth(Buffer header);
+
+    /**
+     * Read the image height from a PKM header
+     * @param header native order direct buffer of the header.
+     */
+    public static native int getHeight(Buffer header);
+}
diff --git a/android/opengl/ETC1Util.java b/android/opengl/ETC1Util.java
new file mode 100644
index 0000000..e343c97
--- /dev/null
+++ b/android/opengl/ETC1Util.java
@@ -0,0 +1,228 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.opengl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * Utility methods for using ETC1 compressed textures.
+ *
+ */
+public class ETC1Util {
+    /**
+     * Convenience method to load an ETC1 texture whether or not the active OpenGL context
+     * supports the ETC1 texture compression format.
+     * @param target the texture target.
+     * @param level the texture level
+     * @param border the border size. Typically 0.
+     * @param fallbackFormat the format to use if ETC1 texture compression is not supported.
+     * Must be GL_RGB.
+     * @param fallbackType the type to use if ETC1 texture compression is not supported.
+     * Can be either GL_UNSIGNED_SHORT_5_6_5, which implies 16-bits-per-pixel,
+     * or GL_UNSIGNED_BYTE, which implies 24-bits-per-pixel.
+     * @param input the input stream containing an ETC1 texture in PKM format.
+     * @throws IOException
+     */
+    public static void loadTexture(int target, int level, int border,
+            int fallbackFormat, int fallbackType, InputStream input)
+        throws IOException {
+        loadTexture(target, level, border, fallbackFormat, fallbackType, createTexture(input));
+    }
+
+    /**
+     * Convenience method to load an ETC1 texture whether or not the active OpenGL context
+     * supports the ETC1 texture compression format.
+     * @param target the texture target.
+     * @param level the texture level
+     * @param border the border size. Typically 0.
+     * @param fallbackFormat the format to use if ETC1 texture compression is not supported.
+     * Must be GL_RGB.
+     * @param fallbackType the type to use if ETC1 texture compression is not supported.
+     * Can be either GL_UNSIGNED_SHORT_5_6_5, which implies 16-bits-per-pixel,
+     * or GL_UNSIGNED_BYTE, which implies 24-bits-per-pixel.
+     * @param texture the ETC1 to load.
+     */
+    public static void loadTexture(int target, int level, int border,
+            int fallbackFormat, int fallbackType, ETC1Texture texture) {
+        if (fallbackFormat != GLES10.GL_RGB) {
+            throw new IllegalArgumentException("fallbackFormat must be GL_RGB");
+        }
+        if (! (fallbackType == GLES10.GL_UNSIGNED_SHORT_5_6_5
+                || fallbackType == GLES10.GL_UNSIGNED_BYTE)) {
+            throw new IllegalArgumentException("Unsupported fallbackType");
+        }
+
+        int width = texture.getWidth();
+        int height = texture.getHeight();
+        Buffer data = texture.getData();
+        if (isETC1Supported()) {
+            int imageSize = data.remaining();
+            GLES10.glCompressedTexImage2D(target, level, ETC1.ETC1_RGB8_OES, width, height,
+                    border, imageSize, data);
+        } else {
+            boolean useShorts = fallbackType != GLES10.GL_UNSIGNED_BYTE;
+            int pixelSize = useShorts ? 2 : 3;
+            int stride = pixelSize * width;
+            ByteBuffer decodedData = ByteBuffer.allocateDirect(stride*height)
+                .order(ByteOrder.nativeOrder());
+            ETC1.decodeImage(data, decodedData, width, height, pixelSize, stride);
+            GLES10.glTexImage2D(target, level, fallbackFormat, width, height, border,
+                    fallbackFormat, fallbackType, decodedData);
+        }
+    }
+
+    /**
+     * Check if ETC1 texture compression is supported by the active OpenGL ES context.
+     * @return true if the active OpenGL ES context supports ETC1 texture compression.
+     */
+    public static boolean isETC1Supported() {
+        int[] results = new int[20];
+        GLES10.glGetIntegerv(GLES10.GL_NUM_COMPRESSED_TEXTURE_FORMATS, results, 0);
+        int numFormats = results[0];
+        if (numFormats > results.length) {
+            results = new int[numFormats];
+        }
+        GLES10.glGetIntegerv(GLES10.GL_COMPRESSED_TEXTURE_FORMATS, results, 0);
+        for (int i = 0; i < numFormats; i++) {
+            if (results[i] == ETC1.ETC1_RGB8_OES) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * A utility class encapsulating a compressed ETC1 texture.
+     */
+    public static class ETC1Texture {
+        public ETC1Texture(int width, int height, ByteBuffer data) {
+            mWidth = width;
+            mHeight = height;
+            mData = data;
+        }
+
+        /**
+         * Get the width of the texture in pixels.
+         * @return the width of the texture in pixels.
+         */
+        public int getWidth() { return mWidth; }
+
+        /**
+         * Get the height of the texture in pixels.
+         * @return the width of the texture in pixels.
+         */
+        public int getHeight() { return mHeight; }
+
+        /**
+         * Get the compressed data of the texture.
+         * @return the texture data.
+         */
+        public ByteBuffer getData() { return mData; }
+
+        private int mWidth;
+        private int mHeight;
+        private ByteBuffer mData;
+    }
+
+    /**
+     * Create a new ETC1Texture from an input stream containing a PKM formatted compressed texture.
+     * @param input an input stream containing a PKM formatted compressed texture.
+     * @return an ETC1Texture read from the input stream.
+     * @throws IOException
+     */
+    public static ETC1Texture createTexture(InputStream input) throws IOException {
+        int width = 0;
+        int height = 0;
+        byte[] ioBuffer = new byte[4096];
+        {
+            if (input.read(ioBuffer, 0, ETC1.ETC_PKM_HEADER_SIZE) != ETC1.ETC_PKM_HEADER_SIZE) {
+                throw new IOException("Unable to read PKM file header.");
+            }
+            ByteBuffer headerBuffer = ByteBuffer.allocateDirect(ETC1.ETC_PKM_HEADER_SIZE)
+                .order(ByteOrder.nativeOrder());
+            headerBuffer.put(ioBuffer, 0, ETC1.ETC_PKM_HEADER_SIZE).position(0);
+            if (!ETC1.isValid(headerBuffer)) {
+                throw new IOException("Not a PKM file.");
+            }
+            width = ETC1.getWidth(headerBuffer);
+            height = ETC1.getHeight(headerBuffer);
+        }
+        int encodedSize = ETC1.getEncodedDataSize(width, height);
+        ByteBuffer dataBuffer = ByteBuffer.allocateDirect(encodedSize).order(ByteOrder.nativeOrder());
+        for (int i = 0; i < encodedSize; ) {
+            int chunkSize = Math.min(ioBuffer.length, encodedSize - i);
+            if (input.read(ioBuffer, 0, chunkSize) != chunkSize) {
+                throw new IOException("Unable to read PKM file data.");
+            }
+            dataBuffer.put(ioBuffer, 0, chunkSize);
+            i += chunkSize;
+        }
+        dataBuffer.position(0);
+        return new ETC1Texture(width, height, dataBuffer);
+    }
+
+    /**
+     * Helper function that compresses an image into an ETC1Texture.
+     * @param input a native order direct buffer containing the image data
+     * @param width the width of the image in pixels
+     * @param height the height of the image in pixels
+     * @param pixelSize the size of a pixel in bytes (2 or 3)
+     * @param stride the width of a line of the image in bytes
+     * @return the ETC1 texture.
+     */
+    public static ETC1Texture compressTexture(Buffer input, int width, int height, int pixelSize, int stride){
+        int encodedImageSize = ETC1.getEncodedDataSize(width, height);
+        ByteBuffer compressedImage = ByteBuffer.allocateDirect(encodedImageSize).
+            order(ByteOrder.nativeOrder());
+        ETC1.encodeImage(input, width, height, pixelSize, stride, compressedImage);
+        return new ETC1Texture(width, height, compressedImage);
+    }
+
+    /**
+     * Helper function that writes an ETC1Texture to an output stream formatted as a PKM file.
+     * @param texture the input texture.
+     * @param output the stream to write the formatted texture data to.
+     * @throws IOException
+     */
+    public static void writeTexture(ETC1Texture texture, OutputStream output) throws IOException {
+        ByteBuffer dataBuffer = texture.getData();
+        int originalPosition = dataBuffer.position();
+        try {
+            int width = texture.getWidth();
+            int height = texture.getHeight();
+            ByteBuffer header = ByteBuffer.allocateDirect(ETC1.ETC_PKM_HEADER_SIZE).order(ByteOrder.nativeOrder());
+            ETC1.formatHeader(header, width, height);
+            byte[] ioBuffer = new byte[4096];
+            header.get(ioBuffer, 0, ETC1.ETC_PKM_HEADER_SIZE);
+            output.write(ioBuffer, 0, ETC1.ETC_PKM_HEADER_SIZE);
+            int encodedSize = ETC1.getEncodedDataSize(width, height);
+            for (int i = 0; i < encodedSize; ) {
+                int chunkSize = Math.min(ioBuffer.length, encodedSize - i);
+                dataBuffer.get(ioBuffer, 0, chunkSize);
+                output.write(ioBuffer, 0, chunkSize);
+                i += chunkSize;
+            }
+        } finally {
+            dataBuffer.position(originalPosition);
+        }
+    }
+}
diff --git a/android/opengl/GLDebugHelper.java b/android/opengl/GLDebugHelper.java
new file mode 100644
index 0000000..18a1e73
--- /dev/null
+++ b/android/opengl/GLDebugHelper.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.opengl;
+
+import java.io.Writer;
+
+import javax.microedition.khronos.egl.EGL;
+import javax.microedition.khronos.opengles.GL;
+
+/**
+ * A helper class for debugging OpenGL ES applications.
+ *
+ * Wraps the supplied GL interface with a new GL interface that adds support for
+ * error checking and logging.
+ *
+ */
+public class GLDebugHelper {
+
+    /**
+     * Wrap an existing GL interface in a new GL interface that adds support for
+     * error checking and/or logging.
+     * <p>
+     * Wrapping means that the GL instance that is passed in to this method is
+     * wrapped inside a new GL instance that optionally performs additional
+     * operations before and after calling the wrapped GL instance.
+     * <p>
+     * Error checking means that the wrapper will automatically call
+     * glError after each GL operation,
+     * and throw a GLException if an error occurs. (By design, calling glError
+     * itself will not cause an exception to be thrown.) Enabling error checking
+     * is an alternative to manually calling glError after every GL operation.
+     * <p>
+     * Logging means writing a text representation of each GL method call to
+     * a log.
+     * <p>
+     * @param gl the existing GL interface. Must implement GL and GL10. May
+     * optionally implement GL11 as well.
+     * @param configFlags A bitmask of error checking flags.
+     * @param log - null to disable logging, non-null to enable logging.
+     * @return the wrapped GL instance.
+     */
+
+    /**
+     * Check glError() after every call.
+     */
+    public static final int CONFIG_CHECK_GL_ERROR = (1 << 0);
+
+    /**
+     * Check if all calls are on the same thread.
+     */
+    public static final int CONFIG_CHECK_THREAD = (1 << 1);
+
+    /**
+     * Print argument names when logging GL Calls.
+     */
+    public static final int CONFIG_LOG_ARGUMENT_NAMES = (1 << 2);
+
+    /**
+     * The Error number used in the GLException that is thrown if
+     * CONFIG_CHECK_THREAD is enabled and you call OpenGL ES on the
+     * a different thread.
+     */
+    public static final int ERROR_WRONG_THREAD = 0x7000;
+
+    public static GL wrap(GL gl, int configFlags, Writer log) {
+        if ( configFlags != 0 ) {
+            gl = new GLErrorWrapper(gl, configFlags);
+        }
+        if ( log != null ) {
+            boolean logArgumentNames =
+                (CONFIG_LOG_ARGUMENT_NAMES & configFlags) != 0;
+            gl = new GLLogWrapper(gl, log, logArgumentNames);
+        }
+        return gl;
+    }
+
+    /**
+     * Wrap an existing EGL interface in a new EGL interface that adds
+     * support for error checking and/or logging.
+     * @param egl the existing GL interface. Must implement EGL and EGL10. May
+     * optionally implement EGL11 as well.
+     * @param configFlags A bitmask of error checking flags.
+     * @param log - null to disable logging, non-null to enable logging.
+     * @return the wrapped EGL interface.
+     */
+    public static EGL wrap(EGL egl, int configFlags, Writer log) {
+        if (log != null) {
+            egl = new EGLLogWrapper(egl, configFlags, log);
+        }
+        return egl;
+    }
+}
+
diff --git a/android/opengl/GLES10.java b/android/opengl/GLES10.java
new file mode 100644
index 0000000..fed84d5
--- /dev/null
+++ b/android/opengl/GLES10.java
@@ -0,0 +1,1325 @@
+/*
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+package android.opengl;
+
+import java.nio.Buffer;
+
+public class GLES10 {
+    public static final int GL_ADD                                   = 0x0104;
+    public static final int GL_ALIASED_LINE_WIDTH_RANGE              = 0x846E;
+    public static final int GL_ALIASED_POINT_SIZE_RANGE              = 0x846D;
+    public static final int GL_ALPHA                                 = 0x1906;
+    public static final int GL_ALPHA_BITS                            = 0x0D55;
+    public static final int GL_ALPHA_TEST                            = 0x0BC0;
+    public static final int GL_ALWAYS                                = 0x0207;
+    public static final int GL_AMBIENT                               = 0x1200;
+    public static final int GL_AMBIENT_AND_DIFFUSE                   = 0x1602;
+    public static final int GL_AND                                   = 0x1501;
+    public static final int GL_AND_INVERTED                          = 0x1504;
+    public static final int GL_AND_REVERSE                           = 0x1502;
+    public static final int GL_BACK                                  = 0x0405;
+    public static final int GL_BLEND                                 = 0x0BE2;
+    public static final int GL_BLUE_BITS                             = 0x0D54;
+    public static final int GL_BYTE                                  = 0x1400;
+    public static final int GL_CCW                                   = 0x0901;
+    public static final int GL_CLAMP_TO_EDGE                         = 0x812F;
+    public static final int GL_CLEAR                                 = 0x1500;
+    public static final int GL_COLOR_ARRAY                           = 0x8076;
+    public static final int GL_COLOR_BUFFER_BIT                      = 0x4000;
+    public static final int GL_COLOR_LOGIC_OP                        = 0x0BF2;
+    public static final int GL_COLOR_MATERIAL                        = 0x0B57;
+    public static final int GL_COMPRESSED_TEXTURE_FORMATS            = 0x86A3;
+    public static final int GL_CONSTANT_ATTENUATION                  = 0x1207;
+    public static final int GL_COPY                                  = 0x1503;
+    public static final int GL_COPY_INVERTED                         = 0x150C;
+    public static final int GL_CULL_FACE                             = 0x0B44;
+    public static final int GL_CW                                    = 0x0900;
+    public static final int GL_DECAL                                 = 0x2101;
+    public static final int GL_DECR                                  = 0x1E03;
+    public static final int GL_DEPTH_BITS                            = 0x0D56;
+    public static final int GL_DEPTH_BUFFER_BIT                      = 0x0100;
+    public static final int GL_DEPTH_TEST                            = 0x0B71;
+    public static final int GL_DIFFUSE                               = 0x1201;
+    public static final int GL_DITHER                                = 0x0BD0;
+    public static final int GL_DONT_CARE                             = 0x1100;
+    public static final int GL_DST_ALPHA                             = 0x0304;
+    public static final int GL_DST_COLOR                             = 0x0306;
+    public static final int GL_EMISSION                              = 0x1600;
+    public static final int GL_EQUAL                                 = 0x0202;
+    public static final int GL_EQUIV                                 = 0x1509;
+    public static final int GL_EXP                                   = 0x0800;
+    public static final int GL_EXP2                                  = 0x0801;
+    public static final int GL_EXTENSIONS                            = 0x1F03;
+    public static final int GL_FALSE                                 = 0;
+    public static final int GL_FASTEST                               = 0x1101;
+    public static final int GL_FIXED                                 = 0x140C;
+    public static final int GL_FLAT                                  = 0x1D00;
+    public static final int GL_FLOAT                                 = 0x1406;
+    public static final int GL_FOG                                   = 0x0B60;
+    public static final int GL_FOG_COLOR                             = 0x0B66;
+    public static final int GL_FOG_DENSITY                           = 0x0B62;
+    public static final int GL_FOG_END                               = 0x0B64;
+    public static final int GL_FOG_HINT                              = 0x0C54;
+    public static final int GL_FOG_MODE                              = 0x0B65;
+    public static final int GL_FOG_START                             = 0x0B63;
+    public static final int GL_FRONT                                 = 0x0404;
+    public static final int GL_FRONT_AND_BACK                        = 0x0408;
+    public static final int GL_GEQUAL                                = 0x0206;
+    public static final int GL_GREATER                               = 0x0204;
+    public static final int GL_GREEN_BITS                            = 0x0D53;
+    public static final int GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES  = 0x8B9B;
+    public static final int GL_IMPLEMENTATION_COLOR_READ_TYPE_OES    = 0x8B9A;
+    public static final int GL_INCR                                  = 0x1E02;
+    public static final int GL_INVALID_ENUM                          = 0x0500;
+    public static final int GL_INVALID_OPERATION                     = 0x0502;
+    public static final int GL_INVALID_VALUE                         = 0x0501;
+    public static final int GL_INVERT                                = 0x150A;
+    public static final int GL_KEEP                                  = 0x1E00;
+    public static final int GL_LEQUAL                                = 0x0203;
+    public static final int GL_LESS                                  = 0x0201;
+    public static final int GL_LIGHT_MODEL_AMBIENT                   = 0x0B53;
+    public static final int GL_LIGHT_MODEL_TWO_SIDE                  = 0x0B52;
+    public static final int GL_LIGHT0                                = 0x4000;
+    public static final int GL_LIGHT1                                = 0x4001;
+    public static final int GL_LIGHT2                                = 0x4002;
+    public static final int GL_LIGHT3                                = 0x4003;
+    public static final int GL_LIGHT4                                = 0x4004;
+    public static final int GL_LIGHT5                                = 0x4005;
+    public static final int GL_LIGHT6                                = 0x4006;
+    public static final int GL_LIGHT7                                = 0x4007;
+    public static final int GL_LIGHTING                              = 0x0B50;
+    public static final int GL_LINE_LOOP                             = 0x0002;
+    public static final int GL_LINE_SMOOTH                           = 0x0B20;
+    public static final int GL_LINE_SMOOTH_HINT                      = 0x0C52;
+    public static final int GL_LINE_STRIP                            = 0x0003;
+    public static final int GL_LINEAR                                = 0x2601;
+    public static final int GL_LINEAR_ATTENUATION                    = 0x1208;
+    public static final int GL_LINEAR_MIPMAP_LINEAR                  = 0x2703;
+    public static final int GL_LINEAR_MIPMAP_NEAREST                 = 0x2701;
+    public static final int GL_LINES                                 = 0x0001;
+    public static final int GL_LUMINANCE                             = 0x1909;
+    public static final int GL_LUMINANCE_ALPHA                       = 0x190A;
+    public static final int GL_MAX_ELEMENTS_INDICES                  = 0x80E9;
+    public static final int GL_MAX_ELEMENTS_VERTICES                 = 0x80E8;
+    public static final int GL_MAX_LIGHTS                            = 0x0D31;
+    public static final int GL_MAX_MODELVIEW_STACK_DEPTH             = 0x0D36;
+    public static final int GL_MAX_PROJECTION_STACK_DEPTH            = 0x0D38;
+    public static final int GL_MAX_TEXTURE_SIZE                      = 0x0D33;
+    public static final int GL_MAX_TEXTURE_STACK_DEPTH               = 0x0D39;
+    public static final int GL_MAX_TEXTURE_UNITS                     = 0x84E2;
+    public static final int GL_MAX_VIEWPORT_DIMS                     = 0x0D3A;
+    public static final int GL_MODELVIEW                             = 0x1700;
+    public static final int GL_MODULATE                              = 0x2100;
+    public static final int GL_MULTISAMPLE                           = 0x809D;
+    public static final int GL_NAND                                  = 0x150E;
+    public static final int GL_NEAREST                               = 0x2600;
+    public static final int GL_NEAREST_MIPMAP_LINEAR                 = 0x2702;
+    public static final int GL_NEAREST_MIPMAP_NEAREST                = 0x2700;
+    public static final int GL_NEVER                                 = 0x0200;
+    public static final int GL_NICEST                                = 0x1102;
+    public static final int GL_NO_ERROR                              = 0;
+    public static final int GL_NOOP                                  = 0x1505;
+    public static final int GL_NOR                                   = 0x1508;
+    public static final int GL_NORMAL_ARRAY                          = 0x8075;
+    public static final int GL_NORMALIZE                             = 0x0BA1;
+    public static final int GL_NOTEQUAL                              = 0x0205;
+    public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS        = 0x86A2;
+    public static final int GL_ONE                                   = 1;
+    public static final int GL_ONE_MINUS_DST_ALPHA                   = 0x0305;
+    public static final int GL_ONE_MINUS_DST_COLOR                   = 0x0307;
+    public static final int GL_ONE_MINUS_SRC_ALPHA                   = 0x0303;
+    public static final int GL_ONE_MINUS_SRC_COLOR                   = 0x0301;
+    public static final int GL_OR                                    = 0x1507;
+    public static final int GL_OR_INVERTED                           = 0x150D;
+    public static final int GL_OR_REVERSE                            = 0x150B;
+    public static final int GL_OUT_OF_MEMORY                         = 0x0505;
+    public static final int GL_PACK_ALIGNMENT                        = 0x0D05;
+    public static final int GL_PALETTE4_R5_G6_B5_OES                 = 0x8B92;
+    public static final int GL_PALETTE4_RGB5_A1_OES                  = 0x8B94;
+    public static final int GL_PALETTE4_RGB8_OES                     = 0x8B90;
+    public static final int GL_PALETTE4_RGBA4_OES                    = 0x8B93;
+    public static final int GL_PALETTE4_RGBA8_OES                    = 0x8B91;
+    public static final int GL_PALETTE8_R5_G6_B5_OES                 = 0x8B97;
+    public static final int GL_PALETTE8_RGB5_A1_OES                  = 0x8B99;
+    public static final int GL_PALETTE8_RGB8_OES                     = 0x8B95;
+    public static final int GL_PALETTE8_RGBA4_OES                    = 0x8B98;
+    public static final int GL_PALETTE8_RGBA8_OES                    = 0x8B96;
+    public static final int GL_PERSPECTIVE_CORRECTION_HINT           = 0x0C50;
+    public static final int GL_POINT_SMOOTH                          = 0x0B10;
+    public static final int GL_POINT_SMOOTH_HINT                     = 0x0C51;
+    public static final int GL_POINTS                                = 0x0000;
+    public static final int GL_POINT_FADE_THRESHOLD_SIZE             = 0x8128;
+    public static final int GL_POINT_SIZE                            = 0x0B11;
+    public static final int GL_POLYGON_OFFSET_FILL                   = 0x8037;
+    public static final int GL_POLYGON_SMOOTH_HINT                   = 0x0C53;
+    public static final int GL_POSITION                              = 0x1203;
+    public static final int GL_PROJECTION                            = 0x1701;
+    public static final int GL_QUADRATIC_ATTENUATION                 = 0x1209;
+    public static final int GL_RED_BITS                              = 0x0D52;
+    public static final int GL_RENDERER                              = 0x1F01;
+    public static final int GL_REPEAT                                = 0x2901;
+    public static final int GL_REPLACE                               = 0x1E01;
+    public static final int GL_RESCALE_NORMAL                        = 0x803A;
+    public static final int GL_RGB                                   = 0x1907;
+    public static final int GL_RGBA                                  = 0x1908;
+    public static final int GL_SAMPLE_ALPHA_TO_COVERAGE              = 0x809E;
+    public static final int GL_SAMPLE_ALPHA_TO_ONE                   = 0x809F;
+    public static final int GL_SAMPLE_COVERAGE                       = 0x80A0;
+    public static final int GL_SCISSOR_TEST                          = 0x0C11;
+    public static final int GL_SET                                   = 0x150F;
+    public static final int GL_SHININESS                             = 0x1601;
+    public static final int GL_SHORT                                 = 0x1402;
+    public static final int GL_SMOOTH                                = 0x1D01;
+    public static final int GL_SMOOTH_LINE_WIDTH_RANGE               = 0x0B22;
+    public static final int GL_SMOOTH_POINT_SIZE_RANGE               = 0x0B12;
+    public static final int GL_SPECULAR                              = 0x1202;
+    public static final int GL_SPOT_CUTOFF                           = 0x1206;
+    public static final int GL_SPOT_DIRECTION                        = 0x1204;
+    public static final int GL_SPOT_EXPONENT                         = 0x1205;
+    public static final int GL_SRC_ALPHA                             = 0x0302;
+    public static final int GL_SRC_ALPHA_SATURATE                    = 0x0308;
+    public static final int GL_SRC_COLOR                             = 0x0300;
+    public static final int GL_STACK_OVERFLOW                        = 0x0503;
+    public static final int GL_STACK_UNDERFLOW                       = 0x0504;
+    public static final int GL_STENCIL_BITS                          = 0x0D57;
+    public static final int GL_STENCIL_BUFFER_BIT                    = 0x0400;
+    public static final int GL_STENCIL_TEST                          = 0x0B90;
+    public static final int GL_SUBPIXEL_BITS                         = 0x0D50;
+    public static final int GL_TEXTURE                               = 0x1702;
+    public static final int GL_TEXTURE_2D                            = 0x0DE1;
+    public static final int GL_TEXTURE_COORD_ARRAY                   = 0x8078;
+    public static final int GL_TEXTURE_ENV                           = 0x2300;
+    public static final int GL_TEXTURE_ENV_COLOR                     = 0x2201;
+    public static final int GL_TEXTURE_ENV_MODE                      = 0x2200;
+    public static final int GL_TEXTURE_MAG_FILTER                    = 0x2800;
+    public static final int GL_TEXTURE_MIN_FILTER                    = 0x2801;
+    public static final int GL_TEXTURE_WRAP_S                        = 0x2802;
+    public static final int GL_TEXTURE_WRAP_T                        = 0x2803;
+    public static final int GL_TEXTURE0                              = 0x84C0;
+    public static final int GL_TEXTURE1                              = 0x84C1;
+    public static final int GL_TEXTURE2                              = 0x84C2;
+    public static final int GL_TEXTURE3                              = 0x84C3;
+    public static final int GL_TEXTURE4                              = 0x84C4;
+    public static final int GL_TEXTURE5                              = 0x84C5;
+    public static final int GL_TEXTURE6                              = 0x84C6;
+    public static final int GL_TEXTURE7                              = 0x84C7;
+    public static final int GL_TEXTURE8                              = 0x84C8;
+    public static final int GL_TEXTURE9                              = 0x84C9;
+    public static final int GL_TEXTURE10                             = 0x84CA;
+    public static final int GL_TEXTURE11                             = 0x84CB;
+    public static final int GL_TEXTURE12                             = 0x84CC;
+    public static final int GL_TEXTURE13                             = 0x84CD;
+    public static final int GL_TEXTURE14                             = 0x84CE;
+    public static final int GL_TEXTURE15                             = 0x84CF;
+    public static final int GL_TEXTURE16                             = 0x84D0;
+    public static final int GL_TEXTURE17                             = 0x84D1;
+    public static final int GL_TEXTURE18                             = 0x84D2;
+    public static final int GL_TEXTURE19                             = 0x84D3;
+    public static final int GL_TEXTURE20                             = 0x84D4;
+    public static final int GL_TEXTURE21                             = 0x84D5;
+    public static final int GL_TEXTURE22                             = 0x84D6;
+    public static final int GL_TEXTURE23                             = 0x84D7;
+    public static final int GL_TEXTURE24                             = 0x84D8;
+    public static final int GL_TEXTURE25                             = 0x84D9;
+    public static final int GL_TEXTURE26                             = 0x84DA;
+    public static final int GL_TEXTURE27                             = 0x84DB;
+    public static final int GL_TEXTURE28                             = 0x84DC;
+    public static final int GL_TEXTURE29                             = 0x84DD;
+    public static final int GL_TEXTURE30                             = 0x84DE;
+    public static final int GL_TEXTURE31                             = 0x84DF;
+    public static final int GL_TRIANGLE_FAN                          = 0x0006;
+    public static final int GL_TRIANGLE_STRIP                        = 0x0005;
+    public static final int GL_TRIANGLES                             = 0x0004;
+    public static final int GL_TRUE                                  = 1;
+    public static final int GL_UNPACK_ALIGNMENT                      = 0x0CF5;
+    public static final int GL_UNSIGNED_BYTE                         = 0x1401;
+    public static final int GL_UNSIGNED_SHORT                        = 0x1403;
+    public static final int GL_UNSIGNED_SHORT_4_4_4_4                = 0x8033;
+    public static final int GL_UNSIGNED_SHORT_5_5_5_1                = 0x8034;
+    public static final int GL_UNSIGNED_SHORT_5_6_5                  = 0x8363;
+    public static final int GL_VENDOR                                = 0x1F00;
+    public static final int GL_VERSION                               = 0x1F02;
+    public static final int GL_VERTEX_ARRAY                          = 0x8074;
+    public static final int GL_XOR                                   = 0x1506;
+    public static final int GL_ZERO                                  = 0;
+
+    native private static void _nativeClassInit();
+    static {
+        _nativeClassInit();
+    }
+
+    private static Buffer _colorPointer;
+    private static Buffer _normalPointer;
+    private static Buffer _texCoordPointer;
+    private static Buffer _vertexPointer;
+
+    // C function void glActiveTexture ( GLenum texture )
+
+    public static native void glActiveTexture(
+        int texture
+    );
+
+    // C function void glAlphaFunc ( GLenum func, GLclampf ref )
+
+    public static native void glAlphaFunc(
+        int func,
+        float ref
+    );
+
+    // C function void glAlphaFuncx ( GLenum func, GLclampx ref )
+
+    public static native void glAlphaFuncx(
+        int func,
+        int ref
+    );
+
+    // C function void glBindTexture ( GLenum target, GLuint texture )
+
+    public static native void glBindTexture(
+        int target,
+        int texture
+    );
+
+    // C function void glBlendFunc ( GLenum sfactor, GLenum dfactor )
+
+    public static native void glBlendFunc(
+        int sfactor,
+        int dfactor
+    );
+
+    // C function void glClear ( GLbitfield mask )
+
+    public static native void glClear(
+        int mask
+    );
+
+    // C function void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
+
+    public static native void glClearColor(
+        float red,
+        float green,
+        float blue,
+        float alpha
+    );
+
+    // C function void glClearColorx ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha )
+
+    public static native void glClearColorx(
+        int red,
+        int green,
+        int blue,
+        int alpha
+    );
+
+    // C function void glClearDepthf ( GLclampf depth )
+
+    public static native void glClearDepthf(
+        float depth
+    );
+
+    // C function void glClearDepthx ( GLclampx depth )
+
+    public static native void glClearDepthx(
+        int depth
+    );
+
+    // C function void glClearStencil ( GLint s )
+
+    public static native void glClearStencil(
+        int s
+    );
+
+    // C function void glClientActiveTexture ( GLenum texture )
+
+    public static native void glClientActiveTexture(
+        int texture
+    );
+
+    // C function void glColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
+
+    public static native void glColor4f(
+        float red,
+        float green,
+        float blue,
+        float alpha
+    );
+
+    // C function void glColor4x ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha )
+
+    public static native void glColor4x(
+        int red,
+        int green,
+        int blue,
+        int alpha
+    );
+
+    // C function void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha )
+
+    public static native void glColorMask(
+        boolean red,
+        boolean green,
+        boolean blue,
+        boolean alpha
+    );
+
+    // C function void glColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+
+    private static native void glColorPointerBounds(
+        int size,
+        int type,
+        int stride,
+        java.nio.Buffer pointer,
+        int remaining
+    );
+
+    public static void glColorPointer(
+        int size,
+        int type,
+        int stride,
+        java.nio.Buffer pointer
+    ) {
+        glColorPointerBounds(
+            size,
+            type,
+            stride,
+            pointer,
+            pointer.remaining()
+        );
+        if ((size == 4) &&
+            ((type == GL_FLOAT) ||
+             (type == GL_UNSIGNED_BYTE) ||
+             (type == GL_FIXED)) &&
+            (stride >= 0)) {
+            _colorPointer = pointer;
+        }
+    }
+
+    // C function void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data )
+
+    public static native void glCompressedTexImage2D(
+        int target,
+        int level,
+        int internalformat,
+        int width,
+        int height,
+        int border,
+        int imageSize,
+        java.nio.Buffer data
+    );
+
+    // C function void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data )
+
+    public static native void glCompressedTexSubImage2D(
+        int target,
+        int level,
+        int xoffset,
+        int yoffset,
+        int width,
+        int height,
+        int format,
+        int imageSize,
+        java.nio.Buffer data
+    );
+
+    // C function void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border )
+
+    public static native void glCopyTexImage2D(
+        int target,
+        int level,
+        int internalformat,
+        int x,
+        int y,
+        int width,
+        int height,
+        int border
+    );
+
+    // C function void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height )
+
+    public static native void glCopyTexSubImage2D(
+        int target,
+        int level,
+        int xoffset,
+        int yoffset,
+        int x,
+        int y,
+        int width,
+        int height
+    );
+
+    // C function void glCullFace ( GLenum mode )
+
+    public static native void glCullFace(
+        int mode
+    );
+
+    // C function void glDeleteTextures ( GLsizei n, const GLuint *textures )
+
+    public static native void glDeleteTextures(
+        int n,
+        int[] textures,
+        int offset
+    );
+
+    // C function void glDeleteTextures ( GLsizei n, const GLuint *textures )
+
+    public static native void glDeleteTextures(
+        int n,
+        java.nio.IntBuffer textures
+    );
+
+    // C function void glDepthFunc ( GLenum func )
+
+    public static native void glDepthFunc(
+        int func
+    );
+
+    // C function void glDepthMask ( GLboolean flag )
+
+    public static native void glDepthMask(
+        boolean flag
+    );
+
+    // C function void glDepthRangef ( GLclampf zNear, GLclampf zFar )
+
+    public static native void glDepthRangef(
+        float zNear,
+        float zFar
+    );
+
+    // C function void glDepthRangex ( GLclampx zNear, GLclampx zFar )
+
+    public static native void glDepthRangex(
+        int zNear,
+        int zFar
+    );
+
+    // C function void glDisable ( GLenum cap )
+
+    public static native void glDisable(
+        int cap
+    );
+
+    // C function void glDisableClientState ( GLenum array )
+
+    public static native void glDisableClientState(
+        int array
+    );
+
+    // C function void glDrawArrays ( GLenum mode, GLint first, GLsizei count )
+
+    public static native void glDrawArrays(
+        int mode,
+        int first,
+        int count
+    );
+
+    // C function void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices )
+
+    public static native void glDrawElements(
+        int mode,
+        int count,
+        int type,
+        java.nio.Buffer indices
+    );
+
+    // C function void glEnable ( GLenum cap )
+
+    public static native void glEnable(
+        int cap
+    );
+
+    // C function void glEnableClientState ( GLenum array )
+
+    public static native void glEnableClientState(
+        int array
+    );
+
+    // C function void glFinish ( void )
+
+    public static native void glFinish(
+    );
+
+    // C function void glFlush ( void )
+
+    public static native void glFlush(
+    );
+
+    // C function void glFogf ( GLenum pname, GLfloat param )
+
+    public static native void glFogf(
+        int pname,
+        float param
+    );
+
+    // C function void glFogfv ( GLenum pname, const GLfloat *params )
+
+    public static native void glFogfv(
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glFogfv ( GLenum pname, const GLfloat *params )
+
+    public static native void glFogfv(
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glFogx ( GLenum pname, GLfixed param )
+
+    public static native void glFogx(
+        int pname,
+        int param
+    );
+
+    // C function void glFogxv ( GLenum pname, const GLfixed *params )
+
+    public static native void glFogxv(
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glFogxv ( GLenum pname, const GLfixed *params )
+
+    public static native void glFogxv(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glFrontFace ( GLenum mode )
+
+    public static native void glFrontFace(
+        int mode
+    );
+
+    // C function void glFrustumf ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
+
+    public static native void glFrustumf(
+        float left,
+        float right,
+        float bottom,
+        float top,
+        float zNear,
+        float zFar
+    );
+
+    // C function void glFrustumx ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
+
+    public static native void glFrustumx(
+        int left,
+        int right,
+        int bottom,
+        int top,
+        int zNear,
+        int zFar
+    );
+
+    // C function void glGenTextures ( GLsizei n, GLuint *textures )
+
+    public static native void glGenTextures(
+        int n,
+        int[] textures,
+        int offset
+    );
+
+    // C function void glGenTextures ( GLsizei n, GLuint *textures )
+
+    public static native void glGenTextures(
+        int n,
+        java.nio.IntBuffer textures
+    );
+
+    // C function GLenum glGetError ( void )
+
+    public static native int glGetError(
+    );
+
+    // C function void glGetIntegerv ( GLenum pname, GLint *params )
+
+    public static native void glGetIntegerv(
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetIntegerv ( GLenum pname, GLint *params )
+
+    public static native void glGetIntegerv(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function const GLubyte * glGetString ( GLenum name )
+
+    public static native String glGetString(
+        int name
+    );
+    // C function void glHint ( GLenum target, GLenum mode )
+
+    public static native void glHint(
+        int target,
+        int mode
+    );
+
+    // C function void glLightModelf ( GLenum pname, GLfloat param )
+
+    public static native void glLightModelf(
+        int pname,
+        float param
+    );
+
+    // C function void glLightModelfv ( GLenum pname, const GLfloat *params )
+
+    public static native void glLightModelfv(
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glLightModelfv ( GLenum pname, const GLfloat *params )
+
+    public static native void glLightModelfv(
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glLightModelx ( GLenum pname, GLfixed param )
+
+    public static native void glLightModelx(
+        int pname,
+        int param
+    );
+
+    // C function void glLightModelxv ( GLenum pname, const GLfixed *params )
+
+    public static native void glLightModelxv(
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glLightModelxv ( GLenum pname, const GLfixed *params )
+
+    public static native void glLightModelxv(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glLightf ( GLenum light, GLenum pname, GLfloat param )
+
+    public static native void glLightf(
+        int light,
+        int pname,
+        float param
+    );
+
+    // C function void glLightfv ( GLenum light, GLenum pname, const GLfloat *params )
+
+    public static native void glLightfv(
+        int light,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glLightfv ( GLenum light, GLenum pname, const GLfloat *params )
+
+    public static native void glLightfv(
+        int light,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glLightx ( GLenum light, GLenum pname, GLfixed param )
+
+    public static native void glLightx(
+        int light,
+        int pname,
+        int param
+    );
+
+    // C function void glLightxv ( GLenum light, GLenum pname, const GLfixed *params )
+
+    public static native void glLightxv(
+        int light,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glLightxv ( GLenum light, GLenum pname, const GLfixed *params )
+
+    public static native void glLightxv(
+        int light,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glLineWidth ( GLfloat width )
+
+    public static native void glLineWidth(
+        float width
+    );
+
+    // C function void glLineWidthx ( GLfixed width )
+
+    public static native void glLineWidthx(
+        int width
+    );
+
+    // C function void glLoadIdentity ( void )
+
+    public static native void glLoadIdentity(
+    );
+
+    // C function void glLoadMatrixf ( const GLfloat *m )
+
+    public static native void glLoadMatrixf(
+        float[] m,
+        int offset
+    );
+
+    // C function void glLoadMatrixf ( const GLfloat *m )
+
+    public static native void glLoadMatrixf(
+        java.nio.FloatBuffer m
+    );
+
+    // C function void glLoadMatrixx ( const GLfixed *m )
+
+    public static native void glLoadMatrixx(
+        int[] m,
+        int offset
+    );
+
+    // C function void glLoadMatrixx ( const GLfixed *m )
+
+    public static native void glLoadMatrixx(
+        java.nio.IntBuffer m
+    );
+
+    // C function void glLogicOp ( GLenum opcode )
+
+    public static native void glLogicOp(
+        int opcode
+    );
+
+    // C function void glMaterialf ( GLenum face, GLenum pname, GLfloat param )
+
+    public static native void glMaterialf(
+        int face,
+        int pname,
+        float param
+    );
+
+    // C function void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params )
+
+    public static native void glMaterialfv(
+        int face,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params )
+
+    public static native void glMaterialfv(
+        int face,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glMaterialx ( GLenum face, GLenum pname, GLfixed param )
+
+    public static native void glMaterialx(
+        int face,
+        int pname,
+        int param
+    );
+
+    // C function void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params )
+
+    public static native void glMaterialxv(
+        int face,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params )
+
+    public static native void glMaterialxv(
+        int face,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glMatrixMode ( GLenum mode )
+
+    public static native void glMatrixMode(
+        int mode
+    );
+
+    // C function void glMultMatrixf ( const GLfloat *m )
+
+    public static native void glMultMatrixf(
+        float[] m,
+        int offset
+    );
+
+    // C function void glMultMatrixf ( const GLfloat *m )
+
+    public static native void glMultMatrixf(
+        java.nio.FloatBuffer m
+    );
+
+    // C function void glMultMatrixx ( const GLfixed *m )
+
+    public static native void glMultMatrixx(
+        int[] m,
+        int offset
+    );
+
+    // C function void glMultMatrixx ( const GLfixed *m )
+
+    public static native void glMultMatrixx(
+        java.nio.IntBuffer m
+    );
+
+    // C function void glMultiTexCoord4f ( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q )
+
+    public static native void glMultiTexCoord4f(
+        int target,
+        float s,
+        float t,
+        float r,
+        float q
+    );
+
+    // C function void glMultiTexCoord4x ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q )
+
+    public static native void glMultiTexCoord4x(
+        int target,
+        int s,
+        int t,
+        int r,
+        int q
+    );
+
+    // C function void glNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz )
+
+    public static native void glNormal3f(
+        float nx,
+        float ny,
+        float nz
+    );
+
+    // C function void glNormal3x ( GLfixed nx, GLfixed ny, GLfixed nz )
+
+    public static native void glNormal3x(
+        int nx,
+        int ny,
+        int nz
+    );
+
+    // C function void glNormalPointer ( GLenum type, GLsizei stride, const GLvoid *pointer )
+
+    private static native void glNormalPointerBounds(
+        int type,
+        int stride,
+        java.nio.Buffer pointer,
+        int remaining
+    );
+
+    public static void glNormalPointer(
+        int type,
+        int stride,
+        java.nio.Buffer pointer
+    ) {
+        glNormalPointerBounds(
+            type,
+            stride,
+            pointer,
+            pointer.remaining()
+        );
+        if (((type == GL_FLOAT) ||
+             (type == GL_BYTE) ||
+             (type == GL_SHORT) ||
+             (type == GL_FIXED)) &&
+            (stride >= 0)) {
+            _normalPointer = pointer;
+        }
+    }
+
+    // C function void glOrthof ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
+
+    public static native void glOrthof(
+        float left,
+        float right,
+        float bottom,
+        float top,
+        float zNear,
+        float zFar
+    );
+
+    // C function void glOrthox ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
+
+    public static native void glOrthox(
+        int left,
+        int right,
+        int bottom,
+        int top,
+        int zNear,
+        int zFar
+    );
+
+    // C function void glPixelStorei ( GLenum pname, GLint param )
+
+    public static native void glPixelStorei(
+        int pname,
+        int param
+    );
+
+    // C function void glPointSize ( GLfloat size )
+
+    public static native void glPointSize(
+        float size
+    );
+
+    // C function void glPointSizex ( GLfixed size )
+
+    public static native void glPointSizex(
+        int size
+    );
+
+    // C function void glPolygonOffset ( GLfloat factor, GLfloat units )
+
+    public static native void glPolygonOffset(
+        float factor,
+        float units
+    );
+
+    // C function void glPolygonOffsetx ( GLfixed factor, GLfixed units )
+
+    public static native void glPolygonOffsetx(
+        int factor,
+        int units
+    );
+
+    // C function void glPopMatrix ( void )
+
+    public static native void glPopMatrix(
+    );
+
+    // C function void glPushMatrix ( void )
+
+    public static native void glPushMatrix(
+    );
+
+    // C function void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels )
+
+    public static native void glReadPixels(
+        int x,
+        int y,
+        int width,
+        int height,
+        int format,
+        int type,
+        java.nio.Buffer pixels
+    );
+
+    // C function void glRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z )
+
+    public static native void glRotatef(
+        float angle,
+        float x,
+        float y,
+        float z
+    );
+
+    // C function void glRotatex ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z )
+
+    public static native void glRotatex(
+        int angle,
+        int x,
+        int y,
+        int z
+    );
+
+    // C function void glSampleCoverage ( GLclampf value, GLboolean invert )
+
+    public static native void glSampleCoverage(
+        float value,
+        boolean invert
+    );
+
+    // C function void glSampleCoveragex ( GLclampx value, GLboolean invert )
+
+    public static native void glSampleCoveragex(
+        int value,
+        boolean invert
+    );
+
+    // C function void glScalef ( GLfloat x, GLfloat y, GLfloat z )
+
+    public static native void glScalef(
+        float x,
+        float y,
+        float z
+    );
+
+    // C function void glScalex ( GLfixed x, GLfixed y, GLfixed z )
+
+    public static native void glScalex(
+        int x,
+        int y,
+        int z
+    );
+
+    // C function void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height )
+
+    public static native void glScissor(
+        int x,
+        int y,
+        int width,
+        int height
+    );
+
+    // C function void glShadeModel ( GLenum mode )
+
+    public static native void glShadeModel(
+        int mode
+    );
+
+    // C function void glStencilFunc ( GLenum func, GLint ref, GLuint mask )
+
+    public static native void glStencilFunc(
+        int func,
+        int ref,
+        int mask
+    );
+
+    // C function void glStencilMask ( GLuint mask )
+
+    public static native void glStencilMask(
+        int mask
+    );
+
+    // C function void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass )
+
+    public static native void glStencilOp(
+        int fail,
+        int zfail,
+        int zpass
+    );
+
+    // C function void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+
+    private static native void glTexCoordPointerBounds(
+        int size,
+        int type,
+        int stride,
+        java.nio.Buffer pointer,
+        int remaining
+    );
+
+    public static void glTexCoordPointer(
+        int size,
+        int type,
+        int stride,
+        java.nio.Buffer pointer
+    ) {
+        glTexCoordPointerBounds(
+            size,
+            type,
+            stride,
+            pointer,
+            pointer.remaining()
+        );
+        if (((size == 2) ||
+             (size == 3) ||
+             (size == 4)) &&
+            ((type == GL_FLOAT) ||
+             (type == GL_BYTE) ||
+             (type == GL_SHORT) ||
+             (type == GL_FIXED)) &&
+            (stride >= 0)) {
+            _texCoordPointer = pointer;
+        }
+    }
+
+    // C function void glTexEnvf ( GLenum target, GLenum pname, GLfloat param )
+
+    public static native void glTexEnvf(
+        int target,
+        int pname,
+        float param
+    );
+
+    // C function void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params )
+
+    public static native void glTexEnvfv(
+        int target,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params )
+
+    public static native void glTexEnvfv(
+        int target,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glTexEnvx ( GLenum target, GLenum pname, GLfixed param )
+
+    public static native void glTexEnvx(
+        int target,
+        int pname,
+        int param
+    );
+
+    // C function void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params )
+
+    public static native void glTexEnvxv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params )
+
+    public static native void glTexEnvxv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
+
+    public static native void glTexImage2D(
+        int target,
+        int level,
+        int internalformat,
+        int width,
+        int height,
+        int border,
+        int format,
+        int type,
+        java.nio.Buffer pixels
+    );
+
+    // C function void glTexParameterf ( GLenum target, GLenum pname, GLfloat param )
+
+    public static native void glTexParameterf(
+        int target,
+        int pname,
+        float param
+    );
+
+    // C function void glTexParameterx ( GLenum target, GLenum pname, GLfixed param )
+
+    public static native void glTexParameterx(
+        int target,
+        int pname,
+        int param
+    );
+
+    // C function void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels )
+
+    public static native void glTexSubImage2D(
+        int target,
+        int level,
+        int xoffset,
+        int yoffset,
+        int width,
+        int height,
+        int format,
+        int type,
+        java.nio.Buffer pixels
+    );
+
+    // C function void glTranslatef ( GLfloat x, GLfloat y, GLfloat z )
+
+    public static native void glTranslatef(
+        float x,
+        float y,
+        float z
+    );
+
+    // C function void glTranslatex ( GLfixed x, GLfixed y, GLfixed z )
+
+    public static native void glTranslatex(
+        int x,
+        int y,
+        int z
+    );
+
+    // C function void glVertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+
+    private static native void glVertexPointerBounds(
+        int size,
+        int type,
+        int stride,
+        java.nio.Buffer pointer,
+        int remaining
+    );
+
+    public static void glVertexPointer(
+        int size,
+        int type,
+        int stride,
+        java.nio.Buffer pointer
+    ) {
+        glVertexPointerBounds(
+            size,
+            type,
+            stride,
+            pointer,
+            pointer.remaining()
+        );
+        if (((size == 2) ||
+             (size == 3) ||
+             (size == 4)) &&
+            ((type == GL_FLOAT) ||
+             (type == GL_BYTE) ||
+             (type == GL_SHORT) ||
+             (type == GL_FIXED)) &&
+            (stride >= 0)) {
+            _vertexPointer = pointer;
+        }
+    }
+
+    // C function void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height )
+
+    public static native void glViewport(
+        int x,
+        int y,
+        int width,
+        int height
+    );
+
+}
diff --git a/android/opengl/GLES10Ext.java b/android/opengl/GLES10Ext.java
new file mode 100644
index 0000000..3dc26eb
--- /dev/null
+++ b/android/opengl/GLES10Ext.java
@@ -0,0 +1,44 @@
+/*
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and 
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+package android.opengl;
+
+public class GLES10Ext {
+    native private static void _nativeClassInit();
+    static {
+        _nativeClassInit();
+    }
+    
+    // C function GLbitfield glQueryMatrixxOES ( GLfixed *mantissa, GLint *exponent )
+
+    public static native int glQueryMatrixxOES(
+        int[] mantissa,
+        int mantissaOffset,
+        int[] exponent,
+        int exponentOffset
+    );
+
+    // C function GLbitfield glQueryMatrixxOES ( GLfixed *mantissa, GLint *exponent )
+
+    public static native int glQueryMatrixxOES(
+        java.nio.IntBuffer mantissa,
+        java.nio.IntBuffer exponent
+    );
+
+}
diff --git a/android/opengl/GLES11.java b/android/opengl/GLES11.java
new file mode 100644
index 0000000..bb69bba
--- /dev/null
+++ b/android/opengl/GLES11.java
@@ -0,0 +1,727 @@
+/*
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+package android.opengl;
+
+import java.nio.Buffer;
+
+public class GLES11 extends GLES10 {
+    public static final int GL_ACTIVE_TEXTURE                          = 0x84E0;
+    public static final int GL_ADD_SIGNED                              = 0x8574;
+    public static final int GL_ALPHA_SCALE                             = 0x0D1C;
+    public static final int GL_ALPHA_TEST_FUNC                         = 0x0BC1;
+    public static final int GL_ALPHA_TEST_REF                          = 0x0BC2;
+    public static final int GL_ARRAY_BUFFER                            = 0x8892;
+    public static final int GL_ARRAY_BUFFER_BINDING                    = 0x8894;
+    public static final int GL_BLEND_DST                               = 0x0BE0;
+    public static final int GL_BLEND_SRC                               = 0x0BE1;
+    public static final int GL_BUFFER_ACCESS                           = 0x88BB;
+    public static final int GL_BUFFER_SIZE                             = 0x8764;
+    public static final int GL_BUFFER_USAGE                            = 0x8765;
+    public static final int GL_CLIENT_ACTIVE_TEXTURE                   = 0x84E1;
+    public static final int GL_CLIP_PLANE0                             = 0x3000;
+    public static final int GL_CLIP_PLANE1                             = 0x3001;
+    public static final int GL_CLIP_PLANE2                             = 0x3002;
+    public static final int GL_CLIP_PLANE3                             = 0x3003;
+    public static final int GL_CLIP_PLANE4                             = 0x3004;
+    public static final int GL_CLIP_PLANE5                             = 0x3005;
+    public static final int GL_COLOR_ARRAY_BUFFER_BINDING              = 0x8898;
+    public static final int GL_COLOR_ARRAY_POINTER                     = 0x8090;
+    public static final int GL_COLOR_ARRAY_SIZE                        = 0x8081;
+    public static final int GL_COLOR_ARRAY_STRIDE                      = 0x8083;
+    public static final int GL_COLOR_ARRAY_TYPE                        = 0x8082;
+    public static final int GL_COLOR_CLEAR_VALUE                       = 0x0C22;
+    public static final int GL_COLOR_WRITEMASK                         = 0x0C23;
+    public static final int GL_COMBINE                                 = 0x8570;
+    public static final int GL_COMBINE_ALPHA                           = 0x8572;
+    public static final int GL_COMBINE_RGB                             = 0x8571;
+    public static final int GL_CONSTANT                                = 0x8576;
+    public static final int GL_COORD_REPLACE_OES                       = 0x8862;
+    public static final int GL_CULL_FACE_MODE                          = 0x0B45;
+    public static final int GL_CURRENT_COLOR                           = 0x0B00;
+    public static final int GL_CURRENT_NORMAL                          = 0x0B02;
+    public static final int GL_CURRENT_TEXTURE_COORDS                  = 0x0B03;
+    public static final int GL_DEPTH_CLEAR_VALUE                       = 0x0B73;
+    public static final int GL_DEPTH_FUNC                              = 0x0B74;
+    public static final int GL_DEPTH_RANGE                             = 0x0B70;
+    public static final int GL_DEPTH_WRITEMASK                         = 0x0B72;
+    public static final int GL_DOT3_RGB                                = 0x86AE;
+    public static final int GL_DOT3_RGBA                               = 0x86AF;
+    public static final int GL_DYNAMIC_DRAW                            = 0x88E8;
+    public static final int GL_ELEMENT_ARRAY_BUFFER                    = 0x8893;
+    public static final int GL_ELEMENT_ARRAY_BUFFER_BINDING            = 0x8895;
+    public static final int GL_FRONT_FACE                              = 0x0B46;
+    public static final int GL_GENERATE_MIPMAP                         = 0x8191;
+    public static final int GL_GENERATE_MIPMAP_HINT                    = 0x8192;
+    public static final int GL_INTERPOLATE                             = 0x8575;
+    public static final int GL_LINE_WIDTH                              = 0x0B21;
+    public static final int GL_LOGIC_OP_MODE                           = 0x0BF0;
+    public static final int GL_MATRIX_MODE                             = 0x0BA0;
+    public static final int GL_MAX_CLIP_PLANES                         = 0x0D32;
+    public static final int GL_MODELVIEW_MATRIX                        = 0x0BA6;
+    public static final int GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES  = 0x898D;
+    public static final int GL_MODELVIEW_STACK_DEPTH                   = 0x0BA3;
+    public static final int GL_NORMAL_ARRAY_BUFFER_BINDING             = 0x8897;
+    public static final int GL_NORMAL_ARRAY_POINTER                    = 0x808F;
+    public static final int GL_NORMAL_ARRAY_STRIDE                     = 0x807F;
+    public static final int GL_NORMAL_ARRAY_TYPE                       = 0x807E;
+    public static final int GL_OPERAND0_ALPHA                          = 0x8598;
+    public static final int GL_OPERAND0_RGB                            = 0x8590;
+    public static final int GL_OPERAND1_ALPHA                          = 0x8599;
+    public static final int GL_OPERAND1_RGB                            = 0x8591;
+    public static final int GL_OPERAND2_ALPHA                          = 0x859A;
+    public static final int GL_OPERAND2_RGB                            = 0x8592;
+    public static final int GL_POINT_DISTANCE_ATTENUATION              = 0x8129;
+    public static final int GL_POINT_FADE_THRESHOLD_SIZE               = 0x8128;
+    public static final int GL_POINT_SIZE                              = 0x0B11;
+    public static final int GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES     = 0x8B9F;
+    public static final int GL_POINT_SIZE_ARRAY_OES                    = 0x8B9C;
+    public static final int GL_POINT_SIZE_ARRAY_POINTER_OES            = 0x898C;
+    public static final int GL_POINT_SIZE_ARRAY_STRIDE_OES             = 0x898B;
+    public static final int GL_POINT_SIZE_ARRAY_TYPE_OES               = 0x898A;
+    public static final int GL_POINT_SIZE_MAX                          = 0x8127;
+    public static final int GL_POINT_SIZE_MIN                          = 0x8126;
+    public static final int GL_POINT_SPRITE_OES                        = 0x8861;
+    public static final int GL_POLYGON_OFFSET_FACTOR                   = 0x8038;
+    public static final int GL_POLYGON_OFFSET_UNITS                    = 0x2A00;
+    public static final int GL_PREVIOUS                                = 0x8578;
+    public static final int GL_PRIMARY_COLOR                           = 0x8577;
+    public static final int GL_PROJECTION_MATRIX                       = 0x0BA7;
+    public static final int GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898E;
+    public static final int GL_PROJECTION_STACK_DEPTH                  = 0x0BA4;
+    public static final int GL_RGB_SCALE                               = 0x8573;
+    public static final int GL_SAMPLE_BUFFERS                          = 0x80A8;
+    public static final int GL_SAMPLE_COVERAGE_INVERT                  = 0x80AB;
+    public static final int GL_SAMPLE_COVERAGE_VALUE                   = 0x80AA;
+    public static final int GL_SAMPLES                                 = 0x80A9;
+    public static final int GL_SCISSOR_BOX                             = 0x0C10;
+    public static final int GL_SHADE_MODEL                             = 0x0B54;
+    public static final int GL_SRC0_ALPHA                              = 0x8588;
+    public static final int GL_SRC0_RGB                                = 0x8580;
+    public static final int GL_SRC1_ALPHA                              = 0x8589;
+    public static final int GL_SRC1_RGB                                = 0x8581;
+    public static final int GL_SRC2_ALPHA                              = 0x858A;
+    public static final int GL_SRC2_RGB                                = 0x8582;
+    public static final int GL_STATIC_DRAW                             = 0x88E4;
+    public static final int GL_STENCIL_CLEAR_VALUE                     = 0x0B91;
+    public static final int GL_STENCIL_FAIL                            = 0x0B94;
+    public static final int GL_STENCIL_FUNC                            = 0x0B92;
+    public static final int GL_STENCIL_PASS_DEPTH_FAIL                 = 0x0B95;
+    public static final int GL_STENCIL_PASS_DEPTH_PASS                 = 0x0B96;
+    public static final int GL_STENCIL_REF                             = 0x0B97;
+    public static final int GL_STENCIL_VALUE_MASK                      = 0x0B93;
+    public static final int GL_STENCIL_WRITEMASK                       = 0x0B98;
+    public static final int GL_SUBTRACT                                = 0x84E7;
+    public static final int GL_TEXTURE_BINDING_2D                      = 0x8069;
+    public static final int GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING      = 0x889A;
+    public static final int GL_TEXTURE_COORD_ARRAY_POINTER             = 0x8092;
+    public static final int GL_TEXTURE_COORD_ARRAY_SIZE                = 0x8088;
+    public static final int GL_TEXTURE_COORD_ARRAY_STRIDE              = 0x808A;
+    public static final int GL_TEXTURE_COORD_ARRAY_TYPE                = 0x8089;
+    public static final int GL_TEXTURE_MATRIX                          = 0x0BA8;
+    public static final int GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES    = 0x898F;
+    public static final int GL_TEXTURE_STACK_DEPTH                     = 0x0BA5;
+    public static final int GL_VERTEX_ARRAY_BUFFER_BINDING             = 0x8896;
+    public static final int GL_VERTEX_ARRAY_POINTER                    = 0x808E;
+    public static final int GL_VERTEX_ARRAY_SIZE                       = 0x807A;
+    public static final int GL_VERTEX_ARRAY_STRIDE                     = 0x807C;
+    public static final int GL_VERTEX_ARRAY_TYPE                       = 0x807B;
+    public static final int GL_VIEWPORT                                = 0x0BA2;
+    public static final int GL_WRITE_ONLY                              = 0x88B9;
+
+    native private static void _nativeClassInit();
+    static {
+        _nativeClassInit();
+    }
+
+    private static Buffer _pointSizePointerOES;
+    // C function void glBindBuffer ( GLenum target, GLuint buffer )
+
+    public static native void glBindBuffer(
+        int target,
+        int buffer
+    );
+
+    // C function void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage )
+
+    public static native void glBufferData(
+        int target,
+        int size,
+        java.nio.Buffer data,
+        int usage
+    );
+
+    // C function void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data )
+
+    public static native void glBufferSubData(
+        int target,
+        int offset,
+        int size,
+        java.nio.Buffer data
+    );
+
+    // C function void glClipPlanef ( GLenum plane, const GLfloat *equation )
+
+    public static native void glClipPlanef(
+        int plane,
+        float[] equation,
+        int offset
+    );
+
+    // C function void glClipPlanef ( GLenum plane, const GLfloat *equation )
+
+    public static native void glClipPlanef(
+        int plane,
+        java.nio.FloatBuffer equation
+    );
+
+    // C function void glClipPlanex ( GLenum plane, const GLfixed *equation )
+
+    public static native void glClipPlanex(
+        int plane,
+        int[] equation,
+        int offset
+    );
+
+    // C function void glClipPlanex ( GLenum plane, const GLfixed *equation )
+
+    public static native void glClipPlanex(
+        int plane,
+        java.nio.IntBuffer equation
+    );
+
+    // C function void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha )
+
+    public static native void glColor4ub(
+        byte red,
+        byte green,
+        byte blue,
+        byte alpha
+    );
+
+    // C function void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )
+
+    public static native void glColorPointer(
+        int size,
+        int type,
+        int stride,
+        int offset
+    );
+
+    // C function void glDeleteBuffers ( GLsizei n, const GLuint *buffers )
+
+    public static native void glDeleteBuffers(
+        int n,
+        int[] buffers,
+        int offset
+    );
+
+    // C function void glDeleteBuffers ( GLsizei n, const GLuint *buffers )
+
+    public static native void glDeleteBuffers(
+        int n,
+        java.nio.IntBuffer buffers
+    );
+
+    // C function void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset )
+
+    public static native void glDrawElements(
+        int mode,
+        int count,
+        int type,
+        int offset
+    );
+
+    // C function void glGenBuffers ( GLsizei n, GLuint *buffers )
+
+    public static native void glGenBuffers(
+        int n,
+        int[] buffers,
+        int offset
+    );
+
+    // C function void glGenBuffers ( GLsizei n, GLuint *buffers )
+
+    public static native void glGenBuffers(
+        int n,
+        java.nio.IntBuffer buffers
+    );
+
+    // C function void glGetBooleanv ( GLenum pname, GLboolean *params )
+
+    public static native void glGetBooleanv(
+        int pname,
+        boolean[] params,
+        int offset
+    );
+
+    // C function void glGetBooleanv ( GLenum pname, GLboolean *params )
+
+    public static native void glGetBooleanv(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetBufferParameteriv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetBufferParameteriv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetClipPlanef ( GLenum pname, GLfloat *eqn )
+
+    public static native void glGetClipPlanef(
+        int pname,
+        float[] eqn,
+        int offset
+    );
+
+    // C function void glGetClipPlanef ( GLenum pname, GLfloat *eqn )
+
+    public static native void glGetClipPlanef(
+        int pname,
+        java.nio.FloatBuffer eqn
+    );
+
+    // C function void glGetClipPlanex ( GLenum pname, GLfixed *eqn )
+
+    public static native void glGetClipPlanex(
+        int pname,
+        int[] eqn,
+        int offset
+    );
+
+    // C function void glGetClipPlanex ( GLenum pname, GLfixed *eqn )
+
+    public static native void glGetClipPlanex(
+        int pname,
+        java.nio.IntBuffer eqn
+    );
+
+    // C function void glGetFixedv ( GLenum pname, GLfixed *params )
+
+    public static native void glGetFixedv(
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetFixedv ( GLenum pname, GLfixed *params )
+
+    public static native void glGetFixedv(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetFloatv ( GLenum pname, GLfloat *params )
+
+    public static native void glGetFloatv(
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glGetFloatv ( GLenum pname, GLfloat *params )
+
+    public static native void glGetFloatv(
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params )
+
+    public static native void glGetLightfv(
+        int light,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params )
+
+    public static native void glGetLightfv(
+        int light,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params )
+
+    public static native void glGetLightxv(
+        int light,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params )
+
+    public static native void glGetLightxv(
+        int light,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params )
+
+    public static native void glGetMaterialfv(
+        int face,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params )
+
+    public static native void glGetMaterialfv(
+        int face,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params )
+
+    public static native void glGetMaterialxv(
+        int face,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params )
+
+    public static native void glGetMaterialxv(
+        int face,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params )
+
+    public static native void glGetTexEnvfv(
+        int env,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params )
+
+    public static native void glGetTexEnvfv(
+        int env,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params )
+
+    public static native void glGetTexEnviv(
+        int env,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params )
+
+    public static native void glGetTexEnviv(
+        int env,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params )
+
+    public static native void glGetTexEnvxv(
+        int env,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params )
+
+    public static native void glGetTexEnvxv(
+        int env,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params )
+
+    public static native void glGetTexParameterfv(
+        int target,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params )
+
+    public static native void glGetTexParameterfv(
+        int target,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetTexParameteriv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetTexParameteriv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params )
+
+    public static native void glGetTexParameterxv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params )
+
+    public static native void glGetTexParameterxv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function GLboolean glIsBuffer ( GLuint buffer )
+
+    public static native boolean glIsBuffer(
+        int buffer
+    );
+
+    // C function GLboolean glIsEnabled ( GLenum cap )
+
+    public static native boolean glIsEnabled(
+        int cap
+    );
+
+    // C function GLboolean glIsTexture ( GLuint texture )
+
+    public static native boolean glIsTexture(
+        int texture
+    );
+
+    // C function void glNormalPointer ( GLenum type, GLsizei stride, GLint offset )
+
+    public static native void glNormalPointer(
+        int type,
+        int stride,
+        int offset
+    );
+
+    // C function void glPointParameterf ( GLenum pname, GLfloat param )
+
+    public static native void glPointParameterf(
+        int pname,
+        float param
+    );
+
+    // C function void glPointParameterfv ( GLenum pname, const GLfloat *params )
+
+    public static native void glPointParameterfv(
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glPointParameterfv ( GLenum pname, const GLfloat *params )
+
+    public static native void glPointParameterfv(
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glPointParameterx ( GLenum pname, GLfixed param )
+
+    public static native void glPointParameterx(
+        int pname,
+        int param
+    );
+
+    // C function void glPointParameterxv ( GLenum pname, const GLfixed *params )
+
+    public static native void glPointParameterxv(
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glPointParameterxv ( GLenum pname, const GLfixed *params )
+
+    public static native void glPointParameterxv(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer )
+
+    private static native void glPointSizePointerOESBounds(
+        int type,
+        int stride,
+        java.nio.Buffer pointer,
+        int remaining
+    );
+
+    public static void glPointSizePointerOES(
+        int type,
+        int stride,
+        java.nio.Buffer pointer
+    ) {
+        glPointSizePointerOESBounds(
+            type,
+            stride,
+            pointer,
+            pointer.remaining()
+        );
+        if (((type == GL_FLOAT) ||
+             (type == GL_FIXED)) &&
+            (stride >= 0)) {
+            _pointSizePointerOES = pointer;
+        }
+    }
+
+    // C function void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )
+
+    public static native void glTexCoordPointer(
+        int size,
+        int type,
+        int stride,
+        int offset
+    );
+
+    // C function void glTexEnvi ( GLenum target, GLenum pname, GLint param )
+
+    public static native void glTexEnvi(
+        int target,
+        int pname,
+        int param
+    );
+
+    // C function void glTexEnviv ( GLenum target, GLenum pname, const GLint *params )
+
+    public static native void glTexEnviv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glTexEnviv ( GLenum target, GLenum pname, const GLint *params )
+
+    public static native void glTexEnviv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params )
+
+    public static native void glTexParameterfv(
+        int target,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params )
+
+    public static native void glTexParameterfv(
+        int target,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glTexParameteri ( GLenum target, GLenum pname, GLint param )
+
+    public static native void glTexParameteri(
+        int target,
+        int pname,
+        int param
+    );
+
+    // C function void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params )
+
+    public static native void glTexParameteriv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params )
+
+    public static native void glTexParameteriv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params )
+
+    public static native void glTexParameterxv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params )
+
+    public static native void glTexParameterxv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )
+
+    public static native void glVertexPointer(
+        int size,
+        int type,
+        int stride,
+        int offset
+    );
+
+}
diff --git a/android/opengl/GLES11Ext.java b/android/opengl/GLES11Ext.java
new file mode 100644
index 0000000..04d1b5d
--- /dev/null
+++ b/android/opengl/GLES11Ext.java
@@ -0,0 +1,1130 @@
+/*
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and 
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+package android.opengl;
+
+import java.nio.Buffer;
+
+public class GLES11Ext {
+    public static final int GL_BLEND_EQUATION_RGB_OES                               = 0x8009;
+    public static final int GL_BLEND_EQUATION_ALPHA_OES                             = 0x883D;
+    public static final int GL_BLEND_DST_RGB_OES                                    = 0x80C8;
+    public static final int GL_BLEND_SRC_RGB_OES                                    = 0x80C9;
+    public static final int GL_BLEND_DST_ALPHA_OES                                  = 0x80CA;
+    public static final int GL_BLEND_SRC_ALPHA_OES                                  = 0x80CB;
+    public static final int GL_BLEND_EQUATION_OES                                   = 0x8009;
+    public static final int GL_FUNC_ADD_OES                                         = 0x8006;
+    public static final int GL_FUNC_SUBTRACT_OES                                    = 0x800A;
+    public static final int GL_FUNC_REVERSE_SUBTRACT_OES                            = 0x800B;
+    public static final int GL_ETC1_RGB8_OES                                        = 0x8D64;
+    public static final int GL_DEPTH_COMPONENT24_OES                                = 0x81A6;
+    public static final int GL_DEPTH_COMPONENT32_OES                                = 0x81A7;
+    public static final int GL_TEXTURE_CROP_RECT_OES                                = 0x8B9D;
+    public static final int GL_FIXED_OES                                            = 0x140C;
+    public static final int GL_NONE_OES                                             = 0;
+    public static final int GL_FRAMEBUFFER_OES                                      = 0x8D40;
+    public static final int GL_RENDERBUFFER_OES                                     = 0x8D41;
+    public static final int GL_RGBA4_OES                                            = 0x8056;
+    public static final int GL_RGB5_A1_OES                                          = 0x8057;
+    public static final int GL_RGB565_OES                                           = 0x8D62;
+    public static final int GL_DEPTH_COMPONENT16_OES                                = 0x81A5;
+    public static final int GL_RENDERBUFFER_WIDTH_OES                               = 0x8D42;
+    public static final int GL_RENDERBUFFER_HEIGHT_OES                              = 0x8D43;
+    public static final int GL_RENDERBUFFER_INTERNAL_FORMAT_OES                     = 0x8D44;
+    public static final int GL_RENDERBUFFER_RED_SIZE_OES                            = 0x8D50;
+    public static final int GL_RENDERBUFFER_GREEN_SIZE_OES                          = 0x8D51;
+    public static final int GL_RENDERBUFFER_BLUE_SIZE_OES                           = 0x8D52;
+    public static final int GL_RENDERBUFFER_ALPHA_SIZE_OES                          = 0x8D53;
+    public static final int GL_RENDERBUFFER_DEPTH_SIZE_OES                          = 0x8D54;
+    public static final int GL_RENDERBUFFER_STENCIL_SIZE_OES                        = 0x8D55;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES               = 0x8CD0;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES               = 0x8CD1;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES             = 0x8CD2;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES     = 0x8CD3;
+    public static final int GL_COLOR_ATTACHMENT0_OES                                = 0x8CE0;
+    public static final int GL_DEPTH_ATTACHMENT_OES                                 = 0x8D00;
+    public static final int GL_STENCIL_ATTACHMENT_OES                               = 0x8D20;
+    public static final int GL_FRAMEBUFFER_COMPLETE_OES                             = 0x8CD5;
+    public static final int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES                = 0x8CD6;
+    public static final int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES        = 0x8CD7;
+    public static final int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES                = 0x8CD9;
+    public static final int GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES                   = 0x8CDA;
+    public static final int GL_FRAMEBUFFER_UNSUPPORTED_OES                          = 0x8CDD;
+    public static final int GL_FRAMEBUFFER_BINDING_OES                              = 0x8CA6;
+    public static final int GL_RENDERBUFFER_BINDING_OES                             = 0x8CA7;
+    public static final int GL_MAX_RENDERBUFFER_SIZE_OES                            = 0x84E8;
+    public static final int GL_INVALID_FRAMEBUFFER_OPERATION_OES                    = 0x0506;
+    public static final int GL_WRITE_ONLY_OES                                       = 0x88B9;
+    public static final int GL_BUFFER_ACCESS_OES                                    = 0x88BB;
+    public static final int GL_BUFFER_MAPPED_OES                                    = 0x88BC;
+    public static final int GL_BUFFER_MAP_POINTER_OES                               = 0x88BD;
+    public static final int GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES               = 0x898D;
+    public static final int GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES              = 0x898E;
+    public static final int GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES                 = 0x898F;
+    public static final int GL_MAX_VERTEX_UNITS_OES                                 = 0x86A4;
+    public static final int GL_MAX_PALETTE_MATRICES_OES                             = 0x8842;
+    public static final int GL_MATRIX_PALETTE_OES                                   = 0x8840;
+    public static final int GL_MATRIX_INDEX_ARRAY_OES                               = 0x8844;
+    public static final int GL_WEIGHT_ARRAY_OES                                     = 0x86AD;
+    public static final int GL_CURRENT_PALETTE_MATRIX_OES                           = 0x8843;
+    public static final int GL_MATRIX_INDEX_ARRAY_SIZE_OES                          = 0x8846;
+    public static final int GL_MATRIX_INDEX_ARRAY_TYPE_OES                          = 0x8847;
+    public static final int GL_MATRIX_INDEX_ARRAY_STRIDE_OES                        = 0x8848;
+    public static final int GL_MATRIX_INDEX_ARRAY_POINTER_OES                       = 0x8849;
+    public static final int GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES                = 0x8B9E;
+    public static final int GL_WEIGHT_ARRAY_SIZE_OES                                = 0x86AB;
+    public static final int GL_WEIGHT_ARRAY_TYPE_OES                                = 0x86A9;
+    public static final int GL_WEIGHT_ARRAY_STRIDE_OES                              = 0x86AA;
+    public static final int GL_WEIGHT_ARRAY_POINTER_OES                             = 0x86AC;
+    public static final int GL_WEIGHT_ARRAY_BUFFER_BINDING_OES                      = 0x889E;
+    public static final int GL_DEPTH_STENCIL_OES                                    = 0x84F9;
+    public static final int GL_UNSIGNED_INT_24_8_OES                                = 0x84FA;
+    public static final int GL_DEPTH24_STENCIL8_OES                                 = 0x88F0;
+    public static final int GL_RGB8_OES                                             = 0x8051;
+    public static final int GL_RGBA8_OES                                            = 0x8058;
+    public static final int GL_STENCIL_INDEX1_OES                                   = 0x8D46;
+    public static final int GL_STENCIL_INDEX4_OES                                   = 0x8D47;
+    public static final int GL_STENCIL_INDEX8_OES                                   = 0x8D48;
+    public static final int GL_INCR_WRAP_OES                                        = 0x8507;
+    public static final int GL_DECR_WRAP_OES                                        = 0x8508;
+    public static final int GL_NORMAL_MAP_OES                                       = 0x8511;
+    public static final int GL_REFLECTION_MAP_OES                                   = 0x8512;
+    public static final int GL_TEXTURE_CUBE_MAP_OES                                 = 0x8513;
+    public static final int GL_TEXTURE_BINDING_CUBE_MAP_OES                         = 0x8514;
+    public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES                      = 0x8515;
+    public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES                      = 0x8516;
+    public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES                      = 0x8517;
+    public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES                      = 0x8518;
+    public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES                      = 0x8519;
+    public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES                      = 0x851A;
+    public static final int GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES                        = 0x851C;
+    public static final int GL_TEXTURE_GEN_MODE_OES                                 = 0x2500;
+    public static final int GL_TEXTURE_GEN_STR_OES                                  = 0x8D60;
+    public static final int GL_MIRRORED_REPEAT_OES                                  = 0x8370;
+    public static final int GL_3DC_X_AMD                                            = 0x87F9;
+    public static final int GL_3DC_XY_AMD                                           = 0x87FA;
+    public static final int GL_ATC_RGB_AMD                                          = 0x8C92;
+    public static final int GL_ATC_RGBA_EXPLICIT_ALPHA_AMD                          = 0x8C93;
+    public static final int GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD                      = 0x87EE;
+    public static final int GL_TEXTURE_MAX_ANISOTROPY_EXT                           = 0x84FE;
+    public static final int GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT                       = 0x84FF;
+    public static final int GL_BGRA                                                 = 0x80E1;
+    public static final int GL_TEXTURE_EXTERNAL_OES                                 = 0x8D65;
+    public static final int GL_SAMPLER_EXTERNAL_OES                                 = 0x8D66;
+    public static final int GL_TEXTURE_BINDING_EXTERNAL_OES                         = 0x8D67;
+    public static final int GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES                     = 0x8D68;
+
+    native private static void _nativeClassInit();
+    static {
+        _nativeClassInit();
+    }
+    
+    private static final int GL_BYTE = GLES10.GL_BYTE;
+    private static final int GL_FIXED = GLES10.GL_FIXED;
+    private static final int GL_FLOAT = GLES10.GL_FLOAT;
+    private static final int GL_SHORT = GLES10.GL_SHORT;
+    
+    private static Buffer _matrixIndexPointerOES;
+    // C function void glBlendEquationSeparateOES ( GLenum modeRGB, GLenum modeAlpha )
+
+    public static native void glBlendEquationSeparateOES(
+        int modeRGB,
+        int modeAlpha
+    );
+
+    // C function void glBlendFuncSeparateOES ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha )
+
+    public static native void glBlendFuncSeparateOES(
+        int srcRGB,
+        int dstRGB,
+        int srcAlpha,
+        int dstAlpha
+    );
+
+    // C function void glBlendEquationOES ( GLenum mode )
+
+    public static native void glBlendEquationOES(
+        int mode
+    );
+
+    // C function void glDrawTexsOES ( GLshort x, GLshort y, GLshort z, GLshort width, GLshort height )
+
+    public static native void glDrawTexsOES(
+        short x,
+        short y,
+        short z,
+        short width,
+        short height
+    );
+
+    // C function void glDrawTexiOES ( GLint x, GLint y, GLint z, GLint width, GLint height )
+
+    public static native void glDrawTexiOES(
+        int x,
+        int y,
+        int z,
+        int width,
+        int height
+    );
+
+    // C function void glDrawTexxOES ( GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height )
+
+    public static native void glDrawTexxOES(
+        int x,
+        int y,
+        int z,
+        int width,
+        int height
+    );
+
+    // C function void glDrawTexsvOES ( const GLshort *coords )
+
+    public static native void glDrawTexsvOES(
+        short[] coords,
+        int offset
+    );
+
+    // C function void glDrawTexsvOES ( const GLshort *coords )
+
+    public static native void glDrawTexsvOES(
+        java.nio.ShortBuffer coords
+    );
+
+    // C function void glDrawTexivOES ( const GLint *coords )
+
+    public static native void glDrawTexivOES(
+        int[] coords,
+        int offset
+    );
+
+    // C function void glDrawTexivOES ( const GLint *coords )
+
+    public static native void glDrawTexivOES(
+        java.nio.IntBuffer coords
+    );
+
+    // C function void glDrawTexxvOES ( const GLfixed *coords )
+
+    public static native void glDrawTexxvOES(
+        int[] coords,
+        int offset
+    );
+
+    // C function void glDrawTexxvOES ( const GLfixed *coords )
+
+    public static native void glDrawTexxvOES(
+        java.nio.IntBuffer coords
+    );
+
+    // C function void glDrawTexfOES ( GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height )
+
+    public static native void glDrawTexfOES(
+        float x,
+        float y,
+        float z,
+        float width,
+        float height
+    );
+
+    // C function void glDrawTexfvOES ( const GLfloat *coords )
+
+    public static native void glDrawTexfvOES(
+        float[] coords,
+        int offset
+    );
+
+    // C function void glDrawTexfvOES ( const GLfloat *coords )
+
+    public static native void glDrawTexfvOES(
+        java.nio.FloatBuffer coords
+    );
+
+    // C function void glEGLImageTargetTexture2DOES ( GLenum target, GLeglImageOES image )
+
+    public static native void glEGLImageTargetTexture2DOES(
+        int target,
+        java.nio.Buffer image
+    );
+
+    // C function void glEGLImageTargetRenderbufferStorageOES ( GLenum target, GLeglImageOES image )
+
+    public static native void glEGLImageTargetRenderbufferStorageOES(
+        int target,
+        java.nio.Buffer image
+    );
+
+    // C function void glAlphaFuncxOES ( GLenum func, GLclampx ref )
+
+    public static native void glAlphaFuncxOES(
+        int func,
+        int ref
+    );
+
+    // C function void glClearColorxOES ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha )
+
+    public static native void glClearColorxOES(
+        int red,
+        int green,
+        int blue,
+        int alpha
+    );
+
+    // C function void glClearDepthxOES ( GLclampx depth )
+
+    public static native void glClearDepthxOES(
+        int depth
+    );
+
+    // C function void glClipPlanexOES ( GLenum plane, const GLfixed *equation )
+
+    public static native void glClipPlanexOES(
+        int plane,
+        int[] equation,
+        int offset
+    );
+
+    // C function void glClipPlanexOES ( GLenum plane, const GLfixed *equation )
+
+    public static native void glClipPlanexOES(
+        int plane,
+        java.nio.IntBuffer equation
+    );
+
+    // C function void glColor4xOES ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha )
+
+    public static native void glColor4xOES(
+        int red,
+        int green,
+        int blue,
+        int alpha
+    );
+
+    // C function void glDepthRangexOES ( GLclampx zNear, GLclampx zFar )
+
+    public static native void glDepthRangexOES(
+        int zNear,
+        int zFar
+    );
+
+    // C function void glFogxOES ( GLenum pname, GLfixed param )
+
+    public static native void glFogxOES(
+        int pname,
+        int param
+    );
+
+    // C function void glFogxvOES ( GLenum pname, const GLfixed *params )
+
+    public static native void glFogxvOES(
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glFogxvOES ( GLenum pname, const GLfixed *params )
+
+    public static native void glFogxvOES(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glFrustumxOES ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
+
+    public static native void glFrustumxOES(
+        int left,
+        int right,
+        int bottom,
+        int top,
+        int zNear,
+        int zFar
+    );
+
+    // C function void glGetClipPlanexOES ( GLenum pname, GLfixed *eqn )
+
+    public static native void glGetClipPlanexOES(
+        int pname,
+        int[] eqn,
+        int offset
+    );
+
+    // C function void glGetClipPlanexOES ( GLenum pname, GLfixed *eqn )
+
+    public static native void glGetClipPlanexOES(
+        int pname,
+        java.nio.IntBuffer eqn
+    );
+
+    // C function void glGetFixedvOES ( GLenum pname, GLfixed *params )
+
+    public static native void glGetFixedvOES(
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetFixedvOES ( GLenum pname, GLfixed *params )
+
+    public static native void glGetFixedvOES(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetLightxvOES ( GLenum light, GLenum pname, GLfixed *params )
+
+    public static native void glGetLightxvOES(
+        int light,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetLightxvOES ( GLenum light, GLenum pname, GLfixed *params )
+
+    public static native void glGetLightxvOES(
+        int light,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetMaterialxvOES ( GLenum face, GLenum pname, GLfixed *params )
+
+    public static native void glGetMaterialxvOES(
+        int face,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetMaterialxvOES ( GLenum face, GLenum pname, GLfixed *params )
+
+    public static native void glGetMaterialxvOES(
+        int face,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetTexEnvxvOES ( GLenum env, GLenum pname, GLfixed *params )
+
+    public static native void glGetTexEnvxvOES(
+        int env,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexEnvxvOES ( GLenum env, GLenum pname, GLfixed *params )
+
+    public static native void glGetTexEnvxvOES(
+        int env,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetTexParameterxvOES ( GLenum target, GLenum pname, GLfixed *params )
+
+    public static native void glGetTexParameterxvOES(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexParameterxvOES ( GLenum target, GLenum pname, GLfixed *params )
+
+    public static native void glGetTexParameterxvOES(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glLightModelxOES ( GLenum pname, GLfixed param )
+
+    public static native void glLightModelxOES(
+        int pname,
+        int param
+    );
+
+    // C function void glLightModelxvOES ( GLenum pname, const GLfixed *params )
+
+    public static native void glLightModelxvOES(
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glLightModelxvOES ( GLenum pname, const GLfixed *params )
+
+    public static native void glLightModelxvOES(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glLightxOES ( GLenum light, GLenum pname, GLfixed param )
+
+    public static native void glLightxOES(
+        int light,
+        int pname,
+        int param
+    );
+
+    // C function void glLightxvOES ( GLenum light, GLenum pname, const GLfixed *params )
+
+    public static native void glLightxvOES(
+        int light,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glLightxvOES ( GLenum light, GLenum pname, const GLfixed *params )
+
+    public static native void glLightxvOES(
+        int light,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glLineWidthxOES ( GLfixed width )
+
+    public static native void glLineWidthxOES(
+        int width
+    );
+
+    // C function void glLoadMatrixxOES ( const GLfixed *m )
+
+    public static native void glLoadMatrixxOES(
+        int[] m,
+        int offset
+    );
+
+    // C function void glLoadMatrixxOES ( const GLfixed *m )
+
+    public static native void glLoadMatrixxOES(
+        java.nio.IntBuffer m
+    );
+
+    // C function void glMaterialxOES ( GLenum face, GLenum pname, GLfixed param )
+
+    public static native void glMaterialxOES(
+        int face,
+        int pname,
+        int param
+    );
+
+    // C function void glMaterialxvOES ( GLenum face, GLenum pname, const GLfixed *params )
+
+    public static native void glMaterialxvOES(
+        int face,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glMaterialxvOES ( GLenum face, GLenum pname, const GLfixed *params )
+
+    public static native void glMaterialxvOES(
+        int face,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glMultMatrixxOES ( const GLfixed *m )
+
+    public static native void glMultMatrixxOES(
+        int[] m,
+        int offset
+    );
+
+    // C function void glMultMatrixxOES ( const GLfixed *m )
+
+    public static native void glMultMatrixxOES(
+        java.nio.IntBuffer m
+    );
+
+    // C function void glMultiTexCoord4xOES ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q )
+
+    public static native void glMultiTexCoord4xOES(
+        int target,
+        int s,
+        int t,
+        int r,
+        int q
+    );
+
+    // C function void glNormal3xOES ( GLfixed nx, GLfixed ny, GLfixed nz )
+
+    public static native void glNormal3xOES(
+        int nx,
+        int ny,
+        int nz
+    );
+
+    // C function void glOrthoxOES ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
+
+    public static native void glOrthoxOES(
+        int left,
+        int right,
+        int bottom,
+        int top,
+        int zNear,
+        int zFar
+    );
+
+    // C function void glPointParameterxOES ( GLenum pname, GLfixed param )
+
+    public static native void glPointParameterxOES(
+        int pname,
+        int param
+    );
+
+    // C function void glPointParameterxvOES ( GLenum pname, const GLfixed *params )
+
+    public static native void glPointParameterxvOES(
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glPointParameterxvOES ( GLenum pname, const GLfixed *params )
+
+    public static native void glPointParameterxvOES(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glPointSizexOES ( GLfixed size )
+
+    public static native void glPointSizexOES(
+        int size
+    );
+
+    // C function void glPolygonOffsetxOES ( GLfixed factor, GLfixed units )
+
+    public static native void glPolygonOffsetxOES(
+        int factor,
+        int units
+    );
+
+    // C function void glRotatexOES ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z )
+
+    public static native void glRotatexOES(
+        int angle,
+        int x,
+        int y,
+        int z
+    );
+
+    // C function void glSampleCoveragexOES ( GLclampx value, GLboolean invert )
+
+    public static native void glSampleCoveragexOES(
+        int value,
+        boolean invert
+    );
+
+    // C function void glScalexOES ( GLfixed x, GLfixed y, GLfixed z )
+
+    public static native void glScalexOES(
+        int x,
+        int y,
+        int z
+    );
+
+    // C function void glTexEnvxOES ( GLenum target, GLenum pname, GLfixed param )
+
+    public static native void glTexEnvxOES(
+        int target,
+        int pname,
+        int param
+    );
+
+    // C function void glTexEnvxvOES ( GLenum target, GLenum pname, const GLfixed *params )
+
+    public static native void glTexEnvxvOES(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glTexEnvxvOES ( GLenum target, GLenum pname, const GLfixed *params )
+
+    public static native void glTexEnvxvOES(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glTexParameterxOES ( GLenum target, GLenum pname, GLfixed param )
+
+    public static native void glTexParameterxOES(
+        int target,
+        int pname,
+        int param
+    );
+
+    // C function void glTexParameterxvOES ( GLenum target, GLenum pname, const GLfixed *params )
+
+    public static native void glTexParameterxvOES(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glTexParameterxvOES ( GLenum target, GLenum pname, const GLfixed *params )
+
+    public static native void glTexParameterxvOES(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glTranslatexOES ( GLfixed x, GLfixed y, GLfixed z )
+
+    public static native void glTranslatexOES(
+        int x,
+        int y,
+        int z
+    );
+
+    // C function GLboolean glIsRenderbufferOES ( GLuint renderbuffer )
+
+    public static native boolean glIsRenderbufferOES(
+        int renderbuffer
+    );
+
+    // C function void glBindRenderbufferOES ( GLenum target, GLuint renderbuffer )
+
+    public static native void glBindRenderbufferOES(
+        int target,
+        int renderbuffer
+    );
+
+    // C function void glDeleteRenderbuffersOES ( GLsizei n, const GLuint *renderbuffers )
+
+    public static native void glDeleteRenderbuffersOES(
+        int n,
+        int[] renderbuffers,
+        int offset
+    );
+
+    // C function void glDeleteRenderbuffersOES ( GLsizei n, const GLuint *renderbuffers )
+
+    public static native void glDeleteRenderbuffersOES(
+        int n,
+        java.nio.IntBuffer renderbuffers
+    );
+
+    // C function void glGenRenderbuffersOES ( GLsizei n, GLuint *renderbuffers )
+
+    public static native void glGenRenderbuffersOES(
+        int n,
+        int[] renderbuffers,
+        int offset
+    );
+
+    // C function void glGenRenderbuffersOES ( GLsizei n, GLuint *renderbuffers )
+
+    public static native void glGenRenderbuffersOES(
+        int n,
+        java.nio.IntBuffer renderbuffers
+    );
+
+    // C function void glRenderbufferStorageOES ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height )
+
+    public static native void glRenderbufferStorageOES(
+        int target,
+        int internalformat,
+        int width,
+        int height
+    );
+
+    // C function void glGetRenderbufferParameterivOES ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetRenderbufferParameterivOES(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetRenderbufferParameterivOES ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetRenderbufferParameterivOES(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function GLboolean glIsFramebufferOES ( GLuint framebuffer )
+
+    public static native boolean glIsFramebufferOES(
+        int framebuffer
+    );
+
+    // C function void glBindFramebufferOES ( GLenum target, GLuint framebuffer )
+
+    public static native void glBindFramebufferOES(
+        int target,
+        int framebuffer
+    );
+
+    // C function void glDeleteFramebuffersOES ( GLsizei n, const GLuint *framebuffers )
+
+    public static native void glDeleteFramebuffersOES(
+        int n,
+        int[] framebuffers,
+        int offset
+    );
+
+    // C function void glDeleteFramebuffersOES ( GLsizei n, const GLuint *framebuffers )
+
+    public static native void glDeleteFramebuffersOES(
+        int n,
+        java.nio.IntBuffer framebuffers
+    );
+
+    // C function void glGenFramebuffersOES ( GLsizei n, GLuint *framebuffers )
+
+    public static native void glGenFramebuffersOES(
+        int n,
+        int[] framebuffers,
+        int offset
+    );
+
+    // C function void glGenFramebuffersOES ( GLsizei n, GLuint *framebuffers )
+
+    public static native void glGenFramebuffersOES(
+        int n,
+        java.nio.IntBuffer framebuffers
+    );
+
+    // C function GLenum glCheckFramebufferStatusOES ( GLenum target )
+
+    public static native int glCheckFramebufferStatusOES(
+        int target
+    );
+
+    // C function void glFramebufferRenderbufferOES ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer )
+
+    public static native void glFramebufferRenderbufferOES(
+        int target,
+        int attachment,
+        int renderbuffertarget,
+        int renderbuffer
+    );
+
+    // C function void glFramebufferTexture2DOES ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level )
+
+    public static native void glFramebufferTexture2DOES(
+        int target,
+        int attachment,
+        int textarget,
+        int texture,
+        int level
+    );
+
+    // C function void glGetFramebufferAttachmentParameterivOES ( GLenum target, GLenum attachment, GLenum pname, GLint *params )
+
+    public static native void glGetFramebufferAttachmentParameterivOES(
+        int target,
+        int attachment,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetFramebufferAttachmentParameterivOES ( GLenum target, GLenum attachment, GLenum pname, GLint *params )
+
+    public static native void glGetFramebufferAttachmentParameterivOES(
+        int target,
+        int attachment,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGenerateMipmapOES ( GLenum target )
+
+    public static native void glGenerateMipmapOES(
+        int target
+    );
+
+    // C function void glCurrentPaletteMatrixOES ( GLuint matrixpaletteindex )
+
+    public static native void glCurrentPaletteMatrixOES(
+        int matrixpaletteindex
+    );
+
+    // C function void glLoadPaletteFromModelViewMatrixOES ( void )
+
+    public static native void glLoadPaletteFromModelViewMatrixOES(
+    );
+
+    // C function void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+
+    private static native void glMatrixIndexPointerOESBounds(
+        int size,
+        int type,
+        int stride,
+        java.nio.Buffer pointer,
+        int remaining
+    );
+
+    public static void glMatrixIndexPointerOES(
+        int size,
+        int type,
+        int stride,
+        java.nio.Buffer pointer
+    ) {
+        glMatrixIndexPointerOESBounds(
+            size,
+            type,
+            stride,
+            pointer,
+            pointer.remaining()
+        );
+        if (((size == 2) ||
+             (size == 3) ||
+             (size == 4)) &&
+            ((type == GL_FLOAT) ||
+             (type == GL_BYTE) ||
+             (type == GL_SHORT) ||
+             (type == GL_FIXED)) &&
+            (stride >= 0)) {
+            _matrixIndexPointerOES = pointer;
+        }
+    }
+
+    // C function void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+
+    private static native void glWeightPointerOESBounds(
+        int size,
+        int type,
+        int stride,
+        java.nio.Buffer pointer,
+        int remaining
+    );
+
+    public static void glWeightPointerOES(
+        int size,
+        int type,
+        int stride,
+        java.nio.Buffer pointer
+    ) {
+        glWeightPointerOESBounds(
+            size,
+            type,
+            stride,
+            pointer,
+            pointer.remaining()
+        );
+    }
+
+    // C function void glDepthRangefOES ( GLclampf zNear, GLclampf zFar )
+
+    public static native void glDepthRangefOES(
+        float zNear,
+        float zFar
+    );
+
+    // C function void glFrustumfOES ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
+
+    public static native void glFrustumfOES(
+        float left,
+        float right,
+        float bottom,
+        float top,
+        float zNear,
+        float zFar
+    );
+
+    // C function void glOrthofOES ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
+
+    public static native void glOrthofOES(
+        float left,
+        float right,
+        float bottom,
+        float top,
+        float zNear,
+        float zFar
+    );
+
+    // C function void glClipPlanefOES ( GLenum plane, const GLfloat *equation )
+
+    public static native void glClipPlanefOES(
+        int plane,
+        float[] equation,
+        int offset
+    );
+
+    // C function void glClipPlanefOES ( GLenum plane, const GLfloat *equation )
+
+    public static native void glClipPlanefOES(
+        int plane,
+        java.nio.FloatBuffer equation
+    );
+
+    // C function void glGetClipPlanefOES ( GLenum pname, GLfloat *eqn )
+
+    public static native void glGetClipPlanefOES(
+        int pname,
+        float[] eqn,
+        int offset
+    );
+
+    // C function void glGetClipPlanefOES ( GLenum pname, GLfloat *eqn )
+
+    public static native void glGetClipPlanefOES(
+        int pname,
+        java.nio.FloatBuffer eqn
+    );
+
+    // C function void glClearDepthfOES ( GLclampf depth )
+
+    public static native void glClearDepthfOES(
+        float depth
+    );
+
+    // C function void glTexGenfOES ( GLenum coord, GLenum pname, GLfloat param )
+
+    public static native void glTexGenfOES(
+        int coord,
+        int pname,
+        float param
+    );
+
+    // C function void glTexGenfvOES ( GLenum coord, GLenum pname, const GLfloat *params )
+
+    public static native void glTexGenfvOES(
+        int coord,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glTexGenfvOES ( GLenum coord, GLenum pname, const GLfloat *params )
+
+    public static native void glTexGenfvOES(
+        int coord,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glTexGeniOES ( GLenum coord, GLenum pname, GLint param )
+
+    public static native void glTexGeniOES(
+        int coord,
+        int pname,
+        int param
+    );
+
+    // C function void glTexGenivOES ( GLenum coord, GLenum pname, const GLint *params )
+
+    public static native void glTexGenivOES(
+        int coord,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glTexGenivOES ( GLenum coord, GLenum pname, const GLint *params )
+
+    public static native void glTexGenivOES(
+        int coord,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glTexGenxOES ( GLenum coord, GLenum pname, GLfixed param )
+
+    public static native void glTexGenxOES(
+        int coord,
+        int pname,
+        int param
+    );
+
+    // C function void glTexGenxvOES ( GLenum coord, GLenum pname, const GLfixed *params )
+
+    public static native void glTexGenxvOES(
+        int coord,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glTexGenxvOES ( GLenum coord, GLenum pname, const GLfixed *params )
+
+    public static native void glTexGenxvOES(
+        int coord,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetTexGenfvOES ( GLenum coord, GLenum pname, GLfloat *params )
+
+    public static native void glGetTexGenfvOES(
+        int coord,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glGetTexGenfvOES ( GLenum coord, GLenum pname, GLfloat *params )
+
+    public static native void glGetTexGenfvOES(
+        int coord,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glGetTexGenivOES ( GLenum coord, GLenum pname, GLint *params )
+
+    public static native void glGetTexGenivOES(
+        int coord,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexGenivOES ( GLenum coord, GLenum pname, GLint *params )
+
+    public static native void glGetTexGenivOES(
+        int coord,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetTexGenxvOES ( GLenum coord, GLenum pname, GLfixed *params )
+
+    public static native void glGetTexGenxvOES(
+        int coord,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexGenxvOES ( GLenum coord, GLenum pname, GLfixed *params )
+
+    public static native void glGetTexGenxvOES(
+        int coord,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+}
diff --git a/android/opengl/GLES20.java b/android/opengl/GLES20.java
new file mode 100644
index 0000000..e853e44
--- /dev/null
+++ b/android/opengl/GLES20.java
@@ -0,0 +1,1930 @@
+/*
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License"); 
+** you may not use this file except in compliance with the License. 
+** You may obtain a copy of the License at 
+**
+**     http://www.apache.org/licenses/LICENSE-2.0 
+**
+** Unless required by applicable law or agreed to in writing, software 
+** distributed under the License is distributed on an "AS IS" BASIS, 
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+** See the License for the specific language governing permissions and 
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+package android.opengl;
+
+import android.compat.annotation.UnsupportedAppUsage;
+
+/** OpenGL ES 2.0
+ */
+public class GLES20 {
+    public static final int GL_ACTIVE_TEXTURE                          = 0x84E0;
+    public static final int GL_DEPTH_BUFFER_BIT                        = 0x00000100;
+    public static final int GL_STENCIL_BUFFER_BIT                      = 0x00000400;
+    public static final int GL_COLOR_BUFFER_BIT                        = 0x00004000;
+    public static final int GL_FALSE                                   = 0;
+    public static final int GL_TRUE                                    = 1;
+    public static final int GL_POINTS                                  = 0x0000;
+    public static final int GL_LINES                                   = 0x0001;
+    public static final int GL_LINE_LOOP                               = 0x0002;
+    public static final int GL_LINE_STRIP                              = 0x0003;
+    public static final int GL_TRIANGLES                               = 0x0004;
+    public static final int GL_TRIANGLE_STRIP                          = 0x0005;
+    public static final int GL_TRIANGLE_FAN                            = 0x0006;
+    public static final int GL_ZERO                                    = 0;
+    public static final int GL_ONE                                     = 1;
+    public static final int GL_SRC_COLOR                               = 0x0300;
+    public static final int GL_ONE_MINUS_SRC_COLOR                     = 0x0301;
+    public static final int GL_SRC_ALPHA                               = 0x0302;
+    public static final int GL_ONE_MINUS_SRC_ALPHA                     = 0x0303;
+    public static final int GL_DST_ALPHA                               = 0x0304;
+    public static final int GL_ONE_MINUS_DST_ALPHA                     = 0x0305;
+    public static final int GL_DST_COLOR                               = 0x0306;
+    public static final int GL_ONE_MINUS_DST_COLOR                     = 0x0307;
+    public static final int GL_SRC_ALPHA_SATURATE                      = 0x0308;
+    public static final int GL_FUNC_ADD                                = 0x8006;
+    public static final int GL_BLEND_EQUATION                          = 0x8009;
+    public static final int GL_BLEND_EQUATION_RGB                      = 0x8009;   /* same as BLEND_EQUATION */
+    public static final int GL_BLEND_EQUATION_ALPHA                    = 0x883D;
+    public static final int GL_FUNC_SUBTRACT                           = 0x800A;
+    public static final int GL_FUNC_REVERSE_SUBTRACT                   = 0x800B;
+    public static final int GL_BLEND_DST_RGB                           = 0x80C8;
+    public static final int GL_BLEND_SRC_RGB                           = 0x80C9;
+    public static final int GL_BLEND_DST_ALPHA                         = 0x80CA;
+    public static final int GL_BLEND_SRC_ALPHA                         = 0x80CB;
+    public static final int GL_CONSTANT_COLOR                          = 0x8001;
+    public static final int GL_ONE_MINUS_CONSTANT_COLOR                = 0x8002;
+    public static final int GL_CONSTANT_ALPHA                          = 0x8003;
+    public static final int GL_ONE_MINUS_CONSTANT_ALPHA                = 0x8004;
+    public static final int GL_BLEND_COLOR                             = 0x8005;
+    public static final int GL_ARRAY_BUFFER                            = 0x8892;
+    public static final int GL_ELEMENT_ARRAY_BUFFER                    = 0x8893;
+    public static final int GL_ARRAY_BUFFER_BINDING                    = 0x8894;
+    public static final int GL_ELEMENT_ARRAY_BUFFER_BINDING            = 0x8895;
+    public static final int GL_STREAM_DRAW                             = 0x88E0;
+    public static final int GL_STATIC_DRAW                             = 0x88E4;
+    public static final int GL_DYNAMIC_DRAW                            = 0x88E8;
+    public static final int GL_BUFFER_SIZE                             = 0x8764;
+    public static final int GL_BUFFER_USAGE                            = 0x8765;
+    public static final int GL_CURRENT_VERTEX_ATTRIB                   = 0x8626;
+    public static final int GL_FRONT                                   = 0x0404;
+    public static final int GL_BACK                                    = 0x0405;
+    public static final int GL_FRONT_AND_BACK                          = 0x0408;
+    public static final int GL_TEXTURE_2D                              = 0x0DE1;
+    public static final int GL_CULL_FACE                               = 0x0B44;
+    public static final int GL_BLEND                                   = 0x0BE2;
+    public static final int GL_DITHER                                  = 0x0BD0;
+    public static final int GL_STENCIL_TEST                            = 0x0B90;
+    public static final int GL_DEPTH_TEST                              = 0x0B71;
+    public static final int GL_SCISSOR_TEST                            = 0x0C11;
+    public static final int GL_POLYGON_OFFSET_FILL                     = 0x8037;
+    public static final int GL_SAMPLE_ALPHA_TO_COVERAGE                = 0x809E;
+    public static final int GL_SAMPLE_COVERAGE                         = 0x80A0;
+    public static final int GL_NO_ERROR                                = 0;
+    public static final int GL_INVALID_ENUM                            = 0x0500;
+    public static final int GL_INVALID_VALUE                           = 0x0501;
+    public static final int GL_INVALID_OPERATION                       = 0x0502;
+    public static final int GL_OUT_OF_MEMORY                           = 0x0505;
+    public static final int GL_CW                                      = 0x0900;
+    public static final int GL_CCW                                     = 0x0901;
+    public static final int GL_LINE_WIDTH                              = 0x0B21;
+    public static final int GL_ALIASED_POINT_SIZE_RANGE                = 0x846D;
+    public static final int GL_ALIASED_LINE_WIDTH_RANGE                = 0x846E;
+    public static final int GL_CULL_FACE_MODE                          = 0x0B45;
+    public static final int GL_FRONT_FACE                              = 0x0B46;
+    public static final int GL_DEPTH_RANGE                             = 0x0B70;
+    public static final int GL_DEPTH_WRITEMASK                         = 0x0B72;
+    public static final int GL_DEPTH_CLEAR_VALUE                       = 0x0B73;
+    public static final int GL_DEPTH_FUNC                              = 0x0B74;
+    public static final int GL_STENCIL_CLEAR_VALUE                     = 0x0B91;
+    public static final int GL_STENCIL_FUNC                            = 0x0B92;
+    public static final int GL_STENCIL_FAIL                            = 0x0B94;
+    public static final int GL_STENCIL_PASS_DEPTH_FAIL                 = 0x0B95;
+    public static final int GL_STENCIL_PASS_DEPTH_PASS                 = 0x0B96;
+    public static final int GL_STENCIL_REF                             = 0x0B97;
+    public static final int GL_STENCIL_VALUE_MASK                      = 0x0B93;
+    public static final int GL_STENCIL_WRITEMASK                       = 0x0B98;
+    public static final int GL_STENCIL_BACK_FUNC                       = 0x8800;
+    public static final int GL_STENCIL_BACK_FAIL                       = 0x8801;
+    public static final int GL_STENCIL_BACK_PASS_DEPTH_FAIL            = 0x8802;
+    public static final int GL_STENCIL_BACK_PASS_DEPTH_PASS            = 0x8803;
+    public static final int GL_STENCIL_BACK_REF                        = 0x8CA3;
+    public static final int GL_STENCIL_BACK_VALUE_MASK                 = 0x8CA4;
+    public static final int GL_STENCIL_BACK_WRITEMASK                  = 0x8CA5;
+    public static final int GL_VIEWPORT                                = 0x0BA2;
+    public static final int GL_SCISSOR_BOX                             = 0x0C10;
+    public static final int GL_COLOR_CLEAR_VALUE                       = 0x0C22;
+    public static final int GL_COLOR_WRITEMASK                         = 0x0C23;
+    public static final int GL_UNPACK_ALIGNMENT                        = 0x0CF5;
+    public static final int GL_PACK_ALIGNMENT                          = 0x0D05;
+    public static final int GL_MAX_TEXTURE_SIZE                        = 0x0D33;
+    public static final int GL_MAX_VIEWPORT_DIMS                       = 0x0D3A;
+    public static final int GL_SUBPIXEL_BITS                           = 0x0D50;
+    public static final int GL_RED_BITS                                = 0x0D52;
+    public static final int GL_GREEN_BITS                              = 0x0D53;
+    public static final int GL_BLUE_BITS                               = 0x0D54;
+    public static final int GL_ALPHA_BITS                              = 0x0D55;
+    public static final int GL_DEPTH_BITS                              = 0x0D56;
+    public static final int GL_STENCIL_BITS                            = 0x0D57;
+    public static final int GL_POLYGON_OFFSET_UNITS                    = 0x2A00;
+    public static final int GL_POLYGON_OFFSET_FACTOR                   = 0x8038;
+    public static final int GL_TEXTURE_BINDING_2D                      = 0x8069;
+    public static final int GL_SAMPLE_BUFFERS                          = 0x80A8;
+    public static final int GL_SAMPLES                                 = 0x80A9;
+    public static final int GL_SAMPLE_COVERAGE_VALUE                   = 0x80AA;
+    public static final int GL_SAMPLE_COVERAGE_INVERT                  = 0x80AB;
+    public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS          = 0x86A2;
+    public static final int GL_COMPRESSED_TEXTURE_FORMATS              = 0x86A3;
+    public static final int GL_DONT_CARE                               = 0x1100;
+    public static final int GL_FASTEST                                 = 0x1101;
+    public static final int GL_NICEST                                  = 0x1102;
+    public static final int GL_GENERATE_MIPMAP_HINT                    = 0x8192;
+    public static final int GL_BYTE                                    = 0x1400;
+    public static final int GL_UNSIGNED_BYTE                           = 0x1401;
+    public static final int GL_SHORT                                   = 0x1402;
+    public static final int GL_UNSIGNED_SHORT                          = 0x1403;
+    public static final int GL_INT                                     = 0x1404;
+    public static final int GL_UNSIGNED_INT                            = 0x1405;
+    public static final int GL_FLOAT                                   = 0x1406;
+    public static final int GL_FIXED                                   = 0x140C;
+    public static final int GL_DEPTH_COMPONENT                         = 0x1902;
+    public static final int GL_ALPHA                                   = 0x1906;
+    public static final int GL_RGB                                     = 0x1907;
+    public static final int GL_RGBA                                    = 0x1908;
+    public static final int GL_LUMINANCE                               = 0x1909;
+    public static final int GL_LUMINANCE_ALPHA                         = 0x190A;
+    public static final int GL_UNSIGNED_SHORT_4_4_4_4                  = 0x8033;
+    public static final int GL_UNSIGNED_SHORT_5_5_5_1                  = 0x8034;
+    public static final int GL_UNSIGNED_SHORT_5_6_5                    = 0x8363;
+    public static final int GL_FRAGMENT_SHADER                           = 0x8B30;
+    public static final int GL_VERTEX_SHADER                             = 0x8B31;
+    public static final int GL_MAX_VERTEX_ATTRIBS                        = 0x8869;
+    public static final int GL_MAX_VERTEX_UNIFORM_VECTORS                = 0x8DFB;
+    public static final int GL_MAX_VARYING_VECTORS                       = 0x8DFC;
+    public static final int GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS          = 0x8B4D;
+    public static final int GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS            = 0x8B4C;
+    public static final int GL_MAX_TEXTURE_IMAGE_UNITS                   = 0x8872;
+    public static final int GL_MAX_FRAGMENT_UNIFORM_VECTORS              = 0x8DFD;
+    public static final int GL_SHADER_TYPE                               = 0x8B4F;
+    public static final int GL_DELETE_STATUS                             = 0x8B80;
+    public static final int GL_LINK_STATUS                               = 0x8B82;
+    public static final int GL_VALIDATE_STATUS                           = 0x8B83;
+    public static final int GL_ATTACHED_SHADERS                          = 0x8B85;
+    public static final int GL_ACTIVE_UNIFORMS                           = 0x8B86;
+    public static final int GL_ACTIVE_UNIFORM_MAX_LENGTH                 = 0x8B87;
+    public static final int GL_ACTIVE_ATTRIBUTES                         = 0x8B89;
+    public static final int GL_ACTIVE_ATTRIBUTE_MAX_LENGTH               = 0x8B8A;
+    public static final int GL_SHADING_LANGUAGE_VERSION                  = 0x8B8C;
+    public static final int GL_CURRENT_PROGRAM                           = 0x8B8D;
+    public static final int GL_NEVER                                   = 0x0200;
+    public static final int GL_LESS                                    = 0x0201;
+    public static final int GL_EQUAL                                   = 0x0202;
+    public static final int GL_LEQUAL                                  = 0x0203;
+    public static final int GL_GREATER                                 = 0x0204;
+    public static final int GL_NOTEQUAL                                = 0x0205;
+    public static final int GL_GEQUAL                                  = 0x0206;
+    public static final int GL_ALWAYS                                  = 0x0207;
+    public static final int GL_KEEP                                    = 0x1E00;
+    public static final int GL_REPLACE                                 = 0x1E01;
+    public static final int GL_INCR                                    = 0x1E02;
+    public static final int GL_DECR                                    = 0x1E03;
+    public static final int GL_INVERT                                  = 0x150A;
+    public static final int GL_INCR_WRAP                               = 0x8507;
+    public static final int GL_DECR_WRAP                               = 0x8508;
+    public static final int GL_VENDOR                                  = 0x1F00;
+    public static final int GL_RENDERER                                = 0x1F01;
+    public static final int GL_VERSION                                 = 0x1F02;
+    public static final int GL_EXTENSIONS                              = 0x1F03;
+    public static final int GL_NEAREST                                 = 0x2600;
+    public static final int GL_LINEAR                                  = 0x2601;
+    public static final int GL_NEAREST_MIPMAP_NEAREST                  = 0x2700;
+    public static final int GL_LINEAR_MIPMAP_NEAREST                   = 0x2701;
+    public static final int GL_NEAREST_MIPMAP_LINEAR                   = 0x2702;
+    public static final int GL_LINEAR_MIPMAP_LINEAR                    = 0x2703;
+    public static final int GL_TEXTURE_MAG_FILTER                      = 0x2800;
+    public static final int GL_TEXTURE_MIN_FILTER                      = 0x2801;
+    public static final int GL_TEXTURE_WRAP_S                          = 0x2802;
+    public static final int GL_TEXTURE_WRAP_T                          = 0x2803;
+    public static final int GL_TEXTURE                                 = 0x1702;
+    public static final int GL_TEXTURE_CUBE_MAP                        = 0x8513;
+    public static final int GL_TEXTURE_BINDING_CUBE_MAP                = 0x8514;
+    public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_X             = 0x8515;
+    public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_X             = 0x8516;
+    public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Y             = 0x8517;
+    public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y             = 0x8518;
+    public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Z             = 0x8519;
+    public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z             = 0x851A;
+    public static final int GL_MAX_CUBE_MAP_TEXTURE_SIZE               = 0x851C;
+    public static final int GL_TEXTURE0                                = 0x84C0;
+    public static final int GL_TEXTURE1                                = 0x84C1;
+    public static final int GL_TEXTURE2                                = 0x84C2;
+    public static final int GL_TEXTURE3                                = 0x84C3;
+    public static final int GL_TEXTURE4                                = 0x84C4;
+    public static final int GL_TEXTURE5                                = 0x84C5;
+    public static final int GL_TEXTURE6                                = 0x84C6;
+    public static final int GL_TEXTURE7                                = 0x84C7;
+    public static final int GL_TEXTURE8                                = 0x84C8;
+    public static final int GL_TEXTURE9                                = 0x84C9;
+    public static final int GL_TEXTURE10                               = 0x84CA;
+    public static final int GL_TEXTURE11                               = 0x84CB;
+    public static final int GL_TEXTURE12                               = 0x84CC;
+    public static final int GL_TEXTURE13                               = 0x84CD;
+    public static final int GL_TEXTURE14                               = 0x84CE;
+    public static final int GL_TEXTURE15                               = 0x84CF;
+    public static final int GL_TEXTURE16                               = 0x84D0;
+    public static final int GL_TEXTURE17                               = 0x84D1;
+    public static final int GL_TEXTURE18                               = 0x84D2;
+    public static final int GL_TEXTURE19                               = 0x84D3;
+    public static final int GL_TEXTURE20                               = 0x84D4;
+    public static final int GL_TEXTURE21                               = 0x84D5;
+    public static final int GL_TEXTURE22                               = 0x84D6;
+    public static final int GL_TEXTURE23                               = 0x84D7;
+    public static final int GL_TEXTURE24                               = 0x84D8;
+    public static final int GL_TEXTURE25                               = 0x84D9;
+    public static final int GL_TEXTURE26                               = 0x84DA;
+    public static final int GL_TEXTURE27                               = 0x84DB;
+    public static final int GL_TEXTURE28                               = 0x84DC;
+    public static final int GL_TEXTURE29                               = 0x84DD;
+    public static final int GL_TEXTURE30                               = 0x84DE;
+    public static final int GL_TEXTURE31                               = 0x84DF;
+    public static final int GL_REPEAT                                  = 0x2901;
+    public static final int GL_CLAMP_TO_EDGE                           = 0x812F;
+    public static final int GL_MIRRORED_REPEAT                         = 0x8370;
+    public static final int GL_FLOAT_VEC2                              = 0x8B50;
+    public static final int GL_FLOAT_VEC3                              = 0x8B51;
+    public static final int GL_FLOAT_VEC4                              = 0x8B52;
+    public static final int GL_INT_VEC2                                = 0x8B53;
+    public static final int GL_INT_VEC3                                = 0x8B54;
+    public static final int GL_INT_VEC4                                = 0x8B55;
+    public static final int GL_BOOL                                    = 0x8B56;
+    public static final int GL_BOOL_VEC2                               = 0x8B57;
+    public static final int GL_BOOL_VEC3                               = 0x8B58;
+    public static final int GL_BOOL_VEC4                               = 0x8B59;
+    public static final int GL_FLOAT_MAT2                              = 0x8B5A;
+    public static final int GL_FLOAT_MAT3                              = 0x8B5B;
+    public static final int GL_FLOAT_MAT4                              = 0x8B5C;
+    public static final int GL_SAMPLER_2D                              = 0x8B5E;
+    public static final int GL_SAMPLER_CUBE                            = 0x8B60;
+    public static final int GL_VERTEX_ATTRIB_ARRAY_ENABLED                 = 0x8622;
+    public static final int GL_VERTEX_ATTRIB_ARRAY_SIZE                    = 0x8623;
+    public static final int GL_VERTEX_ATTRIB_ARRAY_STRIDE                  = 0x8624;
+    public static final int GL_VERTEX_ATTRIB_ARRAY_TYPE                    = 0x8625;
+    public static final int GL_VERTEX_ATTRIB_ARRAY_NORMALIZED              = 0x886A;
+    public static final int GL_VERTEX_ATTRIB_ARRAY_POINTER                 = 0x8645;
+    public static final int GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING          = 0x889F;
+    public static final int GL_IMPLEMENTATION_COLOR_READ_TYPE            = 0x8B9A;
+    public static final int GL_IMPLEMENTATION_COLOR_READ_FORMAT          = 0x8B9B;
+    public static final int GL_COMPILE_STATUS                          = 0x8B81;
+    public static final int GL_INFO_LOG_LENGTH                         = 0x8B84;
+    public static final int GL_SHADER_SOURCE_LENGTH                    = 0x8B88;
+    public static final int GL_SHADER_COMPILER                         = 0x8DFA;
+    public static final int GL_SHADER_BINARY_FORMATS                   = 0x8DF8;
+    public static final int GL_NUM_SHADER_BINARY_FORMATS               = 0x8DF9;
+    public static final int GL_LOW_FLOAT                               = 0x8DF0;
+    public static final int GL_MEDIUM_FLOAT                            = 0x8DF1;
+    public static final int GL_HIGH_FLOAT                              = 0x8DF2;
+    public static final int GL_LOW_INT                                 = 0x8DF3;
+    public static final int GL_MEDIUM_INT                              = 0x8DF4;
+    public static final int GL_HIGH_INT                                = 0x8DF5;
+    public static final int GL_FRAMEBUFFER                             = 0x8D40;
+    public static final int GL_RENDERBUFFER                            = 0x8D41;
+    public static final int GL_RGBA4                                   = 0x8056;
+    public static final int GL_RGB5_A1                                 = 0x8057;
+    public static final int GL_RGB565                                  = 0x8D62;
+    public static final int GL_DEPTH_COMPONENT16                       = 0x81A5;
+    // GL_STENCIL_INDEX does not appear in gl2.h or gl2ext.h, and there is no
+    // token with value 0x1901.
+    //
+    @Deprecated
+    public static final int GL_STENCIL_INDEX                           = 0x1901;
+    public static final int GL_STENCIL_INDEX8                          = 0x8D48;
+    public static final int GL_RENDERBUFFER_WIDTH                      = 0x8D42;
+    public static final int GL_RENDERBUFFER_HEIGHT                     = 0x8D43;
+    public static final int GL_RENDERBUFFER_INTERNAL_FORMAT            = 0x8D44;
+    public static final int GL_RENDERBUFFER_RED_SIZE                   = 0x8D50;
+    public static final int GL_RENDERBUFFER_GREEN_SIZE                 = 0x8D51;
+    public static final int GL_RENDERBUFFER_BLUE_SIZE                  = 0x8D52;
+    public static final int GL_RENDERBUFFER_ALPHA_SIZE                 = 0x8D53;
+    public static final int GL_RENDERBUFFER_DEPTH_SIZE                 = 0x8D54;
+    public static final int GL_RENDERBUFFER_STENCIL_SIZE               = 0x8D55;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE      = 0x8CD0;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME      = 0x8CD1;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL    = 0x8CD2;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3;
+    public static final int GL_COLOR_ATTACHMENT0                       = 0x8CE0;
+    public static final int GL_DEPTH_ATTACHMENT                        = 0x8D00;
+    public static final int GL_STENCIL_ATTACHMENT                      = 0x8D20;
+    public static final int GL_NONE                                    = 0;
+    public static final int GL_FRAMEBUFFER_COMPLETE                    = 0x8CD5;
+    public static final int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT       = 0x8CD6;
+    public static final int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT          = 0x8CD7;
+    public static final int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS       = 0x8CD9;
+    public static final int GL_FRAMEBUFFER_UNSUPPORTED                 = 0x8CDD;
+    public static final int GL_FRAMEBUFFER_BINDING                     = 0x8CA6;
+    public static final int GL_RENDERBUFFER_BINDING                    = 0x8CA7;
+    public static final int GL_MAX_RENDERBUFFER_SIZE                   = 0x84E8;
+    public static final int GL_INVALID_FRAMEBUFFER_OPERATION           = 0x0506;
+
+    native private static void _nativeClassInit();
+    static {
+        _nativeClassInit();
+    }
+    // C function void glActiveTexture ( GLenum texture )
+
+    public static native void glActiveTexture(
+        int texture
+    );
+
+    // C function void glAttachShader ( GLuint program, GLuint shader )
+
+    public static native void glAttachShader(
+        int program,
+        int shader
+    );
+
+    // C function void glBindAttribLocation ( GLuint program, GLuint index, const char *name )
+
+    public static native void glBindAttribLocation(
+        int program,
+        int index,
+        String name
+    );
+
+    // C function void glBindBuffer ( GLenum target, GLuint buffer )
+
+    public static native void glBindBuffer(
+        int target,
+        int buffer
+    );
+
+    // C function void glBindFramebuffer ( GLenum target, GLuint framebuffer )
+
+    public static native void glBindFramebuffer(
+        int target,
+        int framebuffer
+    );
+
+    // C function void glBindRenderbuffer ( GLenum target, GLuint renderbuffer )
+
+    public static native void glBindRenderbuffer(
+        int target,
+        int renderbuffer
+    );
+
+    // C function void glBindTexture ( GLenum target, GLuint texture )
+
+    public static native void glBindTexture(
+        int target,
+        int texture
+    );
+
+    // C function void glBlendColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
+
+    public static native void glBlendColor(
+        float red,
+        float green,
+        float blue,
+        float alpha
+    );
+
+    // C function void glBlendEquation ( GLenum mode )
+
+    public static native void glBlendEquation(
+        int mode
+    );
+
+    // C function void glBlendEquationSeparate ( GLenum modeRGB, GLenum modeAlpha )
+
+    public static native void glBlendEquationSeparate(
+        int modeRGB,
+        int modeAlpha
+    );
+
+    // C function void glBlendFunc ( GLenum sfactor, GLenum dfactor )
+
+    public static native void glBlendFunc(
+        int sfactor,
+        int dfactor
+    );
+
+    // C function void glBlendFuncSeparate ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha )
+
+    public static native void glBlendFuncSeparate(
+        int srcRGB,
+        int dstRGB,
+        int srcAlpha,
+        int dstAlpha
+    );
+
+    // C function void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage )
+
+    public static native void glBufferData(
+        int target,
+        int size,
+        java.nio.Buffer data,
+        int usage
+    );
+
+    // C function void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data )
+
+    public static native void glBufferSubData(
+        int target,
+        int offset,
+        int size,
+        java.nio.Buffer data
+    );
+
+    // C function GLenum glCheckFramebufferStatus ( GLenum target )
+
+    public static native int glCheckFramebufferStatus(
+        int target
+    );
+
+    // C function void glClear ( GLbitfield mask )
+
+    public static native void glClear(
+        int mask
+    );
+
+    // C function void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
+
+    public static native void glClearColor(
+        float red,
+        float green,
+        float blue,
+        float alpha
+    );
+
+    // C function void glClearDepthf ( GLclampf depth )
+
+    public static native void glClearDepthf(
+        float depth
+    );
+
+    // C function void glClearStencil ( GLint s )
+
+    public static native void glClearStencil(
+        int s
+    );
+
+    // C function void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha )
+
+    public static native void glColorMask(
+        boolean red,
+        boolean green,
+        boolean blue,
+        boolean alpha
+    );
+
+    // C function void glCompileShader ( GLuint shader )
+
+    public static native void glCompileShader(
+        int shader
+    );
+
+    // C function void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data )
+
+    public static native void glCompressedTexImage2D(
+        int target,
+        int level,
+        int internalformat,
+        int width,
+        int height,
+        int border,
+        int imageSize,
+        java.nio.Buffer data
+    );
+
+    // C function void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data )
+
+    public static native void glCompressedTexSubImage2D(
+        int target,
+        int level,
+        int xoffset,
+        int yoffset,
+        int width,
+        int height,
+        int format,
+        int imageSize,
+        java.nio.Buffer data
+    );
+
+    // C function void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border )
+
+    public static native void glCopyTexImage2D(
+        int target,
+        int level,
+        int internalformat,
+        int x,
+        int y,
+        int width,
+        int height,
+        int border
+    );
+
+    // C function void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height )
+
+    public static native void glCopyTexSubImage2D(
+        int target,
+        int level,
+        int xoffset,
+        int yoffset,
+        int x,
+        int y,
+        int width,
+        int height
+    );
+
+    // C function GLuint glCreateProgram ( void )
+
+    public static native int glCreateProgram(
+    );
+
+    // C function GLuint glCreateShader ( GLenum type )
+
+    public static native int glCreateShader(
+        int type
+    );
+
+    // C function void glCullFace ( GLenum mode )
+
+    public static native void glCullFace(
+        int mode
+    );
+
+    // C function void glDeleteBuffers ( GLsizei n, const GLuint *buffers )
+
+    public static native void glDeleteBuffers(
+        int n,
+        int[] buffers,
+        int offset
+    );
+
+    // C function void glDeleteBuffers ( GLsizei n, const GLuint *buffers )
+
+    public static native void glDeleteBuffers(
+        int n,
+        java.nio.IntBuffer buffers
+    );
+
+    // C function void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers )
+
+    public static native void glDeleteFramebuffers(
+        int n,
+        int[] framebuffers,
+        int offset
+    );
+
+    // C function void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers )
+
+    public static native void glDeleteFramebuffers(
+        int n,
+        java.nio.IntBuffer framebuffers
+    );
+
+    // C function void glDeleteProgram ( GLuint program )
+
+    public static native void glDeleteProgram(
+        int program
+    );
+
+    // C function void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers )
+
+    public static native void glDeleteRenderbuffers(
+        int n,
+        int[] renderbuffers,
+        int offset
+    );
+
+    // C function void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers )
+
+    public static native void glDeleteRenderbuffers(
+        int n,
+        java.nio.IntBuffer renderbuffers
+    );
+
+    // C function void glDeleteShader ( GLuint shader )
+
+    public static native void glDeleteShader(
+        int shader
+    );
+
+    // C function void glDeleteTextures ( GLsizei n, const GLuint *textures )
+
+    public static native void glDeleteTextures(
+        int n,
+        int[] textures,
+        int offset
+    );
+
+    // C function void glDeleteTextures ( GLsizei n, const GLuint *textures )
+
+    public static native void glDeleteTextures(
+        int n,
+        java.nio.IntBuffer textures
+    );
+
+    // C function void glDepthFunc ( GLenum func )
+
+    public static native void glDepthFunc(
+        int func
+    );
+
+    // C function void glDepthMask ( GLboolean flag )
+
+    public static native void glDepthMask(
+        boolean flag
+    );
+
+    // C function void glDepthRangef ( GLclampf zNear, GLclampf zFar )
+
+    public static native void glDepthRangef(
+        float zNear,
+        float zFar
+    );
+
+    // C function void glDetachShader ( GLuint program, GLuint shader )
+
+    public static native void glDetachShader(
+        int program,
+        int shader
+    );
+
+    // C function void glDisable ( GLenum cap )
+
+    public static native void glDisable(
+        int cap
+    );
+
+    // C function void glDisableVertexAttribArray ( GLuint index )
+
+    public static native void glDisableVertexAttribArray(
+        int index
+    );
+
+    // C function void glDrawArrays ( GLenum mode, GLint first, GLsizei count )
+
+    public static native void glDrawArrays(
+        int mode,
+        int first,
+        int count
+    );
+
+    // C function void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset )
+
+    public static native void glDrawElements(
+        int mode,
+        int count,
+        int type,
+        int offset
+    );
+
+    // C function void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices )
+
+    public static native void glDrawElements(
+        int mode,
+        int count,
+        int type,
+        java.nio.Buffer indices
+    );
+
+    // C function void glEnable ( GLenum cap )
+
+    public static native void glEnable(
+        int cap
+    );
+
+    // C function void glEnableVertexAttribArray ( GLuint index )
+
+    public static native void glEnableVertexAttribArray(
+        int index
+    );
+
+    // C function void glFinish ( void )
+
+    public static native void glFinish(
+    );
+
+    // C function void glFlush ( void )
+
+    public static native void glFlush(
+    );
+
+    // C function void glFramebufferRenderbuffer ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer )
+
+    public static native void glFramebufferRenderbuffer(
+        int target,
+        int attachment,
+        int renderbuffertarget,
+        int renderbuffer
+    );
+
+    // C function void glFramebufferTexture2D ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level )
+
+    public static native void glFramebufferTexture2D(
+        int target,
+        int attachment,
+        int textarget,
+        int texture,
+        int level
+    );
+
+    // C function void glFrontFace ( GLenum mode )
+
+    public static native void glFrontFace(
+        int mode
+    );
+
+    // C function void glGenBuffers ( GLsizei n, GLuint *buffers )
+
+    public static native void glGenBuffers(
+        int n,
+        int[] buffers,
+        int offset
+    );
+
+    // C function void glGenBuffers ( GLsizei n, GLuint *buffers )
+
+    public static native void glGenBuffers(
+        int n,
+        java.nio.IntBuffer buffers
+    );
+
+    // C function void glGenerateMipmap ( GLenum target )
+
+    public static native void glGenerateMipmap(
+        int target
+    );
+
+    // C function void glGenFramebuffers ( GLsizei n, GLuint *framebuffers )
+
+    public static native void glGenFramebuffers(
+        int n,
+        int[] framebuffers,
+        int offset
+    );
+
+    // C function void glGenFramebuffers ( GLsizei n, GLuint *framebuffers )
+
+    public static native void glGenFramebuffers(
+        int n,
+        java.nio.IntBuffer framebuffers
+    );
+
+    // C function void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers )
+
+    public static native void glGenRenderbuffers(
+        int n,
+        int[] renderbuffers,
+        int offset
+    );
+
+    // C function void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers )
+
+    public static native void glGenRenderbuffers(
+        int n,
+        java.nio.IntBuffer renderbuffers
+    );
+
+    // C function void glGenTextures ( GLsizei n, GLuint *textures )
+
+    public static native void glGenTextures(
+        int n,
+        int[] textures,
+        int offset
+    );
+
+    // C function void glGenTextures ( GLsizei n, GLuint *textures )
+
+    public static native void glGenTextures(
+        int n,
+        java.nio.IntBuffer textures
+    );
+
+    // C function void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
+
+    public static native void glGetActiveAttrib(
+        int program,
+        int index,
+        int bufsize,
+        int[] length,
+        int lengthOffset,
+        int[] size,
+        int sizeOffset,
+        int[] type,
+        int typeOffset,
+        byte[] name,
+        int nameOffset
+    );
+
+    // C function void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
+
+    /** @hide Method is broken, but used to be public (b/6006380) */
+    @UnsupportedAppUsage
+    public static native void glGetActiveAttrib(
+        int program,
+        int index,
+        int bufsize,
+        java.nio.IntBuffer length,
+        java.nio.IntBuffer size,
+        java.nio.IntBuffer type,
+        byte name
+    );
+
+    // C function void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
+
+    public static native String glGetActiveAttrib(
+        int program,
+        int index,
+        int[] size,
+        int sizeOffset,
+        int[] type,
+        int typeOffset
+    );
+
+    // C function void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
+
+    public static native String glGetActiveAttrib(
+        int program,
+        int index,
+        java.nio.IntBuffer size,
+        java.nio.IntBuffer type
+    );
+    // C function void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
+
+    public static native void glGetActiveUniform(
+        int program,
+        int index,
+        int bufsize,
+        int[] length,
+        int lengthOffset,
+        int[] size,
+        int sizeOffset,
+        int[] type,
+        int typeOffset,
+        byte[] name,
+        int nameOffset
+    );
+
+    // C function void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
+
+    /** @hide Method is broken, but used to be public (b/6006380) */
+    @UnsupportedAppUsage
+    public static native void glGetActiveUniform(
+        int program,
+        int index,
+        int bufsize,
+        java.nio.IntBuffer length,
+        java.nio.IntBuffer size,
+        java.nio.IntBuffer type,
+        byte name
+    );
+    // C function void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
+
+    public static native String glGetActiveUniform(
+        int program,
+        int index,
+        int[] size,
+        int sizeOffset,
+        int[] type,
+        int typeOffset
+    );
+
+    // C function void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
+
+    public static native String glGetActiveUniform(
+        int program,
+        int index,
+        java.nio.IntBuffer size,
+        java.nio.IntBuffer type
+    );
+    // C function void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders )
+
+    public static native void glGetAttachedShaders(
+        int program,
+        int maxcount,
+        int[] count,
+        int countOffset,
+        int[] shaders,
+        int shadersOffset
+    );
+
+    // C function void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders )
+
+    public static native void glGetAttachedShaders(
+        int program,
+        int maxcount,
+        java.nio.IntBuffer count,
+        java.nio.IntBuffer shaders
+    );
+
+    // C function GLint glGetAttribLocation ( GLuint program, const char *name )
+
+    public static native int glGetAttribLocation(
+        int program,
+        String name
+    );
+
+    // C function void glGetBooleanv ( GLenum pname, GLboolean *params )
+
+    public static native void glGetBooleanv(
+        int pname,
+        boolean[] params,
+        int offset
+    );
+
+    // C function void glGetBooleanv ( GLenum pname, GLboolean *params )
+
+    public static native void glGetBooleanv(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetBufferParameteriv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetBufferParameteriv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function GLenum glGetError ( void )
+
+    public static native int glGetError(
+    );
+
+    // C function void glGetFloatv ( GLenum pname, GLfloat *params )
+
+    public static native void glGetFloatv(
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glGetFloatv ( GLenum pname, GLfloat *params )
+
+    public static native void glGetFloatv(
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params )
+
+    public static native void glGetFramebufferAttachmentParameteriv(
+        int target,
+        int attachment,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params )
+
+    public static native void glGetFramebufferAttachmentParameteriv(
+        int target,
+        int attachment,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetIntegerv ( GLenum pname, GLint *params )
+
+    public static native void glGetIntegerv(
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetIntegerv ( GLenum pname, GLint *params )
+
+    public static native void glGetIntegerv(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetProgramiv ( GLuint program, GLenum pname, GLint *params )
+
+    public static native void glGetProgramiv(
+        int program,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetProgramiv ( GLuint program, GLenum pname, GLint *params )
+
+    public static native void glGetProgramiv(
+        int program,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetProgramInfoLog( GLuint program, GLsizei maxLength, GLsizei * length,
+    //     GLchar * infoLog);
+
+    public static native String glGetProgramInfoLog(
+        int program
+    );
+    // C function void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetRenderbufferParameteriv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetRenderbufferParameteriv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params )
+
+    public static native void glGetShaderiv(
+        int shader,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params )
+
+    public static native void glGetShaderiv(
+        int shader,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetShaderInfoLog( GLuint shader, GLsizei maxLength, GLsizei * length,
+    //     GLchar * infoLog);
+
+    public static native String glGetShaderInfoLog(
+        int shader
+    );
+    // C function void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision )
+
+    public static native void glGetShaderPrecisionFormat(
+        int shadertype,
+        int precisiontype,
+        int[] range,
+        int rangeOffset,
+        int[] precision,
+        int precisionOffset
+    );
+
+    // C function void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision )
+
+    public static native void glGetShaderPrecisionFormat(
+        int shadertype,
+        int precisiontype,
+        java.nio.IntBuffer range,
+        java.nio.IntBuffer precision
+    );
+
+    // C function void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source )
+
+    public static native void glGetShaderSource(
+        int shader,
+        int bufsize,
+        int[] length,
+        int lengthOffset,
+        byte[] source,
+        int sourceOffset
+    );
+
+    // C function void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source )
+
+    /** @hide Method is broken, but used to be public (b/6006380) */
+    public static native void glGetShaderSource(
+        int shader,
+        int bufsize,
+        java.nio.IntBuffer length,
+        byte source
+    );
+
+    // C function void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source )
+
+    public static native String glGetShaderSource(
+        int shader
+    );
+    // C function const GLubyte * glGetString ( GLenum name )
+
+    public static native String glGetString(
+        int name
+    );
+    // C function void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params )
+
+    public static native void glGetTexParameterfv(
+        int target,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params )
+
+    public static native void glGetTexParameterfv(
+        int target,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetTexParameteriv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetTexParameteriv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetUniformfv ( GLuint program, GLint location, GLfloat *params )
+
+    public static native void glGetUniformfv(
+        int program,
+        int location,
+        float[] params,
+        int offset
+    );
+
+    // C function void glGetUniformfv ( GLuint program, GLint location, GLfloat *params )
+
+    public static native void glGetUniformfv(
+        int program,
+        int location,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glGetUniformiv ( GLuint program, GLint location, GLint *params )
+
+    public static native void glGetUniformiv(
+        int program,
+        int location,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetUniformiv ( GLuint program, GLint location, GLint *params )
+
+    public static native void glGetUniformiv(
+        int program,
+        int location,
+        java.nio.IntBuffer params
+    );
+
+    // C function GLint glGetUniformLocation ( GLuint program, const char *name )
+
+    public static native int glGetUniformLocation(
+        int program,
+        String name
+    );
+
+    // C function void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params )
+
+    public static native void glGetVertexAttribfv(
+        int index,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params )
+
+    public static native void glGetVertexAttribfv(
+        int index,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params )
+
+    public static native void glGetVertexAttribiv(
+        int index,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params )
+
+    public static native void glGetVertexAttribiv(
+        int index,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glHint ( GLenum target, GLenum mode )
+
+    public static native void glHint(
+        int target,
+        int mode
+    );
+
+    // C function GLboolean glIsBuffer ( GLuint buffer )
+
+    public static native boolean glIsBuffer(
+        int buffer
+    );
+
+    // C function GLboolean glIsEnabled ( GLenum cap )
+
+    public static native boolean glIsEnabled(
+        int cap
+    );
+
+    // C function GLboolean glIsFramebuffer ( GLuint framebuffer )
+
+    public static native boolean glIsFramebuffer(
+        int framebuffer
+    );
+
+    // C function GLboolean glIsProgram ( GLuint program )
+
+    public static native boolean glIsProgram(
+        int program
+    );
+
+    // C function GLboolean glIsRenderbuffer ( GLuint renderbuffer )
+
+    public static native boolean glIsRenderbuffer(
+        int renderbuffer
+    );
+
+    // C function GLboolean glIsShader ( GLuint shader )
+
+    public static native boolean glIsShader(
+        int shader
+    );
+
+    // C function GLboolean glIsTexture ( GLuint texture )
+
+    public static native boolean glIsTexture(
+        int texture
+    );
+
+    // C function void glLineWidth ( GLfloat width )
+
+    public static native void glLineWidth(
+        float width
+    );
+
+    // C function void glLinkProgram ( GLuint program )
+
+    public static native void glLinkProgram(
+        int program
+    );
+
+    // C function void glPixelStorei ( GLenum pname, GLint param )
+
+    public static native void glPixelStorei(
+        int pname,
+        int param
+    );
+
+    // C function void glPolygonOffset ( GLfloat factor, GLfloat units )
+
+    public static native void glPolygonOffset(
+        float factor,
+        float units
+    );
+
+    // C function void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels )
+
+    public static native void glReadPixels(
+        int x,
+        int y,
+        int width,
+        int height,
+        int format,
+        int type,
+        java.nio.Buffer pixels
+    );
+
+    // C function void glReleaseShaderCompiler ( void )
+
+    public static native void glReleaseShaderCompiler(
+    );
+
+    // C function void glRenderbufferStorage ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height )
+
+    public static native void glRenderbufferStorage(
+        int target,
+        int internalformat,
+        int width,
+        int height
+    );
+
+    // C function void glSampleCoverage ( GLclampf value, GLboolean invert )
+
+    public static native void glSampleCoverage(
+        float value,
+        boolean invert
+    );
+
+    // C function void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height )
+
+    public static native void glScissor(
+        int x,
+        int y,
+        int width,
+        int height
+    );
+
+    // C function void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length )
+
+    public static native void glShaderBinary(
+        int n,
+        int[] shaders,
+        int offset,
+        int binaryformat,
+        java.nio.Buffer binary,
+        int length
+    );
+
+    // C function void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length )
+
+    public static native void glShaderBinary(
+        int n,
+        java.nio.IntBuffer shaders,
+        int binaryformat,
+        java.nio.Buffer binary,
+        int length
+    );
+
+    // C function void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint* length )
+
+    public static native void glShaderSource(
+        int shader,
+        String string
+    );
+    // C function void glStencilFunc ( GLenum func, GLint ref, GLuint mask )
+
+    public static native void glStencilFunc(
+        int func,
+        int ref,
+        int mask
+    );
+
+    // C function void glStencilFuncSeparate ( GLenum face, GLenum func, GLint ref, GLuint mask )
+
+    public static native void glStencilFuncSeparate(
+        int face,
+        int func,
+        int ref,
+        int mask
+    );
+
+    // C function void glStencilMask ( GLuint mask )
+
+    public static native void glStencilMask(
+        int mask
+    );
+
+    // C function void glStencilMaskSeparate ( GLenum face, GLuint mask )
+
+    public static native void glStencilMaskSeparate(
+        int face,
+        int mask
+    );
+
+    // C function void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass )
+
+    public static native void glStencilOp(
+        int fail,
+        int zfail,
+        int zpass
+    );
+
+    // C function void glStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass )
+
+    public static native void glStencilOpSeparate(
+        int face,
+        int fail,
+        int zfail,
+        int zpass
+    );
+
+    // C function void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
+
+    public static native void glTexImage2D(
+        int target,
+        int level,
+        int internalformat,
+        int width,
+        int height,
+        int border,
+        int format,
+        int type,
+        java.nio.Buffer pixels
+    );
+
+    // C function void glTexParameterf ( GLenum target, GLenum pname, GLfloat param )
+
+    public static native void glTexParameterf(
+        int target,
+        int pname,
+        float param
+    );
+
+    // C function void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params )
+
+    public static native void glTexParameterfv(
+        int target,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params )
+
+    public static native void glTexParameterfv(
+        int target,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glTexParameteri ( GLenum target, GLenum pname, GLint param )
+
+    public static native void glTexParameteri(
+        int target,
+        int pname,
+        int param
+    );
+
+    // C function void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params )
+
+    public static native void glTexParameteriv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params )
+
+    public static native void glTexParameteriv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels )
+
+    public static native void glTexSubImage2D(
+        int target,
+        int level,
+        int xoffset,
+        int yoffset,
+        int width,
+        int height,
+        int format,
+        int type,
+        java.nio.Buffer pixels
+    );
+
+    // C function void glUniform1f ( GLint location, GLfloat x )
+
+    public static native void glUniform1f(
+        int location,
+        float x
+    );
+
+    // C function void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v )
+
+    public static native void glUniform1fv(
+        int location,
+        int count,
+        float[] v,
+        int offset
+    );
+
+    // C function void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v )
+
+    public static native void glUniform1fv(
+        int location,
+        int count,
+        java.nio.FloatBuffer v
+    );
+
+    // C function void glUniform1i ( GLint location, GLint x )
+
+    public static native void glUniform1i(
+        int location,
+        int x
+    );
+
+    // C function void glUniform1iv ( GLint location, GLsizei count, const GLint *v )
+
+    public static native void glUniform1iv(
+        int location,
+        int count,
+        int[] v,
+        int offset
+    );
+
+    // C function void glUniform1iv ( GLint location, GLsizei count, const GLint *v )
+
+    public static native void glUniform1iv(
+        int location,
+        int count,
+        java.nio.IntBuffer v
+    );
+
+    // C function void glUniform2f ( GLint location, GLfloat x, GLfloat y )
+
+    public static native void glUniform2f(
+        int location,
+        float x,
+        float y
+    );
+
+    // C function void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v )
+
+    public static native void glUniform2fv(
+        int location,
+        int count,
+        float[] v,
+        int offset
+    );
+
+    // C function void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v )
+
+    public static native void glUniform2fv(
+        int location,
+        int count,
+        java.nio.FloatBuffer v
+    );
+
+    // C function void glUniform2i ( GLint location, GLint x, GLint y )
+
+    public static native void glUniform2i(
+        int location,
+        int x,
+        int y
+    );
+
+    // C function void glUniform2iv ( GLint location, GLsizei count, const GLint *v )
+
+    public static native void glUniform2iv(
+        int location,
+        int count,
+        int[] v,
+        int offset
+    );
+
+    // C function void glUniform2iv ( GLint location, GLsizei count, const GLint *v )
+
+    public static native void glUniform2iv(
+        int location,
+        int count,
+        java.nio.IntBuffer v
+    );
+
+    // C function void glUniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z )
+
+    public static native void glUniform3f(
+        int location,
+        float x,
+        float y,
+        float z
+    );
+
+    // C function void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v )
+
+    public static native void glUniform3fv(
+        int location,
+        int count,
+        float[] v,
+        int offset
+    );
+
+    // C function void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v )
+
+    public static native void glUniform3fv(
+        int location,
+        int count,
+        java.nio.FloatBuffer v
+    );
+
+    // C function void glUniform3i ( GLint location, GLint x, GLint y, GLint z )
+
+    public static native void glUniform3i(
+        int location,
+        int x,
+        int y,
+        int z
+    );
+
+    // C function void glUniform3iv ( GLint location, GLsizei count, const GLint *v )
+
+    public static native void glUniform3iv(
+        int location,
+        int count,
+        int[] v,
+        int offset
+    );
+
+    // C function void glUniform3iv ( GLint location, GLsizei count, const GLint *v )
+
+    public static native void glUniform3iv(
+        int location,
+        int count,
+        java.nio.IntBuffer v
+    );
+
+    // C function void glUniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+
+    public static native void glUniform4f(
+        int location,
+        float x,
+        float y,
+        float z,
+        float w
+    );
+
+    // C function void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v )
+
+    public static native void glUniform4fv(
+        int location,
+        int count,
+        float[] v,
+        int offset
+    );
+
+    // C function void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v )
+
+    public static native void glUniform4fv(
+        int location,
+        int count,
+        java.nio.FloatBuffer v
+    );
+
+    // C function void glUniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w )
+
+    public static native void glUniform4i(
+        int location,
+        int x,
+        int y,
+        int z,
+        int w
+    );
+
+    // C function void glUniform4iv ( GLint location, GLsizei count, const GLint *v )
+
+    public static native void glUniform4iv(
+        int location,
+        int count,
+        int[] v,
+        int offset
+    );
+
+    // C function void glUniform4iv ( GLint location, GLsizei count, const GLint *v )
+
+    public static native void glUniform4iv(
+        int location,
+        int count,
+        java.nio.IntBuffer v
+    );
+
+    // C function void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glUniformMatrix2fv(
+        int location,
+        int count,
+        boolean transpose,
+        float[] value,
+        int offset
+    );
+
+    // C function void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glUniformMatrix2fv(
+        int location,
+        int count,
+        boolean transpose,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glUniformMatrix3fv(
+        int location,
+        int count,
+        boolean transpose,
+        float[] value,
+        int offset
+    );
+
+    // C function void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glUniformMatrix3fv(
+        int location,
+        int count,
+        boolean transpose,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glUniformMatrix4fv(
+        int location,
+        int count,
+        boolean transpose,
+        float[] value,
+        int offset
+    );
+
+    // C function void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glUniformMatrix4fv(
+        int location,
+        int count,
+        boolean transpose,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glUseProgram ( GLuint program )
+
+    public static native void glUseProgram(
+        int program
+    );
+
+    // C function void glValidateProgram ( GLuint program )
+
+    public static native void glValidateProgram(
+        int program
+    );
+
+    // C function void glVertexAttrib1f ( GLuint indx, GLfloat x )
+
+    public static native void glVertexAttrib1f(
+        int indx,
+        float x
+    );
+
+    // C function void glVertexAttrib1fv ( GLuint indx, const GLfloat *values )
+
+    public static native void glVertexAttrib1fv(
+        int indx,
+        float[] values,
+        int offset
+    );
+
+    // C function void glVertexAttrib1fv ( GLuint indx, const GLfloat *values )
+
+    public static native void glVertexAttrib1fv(
+        int indx,
+        java.nio.FloatBuffer values
+    );
+
+    // C function void glVertexAttrib2f ( GLuint indx, GLfloat x, GLfloat y )
+
+    public static native void glVertexAttrib2f(
+        int indx,
+        float x,
+        float y
+    );
+
+    // C function void glVertexAttrib2fv ( GLuint indx, const GLfloat *values )
+
+    public static native void glVertexAttrib2fv(
+        int indx,
+        float[] values,
+        int offset
+    );
+
+    // C function void glVertexAttrib2fv ( GLuint indx, const GLfloat *values )
+
+    public static native void glVertexAttrib2fv(
+        int indx,
+        java.nio.FloatBuffer values
+    );
+
+    // C function void glVertexAttrib3f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z )
+
+    public static native void glVertexAttrib3f(
+        int indx,
+        float x,
+        float y,
+        float z
+    );
+
+    // C function void glVertexAttrib3fv ( GLuint indx, const GLfloat *values )
+
+    public static native void glVertexAttrib3fv(
+        int indx,
+        float[] values,
+        int offset
+    );
+
+    // C function void glVertexAttrib3fv ( GLuint indx, const GLfloat *values )
+
+    public static native void glVertexAttrib3fv(
+        int indx,
+        java.nio.FloatBuffer values
+    );
+
+    // C function void glVertexAttrib4f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+
+    public static native void glVertexAttrib4f(
+        int indx,
+        float x,
+        float y,
+        float z,
+        float w
+    );
+
+    // C function void glVertexAttrib4fv ( GLuint indx, const GLfloat *values )
+
+    public static native void glVertexAttrib4fv(
+        int indx,
+        float[] values,
+        int offset
+    );
+
+    // C function void glVertexAttrib4fv ( GLuint indx, const GLfloat *values )
+
+    public static native void glVertexAttrib4fv(
+        int indx,
+        java.nio.FloatBuffer values
+    );
+
+    // C function void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint offset )
+
+    public static native void glVertexAttribPointer(
+        int indx,
+        int size,
+        int type,
+        boolean normalized,
+        int stride,
+        int offset
+    );
+
+    // C function void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr )
+
+    private static native void glVertexAttribPointerBounds(
+        int indx,
+        int size,
+        int type,
+        boolean normalized,
+        int stride,
+        java.nio.Buffer ptr,
+        int remaining
+    );
+
+    public static void glVertexAttribPointer(
+        int indx,
+        int size,
+        int type,
+        boolean normalized,
+        int stride,
+        java.nio.Buffer ptr
+    ) {
+        glVertexAttribPointerBounds(
+            indx,
+            size,
+            type,
+            normalized,
+            stride,
+            ptr,
+            ptr.remaining()
+        );
+    }
+
+    // C function void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height )
+
+    public static native void glViewport(
+        int x,
+        int y,
+        int width,
+        int height
+    );
+
+}
diff --git a/android/opengl/GLES30.java b/android/opengl/GLES30.java
new file mode 100644
index 0000000..3b805d2
--- /dev/null
+++ b/android/opengl/GLES30.java
@@ -0,0 +1,1829 @@
+/*
+**
+** Copyright 2013, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+package android.opengl;
+
+/** OpenGL ES 3.0
+ */
+public class GLES30 extends GLES20 {
+    public static final int GL_READ_BUFFER                             = 0x0C02;
+    public static final int GL_UNPACK_ROW_LENGTH                       = 0x0CF2;
+    public static final int GL_UNPACK_SKIP_ROWS                        = 0x0CF3;
+    public static final int GL_UNPACK_SKIP_PIXELS                      = 0x0CF4;
+    public static final int GL_PACK_ROW_LENGTH                         = 0x0D02;
+    public static final int GL_PACK_SKIP_ROWS                          = 0x0D03;
+    public static final int GL_PACK_SKIP_PIXELS                        = 0x0D04;
+    public static final int GL_COLOR                                   = 0x1800;
+    public static final int GL_DEPTH                                   = 0x1801;
+    public static final int GL_STENCIL                                 = 0x1802;
+    public static final int GL_RED                                     = 0x1903;
+    public static final int GL_RGB8                                    = 0x8051;
+    public static final int GL_RGBA8                                   = 0x8058;
+    public static final int GL_RGB10_A2                                = 0x8059;
+    public static final int GL_TEXTURE_BINDING_3D                      = 0x806A;
+    public static final int GL_UNPACK_SKIP_IMAGES                      = 0x806D;
+    public static final int GL_UNPACK_IMAGE_HEIGHT                     = 0x806E;
+    public static final int GL_TEXTURE_3D                              = 0x806F;
+    public static final int GL_TEXTURE_WRAP_R                          = 0x8072;
+    public static final int GL_MAX_3D_TEXTURE_SIZE                     = 0x8073;
+    public static final int GL_UNSIGNED_INT_2_10_10_10_REV             = 0x8368;
+    public static final int GL_MAX_ELEMENTS_VERTICES                   = 0x80E8;
+    public static final int GL_MAX_ELEMENTS_INDICES                    = 0x80E9;
+    public static final int GL_TEXTURE_MIN_LOD                         = 0x813A;
+    public static final int GL_TEXTURE_MAX_LOD                         = 0x813B;
+    public static final int GL_TEXTURE_BASE_LEVEL                      = 0x813C;
+    public static final int GL_TEXTURE_MAX_LEVEL                       = 0x813D;
+    public static final int GL_MIN                                     = 0x8007;
+    public static final int GL_MAX                                     = 0x8008;
+    public static final int GL_DEPTH_COMPONENT24                       = 0x81A6;
+    public static final int GL_MAX_TEXTURE_LOD_BIAS                    = 0x84FD;
+    public static final int GL_TEXTURE_COMPARE_MODE                    = 0x884C;
+    public static final int GL_TEXTURE_COMPARE_FUNC                    = 0x884D;
+    public static final int GL_CURRENT_QUERY                           = 0x8865;
+    public static final int GL_QUERY_RESULT                            = 0x8866;
+    public static final int GL_QUERY_RESULT_AVAILABLE                  = 0x8867;
+    public static final int GL_BUFFER_MAPPED                           = 0x88BC;
+    public static final int GL_BUFFER_MAP_POINTER                      = 0x88BD;
+    public static final int GL_STREAM_READ                             = 0x88E1;
+    public static final int GL_STREAM_COPY                             = 0x88E2;
+    public static final int GL_STATIC_READ                             = 0x88E5;
+    public static final int GL_STATIC_COPY                             = 0x88E6;
+    public static final int GL_DYNAMIC_READ                            = 0x88E9;
+    public static final int GL_DYNAMIC_COPY                            = 0x88EA;
+    public static final int GL_MAX_DRAW_BUFFERS                        = 0x8824;
+    public static final int GL_DRAW_BUFFER0                            = 0x8825;
+    public static final int GL_DRAW_BUFFER1                            = 0x8826;
+    public static final int GL_DRAW_BUFFER2                            = 0x8827;
+    public static final int GL_DRAW_BUFFER3                            = 0x8828;
+    public static final int GL_DRAW_BUFFER4                            = 0x8829;
+    public static final int GL_DRAW_BUFFER5                            = 0x882A;
+    public static final int GL_DRAW_BUFFER6                            = 0x882B;
+    public static final int GL_DRAW_BUFFER7                            = 0x882C;
+    public static final int GL_DRAW_BUFFER8                            = 0x882D;
+    public static final int GL_DRAW_BUFFER9                            = 0x882E;
+    public static final int GL_DRAW_BUFFER10                           = 0x882F;
+    public static final int GL_DRAW_BUFFER11                           = 0x8830;
+    public static final int GL_DRAW_BUFFER12                           = 0x8831;
+    public static final int GL_DRAW_BUFFER13                           = 0x8832;
+    public static final int GL_DRAW_BUFFER14                           = 0x8833;
+    public static final int GL_DRAW_BUFFER15                           = 0x8834;
+    public static final int GL_MAX_FRAGMENT_UNIFORM_COMPONENTS         = 0x8B49;
+    public static final int GL_MAX_VERTEX_UNIFORM_COMPONENTS           = 0x8B4A;
+    public static final int GL_SAMPLER_3D                              = 0x8B5F;
+    public static final int GL_SAMPLER_2D_SHADOW                       = 0x8B62;
+    public static final int GL_FRAGMENT_SHADER_DERIVATIVE_HINT         = 0x8B8B;
+    public static final int GL_PIXEL_PACK_BUFFER                       = 0x88EB;
+    public static final int GL_PIXEL_UNPACK_BUFFER                     = 0x88EC;
+    public static final int GL_PIXEL_PACK_BUFFER_BINDING               = 0x88ED;
+    public static final int GL_PIXEL_UNPACK_BUFFER_BINDING             = 0x88EF;
+    public static final int GL_FLOAT_MAT2x3                            = 0x8B65;
+    public static final int GL_FLOAT_MAT2x4                            = 0x8B66;
+    public static final int GL_FLOAT_MAT3x2                            = 0x8B67;
+    public static final int GL_FLOAT_MAT3x4                            = 0x8B68;
+    public static final int GL_FLOAT_MAT4x2                            = 0x8B69;
+    public static final int GL_FLOAT_MAT4x3                            = 0x8B6A;
+    public static final int GL_SRGB                                    = 0x8C40;
+    public static final int GL_SRGB8                                   = 0x8C41;
+    public static final int GL_SRGB8_ALPHA8                            = 0x8C43;
+    public static final int GL_COMPARE_REF_TO_TEXTURE                  = 0x884E;
+    public static final int GL_MAJOR_VERSION                           = 0x821B;
+    public static final int GL_MINOR_VERSION                           = 0x821C;
+    public static final int GL_NUM_EXTENSIONS                          = 0x821D;
+    public static final int GL_RGBA32F                                 = 0x8814;
+    public static final int GL_RGB32F                                  = 0x8815;
+    public static final int GL_RGBA16F                                 = 0x881A;
+    public static final int GL_RGB16F                                  = 0x881B;
+    public static final int GL_VERTEX_ATTRIB_ARRAY_INTEGER             = 0x88FD;
+    public static final int GL_MAX_ARRAY_TEXTURE_LAYERS                = 0x88FF;
+    public static final int GL_MIN_PROGRAM_TEXEL_OFFSET                = 0x8904;
+    public static final int GL_MAX_PROGRAM_TEXEL_OFFSET                = 0x8905;
+    public static final int GL_MAX_VARYING_COMPONENTS                  = 0x8B4B;
+    public static final int GL_TEXTURE_2D_ARRAY                        = 0x8C1A;
+    public static final int GL_TEXTURE_BINDING_2D_ARRAY                = 0x8C1D;
+    public static final int GL_R11F_G11F_B10F                          = 0x8C3A;
+    public static final int GL_UNSIGNED_INT_10F_11F_11F_REV            = 0x8C3B;
+    public static final int GL_RGB9_E5                                 = 0x8C3D;
+    public static final int GL_UNSIGNED_INT_5_9_9_9_REV                = 0x8C3E;
+    public static final int GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH   = 0x8C76;
+    public static final int GL_TRANSFORM_FEEDBACK_BUFFER_MODE          = 0x8C7F;
+    public static final int GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS   = 0x8C80;
+    public static final int GL_TRANSFORM_FEEDBACK_VARYINGS             = 0x8C83;
+    public static final int GL_TRANSFORM_FEEDBACK_BUFFER_START         = 0x8C84;
+    public static final int GL_TRANSFORM_FEEDBACK_BUFFER_SIZE          = 0x8C85;
+    public static final int GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN   = 0x8C88;
+    public static final int GL_RASTERIZER_DISCARD                      = 0x8C89;
+    public static final int GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS    = 0x8C8A;
+    public static final int GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8C8B;
+    public static final int GL_INTERLEAVED_ATTRIBS                     = 0x8C8C;
+    public static final int GL_SEPARATE_ATTRIBS                        = 0x8C8D;
+    public static final int GL_TRANSFORM_FEEDBACK_BUFFER               = 0x8C8E;
+    public static final int GL_TRANSFORM_FEEDBACK_BUFFER_BINDING       = 0x8C8F;
+    public static final int GL_RGBA32UI                                = 0x8D70;
+    public static final int GL_RGB32UI                                 = 0x8D71;
+    public static final int GL_RGBA16UI                                = 0x8D76;
+    public static final int GL_RGB16UI                                 = 0x8D77;
+    public static final int GL_RGBA8UI                                 = 0x8D7C;
+    public static final int GL_RGB8UI                                  = 0x8D7D;
+    public static final int GL_RGBA32I                                 = 0x8D82;
+    public static final int GL_RGB32I                                  = 0x8D83;
+    public static final int GL_RGBA16I                                 = 0x8D88;
+    public static final int GL_RGB16I                                  = 0x8D89;
+    public static final int GL_RGBA8I                                  = 0x8D8E;
+    public static final int GL_RGB8I                                   = 0x8D8F;
+    public static final int GL_RED_INTEGER                             = 0x8D94;
+    public static final int GL_RGB_INTEGER                             = 0x8D98;
+    public static final int GL_RGBA_INTEGER                            = 0x8D99;
+    public static final int GL_SAMPLER_2D_ARRAY                        = 0x8DC1;
+    public static final int GL_SAMPLER_2D_ARRAY_SHADOW                 = 0x8DC4;
+    public static final int GL_SAMPLER_CUBE_SHADOW                     = 0x8DC5;
+    public static final int GL_UNSIGNED_INT_VEC2                       = 0x8DC6;
+    public static final int GL_UNSIGNED_INT_VEC3                       = 0x8DC7;
+    public static final int GL_UNSIGNED_INT_VEC4                       = 0x8DC8;
+    public static final int GL_INT_SAMPLER_2D                          = 0x8DCA;
+    public static final int GL_INT_SAMPLER_3D                          = 0x8DCB;
+    public static final int GL_INT_SAMPLER_CUBE                        = 0x8DCC;
+    public static final int GL_INT_SAMPLER_2D_ARRAY                    = 0x8DCF;
+    public static final int GL_UNSIGNED_INT_SAMPLER_2D                 = 0x8DD2;
+    public static final int GL_UNSIGNED_INT_SAMPLER_3D                 = 0x8DD3;
+    public static final int GL_UNSIGNED_INT_SAMPLER_CUBE               = 0x8DD4;
+    public static final int GL_UNSIGNED_INT_SAMPLER_2D_ARRAY           = 0x8DD7;
+    public static final int GL_BUFFER_ACCESS_FLAGS                     = 0x911F;
+    public static final int GL_BUFFER_MAP_LENGTH                       = 0x9120;
+    public static final int GL_BUFFER_MAP_OFFSET                       = 0x9121;
+    public static final int GL_DEPTH_COMPONENT32F                      = 0x8CAC;
+    public static final int GL_DEPTH32F_STENCIL8                       = 0x8CAD;
+    public static final int GL_FLOAT_32_UNSIGNED_INT_24_8_REV          = 0x8DAD;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING   = 0x8210;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE   = 0x8211;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE         = 0x8212;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE       = 0x8213;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE        = 0x8214;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE       = 0x8215;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE       = 0x8216;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE     = 0x8217;
+    public static final int GL_FRAMEBUFFER_DEFAULT                     = 0x8218;
+    public static final int GL_FRAMEBUFFER_UNDEFINED                   = 0x8219;
+    public static final int GL_DEPTH_STENCIL_ATTACHMENT                = 0x821A;
+    public static final int GL_DEPTH_STENCIL                           = 0x84F9;
+    public static final int GL_UNSIGNED_INT_24_8                       = 0x84FA;
+    public static final int GL_DEPTH24_STENCIL8                        = 0x88F0;
+    public static final int GL_UNSIGNED_NORMALIZED                     = 0x8C17;
+    public static final int GL_DRAW_FRAMEBUFFER_BINDING                = GL_FRAMEBUFFER_BINDING;
+    public static final int GL_READ_FRAMEBUFFER                        = 0x8CA8;
+    public static final int GL_DRAW_FRAMEBUFFER                        = 0x8CA9;
+    public static final int GL_READ_FRAMEBUFFER_BINDING                = 0x8CAA;
+    public static final int GL_RENDERBUFFER_SAMPLES                    = 0x8CAB;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER    = 0x8CD4;
+    public static final int GL_MAX_COLOR_ATTACHMENTS                   = 0x8CDF;
+    public static final int GL_COLOR_ATTACHMENT1                       = 0x8CE1;
+    public static final int GL_COLOR_ATTACHMENT2                       = 0x8CE2;
+    public static final int GL_COLOR_ATTACHMENT3                       = 0x8CE3;
+    public static final int GL_COLOR_ATTACHMENT4                       = 0x8CE4;
+    public static final int GL_COLOR_ATTACHMENT5                       = 0x8CE5;
+    public static final int GL_COLOR_ATTACHMENT6                       = 0x8CE6;
+    public static final int GL_COLOR_ATTACHMENT7                       = 0x8CE7;
+    public static final int GL_COLOR_ATTACHMENT8                       = 0x8CE8;
+    public static final int GL_COLOR_ATTACHMENT9                       = 0x8CE9;
+    public static final int GL_COLOR_ATTACHMENT10                      = 0x8CEA;
+    public static final int GL_COLOR_ATTACHMENT11                      = 0x8CEB;
+    public static final int GL_COLOR_ATTACHMENT12                      = 0x8CEC;
+    public static final int GL_COLOR_ATTACHMENT13                      = 0x8CED;
+    public static final int GL_COLOR_ATTACHMENT14                      = 0x8CEE;
+    public static final int GL_COLOR_ATTACHMENT15                      = 0x8CEF;
+    public static final int GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE      = 0x8D56;
+    public static final int GL_MAX_SAMPLES                             = 0x8D57;
+    public static final int GL_HALF_FLOAT                              = 0x140B;
+    public static final int GL_MAP_READ_BIT                            = 0x0001;
+    public static final int GL_MAP_WRITE_BIT                           = 0x0002;
+    public static final int GL_MAP_INVALIDATE_RANGE_BIT                = 0x0004;
+    public static final int GL_MAP_INVALIDATE_BUFFER_BIT               = 0x0008;
+    public static final int GL_MAP_FLUSH_EXPLICIT_BIT                  = 0x0010;
+    public static final int GL_MAP_UNSYNCHRONIZED_BIT                  = 0x0020;
+    public static final int GL_RG                                      = 0x8227;
+    public static final int GL_RG_INTEGER                              = 0x8228;
+    public static final int GL_R8                                      = 0x8229;
+    public static final int GL_RG8                                     = 0x822B;
+    public static final int GL_R16F                                    = 0x822D;
+    public static final int GL_R32F                                    = 0x822E;
+    public static final int GL_RG16F                                   = 0x822F;
+    public static final int GL_RG32F                                   = 0x8230;
+    public static final int GL_R8I                                     = 0x8231;
+    public static final int GL_R8UI                                    = 0x8232;
+    public static final int GL_R16I                                    = 0x8233;
+    public static final int GL_R16UI                                   = 0x8234;
+    public static final int GL_R32I                                    = 0x8235;
+    public static final int GL_R32UI                                   = 0x8236;
+    public static final int GL_RG8I                                    = 0x8237;
+    public static final int GL_RG8UI                                   = 0x8238;
+    public static final int GL_RG16I                                   = 0x8239;
+    public static final int GL_RG16UI                                  = 0x823A;
+    public static final int GL_RG32I                                   = 0x823B;
+    public static final int GL_RG32UI                                  = 0x823C;
+    public static final int GL_VERTEX_ARRAY_BINDING                    = 0x85B5;
+    public static final int GL_R8_SNORM                                = 0x8F94;
+    public static final int GL_RG8_SNORM                               = 0x8F95;
+    public static final int GL_RGB8_SNORM                              = 0x8F96;
+    public static final int GL_RGBA8_SNORM                             = 0x8F97;
+    public static final int GL_SIGNED_NORMALIZED                       = 0x8F9C;
+    public static final int GL_PRIMITIVE_RESTART_FIXED_INDEX           = 0x8D69;
+    public static final int GL_COPY_READ_BUFFER                        = 0x8F36;
+    public static final int GL_COPY_WRITE_BUFFER                       = 0x8F37;
+    public static final int GL_COPY_READ_BUFFER_BINDING                = GL_COPY_READ_BUFFER;
+    public static final int GL_COPY_WRITE_BUFFER_BINDING               = GL_COPY_WRITE_BUFFER;
+    public static final int GL_UNIFORM_BUFFER                          = 0x8A11;
+    public static final int GL_UNIFORM_BUFFER_BINDING                  = 0x8A28;
+    public static final int GL_UNIFORM_BUFFER_START                    = 0x8A29;
+    public static final int GL_UNIFORM_BUFFER_SIZE                     = 0x8A2A;
+    public static final int GL_MAX_VERTEX_UNIFORM_BLOCKS               = 0x8A2B;
+    public static final int GL_MAX_FRAGMENT_UNIFORM_BLOCKS             = 0x8A2D;
+    public static final int GL_MAX_COMBINED_UNIFORM_BLOCKS             = 0x8A2E;
+    public static final int GL_MAX_UNIFORM_BUFFER_BINDINGS             = 0x8A2F;
+    public static final int GL_MAX_UNIFORM_BLOCK_SIZE                  = 0x8A30;
+    public static final int GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS  = 0x8A31;
+    public static final int GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS     = 0x8A33;
+    public static final int GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT         = 0x8A34;
+    public static final int GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH    = 0x8A35;
+    public static final int GL_ACTIVE_UNIFORM_BLOCKS                   = 0x8A36;
+    public static final int GL_UNIFORM_TYPE                            = 0x8A37;
+    public static final int GL_UNIFORM_SIZE                            = 0x8A38;
+    public static final int GL_UNIFORM_NAME_LENGTH                     = 0x8A39;
+    public static final int GL_UNIFORM_BLOCK_INDEX                     = 0x8A3A;
+    public static final int GL_UNIFORM_OFFSET                          = 0x8A3B;
+    public static final int GL_UNIFORM_ARRAY_STRIDE                    = 0x8A3C;
+    public static final int GL_UNIFORM_MATRIX_STRIDE                   = 0x8A3D;
+    public static final int GL_UNIFORM_IS_ROW_MAJOR                    = 0x8A3E;
+    public static final int GL_UNIFORM_BLOCK_BINDING                   = 0x8A3F;
+    public static final int GL_UNIFORM_BLOCK_DATA_SIZE                 = 0x8A40;
+    public static final int GL_UNIFORM_BLOCK_NAME_LENGTH               = 0x8A41;
+    public static final int GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS           = 0x8A42;
+    public static final int GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES    = 0x8A43;
+    public static final int GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER    = 0x8A44;
+    public static final int GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER  = 0x8A46;
+    // GL_INVALID_INDEX is defined as 0xFFFFFFFFu in C.
+    public static final int GL_INVALID_INDEX                           = -1;
+    public static final int GL_MAX_VERTEX_OUTPUT_COMPONENTS            = 0x9122;
+    public static final int GL_MAX_FRAGMENT_INPUT_COMPONENTS           = 0x9125;
+    public static final int GL_MAX_SERVER_WAIT_TIMEOUT                 = 0x9111;
+    public static final int GL_OBJECT_TYPE                             = 0x9112;
+    public static final int GL_SYNC_CONDITION                          = 0x9113;
+    public static final int GL_SYNC_STATUS                             = 0x9114;
+    public static final int GL_SYNC_FLAGS                              = 0x9115;
+    public static final int GL_SYNC_FENCE                              = 0x9116;
+    public static final int GL_SYNC_GPU_COMMANDS_COMPLETE              = 0x9117;
+    public static final int GL_UNSIGNALED                              = 0x9118;
+    public static final int GL_SIGNALED                                = 0x9119;
+    public static final int GL_ALREADY_SIGNALED                        = 0x911A;
+    public static final int GL_TIMEOUT_EXPIRED                         = 0x911B;
+    public static final int GL_CONDITION_SATISFIED                     = 0x911C;
+    public static final int GL_WAIT_FAILED                             = 0x911D;
+    public static final int GL_SYNC_FLUSH_COMMANDS_BIT                 = 0x00000001;
+    // GL_TIMEOUT_IGNORED is defined as 0xFFFFFFFFFFFFFFFFull in C.
+    public static final long GL_TIMEOUT_IGNORED                         = -1;
+    public static final int GL_VERTEX_ATTRIB_ARRAY_DIVISOR             = 0x88FE;
+    public static final int GL_ANY_SAMPLES_PASSED                      = 0x8C2F;
+    public static final int GL_ANY_SAMPLES_PASSED_CONSERVATIVE         = 0x8D6A;
+    public static final int GL_SAMPLER_BINDING                         = 0x8919;
+    public static final int GL_RGB10_A2UI                              = 0x906F;
+    public static final int GL_TEXTURE_SWIZZLE_R                       = 0x8E42;
+    public static final int GL_TEXTURE_SWIZZLE_G                       = 0x8E43;
+    public static final int GL_TEXTURE_SWIZZLE_B                       = 0x8E44;
+    public static final int GL_TEXTURE_SWIZZLE_A                       = 0x8E45;
+    public static final int GL_GREEN                                   = 0x1904;
+    public static final int GL_BLUE                                    = 0x1905;
+    public static final int GL_INT_2_10_10_10_REV                      = 0x8D9F;
+    public static final int GL_TRANSFORM_FEEDBACK                      = 0x8E22;
+    public static final int GL_TRANSFORM_FEEDBACK_PAUSED               = 0x8E23;
+    public static final int GL_TRANSFORM_FEEDBACK_ACTIVE               = 0x8E24;
+    public static final int GL_TRANSFORM_FEEDBACK_BINDING              = 0x8E25;
+    public static final int GL_PROGRAM_BINARY_RETRIEVABLE_HINT         = 0x8257;
+    public static final int GL_PROGRAM_BINARY_LENGTH                   = 0x8741;
+    public static final int GL_NUM_PROGRAM_BINARY_FORMATS              = 0x87FE;
+    public static final int GL_PROGRAM_BINARY_FORMATS                  = 0x87FF;
+    public static final int GL_COMPRESSED_R11_EAC                      = 0x9270;
+    public static final int GL_COMPRESSED_SIGNED_R11_EAC               = 0x9271;
+    public static final int GL_COMPRESSED_RG11_EAC                     = 0x9272;
+    public static final int GL_COMPRESSED_SIGNED_RG11_EAC              = 0x9273;
+    public static final int GL_COMPRESSED_RGB8_ETC2                    = 0x9274;
+    public static final int GL_COMPRESSED_SRGB8_ETC2                   = 0x9275;
+    public static final int GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2     = 0x9276;
+    public static final int GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2    = 0x9277;
+    public static final int GL_COMPRESSED_RGBA8_ETC2_EAC               = 0x9278;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC        = 0x9279;
+    public static final int GL_TEXTURE_IMMUTABLE_FORMAT                = 0x912F;
+    public static final int GL_MAX_ELEMENT_INDEX                       = 0x8D6B;
+    public static final int GL_NUM_SAMPLE_COUNTS                       = 0x9380;
+    public static final int GL_TEXTURE_IMMUTABLE_LEVELS                = 0x82DF;
+
+    native private static void _nativeClassInit();
+    static {
+        _nativeClassInit();
+    }
+
+    // C function void glReadBuffer ( GLenum mode )
+
+    public static native void glReadBuffer(
+        int mode
+    );
+
+    // C function void glDrawRangeElements ( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices )
+
+    public static native void glDrawRangeElements(
+        int mode,
+        int start,
+        int end,
+        int count,
+        int type,
+        java.nio.Buffer indices
+    );
+
+    // C function void glDrawRangeElements ( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLsizei offset )
+
+    public static native void glDrawRangeElements(
+        int mode,
+        int start,
+        int end,
+        int count,
+        int type,
+        int offset
+    );
+
+    // C function void glTexImage3D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
+
+    public static native void glTexImage3D(
+        int target,
+        int level,
+        int internalformat,
+        int width,
+        int height,
+        int depth,
+        int border,
+        int format,
+        int type,
+        java.nio.Buffer pixels
+    );
+
+    // C function void glTexImage3D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLsizei offset )
+
+    public static native void glTexImage3D(
+        int target,
+        int level,
+        int internalformat,
+        int width,
+        int height,
+        int depth,
+        int border,
+        int format,
+        int type,
+        int offset
+    );
+
+    // C function void glTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels )
+
+    public static native void glTexSubImage3D(
+        int target,
+        int level,
+        int xoffset,
+        int yoffset,
+        int zoffset,
+        int width,
+        int height,
+        int depth,
+        int format,
+        int type,
+        java.nio.Buffer pixels
+    );
+
+    // C function void glTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei offset )
+
+    public static native void glTexSubImage3D(
+        int target,
+        int level,
+        int xoffset,
+        int yoffset,
+        int zoffset,
+        int width,
+        int height,
+        int depth,
+        int format,
+        int type,
+        int offset
+    );
+
+    // C function void glCopyTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height )
+
+    public static native void glCopyTexSubImage3D(
+        int target,
+        int level,
+        int xoffset,
+        int yoffset,
+        int zoffset,
+        int x,
+        int y,
+        int width,
+        int height
+    );
+
+    // C function void glCompressedTexImage3D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data )
+
+    public static native void glCompressedTexImage3D(
+        int target,
+        int level,
+        int internalformat,
+        int width,
+        int height,
+        int depth,
+        int border,
+        int imageSize,
+        java.nio.Buffer data
+    );
+
+    // C function void glCompressedTexImage3D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLsizei offset )
+
+    public static native void glCompressedTexImage3D(
+        int target,
+        int level,
+        int internalformat,
+        int width,
+        int height,
+        int depth,
+        int border,
+        int imageSize,
+        int offset
+    );
+
+    // C function void glCompressedTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data )
+
+    public static native void glCompressedTexSubImage3D(
+        int target,
+        int level,
+        int xoffset,
+        int yoffset,
+        int zoffset,
+        int width,
+        int height,
+        int depth,
+        int format,
+        int imageSize,
+        java.nio.Buffer data
+    );
+
+    // C function void glCompressedTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, GLsizei offset )
+
+    public static native void glCompressedTexSubImage3D(
+        int target,
+        int level,
+        int xoffset,
+        int yoffset,
+        int zoffset,
+        int width,
+        int height,
+        int depth,
+        int format,
+        int imageSize,
+        int offset
+    );
+
+    // C function void glGenQueries ( GLsizei n, GLuint *ids )
+
+    public static native void glGenQueries(
+        int n,
+        int[] ids,
+        int offset
+    );
+
+    // C function void glGenQueries ( GLsizei n, GLuint *ids )
+
+    public static native void glGenQueries(
+        int n,
+        java.nio.IntBuffer ids
+    );
+
+    // C function void glDeleteQueries ( GLsizei n, const GLuint *ids )
+
+    public static native void glDeleteQueries(
+        int n,
+        int[] ids,
+        int offset
+    );
+
+    // C function void glDeleteQueries ( GLsizei n, const GLuint *ids )
+
+    public static native void glDeleteQueries(
+        int n,
+        java.nio.IntBuffer ids
+    );
+
+    // C function GLboolean glIsQuery ( GLuint id )
+
+    public static native boolean glIsQuery(
+        int id
+    );
+
+    // C function void glBeginQuery ( GLenum target, GLuint id )
+
+    public static native void glBeginQuery(
+        int target,
+        int id
+    );
+
+    // C function void glEndQuery ( GLenum target )
+
+    public static native void glEndQuery(
+        int target
+    );
+
+    // C function void glGetQueryiv ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetQueryiv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetQueryiv ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetQueryiv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetQueryObjectuiv ( GLuint id, GLenum pname, GLuint *params )
+
+    public static native void glGetQueryObjectuiv(
+        int id,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetQueryObjectuiv ( GLuint id, GLenum pname, GLuint *params )
+
+    public static native void glGetQueryObjectuiv(
+        int id,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function GLboolean glUnmapBuffer ( GLenum target )
+
+    public static native boolean glUnmapBuffer(
+        int target
+    );
+
+    // C function void glGetBufferPointerv ( GLenum target, GLenum pname, GLvoid** params )
+
+    /**
+     * The {@link java.nio.Buffer} instance returned by this method is guaranteed
+     * to be an instance of {@link java.nio.ByteBuffer}.
+     */
+    public static native java.nio.Buffer glGetBufferPointerv(
+        int target,
+        int pname
+    );
+
+    // C function void glDrawBuffers ( GLsizei n, const GLenum *bufs )
+
+    public static native void glDrawBuffers(
+        int n,
+        int[] bufs,
+        int offset
+    );
+
+    // C function void glDrawBuffers ( GLsizei n, const GLenum *bufs )
+
+    public static native void glDrawBuffers(
+        int n,
+        java.nio.IntBuffer bufs
+    );
+
+    // C function void glUniformMatrix2x3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glUniformMatrix2x3fv(
+        int location,
+        int count,
+        boolean transpose,
+        float[] value,
+        int offset
+    );
+
+    // C function void glUniformMatrix2x3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glUniformMatrix2x3fv(
+        int location,
+        int count,
+        boolean transpose,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glUniformMatrix3x2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glUniformMatrix3x2fv(
+        int location,
+        int count,
+        boolean transpose,
+        float[] value,
+        int offset
+    );
+
+    // C function void glUniformMatrix3x2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glUniformMatrix3x2fv(
+        int location,
+        int count,
+        boolean transpose,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glUniformMatrix2x4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glUniformMatrix2x4fv(
+        int location,
+        int count,
+        boolean transpose,
+        float[] value,
+        int offset
+    );
+
+    // C function void glUniformMatrix2x4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glUniformMatrix2x4fv(
+        int location,
+        int count,
+        boolean transpose,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glUniformMatrix4x2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glUniformMatrix4x2fv(
+        int location,
+        int count,
+        boolean transpose,
+        float[] value,
+        int offset
+    );
+
+    // C function void glUniformMatrix4x2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glUniformMatrix4x2fv(
+        int location,
+        int count,
+        boolean transpose,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glUniformMatrix3x4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glUniformMatrix3x4fv(
+        int location,
+        int count,
+        boolean transpose,
+        float[] value,
+        int offset
+    );
+
+    // C function void glUniformMatrix3x4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glUniformMatrix3x4fv(
+        int location,
+        int count,
+        boolean transpose,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glUniformMatrix4x3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glUniformMatrix4x3fv(
+        int location,
+        int count,
+        boolean transpose,
+        float[] value,
+        int offset
+    );
+
+    // C function void glUniformMatrix4x3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glUniformMatrix4x3fv(
+        int location,
+        int count,
+        boolean transpose,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glBlitFramebuffer ( GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter )
+
+    public static native void glBlitFramebuffer(
+        int srcX0,
+        int srcY0,
+        int srcX1,
+        int srcY1,
+        int dstX0,
+        int dstY0,
+        int dstX1,
+        int dstY1,
+        int mask,
+        int filter
+    );
+
+    // C function void glRenderbufferStorageMultisample ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height )
+
+    public static native void glRenderbufferStorageMultisample(
+        int target,
+        int samples,
+        int internalformat,
+        int width,
+        int height
+    );
+
+    // C function void glFramebufferTextureLayer ( GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer )
+
+    public static native void glFramebufferTextureLayer(
+        int target,
+        int attachment,
+        int texture,
+        int level,
+        int layer
+    );
+
+    // C function GLvoid * glMapBufferRange ( GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access )
+
+    /**
+     * The {@link java.nio.Buffer} instance returned by this method is guaranteed
+     * to be an instance of {@link java.nio.ByteBuffer}.
+     */
+    public static native java.nio.Buffer glMapBufferRange(
+        int target,
+        int offset,
+        int length,
+        int access
+    );
+
+    // C function void glFlushMappedBufferRange ( GLenum target, GLintptr offset, GLsizeiptr length )
+
+    public static native void glFlushMappedBufferRange(
+        int target,
+        int offset,
+        int length
+    );
+
+    // C function void glBindVertexArray ( GLuint array )
+
+    public static native void glBindVertexArray(
+        int array
+    );
+
+    // C function void glDeleteVertexArrays ( GLsizei n, const GLuint *arrays )
+
+    public static native void glDeleteVertexArrays(
+        int n,
+        int[] arrays,
+        int offset
+    );
+
+    // C function void glDeleteVertexArrays ( GLsizei n, const GLuint *arrays )
+
+    public static native void glDeleteVertexArrays(
+        int n,
+        java.nio.IntBuffer arrays
+    );
+
+    // C function void glGenVertexArrays ( GLsizei n, GLuint *arrays )
+
+    public static native void glGenVertexArrays(
+        int n,
+        int[] arrays,
+        int offset
+    );
+
+    // C function void glGenVertexArrays ( GLsizei n, GLuint *arrays )
+
+    public static native void glGenVertexArrays(
+        int n,
+        java.nio.IntBuffer arrays
+    );
+
+    // C function GLboolean glIsVertexArray ( GLuint array )
+
+    public static native boolean glIsVertexArray(
+        int array
+    );
+
+    // C function void glGetIntegeri_v ( GLenum target, GLuint index, GLint *data )
+
+    public static native void glGetIntegeri_v(
+        int target,
+        int index,
+        int[] data,
+        int offset
+    );
+
+    // C function void glGetIntegeri_v ( GLenum target, GLuint index, GLint *data )
+
+    public static native void glGetIntegeri_v(
+        int target,
+        int index,
+        java.nio.IntBuffer data
+    );
+
+    // C function void glBeginTransformFeedback ( GLenum primitiveMode )
+
+    public static native void glBeginTransformFeedback(
+        int primitiveMode
+    );
+
+    // C function void glEndTransformFeedback ( void )
+
+    public static native void glEndTransformFeedback(
+    );
+
+    // C function void glBindBufferRange ( GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size )
+
+    public static native void glBindBufferRange(
+        int target,
+        int index,
+        int buffer,
+        int offset,
+        int size
+    );
+
+    // C function void glBindBufferBase ( GLenum target, GLuint index, GLuint buffer )
+
+    public static native void glBindBufferBase(
+        int target,
+        int index,
+        int buffer
+    );
+
+    // C function void glTransformFeedbackVaryings ( GLuint program, GLsizei count, const GLchar *varyings, GLenum bufferMode )
+
+    public static native void glTransformFeedbackVaryings(
+        int program,
+        String[] varyings,
+        int bufferMode
+    );
+
+    // C function void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name )
+
+    public static native void glGetTransformFeedbackVarying(
+        int program,
+        int index,
+        int bufsize,
+        int[] length,
+        int lengthOffset,
+        int[] size,
+        int sizeOffset,
+        int[] type,
+        int typeOffset,
+        byte[] name,
+        int nameOffset
+    );
+
+    // C function void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name )
+    /**
+     * @deprecated
+     * Use the version that takes a ByteBuffer as the last argument, or the versions that return a String.
+     * */
+    public static native void glGetTransformFeedbackVarying(
+        int program,
+        int index,
+        int bufsize,
+        java.nio.IntBuffer length,
+        java.nio.IntBuffer size,
+        java.nio.IntBuffer type,
+        byte name
+    );
+
+    // C function void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name )
+
+    public static native void glGetTransformFeedbackVarying(
+        int program,
+        int index,
+        int bufsize,
+        java.nio.IntBuffer length,
+        java.nio.IntBuffer size,
+        java.nio.IntBuffer type,
+        java.nio.ByteBuffer name
+    );
+
+    // C function void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name )
+
+    public static native String glGetTransformFeedbackVarying(
+        int program,
+        int index,
+        int[] size,
+        int sizeOffset,
+        int[] type,
+        int typeOffset
+    );
+
+    // C function void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name )
+
+    public static native String glGetTransformFeedbackVarying(
+        int program,
+        int index,
+        java.nio.IntBuffer size,
+        java.nio.IntBuffer type
+    );
+
+    // C function void glVertexAttribIPointer ( GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+
+    private static native void glVertexAttribIPointerBounds(
+        int index,
+        int size,
+        int type,
+        int stride,
+        java.nio.Buffer pointer,
+        int remaining
+    );
+
+    public static void glVertexAttribIPointer(
+        int index,
+        int size,
+        int type,
+        int stride,
+        java.nio.Buffer pointer
+    ) {
+        glVertexAttribIPointerBounds(
+            index,
+            size,
+            type,
+            stride,
+            pointer,
+            pointer.remaining()
+        );
+    }
+
+    // C function void glVertexAttribIPointer ( GLuint index, GLint size, GLenum type, GLsizei stride, GLsizei offset )
+
+    public static native void glVertexAttribIPointer(
+        int index,
+        int size,
+        int type,
+        int stride,
+        int offset
+    );
+
+    // C function void glGetVertexAttribIiv ( GLuint index, GLenum pname, GLint *params )
+
+    public static native void glGetVertexAttribIiv(
+        int index,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetVertexAttribIiv ( GLuint index, GLenum pname, GLint *params )
+
+    public static native void glGetVertexAttribIiv(
+        int index,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetVertexAttribIuiv ( GLuint index, GLenum pname, GLuint *params )
+
+    public static native void glGetVertexAttribIuiv(
+        int index,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetVertexAttribIuiv ( GLuint index, GLenum pname, GLuint *params )
+
+    public static native void glGetVertexAttribIuiv(
+        int index,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glVertexAttribI4i ( GLuint index, GLint x, GLint y, GLint z, GLint w )
+
+    public static native void glVertexAttribI4i(
+        int index,
+        int x,
+        int y,
+        int z,
+        int w
+    );
+
+    // C function void glVertexAttribI4ui ( GLuint index, GLuint x, GLuint y, GLuint z, GLuint w )
+
+    public static native void glVertexAttribI4ui(
+        int index,
+        int x,
+        int y,
+        int z,
+        int w
+    );
+
+    // C function void glVertexAttribI4iv ( GLuint index, const GLint *v )
+
+    public static native void glVertexAttribI4iv(
+        int index,
+        int[] v,
+        int offset
+    );
+
+    // C function void glVertexAttribI4iv ( GLuint index, const GLint *v )
+
+    public static native void glVertexAttribI4iv(
+        int index,
+        java.nio.IntBuffer v
+    );
+
+    // C function void glVertexAttribI4uiv ( GLuint index, const GLuint *v )
+
+    public static native void glVertexAttribI4uiv(
+        int index,
+        int[] v,
+        int offset
+    );
+
+    // C function void glVertexAttribI4uiv ( GLuint index, const GLuint *v )
+
+    public static native void glVertexAttribI4uiv(
+        int index,
+        java.nio.IntBuffer v
+    );
+
+    // C function void glGetUniformuiv ( GLuint program, GLint location, GLuint *params )
+
+    public static native void glGetUniformuiv(
+        int program,
+        int location,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetUniformuiv ( GLuint program, GLint location, GLuint *params )
+
+    public static native void glGetUniformuiv(
+        int program,
+        int location,
+        java.nio.IntBuffer params
+    );
+
+    // C function GLint glGetFragDataLocation ( GLuint program, const GLchar *name )
+
+    public static native int glGetFragDataLocation(
+        int program,
+        String name
+    );
+
+    // C function void glUniform1ui ( GLint location, GLuint v0 )
+
+    public static native void glUniform1ui(
+        int location,
+        int v0
+    );
+
+    // C function void glUniform2ui ( GLint location, GLuint v0, GLuint v1 )
+
+    public static native void glUniform2ui(
+        int location,
+        int v0,
+        int v1
+    );
+
+    // C function void glUniform3ui ( GLint location, GLuint v0, GLuint v1, GLuint v2 )
+
+    public static native void glUniform3ui(
+        int location,
+        int v0,
+        int v1,
+        int v2
+    );
+
+    // C function void glUniform4ui ( GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3 )
+
+    public static native void glUniform4ui(
+        int location,
+        int v0,
+        int v1,
+        int v2,
+        int v3
+    );
+
+    // C function void glUniform1uiv ( GLint location, GLsizei count, const GLuint *value )
+
+    public static native void glUniform1uiv(
+        int location,
+        int count,
+        int[] value,
+        int offset
+    );
+
+    // C function void glUniform1uiv ( GLint location, GLsizei count, const GLuint *value )
+
+    public static native void glUniform1uiv(
+        int location,
+        int count,
+        java.nio.IntBuffer value
+    );
+
+    // C function void glUniform2uiv ( GLint location, GLsizei count, const GLuint *value )
+
+    public static native void glUniform2uiv(
+        int location,
+        int count,
+        int[] value,
+        int offset
+    );
+
+    // C function void glUniform2uiv ( GLint location, GLsizei count, const GLuint *value )
+
+    public static native void glUniform2uiv(
+        int location,
+        int count,
+        java.nio.IntBuffer value
+    );
+
+    // C function void glUniform3uiv ( GLint location, GLsizei count, const GLuint *value )
+
+    public static native void glUniform3uiv(
+        int location,
+        int count,
+        int[] value,
+        int offset
+    );
+
+    // C function void glUniform3uiv ( GLint location, GLsizei count, const GLuint *value )
+
+    public static native void glUniform3uiv(
+        int location,
+        int count,
+        java.nio.IntBuffer value
+    );
+
+    // C function void glUniform4uiv ( GLint location, GLsizei count, const GLuint *value )
+
+    public static native void glUniform4uiv(
+        int location,
+        int count,
+        int[] value,
+        int offset
+    );
+
+    // C function void glUniform4uiv ( GLint location, GLsizei count, const GLuint *value )
+
+    public static native void glUniform4uiv(
+        int location,
+        int count,
+        java.nio.IntBuffer value
+    );
+
+    // C function void glClearBufferiv ( GLenum buffer, GLint drawbuffer, const GLint *value )
+
+    public static native void glClearBufferiv(
+        int buffer,
+        int drawbuffer,
+        int[] value,
+        int offset
+    );
+
+    // C function void glClearBufferiv ( GLenum buffer, GLint drawbuffer, const GLint *value )
+
+    public static native void glClearBufferiv(
+        int buffer,
+        int drawbuffer,
+        java.nio.IntBuffer value
+    );
+
+    // C function void glClearBufferuiv ( GLenum buffer, GLint drawbuffer, const GLuint *value )
+
+    public static native void glClearBufferuiv(
+        int buffer,
+        int drawbuffer,
+        int[] value,
+        int offset
+    );
+
+    // C function void glClearBufferuiv ( GLenum buffer, GLint drawbuffer, const GLuint *value )
+
+    public static native void glClearBufferuiv(
+        int buffer,
+        int drawbuffer,
+        java.nio.IntBuffer value
+    );
+
+    // C function void glClearBufferfv ( GLenum buffer, GLint drawbuffer, const GLfloat *value )
+
+    public static native void glClearBufferfv(
+        int buffer,
+        int drawbuffer,
+        float[] value,
+        int offset
+    );
+
+    // C function void glClearBufferfv ( GLenum buffer, GLint drawbuffer, const GLfloat *value )
+
+    public static native void glClearBufferfv(
+        int buffer,
+        int drawbuffer,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glClearBufferfi ( GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil )
+
+    public static native void glClearBufferfi(
+        int buffer,
+        int drawbuffer,
+        float depth,
+        int stencil
+    );
+
+    // C function const GLubyte * glGetStringi ( GLenum name, GLuint index )
+
+    public static native String glGetStringi(
+        int name,
+        int index
+    );
+
+    // C function void glCopyBufferSubData ( GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size )
+
+    public static native void glCopyBufferSubData(
+        int readTarget,
+        int writeTarget,
+        int readOffset,
+        int writeOffset,
+        int size
+    );
+
+    // C function void glGetUniformIndices ( GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices )
+
+    public static native void glGetUniformIndices(
+        int program,
+        String[] uniformNames,
+        int[] uniformIndices,
+        int uniformIndicesOffset
+    );
+
+    // C function void glGetUniformIndices ( GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices )
+
+    public static native void glGetUniformIndices(
+        int program,
+        String[] uniformNames,
+        java.nio.IntBuffer uniformIndices
+    );
+
+    // C function void glGetActiveUniformsiv ( GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params )
+
+    public static native void glGetActiveUniformsiv(
+        int program,
+        int uniformCount,
+        int[] uniformIndices,
+        int uniformIndicesOffset,
+        int pname,
+        int[] params,
+        int paramsOffset
+    );
+
+    // C function void glGetActiveUniformsiv ( GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params )
+
+    public static native void glGetActiveUniformsiv(
+        int program,
+        int uniformCount,
+        java.nio.IntBuffer uniformIndices,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function GLuint glGetUniformBlockIndex ( GLuint program, const GLchar *uniformBlockName )
+
+    public static native int glGetUniformBlockIndex(
+        int program,
+        String uniformBlockName
+    );
+
+    // C function void glGetActiveUniformBlockiv ( GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params )
+
+    public static native void glGetActiveUniformBlockiv(
+        int program,
+        int uniformBlockIndex,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetActiveUniformBlockiv ( GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params )
+
+    public static native void glGetActiveUniformBlockiv(
+        int program,
+        int uniformBlockIndex,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName )
+
+    public static native void glGetActiveUniformBlockName(
+        int program,
+        int uniformBlockIndex,
+        int bufSize,
+        int[] length,
+        int lengthOffset,
+        byte[] uniformBlockName,
+        int uniformBlockNameOffset
+    );
+
+    // C function void glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName )
+
+    public static native void glGetActiveUniformBlockName(
+        int program,
+        int uniformBlockIndex,
+        java.nio.Buffer length,
+        java.nio.Buffer uniformBlockName
+    );
+
+    // C function void glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName )
+
+    public static native String glGetActiveUniformBlockName(
+        int program,
+        int uniformBlockIndex
+    );
+
+    // C function void glUniformBlockBinding ( GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding )
+
+    public static native void glUniformBlockBinding(
+        int program,
+        int uniformBlockIndex,
+        int uniformBlockBinding
+    );
+
+    // C function void glDrawArraysInstanced ( GLenum mode, GLint first, GLsizei count, GLsizei instanceCount )
+
+    public static native void glDrawArraysInstanced(
+        int mode,
+        int first,
+        int count,
+        int instanceCount
+    );
+
+    // C function void glDrawElementsInstanced ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount )
+
+    public static native void glDrawElementsInstanced(
+        int mode,
+        int count,
+        int type,
+        java.nio.Buffer indices,
+        int instanceCount
+    );
+
+    // C function void glDrawElementsInstanced ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount )
+
+    public static native void glDrawElementsInstanced(
+        int mode,
+        int count,
+        int type,
+        int indicesOffset,
+        int instanceCount
+    );
+
+    // C function GLsync glFenceSync ( GLenum condition, GLbitfield flags )
+
+    public static native long glFenceSync(
+        int condition,
+        int flags
+    );
+
+    // C function GLboolean glIsSync ( GLsync sync )
+
+    public static native boolean glIsSync(
+        long sync
+    );
+
+    // C function void glDeleteSync ( GLsync sync )
+
+    public static native void glDeleteSync(
+        long sync
+    );
+
+    // C function GLenum glClientWaitSync ( GLsync sync, GLbitfield flags, GLuint64 timeout )
+
+    public static native int glClientWaitSync(
+        long sync,
+        int flags,
+        long timeout
+    );
+
+    // C function void glWaitSync ( GLsync sync, GLbitfield flags, GLuint64 timeout )
+
+    public static native void glWaitSync(
+        long sync,
+        int flags,
+        long timeout
+    );
+
+    // C function void glGetInteger64v ( GLenum pname, GLint64 *params )
+
+    public static native void glGetInteger64v(
+        int pname,
+        long[] params,
+        int offset
+    );
+
+    // C function void glGetInteger64v ( GLenum pname, GLint64 *params )
+
+    public static native void glGetInteger64v(
+        int pname,
+        java.nio.LongBuffer params
+    );
+
+    // C function void glGetSynciv ( GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values )
+
+    public static native void glGetSynciv(
+        long sync,
+        int pname,
+        int bufSize,
+        int[] length,
+        int lengthOffset,
+        int[] values,
+        int valuesOffset
+    );
+
+    // C function void glGetSynciv ( GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values )
+
+    public static native void glGetSynciv(
+        long sync,
+        int pname,
+        int bufSize,
+        java.nio.IntBuffer length,
+        java.nio.IntBuffer values
+    );
+
+    // C function void glGetInteger64i_v ( GLenum target, GLuint index, GLint64 *data )
+
+    public static native void glGetInteger64i_v(
+        int target,
+        int index,
+        long[] data,
+        int offset
+    );
+
+    // C function void glGetInteger64i_v ( GLenum target, GLuint index, GLint64 *data )
+
+    public static native void glGetInteger64i_v(
+        int target,
+        int index,
+        java.nio.LongBuffer data
+    );
+
+    // C function void glGetBufferParameteri64v ( GLenum target, GLenum pname, GLint64 *params )
+
+    public static native void glGetBufferParameteri64v(
+        int target,
+        int pname,
+        long[] params,
+        int offset
+    );
+
+    // C function void glGetBufferParameteri64v ( GLenum target, GLenum pname, GLint64 *params )
+
+    public static native void glGetBufferParameteri64v(
+        int target,
+        int pname,
+        java.nio.LongBuffer params
+    );
+
+    // C function void glGenSamplers ( GLsizei count, GLuint *samplers )
+
+    public static native void glGenSamplers(
+        int count,
+        int[] samplers,
+        int offset
+    );
+
+    // C function void glGenSamplers ( GLsizei count, GLuint *samplers )
+
+    public static native void glGenSamplers(
+        int count,
+        java.nio.IntBuffer samplers
+    );
+
+    // C function void glDeleteSamplers ( GLsizei count, const GLuint *samplers )
+
+    public static native void glDeleteSamplers(
+        int count,
+        int[] samplers,
+        int offset
+    );
+
+    // C function void glDeleteSamplers ( GLsizei count, const GLuint *samplers )
+
+    public static native void glDeleteSamplers(
+        int count,
+        java.nio.IntBuffer samplers
+    );
+
+    // C function GLboolean glIsSampler ( GLuint sampler )
+
+    public static native boolean glIsSampler(
+        int sampler
+    );
+
+    // C function void glBindSampler ( GLuint unit, GLuint sampler )
+
+    public static native void glBindSampler(
+        int unit,
+        int sampler
+    );
+
+    // C function void glSamplerParameteri ( GLuint sampler, GLenum pname, GLint param )
+
+    public static native void glSamplerParameteri(
+        int sampler,
+        int pname,
+        int param
+    );
+
+    // C function void glSamplerParameteriv ( GLuint sampler, GLenum pname, const GLint *param )
+
+    public static native void glSamplerParameteriv(
+        int sampler,
+        int pname,
+        int[] param,
+        int offset
+    );
+
+    // C function void glSamplerParameteriv ( GLuint sampler, GLenum pname, const GLint *param )
+
+    public static native void glSamplerParameteriv(
+        int sampler,
+        int pname,
+        java.nio.IntBuffer param
+    );
+
+    // C function void glSamplerParameterf ( GLuint sampler, GLenum pname, GLfloat param )
+
+    public static native void glSamplerParameterf(
+        int sampler,
+        int pname,
+        float param
+    );
+
+    // C function void glSamplerParameterfv ( GLuint sampler, GLenum pname, const GLfloat *param )
+
+    public static native void glSamplerParameterfv(
+        int sampler,
+        int pname,
+        float[] param,
+        int offset
+    );
+
+    // C function void glSamplerParameterfv ( GLuint sampler, GLenum pname, const GLfloat *param )
+
+    public static native void glSamplerParameterfv(
+        int sampler,
+        int pname,
+        java.nio.FloatBuffer param
+    );
+
+    // C function void glGetSamplerParameteriv ( GLuint sampler, GLenum pname, GLint *params )
+
+    public static native void glGetSamplerParameteriv(
+        int sampler,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetSamplerParameteriv ( GLuint sampler, GLenum pname, GLint *params )
+
+    public static native void glGetSamplerParameteriv(
+        int sampler,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetSamplerParameterfv ( GLuint sampler, GLenum pname, GLfloat *params )
+
+    public static native void glGetSamplerParameterfv(
+        int sampler,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glGetSamplerParameterfv ( GLuint sampler, GLenum pname, GLfloat *params )
+
+    public static native void glGetSamplerParameterfv(
+        int sampler,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glVertexAttribDivisor ( GLuint index, GLuint divisor )
+
+    public static native void glVertexAttribDivisor(
+        int index,
+        int divisor
+    );
+
+    // C function void glBindTransformFeedback ( GLenum target, GLuint id )
+
+    public static native void glBindTransformFeedback(
+        int target,
+        int id
+    );
+
+    // C function void glDeleteTransformFeedbacks ( GLsizei n, const GLuint *ids )
+
+    public static native void glDeleteTransformFeedbacks(
+        int n,
+        int[] ids,
+        int offset
+    );
+
+    // C function void glDeleteTransformFeedbacks ( GLsizei n, const GLuint *ids )
+
+    public static native void glDeleteTransformFeedbacks(
+        int n,
+        java.nio.IntBuffer ids
+    );
+
+    // C function void glGenTransformFeedbacks ( GLsizei n, GLuint *ids )
+
+    public static native void glGenTransformFeedbacks(
+        int n,
+        int[] ids,
+        int offset
+    );
+
+    // C function void glGenTransformFeedbacks ( GLsizei n, GLuint *ids )
+
+    public static native void glGenTransformFeedbacks(
+        int n,
+        java.nio.IntBuffer ids
+    );
+
+    // C function GLboolean glIsTransformFeedback ( GLuint id )
+
+    public static native boolean glIsTransformFeedback(
+        int id
+    );
+
+    // C function void glPauseTransformFeedback ( void )
+
+    public static native void glPauseTransformFeedback(
+    );
+
+    // C function void glResumeTransformFeedback ( void )
+
+    public static native void glResumeTransformFeedback(
+    );
+
+    // C function void glGetProgramBinary ( GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary )
+
+    public static native void glGetProgramBinary(
+        int program,
+        int bufSize,
+        int[] length,
+        int lengthOffset,
+        int[] binaryFormat,
+        int binaryFormatOffset,
+        java.nio.Buffer binary
+    );
+
+    // C function void glGetProgramBinary ( GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary )
+
+    public static native void glGetProgramBinary(
+        int program,
+        int bufSize,
+        java.nio.IntBuffer length,
+        java.nio.IntBuffer binaryFormat,
+        java.nio.Buffer binary
+    );
+
+    // C function void glProgramBinary ( GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length )
+
+    public static native void glProgramBinary(
+        int program,
+        int binaryFormat,
+        java.nio.Buffer binary,
+        int length
+    );
+
+    // C function void glProgramParameteri ( GLuint program, GLenum pname, GLint value )
+
+    public static native void glProgramParameteri(
+        int program,
+        int pname,
+        int value
+    );
+
+    // C function void glInvalidateFramebuffer ( GLenum target, GLsizei numAttachments, const GLenum *attachments )
+
+    public static native void glInvalidateFramebuffer(
+        int target,
+        int numAttachments,
+        int[] attachments,
+        int offset
+    );
+
+    // C function void glInvalidateFramebuffer ( GLenum target, GLsizei numAttachments, const GLenum *attachments )
+
+    public static native void glInvalidateFramebuffer(
+        int target,
+        int numAttachments,
+        java.nio.IntBuffer attachments
+    );
+
+    // C function void glInvalidateSubFramebuffer ( GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height )
+
+    public static native void glInvalidateSubFramebuffer(
+        int target,
+        int numAttachments,
+        int[] attachments,
+        int offset,
+        int x,
+        int y,
+        int width,
+        int height
+    );
+
+    // C function void glInvalidateSubFramebuffer ( GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height )
+
+    public static native void glInvalidateSubFramebuffer(
+        int target,
+        int numAttachments,
+        java.nio.IntBuffer attachments,
+        int x,
+        int y,
+        int width,
+        int height
+    );
+
+    // C function void glTexStorage2D ( GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height )
+
+    public static native void glTexStorage2D(
+        int target,
+        int levels,
+        int internalformat,
+        int width,
+        int height
+    );
+
+    // C function void glTexStorage3D ( GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth )
+
+    public static native void glTexStorage3D(
+        int target,
+        int levels,
+        int internalformat,
+        int width,
+        int height,
+        int depth
+    );
+
+    // C function void glGetInternalformativ ( GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params )
+
+    public static native void glGetInternalformativ(
+        int target,
+        int internalformat,
+        int pname,
+        int bufSize,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetInternalformativ ( GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params )
+
+    public static native void glGetInternalformativ(
+        int target,
+        int internalformat,
+        int pname,
+        int bufSize,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint offset )
+
+    public static native void glReadPixels(
+        int x,
+        int y,
+        int width,
+        int height,
+        int format,
+        int type,
+        int offset
+    );
+
+}
diff --git a/android/opengl/GLES31.java b/android/opengl/GLES31.java
new file mode 100644
index 0000000..679108f
--- /dev/null
+++ b/android/opengl/GLES31.java
@@ -0,0 +1,1106 @@
+/*
+ * Copyright 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// This source file is automatically generated
+
+package android.opengl;
+
+/** OpenGL ES 3.1
+ */
+public class GLES31 extends GLES30 {
+
+    public static final int GL_VERTEX_SHADER_BIT                            = 0x00000001;
+    public static final int GL_FRAGMENT_SHADER_BIT                          = 0x00000002;
+    public static final int GL_COMPUTE_SHADER_BIT                           = 0x00000020;
+    public static final int GL_ALL_SHADER_BITS                              = -1; // 0xFFFFFFFF
+
+    public static final int GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT              = 0x00000001;
+    public static final int GL_ELEMENT_ARRAY_BARRIER_BIT                    = 0x00000002;
+    public static final int GL_UNIFORM_BARRIER_BIT                          = 0x00000004;
+    public static final int GL_TEXTURE_FETCH_BARRIER_BIT                    = 0x00000008;
+    public static final int GL_SHADER_IMAGE_ACCESS_BARRIER_BIT              = 0x00000020;
+    public static final int GL_COMMAND_BARRIER_BIT                          = 0x00000040;
+    public static final int GL_PIXEL_BUFFER_BARRIER_BIT                     = 0x00000080;
+    public static final int GL_TEXTURE_UPDATE_BARRIER_BIT                   = 0x00000100;
+    public static final int GL_BUFFER_UPDATE_BARRIER_BIT                    = 0x00000200;
+    public static final int GL_FRAMEBUFFER_BARRIER_BIT                      = 0x00000400;
+    public static final int GL_TRANSFORM_FEEDBACK_BARRIER_BIT               = 0x00000800;
+    public static final int GL_ATOMIC_COUNTER_BARRIER_BIT                   = 0x00001000;
+    public static final int GL_SHADER_STORAGE_BARRIER_BIT                   = 0x00002000;
+    public static final int GL_ALL_BARRIER_BITS                             = -1; // 0xFFFFFFFF
+
+
+    public static final int GL_TEXTURE_WIDTH                                = 0x1000;
+    public static final int GL_TEXTURE_HEIGHT                               = 0x1001;
+    public static final int GL_TEXTURE_INTERNAL_FORMAT                      = 0x1003;
+    public static final int GL_STENCIL_INDEX                                = 0x1901;
+    public static final int GL_TEXTURE_RED_SIZE                             = 0x805C;
+    public static final int GL_TEXTURE_GREEN_SIZE                           = 0x805D;
+    public static final int GL_TEXTURE_BLUE_SIZE                            = 0x805E;
+    public static final int GL_TEXTURE_ALPHA_SIZE                           = 0x805F;
+    public static final int GL_TEXTURE_DEPTH                                = 0x8071;
+    public static final int GL_PROGRAM_SEPARABLE                            = 0x8258;
+    public static final int GL_ACTIVE_PROGRAM                               = 0x8259;
+    public static final int GL_PROGRAM_PIPELINE_BINDING                     = 0x825A;
+    public static final int GL_MAX_COMPUTE_SHARED_MEMORY_SIZE               = 0x8262;
+    public static final int GL_MAX_COMPUTE_UNIFORM_COMPONENTS               = 0x8263;
+    public static final int GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS           = 0x8264;
+    public static final int GL_MAX_COMPUTE_ATOMIC_COUNTERS                  = 0x8265;
+    public static final int GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS      = 0x8266;
+    public static final int GL_COMPUTE_WORK_GROUP_SIZE                      = 0x8267;
+    public static final int GL_MAX_UNIFORM_LOCATIONS                        = 0x826E;
+    public static final int GL_VERTEX_ATTRIB_BINDING                        = 0x82D4;
+    public static final int GL_VERTEX_ATTRIB_RELATIVE_OFFSET                = 0x82D5;
+    public static final int GL_VERTEX_BINDING_DIVISOR                       = 0x82D6;
+    public static final int GL_VERTEX_BINDING_OFFSET                        = 0x82D7;
+    public static final int GL_VERTEX_BINDING_STRIDE                        = 0x82D8;
+    public static final int GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET            = 0x82D9;
+    public static final int GL_MAX_VERTEX_ATTRIB_BINDINGS                   = 0x82DA;
+    public static final int GL_MAX_VERTEX_ATTRIB_STRIDE                     = 0x82E5;
+    public static final int GL_TEXTURE_COMPRESSED                           = 0x86A1;
+    public static final int GL_TEXTURE_DEPTH_SIZE                           = 0x884A;
+    public static final int GL_READ_ONLY                                    = 0x88B8;
+    public static final int GL_WRITE_ONLY                                   = 0x88B9;
+    public static final int GL_READ_WRITE                                   = 0x88BA;
+    public static final int GL_TEXTURE_STENCIL_SIZE                         = 0x88F1;
+    public static final int GL_TEXTURE_RED_TYPE                             = 0x8C10;
+    public static final int GL_TEXTURE_GREEN_TYPE                           = 0x8C11;
+    public static final int GL_TEXTURE_BLUE_TYPE                            = 0x8C12;
+    public static final int GL_TEXTURE_ALPHA_TYPE                           = 0x8C13;
+    public static final int GL_TEXTURE_DEPTH_TYPE                           = 0x8C16;
+    public static final int GL_TEXTURE_SHARED_SIZE                          = 0x8C3F;
+    public static final int GL_SAMPLE_POSITION                              = 0x8E50;
+    public static final int GL_SAMPLE_MASK                                  = 0x8E51;
+    public static final int GL_SAMPLE_MASK_VALUE                            = 0x8E52;
+    public static final int GL_MAX_SAMPLE_MASK_WORDS                        = 0x8E59;
+    public static final int GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET            = 0x8E5E;
+    public static final int GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET            = 0x8E5F;
+    public static final int GL_MAX_IMAGE_UNITS                              = 0x8F38;
+    public static final int GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES         = 0x8F39;
+    public static final int GL_IMAGE_BINDING_NAME                           = 0x8F3A;
+    public static final int GL_IMAGE_BINDING_LEVEL                          = 0x8F3B;
+    public static final int GL_IMAGE_BINDING_LAYERED                        = 0x8F3C;
+    public static final int GL_IMAGE_BINDING_LAYER                          = 0x8F3D;
+    public static final int GL_IMAGE_BINDING_ACCESS                         = 0x8F3E;
+    public static final int GL_DRAW_INDIRECT_BUFFER                         = 0x8F3F;
+    public static final int GL_DRAW_INDIRECT_BUFFER_BINDING                 = 0x8F43;
+    public static final int GL_VERTEX_BINDING_BUFFER                        = 0x8F4F;
+    public static final int GL_IMAGE_2D                                     = 0x904D;
+    public static final int GL_IMAGE_3D                                     = 0x904E;
+    public static final int GL_IMAGE_CUBE                                   = 0x9050;
+    public static final int GL_IMAGE_2D_ARRAY                               = 0x9053;
+    public static final int GL_INT_IMAGE_2D                                 = 0x9058;
+    public static final int GL_INT_IMAGE_3D                                 = 0x9059;
+    public static final int GL_INT_IMAGE_CUBE                               = 0x905B;
+    public static final int GL_INT_IMAGE_2D_ARRAY                           = 0x905E;
+    public static final int GL_UNSIGNED_INT_IMAGE_2D                        = 0x9063;
+    public static final int GL_UNSIGNED_INT_IMAGE_3D                        = 0x9064;
+    public static final int GL_UNSIGNED_INT_IMAGE_CUBE                      = 0x9066;
+    public static final int GL_UNSIGNED_INT_IMAGE_2D_ARRAY                  = 0x9069;
+    public static final int GL_IMAGE_BINDING_FORMAT                         = 0x906E;
+    public static final int GL_IMAGE_FORMAT_COMPATIBILITY_TYPE              = 0x90C7;
+    public static final int GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE           = 0x90C8;
+    public static final int GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS          = 0x90C9;
+    public static final int GL_MAX_VERTEX_IMAGE_UNIFORMS                    = 0x90CA;
+    public static final int GL_MAX_FRAGMENT_IMAGE_UNIFORMS                  = 0x90CE;
+    public static final int GL_MAX_COMBINED_IMAGE_UNIFORMS                  = 0x90CF;
+    public static final int GL_SHADER_STORAGE_BUFFER                        = 0x90D2;
+    public static final int GL_SHADER_STORAGE_BUFFER_BINDING                = 0x90D3;
+    public static final int GL_SHADER_STORAGE_BUFFER_START                  = 0x90D4;
+    public static final int GL_SHADER_STORAGE_BUFFER_SIZE                   = 0x90D5;
+    public static final int GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS             = 0x90D6;
+    public static final int GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS           = 0x90DA;
+    public static final int GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS            = 0x90DB;
+    public static final int GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS           = 0x90DC;
+    public static final int GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS           = 0x90DD;
+    public static final int GL_MAX_SHADER_STORAGE_BLOCK_SIZE                = 0x90DE;
+    public static final int GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT       = 0x90DF;
+    public static final int GL_DEPTH_STENCIL_TEXTURE_MODE                   = 0x90EA;
+    public static final int GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS           = 0x90EB;
+    public static final int GL_DISPATCH_INDIRECT_BUFFER                     = 0x90EE;
+    public static final int GL_DISPATCH_INDIRECT_BUFFER_BINDING             = 0x90EF;
+    public static final int GL_TEXTURE_2D_MULTISAMPLE                       = 0x9100;
+    public static final int GL_TEXTURE_BINDING_2D_MULTISAMPLE               = 0x9104;
+    public static final int GL_TEXTURE_SAMPLES                              = 0x9106;
+    public static final int GL_TEXTURE_FIXED_SAMPLE_LOCATIONS               = 0x9107;
+    public static final int GL_SAMPLER_2D_MULTISAMPLE                       = 0x9108;
+    public static final int GL_INT_SAMPLER_2D_MULTISAMPLE                   = 0x9109;
+    public static final int GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE          = 0x910A;
+    public static final int GL_MAX_COLOR_TEXTURE_SAMPLES                    = 0x910E;
+    public static final int GL_MAX_DEPTH_TEXTURE_SAMPLES                    = 0x910F;
+    public static final int GL_MAX_INTEGER_SAMPLES                          = 0x9110;
+    public static final int GL_COMPUTE_SHADER                               = 0x91B9;
+    public static final int GL_MAX_COMPUTE_UNIFORM_BLOCKS                   = 0x91BB;
+    public static final int GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS              = 0x91BC;
+    public static final int GL_MAX_COMPUTE_IMAGE_UNIFORMS                   = 0x91BD;
+    public static final int GL_MAX_COMPUTE_WORK_GROUP_COUNT                 = 0x91BE;
+    public static final int GL_MAX_COMPUTE_WORK_GROUP_SIZE                  = 0x91BF;
+    public static final int GL_ATOMIC_COUNTER_BUFFER                        = 0x92C0;
+    public static final int GL_ATOMIC_COUNTER_BUFFER_BINDING                = 0x92C1;
+    public static final int GL_ATOMIC_COUNTER_BUFFER_START                  = 0x92C2;
+    public static final int GL_ATOMIC_COUNTER_BUFFER_SIZE                   = 0x92C3;
+    public static final int GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS            = 0x92CC;
+    public static final int GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS          = 0x92D0;
+    public static final int GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS          = 0x92D1;
+    public static final int GL_MAX_VERTEX_ATOMIC_COUNTERS                   = 0x92D2;
+    public static final int GL_MAX_FRAGMENT_ATOMIC_COUNTERS                 = 0x92D6;
+    public static final int GL_MAX_COMBINED_ATOMIC_COUNTERS                 = 0x92D7;
+    public static final int GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE               = 0x92D8;
+    public static final int GL_ACTIVE_ATOMIC_COUNTER_BUFFERS                = 0x92D9;
+    public static final int GL_UNSIGNED_INT_ATOMIC_COUNTER                  = 0x92DB;
+    public static final int GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS           = 0x92DC;
+    public static final int GL_UNIFORM                                      = 0x92E1;
+    public static final int GL_UNIFORM_BLOCK                                = 0x92E2;
+    public static final int GL_PROGRAM_INPUT                                = 0x92E3;
+    public static final int GL_PROGRAM_OUTPUT                               = 0x92E4;
+    public static final int GL_BUFFER_VARIABLE                              = 0x92E5;
+    public static final int GL_SHADER_STORAGE_BLOCK                         = 0x92E6;
+    public static final int GL_TRANSFORM_FEEDBACK_VARYING                   = 0x92F4;
+    public static final int GL_ACTIVE_RESOURCES                             = 0x92F5;
+    public static final int GL_MAX_NAME_LENGTH                              = 0x92F6;
+    public static final int GL_MAX_NUM_ACTIVE_VARIABLES                     = 0x92F7;
+    public static final int GL_NAME_LENGTH                                  = 0x92F9;
+    public static final int GL_TYPE                                         = 0x92FA;
+    public static final int GL_ARRAY_SIZE                                   = 0x92FB;
+    public static final int GL_OFFSET                                       = 0x92FC;
+    public static final int GL_BLOCK_INDEX                                  = 0x92FD;
+    public static final int GL_ARRAY_STRIDE                                 = 0x92FE;
+    public static final int GL_MATRIX_STRIDE                                = 0x92FF;
+    public static final int GL_IS_ROW_MAJOR                                 = 0x9300;
+    public static final int GL_ATOMIC_COUNTER_BUFFER_INDEX                  = 0x9301;
+    public static final int GL_BUFFER_BINDING                               = 0x9302;
+    public static final int GL_BUFFER_DATA_SIZE                             = 0x9303;
+    public static final int GL_NUM_ACTIVE_VARIABLES                         = 0x9304;
+    public static final int GL_ACTIVE_VARIABLES                             = 0x9305;
+    public static final int GL_REFERENCED_BY_VERTEX_SHADER                  = 0x9306;
+    public static final int GL_REFERENCED_BY_FRAGMENT_SHADER                = 0x930A;
+    public static final int GL_REFERENCED_BY_COMPUTE_SHADER                 = 0x930B;
+    public static final int GL_TOP_LEVEL_ARRAY_SIZE                         = 0x930C;
+    public static final int GL_TOP_LEVEL_ARRAY_STRIDE                       = 0x930D;
+    public static final int GL_LOCATION                                     = 0x930E;
+    public static final int GL_FRAMEBUFFER_DEFAULT_WIDTH                    = 0x9310;
+    public static final int GL_FRAMEBUFFER_DEFAULT_HEIGHT                   = 0x9311;
+    public static final int GL_FRAMEBUFFER_DEFAULT_SAMPLES                  = 0x9313;
+    public static final int GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS   = 0x9314;
+    public static final int GL_MAX_FRAMEBUFFER_WIDTH                        = 0x9315;
+    public static final int GL_MAX_FRAMEBUFFER_HEIGHT                       = 0x9316;
+    public static final int GL_MAX_FRAMEBUFFER_SAMPLES                      = 0x9318;
+
+    native private static void _nativeClassInit();
+    static {
+        _nativeClassInit();
+    }
+
+    /** @hide */
+    GLES31() {}
+    // C function void glDispatchCompute ( GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z )
+
+    public static native void glDispatchCompute(
+        int num_groups_x,
+        int num_groups_y,
+        int num_groups_z
+    );
+
+    // C function void glDispatchComputeIndirect ( GLintptr indirect );
+
+    public static native void glDispatchComputeIndirect(long indirect);
+
+    // C function void glDrawArraysIndirect ( GLenum mode, const void *indirect );
+
+    public static native void glDrawArraysIndirect(int mode, long indirect);
+
+    // C function glDrawElementsIndirect ( GLenum mode, GLenum type, const void *indirect );
+
+    public static native void glDrawElementsIndirect(int mode, int type, long indirect);
+
+    // C function void glFramebufferParameteri ( GLenum target, GLenum pname, GLint param )
+
+    public static native void glFramebufferParameteri(
+        int target,
+        int pname,
+        int param
+    );
+
+    // C function void glGetFramebufferParameteriv ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetFramebufferParameteriv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetFramebufferParameteriv ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetFramebufferParameteriv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetProgramInterfaceiv ( GLuint program, GLenum programInterface, GLenum pname, GLint *params )
+
+    public static native void glGetProgramInterfaceiv(
+        int program,
+        int programInterface,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetProgramInterfaceiv ( GLuint program, GLenum programInterface, GLenum pname, GLint *params )
+
+    public static native void glGetProgramInterfaceiv(
+        int program,
+        int programInterface,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function GLuint glGetProgramResourceIndex ( GLuint program, GLenum programInterface, const GLchar *name )
+
+    public static native int glGetProgramResourceIndex(
+        int program,
+        int programInterface,
+        String name
+    );
+
+    // C function void glGetProgramResourceName ( GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name )
+
+    public static native String glGetProgramResourceName(
+        int program,
+        int programInterface,
+        int index
+    );
+
+    // C function void glGetProgramResourceiv ( GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params )
+
+    public static native void glGetProgramResourceiv(
+        int program,
+        int programInterface,
+        int index,
+        int propCount,
+        int[] props,
+        int propsOffset,
+        int bufSize,
+        int[] length,
+        int lengthOffset,
+        int[] params,
+        int paramsOffset
+    );
+
+    // C function void glGetProgramResourceiv ( GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params )
+
+    public static native void glGetProgramResourceiv(
+        int program,
+        int programInterface,
+        int index,
+        int propCount,
+        java.nio.IntBuffer props,
+        int bufSize,
+        java.nio.IntBuffer length,
+        java.nio.IntBuffer params
+    );
+
+    // C function GLint glGetProgramResourceLocation ( GLuint program, GLenum programInterface, const GLchar *name )
+
+    public static native int glGetProgramResourceLocation(
+        int program,
+        int programInterface,
+        String name
+    );
+
+    // C function void glUseProgramStages ( GLuint pipeline, GLbitfield stages, GLuint program )
+
+    public static native void glUseProgramStages(
+        int pipeline,
+        int stages,
+        int program
+    );
+
+    // C function void glActiveShaderProgram ( GLuint pipeline, GLuint program )
+
+    public static native void glActiveShaderProgram(
+        int pipeline,
+        int program
+    );
+
+    // C function GLuint glCreateShaderProgramv ( GLenum type, GLsizei count, const GLchar *const *strings )
+
+    public static native int glCreateShaderProgramv(
+        int type,
+        String[] strings
+    );
+
+    // C function void glBindProgramPipeline ( GLuint pipeline )
+
+    public static native void glBindProgramPipeline(
+        int pipeline
+    );
+
+    // C function void glDeleteProgramPipelines ( GLsizei n, const GLuint *pipelines )
+
+    public static native void glDeleteProgramPipelines(
+        int n,
+        int[] pipelines,
+        int offset
+    );
+
+    // C function void glDeleteProgramPipelines ( GLsizei n, const GLuint *pipelines )
+
+    public static native void glDeleteProgramPipelines(
+        int n,
+        java.nio.IntBuffer pipelines
+    );
+
+    // C function void glGenProgramPipelines ( GLsizei n, GLuint *pipelines )
+
+    public static native void glGenProgramPipelines(
+        int n,
+        int[] pipelines,
+        int offset
+    );
+
+    // C function void glGenProgramPipelines ( GLsizei n, GLuint *pipelines )
+
+    public static native void glGenProgramPipelines(
+        int n,
+        java.nio.IntBuffer pipelines
+    );
+
+    // C function GLboolean glIsProgramPipeline ( GLuint pipeline )
+
+    public static native boolean glIsProgramPipeline(
+        int pipeline
+    );
+
+    // C function void glGetProgramPipelineiv ( GLuint pipeline, GLenum pname, GLint *params )
+
+    public static native void glGetProgramPipelineiv(
+        int pipeline,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetProgramPipelineiv ( GLuint pipeline, GLenum pname, GLint *params )
+
+    public static native void glGetProgramPipelineiv(
+        int pipeline,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glProgramUniform1i ( GLuint program, GLint location, GLint v0 )
+
+    public static native void glProgramUniform1i(
+        int program,
+        int location,
+        int v0
+    );
+
+    // C function void glProgramUniform2i ( GLuint program, GLint location, GLint v0, GLint v1 )
+
+    public static native void glProgramUniform2i(
+        int program,
+        int location,
+        int v0,
+        int v1
+    );
+
+    // C function void glProgramUniform3i ( GLuint program, GLint location, GLint v0, GLint v1, GLint v2 )
+
+    public static native void glProgramUniform3i(
+        int program,
+        int location,
+        int v0,
+        int v1,
+        int v2
+    );
+
+    // C function void glProgramUniform4i ( GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3 )
+
+    public static native void glProgramUniform4i(
+        int program,
+        int location,
+        int v0,
+        int v1,
+        int v2,
+        int v3
+    );
+
+    // C function void glProgramUniform1ui ( GLuint program, GLint location, GLuint v0 )
+
+    public static native void glProgramUniform1ui(
+        int program,
+        int location,
+        int v0
+    );
+
+    // C function void glProgramUniform2ui ( GLuint program, GLint location, GLuint v0, GLuint v1 )
+
+    public static native void glProgramUniform2ui(
+        int program,
+        int location,
+        int v0,
+        int v1
+    );
+
+    // C function void glProgramUniform3ui ( GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2 )
+
+    public static native void glProgramUniform3ui(
+        int program,
+        int location,
+        int v0,
+        int v1,
+        int v2
+    );
+
+    // C function void glProgramUniform4ui ( GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3 )
+
+    public static native void glProgramUniform4ui(
+        int program,
+        int location,
+        int v0,
+        int v1,
+        int v2,
+        int v3
+    );
+
+    // C function void glProgramUniform1f ( GLuint program, GLint location, GLfloat v0 )
+
+    public static native void glProgramUniform1f(
+        int program,
+        int location,
+        float v0
+    );
+
+    // C function void glProgramUniform2f ( GLuint program, GLint location, GLfloat v0, GLfloat v1 )
+
+    public static native void glProgramUniform2f(
+        int program,
+        int location,
+        float v0,
+        float v1
+    );
+
+    // C function void glProgramUniform3f ( GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2 )
+
+    public static native void glProgramUniform3f(
+        int program,
+        int location,
+        float v0,
+        float v1,
+        float v2
+    );
+
+    // C function void glProgramUniform4f ( GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3 )
+
+    public static native void glProgramUniform4f(
+        int program,
+        int location,
+        float v0,
+        float v1,
+        float v2,
+        float v3
+    );
+
+    // C function void glProgramUniform1iv ( GLuint program, GLint location, GLsizei count, const GLint *value )
+
+    public static native void glProgramUniform1iv(
+        int program,
+        int location,
+        int count,
+        int[] value,
+        int offset
+    );
+
+    // C function void glProgramUniform1iv ( GLuint program, GLint location, GLsizei count, const GLint *value )
+
+    public static native void glProgramUniform1iv(
+        int program,
+        int location,
+        int count,
+        java.nio.IntBuffer value
+    );
+
+    // C function void glProgramUniform2iv ( GLuint program, GLint location, GLsizei count, const GLint *value )
+
+    public static native void glProgramUniform2iv(
+        int program,
+        int location,
+        int count,
+        int[] value,
+        int offset
+    );
+
+    // C function void glProgramUniform2iv ( GLuint program, GLint location, GLsizei count, const GLint *value )
+
+    public static native void glProgramUniform2iv(
+        int program,
+        int location,
+        int count,
+        java.nio.IntBuffer value
+    );
+
+    // C function void glProgramUniform3iv ( GLuint program, GLint location, GLsizei count, const GLint *value )
+
+    public static native void glProgramUniform3iv(
+        int program,
+        int location,
+        int count,
+        int[] value,
+        int offset
+    );
+
+    // C function void glProgramUniform3iv ( GLuint program, GLint location, GLsizei count, const GLint *value )
+
+    public static native void glProgramUniform3iv(
+        int program,
+        int location,
+        int count,
+        java.nio.IntBuffer value
+    );
+
+    // C function void glProgramUniform4iv ( GLuint program, GLint location, GLsizei count, const GLint *value )
+
+    public static native void glProgramUniform4iv(
+        int program,
+        int location,
+        int count,
+        int[] value,
+        int offset
+    );
+
+    // C function void glProgramUniform4iv ( GLuint program, GLint location, GLsizei count, const GLint *value )
+
+    public static native void glProgramUniform4iv(
+        int program,
+        int location,
+        int count,
+        java.nio.IntBuffer value
+    );
+
+    // C function void glProgramUniform1uiv ( GLuint program, GLint location, GLsizei count, const GLuint *value )
+
+    public static native void glProgramUniform1uiv(
+        int program,
+        int location,
+        int count,
+        int[] value,
+        int offset
+    );
+
+    // C function void glProgramUniform1uiv ( GLuint program, GLint location, GLsizei count, const GLuint *value )
+
+    public static native void glProgramUniform1uiv(
+        int program,
+        int location,
+        int count,
+        java.nio.IntBuffer value
+    );
+
+    // C function void glProgramUniform2uiv ( GLuint program, GLint location, GLsizei count, const GLuint *value )
+
+    public static native void glProgramUniform2uiv(
+        int program,
+        int location,
+        int count,
+        int[] value,
+        int offset
+    );
+
+    // C function void glProgramUniform2uiv ( GLuint program, GLint location, GLsizei count, const GLuint *value )
+
+    public static native void glProgramUniform2uiv(
+        int program,
+        int location,
+        int count,
+        java.nio.IntBuffer value
+    );
+
+    // C function void glProgramUniform3uiv ( GLuint program, GLint location, GLsizei count, const GLuint *value )
+
+    public static native void glProgramUniform3uiv(
+        int program,
+        int location,
+        int count,
+        int[] value,
+        int offset
+    );
+
+    // C function void glProgramUniform3uiv ( GLuint program, GLint location, GLsizei count, const GLuint *value )
+
+    public static native void glProgramUniform3uiv(
+        int program,
+        int location,
+        int count,
+        java.nio.IntBuffer value
+    );
+
+    // C function void glProgramUniform4uiv ( GLuint program, GLint location, GLsizei count, const GLuint *value )
+
+    public static native void glProgramUniform4uiv(
+        int program,
+        int location,
+        int count,
+        int[] value,
+        int offset
+    );
+
+    // C function void glProgramUniform4uiv ( GLuint program, GLint location, GLsizei count, const GLuint *value )
+
+    public static native void glProgramUniform4uiv(
+        int program,
+        int location,
+        int count,
+        java.nio.IntBuffer value
+    );
+
+    // C function void glProgramUniform1fv ( GLuint program, GLint location, GLsizei count, const GLfloat *value )
+
+    public static native void glProgramUniform1fv(
+        int program,
+        int location,
+        int count,
+        float[] value,
+        int offset
+    );
+
+    // C function void glProgramUniform1fv ( GLuint program, GLint location, GLsizei count, const GLfloat *value )
+
+    public static native void glProgramUniform1fv(
+        int program,
+        int location,
+        int count,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glProgramUniform2fv ( GLuint program, GLint location, GLsizei count, const GLfloat *value )
+
+    public static native void glProgramUniform2fv(
+        int program,
+        int location,
+        int count,
+        float[] value,
+        int offset
+    );
+
+    // C function void glProgramUniform2fv ( GLuint program, GLint location, GLsizei count, const GLfloat *value )
+
+    public static native void glProgramUniform2fv(
+        int program,
+        int location,
+        int count,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glProgramUniform3fv ( GLuint program, GLint location, GLsizei count, const GLfloat *value )
+
+    public static native void glProgramUniform3fv(
+        int program,
+        int location,
+        int count,
+        float[] value,
+        int offset
+    );
+
+    // C function void glProgramUniform3fv ( GLuint program, GLint location, GLsizei count, const GLfloat *value )
+
+    public static native void glProgramUniform3fv(
+        int program,
+        int location,
+        int count,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glProgramUniform4fv ( GLuint program, GLint location, GLsizei count, const GLfloat *value )
+
+    public static native void glProgramUniform4fv(
+        int program,
+        int location,
+        int count,
+        float[] value,
+        int offset
+    );
+
+    // C function void glProgramUniform4fv ( GLuint program, GLint location, GLsizei count, const GLfloat *value )
+
+    public static native void glProgramUniform4fv(
+        int program,
+        int location,
+        int count,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glProgramUniformMatrix2fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glProgramUniformMatrix2fv(
+        int program,
+        int location,
+        int count,
+        boolean transpose,
+        float[] value,
+        int offset
+    );
+
+    // C function void glProgramUniformMatrix2fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glProgramUniformMatrix2fv(
+        int program,
+        int location,
+        int count,
+        boolean transpose,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glProgramUniformMatrix3fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glProgramUniformMatrix3fv(
+        int program,
+        int location,
+        int count,
+        boolean transpose,
+        float[] value,
+        int offset
+    );
+
+    // C function void glProgramUniformMatrix3fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glProgramUniformMatrix3fv(
+        int program,
+        int location,
+        int count,
+        boolean transpose,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glProgramUniformMatrix4fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glProgramUniformMatrix4fv(
+        int program,
+        int location,
+        int count,
+        boolean transpose,
+        float[] value,
+        int offset
+    );
+
+    // C function void glProgramUniformMatrix4fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glProgramUniformMatrix4fv(
+        int program,
+        int location,
+        int count,
+        boolean transpose,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glProgramUniformMatrix2x3fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glProgramUniformMatrix2x3fv(
+        int program,
+        int location,
+        int count,
+        boolean transpose,
+        float[] value,
+        int offset
+    );
+
+    // C function void glProgramUniformMatrix2x3fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glProgramUniformMatrix2x3fv(
+        int program,
+        int location,
+        int count,
+        boolean transpose,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glProgramUniformMatrix3x2fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glProgramUniformMatrix3x2fv(
+        int program,
+        int location,
+        int count,
+        boolean transpose,
+        float[] value,
+        int offset
+    );
+
+    // C function void glProgramUniformMatrix3x2fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glProgramUniformMatrix3x2fv(
+        int program,
+        int location,
+        int count,
+        boolean transpose,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glProgramUniformMatrix2x4fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glProgramUniformMatrix2x4fv(
+        int program,
+        int location,
+        int count,
+        boolean transpose,
+        float[] value,
+        int offset
+    );
+
+    // C function void glProgramUniformMatrix2x4fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glProgramUniformMatrix2x4fv(
+        int program,
+        int location,
+        int count,
+        boolean transpose,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glProgramUniformMatrix4x2fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glProgramUniformMatrix4x2fv(
+        int program,
+        int location,
+        int count,
+        boolean transpose,
+        float[] value,
+        int offset
+    );
+
+    // C function void glProgramUniformMatrix4x2fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glProgramUniformMatrix4x2fv(
+        int program,
+        int location,
+        int count,
+        boolean transpose,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glProgramUniformMatrix3x4fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glProgramUniformMatrix3x4fv(
+        int program,
+        int location,
+        int count,
+        boolean transpose,
+        float[] value,
+        int offset
+    );
+
+    // C function void glProgramUniformMatrix3x4fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glProgramUniformMatrix3x4fv(
+        int program,
+        int location,
+        int count,
+        boolean transpose,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glProgramUniformMatrix4x3fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glProgramUniformMatrix4x3fv(
+        int program,
+        int location,
+        int count,
+        boolean transpose,
+        float[] value,
+        int offset
+    );
+
+    // C function void glProgramUniformMatrix4x3fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+
+    public static native void glProgramUniformMatrix4x3fv(
+        int program,
+        int location,
+        int count,
+        boolean transpose,
+        java.nio.FloatBuffer value
+    );
+
+    // C function void glValidateProgramPipeline ( GLuint pipeline )
+
+    public static native void glValidateProgramPipeline(
+        int pipeline
+    );
+
+    // C function void glGetProgramPipelineInfoLog( GLuint program, GLsizei maxLength, GLsizei * length, GLchar * infoLog);
+
+    public static native String glGetProgramPipelineInfoLog(
+        int program
+    );
+
+    // C function void glBindImageTexture ( GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format )
+
+    public static native void glBindImageTexture(
+        int unit,
+        int texture,
+        int level,
+        boolean layered,
+        int layer,
+        int access,
+        int format
+    );
+
+    // C function void glGetBooleani_v ( GLenum target, GLuint index, GLboolean *data )
+
+    public static native void glGetBooleani_v(
+        int target,
+        int index,
+        boolean[] data,
+        int offset
+    );
+
+    // C function void glGetBooleani_v ( GLenum target, GLuint index, GLboolean *data )
+
+    public static native void glGetBooleani_v(
+        int target,
+        int index,
+        java.nio.IntBuffer data
+    );
+
+    // C function void glMemoryBarrier ( GLbitfield barriers )
+
+    public static native void glMemoryBarrier(
+        int barriers
+    );
+
+    // C function void glMemoryBarrierByRegion ( GLbitfield barriers )
+
+    public static native void glMemoryBarrierByRegion(
+        int barriers
+    );
+
+    // C function void glTexStorage2DMultisample ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations )
+
+    public static native void glTexStorage2DMultisample(
+        int target,
+        int samples,
+        int internalformat,
+        int width,
+        int height,
+        boolean fixedsamplelocations
+    );
+
+    // C function void glGetMultisamplefv ( GLenum pname, GLuint index, GLfloat *val )
+
+    public static native void glGetMultisamplefv(
+        int pname,
+        int index,
+        float[] val,
+        int offset
+    );
+
+    // C function void glGetMultisamplefv ( GLenum pname, GLuint index, GLfloat *val )
+
+    public static native void glGetMultisamplefv(
+        int pname,
+        int index,
+        java.nio.FloatBuffer val
+    );
+
+    // C function void glSampleMaski ( GLuint maskNumber, GLbitfield mask )
+
+    public static native void glSampleMaski(
+        int maskNumber,
+        int mask
+    );
+
+    // C function void glGetTexLevelParameteriv ( GLenum target, GLint level, GLenum pname, GLint *params )
+
+    public static native void glGetTexLevelParameteriv(
+        int target,
+        int level,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexLevelParameteriv ( GLenum target, GLint level, GLenum pname, GLint *params )
+
+    public static native void glGetTexLevelParameteriv(
+        int target,
+        int level,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetTexLevelParameterfv ( GLenum target, GLint level, GLenum pname, GLfloat *params )
+
+    public static native void glGetTexLevelParameterfv(
+        int target,
+        int level,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glGetTexLevelParameterfv ( GLenum target, GLint level, GLenum pname, GLfloat *params )
+
+    public static native void glGetTexLevelParameterfv(
+        int target,
+        int level,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glBindVertexBuffer ( GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride )
+
+    public static native void glBindVertexBuffer(
+        int bindingindex,
+        int buffer,
+        long offset,
+        int stride
+    );
+
+    // C function void glVertexAttribFormat ( GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset )
+
+    public static native void glVertexAttribFormat(
+        int attribindex,
+        int size,
+        int type,
+        boolean normalized,
+        int relativeoffset
+    );
+
+    // C function void glVertexAttribIFormat ( GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset )
+
+    public static native void glVertexAttribIFormat(
+        int attribindex,
+        int size,
+        int type,
+        int relativeoffset
+    );
+
+    // C function void glVertexAttribBinding ( GLuint attribindex, GLuint bindingindex )
+
+    public static native void glVertexAttribBinding(
+        int attribindex,
+        int bindingindex
+    );
+
+    // C function void glVertexBindingDivisor ( GLuint bindingindex, GLuint divisor )
+
+    public static native void glVertexBindingDivisor(
+        int bindingindex,
+        int divisor
+    );
+
+}
diff --git a/android/opengl/GLES31Ext.java b/android/opengl/GLES31Ext.java
new file mode 100644
index 0000000..c362a36
--- /dev/null
+++ b/android/opengl/GLES31Ext.java
@@ -0,0 +1,678 @@
+/*
+ * Copyright 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// This source file is automatically generated
+
+package android.opengl;
+
+public class GLES31Ext {
+
+    // GL_KHR_blend_equation_advanced
+    public static final int GL_BLEND_ADVANCED_COHERENT_KHR                          = 0x9285;
+    public static final int GL_MULTIPLY_KHR                                         = 0x9294;
+    public static final int GL_SCREEN_KHR                                           = 0x9295;
+    public static final int GL_OVERLAY_KHR                                          = 0x9296;
+    public static final int GL_DARKEN_KHR                                           = 0x9297;
+    public static final int GL_LIGHTEN_KHR                                          = 0x9298;
+    public static final int GL_COLORDODGE_KHR                                       = 0x9299;
+    public static final int GL_COLORBURN_KHR                                        = 0x929A;
+    public static final int GL_HARDLIGHT_KHR                                        = 0x929B;
+    public static final int GL_SOFTLIGHT_KHR                                        = 0x929C;
+    public static final int GL_DIFFERENCE_KHR                                       = 0x929E;
+    public static final int GL_EXCLUSION_KHR                                        = 0x92A0;
+    public static final int GL_HSL_HUE_KHR                                          = 0x92AD;
+    public static final int GL_HSL_SATURATION_KHR                                   = 0x92AE;
+    public static final int GL_HSL_COLOR_KHR                                        = 0x92AF;
+    public static final int GL_HSL_LUMINOSITY_KHR                                   = 0x92B0;
+
+    // GL_KHR_debug
+    public static final int GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR                         = 0x8242;
+    public static final int GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR                 = 0x8243;
+    public static final int GL_DEBUG_CALLBACK_FUNCTION_KHR                          = 0x8244;
+    public static final int GL_DEBUG_CALLBACK_USER_PARAM_KHR                        = 0x8245;
+    public static final int GL_DEBUG_SOURCE_API_KHR                                 = 0x8246;
+    public static final int GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR                       = 0x8247;
+    public static final int GL_DEBUG_SOURCE_SHADER_COMPILER_KHR                     = 0x8248;
+    public static final int GL_DEBUG_SOURCE_THIRD_PARTY_KHR                         = 0x8249;
+    public static final int GL_DEBUG_SOURCE_APPLICATION_KHR                         = 0x824A;
+    public static final int GL_DEBUG_SOURCE_OTHER_KHR                               = 0x824B;
+    public static final int GL_DEBUG_TYPE_ERROR_KHR                                 = 0x824C;
+    public static final int GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR                   = 0x824D;
+    public static final int GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR                    = 0x824E;
+    public static final int GL_DEBUG_TYPE_PORTABILITY_KHR                           = 0x824F;
+    public static final int GL_DEBUG_TYPE_PERFORMANCE_KHR                           = 0x8250;
+    public static final int GL_DEBUG_TYPE_OTHER_KHR                                 = 0x8251;
+    public static final int GL_DEBUG_TYPE_MARKER_KHR                                = 0x8268;
+    public static final int GL_DEBUG_TYPE_PUSH_GROUP_KHR                            = 0x8269;
+    public static final int GL_DEBUG_TYPE_POP_GROUP_KHR                             = 0x826A;
+    public static final int GL_DEBUG_SEVERITY_NOTIFICATION_KHR                      = 0x826B;
+    public static final int GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR                      = 0x826C;
+    public static final int GL_DEBUG_GROUP_STACK_DEPTH_KHR                          = 0x826D;
+    public static final int GL_BUFFER_KHR                                           = 0x82E0;
+    public static final int GL_SHADER_KHR                                           = 0x82E1;
+    public static final int GL_PROGRAM_KHR                                          = 0x82E2;
+    public static final int GL_VERTEX_ARRAY_KHR                                     = 0x8074;
+    public static final int GL_QUERY_KHR                                            = 0x82E3;
+    public static final int GL_SAMPLER_KHR                                          = 0x82E6;
+    public static final int GL_MAX_LABEL_LENGTH_KHR                                 = 0x82E8;
+    public static final int GL_MAX_DEBUG_MESSAGE_LENGTH_KHR                         = 0x9143;
+    public static final int GL_MAX_DEBUG_LOGGED_MESSAGES_KHR                        = 0x9144;
+    public static final int GL_DEBUG_LOGGED_MESSAGES_KHR                            = 0x9145;
+    public static final int GL_DEBUG_SEVERITY_HIGH_KHR                              = 0x9146;
+    public static final int GL_DEBUG_SEVERITY_MEDIUM_KHR                            = 0x9147;
+    public static final int GL_DEBUG_SEVERITY_LOW_KHR                               = 0x9148;
+    public static final int GL_DEBUG_OUTPUT_KHR                                     = 0x92E0;
+    public static final int GL_CONTEXT_FLAG_DEBUG_BIT_KHR                           = 0x00000002;
+    public static final int GL_STACK_OVERFLOW_KHR                                   = 0x0503;
+    public static final int GL_STACK_UNDERFLOW_KHR                                  = 0x0504;
+
+    // GL_KHR_texture_compression_astc_ldr
+    public static final int GL_COMPRESSED_RGBA_ASTC_4x4_KHR                         = 0x93B0;
+    public static final int GL_COMPRESSED_RGBA_ASTC_5x4_KHR                         = 0x93B1;
+    public static final int GL_COMPRESSED_RGBA_ASTC_5x5_KHR                         = 0x93B2;
+    public static final int GL_COMPRESSED_RGBA_ASTC_6x5_KHR                         = 0x93B3;
+    public static final int GL_COMPRESSED_RGBA_ASTC_6x6_KHR                         = 0x93B4;
+    public static final int GL_COMPRESSED_RGBA_ASTC_8x5_KHR                         = 0x93B5;
+    public static final int GL_COMPRESSED_RGBA_ASTC_8x6_KHR                         = 0x93B6;
+    public static final int GL_COMPRESSED_RGBA_ASTC_8x8_KHR                         = 0x93B7;
+    public static final int GL_COMPRESSED_RGBA_ASTC_10x5_KHR                        = 0x93B8;
+    public static final int GL_COMPRESSED_RGBA_ASTC_10x6_KHR                        = 0x93B9;
+    public static final int GL_COMPRESSED_RGBA_ASTC_10x8_KHR                        = 0x93BA;
+    public static final int GL_COMPRESSED_RGBA_ASTC_10x10_KHR                       = 0x93BB;
+    public static final int GL_COMPRESSED_RGBA_ASTC_12x10_KHR                       = 0x93BC;
+    public static final int GL_COMPRESSED_RGBA_ASTC_12x12_KHR                       = 0x93BD;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR                 = 0x93D0;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR                 = 0x93D1;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR                 = 0x93D2;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR                 = 0x93D3;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR                 = 0x93D4;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR                 = 0x93D5;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR                 = 0x93D6;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR                 = 0x93D7;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR                = 0x93D8;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR                = 0x93D9;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR                = 0x93DA;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR               = 0x93DB;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR               = 0x93DC;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR               = 0x93DD;
+
+    // GL_OES_sample_shading
+    public static final int GL_SAMPLE_SHADING_OES                                   = 0x8C36;
+    public static final int GL_MIN_SAMPLE_SHADING_VALUE_OES                         = 0x8C37;
+
+    // GL_OES_shader_multisample_interpolation
+    public static final int GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES                = 0x8E5B;
+    public static final int GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES                = 0x8E5C;
+    public static final int GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES               = 0x8E5D;
+
+    // GL_OES_texture_stencil8
+    public static final int GL_STENCIL_INDEX_OES                                    = 0x1901;
+    public static final int GL_STENCIL_INDEX8_OES                                   = 0x8D48;
+
+    // GL_OES_texture_storage_multisample_2d_array
+    public static final int GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES                     = 0x9102;
+    public static final int GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES             = 0x9105;
+    public static final int GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES                     = 0x910B;
+    public static final int GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES                 = 0x910C;
+    public static final int GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES        = 0x910D;
+
+    // GL_EXT_geometry_shader
+    public static final int GL_GEOMETRY_SHADER_EXT                                  = 0x8DD9;
+    public static final int GL_GEOMETRY_SHADER_BIT_EXT                              = 0x00000004;
+    public static final int GL_GEOMETRY_LINKED_VERTICES_OUT_EXT                     = 0x8916;
+    public static final int GL_GEOMETRY_LINKED_INPUT_TYPE_EXT                       = 0x8917;
+    public static final int GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT                      = 0x8918;
+    public static final int GL_GEOMETRY_SHADER_INVOCATIONS_EXT                      = 0x887F;
+    public static final int GL_LAYER_PROVOKING_VERTEX_EXT                           = 0x825E;
+    public static final int GL_LINES_ADJACENCY_EXT                                  = 0x000A;
+    public static final int GL_LINE_STRIP_ADJACENCY_EXT                             = 0x000B;
+    public static final int GL_TRIANGLES_ADJACENCY_EXT                              = 0x000C;
+    public static final int GL_TRIANGLE_STRIP_ADJACENCY_EXT                         = 0x000D;
+    public static final int GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT                  = 0x8DDF;
+    public static final int GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT                      = 0x8A2C;
+    public static final int GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT         = 0x8A32;
+    public static final int GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT                    = 0x9123;
+    public static final int GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT                   = 0x9124;
+    public static final int GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT                     = 0x8DE0;
+    public static final int GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT             = 0x8DE1;
+    public static final int GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT                  = 0x8E5A;
+    public static final int GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT                 = 0x8C29;
+    public static final int GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT              = 0x92CF;
+    public static final int GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT                     = 0x92D5;
+    public static final int GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT                      = 0x90CD;
+    public static final int GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT               = 0x90D7;
+    public static final int GL_FIRST_VERTEX_CONVENTION_EXT                          = 0x8E4D;
+    public static final int GL_LAST_VERTEX_CONVENTION_EXT                           = 0x8E4E;
+    public static final int GL_UNDEFINED_VERTEX_EXT                                 = 0x8260;
+    public static final int GL_PRIMITIVES_GENERATED_EXT                             = 0x8C87;
+    public static final int GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT                       = 0x9312;
+    public static final int GL_MAX_FRAMEBUFFER_LAYERS_EXT                           = 0x9317;
+    public static final int GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT             = 0x8DA8;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT                   = 0x8DA7;
+    public static final int GL_REFERENCED_BY_GEOMETRY_SHADER_EXT                    = 0x9309;
+
+    // GL_EXT_primitive_bounding_box
+    public static final int GL_PRIMITIVE_BOUNDING_BOX_EXT                           = 0x92BE;
+
+    // GL_EXT_tessellation_shader
+    public static final int GL_PATCHES_EXT                                          = 0x000E;
+    public static final int GL_PATCH_VERTICES_EXT                                   = 0x8E72;
+    public static final int GL_TESS_CONTROL_OUTPUT_VERTICES_EXT                     = 0x8E75;
+    public static final int GL_TESS_GEN_MODE_EXT                                    = 0x8E76;
+    public static final int GL_TESS_GEN_SPACING_EXT                                 = 0x8E77;
+    public static final int GL_TESS_GEN_VERTEX_ORDER_EXT                            = 0x8E78;
+    public static final int GL_TESS_GEN_POINT_MODE_EXT                              = 0x8E79;
+    public static final int GL_ISOLINES_EXT                                         = 0x8E7A;
+    public static final int GL_QUADS_EXT                                            = 0x0007;
+    public static final int GL_FRACTIONAL_ODD_EXT                                   = 0x8E7B;
+    public static final int GL_FRACTIONAL_EVEN_EXT                                  = 0x8E7C;
+    public static final int GL_MAX_PATCH_VERTICES_EXT                               = 0x8E7D;
+    public static final int GL_MAX_TESS_GEN_LEVEL_EXT                               = 0x8E7E;
+    public static final int GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_EXT              = 0x8E7F;
+    public static final int GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT           = 0x8E80;
+    public static final int GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_EXT             = 0x8E81;
+    public static final int GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_EXT          = 0x8E82;
+    public static final int GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT               = 0x8E83;
+    public static final int GL_MAX_TESS_PATCH_COMPONENTS_EXT                        = 0x8E84;
+    public static final int GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT         = 0x8E85;
+    public static final int GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT            = 0x8E86;
+    public static final int GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_EXT                  = 0x8E89;
+    public static final int GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_EXT               = 0x8E8A;
+    public static final int GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT                = 0x886C;
+    public static final int GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT             = 0x886D;
+    public static final int GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_EXT     = 0x8E1E;
+    public static final int GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT  = 0x8E1F;
+    public static final int GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_EXT          = 0x92CD;
+    public static final int GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_EXT       = 0x92CE;
+    public static final int GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT                 = 0x92D3;
+    public static final int GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_EXT              = 0x92D4;
+    public static final int GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT                  = 0x90CB;
+    public static final int GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_EXT               = 0x90CC;
+    public static final int GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_EXT           = 0x90D8;
+    public static final int GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_EXT        = 0x90D9;
+    public static final int GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED              = 0x8221;
+    public static final int GL_IS_PER_PATCH_EXT                                     = 0x92E7;
+    public static final int GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT                = 0x9307;
+    public static final int GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT             = 0x9308;
+    public static final int GL_TESS_CONTROL_SHADER_EXT                              = 0x8E88;
+    public static final int GL_TESS_EVALUATION_SHADER_EXT                           = 0x8E87;
+    public static final int GL_TESS_CONTROL_SHADER_BIT_EXT                          = 0x00000008;
+    public static final int GL_TESS_EVALUATION_SHADER_BIT_EXT                       = 0x00000010;
+
+    // GL_EXT_texture_border_clamp
+    public static final int GL_TEXTURE_BORDER_COLOR_EXT                             = 0x1004;
+    public static final int GL_CLAMP_TO_BORDER_EXT                                  = 0x812D;
+
+    // GL_EXT_texture_buffer
+    public static final int GL_TEXTURE_BUFFER_EXT                                   = 0x8C2A;
+    public static final int GL_TEXTURE_BUFFER_BINDING_EXT                           = 0x8C2A;
+    public static final int GL_MAX_TEXTURE_BUFFER_SIZE_EXT                          = 0x8C2B;
+    public static final int GL_TEXTURE_BINDING_BUFFER_EXT                           = 0x8C2C;
+    public static final int GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT                = 0x8C2D;
+    public static final int GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_EXT                  = 0x919F;
+    public static final int GL_SAMPLER_BUFFER_EXT                                   = 0x8DC2;
+    public static final int GL_INT_SAMPLER_BUFFER_EXT                               = 0x8DD0;
+    public static final int GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT                      = 0x8DD8;
+    public static final int GL_IMAGE_BUFFER_EXT                                     = 0x9051;
+    public static final int GL_INT_IMAGE_BUFFER_EXT                                 = 0x905C;
+    public static final int GL_UNSIGNED_INT_IMAGE_BUFFER_EXT                        = 0x9067;
+    public static final int GL_TEXTURE_BUFFER_OFFSET_EXT                            = 0x919D;
+    public static final int GL_TEXTURE_BUFFER_SIZE_EXT                              = 0x919E;
+
+    // GL_EXT_texture_cube_map_array
+    public static final int GL_TEXTURE_CUBE_MAP_ARRAY_EXT                           = 0x9009;
+    public static final int GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_EXT                   = 0x900A;
+    public static final int GL_SAMPLER_CUBE_MAP_ARRAY_EXT                           = 0x900C;
+    public static final int GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_EXT                    = 0x900D;
+    public static final int GL_INT_SAMPLER_CUBE_MAP_ARRAY_EXT                       = 0x900E;
+    public static final int GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_EXT              = 0x900F;
+    public static final int GL_IMAGE_CUBE_MAP_ARRAY_EXT                             = 0x9054;
+    public static final int GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT                         = 0x905F;
+    public static final int GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT                = 0x906A;
+
+    // GL_EXT_texture_sRGB_decode
+    public static final int GL_TEXTURE_SRGB_DECODE_EXT                              = 0x8A48;
+    public static final int GL_DECODE_EXT                                           = 0x8A49;
+    public static final int GL_SKIP_DECODE_EXT                                      = 0x8A4A;
+
+    native private static void _nativeClassInit();
+    static {
+        _nativeClassInit();
+    }
+
+    private GLES31Ext() {}
+    // C function void glBlendBarrierKHR ( void )
+
+    public static native void glBlendBarrierKHR(
+    );
+
+    // C function void glDebugMessageControlKHR ( GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled )
+
+    public static native void glDebugMessageControlKHR(
+        int source,
+        int type,
+        int severity,
+        int count,
+        int[] ids,
+        int offset,
+        boolean enabled
+    );
+
+    // C function void glDebugMessageControlKHR ( GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled )
+
+    public static native void glDebugMessageControlKHR(
+        int source,
+        int type,
+        int severity,
+        int count,
+        java.nio.IntBuffer ids,
+        boolean enabled
+    );
+
+    // C function void glDebugMessageInsertKHR ( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf )
+
+    public static native void glDebugMessageInsertKHR(
+        int source,
+        int type,
+        int id,
+        int severity,
+        String buf
+    );
+
+    // C function void glDebugMessageCallbackKHR ( GLDEBUGPROCKHR callback, const void *userParam )
+
+    public interface DebugProcKHR {
+        void onMessage(int source, int type, int id, int severity, String message);
+    }
+
+    public static native void glDebugMessageCallbackKHR(DebugProcKHR callback);
+
+    // C function GLuint glGetDebugMessageLogKHR ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog )
+
+    public static native int glGetDebugMessageLogKHR(
+        int count,
+        int bufSize,
+        int[] sources,
+        int sourcesOffset,
+        int[] types,
+        int typesOffset,
+        int[] ids,
+        int idsOffset,
+        int[] severities,
+        int severitiesOffset,
+        int[] lengths,
+        int lengthsOffset,
+        byte[] messageLog,
+        int messageLogOffset);
+
+    // C function GLuint glGetDebugMessageLogKHR ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog )
+
+    public static native int glGetDebugMessageLogKHR(
+        int count,
+        java.nio.IntBuffer sources,
+        java.nio.IntBuffer types,
+        java.nio.IntBuffer ids,
+        java.nio.IntBuffer severities,
+        java.nio.IntBuffer lengths,
+        java.nio.ByteBuffer messageLog);
+
+    // C function GLuint glGetDebugMessageLogKHR ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog )
+
+    public static native String[] glGetDebugMessageLogKHR(
+        int count,
+        int[] sources,
+        int sourcesOffset,
+        int[] types,
+        int typesOffset,
+        int[] ids,
+        int idsOffset,
+        int[] severities,
+        int severitiesOffset);
+
+    // C function GLuint glGetDebugMessageLogKHR ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog )
+
+    public static native String[] glGetDebugMessageLogKHR(
+        int count,
+        java.nio.IntBuffer sources,
+        java.nio.IntBuffer types,
+        java.nio.IntBuffer ids,
+        java.nio.IntBuffer severities);
+
+    // C function void glPushDebugGroupKHR ( GLenum source, GLuint id, GLsizei length, const GLchar *message )
+
+    public static native void glPushDebugGroupKHR(
+        int source,
+        int id,
+        int length,
+        String message
+    );
+
+    // C function void glPopDebugGroupKHR ( void )
+
+    public static native void glPopDebugGroupKHR(
+    );
+
+    // C function void glObjectLabelKHR ( GLenum identifier, GLuint name, GLsizei length, const GLchar *label )
+
+    public static native void glObjectLabelKHR(
+        int identifier,
+        int name,
+        int length,
+        String label
+    );
+
+    // C function void glGetObjectLabelKHR ( GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label )
+
+    public static native String glGetObjectLabelKHR(int identifier, int name);
+
+    // C function void glObjectPtrLabelKHR ( const void *ptr, GLsizei length, const GLchar *label )
+
+    public static native void glObjectPtrLabelKHR(long ptr, String label);
+
+    // C function void glGetObjectPtrLabelKHR ( const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label )
+
+    public static native String glGetObjectPtrLabelKHR(long ptr);
+
+    // C function void glGetPointervKHR ( GLenum pname, void **params )
+
+    public static native DebugProcKHR glGetDebugMessageCallbackKHR();
+
+    // C function void glMinSampleShadingOES ( GLfloat value )
+
+    public static native void glMinSampleShadingOES(
+        float value
+    );
+
+    // C function void glTexStorage3DMultisampleOES ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations )
+
+    public static native void glTexStorage3DMultisampleOES(
+        int target,
+        int samples,
+        int internalformat,
+        int width,
+        int height,
+        int depth,
+        boolean fixedsamplelocations
+    );
+
+    // C function void glCopyImageSubDataEXT ( GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth )
+
+    public static native void glCopyImageSubDataEXT(
+        int srcName,
+        int srcTarget,
+        int srcLevel,
+        int srcX,
+        int srcY,
+        int srcZ,
+        int dstName,
+        int dstTarget,
+        int dstLevel,
+        int dstX,
+        int dstY,
+        int dstZ,
+        int srcWidth,
+        int srcHeight,
+        int srcDepth
+    );
+
+    // C function void glEnableiEXT ( GLenum target, GLuint index )
+
+    public static native void glEnableiEXT(
+        int target,
+        int index
+    );
+
+    // C function void glDisableiEXT ( GLenum target, GLuint index )
+
+    public static native void glDisableiEXT(
+        int target,
+        int index
+    );
+
+    // C function void glBlendEquationiEXT ( GLuint buf, GLenum mode )
+
+    public static native void glBlendEquationiEXT(
+        int buf,
+        int mode
+    );
+
+    // C function void glBlendEquationSeparateiEXT ( GLuint buf, GLenum modeRGB, GLenum modeAlpha )
+
+    public static native void glBlendEquationSeparateiEXT(
+        int buf,
+        int modeRGB,
+        int modeAlpha
+    );
+
+    // C function void glBlendFunciEXT ( GLuint buf, GLenum src, GLenum dst )
+
+    public static native void glBlendFunciEXT(
+        int buf,
+        int src,
+        int dst
+    );
+
+    // C function void glBlendFuncSeparateiEXT ( GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha )
+
+    public static native void glBlendFuncSeparateiEXT(
+        int buf,
+        int srcRGB,
+        int dstRGB,
+        int srcAlpha,
+        int dstAlpha
+    );
+
+    // C function void glColorMaskiEXT ( GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a )
+
+    public static native void glColorMaskiEXT(
+        int index,
+        boolean r,
+        boolean g,
+        boolean b,
+        boolean a
+    );
+
+    // C function GLboolean glIsEnablediEXT ( GLenum target, GLuint index )
+
+    public static native boolean glIsEnablediEXT(
+        int target,
+        int index
+    );
+
+    // C function void glFramebufferTextureEXT ( GLenum target, GLenum attachment, GLuint texture, GLint level )
+
+    public static native void glFramebufferTextureEXT(
+        int target,
+        int attachment,
+        int texture,
+        int level
+    );
+
+    // C function void glPrimitiveBoundingBoxEXT ( GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW )
+
+    public static native void glPrimitiveBoundingBoxEXT(
+        float minX,
+        float minY,
+        float minZ,
+        float minW,
+        float maxX,
+        float maxY,
+        float maxZ,
+        float maxW
+    );
+
+    // C function void glPatchParameteriEXT ( GLenum pname, GLint value )
+
+    public static native void glPatchParameteriEXT(
+        int pname,
+        int value
+    );
+
+    // C function void glTexParameterIivEXT ( GLenum target, GLenum pname, const GLint *params )
+
+    public static native void glTexParameterIivEXT(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glTexParameterIivEXT ( GLenum target, GLenum pname, const GLint *params )
+
+    public static native void glTexParameterIivEXT(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glTexParameterIuivEXT ( GLenum target, GLenum pname, const GLuint *params )
+
+    public static native void glTexParameterIuivEXT(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glTexParameterIuivEXT ( GLenum target, GLenum pname, const GLuint *params )
+
+    public static native void glTexParameterIuivEXT(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetTexParameterIivEXT ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetTexParameterIivEXT(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexParameterIivEXT ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetTexParameterIivEXT(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetTexParameterIuivEXT ( GLenum target, GLenum pname, GLuint *params )
+
+    public static native void glGetTexParameterIuivEXT(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexParameterIuivEXT ( GLenum target, GLenum pname, GLuint *params )
+
+    public static native void glGetTexParameterIuivEXT(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glSamplerParameterIivEXT ( GLuint sampler, GLenum pname, const GLint *param )
+
+    public static native void glSamplerParameterIivEXT(
+        int sampler,
+        int pname,
+        int[] param,
+        int offset
+    );
+
+    // C function void glSamplerParameterIivEXT ( GLuint sampler, GLenum pname, const GLint *param )
+
+    public static native void glSamplerParameterIivEXT(
+        int sampler,
+        int pname,
+        java.nio.IntBuffer param
+    );
+
+    // C function void glSamplerParameterIuivEXT ( GLuint sampler, GLenum pname, const GLuint *param )
+
+    public static native void glSamplerParameterIuivEXT(
+        int sampler,
+        int pname,
+        int[] param,
+        int offset
+    );
+
+    // C function void glSamplerParameterIuivEXT ( GLuint sampler, GLenum pname, const GLuint *param )
+
+    public static native void glSamplerParameterIuivEXT(
+        int sampler,
+        int pname,
+        java.nio.IntBuffer param
+    );
+
+    // C function void glGetSamplerParameterIivEXT ( GLuint sampler, GLenum pname, GLint *params )
+
+    public static native void glGetSamplerParameterIivEXT(
+        int sampler,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetSamplerParameterIivEXT ( GLuint sampler, GLenum pname, GLint *params )
+
+    public static native void glGetSamplerParameterIivEXT(
+        int sampler,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetSamplerParameterIuivEXT ( GLuint sampler, GLenum pname, GLuint *params )
+
+    public static native void glGetSamplerParameterIuivEXT(
+        int sampler,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetSamplerParameterIuivEXT ( GLuint sampler, GLenum pname, GLuint *params )
+
+    public static native void glGetSamplerParameterIuivEXT(
+        int sampler,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glTexBufferEXT ( GLenum target, GLenum internalformat, GLuint buffer )
+
+    public static native void glTexBufferEXT(
+        int target,
+        int internalformat,
+        int buffer
+    );
+
+    // C function void glTexBufferRangeEXT ( GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size )
+
+    public static native void glTexBufferRangeEXT(
+        int target,
+        int internalformat,
+        int buffer,
+        int offset,
+        int size
+    );
+
+}
diff --git a/android/opengl/GLES32.java b/android/opengl/GLES32.java
new file mode 100644
index 0000000..7a392b8
--- /dev/null
+++ b/android/opengl/GLES32.java
@@ -0,0 +1,785 @@
+/*
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// This source file is automatically generated
+
+package android.opengl;
+
+/** OpenGL ES 3.2
+ */
+public class GLES32 extends GLES31 {
+
+    public static final int GL_CONTEXT_FLAG_DEBUG_BIT                          = 0x00000002;
+
+    public static final int GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT                  = 0x00000004;
+
+    public static final int GL_GEOMETRY_SHADER_BIT                             = 0x00000004;
+    public static final int GL_TESS_CONTROL_SHADER_BIT                         = 0x00000008;
+    public static final int GL_TESS_EVALUATION_SHADER_BIT                      = 0x00000010;
+
+    public static final int GL_QUADS                                           = 0x0007;
+    public static final int GL_LINES_ADJACENCY                                 = 0x000A;
+    public static final int GL_LINE_STRIP_ADJACENCY                            = 0x000B;
+    public static final int GL_TRIANGLES_ADJACENCY                             = 0x000C;
+    public static final int GL_TRIANGLE_STRIP_ADJACENCY                        = 0x000D;
+    public static final int GL_PATCHES                                         = 0x000E;
+    public static final int GL_STACK_OVERFLOW                                  = 0x0503;
+    public static final int GL_STACK_UNDERFLOW                                 = 0x0504;
+    public static final int GL_CONTEXT_LOST                                    = 0x0507;
+    public static final int GL_TEXTURE_BORDER_COLOR                            = 0x1004;
+    public static final int GL_VERTEX_ARRAY                                    = 0x8074;
+    public static final int GL_CLAMP_TO_BORDER                                 = 0x812D;
+    public static final int GL_CONTEXT_FLAGS                                   = 0x821E;
+    public static final int GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED         = 0x8221;
+    public static final int GL_DEBUG_OUTPUT_SYNCHRONOUS                        = 0x8242;
+    public static final int GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH                = 0x8243;
+    public static final int GL_DEBUG_CALLBACK_FUNCTION                         = 0x8244;
+    public static final int GL_DEBUG_CALLBACK_USER_PARAM                       = 0x8245;
+    public static final int GL_DEBUG_SOURCE_API                                = 0x8246;
+    public static final int GL_DEBUG_SOURCE_WINDOW_SYSTEM                      = 0x8247;
+    public static final int GL_DEBUG_SOURCE_SHADER_COMPILER                    = 0x8248;
+    public static final int GL_DEBUG_SOURCE_THIRD_PARTY                        = 0x8249;
+    public static final int GL_DEBUG_SOURCE_APPLICATION                        = 0x824A;
+    public static final int GL_DEBUG_SOURCE_OTHER                              = 0x824B;
+    public static final int GL_DEBUG_TYPE_ERROR                                = 0x824C;
+    public static final int GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR                  = 0x824D;
+    public static final int GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR                   = 0x824E;
+    public static final int GL_DEBUG_TYPE_PORTABILITY                          = 0x824F;
+    public static final int GL_DEBUG_TYPE_PERFORMANCE                          = 0x8250;
+    public static final int GL_DEBUG_TYPE_OTHER                                = 0x8251;
+    public static final int GL_LOSE_CONTEXT_ON_RESET                           = 0x8252;
+    public static final int GL_GUILTY_CONTEXT_RESET                            = 0x8253;
+    public static final int GL_INNOCENT_CONTEXT_RESET                          = 0x8254;
+    public static final int GL_UNKNOWN_CONTEXT_RESET                           = 0x8255;
+    public static final int GL_RESET_NOTIFICATION_STRATEGY                     = 0x8256;
+    public static final int GL_LAYER_PROVOKING_VERTEX                          = 0x825E;
+    public static final int GL_UNDEFINED_VERTEX                                = 0x8260;
+    public static final int GL_NO_RESET_NOTIFICATION                           = 0x8261;
+    public static final int GL_DEBUG_TYPE_MARKER                               = 0x8268;
+    public static final int GL_DEBUG_TYPE_PUSH_GROUP                           = 0x8269;
+    public static final int GL_DEBUG_TYPE_POP_GROUP                            = 0x826A;
+    public static final int GL_DEBUG_SEVERITY_NOTIFICATION                     = 0x826B;
+    public static final int GL_MAX_DEBUG_GROUP_STACK_DEPTH                     = 0x826C;
+    public static final int GL_DEBUG_GROUP_STACK_DEPTH                         = 0x826D;
+    public static final int GL_BUFFER                                          = 0x82E0;
+    public static final int GL_SHADER                                          = 0x82E1;
+    public static final int GL_PROGRAM                                         = 0x82E2;
+    public static final int GL_QUERY                                           = 0x82E3;
+    public static final int GL_PROGRAM_PIPELINE                                = 0x82E4;
+    public static final int GL_SAMPLER                                         = 0x82E6;
+    public static final int GL_MAX_LABEL_LENGTH                                = 0x82E8;
+    public static final int GL_MAX_TESS_CONTROL_INPUT_COMPONENTS               = 0x886C;
+    public static final int GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS            = 0x886D;
+    public static final int GL_GEOMETRY_SHADER_INVOCATIONS                     = 0x887F;
+    public static final int GL_GEOMETRY_VERTICES_OUT                           = 0x8916;
+    public static final int GL_GEOMETRY_INPUT_TYPE                             = 0x8917;
+    public static final int GL_GEOMETRY_OUTPUT_TYPE                            = 0x8918;
+    public static final int GL_MAX_GEOMETRY_UNIFORM_BLOCKS                     = 0x8A2C;
+    public static final int GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS        = 0x8A32;
+    public static final int GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS                = 0x8C29;
+    public static final int GL_TEXTURE_BUFFER                                  = 0x8C2A;
+    public static final int GL_TEXTURE_BUFFER_BINDING                          = 0x8C2A;
+    public static final int GL_MAX_TEXTURE_BUFFER_SIZE                         = 0x8C2B;
+    public static final int GL_TEXTURE_BINDING_BUFFER                          = 0x8C2C;
+    public static final int GL_TEXTURE_BUFFER_DATA_STORE_BINDING               = 0x8C2D;
+    public static final int GL_SAMPLE_SHADING                                  = 0x8C36;
+    public static final int GL_MIN_SAMPLE_SHADING_VALUE                        = 0x8C37;
+    public static final int GL_PRIMITIVES_GENERATED                            = 0x8C87;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_LAYERED                  = 0x8DA7;
+    public static final int GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS            = 0x8DA8;
+    public static final int GL_SAMPLER_BUFFER                                  = 0x8DC2;
+    public static final int GL_INT_SAMPLER_BUFFER                              = 0x8DD0;
+    public static final int GL_UNSIGNED_INT_SAMPLER_BUFFER                     = 0x8DD8;
+    public static final int GL_GEOMETRY_SHADER                                 = 0x8DD9;
+    public static final int GL_MAX_GEOMETRY_UNIFORM_COMPONENTS                 = 0x8DDF;
+    public static final int GL_MAX_GEOMETRY_OUTPUT_VERTICES                    = 0x8DE0;
+    public static final int GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS            = 0x8DE1;
+    public static final int GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS    = 0x8E1E;
+    public static final int GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS = 0x8E1F;
+    public static final int GL_FIRST_VERTEX_CONVENTION                         = 0x8E4D;
+    public static final int GL_LAST_VERTEX_CONVENTION                          = 0x8E4E;
+    public static final int GL_MAX_GEOMETRY_SHADER_INVOCATIONS                 = 0x8E5A;
+    public static final int GL_MIN_FRAGMENT_INTERPOLATION_OFFSET               = 0x8E5B;
+    public static final int GL_MAX_FRAGMENT_INTERPOLATION_OFFSET               = 0x8E5C;
+    public static final int GL_FRAGMENT_INTERPOLATION_OFFSET_BITS              = 0x8E5D;
+    public static final int GL_PATCH_VERTICES                                  = 0x8E72;
+    public static final int GL_TESS_CONTROL_OUTPUT_VERTICES                    = 0x8E75;
+    public static final int GL_TESS_GEN_MODE                                   = 0x8E76;
+    public static final int GL_TESS_GEN_SPACING                                = 0x8E77;
+    public static final int GL_TESS_GEN_VERTEX_ORDER                           = 0x8E78;
+    public static final int GL_TESS_GEN_POINT_MODE                             = 0x8E79;
+    public static final int GL_ISOLINES                                        = 0x8E7A;
+    public static final int GL_FRACTIONAL_ODD                                  = 0x8E7B;
+    public static final int GL_FRACTIONAL_EVEN                                 = 0x8E7C;
+    public static final int GL_MAX_PATCH_VERTICES                              = 0x8E7D;
+    public static final int GL_MAX_TESS_GEN_LEVEL                              = 0x8E7E;
+    public static final int GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS             = 0x8E7F;
+    public static final int GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS          = 0x8E80;
+    public static final int GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS            = 0x8E81;
+    public static final int GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS         = 0x8E82;
+    public static final int GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS              = 0x8E83;
+    public static final int GL_MAX_TESS_PATCH_COMPONENTS                       = 0x8E84;
+    public static final int GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS        = 0x8E85;
+    public static final int GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS           = 0x8E86;
+    public static final int GL_TESS_EVALUATION_SHADER                          = 0x8E87;
+    public static final int GL_TESS_CONTROL_SHADER                             = 0x8E88;
+    public static final int GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS                 = 0x8E89;
+    public static final int GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS              = 0x8E8A;
+    public static final int GL_TEXTURE_CUBE_MAP_ARRAY                          = 0x9009;
+    public static final int GL_TEXTURE_BINDING_CUBE_MAP_ARRAY                  = 0x900A;
+    public static final int GL_SAMPLER_CUBE_MAP_ARRAY                          = 0x900C;
+    public static final int GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW                   = 0x900D;
+    public static final int GL_INT_SAMPLER_CUBE_MAP_ARRAY                      = 0x900E;
+    public static final int GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY             = 0x900F;
+    public static final int GL_IMAGE_BUFFER                                    = 0x9051;
+    public static final int GL_IMAGE_CUBE_MAP_ARRAY                            = 0x9054;
+    public static final int GL_INT_IMAGE_BUFFER                                = 0x905C;
+    public static final int GL_INT_IMAGE_CUBE_MAP_ARRAY                        = 0x905F;
+    public static final int GL_UNSIGNED_INT_IMAGE_BUFFER                       = 0x9067;
+    public static final int GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY               = 0x906A;
+    public static final int GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS                 = 0x90CB;
+    public static final int GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS              = 0x90CC;
+    public static final int GL_MAX_GEOMETRY_IMAGE_UNIFORMS                     = 0x90CD;
+    public static final int GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS              = 0x90D7;
+    public static final int GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS          = 0x90D8;
+    public static final int GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS       = 0x90D9;
+    public static final int GL_TEXTURE_2D_MULTISAMPLE_ARRAY                    = 0x9102;
+    public static final int GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY            = 0x9105;
+    public static final int GL_SAMPLER_2D_MULTISAMPLE_ARRAY                    = 0x910B;
+    public static final int GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY                = 0x910C;
+    public static final int GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY       = 0x910D;
+    public static final int GL_MAX_GEOMETRY_INPUT_COMPONENTS                   = 0x9123;
+    public static final int GL_MAX_GEOMETRY_OUTPUT_COMPONENTS                  = 0x9124;
+    public static final int GL_MAX_DEBUG_MESSAGE_LENGTH                        = 0x9143;
+    public static final int GL_MAX_DEBUG_LOGGED_MESSAGES                       = 0x9144;
+    public static final int GL_DEBUG_LOGGED_MESSAGES                           = 0x9145;
+    public static final int GL_DEBUG_SEVERITY_HIGH                             = 0x9146;
+    public static final int GL_DEBUG_SEVERITY_MEDIUM                           = 0x9147;
+    public static final int GL_DEBUG_SEVERITY_LOW                              = 0x9148;
+    public static final int GL_TEXTURE_BUFFER_OFFSET                           = 0x919D;
+    public static final int GL_TEXTURE_BUFFER_SIZE                             = 0x919E;
+    public static final int GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT                 = 0x919F;
+    public static final int GL_MULTIPLY                                        = 0x9294;
+    public static final int GL_SCREEN                                          = 0x9295;
+    public static final int GL_OVERLAY                                         = 0x9296;
+    public static final int GL_DARKEN                                          = 0x9297;
+    public static final int GL_LIGHTEN                                         = 0x9298;
+    public static final int GL_COLORDODGE                                      = 0x9299;
+    public static final int GL_COLORBURN                                       = 0x929A;
+    public static final int GL_HARDLIGHT                                       = 0x929B;
+    public static final int GL_SOFTLIGHT                                       = 0x929C;
+    public static final int GL_DIFFERENCE                                      = 0x929E;
+    public static final int GL_EXCLUSION                                       = 0x92A0;
+    public static final int GL_HSL_HUE                                         = 0x92AD;
+    public static final int GL_HSL_SATURATION                                  = 0x92AE;
+    public static final int GL_HSL_COLOR                                       = 0x92AF;
+    public static final int GL_HSL_LUMINOSITY                                  = 0x92B0;
+    public static final int GL_PRIMITIVE_BOUNDING_BOX                          = 0x92BE;
+    public static final int GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS         = 0x92CD;
+    public static final int GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS      = 0x92CE;
+    public static final int GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS             = 0x92CF;
+    public static final int GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS                = 0x92D3;
+    public static final int GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS             = 0x92D4;
+    public static final int GL_MAX_GEOMETRY_ATOMIC_COUNTERS                    = 0x92D5;
+    public static final int GL_DEBUG_OUTPUT                                    = 0x92E0;
+    public static final int GL_IS_PER_PATCH                                    = 0x92E7;
+    public static final int GL_REFERENCED_BY_TESS_CONTROL_SHADER               = 0x9307;
+    public static final int GL_REFERENCED_BY_TESS_EVALUATION_SHADER            = 0x9308;
+    public static final int GL_REFERENCED_BY_GEOMETRY_SHADER                   = 0x9309;
+    public static final int GL_FRAMEBUFFER_DEFAULT_LAYERS                      = 0x9312;
+    public static final int GL_MAX_FRAMEBUFFER_LAYERS                          = 0x9317;
+    public static final int GL_MULTISAMPLE_LINE_WIDTH_RANGE                    = 0x9381;
+    public static final int GL_MULTISAMPLE_LINE_WIDTH_GRANULARITY              = 0x9382;
+    public static final int GL_COMPRESSED_RGBA_ASTC_4x4                        = 0x93B0;
+    public static final int GL_COMPRESSED_RGBA_ASTC_5x4                        = 0x93B1;
+    public static final int GL_COMPRESSED_RGBA_ASTC_5x5                        = 0x93B2;
+    public static final int GL_COMPRESSED_RGBA_ASTC_6x5                        = 0x93B3;
+    public static final int GL_COMPRESSED_RGBA_ASTC_6x6                        = 0x93B4;
+    public static final int GL_COMPRESSED_RGBA_ASTC_8x5                        = 0x93B5;
+    public static final int GL_COMPRESSED_RGBA_ASTC_8x6                        = 0x93B6;
+    public static final int GL_COMPRESSED_RGBA_ASTC_8x8                        = 0x93B7;
+    public static final int GL_COMPRESSED_RGBA_ASTC_10x5                       = 0x93B8;
+    public static final int GL_COMPRESSED_RGBA_ASTC_10x6                       = 0x93B9;
+    public static final int GL_COMPRESSED_RGBA_ASTC_10x8                       = 0x93BA;
+    public static final int GL_COMPRESSED_RGBA_ASTC_10x10                      = 0x93BB;
+    public static final int GL_COMPRESSED_RGBA_ASTC_12x10                      = 0x93BC;
+    public static final int GL_COMPRESSED_RGBA_ASTC_12x12                      = 0x93BD;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4                = 0x93D0;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4                = 0x93D1;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5                = 0x93D2;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5                = 0x93D3;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6                = 0x93D4;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5                = 0x93D5;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6                = 0x93D6;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8                = 0x93D7;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5               = 0x93D8;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6               = 0x93D9;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8               = 0x93DA;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10              = 0x93DB;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10              = 0x93DC;
+    public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12              = 0x93DD;
+
+
+    native private static void _nativeClassInit();
+    static {
+        _nativeClassInit();
+    }
+
+    private GLES32() {}
+    // C function void glBlendBarrier ( void )
+
+    public static native void glBlendBarrier(
+    );
+
+    // C function void glCopyImageSubData ( GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth )
+
+    public static native void glCopyImageSubData(
+        int srcName,
+        int srcTarget,
+        int srcLevel,
+        int srcX,
+        int srcY,
+        int srcZ,
+        int dstName,
+        int dstTarget,
+        int dstLevel,
+        int dstX,
+        int dstY,
+        int dstZ,
+        int srcWidth,
+        int srcHeight,
+        int srcDepth
+    );
+
+    // C function void glDebugMessageControl ( GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled )
+
+    public static native void glDebugMessageControl(
+        int source,
+        int type,
+        int severity,
+        int count,
+        int[] ids,
+        int offset,
+        boolean enabled
+    );
+
+    // C function void glDebugMessageControl ( GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled )
+
+    public static native void glDebugMessageControl(
+        int source,
+        int type,
+        int severity,
+        int count,
+        java.nio.IntBuffer ids,
+        boolean enabled
+    );
+
+    // C function void glDebugMessageInsert ( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf )
+
+    public static native void glDebugMessageInsert(
+        int source,
+        int type,
+        int id,
+        int severity,
+        int length,
+        String buf
+    );
+
+    // C function void glDebugMessageCallback ( GLDEBUGPROC callback, const void *userParam )
+
+    public interface DebugProc {
+        void onMessage(int source, int type, int id, int severity, String message);
+    }
+
+    public static native void glDebugMessageCallback(DebugProc callback);
+
+    // C function GLuint glGetDebugMessageLog ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog )
+
+    public static native int glGetDebugMessageLog(
+        int count,
+        int bufSize,
+        int[] sources,
+        int sourcesOffset,
+        int[] types,
+        int typesOffset,
+        int[] ids,
+        int idsOffset,
+        int[] severities,
+        int severitiesOffset,
+        int[] lengths,
+        int lengthsOffset,
+        byte[] messageLog,
+        int messageLogOffset);
+
+    // C function GLuint glGetDebugMessageLog ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog )
+
+    public static native int glGetDebugMessageLog(
+        int count,
+        java.nio.IntBuffer sources,
+        java.nio.IntBuffer types,
+        java.nio.IntBuffer ids,
+        java.nio.IntBuffer severities,
+        java.nio.IntBuffer lengths,
+        java.nio.ByteBuffer messageLog);
+
+    // C function GLuint glGetDebugMessageLog ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog )
+
+    public static native String[] glGetDebugMessageLog(
+        int count,
+        int[] sources,
+        int sourcesOffset,
+        int[] types,
+        int typesOffset,
+        int[] ids,
+        int idsOffset,
+        int[] severities,
+        int severitiesOffset);
+
+    // C function GLuint glGetDebugMessageLog ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog )
+
+    public static native String[] glGetDebugMessageLog(
+        int count,
+        java.nio.IntBuffer sources,
+        java.nio.IntBuffer types,
+        java.nio.IntBuffer ids,
+        java.nio.IntBuffer severities);
+
+    // C function void glPushDebugGroup ( GLenum source, GLuint id, GLsizei length, const GLchar *message )
+
+    public static native void glPushDebugGroup(
+        int source,
+        int id,
+        int length,
+        String message
+    );
+
+    // C function void glPopDebugGroup ( void )
+
+    public static native void glPopDebugGroup(
+    );
+
+    // C function void glObjectLabel ( GLenum identifier, GLuint name, GLsizei length, const GLchar *label )
+
+    public static native void glObjectLabel(
+        int identifier,
+        int name,
+        int length,
+        String label
+    );
+
+    // C function void glGetObjectLabel ( GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label )
+
+    public static native String glGetObjectLabel(int identifier, int name);
+
+    // C function void glObjectPtrLabel ( const void *ptr, GLsizei length, const GLchar *label )
+
+    public static native void glObjectPtrLabel(long ptr, String label);
+
+    // C function void glGetObjectPtrLabel ( const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label )
+
+    public static native String glGetObjectPtrLabel(long ptr);
+
+    // C function void glGetPointerv ( GLenum pname, void **params )
+
+    public static native long glGetPointerv(
+        int pname
+    );
+
+    // C function void glEnablei ( GLenum target, GLuint index )
+
+    public static native void glEnablei(
+        int target,
+        int index
+    );
+
+    // C function void glDisablei ( GLenum target, GLuint index )
+
+    public static native void glDisablei(
+        int target,
+        int index
+    );
+
+    // C function void glBlendEquationi ( GLuint buf, GLenum mode )
+
+    public static native void glBlendEquationi(
+        int buf,
+        int mode
+    );
+
+    // C function void glBlendEquationSeparatei ( GLuint buf, GLenum modeRGB, GLenum modeAlpha )
+
+    public static native void glBlendEquationSeparatei(
+        int buf,
+        int modeRGB,
+        int modeAlpha
+    );
+
+    // C function void glBlendFunci ( GLuint buf, GLenum src, GLenum dst )
+
+    public static native void glBlendFunci(
+        int buf,
+        int src,
+        int dst
+    );
+
+    // C function void glBlendFuncSeparatei ( GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha )
+
+    public static native void glBlendFuncSeparatei(
+        int buf,
+        int srcRGB,
+        int dstRGB,
+        int srcAlpha,
+        int dstAlpha
+    );
+
+    // C function void glColorMaski ( GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a )
+
+    public static native void glColorMaski(
+        int index,
+        boolean r,
+        boolean g,
+        boolean b,
+        boolean a
+    );
+
+    // C function GLboolean glIsEnabledi ( GLenum target, GLuint index )
+
+    public static native boolean glIsEnabledi(
+        int target,
+        int index
+    );
+
+    // C function void glDrawElementsBaseVertex ( GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex )
+
+    public static native void glDrawElementsBaseVertex(
+        int mode,
+        int count,
+        int type,
+        java.nio.Buffer indices,
+        int basevertex
+    );
+
+    // C function void glDrawRangeElementsBaseVertex ( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex )
+
+    public static native void glDrawRangeElementsBaseVertex(
+        int mode,
+        int start,
+        int end,
+        int count,
+        int type,
+        java.nio.Buffer indices,
+        int basevertex
+    );
+
+    // C function void glDrawElementsInstancedBaseVertex ( GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instanceCount, GLint basevertex )
+
+    public static native void glDrawElementsInstancedBaseVertex(
+        int mode,
+        int count,
+        int type,
+        java.nio.Buffer indices,
+        int instanceCount,
+        int basevertex
+    );
+
+    // C function void glDrawElementsInstancedBaseVertex ( GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instanceCount, GLint basevertex )
+
+    public static native void glDrawElementsInstancedBaseVertex(
+        int mode,
+        int count,
+        int type,
+        int indicesOffset,
+        int instanceCount,
+        int basevertex
+    );
+
+    // C function void glFramebufferTexture ( GLenum target, GLenum attachment, GLuint texture, GLint level )
+
+    public static native void glFramebufferTexture(
+        int target,
+        int attachment,
+        int texture,
+        int level
+    );
+
+    // C function void glPrimitiveBoundingBox ( GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW )
+
+    public static native void glPrimitiveBoundingBox(
+        float minX,
+        float minY,
+        float minZ,
+        float minW,
+        float maxX,
+        float maxY,
+        float maxZ,
+        float maxW
+    );
+
+    // C function GLenum glGetGraphicsResetStatus ( void )
+
+    public static native int glGetGraphicsResetStatus(
+    );
+
+    // C function void glReadnPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data )
+
+    public static native void glReadnPixels(
+        int x,
+        int y,
+        int width,
+        int height,
+        int format,
+        int type,
+        int bufSize,
+        java.nio.Buffer data
+    );
+
+    // C function void glGetnUniformfv ( GLuint program, GLint location, GLsizei bufSize, GLfloat *params )
+
+    public static native void glGetnUniformfv(
+        int program,
+        int location,
+        int bufSize,
+        float[] params,
+        int offset
+    );
+
+    // C function void glGetnUniformfv ( GLuint program, GLint location, GLsizei bufSize, GLfloat *params )
+
+    public static native void glGetnUniformfv(
+        int program,
+        int location,
+        int bufSize,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glGetnUniformiv ( GLuint program, GLint location, GLsizei bufSize, GLint *params )
+
+    public static native void glGetnUniformiv(
+        int program,
+        int location,
+        int bufSize,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetnUniformiv ( GLuint program, GLint location, GLsizei bufSize, GLint *params )
+
+    public static native void glGetnUniformiv(
+        int program,
+        int location,
+        int bufSize,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetnUniformuiv ( GLuint program, GLint location, GLsizei bufSize, GLuint *params )
+
+    public static native void glGetnUniformuiv(
+        int program,
+        int location,
+        int bufSize,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetnUniformuiv ( GLuint program, GLint location, GLsizei bufSize, GLuint *params )
+
+    public static native void glGetnUniformuiv(
+        int program,
+        int location,
+        int bufSize,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glMinSampleShading ( GLfloat value )
+
+    public static native void glMinSampleShading(
+        float value
+    );
+
+    // C function void glPatchParameteri ( GLenum pname, GLint value )
+
+    public static native void glPatchParameteri(
+        int pname,
+        int value
+    );
+
+    // C function void glTexParameterIiv ( GLenum target, GLenum pname, const GLint *params )
+
+    public static native void glTexParameterIiv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glTexParameterIiv ( GLenum target, GLenum pname, const GLint *params )
+
+    public static native void glTexParameterIiv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glTexParameterIuiv ( GLenum target, GLenum pname, const GLuint *params )
+
+    public static native void glTexParameterIuiv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glTexParameterIuiv ( GLenum target, GLenum pname, const GLuint *params )
+
+    public static native void glTexParameterIuiv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetTexParameterIiv ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetTexParameterIiv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexParameterIiv ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetTexParameterIiv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetTexParameterIuiv ( GLenum target, GLenum pname, GLuint *params )
+
+    public static native void glGetTexParameterIuiv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexParameterIuiv ( GLenum target, GLenum pname, GLuint *params )
+
+    public static native void glGetTexParameterIuiv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glSamplerParameterIiv ( GLuint sampler, GLenum pname, const GLint *param )
+
+    public static native void glSamplerParameterIiv(
+        int sampler,
+        int pname,
+        int[] param,
+        int offset
+    );
+
+    // C function void glSamplerParameterIiv ( GLuint sampler, GLenum pname, const GLint *param )
+
+    public static native void glSamplerParameterIiv(
+        int sampler,
+        int pname,
+        java.nio.IntBuffer param
+    );
+
+    // C function void glSamplerParameterIuiv ( GLuint sampler, GLenum pname, const GLuint *param )
+
+    public static native void glSamplerParameterIuiv(
+        int sampler,
+        int pname,
+        int[] param,
+        int offset
+    );
+
+    // C function void glSamplerParameterIuiv ( GLuint sampler, GLenum pname, const GLuint *param )
+
+    public static native void glSamplerParameterIuiv(
+        int sampler,
+        int pname,
+        java.nio.IntBuffer param
+    );
+
+    // C function void glGetSamplerParameterIiv ( GLuint sampler, GLenum pname, GLint *params )
+
+    public static native void glGetSamplerParameterIiv(
+        int sampler,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetSamplerParameterIiv ( GLuint sampler, GLenum pname, GLint *params )
+
+    public static native void glGetSamplerParameterIiv(
+        int sampler,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetSamplerParameterIuiv ( GLuint sampler, GLenum pname, GLuint *params )
+
+    public static native void glGetSamplerParameterIuiv(
+        int sampler,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetSamplerParameterIuiv ( GLuint sampler, GLenum pname, GLuint *params )
+
+    public static native void glGetSamplerParameterIuiv(
+        int sampler,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glTexBuffer ( GLenum target, GLenum internalformat, GLuint buffer )
+
+    public static native void glTexBuffer(
+        int target,
+        int internalformat,
+        int buffer
+    );
+
+    // C function void glTexBufferRange ( GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size )
+
+    public static native void glTexBufferRange(
+        int target,
+        int internalformat,
+        int buffer,
+        int offset,
+        int size
+    );
+
+    // C function void glTexStorage3DMultisample ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations )
+
+    public static native void glTexStorage3DMultisample(
+        int target,
+        int samples,
+        int internalformat,
+        int width,
+        int height,
+        int depth,
+        boolean fixedsamplelocations
+    );
+
+}
diff --git a/android/opengl/GLErrorWrapper.java b/android/opengl/GLErrorWrapper.java
new file mode 100644
index 0000000..66159a8
--- /dev/null
+++ b/android/opengl/GLErrorWrapper.java
@@ -0,0 +1,1663 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.opengl;
+
+import java.nio.Buffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.ShortBuffer;
+
+import javax.microedition.khronos.opengles.GL;
+
+/**
+ * Implement an error checking wrapper. The wrapper will automatically call
+     * glError after each GL operation, and throw a GLException if an error
+     * occurs. (By design, calling glError itself will not cause an exception
+     * to be thrown.) Enabling error checking is an alternative to manually
+     *  calling glError after every GL operation.
+ */
+class GLErrorWrapper extends GLWrapperBase {
+    boolean mCheckError;
+    boolean mCheckThread;
+    Thread mOurThread;
+
+    public GLErrorWrapper(GL gl, int configFlags) {
+        super(gl);
+        mCheckError = (configFlags & GLDebugHelper.CONFIG_CHECK_GL_ERROR) != 0;
+        mCheckThread = (configFlags & GLDebugHelper.CONFIG_CHECK_THREAD) != 0;
+    }
+
+    private void checkThread() {
+        if (mCheckThread) {
+            Thread currentThread = Thread.currentThread();
+            if (mOurThread == null) {
+                mOurThread = currentThread;
+            } else {
+                if (!mOurThread.equals(currentThread)) {
+                    throw new GLException(GLDebugHelper.ERROR_WRONG_THREAD,
+                            "OpenGL method called from wrong thread.");
+                }
+            }
+        }
+    }
+
+    private void checkError() {
+        if (mCheckError) {
+            int glError;
+            if ((glError = mgl.glGetError()) != 0) {
+                throw new GLException(glError);
+            }
+        }
+    }
+
+    // ---------------------------------------------------------------------
+    // GL10 methods:
+
+    public void glActiveTexture(int texture) {
+        checkThread();
+        mgl.glActiveTexture(texture);
+        checkError();
+    }
+
+    public void glAlphaFunc(int func, float ref) {
+        checkThread();
+        mgl.glAlphaFunc(func, ref);
+        checkError();
+    }
+
+    public void glAlphaFuncx(int func, int ref) {
+        checkThread();
+        mgl.glAlphaFuncx(func, ref);
+        checkError();
+    }
+
+    public void glBindTexture(int target, int texture) {
+        checkThread();
+        mgl.glBindTexture(target, texture);
+        checkError();
+    }
+
+    public void glBlendFunc(int sfactor, int dfactor) {
+        checkThread();
+        mgl.glBlendFunc(sfactor, dfactor);
+        checkError();
+    }
+
+    public void glClear(int mask) {
+        checkThread();
+        mgl.glClear(mask);
+        checkError();
+    }
+
+    public void glClearColor(float red, float green, float blue, float alpha) {
+        checkThread();
+        mgl.glClearColor(red, green, blue, alpha);
+        checkError();
+    }
+
+    public void glClearColorx(int red, int green, int blue, int alpha) {
+        checkThread();
+        mgl.glClearColorx(red, green, blue, alpha);
+        checkError();
+    }
+
+    public void glClearDepthf(float depth) {
+        checkThread();
+        mgl.glClearDepthf(depth);
+        checkError();
+    }
+
+    public void glClearDepthx(int depth) {
+        checkThread();
+        mgl.glClearDepthx(depth);
+        checkError();
+    }
+
+    public void glClearStencil(int s) {
+        checkThread();
+        mgl.glClearStencil(s);
+        checkError();
+    }
+
+    public void glClientActiveTexture(int texture) {
+        checkThread();
+        mgl.glClientActiveTexture(texture);
+        checkError();
+    }
+
+    public void glColor4f(float red, float green, float blue, float alpha) {
+        checkThread();
+        mgl.glColor4f(red, green, blue, alpha);
+        checkError();
+    }
+
+    public void glColor4x(int red, int green, int blue, int alpha) {
+        checkThread();
+        mgl.glColor4x(red, green, blue, alpha);
+        checkError();
+    }
+
+    public void glColorMask(boolean red, boolean green, boolean blue,
+            boolean alpha) {
+        checkThread();
+        mgl.glColorMask(red, green, blue, alpha);
+        checkError();
+    }
+
+    public void glColorPointer(int size, int type, int stride, Buffer pointer) {
+        checkThread();
+        mgl.glColorPointer(size, type, stride, pointer);
+        checkError();
+    }
+
+    public void glCompressedTexImage2D(int target, int level,
+            int internalformat, int width, int height, int border,
+            int imageSize, Buffer data) {
+        checkThread();
+        mgl.glCompressedTexImage2D(target, level, internalformat, width,
+                height, border, imageSize, data);
+        checkError();
+    }
+
+    public void glCompressedTexSubImage2D(int target, int level, int xoffset,
+            int yoffset, int width, int height, int format, int imageSize,
+            Buffer data) {
+        checkThread();
+        mgl.glCompressedTexSubImage2D(target, level, xoffset, yoffset, width,
+                height, format, imageSize, data);
+        checkError();
+    }
+
+    public void glCopyTexImage2D(int target, int level, int internalformat,
+            int x, int y, int width, int height, int border) {
+        checkThread();
+        mgl.glCopyTexImage2D(target, level, internalformat, x, y, width,
+                height, border);
+        checkError();
+    }
+
+    public void glCopyTexSubImage2D(int target, int level, int xoffset,
+            int yoffset, int x, int y, int width, int height) {
+        checkThread();
+        mgl.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width,
+                height);
+        checkError();
+    }
+
+    public void glCullFace(int mode) {
+        checkThread();
+        mgl.glCullFace(mode);
+        checkError();
+    }
+
+    public void glDeleteTextures(int n, int[] textures, int offset) {
+        checkThread();
+        mgl.glDeleteTextures(n, textures, offset);
+        checkError();
+    }
+
+    public void glDeleteTextures(int n, IntBuffer textures) {
+        checkThread();
+        mgl.glDeleteTextures(n, textures);
+        checkError();
+    }
+
+    public void glDepthFunc(int func) {
+        checkThread();
+        mgl.glDepthFunc(func);
+        checkError();
+    }
+
+    public void glDepthMask(boolean flag) {
+        checkThread();
+        mgl.glDepthMask(flag);
+        checkError();
+    }
+
+    public void glDepthRangef(float near, float far) {
+        checkThread();
+        mgl.glDepthRangef(near, far);
+        checkError();
+    }
+
+    public void glDepthRangex(int near, int far) {
+        checkThread();
+        mgl.glDepthRangex(near, far);
+        checkError();
+    }
+
+    public void glDisable(int cap) {
+        checkThread();
+        mgl.glDisable(cap);
+        checkError();
+    }
+
+    public void glDisableClientState(int array) {
+        checkThread();
+        mgl.glDisableClientState(array);
+        checkError();
+    }
+
+    public void glDrawArrays(int mode, int first, int count) {
+        checkThread();
+        mgl.glDrawArrays(mode, first, count);
+        checkError();
+    }
+
+    public void glDrawElements(int mode, int count, int type, Buffer indices) {
+        checkThread();
+        mgl.glDrawElements(mode, count, type, indices);
+        checkError();
+    }
+
+    public void glEnable(int cap) {
+        checkThread();
+        mgl.glEnable(cap);
+        checkError();
+    }
+
+    public void glEnableClientState(int array) {
+        checkThread();
+        mgl.glEnableClientState(array);
+        checkError();
+    }
+
+    public void glFinish() {
+        checkThread();
+        mgl.glFinish();
+        checkError();
+    }
+
+    public void glFlush() {
+        checkThread();
+        mgl.glFlush();
+        checkError();
+    }
+
+    public void glFogf(int pname, float param) {
+        checkThread();
+        mgl.glFogf(pname, param);
+        checkError();
+    }
+
+    public void glFogfv(int pname, float[] params, int offset) {
+        checkThread();
+        mgl.glFogfv(pname, params, offset);
+        checkError();
+    }
+
+    public void glFogfv(int pname, FloatBuffer params) {
+        checkThread();
+        mgl.glFogfv(pname, params);
+        checkError();
+    }
+
+    public void glFogx(int pname, int param) {
+        checkThread();
+        mgl.glFogx(pname, param);
+        checkError();
+    }
+
+    public void glFogxv(int pname, int[] params, int offset) {
+        checkThread();
+        mgl.glFogxv(pname, params, offset);
+        checkError();
+    }
+
+    public void glFogxv(int pname, IntBuffer params) {
+        checkThread();
+        mgl.glFogxv(pname, params);
+        checkError();
+    }
+
+    public void glFrontFace(int mode) {
+        checkThread();
+        mgl.glFrontFace(mode);
+        checkError();
+    }
+
+    public void glFrustumf(float left, float right, float bottom, float top,
+            float near, float far) {
+        checkThread();
+        mgl.glFrustumf(left, right, bottom, top, near, far);
+        checkError();
+    }
+
+    public void glFrustumx(int left, int right, int bottom, int top, int near,
+            int far) {
+        checkThread();
+        mgl.glFrustumx(left, right, bottom, top, near, far);
+        checkError();
+    }
+
+    public void glGenTextures(int n, int[] textures, int offset) {
+        checkThread();
+        mgl.glGenTextures(n, textures, offset);
+        checkError();
+    }
+
+    public void glGenTextures(int n, IntBuffer textures) {
+        checkThread();
+        mgl.glGenTextures(n, textures);
+        checkError();
+    }
+
+    public int glGetError() {
+        checkThread();
+        int result = mgl.glGetError();
+        return result;
+    }
+
+    public void glGetIntegerv(int pname, int[] params, int offset) {
+        checkThread();
+        mgl.glGetIntegerv(pname, params, offset);
+        checkError();
+    }
+
+    public void glGetIntegerv(int pname, IntBuffer params) {
+        checkThread();
+        mgl.glGetIntegerv(pname, params);
+        checkError();
+    }
+
+    public String glGetString(int name) {
+        checkThread();
+        String result = mgl.glGetString(name);
+        checkError();
+        return result;
+    }
+
+    public void glHint(int target, int mode) {
+        checkThread();
+        mgl.glHint(target, mode);
+        checkError();
+    }
+
+    public void glLightModelf(int pname, float param) {
+        checkThread();
+        mgl.glLightModelf(pname, param);
+        checkError();
+    }
+
+    public void glLightModelfv(int pname, float[] params, int offset) {
+        checkThread();
+        mgl.glLightModelfv(pname, params, offset);
+        checkError();
+    }
+
+    public void glLightModelfv(int pname, FloatBuffer params) {
+        checkThread();
+        mgl.glLightModelfv(pname, params);
+        checkError();
+    }
+
+    public void glLightModelx(int pname, int param) {
+        checkThread();
+        mgl.glLightModelx(pname, param);
+        checkError();
+    }
+
+    public void glLightModelxv(int pname, int[] params, int offset) {
+        checkThread();
+        mgl.glLightModelxv(pname, params, offset);
+        checkError();
+    }
+
+    public void glLightModelxv(int pname, IntBuffer params) {
+        checkThread();
+        mgl.glLightModelxv(pname, params);
+        checkError();
+    }
+
+    public void glLightf(int light, int pname, float param) {
+        checkThread();
+        mgl.glLightf(light, pname, param);
+        checkError();
+    }
+
+    public void glLightfv(int light, int pname, float[] params, int offset) {
+        checkThread();
+        mgl.glLightfv(light, pname, params, offset);
+        checkError();
+    }
+
+    public void glLightfv(int light, int pname, FloatBuffer params) {
+        checkThread();
+        mgl.glLightfv(light, pname, params);
+        checkError();
+    }
+
+    public void glLightx(int light, int pname, int param) {
+        checkThread();
+        mgl.glLightx(light, pname, param);
+        checkError();
+    }
+
+    public void glLightxv(int light, int pname, int[] params, int offset) {
+        checkThread();
+        mgl.glLightxv(light, pname, params, offset);
+        checkError();
+    }
+
+    public void glLightxv(int light, int pname, IntBuffer params) {
+        checkThread();
+        mgl.glLightxv(light, pname, params);
+        checkError();
+    }
+
+    public void glLineWidth(float width) {
+        checkThread();
+        mgl.glLineWidth(width);
+        checkError();
+    }
+
+    public void glLineWidthx(int width) {
+        checkThread();
+        mgl.glLineWidthx(width);
+        checkError();
+    }
+
+    public void glLoadIdentity() {
+        checkThread();
+        mgl.glLoadIdentity();
+        checkError();
+    }
+
+    public void glLoadMatrixf(float[] m, int offset) {
+        checkThread();
+        mgl.glLoadMatrixf(m, offset);
+        checkError();
+    }
+
+    public void glLoadMatrixf(FloatBuffer m) {
+        checkThread();
+        mgl.glLoadMatrixf(m);
+        checkError();
+    }
+
+    public void glLoadMatrixx(int[] m, int offset) {
+        checkThread();
+        mgl.glLoadMatrixx(m, offset);
+        checkError();
+    }
+
+    public void glLoadMatrixx(IntBuffer m) {
+        checkThread();
+        mgl.glLoadMatrixx(m);
+        checkError();
+    }
+
+    public void glLogicOp(int opcode) {
+        checkThread();
+        mgl.glLogicOp(opcode);
+        checkError();
+    }
+
+    public void glMaterialf(int face, int pname, float param) {
+        checkThread();
+        mgl.glMaterialf(face, pname, param);
+        checkError();
+    }
+
+    public void glMaterialfv(int face, int pname, float[] params, int offset) {
+        checkThread();
+        mgl.glMaterialfv(face, pname, params, offset);
+        checkError();
+    }
+
+    public void glMaterialfv(int face, int pname, FloatBuffer params) {
+        checkThread();
+        mgl.glMaterialfv(face, pname, params);
+        checkError();
+    }
+
+    public void glMaterialx(int face, int pname, int param) {
+        checkThread();
+        mgl.glMaterialx(face, pname, param);
+        checkError();
+    }
+
+    public void glMaterialxv(int face, int pname, int[] params, int offset) {
+        checkThread();
+        mgl.glMaterialxv(face, pname, params, offset);
+        checkError();
+    }
+
+    public void glMaterialxv(int face, int pname, IntBuffer params) {
+        checkThread();
+        mgl.glMaterialxv(face, pname, params);
+        checkError();
+    }
+
+    public void glMatrixMode(int mode) {
+        checkThread();
+        mgl.glMatrixMode(mode);
+        checkError();
+    }
+
+    public void glMultMatrixf(float[] m, int offset) {
+        checkThread();
+        mgl.glMultMatrixf(m, offset);
+        checkError();
+    }
+
+    public void glMultMatrixf(FloatBuffer m) {
+        checkThread();
+        mgl.glMultMatrixf(m);
+        checkError();
+    }
+
+    public void glMultMatrixx(int[] m, int offset) {
+        checkThread();
+        mgl.glMultMatrixx(m, offset);
+        checkError();
+    }
+
+    public void glMultMatrixx(IntBuffer m) {
+        checkThread();
+        mgl.glMultMatrixx(m);
+        checkError();
+    }
+
+    public void glMultiTexCoord4f(int target,
+            float s, float t, float r, float q) {
+        checkThread();
+        mgl.glMultiTexCoord4f(target, s, t, r, q);
+        checkError();
+    }
+
+    public void glMultiTexCoord4x(int target, int s, int t, int r, int q) {
+        checkThread();
+        mgl.glMultiTexCoord4x(target, s, t, r, q);
+        checkError();
+    }
+
+    public void glNormal3f(float nx, float ny, float nz) {
+        checkThread();
+        mgl.glNormal3f(nx, ny, nz);
+        checkError();
+    }
+
+    public void glNormal3x(int nx, int ny, int nz) {
+        checkThread();
+        mgl.glNormal3x(nx, ny, nz);
+        checkError();
+    }
+
+    public void glNormalPointer(int type, int stride, Buffer pointer) {
+        checkThread();
+        mgl.glNormalPointer(type, stride, pointer);
+        checkError();
+    }
+
+    public void glOrthof(float left, float right, float bottom, float top,
+            float near, float far) {
+        checkThread();
+        mgl.glOrthof(left, right, bottom, top, near, far);
+        checkError();
+    }
+
+    public void glOrthox(int left, int right, int bottom, int top, int near,
+            int far) {
+        checkThread();
+        mgl.glOrthox(left, right, bottom, top, near, far);
+        checkError();
+    }
+
+    public void glPixelStorei(int pname, int param) {
+        checkThread();
+        mgl.glPixelStorei(pname, param);
+        checkError();
+    }
+
+    public void glPointSize(float size) {
+        checkThread();
+        mgl.glPointSize(size);
+        checkError();
+    }
+
+    public void glPointSizex(int size) {
+        checkThread();
+        mgl.glPointSizex(size);
+        checkError();
+    }
+
+    public void glPolygonOffset(float factor, float units) {
+        checkThread();
+        mgl.glPolygonOffset(factor, units);
+        checkError();
+    }
+
+    public void glPolygonOffsetx(int factor, int units) {
+        checkThread();
+        mgl.glPolygonOffsetx(factor, units);
+        checkError();
+    }
+
+    public void glPopMatrix() {
+        checkThread();
+        mgl.glPopMatrix();
+        checkError();
+    }
+
+    public void glPushMatrix() {
+        checkThread();
+        mgl.glPushMatrix();
+        checkError();
+    }
+
+    public void glReadPixels(int x, int y, int width, int height, int format,
+            int type, Buffer pixels) {
+        checkThread();
+        mgl.glReadPixels(x, y, width, height, format, type, pixels);
+        checkError();
+    }
+
+    public void glRotatef(float angle, float x, float y, float z) {
+        checkThread();
+        mgl.glRotatef(angle, x, y, z);
+        checkError();
+    }
+
+    public void glRotatex(int angle, int x, int y, int z) {
+        checkThread();
+        mgl.glRotatex(angle, x, y, z);
+        checkError();
+    }
+
+    public void glSampleCoverage(float value, boolean invert) {
+        checkThread();
+        mgl.glSampleCoverage(value, invert);
+        checkError();
+    }
+
+    public void glSampleCoveragex(int value, boolean invert) {
+        checkThread();
+        mgl.glSampleCoveragex(value, invert);
+        checkError();
+    }
+
+    public void glScalef(float x, float y, float z) {
+        checkThread();
+        mgl.glScalef(x, y, z);
+        checkError();
+    }
+
+    public void glScalex(int x, int y, int z) {
+        checkThread();
+        mgl.glScalex(x, y, z);
+        checkError();
+    }
+
+    public void glScissor(int x, int y, int width, int height) {
+        checkThread();
+        mgl.glScissor(x, y, width, height);
+        checkError();
+    }
+
+    public void glShadeModel(int mode) {
+        checkThread();
+        mgl.glShadeModel(mode);
+        checkError();
+    }
+
+    public void glStencilFunc(int func, int ref, int mask) {
+        checkThread();
+        mgl.glStencilFunc(func, ref, mask);
+        checkError();
+    }
+
+    public void glStencilMask(int mask) {
+        checkThread();
+        mgl.glStencilMask(mask);
+        checkError();
+    }
+
+    public void glStencilOp(int fail, int zfail, int zpass) {
+        checkThread();
+        mgl.glStencilOp(fail, zfail, zpass);
+        checkError();
+    }
+
+    public void glTexCoordPointer(int size, int type,
+            int stride, Buffer pointer) {
+        checkThread();
+        mgl.glTexCoordPointer(size, type, stride, pointer);
+        checkError();
+    }
+
+    public void glTexEnvf(int target, int pname, float param) {
+        checkThread();
+        mgl.glTexEnvf(target, pname, param);
+        checkError();
+    }
+
+    public void glTexEnvfv(int target, int pname, float[] params, int offset) {
+        checkThread();
+        mgl.glTexEnvfv(target, pname, params, offset);
+        checkError();
+    }
+
+    public void glTexEnvfv(int target, int pname, FloatBuffer params) {
+        checkThread();
+        mgl.glTexEnvfv(target, pname, params);
+        checkError();
+    }
+
+    public void glTexEnvx(int target, int pname, int param) {
+        checkThread();
+        mgl.glTexEnvx(target, pname, param);
+        checkError();
+    }
+
+    public void glTexEnvxv(int target, int pname, int[] params, int offset) {
+        checkThread();
+        mgl.glTexEnvxv(target, pname, params, offset);
+        checkError();
+    }
+
+    public void glTexEnvxv(int target, int pname, IntBuffer params) {
+        checkThread();
+        mgl.glTexEnvxv(target, pname, params);
+        checkError();
+    }
+
+    public void glTexImage2D(int target, int level, int internalformat,
+            int width, int height, int border, int format, int type,
+            Buffer pixels) {
+        checkThread();
+        mgl.glTexImage2D(target, level, internalformat, width, height, border,
+                format, type, pixels);
+        checkError();
+    }
+
+    public void glTexParameterf(int target, int pname, float param) {
+        checkThread();
+        mgl.glTexParameterf(target, pname, param);
+        checkError();
+    }
+
+    public void glTexParameterx(int target, int pname, int param) {
+        checkThread();
+        mgl.glTexParameterx(target, pname, param);
+        checkError();
+    }
+
+    public void glTexParameteriv(int target, int pname, int[] params, int offset) {
+        checkThread();
+        mgl11.glTexParameteriv(target, pname, params, offset);
+        checkError();
+    }
+
+    public void glTexParameteriv(int target, int pname, IntBuffer params) {
+        checkThread();
+        mgl11.glTexParameteriv(target, pname, params);
+        checkError();
+    }
+
+    public void glTexSubImage2D(int target, int level, int xoffset,
+            int yoffset, int width, int height, int format, int type,
+            Buffer pixels) {
+        checkThread();
+        mgl.glTexSubImage2D(target, level, xoffset, yoffset, width, height,
+                format, type, pixels);
+        checkError();
+    }
+
+    public void glTranslatef(float x, float y, float z) {
+        checkThread();
+        mgl.glTranslatef(x, y, z);
+        checkError();
+    }
+
+    public void glTranslatex(int x, int y, int z) {
+        checkThread();
+        mgl.glTranslatex(x, y, z);
+        checkError();
+    }
+
+    public void glVertexPointer(int size, int type,
+            int stride, Buffer pointer) {
+        checkThread();
+        mgl.glVertexPointer(size, type, stride, pointer);
+        checkError();
+    }
+
+    public void glViewport(int x, int y, int width, int height) {
+        checkThread();
+        mgl.glViewport(x, y, width, height);
+        checkError();
+    }
+
+    public void glClipPlanef(int plane, float[] equation, int offset) {
+        checkThread();
+        mgl11.glClipPlanef(plane, equation, offset);
+        checkError();
+    }
+
+    public void glClipPlanef(int plane, FloatBuffer equation) {
+        checkThread();
+        mgl11.glClipPlanef(plane, equation);
+        checkError();
+    }
+
+    public void glClipPlanex(int plane, int[] equation, int offset) {
+        checkThread();
+        mgl11.glClipPlanex(plane, equation, offset);
+        checkError();
+    }
+
+    public void glClipPlanex(int plane, IntBuffer equation) {
+        checkThread();
+        mgl11.glClipPlanex(plane, equation);
+        checkError();
+    }
+
+    // Draw Texture Extension
+
+    public void glDrawTexfOES(float x, float y, float z,
+        float width, float height) {
+        checkThread();
+        mgl11Ext.glDrawTexfOES(x, y, z, width, height);
+        checkError();
+    }
+
+    public void glDrawTexfvOES(float[] coords, int offset) {
+        checkThread();
+        mgl11Ext.glDrawTexfvOES(coords, offset);
+        checkError();
+    }
+
+    public void glDrawTexfvOES(FloatBuffer coords) {
+        checkThread();
+        mgl11Ext.glDrawTexfvOES(coords);
+        checkError();
+    }
+
+    public void glDrawTexiOES(int x, int y, int z, int width, int height) {
+        checkThread();
+        mgl11Ext.glDrawTexiOES(x, y, z, width, height);
+        checkError();
+    }
+
+    public void glDrawTexivOES(int[] coords, int offset) {
+        checkThread();
+        mgl11Ext.glDrawTexivOES(coords, offset);
+        checkError();
+    }
+
+    public void glDrawTexivOES(IntBuffer coords) {
+        checkThread();
+        mgl11Ext.glDrawTexivOES(coords);
+        checkError();
+    }
+
+    public void glDrawTexsOES(short x, short y, short z,
+        short width, short height) {
+        checkThread();
+        mgl11Ext.glDrawTexsOES(x, y, z, width, height);
+        checkError();
+    }
+
+    public void glDrawTexsvOES(short[] coords, int offset) {
+        checkThread();
+        mgl11Ext.glDrawTexsvOES(coords, offset);
+        checkError();
+    }
+
+    public void glDrawTexsvOES(ShortBuffer coords) {
+        checkThread();
+        mgl11Ext.glDrawTexsvOES(coords);
+        checkError();
+    }
+
+    public void glDrawTexxOES(int x, int y, int z, int width, int height) {
+        checkThread();
+        mgl11Ext.glDrawTexxOES(x, y, z, width, height);
+        checkError();
+    }
+
+    public void glDrawTexxvOES(int[] coords, int offset) {
+        checkThread();
+        mgl11Ext.glDrawTexxvOES(coords, offset);
+        checkError();
+    }
+
+    public void glDrawTexxvOES(IntBuffer coords) {
+        checkThread();
+        mgl11Ext.glDrawTexxvOES(coords);
+        checkError();
+    }
+
+    public int glQueryMatrixxOES(int[] mantissa, int mantissaOffset,
+        int[] exponent, int exponentOffset) {
+        checkThread();
+        int valid = mgl10Ext.glQueryMatrixxOES(mantissa, mantissaOffset,
+            exponent, exponentOffset);
+        checkError();
+        return valid;
+    }
+
+    public int glQueryMatrixxOES(IntBuffer mantissa, IntBuffer exponent) {
+        checkThread();
+        int valid = mgl10Ext.glQueryMatrixxOES(mantissa, exponent);
+        checkError();
+        return valid;
+    }
+
+    public void glBindBuffer(int target, int buffer) {
+        checkThread();
+        mgl11.glBindBuffer(target, buffer);
+        checkError();
+    }
+
+    public void glBufferData(int target, int size, Buffer data, int usage) {
+        checkThread();
+        mgl11.glBufferData(target, size, data, usage);
+        checkError();
+    }
+
+    public void glBufferSubData(int target, int offset, int size, Buffer data) {
+        checkThread();
+        mgl11.glBufferSubData(target, offset, size, data);
+        checkError();
+    }
+
+    public void glColor4ub(byte red, byte green, byte blue, byte alpha) {
+        checkThread();
+        mgl11.glColor4ub(red, green, blue, alpha);
+        checkError();    }
+
+    public void glColorPointer(int size, int type, int stride, int offset) {
+        checkThread();
+        mgl11.glColorPointer(size, type, stride, offset);
+        checkError();
+    }
+
+    public void glDeleteBuffers(int n, int[] buffers, int offset) {
+        checkThread();
+        mgl11.glDeleteBuffers(n, buffers, offset);
+        checkError();
+    }
+
+    public void glDeleteBuffers(int n, IntBuffer buffers) {
+        checkThread();
+        mgl11.glDeleteBuffers(n, buffers);
+        checkError();
+    }
+
+    public void glDrawElements(int mode, int count, int type, int offset) {
+        checkThread();
+        mgl11.glDrawElements(mode, count, type, offset);
+        checkError();
+    }
+
+    public void glGenBuffers(int n, int[] buffers, int offset) {
+        checkThread();
+        mgl11.glGenBuffers(n, buffers, offset);
+        checkError();
+    }
+
+    public void glGenBuffers(int n, IntBuffer buffers) {
+        checkThread();
+        mgl11.glGenBuffers(n, buffers);
+        checkError();
+    }
+
+    public void glGetBooleanv(int pname, boolean[] params, int offset) {
+        checkThread();
+        mgl11.glGetBooleanv(pname, params, offset);
+        checkError();
+    }
+
+    public void glGetBooleanv(int pname, IntBuffer params) {
+        checkThread();
+        mgl11.glGetBooleanv(pname, params);
+        checkError();
+    }
+
+    public void glGetBufferParameteriv(int target, int pname, int[] params,
+            int offset) {
+        checkThread();
+        mgl11.glGetBufferParameteriv(target, pname, params, offset);
+        checkError();
+    }
+
+    public void glGetBufferParameteriv(int target, int pname, IntBuffer params) {
+        checkThread();
+        mgl11.glGetBufferParameteriv(target, pname, params);
+        checkError();
+    }
+
+    public void glGetClipPlanef(int pname, float[] eqn, int offset) {
+        checkThread();
+        mgl11.glGetClipPlanef(pname, eqn, offset);
+        checkError();
+    }
+
+    public void glGetClipPlanef(int pname, FloatBuffer eqn) {
+        checkThread();
+        mgl11.glGetClipPlanef(pname, eqn);
+        checkError();
+    }
+
+    public void glGetClipPlanex(int pname, int[] eqn, int offset) {
+        checkThread();
+        mgl11.glGetClipPlanex(pname, eqn, offset);
+        checkError();
+    }
+
+    public void glGetClipPlanex(int pname, IntBuffer eqn) {
+        checkThread();
+        mgl11.glGetClipPlanex(pname, eqn);
+        checkError();
+    }
+
+    public void glGetFixedv(int pname, int[] params, int offset) {
+        checkThread();
+        mgl11.glGetFixedv(pname, params, offset);
+        checkError();
+    }
+
+    public void glGetFixedv(int pname, IntBuffer params) {
+        checkThread();
+        mgl11.glGetFixedv(pname, params);
+        checkError();
+    }
+
+    public void glGetFloatv(int pname, float[] params, int offset) {
+        checkThread();
+        mgl11.glGetFloatv(pname, params, offset);
+        checkError();
+    }
+
+    public void glGetFloatv(int pname, FloatBuffer params) {
+        checkThread();
+        mgl11.glGetFloatv(pname, params);
+        checkError();
+    }
+
+    public void glGetLightfv(int light, int pname, float[] params, int offset) {
+        checkThread();
+        mgl11.glGetLightfv(light, pname, params, offset);
+        checkError();
+    }
+
+    public void glGetLightfv(int light, int pname, FloatBuffer params) {
+        checkThread();
+        mgl11.glGetLightfv(light, pname, params);
+        checkError();
+    }
+
+    public void glGetLightxv(int light, int pname, int[] params, int offset) {
+        checkThread();
+        mgl11.glGetLightxv(light, pname, params, offset);
+        checkError();
+    }
+
+    public void glGetLightxv(int light, int pname, IntBuffer params) {
+        checkThread();
+        mgl11.glGetLightxv(light, pname, params);
+        checkError();
+    }
+
+    public void glGetMaterialfv(int face, int pname, float[] params, int offset) {
+        checkThread();
+        mgl11.glGetMaterialfv(face, pname, params, offset);
+        checkError();
+    }
+
+    public void glGetMaterialfv(int face, int pname, FloatBuffer params) {
+        checkThread();
+        mgl11.glGetMaterialfv(face, pname, params);
+        checkError();
+    }
+
+    public void glGetMaterialxv(int face, int pname, int[] params, int offset) {
+        checkThread();
+        mgl11.glGetMaterialxv(face, pname, params, offset);
+        checkError();
+    }
+
+    public void glGetMaterialxv(int face, int pname, IntBuffer params) {
+        checkThread();
+        mgl11.glGetMaterialxv(face, pname, params);
+        checkError();
+    }
+
+    public void glGetPointerv(int pname, Buffer[] params) {
+        checkThread();
+        mgl11.glGetPointerv(pname, params);
+        checkError();
+    }
+
+    public void glGetTexEnviv(int env, int pname, int[] params, int offset) {
+        checkThread();
+        mgl11.glGetTexEnviv(env, pname, params, offset);
+        checkError();
+    }
+
+    public void glGetTexEnviv(int env, int pname, IntBuffer params) {
+        checkThread();
+        mgl11.glGetTexEnviv(env, pname, params);
+        checkError();
+    }
+
+    public void glGetTexEnvxv(int env, int pname, int[] params, int offset) {
+        checkThread();
+        mgl11.glGetTexEnvxv(env, pname, params, offset);
+        checkError();
+    }
+
+    public void glGetTexEnvxv(int env, int pname, IntBuffer params) {
+        checkThread();
+        mgl11.glGetTexEnvxv(env, pname, params);
+        checkError();
+    }
+
+    public void glGetTexParameterfv(int target, int pname, float[] params,
+            int offset) {
+        checkThread();
+        mgl11.glGetTexParameterfv(target, pname, params, offset);
+        checkError();
+    }
+
+    public void glGetTexParameterfv(int target, int pname, FloatBuffer params) {
+        checkThread();
+        mgl11.glGetTexParameterfv(target, pname, params);
+        checkError();
+    }
+
+    public void glGetTexParameteriv(int target, int pname, int[] params,
+            int offset) {
+        checkThread();
+        mgl11.glGetTexParameteriv(target, pname, params, offset);
+        checkError();
+    }
+
+    public void glGetTexParameteriv(int target, int pname, IntBuffer params) {
+        checkThread();
+        mgl11.glGetTexParameteriv(target, pname, params);
+        checkError();
+    }
+
+    public void glGetTexParameterxv(int target, int pname, int[] params,
+            int offset) {
+        checkThread();
+        mgl11.glGetTexParameterxv(target, pname, params, offset);
+        checkError();
+    }
+
+    public void glGetTexParameterxv(int target, int pname, IntBuffer params) {
+        checkThread();
+        mgl11.glGetTexParameterxv(target, pname, params);
+        checkError();
+    }
+
+    public boolean glIsBuffer(int buffer) {
+        checkThread();
+        boolean valid = mgl11.glIsBuffer(buffer);
+        checkError();
+        return valid;
+    }
+
+    public boolean glIsEnabled(int cap) {
+        checkThread();
+        boolean valid = mgl11.glIsEnabled(cap);
+        checkError();
+        return valid;
+    }
+
+    public boolean glIsTexture(int texture) {
+        checkThread();
+        boolean valid = mgl11.glIsTexture(texture);
+        checkError();
+        return valid;
+    }
+
+    public void glNormalPointer(int type, int stride, int offset) {
+        checkThread();
+        mgl11.glNormalPointer(type, stride, offset);
+        checkError();
+    }
+
+    public void glPointParameterf(int pname, float param) {
+        checkThread();
+        mgl11.glPointParameterf(pname, param);
+        checkError();
+    }
+
+    public void glPointParameterfv(int pname, float[] params, int offset) {
+        checkThread();
+        mgl11.glPointParameterfv(pname, params, offset);
+        checkError();
+    }
+
+    public void glPointParameterfv(int pname, FloatBuffer params) {
+        checkThread();
+        mgl11.glPointParameterfv(pname, params);
+        checkError();
+    }
+
+    public void glPointParameterx(int pname, int param) {
+        checkThread();
+        mgl11.glPointParameterx(pname, param);
+        checkError();
+    }
+
+    public void glPointParameterxv(int pname, int[] params, int offset) {
+        checkThread();
+        mgl11.glPointParameterxv(pname, params, offset);
+        checkError();
+    }
+
+    public void glPointParameterxv(int pname, IntBuffer params) {
+        checkThread();
+        mgl11.glPointParameterxv(pname, params);
+        checkError();
+    }
+
+    public void glPointSizePointerOES(int type, int stride, Buffer pointer) {
+        checkThread();
+        mgl11.glPointSizePointerOES(type, stride, pointer);
+        checkError();
+    }
+
+    public void glTexCoordPointer(int size, int type, int stride, int offset) {
+        checkThread();
+        mgl11.glTexCoordPointer(size, type, stride, offset);
+        checkError();
+    }
+
+    public void glTexEnvi(int target, int pname, int param) {
+        checkThread();
+        mgl11.glTexEnvi(target, pname, param);
+        checkError();
+    }
+
+    public void glTexEnviv(int target, int pname, int[] params, int offset) {
+        checkThread();
+        mgl11.glTexEnviv(target, pname, params, offset);
+        checkError();
+    }
+
+    public void glTexEnviv(int target, int pname, IntBuffer params) {
+        checkThread();
+        mgl11.glTexEnviv(target, pname, params);
+        checkError();
+    }
+
+    public void glTexParameterfv(int target, int pname, float[] params,
+            int offset) {
+        checkThread();
+        mgl11.glTexParameterfv(target, pname, params, offset);
+        checkError();
+    }
+
+    public void glTexParameterfv(int target, int pname, FloatBuffer params) {
+        checkThread();
+        mgl11.glTexParameterfv(target, pname, params);
+        checkError();
+    }
+
+    public void glTexParameteri(int target, int pname, int param) {
+        checkThread();
+        mgl11.glTexParameteri(target, pname, param);
+        checkError();
+    }
+
+    public void glTexParameterxv(int target, int pname, int[] params, int offset) {
+        checkThread();
+        mgl11.glTexParameterxv(target, pname, params, offset);
+        checkError();
+    }
+
+    public void glTexParameterxv(int target, int pname, IntBuffer params) {
+        checkThread();
+        mgl11.glTexParameterxv(target, pname, params);
+        checkError();
+    }
+
+    public void glVertexPointer(int size, int type, int stride, int offset) {
+        checkThread();
+        mgl11.glVertexPointer(size, type, stride, offset);
+        checkError();
+    }
+
+    public void glCurrentPaletteMatrixOES(int matrixpaletteindex) {
+        checkThread();
+        mgl11Ext.glCurrentPaletteMatrixOES(matrixpaletteindex);
+        checkError();
+    }
+
+    public void glLoadPaletteFromModelViewMatrixOES() {
+        checkThread();
+        mgl11Ext.glLoadPaletteFromModelViewMatrixOES();
+        checkError();
+    }
+
+    public void glMatrixIndexPointerOES(int size, int type, int stride,
+            Buffer pointer) {
+        checkThread();
+        mgl11Ext.glMatrixIndexPointerOES(size, type, stride, pointer);
+        checkError();
+    }
+
+    public void glMatrixIndexPointerOES(int size, int type, int stride,
+            int offset) {
+        checkThread();
+        mgl11Ext.glMatrixIndexPointerOES(size, type, stride, offset);
+        checkError();
+    }
+
+    public void glWeightPointerOES(int size, int type, int stride,
+            Buffer pointer) {
+        checkThread();
+        mgl11Ext.glWeightPointerOES(size, type, stride, pointer);
+        checkError();
+    }
+
+    public void glWeightPointerOES(int size, int type, int stride, int offset) {
+        checkThread();
+        mgl11Ext.glWeightPointerOES(size, type, stride, offset);
+        checkError();
+    }
+
+    @Override
+    public void glBindFramebufferOES(int target, int framebuffer) {
+        checkThread();
+        mgl11ExtensionPack.glBindFramebufferOES(target, framebuffer);
+        checkError();
+    }
+
+    @Override
+    public void glBindRenderbufferOES(int target, int renderbuffer) {
+        checkThread();
+        mgl11ExtensionPack.glBindRenderbufferOES(target, renderbuffer);
+        checkError();
+    }
+
+    @Override
+    public void glBlendEquation(int mode) {
+        checkThread();
+        mgl11ExtensionPack.glBlendEquation(mode);
+        checkError();
+    }
+
+    @Override
+    public void glBlendEquationSeparate(int modeRGB, int modeAlpha) {
+        checkThread();
+        mgl11ExtensionPack.glBlendEquationSeparate(modeRGB, modeAlpha);
+        checkError();
+    }
+
+    @Override
+    public void glBlendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha,
+            int dstAlpha) {
+        checkThread();
+        mgl11ExtensionPack.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
+        checkError();
+    }
+
+    @Override
+    public int glCheckFramebufferStatusOES(int target) {
+        checkThread();
+        int result = mgl11ExtensionPack.glCheckFramebufferStatusOES(target);
+        checkError();
+        return result;
+    }
+
+    @Override
+    public void glDeleteFramebuffersOES(int n, int[] framebuffers, int offset) {
+        checkThread();
+        mgl11ExtensionPack.glDeleteFramebuffersOES(n, framebuffers, offset);
+        checkError();
+    }
+
+    @Override
+    public void glDeleteFramebuffersOES(int n, IntBuffer framebuffers) {
+        checkThread();
+        mgl11ExtensionPack.glDeleteFramebuffersOES(n, framebuffers);
+        checkError();
+    }
+
+    @Override
+    public void glDeleteRenderbuffersOES(int n, int[] renderbuffers, int offset) {
+        checkThread();
+        mgl11ExtensionPack.glDeleteRenderbuffersOES(n, renderbuffers, offset);
+        checkError();
+    }
+
+    @Override
+    public void glDeleteRenderbuffersOES(int n, IntBuffer renderbuffers) {
+        checkThread();
+        mgl11ExtensionPack.glDeleteRenderbuffersOES(n, renderbuffers);
+        checkError();
+    }
+
+    @Override
+    public void glFramebufferRenderbufferOES(int target, int attachment,
+            int renderbuffertarget, int renderbuffer) {
+        checkThread();
+        mgl11ExtensionPack.glFramebufferRenderbufferOES(target, attachment, renderbuffertarget, renderbuffer);
+        checkError();
+    }
+
+    @Override
+    public void glFramebufferTexture2DOES(int target, int attachment,
+            int textarget, int texture, int level) {
+        checkThread();
+        mgl11ExtensionPack.glFramebufferTexture2DOES(target, attachment, textarget, texture, level);
+        checkError();
+    }
+
+    @Override
+    public void glGenerateMipmapOES(int target) {
+        checkThread();
+        mgl11ExtensionPack.glGenerateMipmapOES(target);
+        checkError();
+    }
+
+    @Override
+    public void glGenFramebuffersOES(int n, int[] framebuffers, int offset) {
+        checkThread();
+        mgl11ExtensionPack.glGenFramebuffersOES(n, framebuffers, offset);
+        checkError();
+    }
+
+    @Override
+    public void glGenFramebuffersOES(int n, IntBuffer framebuffers) {
+        checkThread();
+        mgl11ExtensionPack.glGenFramebuffersOES(n, framebuffers);
+        checkError();
+    }
+
+    @Override
+    public void glGenRenderbuffersOES(int n, int[] renderbuffers, int offset) {
+        checkThread();
+        mgl11ExtensionPack.glGenRenderbuffersOES(n, renderbuffers, offset);
+        checkError();
+    }
+
+    @Override
+    public void glGenRenderbuffersOES(int n, IntBuffer renderbuffers) {
+        checkThread();
+        mgl11ExtensionPack.glGenRenderbuffersOES(n, renderbuffers);
+        checkError();
+    }
+
+    @Override
+    public void glGetFramebufferAttachmentParameterivOES(int target,
+            int attachment, int pname, int[] params, int offset) {
+        checkThread();
+        mgl11ExtensionPack.glGetFramebufferAttachmentParameterivOES(target, attachment, pname, params, offset);
+        checkError();
+    }
+
+    @Override
+    public void glGetFramebufferAttachmentParameterivOES(int target,
+            int attachment, int pname, IntBuffer params) {
+        checkThread();
+        mgl11ExtensionPack.glGetFramebufferAttachmentParameterivOES(target, attachment, pname, params);
+        checkError();
+    }
+
+    @Override
+    public void glGetRenderbufferParameterivOES(int target, int pname,
+            int[] params, int offset) {
+        checkThread();
+        mgl11ExtensionPack.glGetRenderbufferParameterivOES(target, pname, params, offset);
+        checkError();
+    }
+
+    @Override
+    public void glGetRenderbufferParameterivOES(int target, int pname,
+            IntBuffer params) {
+        checkThread();
+        mgl11ExtensionPack.glGetRenderbufferParameterivOES(target, pname, params);
+        checkError();
+    }
+
+    @Override
+    public void glGetTexGenfv(int coord, int pname, float[] params, int offset) {
+        checkThread();
+        mgl11ExtensionPack.glGetTexGenfv(coord, pname, params, offset);
+        checkError();
+    }
+
+    @Override
+    public void glGetTexGenfv(int coord, int pname, FloatBuffer params) {
+        checkThread();
+        mgl11ExtensionPack.glGetTexGenfv(coord, pname, params);
+        checkError();
+    }
+
+    @Override
+    public void glGetTexGeniv(int coord, int pname, int[] params, int offset) {
+        checkThread();
+        mgl11ExtensionPack.glGetTexGeniv(coord, pname, params, offset);
+        checkError();
+    }
+
+    @Override
+    public void glGetTexGeniv(int coord, int pname, IntBuffer params) {
+        checkThread();
+        mgl11ExtensionPack.glGetTexGeniv(coord, pname, params);
+        checkError();
+    }
+
+    @Override
+    public void glGetTexGenxv(int coord, int pname, int[] params, int offset) {
+        checkThread();
+        mgl11ExtensionPack.glGetTexGenxv(coord, pname, params, offset);
+        checkError();
+    }
+
+    @Override
+    public void glGetTexGenxv(int coord, int pname, IntBuffer params) {
+        checkThread();
+        mgl11ExtensionPack.glGetTexGenxv(coord, pname, params);
+        checkError();
+    }
+
+    @Override
+    public boolean glIsFramebufferOES(int framebuffer) {
+        checkThread();
+        boolean result = mgl11ExtensionPack.glIsFramebufferOES(framebuffer);
+        checkError();
+        return result;
+    }
+
+    @Override
+    public boolean glIsRenderbufferOES(int renderbuffer) {
+        checkThread();
+        mgl11ExtensionPack.glIsRenderbufferOES(renderbuffer);
+        checkError();
+        return false;
+    }
+
+    @Override
+    public void glRenderbufferStorageOES(int target, int internalformat,
+            int width, int height) {
+        checkThread();
+        mgl11ExtensionPack.glRenderbufferStorageOES(target, internalformat, width, height);
+        checkError();
+    }
+
+    @Override
+    public void glTexGenf(int coord, int pname, float param) {
+        checkThread();
+        mgl11ExtensionPack.glTexGenf(coord, pname, param);
+        checkError();
+    }
+
+    @Override
+    public void glTexGenfv(int coord, int pname, float[] params, int offset) {
+        checkThread();
+        mgl11ExtensionPack.glTexGenfv(coord, pname, params, offset);
+        checkError();
+    }
+
+    @Override
+    public void glTexGenfv(int coord, int pname, FloatBuffer params) {
+        checkThread();
+        mgl11ExtensionPack.glTexGenfv(coord, pname, params);
+        checkError();
+    }
+
+    @Override
+    public void glTexGeni(int coord, int pname, int param) {
+        checkThread();
+        mgl11ExtensionPack.glTexGeni(coord, pname, param);
+        checkError();
+    }
+
+    @Override
+    public void glTexGeniv(int coord, int pname, int[] params, int offset) {
+        checkThread();
+        mgl11ExtensionPack.glTexGeniv(coord, pname, params, offset);
+        checkError();
+    }
+
+    @Override
+    public void glTexGeniv(int coord, int pname, IntBuffer params) {
+        checkThread();
+        mgl11ExtensionPack.glTexGeniv(coord, pname, params);
+        checkError();
+    }
+
+    @Override
+    public void glTexGenx(int coord, int pname, int param) {
+        checkThread();
+        mgl11ExtensionPack.glTexGenx(coord, pname, param);
+        checkError();
+    }
+
+    @Override
+    public void glTexGenxv(int coord, int pname, int[] params, int offset) {
+        checkThread();
+        mgl11ExtensionPack.glTexGenxv(coord, pname, params, offset);
+        checkError();
+    }
+
+    @Override
+    public void glTexGenxv(int coord, int pname, IntBuffer params) {
+        checkThread();
+        mgl11ExtensionPack.glTexGenxv(coord, pname, params);
+        checkError();
+    }
+}
diff --git a/android/opengl/GLException.java b/android/opengl/GLException.java
new file mode 100644
index 0000000..762fccf
--- /dev/null
+++ b/android/opengl/GLException.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.opengl;
+
+/**
+ * An exception class for OpenGL errors.
+ *
+ */
+@SuppressWarnings("serial")
+public class GLException extends RuntimeException {
+    public GLException(final int error) {
+        super(getErrorString(error));
+        mError = error;
+    }
+
+    public GLException(final int error, final String string) {
+        super(string);
+        mError = error;
+    }
+
+    private static String getErrorString(int error) {
+        String errorString = GLU.gluErrorString(error);
+        if ( errorString == null ) {
+            errorString = "Unknown error 0x" + Integer.toHexString(error);
+        }
+        return errorString;
+    }
+
+    int getError() {
+        return mError;
+    }
+
+    private final int mError;
+}
+
diff --git a/android/opengl/GLLogWrapper.java b/android/opengl/GLLogWrapper.java
new file mode 100644
index 0000000..bff7396
--- /dev/null
+++ b/android/opengl/GLLogWrapper.java
@@ -0,0 +1,3960 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.opengl;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.CharBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.LongBuffer;
+import java.nio.ShortBuffer;
+import java.util.Arrays;
+
+import javax.microedition.khronos.opengles.GL;
+
+/**
+ * A wrapper that logs all GL calls (and results) in human-readable form.
+ *
+ */
+class GLLogWrapper extends GLWrapperBase {
+    private static final int FORMAT_INT = 0;
+    private static final int FORMAT_FLOAT = 1;
+    private static final int FORMAT_FIXED = 2;
+
+    public GLLogWrapper(GL gl, Writer log, boolean logArgumentNames) {
+        super(gl);
+        mLog = log;
+        mLogArgumentNames = logArgumentNames;
+    }
+
+    private void checkError() {
+        int glError;
+        if ((glError = mgl.glGetError()) != 0) {
+            String errorMessage = "glError: " + Integer.toString(glError);
+            logLine(errorMessage);
+        }
+    }
+
+    private void logLine(String message) {
+        log(message + '\n');
+    }
+
+    private void log(String message) {
+        try {
+            mLog.write(message);
+        } catch (IOException e) {
+            // Ignore exception, keep on trying
+        }
+    }
+
+    private void begin(String name) {
+        log(name + '(');
+        mArgCount = 0;
+    }
+
+    private void arg(String name, String value) {
+        if (mArgCount++ > 0) {
+            log(", ");
+        }
+        if (mLogArgumentNames) {
+            log(name + "=");
+        }
+        log(value);
+    }
+
+    private void end() {
+        log(");\n");
+        flush();
+    }
+
+    private void flush() {
+        try {
+            mLog.flush();
+        } catch (IOException e) {
+            mLog = null;
+        }
+    }
+
+    private void arg(String name, boolean value) {
+        arg(name, Boolean.toString(value));
+    }
+
+    private void arg(String name, int value) {
+        arg(name, Integer.toString(value));
+    }
+
+    private void arg(String name, float value) {
+        arg(name, Float.toString(value));
+    }
+
+    private void returns(String result) {
+        log(") returns " + result + ";\n");
+        flush();
+    }
+
+    private void returns(int result) {
+        returns(Integer.toString(result));
+    }
+
+    private void arg(String name, int n, int[] arr, int offset) {
+        arg(name, toString(n, FORMAT_INT, arr, offset));
+    }
+
+    private void arg(String name, int n, short[] arr, int offset) {
+        arg(name, toString(n, arr, offset));
+    }
+
+    private void arg(String name, int n, float[] arr, int offset) {
+        arg(name, toString(n, arr, offset));
+    }
+
+    private void formattedAppend(StringBuilder buf, int value, int format) {
+        switch (format) {
+        case FORMAT_INT:
+            buf.append(value);
+            break;
+        case FORMAT_FLOAT:
+            buf.append(Float.intBitsToFloat(value));
+            break;
+        case FORMAT_FIXED:
+            buf.append(value / 65536.0f);
+            break;
+        }
+    }
+
+    private String toString(int n, int format, int[] arr, int offset) {
+        StringBuilder buf = new StringBuilder();
+        buf.append("{\n");
+        int arrLen = arr.length;
+        for (int i = 0; i < n; i++) {
+            int index = offset + i;
+            buf.append(" [" + index + "] = ");
+            if (index < 0 || index >= arrLen) {
+                buf.append("out of bounds");
+            } else {
+                formattedAppend(buf, arr[index], format);
+            }
+            buf.append('\n');
+        }
+        buf.append("}");
+        return buf.toString();
+    }
+
+    private String toString(int n, short[] arr, int offset) {
+        StringBuilder buf = new StringBuilder();
+        buf.append("{\n");
+        int arrLen = arr.length;
+        for (int i = 0; i < n; i++) {
+            int index = offset + i;
+            buf.append(" [" + index + "] = ");
+            if (index < 0 || index >= arrLen) {
+                buf.append("out of bounds");
+            } else {
+                buf.append(arr[index]);
+            }
+            buf.append('\n');
+        }
+        buf.append("}");
+        return buf.toString();
+    }
+
+    private String toString(int n, float[] arr, int offset) {
+        StringBuilder buf = new StringBuilder();
+        buf.append("{\n");
+        int arrLen = arr.length;
+        for (int i = 0; i < n; i++) {
+            int index = offset + i;
+            buf.append("[" + index + "] = ");
+            if (index < 0 || index >= arrLen) {
+                buf.append("out of bounds");
+            } else {
+                buf.append(arr[index]);
+            }
+            buf.append('\n');
+        }
+        buf.append("}");
+        return buf.toString();
+    }
+
+    private String toString(int n, FloatBuffer buf) {
+        StringBuilder builder = new StringBuilder();
+        builder.append("{\n");
+        for (int i = 0; i < n; i++) {
+            builder.append(" [" + i + "] = " + buf.get(i) + '\n');
+        }
+        builder.append("}");
+        return builder.toString();
+    }
+
+    private String toString(int n, int format, IntBuffer buf) {
+        StringBuilder builder = new StringBuilder();
+        builder.append("{\n");
+        for (int i = 0; i < n; i++) {
+            builder.append(" [" + i + "] = ");
+            formattedAppend(builder, buf.get(i), format);
+            builder.append('\n');
+        }
+        builder.append("}");
+        return builder.toString();
+    }
+
+    private String toString(int n, ShortBuffer buf) {
+        StringBuilder builder = new StringBuilder();
+        builder.append("{\n");
+        for (int i = 0; i < n; i++) {
+            builder.append(" [" + i + "] = " + buf.get(i) + '\n');
+        }
+        builder.append("}");
+        return builder.toString();
+    }
+
+    private void arg(String name, int n, FloatBuffer buf) {
+        arg(name, toString(n, buf));
+    }
+
+    private void arg(String name, int n, IntBuffer buf) {
+        arg(name, toString(n, FORMAT_INT, buf));
+    }
+
+    private void arg(String name, int n, ShortBuffer buf) {
+        arg(name, toString(n, buf));
+    }
+
+    private void argPointer(int size, int type, int stride, Buffer pointer) {
+        arg("size", size);
+        arg("type", getPointerTypeName(type));
+        arg("stride", stride);
+        arg("pointer", pointer.toString());
+    }
+
+    private static String getHex(int value) {
+        return "0x" + Integer.toHexString(value);
+    }
+
+    public static String getErrorString(int error) {
+        switch (error) {
+        case GL_NO_ERROR:
+            return "GL_NO_ERROR";
+        case GL_INVALID_ENUM:
+            return "GL_INVALID_ENUM";
+        case GL_INVALID_VALUE:
+            return "GL_INVALID_VALUE";
+        case GL_INVALID_OPERATION:
+            return "GL_INVALID_OPERATION";
+        case GL_STACK_OVERFLOW:
+            return "GL_STACK_OVERFLOW";
+        case GL_STACK_UNDERFLOW:
+            return "GL_STACK_UNDERFLOW";
+        case GL_OUT_OF_MEMORY:
+            return "GL_OUT_OF_MEMORY";
+        default:
+            return getHex(error);
+        }
+    }
+
+    private String getClearBufferMask(int mask) {
+        StringBuilder b = new StringBuilder();
+        if ((mask & GL_DEPTH_BUFFER_BIT) != 0) {
+            b.append("GL_DEPTH_BUFFER_BIT");
+            mask &= ~GL_DEPTH_BUFFER_BIT;
+        }
+        if ((mask & GL_STENCIL_BUFFER_BIT) != 0) {
+            if (b.length() > 0) {
+                b.append(" | ");
+            }
+            b.append("GL_STENCIL_BUFFER_BIT");
+            mask &= ~GL_STENCIL_BUFFER_BIT;
+        }
+        if ((mask & GL_COLOR_BUFFER_BIT) != 0) {
+            if (b.length() > 0) {
+                b.append(" | ");
+            }
+            b.append("GL_COLOR_BUFFER_BIT");
+            mask &= ~GL_COLOR_BUFFER_BIT;
+        }
+        if (mask != 0) {
+            if (b.length() > 0) {
+                b.append(" | ");
+            }
+            b.append(getHex(mask));
+        }
+        return b.toString();
+    }
+
+    private String getFactor(int factor) {
+        switch(factor) {
+        case GL_ZERO:
+            return "GL_ZERO";
+        case GL_ONE:
+            return "GL_ONE";
+        case GL_SRC_COLOR:
+            return "GL_SRC_COLOR";
+        case GL_ONE_MINUS_SRC_COLOR:
+            return "GL_ONE_MINUS_SRC_COLOR";
+        case GL_DST_COLOR:
+            return "GL_DST_COLOR";
+        case GL_ONE_MINUS_DST_COLOR:
+            return "GL_ONE_MINUS_DST_COLOR";
+        case GL_SRC_ALPHA:
+            return "GL_SRC_ALPHA";
+        case GL_ONE_MINUS_SRC_ALPHA:
+            return "GL_ONE_MINUS_SRC_ALPHA";
+        case GL_DST_ALPHA:
+            return "GL_DST_ALPHA";
+        case GL_ONE_MINUS_DST_ALPHA:
+            return "GL_ONE_MINUS_DST_ALPHA";
+        case GL_SRC_ALPHA_SATURATE:
+            return "GL_SRC_ALPHA_SATURATE";
+
+        default:
+            return getHex(factor);
+        }
+    }
+
+    private String getShadeModel(int model) {
+        switch(model) {
+        case GL_FLAT:
+            return "GL_FLAT";
+        case GL_SMOOTH:
+            return "GL_SMOOTH";
+        default:
+            return getHex(model);
+        }
+    }
+
+    private String getTextureTarget(int target) {
+        switch (target) {
+        case GL_TEXTURE_2D:
+            return "GL_TEXTURE_2D";
+        default:
+            return getHex(target);
+        }
+    }
+
+    private String getTextureEnvTarget(int target) {
+        switch (target) {
+        case GL_TEXTURE_ENV:
+            return "GL_TEXTURE_ENV";
+        default:
+            return getHex(target);
+        }
+    }
+
+    private String getTextureEnvPName(int pname) {
+        switch (pname) {
+        case GL_TEXTURE_ENV_MODE:
+            return "GL_TEXTURE_ENV_MODE";
+        case GL_TEXTURE_ENV_COLOR:
+            return "GL_TEXTURE_ENV_COLOR";
+        default:
+            return getHex(pname);
+        }
+    }
+
+    private int getTextureEnvParamCount(int pname) {
+        switch (pname) {
+        case GL_TEXTURE_ENV_MODE:
+            return 1;
+        case GL_TEXTURE_ENV_COLOR:
+            return 4;
+        default:
+            return 0;
+        }
+    }
+
+    private String getTextureEnvParamName(float param) {
+        int iparam = (int) param;
+        if (param == (float) iparam) {
+            switch (iparam) {
+            case GL_REPLACE:
+                return "GL_REPLACE";
+            case GL_MODULATE:
+                return "GL_MODULATE";
+            case GL_DECAL:
+                return "GL_DECAL";
+            case GL_BLEND:
+                return "GL_BLEND";
+            case GL_ADD:
+                return "GL_ADD";
+            case GL_COMBINE:
+                return "GL_COMBINE";
+            default:
+                return getHex(iparam);
+            }
+        }
+        return Float.toString(param);
+    }
+
+    private String getMatrixMode(int matrixMode) {
+        switch (matrixMode) {
+        case GL_MODELVIEW:
+            return "GL_MODELVIEW";
+        case GL_PROJECTION:
+            return "GL_PROJECTION";
+        case GL_TEXTURE:
+            return "GL_TEXTURE";
+        default:
+            return getHex(matrixMode);
+        }
+    }
+
+    private String getClientState(int clientState) {
+        switch (clientState) {
+        case GL_COLOR_ARRAY:
+            return "GL_COLOR_ARRAY";
+        case GL_VERTEX_ARRAY:
+            return "GL_VERTEX_ARRAY";
+        case GL_NORMAL_ARRAY:
+            return "GL_NORMAL_ARRAY";
+        case GL_TEXTURE_COORD_ARRAY:
+            return "GL_TEXTURE_COORD_ARRAY";
+        default:
+            return getHex(clientState);
+        }
+    }
+
+    private String getCap(int cap) {
+        switch (cap) {
+        case GL_FOG:
+            return "GL_FOG";
+        case GL_LIGHTING:
+            return "GL_LIGHTING";
+        case GL_TEXTURE_2D:
+            return "GL_TEXTURE_2D";
+        case GL_CULL_FACE:
+            return "GL_CULL_FACE";
+        case GL_ALPHA_TEST:
+            return "GL_ALPHA_TEST";
+        case GL_BLEND:
+            return "GL_BLEND";
+        case GL_COLOR_LOGIC_OP:
+            return "GL_COLOR_LOGIC_OP";
+        case GL_DITHER:
+            return "GL_DITHER";
+        case GL_STENCIL_TEST:
+            return "GL_STENCIL_TEST";
+        case GL_DEPTH_TEST:
+            return "GL_DEPTH_TEST";
+        case GL_LIGHT0:
+            return "GL_LIGHT0";
+        case GL_LIGHT1:
+            return "GL_LIGHT1";
+        case GL_LIGHT2:
+            return "GL_LIGHT2";
+        case GL_LIGHT3:
+            return "GL_LIGHT3";
+        case GL_LIGHT4:
+            return "GL_LIGHT4";
+        case GL_LIGHT5:
+            return "GL_LIGHT5";
+        case GL_LIGHT6:
+            return "GL_LIGHT6";
+        case GL_LIGHT7:
+            return "GL_LIGHT7";
+        case GL_POINT_SMOOTH:
+            return "GL_POINT_SMOOTH";
+        case GL_LINE_SMOOTH:
+            return "GL_LINE_SMOOTH";
+        case GL_COLOR_MATERIAL:
+            return "GL_COLOR_MATERIAL";
+        case GL_NORMALIZE:
+            return "GL_NORMALIZE";
+        case GL_RESCALE_NORMAL:
+            return "GL_RESCALE_NORMAL";
+        case GL_VERTEX_ARRAY:
+            return "GL_VERTEX_ARRAY";
+        case GL_NORMAL_ARRAY:
+            return "GL_NORMAL_ARRAY";
+        case GL_COLOR_ARRAY:
+            return "GL_COLOR_ARRAY";
+        case GL_TEXTURE_COORD_ARRAY:
+            return "GL_TEXTURE_COORD_ARRAY";
+        case GL_MULTISAMPLE:
+            return "GL_MULTISAMPLE";
+        case GL_SAMPLE_ALPHA_TO_COVERAGE:
+            return "GL_SAMPLE_ALPHA_TO_COVERAGE";
+        case GL_SAMPLE_ALPHA_TO_ONE:
+            return "GL_SAMPLE_ALPHA_TO_ONE";
+        case GL_SAMPLE_COVERAGE:
+            return "GL_SAMPLE_COVERAGE";
+        case GL_SCISSOR_TEST:
+            return "GL_SCISSOR_TEST";
+        default:
+            return getHex(cap);
+        }
+    }
+
+    private String getTexturePName(int pname) {
+        switch (pname) {
+        case GL_TEXTURE_MAG_FILTER:
+            return "GL_TEXTURE_MAG_FILTER";
+        case GL_TEXTURE_MIN_FILTER:
+            return "GL_TEXTURE_MIN_FILTER";
+        case GL_TEXTURE_WRAP_S:
+            return "GL_TEXTURE_WRAP_S";
+        case GL_TEXTURE_WRAP_T:
+            return "GL_TEXTURE_WRAP_T";
+        case GL_GENERATE_MIPMAP:
+            return "GL_GENERATE_MIPMAP";
+        case GL_TEXTURE_CROP_RECT_OES:
+            return "GL_TEXTURE_CROP_RECT_OES";
+        default:
+            return getHex(pname);
+        }
+    }
+
+    private String getTextureParamName(float param) {
+        int iparam = (int) param;
+        if (param == (float) iparam) {
+            switch (iparam) {
+            case GL_CLAMP_TO_EDGE:
+                return "GL_CLAMP_TO_EDGE";
+            case GL_REPEAT:
+                return "GL_REPEAT";
+            case GL_NEAREST:
+                return "GL_NEAREST";
+            case GL_LINEAR:
+                return "GL_LINEAR";
+            case GL_NEAREST_MIPMAP_NEAREST:
+                return "GL_NEAREST_MIPMAP_NEAREST";
+            case GL_LINEAR_MIPMAP_NEAREST:
+                return "GL_LINEAR_MIPMAP_NEAREST";
+            case GL_NEAREST_MIPMAP_LINEAR:
+                return "GL_NEAREST_MIPMAP_LINEAR";
+            case GL_LINEAR_MIPMAP_LINEAR:
+                return "GL_LINEAR_MIPMAP_LINEAR";
+            default:
+                return getHex(iparam);
+            }
+        }
+        return Float.toString(param);
+    }
+
+    private String getFogPName(int pname) {
+        switch (pname) {
+        case GL_FOG_DENSITY:
+            return "GL_FOG_DENSITY";
+        case GL_FOG_START:
+            return "GL_FOG_START";
+        case GL_FOG_END:
+            return "GL_FOG_END";
+        case GL_FOG_MODE:
+            return "GL_FOG_MODE";
+        case GL_FOG_COLOR:
+            return "GL_FOG_COLOR";
+        default:
+            return getHex(pname);
+        }
+    }
+
+    private int getFogParamCount(int pname) {
+        switch (pname) {
+        case GL_FOG_DENSITY:
+            return 1;
+        case GL_FOG_START:
+            return 1;
+        case GL_FOG_END:
+            return 1;
+        case GL_FOG_MODE:
+            return 1;
+        case GL_FOG_COLOR:
+            return 4;
+        default:
+            return 0;
+        }
+    }
+
+    private String getBeginMode(int mode) {
+        switch (mode) {
+        case GL_POINTS:
+            return "GL_POINTS";
+        case GL_LINES:
+            return "GL_LINES";
+        case GL_LINE_LOOP:
+            return "GL_LINE_LOOP";
+        case GL_LINE_STRIP:
+            return "GL_LINE_STRIP";
+        case GL_TRIANGLES:
+            return "GL_TRIANGLES";
+        case GL_TRIANGLE_STRIP:
+            return "GL_TRIANGLE_STRIP";
+        case GL_TRIANGLE_FAN:
+            return "GL_TRIANGLE_FAN";
+        default:
+            return getHex(mode);
+        }
+    }
+
+    private String getIndexType(int type) {
+        switch (type) {
+        case GL_UNSIGNED_SHORT:
+            return "GL_UNSIGNED_SHORT";
+        case GL_UNSIGNED_BYTE:
+            return "GL_UNSIGNED_BYTE";
+        default:
+            return getHex(type);
+        }
+    }
+
+    private String getIntegerStateName(int pname) {
+        switch (pname) {
+        case GL_ALPHA_BITS:
+            return "GL_ALPHA_BITS";
+        case GL_ALIASED_LINE_WIDTH_RANGE:
+            return "GL_ALIASED_LINE_WIDTH_RANGE";
+        case GL_ALIASED_POINT_SIZE_RANGE:
+            return "GL_ALIASED_POINT_SIZE_RANGE";
+        case GL_BLUE_BITS:
+            return "GL_BLUE_BITS";
+        case GL_COMPRESSED_TEXTURE_FORMATS:
+            return "GL_COMPRESSED_TEXTURE_FORMATS";
+        case GL_DEPTH_BITS:
+            return "GL_DEPTH_BITS";
+        case GL_GREEN_BITS:
+            return "GL_GREEN_BITS";
+        case GL_MAX_ELEMENTS_INDICES:
+            return "GL_MAX_ELEMENTS_INDICES";
+        case GL_MAX_ELEMENTS_VERTICES:
+            return "GL_MAX_ELEMENTS_VERTICES";
+        case GL_MAX_LIGHTS:
+            return "GL_MAX_LIGHTS";
+        case GL_MAX_TEXTURE_SIZE:
+            return "GL_MAX_TEXTURE_SIZE";
+        case GL_MAX_VIEWPORT_DIMS:
+            return "GL_MAX_VIEWPORT_DIMS";
+        case GL_MAX_MODELVIEW_STACK_DEPTH:
+            return "GL_MAX_MODELVIEW_STACK_DEPTH";
+        case GL_MAX_PROJECTION_STACK_DEPTH:
+            return "GL_MAX_PROJECTION_STACK_DEPTH";
+        case GL_MAX_TEXTURE_STACK_DEPTH:
+            return "GL_MAX_TEXTURE_STACK_DEPTH";
+        case GL_MAX_TEXTURE_UNITS:
+            return "GL_MAX_TEXTURE_UNITS";
+        case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
+            return "GL_NUM_COMPRESSED_TEXTURE_FORMATS";
+        case GL_RED_BITS:
+            return "GL_RED_BITS";
+        case GL_SMOOTH_LINE_WIDTH_RANGE:
+            return "GL_SMOOTH_LINE_WIDTH_RANGE";
+        case GL_SMOOTH_POINT_SIZE_RANGE:
+            return "GL_SMOOTH_POINT_SIZE_RANGE";
+        case GL_STENCIL_BITS:
+            return "GL_STENCIL_BITS";
+        case GL_SUBPIXEL_BITS:
+            return "GL_SUBPIXEL_BITS";
+
+        case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES:
+            return "GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES";
+        case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES:
+            return "GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES";
+        case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES:
+            return "GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES";
+
+        default:
+            return getHex(pname);
+        }
+    }
+
+    private int getIntegerStateSize(int pname) {
+        switch (pname) {
+        case GL_ALPHA_BITS:
+            return 1;
+        case GL_ALIASED_LINE_WIDTH_RANGE:
+            return 2;
+        case GL_ALIASED_POINT_SIZE_RANGE:
+            return 2;
+        case GL_BLUE_BITS:
+            return 1;
+        case GL_COMPRESSED_TEXTURE_FORMATS:
+            // Have to ask the implementation for the size
+        {
+            int[] buffer = new int[1];
+            mgl.glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, buffer, 0);
+            return buffer[0];
+        }
+        case GL_DEPTH_BITS:
+            return 1;
+        case GL_GREEN_BITS:
+            return 1;
+        case GL_MAX_ELEMENTS_INDICES:
+            return 1;
+        case GL_MAX_ELEMENTS_VERTICES:
+            return 1;
+        case GL_MAX_LIGHTS:
+            return 1;
+        case GL_MAX_TEXTURE_SIZE:
+            return 1;
+        case GL_MAX_VIEWPORT_DIMS:
+            return 2;
+        case GL_MAX_MODELVIEW_STACK_DEPTH:
+            return 1;
+        case GL_MAX_PROJECTION_STACK_DEPTH:
+            return 1;
+        case GL_MAX_TEXTURE_STACK_DEPTH:
+            return 1;
+        case GL_MAX_TEXTURE_UNITS:
+            return 1;
+        case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
+            return 1;
+        case GL_RED_BITS:
+            return 1;
+        case GL_SMOOTH_LINE_WIDTH_RANGE:
+            return 2;
+        case GL_SMOOTH_POINT_SIZE_RANGE:
+            return 2;
+        case GL_STENCIL_BITS:
+            return 1;
+        case GL_SUBPIXEL_BITS:
+            return 1;
+
+        case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES:
+        case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES:
+        case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES:
+            return 16;
+
+        default:
+            return 0;
+        }
+    }
+
+    private int getIntegerStateFormat(int pname) {
+        switch (pname) {
+        case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES:
+        case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES:
+        case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES:
+            return FORMAT_FLOAT;
+
+        default:
+            return FORMAT_INT;
+        }
+    }
+
+    private String getHintTarget(int target) {
+        switch (target) {
+        case GL_FOG_HINT:
+            return "GL_FOG_HINT";
+        case GL_LINE_SMOOTH_HINT:
+            return "GL_LINE_SMOOTH_HINT";
+        case GL_PERSPECTIVE_CORRECTION_HINT:
+            return "GL_PERSPECTIVE_CORRECTION_HINT";
+        case GL_POINT_SMOOTH_HINT:
+            return "GL_POINT_SMOOTH_HINT";
+        case GL_POLYGON_SMOOTH_HINT:
+            return "GL_POLYGON_SMOOTH_HINT";
+        case GL_GENERATE_MIPMAP_HINT:
+            return "GL_GENERATE_MIPMAP_HINT";
+        default:
+            return getHex(target);
+        }
+    }
+
+    private String getHintMode(int mode) {
+        switch (mode) {
+        case GL_FASTEST:
+            return "GL_FASTEST";
+        case GL_NICEST:
+            return "GL_NICEST";
+        case GL_DONT_CARE:
+            return "GL_DONT_CARE";
+        default:
+            return getHex(mode);
+        }
+    }
+
+    private String getFaceName(int face) {
+        switch (face) {
+        case GL_FRONT_AND_BACK:
+            return "GL_FRONT_AND_BACK";
+        default:
+            return getHex(face);
+        }
+    }
+
+    private String getMaterialPName(int pname) {
+        switch (pname) {
+        case GL_AMBIENT:
+            return "GL_AMBIENT";
+        case GL_DIFFUSE:
+            return "GL_DIFFUSE";
+        case GL_SPECULAR:
+            return "GL_SPECULAR";
+        case GL_EMISSION:
+            return "GL_EMISSION";
+        case GL_SHININESS:
+            return "GL_SHININESS";
+        case GL_AMBIENT_AND_DIFFUSE:
+            return "GL_AMBIENT_AND_DIFFUSE";
+        default:
+            return getHex(pname);
+        }
+    }
+
+    private int getMaterialParamCount(int pname) {
+        switch (pname) {
+        case GL_AMBIENT:
+            return 4;
+        case GL_DIFFUSE:
+            return 4;
+        case GL_SPECULAR:
+            return 4;
+        case GL_EMISSION:
+            return 4;
+        case GL_SHININESS:
+            return 1;
+        case GL_AMBIENT_AND_DIFFUSE:
+            return 4;
+        default:
+            return 0;
+        }
+    }
+
+    private String getLightName(int light) {
+        if (light >= GL_LIGHT0 && light <= GL_LIGHT7) {
+            return "GL_LIGHT" + Integer.toString(light);
+        }
+        return getHex(light);
+    }
+
+    private String getLightPName(int pname) {
+        switch (pname) {
+        case GL_AMBIENT:
+            return "GL_AMBIENT";
+        case GL_DIFFUSE:
+            return "GL_DIFFUSE";
+        case GL_SPECULAR:
+            return "GL_SPECULAR";
+        case GL_POSITION:
+            return "GL_POSITION";
+        case GL_SPOT_DIRECTION:
+            return "GL_SPOT_DIRECTION";
+        case GL_SPOT_EXPONENT:
+            return "GL_SPOT_EXPONENT";
+        case GL_SPOT_CUTOFF:
+            return "GL_SPOT_CUTOFF";
+        case GL_CONSTANT_ATTENUATION:
+            return "GL_CONSTANT_ATTENUATION";
+        case GL_LINEAR_ATTENUATION:
+            return "GL_LINEAR_ATTENUATION";
+        case GL_QUADRATIC_ATTENUATION:
+            return "GL_QUADRATIC_ATTENUATION";
+        default:
+            return getHex(pname);
+        }
+    }
+
+    private int getLightParamCount(int pname) {
+        switch (pname) {
+        case GL_AMBIENT:
+            return 4;
+        case GL_DIFFUSE:
+            return 4;
+        case GL_SPECULAR:
+            return 4;
+        case GL_POSITION:
+            return 4;
+        case GL_SPOT_DIRECTION:
+            return 3;
+        case GL_SPOT_EXPONENT:
+            return 1;
+        case GL_SPOT_CUTOFF:
+            return 1;
+        case GL_CONSTANT_ATTENUATION:
+            return 1;
+        case GL_LINEAR_ATTENUATION:
+            return 1;
+        case GL_QUADRATIC_ATTENUATION:
+            return 1;
+        default:
+            return 0;
+        }
+    }
+
+    private String getLightModelPName(int pname) {
+        switch (pname) {
+        case GL_LIGHT_MODEL_AMBIENT:
+            return "GL_LIGHT_MODEL_AMBIENT";
+        case GL_LIGHT_MODEL_TWO_SIDE:
+            return "GL_LIGHT_MODEL_TWO_SIDE";
+        default:
+            return getHex(pname);
+        }
+    }
+
+    private int getLightModelParamCount(int pname) {
+        switch (pname) {
+        case GL_LIGHT_MODEL_AMBIENT:
+            return 4;
+        case GL_LIGHT_MODEL_TWO_SIDE:
+            return 1;
+        default:
+            return 0;
+        }
+    }
+
+    private String getPointerTypeName(int type) {
+        switch (type) {
+        case GL_BYTE:
+            return "GL_BYTE";
+        case GL_UNSIGNED_BYTE:
+            return "GL_UNSIGNED_BYTE";
+        case GL_SHORT:
+            return "GL_SHORT";
+        case GL_FIXED:
+            return "GL_FIXED";
+        case GL_FLOAT:
+            return "GL_FLOAT";
+        default:
+            return getHex(type);
+        }
+    }
+
+    private ByteBuffer toByteBuffer(int byteCount, Buffer input) {
+        ByteBuffer result = null;
+        boolean convertWholeBuffer = (byteCount < 0);
+        if (input instanceof ByteBuffer) {
+            ByteBuffer input2 = (ByteBuffer) input;
+            int position = input2.position();
+            if (convertWholeBuffer) {
+                byteCount = input2.limit() - position;
+            }
+            result = ByteBuffer.allocate(byteCount).order(input2.order());
+            for (int i = 0; i < byteCount; i++) {
+                result.put(input2.get());
+            }
+            input2.position(position);
+        } else if (input instanceof CharBuffer) {
+            CharBuffer input2 = (CharBuffer) input;
+            int position = input2.position();
+            if (convertWholeBuffer) {
+                byteCount = (input2.limit() - position) * 2;
+            }
+            result = ByteBuffer.allocate(byteCount).order(input2.order());
+            CharBuffer result2 = result.asCharBuffer();
+            for (int i = 0; i < byteCount / 2; i++) {
+                result2.put(input2.get());
+            }
+            input2.position(position);
+        } else if (input instanceof ShortBuffer) {
+            ShortBuffer input2 = (ShortBuffer) input;
+            int position = input2.position();
+            if (convertWholeBuffer) {
+                byteCount = (input2.limit() - position)* 2;
+            }
+            result = ByteBuffer.allocate(byteCount).order(input2.order());
+            ShortBuffer result2 = result.asShortBuffer();
+            for (int i = 0; i < byteCount / 2; i++) {
+                result2.put(input2.get());
+            }
+            input2.position(position);
+        } else if (input instanceof IntBuffer) {
+            IntBuffer input2 = (IntBuffer) input;
+            int position = input2.position();
+            if (convertWholeBuffer) {
+                byteCount = (input2.limit() - position) * 4;
+            }
+            result = ByteBuffer.allocate(byteCount).order(input2.order());
+            IntBuffer result2 = result.asIntBuffer();
+            for (int i = 0; i < byteCount / 4; i++) {
+                result2.put(input2.get());
+            }
+            input2.position(position);
+        } else if (input instanceof FloatBuffer) {
+            FloatBuffer input2 = (FloatBuffer) input;
+            int position = input2.position();
+            if (convertWholeBuffer) {
+                byteCount = (input2.limit() - position) * 4;
+            }
+            result = ByteBuffer.allocate(byteCount).order(input2.order());
+            FloatBuffer result2 = result.asFloatBuffer();
+            for (int i = 0; i < byteCount / 4; i++) {
+                result2.put(input2.get());
+            }
+            input2.position(position);
+        } else if (input instanceof DoubleBuffer) {
+            DoubleBuffer input2 = (DoubleBuffer) input;
+            int position = input2.position();
+            if (convertWholeBuffer) {
+                byteCount = (input2.limit() - position) * 8;
+            }
+            result = ByteBuffer.allocate(byteCount).order(input2.order());
+            DoubleBuffer result2 = result.asDoubleBuffer();
+            for (int i = 0; i < byteCount / 8; i++) {
+                result2.put(input2.get());
+            }
+            input2.position(position);
+        } else if (input instanceof LongBuffer) {
+            LongBuffer input2 = (LongBuffer) input;
+            int position = input2.position();
+            if (convertWholeBuffer) {
+                byteCount = (input2.limit() - position) * 8;
+            }
+            result = ByteBuffer.allocate(byteCount).order(input2.order());
+            LongBuffer result2 = result.asLongBuffer();
+            for (int i = 0; i < byteCount / 8; i++) {
+                result2.put(input2.get());
+            }
+            input2.position(position);
+        } else {
+            throw new RuntimeException("Unimplemented Buffer subclass.");
+        }
+        result.rewind();
+        // The OpenGL API will interpret the result in hardware byte order,
+        // so we better do that as well:
+        result.order(ByteOrder.nativeOrder());
+        return result;
+    }
+
+    private char[] toCharIndices(int count, int type, Buffer indices) {
+        char[] result = new char[count];
+        switch (type) {
+        case GL_UNSIGNED_BYTE: {
+            ByteBuffer byteBuffer = toByteBuffer(count, indices);
+            byte[] array = byteBuffer.array();
+            int offset = byteBuffer.arrayOffset();
+            for (int i = 0; i < count; i++) {
+                result[i] = (char) (0xff & array[offset + i]);
+            }
+        }
+            break;
+        case GL_UNSIGNED_SHORT: {
+            CharBuffer charBuffer;
+            if (indices instanceof CharBuffer) {
+                charBuffer = (CharBuffer) indices;
+            } else {
+                ByteBuffer byteBuffer = toByteBuffer(count * 2, indices);
+                charBuffer = byteBuffer.asCharBuffer();
+            }
+            int oldPosition = charBuffer.position();
+            charBuffer.position(0);
+            charBuffer.get(result);
+            charBuffer.position(oldPosition);
+        }
+            break;
+        default:
+            // Don't throw an exception, because we don't want logging to
+            // change the behavior.
+            break;
+        }
+        return result;
+    }
+
+    private void doArrayElement(StringBuilder builder, boolean enabled,
+            String name, PointerInfo pointer, int index) {
+        if (!enabled) {
+            return;
+        }
+        builder.append(" ");
+        builder.append(name + ":{");
+        if (pointer == null || pointer.mTempByteBuffer == null ) {
+            builder.append("undefined }");
+            return;
+        }
+        if (pointer.mStride < 0) {
+            builder.append("invalid stride");
+            return;
+        }
+
+        int stride = pointer.getStride();
+        ByteBuffer byteBuffer = pointer.mTempByteBuffer;
+        int size = pointer.mSize;
+        int type = pointer.mType;
+        int sizeofType = pointer.sizeof(type);
+        int byteOffset = stride * index;
+        for (int i = 0; i < size; i++) {
+            if (i > 0) {
+                builder.append(", ");
+            }
+            switch (type) {
+            case GL_BYTE: {
+                byte d = byteBuffer.get(byteOffset);
+                builder.append(Integer.toString(d));
+            }
+                break;
+            case GL_UNSIGNED_BYTE: {
+                byte d = byteBuffer.get(byteOffset);
+                builder.append(Integer.toString(0xff & d));
+            }
+                break;
+            case GL_SHORT: {
+                ShortBuffer shortBuffer = byteBuffer.asShortBuffer();
+                short d = shortBuffer.get(byteOffset / 2);
+                builder.append(Integer.toString(d));
+            }
+                break;
+            case GL_FIXED: {
+                IntBuffer intBuffer = byteBuffer.asIntBuffer();
+                int d = intBuffer.get(byteOffset / 4);
+                builder.append(Integer.toString(d));
+            }
+                break;
+            case GL_FLOAT: {
+                FloatBuffer intBuffer = byteBuffer.asFloatBuffer();
+                float d = intBuffer.get(byteOffset / 4);
+                builder.append(Float.toString(d));
+            }
+                break;
+            default:
+                builder.append("?");
+                break;
+            }
+            byteOffset += sizeofType;
+        }
+        builder.append("}");
+    }
+
+    private void doElement(StringBuilder builder, int ordinal, int vertexIndex) {
+        builder.append(" [" + ordinal + " : " + vertexIndex + "] =");
+        doArrayElement(builder, mVertexArrayEnabled, "v", mVertexPointer,
+                vertexIndex);
+        doArrayElement(builder, mNormalArrayEnabled, "n", mNormalPointer,
+                vertexIndex);
+        doArrayElement(builder, mColorArrayEnabled, "c", mColorPointer,
+                vertexIndex);
+        doArrayElement(builder, mTextureCoordArrayEnabled, "t",
+                mTexCoordPointer, vertexIndex);
+        builder.append("\n");
+        // Vertex
+        // Normal
+        // Color
+        // TexCoord
+    }
+
+    private void bindArrays() {
+        if (mColorArrayEnabled)
+            mColorPointer.bindByteBuffer();
+        if (mNormalArrayEnabled)
+            mNormalPointer.bindByteBuffer();
+        if (mTextureCoordArrayEnabled)
+            mTexCoordPointer.bindByteBuffer();
+        if (mVertexArrayEnabled)
+            mVertexPointer.bindByteBuffer();
+    }
+
+    private void unbindArrays() {
+        if (mColorArrayEnabled)
+            mColorPointer.unbindByteBuffer();
+        if (mNormalArrayEnabled)
+            mNormalPointer.unbindByteBuffer();
+        if (mTextureCoordArrayEnabled)
+            mTexCoordPointer.unbindByteBuffer();
+        if (mVertexArrayEnabled)
+            mVertexPointer.unbindByteBuffer();
+    }
+
+    private void startLogIndices() {
+        mStringBuilder = new StringBuilder();
+        mStringBuilder.append("\n");
+        bindArrays();
+    }
+
+    private void endLogIndices() {
+        log(mStringBuilder.toString());
+        unbindArrays();
+    }
+
+    // ---------------------------------------------------------------------
+    // GL10 methods:
+
+    public void glActiveTexture(int texture) {
+        begin("glActiveTexture");
+        arg("texture", texture);
+        end();
+        mgl.glActiveTexture(texture);
+        checkError();
+    }
+
+    public void glAlphaFunc(int func, float ref) {
+        begin("glAlphaFunc");
+        arg("func", func);
+        arg("ref", ref);
+        end();
+        mgl.glAlphaFunc(func, ref);
+        checkError();
+    }
+
+    public void glAlphaFuncx(int func, int ref) {
+        begin("glAlphaFuncx");
+        arg("func", func);
+        arg("ref", ref);
+        end();
+        mgl.glAlphaFuncx(func, ref);
+        checkError();
+    }
+
+    public void glBindTexture(int target, int texture) {
+        begin("glBindTexture");
+        arg("target", getTextureTarget(target));
+        arg("texture", texture);
+        end();
+        mgl.glBindTexture(target, texture);
+        checkError();
+    }
+
+    public void glBlendFunc(int sfactor, int dfactor) {
+        begin("glBlendFunc");
+        arg("sfactor", getFactor(sfactor));
+        arg("dfactor", getFactor(dfactor));
+        end();
+
+        mgl.glBlendFunc(sfactor, dfactor);
+        checkError();
+    }
+
+    public void glClear(int mask) {
+        begin("glClear");
+        arg("mask", getClearBufferMask(mask));
+        end();
+
+        mgl.glClear(mask);
+        checkError();
+    }
+
+    public void glClearColor(float red, float green, float blue, float alpha) {
+        begin("glClearColor");
+        arg("red", red);
+        arg("green", green);
+        arg("blue", blue);
+        arg("alpha", alpha);
+        end();
+
+        mgl.glClearColor(red, green, blue, alpha);
+        checkError();
+    }
+
+    public void glClearColorx(int red, int green, int blue, int alpha) {
+        begin("glClearColor");
+        arg("red", red);
+        arg("green", green);
+        arg("blue", blue);
+        arg("alpha", alpha);
+        end();
+
+        mgl.glClearColorx(red, green, blue, alpha);
+        checkError();
+    }
+
+    public void glClearDepthf(float depth) {
+        begin("glClearDepthf");
+        arg("depth", depth);
+        end();
+
+        mgl.glClearDepthf(depth);
+        checkError();
+    }
+
+    public void glClearDepthx(int depth) {
+        begin("glClearDepthx");
+        arg("depth", depth);
+        end();
+
+        mgl.glClearDepthx(depth);
+        checkError();
+    }
+
+    public void glClearStencil(int s) {
+        begin("glClearStencil");
+        arg("s", s);
+        end();
+
+        mgl.glClearStencil(s);
+        checkError();
+    }
+
+    public void glClientActiveTexture(int texture) {
+        begin("glClientActiveTexture");
+        arg("texture", texture);
+        end();
+
+        mgl.glClientActiveTexture(texture);
+        checkError();
+    }
+
+    public void glColor4f(float red, float green, float blue, float alpha) {
+        begin("glColor4f");
+        arg("red", red);
+        arg("green", green);
+        arg("blue", blue);
+        arg("alpha", alpha);
+        end();
+
+        mgl.glColor4f(red, green, blue, alpha);
+        checkError();
+    }
+
+    public void glColor4x(int red, int green, int blue, int alpha) {
+        begin("glColor4x");
+        arg("red", red);
+        arg("green", green);
+        arg("blue", blue);
+        arg("alpha", alpha);
+        end();
+
+        mgl.glColor4x(red, green, blue, alpha);
+        checkError();
+    }
+
+    public void glColorMask(boolean red, boolean green, boolean blue,
+            boolean alpha) {
+        begin("glColorMask");
+        arg("red", red);
+        arg("green", green);
+        arg("blue", blue);
+        arg("alpha", alpha);
+        end();
+
+        mgl.glColorMask(red, green, blue, alpha);
+        checkError();
+    }
+
+    public void glColorPointer(int size, int type, int stride, Buffer pointer) {
+        begin("glColorPointer");
+        argPointer(size, type, stride, pointer);
+        end();
+        mColorPointer = new PointerInfo(size, type, stride, pointer);
+
+        mgl.glColorPointer(size, type, stride, pointer);
+        checkError();
+    }
+
+    public void glCompressedTexImage2D(int target, int level,
+            int internalformat, int width, int height, int border,
+            int imageSize, Buffer data) {
+        begin("glCompressedTexImage2D");
+        arg("target", getTextureTarget(target));
+        arg("level", level);
+        arg("internalformat", internalformat);
+        arg("width", width);
+        arg("height", height);
+        arg("border", border);
+        arg("imageSize", imageSize);
+        arg("data", data.toString());
+        end();
+
+        mgl.glCompressedTexImage2D(target, level, internalformat, width,
+                height, border, imageSize, data);
+        checkError();
+    }
+
+    public void glCompressedTexSubImage2D(int target, int level, int xoffset,
+            int yoffset, int width, int height, int format, int imageSize,
+            Buffer data) {
+        begin("glCompressedTexSubImage2D");
+        arg("target", getTextureTarget(target));
+        arg("level", level);
+        arg("xoffset", xoffset);
+        arg("yoffset", yoffset);
+        arg("width", width);
+        arg("height", height);
+        arg("format", format);
+        arg("imageSize", imageSize);
+        arg("data", data.toString());
+        end();
+
+        mgl.glCompressedTexSubImage2D(target, level, xoffset, yoffset, width,
+                height, format, imageSize, data);
+        checkError();
+    }
+
+    public void glCopyTexImage2D(int target, int level, int internalformat,
+            int x, int y, int width, int height, int border) {
+        begin("glCopyTexImage2D");
+        arg("target", getTextureTarget(target));
+        arg("level", level);
+        arg("internalformat", internalformat);
+        arg("x", x);
+        arg("y", y);
+        arg("width", width);
+        arg("height", height);
+        arg("border", border);
+        end();
+
+        mgl.glCopyTexImage2D(target, level, internalformat, x, y, width,
+                height, border);
+        checkError();
+    }
+
+    public void glCopyTexSubImage2D(int target, int level, int xoffset,
+            int yoffset, int x, int y, int width, int height) {
+        begin("glCopyTexSubImage2D");
+        arg("target", getTextureTarget(target));
+        arg("level", level);
+        arg("xoffset", xoffset);
+        arg("yoffset", yoffset);
+        arg("x", x);
+        arg("y", y);
+        arg("width", width);
+        arg("height", height);
+        end();
+
+        mgl.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width,
+                height);
+        checkError();
+    }
+
+    public void glCullFace(int mode) {
+        begin("glCullFace");
+        arg("mode", mode);
+        end();
+
+        mgl.glCullFace(mode);
+        checkError();
+    }
+
+    public void glDeleteTextures(int n, int[] textures, int offset) {
+        begin("glDeleteTextures");
+        arg("n", n);
+        arg("textures", n, textures, offset);
+        arg("offset", offset);
+        end();
+
+        mgl.glDeleteTextures(n, textures, offset);
+        checkError();
+    }
+
+    public void glDeleteTextures(int n, IntBuffer textures) {
+        begin("glDeleteTextures");
+        arg("n", n);
+        arg("textures", n, textures);
+        end();
+
+        mgl.glDeleteTextures(n, textures);
+        checkError();
+    }
+
+    public void glDepthFunc(int func) {
+        begin("glDepthFunc");
+        arg("func", func);
+        end();
+
+        mgl.glDepthFunc(func);
+        checkError();
+    }
+
+    public void glDepthMask(boolean flag) {
+        begin("glDepthMask");
+        arg("flag", flag);
+        end();
+
+        mgl.glDepthMask(flag);
+        checkError();
+    }
+
+    public void glDepthRangef(float near, float far) {
+        begin("glDepthRangef");
+        arg("near", near);
+        arg("far", far);
+        end();
+
+        mgl.glDepthRangef(near, far);
+        checkError();
+    }
+
+    public void glDepthRangex(int near, int far) {
+        begin("glDepthRangex");
+        arg("near", near);
+        arg("far", far);
+        end();
+
+        mgl.glDepthRangex(near, far);
+        checkError();
+    }
+
+    public void glDisable(int cap) {
+        begin("glDisable");
+        arg("cap", getCap(cap));
+        end();
+
+        mgl.glDisable(cap);
+        checkError();
+    }
+
+    public void glDisableClientState(int array) {
+        begin("glDisableClientState");
+        arg("array", getClientState(array));
+        end();
+
+        switch (array) {
+        case GL_COLOR_ARRAY:
+            mColorArrayEnabled = false;
+            break;
+        case GL_NORMAL_ARRAY:
+            mNormalArrayEnabled = false;
+            break;
+        case GL_TEXTURE_COORD_ARRAY:
+            mTextureCoordArrayEnabled = false;
+            break;
+        case GL_VERTEX_ARRAY:
+            mVertexArrayEnabled = false;
+            break;
+        }
+        mgl.glDisableClientState(array);
+        checkError();
+    }
+
+    public void glDrawArrays(int mode, int first, int count) {
+        begin("glDrawArrays");
+        arg("mode", mode);
+        arg("first", first);
+        arg("count", count);
+        startLogIndices();
+        for (int i = 0; i < count; i++) {
+            doElement(mStringBuilder, i, first + i);
+        }
+        endLogIndices();
+        end();
+
+        mgl.glDrawArrays(mode, first, count);
+        checkError();
+    }
+
+    public void glDrawElements(int mode, int count, int type, Buffer indices) {
+        begin("glDrawElements");
+        arg("mode", getBeginMode(mode));
+        arg("count", count);
+        arg("type", getIndexType(type));
+        char[] indexArray = toCharIndices(count, type, indices);
+        int indexArrayLength = indexArray.length;
+        startLogIndices();
+        for (int i = 0; i < indexArrayLength; i++) {
+            doElement(mStringBuilder, i, indexArray[i]);
+        }
+        endLogIndices();
+        end();
+
+        mgl.glDrawElements(mode, count, type, indices);
+        checkError();
+    }
+
+    public void glEnable(int cap) {
+        begin("glEnable");
+        arg("cap", getCap(cap));
+        end();
+
+        mgl.glEnable(cap);
+        checkError();
+    }
+
+    public void glEnableClientState(int array) {
+        begin("glEnableClientState");
+        arg("array", getClientState(array));
+        end();
+
+        switch (array) {
+        case GL_COLOR_ARRAY:
+            mColorArrayEnabled = true;
+            break;
+        case GL_NORMAL_ARRAY:
+            mNormalArrayEnabled = true;
+            break;
+        case GL_TEXTURE_COORD_ARRAY:
+            mTextureCoordArrayEnabled = true;
+            break;
+        case GL_VERTEX_ARRAY:
+            mVertexArrayEnabled = true;
+            break;
+        }
+        mgl.glEnableClientState(array);
+        checkError();
+    }
+
+    public void glFinish() {
+        begin("glFinish");
+        end();
+
+        mgl.glFinish();
+        checkError();
+    }
+
+    public void glFlush() {
+        begin("glFlush");
+        end();
+
+        mgl.glFlush();
+        checkError();
+    }
+
+    public void glFogf(int pname, float param) {
+        begin("glFogf");
+        arg("pname", pname);
+        arg("param", param);
+        end();
+
+        mgl.glFogf(pname, param);
+        checkError();
+    }
+
+    public void glFogfv(int pname, float[] params, int offset) {
+        begin("glFogfv");
+        arg("pname", getFogPName(pname));
+        arg("params", getFogParamCount(pname), params, offset);
+        arg("offset", offset);
+        end();
+
+        mgl.glFogfv(pname, params, offset);
+        checkError();
+    }
+
+    public void glFogfv(int pname, FloatBuffer params) {
+        begin("glFogfv");
+        arg("pname", getFogPName(pname));
+        arg("params", getFogParamCount(pname), params);
+        end();
+
+        mgl.glFogfv(pname, params);
+        checkError();
+    }
+
+    public void glFogx(int pname, int param) {
+        begin("glFogx");
+        arg("pname", getFogPName(pname));
+        arg("param", param);
+        end();
+
+        mgl.glFogx(pname, param);
+        checkError();
+    }
+
+    public void glFogxv(int pname, int[] params, int offset) {
+        begin("glFogxv");
+        arg("pname", getFogPName(pname));
+        arg("params", getFogParamCount(pname), params, offset);
+        arg("offset", offset);
+        end();
+
+        mgl.glFogxv(pname, params, offset);
+        checkError();
+    }
+
+    public void glFogxv(int pname, IntBuffer params) {
+        begin("glFogxv");
+        arg("pname", getFogPName(pname));
+        arg("params", getFogParamCount(pname), params);
+        end();
+
+        mgl.glFogxv(pname, params);
+        checkError();
+    }
+
+    public void glFrontFace(int mode) {
+        begin("glFrontFace");
+        arg("mode", mode);
+        end();
+
+        mgl.glFrontFace(mode);
+        checkError();
+    }
+
+    public void glFrustumf(float left, float right, float bottom, float top,
+            float near, float far) {
+        begin("glFrustumf");
+        arg("left", left);
+        arg("right", right);
+        arg("bottom", bottom);
+        arg("top", top);
+        arg("near", near);
+        arg("far", far);
+        end();
+
+        mgl.glFrustumf(left, right, bottom, top, near, far);
+        checkError();
+    }
+
+    public void glFrustumx(int left, int right, int bottom, int top, int near,
+            int far) {
+        begin("glFrustumx");
+        arg("left", left);
+        arg("right", right);
+        arg("bottom", bottom);
+        arg("top", top);
+        arg("near", near);
+        arg("far", far);
+        end();
+
+        mgl.glFrustumx(left, right, bottom, top, near, far);
+        checkError();
+    }
+
+    public void glGenTextures(int n, int[] textures, int offset) {
+        begin("glGenTextures");
+        arg("n", n);
+        arg("textures", Arrays.toString(textures));
+        arg("offset", offset);
+
+        mgl.glGenTextures(n, textures, offset);
+
+        returns(toString(n, FORMAT_INT, textures, offset));
+
+        checkError();
+    }
+
+    public void glGenTextures(int n, IntBuffer textures) {
+        begin("glGenTextures");
+        arg("n", n);
+        arg("textures", textures.toString());
+
+        mgl.glGenTextures(n, textures);
+
+        returns(toString(n, FORMAT_INT, textures));
+
+        checkError();
+    }
+
+    public int glGetError() {
+        begin("glGetError");
+
+        int result = mgl.glGetError();
+
+        returns(result);
+
+        return result;
+    }
+
+    public void glGetIntegerv(int pname, int[] params, int offset) {
+        begin("glGetIntegerv");
+        arg("pname", getIntegerStateName(pname));
+        arg("params", Arrays.toString(params));
+        arg("offset", offset);
+
+        mgl.glGetIntegerv(pname, params, offset);
+
+        returns(toString(getIntegerStateSize(pname),
+                getIntegerStateFormat(pname), params, offset));
+
+        checkError();
+    }
+
+    public void glGetIntegerv(int pname, IntBuffer params) {
+        begin("glGetIntegerv");
+        arg("pname", getIntegerStateName(pname));
+        arg("params", params.toString());
+
+        mgl.glGetIntegerv(pname, params);
+
+        returns(toString(getIntegerStateSize(pname),
+                getIntegerStateFormat(pname), params));
+
+        checkError();
+    }
+
+    public String glGetString(int name) {
+        begin("glGetString");
+        arg("name", name);
+
+        String result = mgl.glGetString(name);
+
+        returns(result);
+
+        checkError();
+        return result;
+    }
+
+    public void glHint(int target, int mode) {
+        begin("glHint");
+        arg("target", getHintTarget(target));
+        arg("mode", getHintMode(mode));
+        end();
+
+        mgl.glHint(target, mode);
+        checkError();
+    }
+
+    public void glLightModelf(int pname, float param) {
+        begin("glLightModelf");
+        arg("pname", getLightModelPName(pname));
+        arg("param", param);
+        end();
+
+        mgl.glLightModelf(pname, param);
+        checkError();
+    }
+
+    public void glLightModelfv(int pname, float[] params, int offset) {
+        begin("glLightModelfv");
+        arg("pname", getLightModelPName(pname));
+        arg("params", getLightModelParamCount(pname), params, offset);
+        arg("offset", offset);
+        end();
+
+        mgl.glLightModelfv(pname, params, offset);
+        checkError();
+    }
+
+    public void glLightModelfv(int pname, FloatBuffer params) {
+        begin("glLightModelfv");
+        arg("pname", getLightModelPName(pname));
+        arg("params", getLightModelParamCount(pname), params);
+        end();
+
+        mgl.glLightModelfv(pname, params);
+        checkError();
+    }
+
+    public void glLightModelx(int pname, int param) {
+        begin("glLightModelx");
+        arg("pname", getLightModelPName(pname));
+        arg("param", param);
+        end();
+
+        mgl.glLightModelx(pname, param);
+        checkError();
+    }
+
+    public void glLightModelxv(int pname, int[] params, int offset) {
+        begin("glLightModelxv");
+        arg("pname", getLightModelPName(pname));
+        arg("params", getLightModelParamCount(pname), params, offset);
+        arg("offset", offset);
+        end();
+
+        mgl.glLightModelxv(pname, params, offset);
+        checkError();
+    }
+
+    public void glLightModelxv(int pname, IntBuffer params) {
+        begin("glLightModelfv");
+        arg("pname", getLightModelPName(pname));
+        arg("params", getLightModelParamCount(pname), params);
+        end();
+
+        mgl.glLightModelxv(pname, params);
+        checkError();
+    }
+
+    public void glLightf(int light, int pname, float param) {
+        begin("glLightf");
+        arg("light", getLightName(light));
+        arg("pname", getLightPName(pname));
+        arg("param", param);
+        end();
+
+        mgl.glLightf(light, pname, param);
+        checkError();
+    }
+
+    public void glLightfv(int light, int pname, float[] params, int offset) {
+        begin("glLightfv");
+        arg("light", getLightName(light));
+        arg("pname", getLightPName(pname));
+        arg("params", getLightParamCount(pname), params, offset);
+        arg("offset", offset);
+        end();
+
+        mgl.glLightfv(light, pname, params, offset);
+        checkError();
+    }
+
+    public void glLightfv(int light, int pname, FloatBuffer params) {
+        begin("glLightfv");
+        arg("light", getLightName(light));
+        arg("pname", getLightPName(pname));
+        arg("params", getLightParamCount(pname), params);
+        end();
+
+        mgl.glLightfv(light, pname, params);
+        checkError();
+    }
+
+    public void glLightx(int light, int pname, int param) {
+        begin("glLightx");
+        arg("light", getLightName(light));
+        arg("pname", getLightPName(pname));
+        arg("param", param);
+        end();
+
+        mgl.glLightx(light, pname, param);
+        checkError();
+    }
+
+    public void glLightxv(int light, int pname, int[] params, int offset) {
+        begin("glLightxv");
+        arg("light", getLightName(light));
+        arg("pname", getLightPName(pname));
+        arg("params", getLightParamCount(pname), params, offset);
+        arg("offset", offset);
+        end();
+
+        mgl.glLightxv(light, pname, params, offset);
+        checkError();
+    }
+
+    public void glLightxv(int light, int pname, IntBuffer params) {
+        begin("glLightxv");
+        arg("light", getLightName(light));
+        arg("pname", getLightPName(pname));
+        arg("params", getLightParamCount(pname), params);
+        end();
+
+        mgl.glLightxv(light, pname, params);
+        checkError();
+    }
+
+    public void glLineWidth(float width) {
+        begin("glLineWidth");
+        arg("width", width);
+        end();
+
+        mgl.glLineWidth(width);
+        checkError();
+    }
+
+    public void glLineWidthx(int width) {
+        begin("glLineWidthx");
+        arg("width", width);
+        end();
+
+        mgl.glLineWidthx(width);
+        checkError();
+    }
+
+    public void glLoadIdentity() {
+        begin("glLoadIdentity");
+        end();
+
+        mgl.glLoadIdentity();
+        checkError();
+    }
+
+    public void glLoadMatrixf(float[] m, int offset) {
+        begin("glLoadMatrixf");
+        arg("m", 16, m, offset);
+        arg("offset", offset);
+        end();
+
+        mgl.glLoadMatrixf(m, offset);
+        checkError();
+    }
+
+    public void glLoadMatrixf(FloatBuffer m) {
+        begin("glLoadMatrixf");
+        arg("m", 16, m);
+        end();
+
+        mgl.glLoadMatrixf(m);
+        checkError();
+    }
+
+    public void glLoadMatrixx(int[] m, int offset) {
+        begin("glLoadMatrixx");
+        arg("m", 16, m, offset);
+        arg("offset", offset);
+        end();
+
+        mgl.glLoadMatrixx(m, offset);
+        checkError();
+    }
+
+    public void glLoadMatrixx(IntBuffer m) {
+        begin("glLoadMatrixx");
+        arg("m", 16, m);
+        end();
+
+        mgl.glLoadMatrixx(m);
+        checkError();
+    }
+
+    public void glLogicOp(int opcode) {
+        begin("glLogicOp");
+        arg("opcode", opcode);
+        end();
+
+        mgl.glLogicOp(opcode);
+        checkError();
+    }
+
+    public void glMaterialf(int face, int pname, float param) {
+        begin("glMaterialf");
+        arg("face", getFaceName(face));
+        arg("pname", getMaterialPName(pname));
+        arg("param", param);
+        end();
+
+        mgl.glMaterialf(face, pname, param);
+        checkError();
+    }
+
+    public void glMaterialfv(int face, int pname, float[] params, int offset) {
+        begin("glMaterialfv");
+        arg("face", getFaceName(face));
+        arg("pname", getMaterialPName(pname));
+        arg("params", getMaterialParamCount(pname), params, offset);
+        arg("offset", offset);
+        end();
+
+        mgl.glMaterialfv(face, pname, params, offset);
+        checkError();
+    }
+
+    public void glMaterialfv(int face, int pname, FloatBuffer params) {
+        begin("glMaterialfv");
+        arg("face", getFaceName(face));
+        arg("pname", getMaterialPName(pname));
+        arg("params", getMaterialParamCount(pname), params);
+        end();
+
+        mgl.glMaterialfv(face, pname, params);
+        checkError();
+    }
+
+    public void glMaterialx(int face, int pname, int param) {
+        begin("glMaterialx");
+        arg("face", getFaceName(face));
+        arg("pname", getMaterialPName(pname));
+        arg("param", param);
+        end();
+
+        mgl.glMaterialx(face, pname, param);
+        checkError();
+    }
+
+    public void glMaterialxv(int face, int pname, int[] params, int offset) {
+        begin("glMaterialxv");
+        arg("face", getFaceName(face));
+        arg("pname", getMaterialPName(pname));
+        arg("params", getMaterialParamCount(pname), params, offset);
+        arg("offset", offset);
+        end();
+
+        mgl.glMaterialxv(face, pname, params, offset);
+        checkError();
+    }
+
+    public void glMaterialxv(int face, int pname, IntBuffer params) {
+        begin("glMaterialxv");
+        arg("face", getFaceName(face));
+        arg("pname", getMaterialPName(pname));
+        arg("params", getMaterialParamCount(pname), params);
+        end();
+
+        mgl.glMaterialxv(face, pname, params);
+        checkError();
+    }
+
+    public void glMatrixMode(int mode) {
+        begin("glMatrixMode");
+        arg("mode", getMatrixMode(mode));
+        end();
+
+        mgl.glMatrixMode(mode);
+        checkError();
+    }
+
+    public void glMultMatrixf(float[] m, int offset) {
+        begin("glMultMatrixf");
+        arg("m", 16, m, offset);
+        arg("offset", offset);
+        end();
+
+        mgl.glMultMatrixf(m, offset);
+        checkError();
+    }
+
+    public void glMultMatrixf(FloatBuffer m) {
+        begin("glMultMatrixf");
+        arg("m", 16, m);
+        end();
+
+        mgl.glMultMatrixf(m);
+        checkError();
+    }
+
+    public void glMultMatrixx(int[] m, int offset) {
+        begin("glMultMatrixx");
+        arg("m", 16, m, offset);
+        arg("offset", offset);
+        end();
+
+        mgl.glMultMatrixx(m, offset);
+        checkError();
+    }
+
+    public void glMultMatrixx(IntBuffer m) {
+        begin("glMultMatrixx");
+        arg("m", 16, m);
+        end();
+
+        mgl.glMultMatrixx(m);
+        checkError();
+    }
+
+    public void glMultiTexCoord4f(int target, float s, float t, float r, float q) {
+        begin("glMultiTexCoord4f");
+        arg("target", target);
+        arg("s", s);
+        arg("t", t);
+        arg("r", r);
+        arg("q", q);
+        end();
+
+        mgl.glMultiTexCoord4f(target, s, t, r, q);
+        checkError();
+    }
+
+    public void glMultiTexCoord4x(int target, int s, int t, int r, int q) {
+        begin("glMultiTexCoord4x");
+        arg("target", target);
+        arg("s", s);
+        arg("t", t);
+        arg("r", r);
+        arg("q", q);
+        end();
+
+        mgl.glMultiTexCoord4x(target, s, t, r, q);
+        checkError();
+    }
+
+    public void glNormal3f(float nx, float ny, float nz) {
+        begin("glNormal3f");
+        arg("nx", nx);
+        arg("ny", ny);
+        arg("nz", nz);
+        end();
+
+        mgl.glNormal3f(nx, ny, nz);
+        checkError();
+    }
+
+    public void glNormal3x(int nx, int ny, int nz) {
+        begin("glNormal3x");
+        arg("nx", nx);
+        arg("ny", ny);
+        arg("nz", nz);
+        end();
+
+        mgl.glNormal3x(nx, ny, nz);
+        checkError();
+    }
+
+    public void glNormalPointer(int type, int stride, Buffer pointer) {
+        begin("glNormalPointer");
+        arg("type", type);
+        arg("stride", stride);
+        arg("pointer", pointer.toString());
+        end();
+        mNormalPointer = new PointerInfo(3, type, stride, pointer);
+
+        mgl.glNormalPointer(type, stride, pointer);
+        checkError();
+    }
+
+    public void glOrthof(float left, float right, float bottom, float top,
+            float near, float far) {
+        begin("glOrthof");
+        arg("left", left);
+        arg("right", right);
+        arg("bottom", bottom);
+        arg("top", top);
+        arg("near", near);
+        arg("far", far);
+        end();
+
+        mgl.glOrthof(left, right, bottom, top, near, far);
+        checkError();
+    }
+
+    public void glOrthox(int left, int right, int bottom, int top, int near,
+            int far) {
+        begin("glOrthox");
+        arg("left", left);
+        arg("right", right);
+        arg("bottom", bottom);
+        arg("top", top);
+        arg("near", near);
+        arg("far", far);
+        end();
+
+        mgl.glOrthox(left, right, bottom, top, near, far);
+        checkError();
+    }
+
+    public void glPixelStorei(int pname, int param) {
+        begin("glPixelStorei");
+        arg("pname", pname);
+        arg("param", param);
+        end();
+
+        mgl.glPixelStorei(pname, param);
+        checkError();
+    }
+
+    public void glPointSize(float size) {
+        begin("glPointSize");
+        arg("size", size);
+        end();
+
+        mgl.glPointSize(size);
+        checkError();
+    }
+
+    public void glPointSizex(int size) {
+        begin("glPointSizex");
+        arg("size", size);
+        end();
+
+        mgl.glPointSizex(size);
+        checkError();
+    }
+
+    public void glPolygonOffset(float factor, float units) {
+        begin("glPolygonOffset");
+        arg("factor", factor);
+        arg("units", units);
+        end();
+        mgl.glPolygonOffset(factor, units);
+        checkError();
+    }
+
+    public void glPolygonOffsetx(int factor, int units) {
+        begin("glPolygonOffsetx");
+        arg("factor", factor);
+        arg("units", units);
+        end();
+
+        mgl.glPolygonOffsetx(factor, units);
+        checkError();
+    }
+
+    public void glPopMatrix() {
+        begin("glPopMatrix");
+        end();
+
+        mgl.glPopMatrix();
+        checkError();
+    }
+
+    public void glPushMatrix() {
+        begin("glPushMatrix");
+        end();
+
+        mgl.glPushMatrix();
+        checkError();
+    }
+
+    public void glReadPixels(int x, int y, int width, int height, int format,
+            int type, Buffer pixels) {
+        begin("glReadPixels");
+        arg("x", x);
+        arg("y", y);
+        arg("width", width);
+        arg("height", height);
+        arg("format", format);
+        arg("type", type);
+        arg("pixels", pixels.toString());
+        end();
+
+        mgl.glReadPixels(x, y, width, height, format, type, pixels);
+        checkError();
+    }
+
+    public void glRotatef(float angle, float x, float y, float z) {
+        begin("glRotatef");
+        arg("angle", angle);
+        arg("x", x);
+        arg("y", y);
+        arg("z", z);
+        end();
+
+        mgl.glRotatef(angle, x, y, z);
+        checkError();
+    }
+
+    public void glRotatex(int angle, int x, int y, int z) {
+        begin("glRotatex");
+        arg("angle", angle);
+        arg("x", x);
+        arg("y", y);
+        arg("z", z);
+        end();
+
+        mgl.glRotatex(angle, x, y, z);
+        checkError();
+    }
+
+    public void glSampleCoverage(float value, boolean invert) {
+        begin("glSampleCoveragex");
+        arg("value", value);
+        arg("invert", invert);
+        end();
+
+        mgl.glSampleCoverage(value, invert);
+        checkError();
+    }
+
+    public void glSampleCoveragex(int value, boolean invert) {
+        begin("glSampleCoveragex");
+        arg("value", value);
+        arg("invert", invert);
+        end();
+
+        mgl.glSampleCoveragex(value, invert);
+        checkError();
+    }
+
+    public void glScalef(float x, float y, float z) {
+        begin("glScalef");
+        arg("x", x);
+        arg("y", y);
+        arg("z", z);
+        end();
+
+        mgl.glScalef(x, y, z);
+        checkError();
+    }
+
+    public void glScalex(int x, int y, int z) {
+        begin("glScalex");
+        arg("x", x);
+        arg("y", y);
+        arg("z", z);
+        end();
+
+        mgl.glScalex(x, y, z);
+        checkError();
+    }
+
+    public void glScissor(int x, int y, int width, int height) {
+        begin("glScissor");
+        arg("x", x);
+        arg("y", y);
+        arg("width", width);
+        arg("height", height);
+        end();
+
+        mgl.glScissor(x, y, width, height);
+        checkError();
+    }
+
+    public void glShadeModel(int mode) {
+        begin("glShadeModel");
+        arg("mode", getShadeModel(mode));
+        end();
+
+        mgl.glShadeModel(mode);
+        checkError();
+    }
+
+    public void glStencilFunc(int func, int ref, int mask) {
+        begin("glStencilFunc");
+        arg("func", func);
+        arg("ref", ref);
+        arg("mask", mask);
+        end();
+
+        mgl.glStencilFunc(func, ref, mask);
+        checkError();
+    }
+
+    public void glStencilMask(int mask) {
+        begin("glStencilMask");
+        arg("mask", mask);
+        end();
+
+        mgl.glStencilMask(mask);
+        checkError();
+    }
+
+    public void glStencilOp(int fail, int zfail, int zpass) {
+        begin("glStencilOp");
+        arg("fail", fail);
+        arg("zfail", zfail);
+        arg("zpass", zpass);
+        end();
+
+        mgl.glStencilOp(fail, zfail, zpass);
+        checkError();
+    }
+
+    public void glTexCoordPointer(int size, int type, int stride, Buffer pointer) {
+        begin("glTexCoordPointer");
+        argPointer(size, type, stride, pointer);
+        end();
+        mTexCoordPointer = new PointerInfo(size, type, stride, pointer);
+
+        mgl.glTexCoordPointer(size, type, stride, pointer);
+        checkError();
+    }
+
+    public void glTexEnvf(int target, int pname, float param) {
+        begin("glTexEnvf");
+        arg("target", getTextureEnvTarget(target));
+        arg("pname", getTextureEnvPName(pname));
+        arg("param", getTextureEnvParamName(param));
+        end();
+
+        mgl.glTexEnvf(target, pname, param);
+        checkError();
+    }
+
+    public void glTexEnvfv(int target, int pname, float[] params, int offset) {
+        begin("glTexEnvfv");
+        arg("target", getTextureEnvTarget(target));
+        arg("pname", getTextureEnvPName(pname));
+        arg("params", getTextureEnvParamCount(pname), params, offset);
+        arg("offset", offset);
+        end();
+
+        mgl.glTexEnvfv(target, pname, params, offset);
+        checkError();
+    }
+
+    public void glTexEnvfv(int target, int pname, FloatBuffer params) {
+        begin("glTexEnvfv");
+        arg("target", getTextureEnvTarget(target));
+        arg("pname", getTextureEnvPName(pname));
+        arg("params", getTextureEnvParamCount(pname), params);
+        end();
+
+        mgl.glTexEnvfv(target, pname, params);
+        checkError();
+    }
+
+    public void glTexEnvx(int target, int pname, int param) {
+        begin("glTexEnvx");
+        arg("target", getTextureEnvTarget(target));
+        arg("pname", getTextureEnvPName(pname));
+        arg("param", param);
+        end();
+
+        mgl.glTexEnvx(target, pname, param);
+        checkError();
+    }
+
+    public void glTexEnvxv(int target, int pname, int[] params, int offset) {
+        begin("glTexEnvxv");
+        arg("target", getTextureEnvTarget(target));
+        arg("pname", getTextureEnvPName(pname));
+        arg("params", getTextureEnvParamCount(pname), params, offset);
+        arg("offset", offset);
+        end();
+
+        mgl.glTexEnvxv(target, pname, params, offset);
+        checkError();
+    }
+
+    public void glTexEnvxv(int target, int pname, IntBuffer params) {
+        begin("glTexEnvxv");
+        arg("target", getTextureEnvTarget(target));
+        arg("pname", getTextureEnvPName(pname));
+        arg("params", getTextureEnvParamCount(pname), params);
+        end();
+
+        mgl.glTexEnvxv(target, pname, params);
+        checkError();
+    }
+
+    public void glTexImage2D(int target, int level, int internalformat,
+            int width, int height, int border, int format, int type,
+            Buffer pixels) {
+        begin("glTexImage2D");
+        arg("target", target);
+        arg("level", level);
+        arg("internalformat", internalformat);
+        arg("width", width);
+        arg("height", height);
+        arg("border", border);
+        arg("format", format);
+        arg("type", type);
+        arg("pixels", pixels.toString());
+        end();
+
+        mgl.glTexImage2D(target, level, internalformat, width, height, border,
+                format, type, pixels);
+        checkError();
+    }
+
+    public void glTexParameterf(int target, int pname, float param) {
+        begin("glTexParameterf");
+        arg("target", getTextureTarget(target));
+        arg("pname", getTexturePName(pname));
+        arg("param", getTextureParamName(param));
+        end();
+
+        mgl.glTexParameterf(target, pname, param);
+        checkError();
+    }
+
+    public void glTexParameterx(int target, int pname, int param) {
+        begin("glTexParameterx");
+        arg("target", getTextureTarget(target));
+        arg("pname", getTexturePName(pname));
+        arg("param", param);
+        end();
+
+        mgl.glTexParameterx(target, pname, param);
+        checkError();
+    }
+
+    public void glTexParameteriv(int target, int pname, int[] params, int offset) {
+        begin("glTexParameteriv");
+        arg("target", getTextureTarget(target));
+        arg("pname", getTexturePName(pname));
+        arg("params", 4, params, offset);
+        end();
+
+        mgl11.glTexParameteriv(target, pname, params, offset);
+        checkError();
+    }
+
+    public void glTexParameteriv(int target, int pname, IntBuffer params) {
+        begin("glTexParameteriv");
+        arg("target", getTextureTarget(target));
+        arg("pname", getTexturePName(pname));
+        arg("params", 4, params);
+        end();
+
+        mgl11.glTexParameteriv(target, pname, params);
+        checkError();
+    }
+
+    public void glTexSubImage2D(int target, int level, int xoffset,
+            int yoffset, int width, int height, int format, int type,
+            Buffer pixels) {
+        begin("glTexSubImage2D");
+        arg("target", getTextureTarget(target));
+        arg("level", level);
+        arg("xoffset", xoffset);
+        arg("yoffset", yoffset);
+        arg("width", width);
+        arg("height", height);
+        arg("format", format);
+        arg("type", type);
+        arg("pixels", pixels.toString());
+        end();
+        mgl.glTexSubImage2D(target, level, xoffset, yoffset, width, height,
+                format, type, pixels);
+        checkError();
+    }
+
+    public void glTranslatef(float x, float y, float z) {
+        begin("glTranslatef");
+        arg("x", x);
+        arg("y", y);
+        arg("z", z);
+        end();
+        mgl.glTranslatef(x, y, z);
+        checkError();
+    }
+
+    public void glTranslatex(int x, int y, int z) {
+        begin("glTranslatex");
+        arg("x", x);
+        arg("y", y);
+        arg("z", z);
+        end();
+        mgl.glTranslatex(x, y, z);
+        checkError();
+    }
+
+    public void glVertexPointer(int size, int type, int stride, Buffer pointer) {
+        begin("glVertexPointer");
+        argPointer(size, type, stride, pointer);
+        end();
+        mVertexPointer = new PointerInfo(size, type, stride, pointer);
+        mgl.glVertexPointer(size, type, stride, pointer);
+        checkError();
+    }
+
+    public void glViewport(int x, int y, int width, int height) {
+        begin("glViewport");
+        arg("x", x);
+        arg("y", y);
+        arg("width", width);
+        arg("height", height);
+        end();
+        mgl.glViewport(x, y, width, height);
+        checkError();
+    }
+
+    public void glClipPlanef(int plane, float[] equation, int offset) {
+        begin("glClipPlanef");
+        arg("plane", plane);
+        arg("equation", 4, equation, offset);
+        arg("offset", offset);
+        end();
+        mgl11.glClipPlanef(plane, equation, offset);
+        checkError();
+    }
+
+    public void glClipPlanef(int plane, FloatBuffer equation) {
+        begin("glClipPlanef");
+        arg("plane", plane);
+        arg("equation", 4, equation);
+        end();
+        mgl11.glClipPlanef(plane, equation);
+        checkError();
+    }
+
+    public void glClipPlanex(int plane, int[] equation, int offset) {
+        begin("glClipPlanex");
+        arg("plane", plane);
+        arg("equation", 4, equation, offset);
+        arg("offset", offset);
+        end();
+        mgl11.glClipPlanex(plane, equation, offset);
+        checkError();
+    }
+
+    public void glClipPlanex(int plane, IntBuffer equation) {
+        begin("glClipPlanef");
+        arg("plane", plane);
+        arg("equation", 4, equation);
+        end();
+        mgl11.glClipPlanex(plane, equation);
+        checkError();
+    }
+
+    // Draw Texture Extension
+
+    public void glDrawTexfOES(float x, float y, float z,
+        float width, float height) {
+        begin("glDrawTexfOES");
+        arg("x", x);
+        arg("y", y);
+        arg("z", z);
+        arg("width", width);
+        arg("height", height);
+        end();
+        mgl11Ext.glDrawTexfOES(x, y, z, width, height);
+        checkError();
+    }
+
+    public void glDrawTexfvOES(float[] coords, int offset) {
+        begin("glDrawTexfvOES");
+        arg("coords", 5, coords, offset);
+        arg("offset", offset);
+        end();
+        mgl11Ext.glDrawTexfvOES(coords, offset);
+        checkError();
+    }
+
+    public void glDrawTexfvOES(FloatBuffer coords) {
+        begin("glDrawTexfvOES");
+        arg("coords", 5, coords);
+        end();
+        mgl11Ext.glDrawTexfvOES(coords);
+        checkError();
+    }
+
+    public void glDrawTexiOES(int x, int y, int z, int width, int height) {
+        begin("glDrawTexiOES");
+        arg("x", x);
+        arg("y", y);
+        arg("z", z);
+        arg("width", width);
+        arg("height", height);
+        end();
+        mgl11Ext.glDrawTexiOES(x, y, z, width, height);
+        checkError();
+    }
+
+    public void glDrawTexivOES(int[] coords, int offset) {
+        begin("glDrawTexivOES");
+        arg("coords", 5, coords, offset);
+        arg("offset", offset);
+        end();
+        mgl11Ext.glDrawTexivOES(coords, offset);
+        checkError();
+    }
+
+    public void glDrawTexivOES(IntBuffer coords) {
+        begin("glDrawTexivOES");
+        arg("coords", 5, coords);
+        end();
+        mgl11Ext.glDrawTexivOES(coords);
+        checkError();
+    }
+
+    public void glDrawTexsOES(short x, short y, short z,
+        short width, short height) {
+        begin("glDrawTexsOES");
+        arg("x", x);
+        arg("y", y);
+        arg("z", z);
+        arg("width", width);
+        arg("height", height);
+        end();
+        mgl11Ext.glDrawTexsOES(x, y, z, width, height);
+        checkError();
+    }
+
+    public void glDrawTexsvOES(short[] coords, int offset) {
+        begin("glDrawTexsvOES");
+        arg("coords", 5, coords, offset);
+        arg("offset", offset);
+        end();
+        mgl11Ext.glDrawTexsvOES(coords, offset);
+        checkError();
+    }
+
+    public void glDrawTexsvOES(ShortBuffer coords) {
+        begin("glDrawTexsvOES");
+        arg("coords", 5, coords);
+        end();
+        mgl11Ext.glDrawTexsvOES(coords);
+        checkError();
+    }
+
+    public void glDrawTexxOES(int x, int y, int z, int width, int height) {
+        begin("glDrawTexxOES");
+        arg("x", x);
+        arg("y", y);
+        arg("z", z);
+        arg("width", width);
+        arg("height", height);
+        end();
+        mgl11Ext.glDrawTexxOES(x, y, z, width, height);
+        checkError();
+    }
+
+    public void glDrawTexxvOES(int[] coords, int offset) {
+        begin("glDrawTexxvOES");
+        arg("coords", 5, coords, offset);
+        arg("offset", offset);
+        end();
+        mgl11Ext.glDrawTexxvOES(coords, offset);
+        checkError();
+    }
+
+    public void glDrawTexxvOES(IntBuffer coords) {
+        begin("glDrawTexxvOES");
+        arg("coords", 5, coords);
+        end();
+        mgl11Ext.glDrawTexxvOES(coords);
+        checkError();
+    }
+
+    public int glQueryMatrixxOES(int[] mantissa, int mantissaOffset,
+        int[] exponent, int exponentOffset) {
+        begin("glQueryMatrixxOES");
+        arg("mantissa", Arrays.toString(mantissa));
+        arg("exponent", Arrays.toString(exponent));
+        end();
+        int valid = mgl10Ext.glQueryMatrixxOES(mantissa, mantissaOffset,
+            exponent, exponentOffset);
+        returns(toString(16, FORMAT_FIXED, mantissa, mantissaOffset));
+        returns(toString(16, FORMAT_INT, exponent, exponentOffset));
+        checkError();
+        return valid;
+    }
+
+    public int glQueryMatrixxOES(IntBuffer mantissa, IntBuffer exponent) {
+        begin("glQueryMatrixxOES");
+        arg("mantissa", mantissa.toString());
+        arg("exponent", exponent.toString());
+        end();
+        int valid = mgl10Ext.glQueryMatrixxOES(mantissa, exponent);
+        returns(toString(16, FORMAT_FIXED, mantissa));
+        returns(toString(16, FORMAT_INT, exponent));
+        checkError();
+        return valid;
+    }
+
+    public void glBindBuffer(int target, int buffer) {
+        begin("glBindBuffer");
+        arg("target", target);
+        arg("buffer", buffer);
+        end();
+        mgl11.glBindBuffer(target, buffer);
+        checkError();
+    }
+
+    public void glBufferData(int target, int size, Buffer data, int usage) {
+        begin("glBufferData");
+        arg("target", target);
+        arg("size", size);
+        arg("data", data.toString());
+        arg("usage", usage);
+        end();
+        mgl11.glBufferData(target, size, data, usage);
+        checkError();
+    }
+
+    public void glBufferSubData(int target, int offset, int size, Buffer data) {
+        begin("glBufferSubData");
+        arg("target", target);
+        arg("offset", offset);
+        arg("size", size);
+        arg("data", data.toString());
+        end();
+        mgl11.glBufferSubData(target, offset, size, data);
+        checkError();
+    }
+
+    public void glColor4ub(byte red, byte green, byte blue, byte alpha) {
+        begin("glColor4ub");
+        arg("red", red);
+        arg("green", green);
+        arg("blue", blue);
+        arg("alpha", alpha);
+        end();
+        mgl11.glColor4ub(red, green, blue, alpha);
+        checkError();
+    }
+
+    public void glDeleteBuffers(int n, int[] buffers, int offset) {
+        begin("glDeleteBuffers");
+        arg("n", n);
+        arg("buffers", buffers.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glDeleteBuffers(n, buffers, offset);
+        checkError();
+    }
+
+    public void glDeleteBuffers(int n, IntBuffer buffers) {
+        begin("glDeleteBuffers");
+        arg("n", n);
+        arg("buffers", buffers.toString());
+        end();
+        mgl11.glDeleteBuffers(n, buffers);
+        checkError();
+    }
+
+    public void glGenBuffers(int n, int[] buffers, int offset) {
+        begin("glGenBuffers");
+        arg("n", n);
+        arg("buffers", buffers.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glGenBuffers(n, buffers, offset);
+        checkError();
+    }
+
+    public void glGenBuffers(int n, IntBuffer buffers) {
+        begin("glGenBuffers");
+        arg("n", n);
+        arg("buffers", buffers.toString());
+        end();
+        mgl11.glGenBuffers(n, buffers);
+        checkError();
+    }
+
+    public void glGetBooleanv(int pname, boolean[] params, int offset) {
+        begin("glGetBooleanv");
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glGetBooleanv(pname, params, offset);
+        checkError();
+    }
+
+    public void glGetBooleanv(int pname, IntBuffer params) {
+        begin("glGetBooleanv");
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11.glGetBooleanv(pname, params);
+        checkError();
+    }
+
+    public void glGetBufferParameteriv(int target, int pname, int[] params,
+            int offset) {
+        begin("glGetBufferParameteriv");
+        arg("target", target);
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glGetBufferParameteriv(target, pname, params, offset);
+        checkError();
+    }
+
+    public void glGetBufferParameteriv(int target, int pname, IntBuffer params) {
+        begin("glGetBufferParameteriv");
+        arg("target", target);
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11.glGetBufferParameteriv(target, pname, params);
+        checkError();
+    }
+
+    public void glGetClipPlanef(int pname, float[] eqn, int offset) {
+        begin("glGetClipPlanef");
+        arg("pname", pname);
+        arg("eqn", eqn.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glGetClipPlanef(pname, eqn, offset);
+        checkError();
+    }
+
+    public void glGetClipPlanef(int pname, FloatBuffer eqn) {
+        begin("glGetClipPlanef");
+        arg("pname", pname);
+        arg("eqn", eqn.toString());
+        end();
+        mgl11.glGetClipPlanef(pname, eqn);
+        checkError();
+    }
+
+    public void glGetClipPlanex(int pname, int[] eqn, int offset) {
+        begin("glGetClipPlanex");
+        arg("pname", pname);
+        arg("eqn", eqn.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glGetClipPlanex(pname, eqn, offset);
+    }
+
+    public void glGetClipPlanex(int pname, IntBuffer eqn) {
+        begin("glGetClipPlanex");
+        arg("pname", pname);
+        arg("eqn", eqn.toString());
+        end();
+        mgl11.glGetClipPlanex(pname, eqn);
+        checkError();
+    }
+
+    public void glGetFixedv(int pname, int[] params, int offset) {
+        begin("glGetFixedv");
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glGetFixedv(pname, params, offset);
+    }
+
+    public void glGetFixedv(int pname, IntBuffer params) {
+        begin("glGetFixedv");
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11.glGetFixedv(pname, params);
+        checkError();
+    }
+
+    public void glGetFloatv(int pname, float[] params, int offset) {
+        begin("glGetFloatv");
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glGetFloatv(pname, params, offset);
+    }
+
+    public void glGetFloatv(int pname, FloatBuffer params) {
+        begin("glGetFloatv");
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11.glGetFloatv(pname, params);
+        checkError();
+    }
+
+    public void glGetLightfv(int light, int pname, float[] params, int offset) {
+        begin("glGetLightfv");
+        arg("light", light);
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glGetLightfv(light, pname, params, offset);
+        checkError();
+    }
+
+    public void glGetLightfv(int light, int pname, FloatBuffer params) {
+        begin("glGetLightfv");
+        arg("light", light);
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11.glGetLightfv(light, pname, params);
+        checkError();
+    }
+
+    public void glGetLightxv(int light, int pname, int[] params, int offset) {
+        begin("glGetLightxv");
+        arg("light", light);
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glGetLightxv(light, pname, params, offset);
+        checkError();
+    }
+
+    public void glGetLightxv(int light, int pname, IntBuffer params) {
+        begin("glGetLightxv");
+        arg("light", light);
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11.glGetLightxv(light, pname, params);
+        checkError();
+    }
+
+    public void glGetMaterialfv(int face, int pname, float[] params,
+            int offset) {
+        begin("glGetMaterialfv");
+        arg("face", face);
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glGetMaterialfv(face, pname, params, offset);
+        checkError();
+    }
+
+    public void glGetMaterialfv(int face, int pname, FloatBuffer params) {
+        begin("glGetMaterialfv");
+        arg("face", face);
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11.glGetMaterialfv(face, pname, params);
+        checkError();
+    }
+
+    public void glGetMaterialxv(int face, int pname, int[] params, int offset) {
+        begin("glGetMaterialxv");
+        arg("face", face);
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glGetMaterialxv(face, pname, params, offset);
+        checkError();
+    }
+
+    public void glGetMaterialxv(int face, int pname, IntBuffer params) {
+        begin("glGetMaterialxv");
+        arg("face", face);
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11.glGetMaterialxv(face, pname, params);
+        checkError();
+    }
+
+    public void glGetTexEnviv(int env, int pname, int[] params, int offset) {
+        begin("glGetTexEnviv");
+        arg("env", env);
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glGetTexEnviv(env, pname, params, offset);
+        checkError();
+    }
+
+    public void glGetTexEnviv(int env, int pname, IntBuffer params) {
+        begin("glGetTexEnviv");
+        arg("env", env);
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11.glGetTexEnviv(env, pname, params);
+        checkError();
+    }
+
+    public void glGetTexEnvxv(int env, int pname, int[] params, int offset) {
+        begin("glGetTexEnviv");
+        arg("env", env);
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glGetTexEnviv(env, pname, params, offset);
+        checkError();
+    }
+
+    public void glGetTexEnvxv(int env, int pname, IntBuffer params) {
+        begin("glGetTexEnviv");
+        arg("env", env);
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11.glGetTexEnvxv(env, pname, params);
+        checkError();
+    }
+
+    public void glGetTexParameterfv(int target, int pname, float[] params, int offset) {
+        begin("glGetTexParameterfv");
+        arg("target", target);
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glGetTexParameterfv(target, pname, params, offset);
+        checkError();
+    }
+
+    public void glGetTexParameterfv(int target, int pname, FloatBuffer params) {
+        begin("glGetTexParameterfv");
+        arg("target", target);
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11.glGetTexParameterfv(target, pname, params);
+        checkError();
+    }
+
+    public void glGetTexParameteriv(int target, int pname, int[] params, int offset) {
+        begin("glGetTexParameteriv");
+        arg("target", target);
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glGetTexEnviv(target, pname, params, offset);
+        checkError();
+    }
+
+    public void glGetTexParameteriv(int target, int pname, IntBuffer params) {
+        begin("glGetTexParameteriv");
+        arg("target", target);
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11.glGetTexParameteriv(target, pname, params);
+        checkError();
+    }
+
+    public void glGetTexParameterxv(int target, int pname, int[] params,
+            int offset) {
+        begin("glGetTexParameterxv");
+        arg("target", target);
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glGetTexParameterxv(target, pname, params, offset);
+        checkError();
+    }
+
+    public void glGetTexParameterxv(int target, int pname, IntBuffer params) {
+        begin("glGetTexParameterxv");
+        arg("target", target);
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11.glGetTexParameterxv(target, pname, params);
+        checkError();
+    }
+
+    public boolean glIsBuffer(int buffer) {
+        begin("glIsBuffer");
+        arg("buffer", buffer);
+        end();
+        boolean result = mgl11.glIsBuffer(buffer);
+        checkError();
+        return result;
+    }
+
+    public boolean glIsEnabled(int cap) {
+        begin("glIsEnabled");
+        arg("cap", cap);
+        end();
+        boolean result = mgl11.glIsEnabled(cap);
+        checkError();
+        return result;
+    }
+
+    public boolean glIsTexture(int texture) {
+        begin("glIsTexture");
+        arg("texture", texture);
+        end();
+        boolean result = mgl11.glIsTexture(texture);
+        checkError();
+        return result;
+    }
+
+    public void glPointParameterf(int pname, float param) {
+        begin("glPointParameterf");
+        arg("pname", pname);
+        arg("param", param);
+        end();
+        mgl11.glPointParameterf( pname, param);
+        checkError();
+    }
+
+    public void glPointParameterfv(int pname, float[] params, int offset) {
+        begin("glPointParameterfv");
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glPointParameterfv(pname, params, offset);
+        checkError();
+    }
+
+    public void glPointParameterfv(int pname, FloatBuffer params) {
+        begin("glPointParameterfv");
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11.glPointParameterfv(pname, params);
+        checkError();
+    }
+
+    public void glPointParameterx(int pname, int param) {
+        begin("glPointParameterfv");
+        arg("pname", pname);
+        arg("param", param);
+        end();
+        mgl11.glPointParameterx( pname, param);
+        checkError();
+    }
+
+    public void glPointParameterxv(int pname, int[] params, int offset) {
+        begin("glPointParameterxv");
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glPointParameterxv(pname, params, offset);
+        checkError();
+    }
+
+    public void glPointParameterxv(int pname, IntBuffer params) {
+        begin("glPointParameterxv");
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11.glPointParameterxv( pname, params);
+        checkError();
+    }
+
+    public void glPointSizePointerOES(int type, int stride, Buffer pointer) {
+        begin("glPointSizePointerOES");
+        arg("type", type);
+        arg("stride", stride);
+        arg("params", pointer.toString());
+        end();
+        mgl11.glPointSizePointerOES( type, stride, pointer);
+        checkError();
+    }
+
+    public void glTexEnvi(int target, int pname, int param) {
+        begin("glTexEnvi");
+        arg("target", target);
+        arg("pname", pname);
+        arg("param", param);
+        end();
+        mgl11.glTexEnvi(target, pname, param);
+        checkError();
+    }
+
+    public void glTexEnviv(int target, int pname, int[] params, int offset) {
+        begin("glTexEnviv");
+        arg("target", target);
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glTexEnviv(target, pname, params, offset);
+        checkError();
+    }
+
+    public void glTexEnviv(int target, int pname, IntBuffer params) {
+        begin("glTexEnviv");
+        arg("target", target);
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11.glTexEnviv( target, pname, params);
+        checkError();
+    }
+
+    public void glTexParameterfv(int target, int pname, float[] params,
+            int offset) {
+        begin("glTexParameterfv");
+        arg("target", target);
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glTexParameterfv( target, pname, params, offset);
+        checkError();
+    }
+
+    public void glTexParameterfv(int target, int pname, FloatBuffer params) {
+        begin("glTexParameterfv");
+        arg("target", target);
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11.glTexParameterfv(target, pname, params);
+        checkError();
+    }
+
+    public void glTexParameteri(int target, int pname, int param) {
+        begin("glTexParameterxv");
+        arg("target", target);
+        arg("pname", pname);
+        arg("param", param);
+        end();
+        mgl11.glTexParameteri(target, pname, param);
+        checkError();
+    }
+
+    public void glTexParameterxv(int target, int pname, int[] params,
+            int offset) {
+        begin("glTexParameterxv");
+        arg("target", target);
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11.glTexParameterxv(target, pname, params, offset);
+        checkError();
+    }
+
+    public void glTexParameterxv(int target, int pname, IntBuffer params) {
+        begin("glTexParameterxv");
+        arg("target", target);
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11.glTexParameterxv(target, pname, params);
+        checkError();
+    }
+
+
+    public void glColorPointer(int size, int type, int stride, int offset) {
+        begin("glColorPointer");
+        arg("size", size);
+        arg("type", type);
+        arg("stride", stride);
+        arg("offset", offset);
+        end();
+        mgl11.glColorPointer(size, type, stride, offset);
+        checkError();
+    }
+
+    public void glDrawElements(int mode, int count, int type, int offset) {
+        begin("glDrawElements");
+        arg("mode", mode);
+        arg("count", count);
+        arg("type", type);
+        arg("offset", offset);
+        end();
+        mgl11.glDrawElements(mode, count, type, offset);
+        checkError();
+    }
+
+    public void glGetPointerv(int pname, Buffer[] params) {
+        begin("glGetPointerv");
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11.glGetPointerv(pname, params);
+        checkError();
+    }
+
+    public void glNormalPointer(int type, int stride, int offset) {
+        begin("glNormalPointer");
+        arg("type", type);
+        arg("stride", stride);
+        arg("offset", offset);
+        end();
+        mgl11.glNormalPointer(type, stride, offset);
+    }
+
+    public void glTexCoordPointer(int size, int type, int stride, int offset) {
+        begin("glTexCoordPointer");
+        arg("size", size);
+        arg("type", type);
+        arg("stride", stride);
+        arg("offset", offset);
+        end();
+        mgl11.glTexCoordPointer(size, type, stride, offset);
+    }
+
+    public void glVertexPointer(int size, int type, int stride, int offset) {
+        begin("glVertexPointer");
+        arg("size", size);
+        arg("type", type);
+        arg("stride", stride);
+        arg("offset", offset);
+        end();
+        mgl11.glVertexPointer(size, type, stride, offset);
+    }
+
+    public void glCurrentPaletteMatrixOES(int matrixpaletteindex) {
+        begin("glCurrentPaletteMatrixOES");
+        arg("matrixpaletteindex", matrixpaletteindex);
+        end();
+        mgl11Ext.glCurrentPaletteMatrixOES(matrixpaletteindex);
+        checkError();
+    }
+
+    public void glLoadPaletteFromModelViewMatrixOES() {
+        begin("glLoadPaletteFromModelViewMatrixOES");
+        end();
+        mgl11Ext.glLoadPaletteFromModelViewMatrixOES();
+        checkError();
+    }
+
+    public void glMatrixIndexPointerOES(int size, int type, int stride,
+            Buffer pointer) {
+        begin("glMatrixIndexPointerOES");
+        argPointer(size, type, stride, pointer);
+        end();
+        mgl11Ext.glMatrixIndexPointerOES(size, type, stride, pointer);
+        checkError();
+    }
+
+    public void glMatrixIndexPointerOES(int size, int type, int stride,
+            int offset) {
+        begin("glMatrixIndexPointerOES");
+        arg("size", size);
+        arg("type", type);
+        arg("stride", stride);
+        arg("offset", offset);
+        end();
+        mgl11Ext.glMatrixIndexPointerOES(size, type, stride, offset);
+        checkError();
+    }
+
+    public void glWeightPointerOES(int size, int type, int stride,
+            Buffer pointer) {
+        begin("glWeightPointerOES");
+        argPointer(size, type, stride, pointer);
+        end();
+        mgl11Ext.glWeightPointerOES(size, type, stride, pointer);
+        checkError();
+    }
+
+    public void glWeightPointerOES(int size, int type, int stride, int offset) {
+        begin("glWeightPointerOES");
+        arg("size", size);
+        arg("type", type);
+        arg("stride", stride);
+        arg("offset", offset);
+        end();
+        mgl11Ext.glWeightPointerOES(size, type, stride, offset);
+        checkError();
+    }
+
+    @Override
+    public void glBindFramebufferOES(int target, int framebuffer) {
+        begin("glBindFramebufferOES");
+        arg("target", target);
+        arg("framebuffer", framebuffer);
+        end();
+        mgl11ExtensionPack.glBindFramebufferOES(target, framebuffer);
+        checkError();
+    }
+
+    @Override
+    public void glBindRenderbufferOES(int target, int renderbuffer) {
+        begin("glBindRenderbufferOES");
+        arg("target", target);
+        arg("renderbuffer", renderbuffer);
+        end();
+        mgl11ExtensionPack.glBindRenderbufferOES(target, renderbuffer);
+        checkError();
+    }
+
+    @Override
+    public void glBlendEquation(int mode) {
+        begin("glBlendEquation");
+        arg("mode", mode);
+        end();
+        mgl11ExtensionPack.glBlendEquation(mode);
+        checkError();
+    }
+
+    @Override
+    public void glBlendEquationSeparate(int modeRGB, int modeAlpha) {
+        begin("glBlendEquationSeparate");
+        arg("modeRGB", modeRGB);
+        arg("modeAlpha", modeAlpha);
+        end();
+        mgl11ExtensionPack.glBlendEquationSeparate(modeRGB, modeAlpha);
+        checkError();
+    }
+
+    @Override
+    public void glBlendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha,
+            int dstAlpha) {
+        begin("glBlendFuncSeparate");
+        arg("srcRGB", srcRGB);
+        arg("dstRGB", dstRGB);
+        arg("srcAlpha", srcAlpha);
+        arg("dstAlpha", dstAlpha);
+        end();
+        mgl11ExtensionPack.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
+        checkError();
+    }
+
+    @Override
+    public int glCheckFramebufferStatusOES(int target) {
+        begin("glCheckFramebufferStatusOES");
+        arg("target", target);
+        end();
+        int result = mgl11ExtensionPack.glCheckFramebufferStatusOES(target);
+        checkError();
+        return result;
+    }
+
+    @Override
+    public void glDeleteFramebuffersOES(int n, int[] framebuffers, int offset) {
+        begin("glDeleteFramebuffersOES");
+        arg("n", n);
+        arg("framebuffers", framebuffers.toString());
+        arg("offset", offset);
+        end();
+        mgl11ExtensionPack.glDeleteFramebuffersOES(n, framebuffers, offset);
+        checkError();
+    }
+
+    @Override
+    public void glDeleteFramebuffersOES(int n, IntBuffer framebuffers) {
+        begin("glDeleteFramebuffersOES");
+        arg("n", n);
+        arg("framebuffers", framebuffers.toString());
+        end();
+        mgl11ExtensionPack.glDeleteFramebuffersOES(n, framebuffers);
+        checkError();
+    }
+
+    @Override
+    public void glDeleteRenderbuffersOES(int n, int[] renderbuffers, int offset) {
+        begin("glDeleteRenderbuffersOES");
+        arg("n", n);
+        arg("renderbuffers", renderbuffers.toString());
+        arg("offset", offset);
+        end();
+        mgl11ExtensionPack.glDeleteRenderbuffersOES(n, renderbuffers, offset);
+        checkError();
+    }
+
+    @Override
+    public void glDeleteRenderbuffersOES(int n, IntBuffer renderbuffers) {
+        begin("glDeleteRenderbuffersOES");
+        arg("n", n);
+        arg("renderbuffers", renderbuffers.toString());
+        end();
+        mgl11ExtensionPack.glDeleteRenderbuffersOES(n, renderbuffers);
+        checkError();
+    }
+
+    @Override
+    public void glFramebufferRenderbufferOES(int target, int attachment,
+            int renderbuffertarget, int renderbuffer) {
+        begin("glFramebufferRenderbufferOES");
+        arg("target", target);
+        arg("attachment", attachment);
+        arg("renderbuffertarget", renderbuffertarget);
+        arg("renderbuffer", renderbuffer);
+        end();
+        mgl11ExtensionPack.glFramebufferRenderbufferOES(target, attachment, renderbuffertarget, renderbuffer);
+        checkError();
+    }
+
+    @Override
+    public void glFramebufferTexture2DOES(int target, int attachment,
+            int textarget, int texture, int level) {
+        begin("glFramebufferTexture2DOES");
+        arg("target", target);
+        arg("attachment", attachment);
+        arg("textarget", textarget);
+        arg("texture", texture);
+        arg("level", level);
+        end();
+        mgl11ExtensionPack.glFramebufferTexture2DOES(target, attachment, textarget, texture, level);
+        checkError();
+    }
+
+    @Override
+    public void glGenerateMipmapOES(int target) {
+        begin("glGenerateMipmapOES");
+        arg("target", target);
+        end();
+        mgl11ExtensionPack.glGenerateMipmapOES(target);
+        checkError();
+    }
+
+    @Override
+    public void glGenFramebuffersOES(int n, int[] framebuffers, int offset) {
+        begin("glGenFramebuffersOES");
+        arg("n", n);
+        arg("framebuffers", framebuffers.toString());
+        arg("offset", offset);
+        end();
+        mgl11ExtensionPack.glGenFramebuffersOES(n, framebuffers, offset);
+        checkError();
+    }
+
+    @Override
+    public void glGenFramebuffersOES(int n, IntBuffer framebuffers) {
+        begin("glGenFramebuffersOES");
+        arg("n", n);
+        arg("framebuffers", framebuffers.toString());
+        end();
+        mgl11ExtensionPack.glGenFramebuffersOES(n, framebuffers);
+        checkError();
+    }
+
+    @Override
+    public void glGenRenderbuffersOES(int n, int[] renderbuffers, int offset) {
+        begin("glGenRenderbuffersOES");
+        arg("n", n);
+        arg("renderbuffers", renderbuffers.toString());
+        arg("offset", offset);
+        end();
+        mgl11ExtensionPack.glGenRenderbuffersOES(n, renderbuffers, offset);
+        checkError();
+    }
+
+    @Override
+    public void glGenRenderbuffersOES(int n, IntBuffer renderbuffers) {
+        begin("glGenRenderbuffersOES");
+        arg("n", n);
+        arg("renderbuffers", renderbuffers.toString());
+        end();
+        mgl11ExtensionPack.glGenRenderbuffersOES(n, renderbuffers);
+        checkError();
+    }
+
+    @Override
+    public void glGetFramebufferAttachmentParameterivOES(int target,
+            int attachment, int pname, int[] params, int offset) {
+        begin("glGetFramebufferAttachmentParameterivOES");
+        arg("target", target);
+        arg("attachment", attachment);
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11ExtensionPack.glGetFramebufferAttachmentParameterivOES(target, attachment, pname, params, offset);
+        checkError();
+    }
+
+    @Override
+    public void glGetFramebufferAttachmentParameterivOES(int target,
+            int attachment, int pname, IntBuffer params) {
+        begin("glGetFramebufferAttachmentParameterivOES");
+        arg("target", target);
+        arg("attachment", attachment);
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11ExtensionPack.glGetFramebufferAttachmentParameterivOES(target, attachment, pname, params);
+        checkError();
+    }
+
+    @Override
+    public void glGetRenderbufferParameterivOES(int target, int pname,
+            int[] params, int offset) {
+        begin("glGetRenderbufferParameterivOES");
+        arg("target", target);
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11ExtensionPack.glGetRenderbufferParameterivOES(target, pname, params, offset);
+        checkError();
+    }
+
+    @Override
+    public void glGetRenderbufferParameterivOES(int target, int pname,
+            IntBuffer params) {
+        begin("glGetRenderbufferParameterivOES");
+        arg("target", target);
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11ExtensionPack.glGetRenderbufferParameterivOES(target, pname, params);
+        checkError();
+    }
+
+    @Override
+    public void glGetTexGenfv(int coord, int pname, float[] params, int offset) {
+        begin("glGetTexGenfv");
+        arg("coord", coord);
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11ExtensionPack.glGetTexGenfv(coord, pname, params, offset);
+        checkError();
+    }
+
+    @Override
+    public void glGetTexGenfv(int coord, int pname, FloatBuffer params) {
+        begin("glGetTexGenfv");
+        arg("coord", coord);
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11ExtensionPack.glGetTexGenfv(coord, pname, params);
+        checkError();
+    }
+
+    @Override
+    public void glGetTexGeniv(int coord, int pname, int[] params, int offset) {
+        begin("glGetTexGeniv");
+        arg("coord", coord);
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11ExtensionPack.glGetTexGeniv(coord, pname, params, offset);
+        checkError();
+    }
+
+    @Override
+    public void glGetTexGeniv(int coord, int pname, IntBuffer params) {
+        begin("glGetTexGeniv");
+        arg("coord", coord);
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11ExtensionPack.glGetTexGeniv(coord, pname, params);
+        checkError();
+    }
+
+    @Override
+    public void glGetTexGenxv(int coord, int pname, int[] params, int offset) {
+        begin("glGetTexGenxv");
+        arg("coord", coord);
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11ExtensionPack.glGetTexGenxv(coord, pname, params, offset);
+        checkError();
+    }
+
+    @Override
+    public void glGetTexGenxv(int coord, int pname, IntBuffer params) {
+        begin("glGetTexGenxv");
+        arg("coord", coord);
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11ExtensionPack.glGetTexGenxv(coord, pname, params);
+        checkError();
+    }
+
+    @Override
+    public boolean glIsFramebufferOES(int framebuffer) {
+        begin("glIsFramebufferOES");
+        arg("framebuffer", framebuffer);
+        end();
+        boolean result = mgl11ExtensionPack.glIsFramebufferOES(framebuffer);
+        checkError();
+        return result;
+    }
+
+    @Override
+    public boolean glIsRenderbufferOES(int renderbuffer) {
+        begin("glIsRenderbufferOES");
+        arg("renderbuffer", renderbuffer);
+        end();
+        mgl11ExtensionPack.glIsRenderbufferOES(renderbuffer);
+        checkError();
+        return false;
+    }
+
+    @Override
+    public void glRenderbufferStorageOES(int target, int internalformat,
+            int width, int height) {
+        begin("glRenderbufferStorageOES");
+        arg("target", target);
+        arg("internalformat", internalformat);
+        arg("width", width);
+        arg("height", height);
+        end();
+        mgl11ExtensionPack.glRenderbufferStorageOES(target, internalformat, width, height);
+        checkError();
+    }
+
+    @Override
+    public void glTexGenf(int coord, int pname, float param) {
+        begin("glTexGenf");
+        arg("coord", coord);
+        arg("pname", pname);
+        arg("param", param);
+        end();
+        mgl11ExtensionPack.glTexGenf(coord, pname, param);
+        checkError();
+    }
+
+    @Override
+    public void glTexGenfv(int coord, int pname, float[] params, int offset) {
+        begin("glTexGenfv");
+        arg("coord", coord);
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11ExtensionPack.glTexGenfv(coord, pname, params, offset);
+        checkError();
+    }
+
+    @Override
+    public void glTexGenfv(int coord, int pname, FloatBuffer params) {
+        begin("glTexGenfv");
+        arg("coord", coord);
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11ExtensionPack.glTexGenfv(coord, pname, params);
+        checkError();
+    }
+
+    @Override
+    public void glTexGeni(int coord, int pname, int param) {
+        begin("glTexGeni");
+        arg("coord", coord);
+        arg("pname", pname);
+        arg("param", param);
+        end();
+        mgl11ExtensionPack.glTexGeni(coord, pname, param);
+        checkError();
+    }
+
+    @Override
+    public void glTexGeniv(int coord, int pname, int[] params, int offset) {
+        begin("glTexGeniv");
+        arg("coord", coord);
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11ExtensionPack.glTexGeniv(coord, pname, params, offset);
+        checkError();
+    }
+
+    @Override
+    public void glTexGeniv(int coord, int pname, IntBuffer params) {
+        begin("glTexGeniv");
+        arg("coord", coord);
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11ExtensionPack.glTexGeniv(coord, pname, params);
+        checkError();
+    }
+
+    @Override
+    public void glTexGenx(int coord, int pname, int param) {
+        begin("glTexGenx");
+        arg("coord", coord);
+        arg("pname", pname);
+        arg("param", param);
+        end();
+        mgl11ExtensionPack.glTexGenx(coord, pname, param);
+        checkError();
+    }
+
+    @Override
+    public void glTexGenxv(int coord, int pname, int[] params, int offset) {
+        begin("glTexGenxv");
+        arg("coord", coord);
+        arg("pname", pname);
+        arg("params", params.toString());
+        arg("offset", offset);
+        end();
+        mgl11ExtensionPack.glTexGenxv(coord, pname, params, offset);
+        checkError();
+    }
+
+    @Override
+    public void glTexGenxv(int coord, int pname, IntBuffer params) {
+        begin("glTexGenxv");
+        arg("coord", coord);
+        arg("pname", pname);
+        arg("params", params.toString());
+        end();
+        mgl11ExtensionPack.glTexGenxv(coord, pname, params);
+        checkError();
+    }
+
+    private class PointerInfo {
+        /**
+         * The number of coordinates per vertex. 1..4
+         */
+        public int mSize;
+        /**
+         * The type of each coordinate.
+         */
+        public int mType;
+        /**
+         * The byte offset between consecutive vertices. 0 means mSize *
+         * sizeof(mType)
+         */
+        public int mStride;
+        public Buffer mPointer;
+        public ByteBuffer mTempByteBuffer; // Only valid during glDrawXXX calls
+
+        public PointerInfo() {
+        }
+
+        public PointerInfo(int size, int type, int stride, Buffer pointer) {
+            mSize = size;
+            mType = type;
+            mStride = stride;
+            mPointer = pointer;
+        }
+
+        public int sizeof(int type) {
+            switch (type) {
+            case GL_UNSIGNED_BYTE:
+                return 1;
+            case GL_BYTE:
+                return 1;
+            case GL_SHORT:
+                return 2;
+            case GL_FIXED:
+                return 4;
+            case GL_FLOAT:
+                return 4;
+            default:
+                return 0;
+            }
+        }
+
+        public int getStride() {
+            return mStride > 0 ? mStride : sizeof(mType) * mSize;
+        }
+
+        public void bindByteBuffer() {
+            mTempByteBuffer = mPointer == null ? null : toByteBuffer(-1, mPointer);
+        }
+
+        public void unbindByteBuffer() {
+            mTempByteBuffer = null;
+        }
+    }
+
+    private Writer mLog;
+    private boolean mLogArgumentNames;
+    private int mArgCount;
+
+    private PointerInfo mColorPointer = new PointerInfo();
+    private PointerInfo mNormalPointer = new PointerInfo();
+    private PointerInfo mTexCoordPointer = new PointerInfo();
+    private PointerInfo mVertexPointer = new PointerInfo();
+
+    boolean mColorArrayEnabled;
+    boolean mNormalArrayEnabled;
+    boolean mTextureCoordArrayEnabled;
+    boolean mVertexArrayEnabled;
+
+    StringBuilder mStringBuilder;
+}
diff --git a/android/opengl/GLSurfaceView.java b/android/opengl/GLSurfaceView.java
new file mode 100644
index 0000000..75131b0
--- /dev/null
+++ b/android/opengl/GLSurfaceView.java
@@ -0,0 +1,1937 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.opengl;
+
+import android.compat.annotation.UnsupportedAppUsage;
+import android.content.Context;
+import android.os.Trace;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+
+import java.io.Writer;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+
+import javax.microedition.khronos.egl.EGL10;
+import javax.microedition.khronos.egl.EGL11;
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.egl.EGLContext;
+import javax.microedition.khronos.egl.EGLDisplay;
+import javax.microedition.khronos.egl.EGLSurface;
+import javax.microedition.khronos.opengles.GL;
+import javax.microedition.khronos.opengles.GL10;
+
+/**
+ * An implementation of SurfaceView that uses the dedicated surface for
+ * displaying OpenGL rendering.
+ * <p>
+ * A GLSurfaceView provides the following features:
+ * <p>
+ * <ul>
+ * <li>Manages a surface, which is a special piece of memory that can be
+ * composited into the Android view system.
+ * <li>Manages an EGL display, which enables OpenGL to render into a surface.
+ * <li>Accepts a user-provided Renderer object that does the actual rendering.
+ * <li>Renders on a dedicated thread to decouple rendering performance from the
+ * UI thread.
+ * <li>Supports both on-demand and continuous rendering.
+ * <li>Optionally wraps, traces, and/or error-checks the renderer's OpenGL calls.
+ * </ul>
+ *
+ * <div class="special reference">
+ * <h3>Developer Guides</h3>
+ * <p>For more information about how to use OpenGL, read the
+ * <a href="{@docRoot}guide/topics/graphics/opengl.html">OpenGL</a> developer guide.</p>
+ * </div>
+ *
+ * <h3>Using GLSurfaceView</h3>
+ * <p>
+ * Typically you use GLSurfaceView by subclassing it and overriding one or more of the
+ * View system input event methods. If your application does not need to override event
+ * methods then GLSurfaceView can be used as-is. For the most part
+ * GLSurfaceView behavior is customized by calling "set" methods rather than by subclassing.
+ * For example, unlike a regular View, drawing is delegated to a separate Renderer object which
+ * is registered with the GLSurfaceView
+ * using the {@link #setRenderer(Renderer)} call.
+ * <p>
+ * <h3>Initializing GLSurfaceView</h3>
+ * All you have to do to initialize a GLSurfaceView is call {@link #setRenderer(Renderer)}.
+ * However, if desired, you can modify the default behavior of GLSurfaceView by calling one or
+ * more of these methods before calling setRenderer:
+ * <ul>
+ * <li>{@link #setDebugFlags(int)}
+ * <li>{@link #setEGLConfigChooser(boolean)}
+ * <li>{@link #setEGLConfigChooser(EGLConfigChooser)}
+ * <li>{@link #setEGLConfigChooser(int, int, int, int, int, int)}
+ * <li>{@link #setGLWrapper(GLWrapper)}
+ * </ul>
+ * <p>
+ * <h4>Specifying the android.view.Surface</h4>
+ * By default GLSurfaceView will create a PixelFormat.RGB_888 format surface. If a translucent
+ * surface is required, call getHolder().setFormat(PixelFormat.TRANSLUCENT).
+ * The exact format of a TRANSLUCENT surface is device dependent, but it will be
+ * a 32-bit-per-pixel surface with 8 bits per component.
+ * <p>
+ * <h4>Choosing an EGL Configuration</h4>
+ * A given Android device may support multiple EGLConfig rendering configurations.
+ * The available configurations may differ in how many channels of data are present, as
+ * well as how many bits are allocated to each channel. Therefore, the first thing
+ * GLSurfaceView has to do when starting to render is choose what EGLConfig to use.
+ * <p>
+ * By default GLSurfaceView chooses a EGLConfig that has an RGB_888 pixel format,
+ * with at least a 16-bit depth buffer and no stencil.
+ * <p>
+ * If you would prefer a different EGLConfig
+ * you can override the default behavior by calling one of the
+ * setEGLConfigChooser methods.
+ * <p>
+ * <h4>Debug Behavior</h4>
+ * You can optionally modify the behavior of GLSurfaceView by calling
+ * one or more of the debugging methods {@link #setDebugFlags(int)},
+ * and {@link #setGLWrapper}. These methods may be called before and/or after setRenderer, but
+ * typically they are called before setRenderer so that they take effect immediately.
+ * <p>
+ * <h4>Setting a Renderer</h4>
+ * Finally, you must call {@link #setRenderer} to register a {@link Renderer}.
+ * The renderer is
+ * responsible for doing the actual OpenGL rendering.
+ * <p>
+ * <h3>Rendering Mode</h3>
+ * Once the renderer is set, you can control whether the renderer draws
+ * continuously or on-demand by calling
+ * {@link #setRenderMode}. The default is continuous rendering.
+ * <p>
+ * <h3>Activity Life-cycle</h3>
+ * A GLSurfaceView must be notified when to pause and resume rendering. GLSurfaceView clients
+ * are required to call {@link #onPause()} when the activity stops and
+ * {@link #onResume()} when the activity starts. These calls allow GLSurfaceView to
+ * pause and resume the rendering thread, and also allow GLSurfaceView to release and recreate
+ * the OpenGL display.
+ * <p>
+ * <h3>Handling events</h3>
+ * <p>
+ * To handle an event you will typically subclass GLSurfaceView and override the
+ * appropriate method, just as you would with any other View. However, when handling
+ * the event, you may need to communicate with the Renderer object
+ * that's running in the rendering thread. You can do this using any
+ * standard Java cross-thread communication mechanism. In addition,
+ * one relatively easy way to communicate with your renderer is
+ * to call
+ * {@link #queueEvent(Runnable)}. For example:
+ * <pre class="prettyprint">
+ * class MyGLSurfaceView extends GLSurfaceView {
+ *
+ *     private MyRenderer mMyRenderer;
+ *
+ *     public void start() {
+ *         mMyRenderer = ...;
+ *         setRenderer(mMyRenderer);
+ *     }
+ *
+ *     public boolean onKeyDown(int keyCode, KeyEvent event) {
+ *         if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
+ *             queueEvent(new Runnable() {
+ *                 // This method will be called on the rendering
+ *                 // thread:
+ *                 public void run() {
+ *                     mMyRenderer.handleDpadCenter();
+ *                 }});
+ *             return true;
+ *         }
+ *         return super.onKeyDown(keyCode, event);
+ *     }
+ * }
+ * </pre>
+ *
+ */
+public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback2 {
+    private final static String TAG = "GLSurfaceView";
+    private final static boolean LOG_ATTACH_DETACH = false;
+    private final static boolean LOG_THREADS = false;
+    private final static boolean LOG_PAUSE_RESUME = false;
+    private final static boolean LOG_SURFACE = false;
+    private final static boolean LOG_RENDERER = false;
+    private final static boolean LOG_RENDERER_DRAW_FRAME = false;
+    private final static boolean LOG_EGL = false;
+    /**
+     * The renderer only renders
+     * when the surface is created, or when {@link #requestRender} is called.
+     *
+     * @see #getRenderMode()
+     * @see #setRenderMode(int)
+     * @see #requestRender()
+     */
+    public final static int RENDERMODE_WHEN_DIRTY = 0;
+    /**
+     * The renderer is called
+     * continuously to re-render the scene.
+     *
+     * @see #getRenderMode()
+     * @see #setRenderMode(int)
+     */
+    public final static int RENDERMODE_CONTINUOUSLY = 1;
+
+    /**
+     * Check glError() after every GL call and throw an exception if glError indicates
+     * that an error has occurred. This can be used to help track down which OpenGL ES call
+     * is causing an error.
+     *
+     * @see #getDebugFlags
+     * @see #setDebugFlags
+     */
+    public final static int DEBUG_CHECK_GL_ERROR = 1;
+
+    /**
+     * Log GL calls to the system log at "verbose" level with tag "GLSurfaceView".
+     *
+     * @see #getDebugFlags
+     * @see #setDebugFlags
+     */
+    public final static int DEBUG_LOG_GL_CALLS = 2;
+
+    /**
+     * Standard View constructor. In order to render something, you
+     * must call {@link #setRenderer} to register a renderer.
+     */
+    public GLSurfaceView(Context context) {
+        super(context);
+        init();
+    }
+
+    /**
+     * Standard View constructor. In order to render something, you
+     * must call {@link #setRenderer} to register a renderer.
+     */
+    public GLSurfaceView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        init();
+    }
+
+    @Override
+    protected void finalize() throws Throwable {
+        try {
+            if (mGLThread != null) {
+                // GLThread may still be running if this view was never
+                // attached to a window.
+                mGLThread.requestExitAndWait();
+            }
+        } finally {
+            super.finalize();
+        }
+    }
+
+    private void init() {
+        // Install a SurfaceHolder.Callback so we get notified when the
+        // underlying surface is created and destroyed
+        SurfaceHolder holder = getHolder();
+        holder.addCallback(this);
+        // setFormat is done by SurfaceView in SDK 2.3 and newer. Uncomment
+        // this statement if back-porting to 2.2 or older:
+        // holder.setFormat(PixelFormat.RGB_565);
+        //
+        // setType is not needed for SDK 2.0 or newer. Uncomment this
+        // statement if back-porting this code to older SDKs.
+        // holder.setType(SurfaceHolder.SURFACE_TYPE_GPU);
+    }
+
+    /**
+     * Set the glWrapper. If the glWrapper is not null, its
+     * {@link GLWrapper#wrap(GL)} method is called
+     * whenever a surface is created. A GLWrapper can be used to wrap
+     * the GL object that's passed to the renderer. Wrapping a GL
+     * object enables examining and modifying the behavior of the
+     * GL calls made by the renderer.
+     * <p>
+     * Wrapping is typically used for debugging purposes.
+     * <p>
+     * The default value is null.
+     * @param glWrapper the new GLWrapper
+     */
+    public void setGLWrapper(GLWrapper glWrapper) {
+        mGLWrapper = glWrapper;
+    }
+
+    /**
+     * Set the debug flags to a new value. The value is
+     * constructed by OR-together zero or more
+     * of the DEBUG_CHECK_* constants. The debug flags take effect
+     * whenever a surface is created. The default value is zero.
+     * @param debugFlags the new debug flags
+     * @see #DEBUG_CHECK_GL_ERROR
+     * @see #DEBUG_LOG_GL_CALLS
+     */
+    public void setDebugFlags(int debugFlags) {
+        mDebugFlags = debugFlags;
+    }
+
+    /**
+     * Get the current value of the debug flags.
+     * @return the current value of the debug flags.
+     */
+    public int getDebugFlags() {
+        return mDebugFlags;
+    }
+
+    /**
+     * Control whether the EGL context is preserved when the GLSurfaceView is paused and
+     * resumed.
+     * <p>
+     * If set to true, then the EGL context may be preserved when the GLSurfaceView is paused.
+     * <p>
+     * Prior to API level 11, whether the EGL context is actually preserved or not
+     * depends upon whether the Android device can support an arbitrary number of
+     * EGL contexts or not. Devices that can only support a limited number of EGL
+     * contexts must release the EGL context in order to allow multiple applications
+     * to share the GPU.
+     * <p>
+     * If set to false, the EGL context will be released when the GLSurfaceView is paused,
+     * and recreated when the GLSurfaceView is resumed.
+     * <p>
+     *
+     * The default is false.
+     *
+     * @param preserveOnPause preserve the EGL context when paused
+     */
+    public void setPreserveEGLContextOnPause(boolean preserveOnPause) {
+        mPreserveEGLContextOnPause = preserveOnPause;
+    }
+
+    /**
+     * @return true if the EGL context will be preserved when paused
+     */
+    public boolean getPreserveEGLContextOnPause() {
+        return mPreserveEGLContextOnPause;
+    }
+
+    /**
+     * Set the renderer associated with this view. Also starts the thread that
+     * will call the renderer, which in turn causes the rendering to start.
+     * <p>This method should be called once and only once in the life-cycle of
+     * a GLSurfaceView.
+     * <p>The following GLSurfaceView methods can only be called <em>before</em>
+     * setRenderer is called:
+     * <ul>
+     * <li>{@link #setEGLConfigChooser(boolean)}
+     * <li>{@link #setEGLConfigChooser(EGLConfigChooser)}
+     * <li>{@link #setEGLConfigChooser(int, int, int, int, int, int)}
+     * </ul>
+     * <p>
+     * The following GLSurfaceView methods can only be called <em>after</em>
+     * setRenderer is called:
+     * <ul>
+     * <li>{@link #getRenderMode()}
+     * <li>{@link #onPause()}
+     * <li>{@link #onResume()}
+     * <li>{@link #queueEvent(Runnable)}
+     * <li>{@link #requestRender()}
+     * <li>{@link #setRenderMode(int)}
+     * </ul>
+     *
+     * @param renderer the renderer to use to perform OpenGL drawing.
+     */
+    public void setRenderer(Renderer renderer) {
+        checkRenderThreadState();
+        if (mEGLConfigChooser == null) {
+            mEGLConfigChooser = new SimpleEGLConfigChooser(true);
+        }
+        if (mEGLContextFactory == null) {
+            mEGLContextFactory = new DefaultContextFactory();
+        }
+        if (mEGLWindowSurfaceFactory == null) {
+            mEGLWindowSurfaceFactory = new DefaultWindowSurfaceFactory();
+        }
+        mRenderer = renderer;
+        mGLThread = new GLThread(mThisWeakRef);
+        mGLThread.start();
+    }
+
+    /**
+     * Install a custom EGLContextFactory.
+     * <p>If this method is
+     * called, it must be called before {@link #setRenderer(Renderer)}
+     * is called.
+     * <p>
+     * If this method is not called, then by default
+     * a context will be created with no shared context and
+     * with a null attribute list.
+     */
+    public void setEGLContextFactory(EGLContextFactory factory) {
+        checkRenderThreadState();
+        mEGLContextFactory = factory;
+    }
+
+    /**
+     * Install a custom EGLWindowSurfaceFactory.
+     * <p>If this method is
+     * called, it must be called before {@link #setRenderer(Renderer)}
+     * is called.
+     * <p>
+     * If this method is not called, then by default
+     * a window surface will be created with a null attribute list.
+     */
+    public void setEGLWindowSurfaceFactory(EGLWindowSurfaceFactory factory) {
+        checkRenderThreadState();
+        mEGLWindowSurfaceFactory = factory;
+    }
+
+    /**
+     * Install a custom EGLConfigChooser.
+     * <p>If this method is
+     * called, it must be called before {@link #setRenderer(Renderer)}
+     * is called.
+     * <p>
+     * If no setEGLConfigChooser method is called, then by default the
+     * view will choose an EGLConfig that is compatible with the current
+     * android.view.Surface, with a depth buffer depth of
+     * at least 16 bits.
+     * @param configChooser
+     */
+    public void setEGLConfigChooser(EGLConfigChooser configChooser) {
+        checkRenderThreadState();
+        mEGLConfigChooser = configChooser;
+    }
+
+    /**
+     * Install a config chooser which will choose a config
+     * as close to 16-bit RGB as possible, with or without an optional depth
+     * buffer as close to 16-bits as possible.
+     * <p>If this method is
+     * called, it must be called before {@link #setRenderer(Renderer)}
+     * is called.
+     * <p>
+     * If no setEGLConfigChooser method is called, then by default the
+     * view will choose an RGB_888 surface with a depth buffer depth of
+     * at least 16 bits.
+     *
+     * @param needDepth
+     */
+    public void setEGLConfigChooser(boolean needDepth) {
+        setEGLConfigChooser(new SimpleEGLConfigChooser(needDepth));
+    }
+
+    /**
+     * Install a config chooser which will choose a config
+     * with at least the specified depthSize and stencilSize,
+     * and exactly the specified redSize, greenSize, blueSize and alphaSize.
+     * <p>If this method is
+     * called, it must be called before {@link #setRenderer(Renderer)}
+     * is called.
+     * <p>
+     * If no setEGLConfigChooser method is called, then by default the
+     * view will choose an RGB_888 surface with a depth buffer depth of
+     * at least 16 bits.
+     *
+     */
+    public void setEGLConfigChooser(int redSize, int greenSize, int blueSize,
+            int alphaSize, int depthSize, int stencilSize) {
+        setEGLConfigChooser(new ComponentSizeChooser(redSize, greenSize,
+                blueSize, alphaSize, depthSize, stencilSize));
+    }
+
+    /**
+     * Inform the default EGLContextFactory and default EGLConfigChooser
+     * which EGLContext client version to pick.
+     * <p>Use this method to create an OpenGL ES 2.0-compatible context.
+     * Example:
+     * <pre class="prettyprint">
+     *     public MyView(Context context) {
+     *         super(context);
+     *         setEGLContextClientVersion(2); // Pick an OpenGL ES 2.0 context.
+     *         setRenderer(new MyRenderer());
+     *     }
+     * </pre>
+     * <p>Note: Activities which require OpenGL ES 2.0 should indicate this by
+     * setting @lt;uses-feature android:glEsVersion="0x00020000" /> in the activity's
+     * AndroidManifest.xml file.
+     * <p>If this method is called, it must be called before {@link #setRenderer(Renderer)}
+     * is called.
+     * <p>This method only affects the behavior of the default EGLContexFactory and the
+     * default EGLConfigChooser. If
+     * {@link #setEGLContextFactory(EGLContextFactory)} has been called, then the supplied
+     * EGLContextFactory is responsible for creating an OpenGL ES 2.0-compatible context.
+     * If
+     * {@link #setEGLConfigChooser(EGLConfigChooser)} has been called, then the supplied
+     * EGLConfigChooser is responsible for choosing an OpenGL ES 2.0-compatible config.
+     * @param version The EGLContext client version to choose. Use 2 for OpenGL ES 2.0
+     */
+    public void setEGLContextClientVersion(int version) {
+        checkRenderThreadState();
+        mEGLContextClientVersion = version;
+    }
+
+    /**
+     * Set the rendering mode. When renderMode is
+     * RENDERMODE_CONTINUOUSLY, the renderer is called
+     * repeatedly to re-render the scene. When renderMode
+     * is RENDERMODE_WHEN_DIRTY, the renderer only rendered when the surface
+     * is created, or when {@link #requestRender} is called. Defaults to RENDERMODE_CONTINUOUSLY.
+     * <p>
+     * Using RENDERMODE_WHEN_DIRTY can improve battery life and overall system performance
+     * by allowing the GPU and CPU to idle when the view does not need to be updated.
+     * <p>
+     * This method can only be called after {@link #setRenderer(Renderer)}
+     *
+     * @param renderMode one of the RENDERMODE_X constants
+     * @see #RENDERMODE_CONTINUOUSLY
+     * @see #RENDERMODE_WHEN_DIRTY
+     */
+    public void setRenderMode(int renderMode) {
+        mGLThread.setRenderMode(renderMode);
+    }
+
+    /**
+     * Get the current rendering mode. May be called
+     * from any thread. Must not be called before a renderer has been set.
+     * @return the current rendering mode.
+     * @see #RENDERMODE_CONTINUOUSLY
+     * @see #RENDERMODE_WHEN_DIRTY
+     */
+    public int getRenderMode() {
+        return mGLThread.getRenderMode();
+    }
+
+    /**
+     * Request that the renderer render a frame.
+     * This method is typically used when the render mode has been set to
+     * {@link #RENDERMODE_WHEN_DIRTY}, so that frames are only rendered on demand.
+     * May be called
+     * from any thread. Must not be called before a renderer has been set.
+     */
+    public void requestRender() {
+        mGLThread.requestRender();
+    }
+
+    /**
+     * This method is part of the SurfaceHolder.Callback interface, and is
+     * not normally called or subclassed by clients of GLSurfaceView.
+     */
+    public void surfaceCreated(SurfaceHolder holder) {
+        mGLThread.surfaceCreated();
+    }
+
+    /**
+     * This method is part of the SurfaceHolder.Callback interface, and is
+     * not normally called or subclassed by clients of GLSurfaceView.
+     */
+    public void surfaceDestroyed(SurfaceHolder holder) {
+        // Surface will be destroyed when we return
+        mGLThread.surfaceDestroyed();
+    }
+
+    /**
+     * This method is part of the SurfaceHolder.Callback interface, and is
+     * not normally called or subclassed by clients of GLSurfaceView.
+     */
+    public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
+        mGLThread.onWindowResize(w, h);
+    }
+
+    /**
+     * This method is part of the SurfaceHolder.Callback2 interface, and is
+     * not normally called or subclassed by clients of GLSurfaceView.
+     */
+    @Override
+    public void surfaceRedrawNeededAsync(SurfaceHolder holder, Runnable finishDrawing) {
+        if (mGLThread != null) {
+            mGLThread.requestRenderAndNotify(finishDrawing);
+        }
+    }
+
+    /**
+     * This method is part of the SurfaceHolder.Callback2 interface, and is
+     * not normally called or subclassed by clients of GLSurfaceView.
+     */
+    @Deprecated
+    @Override
+    public void surfaceRedrawNeeded(SurfaceHolder holder) {
+        // Since we are part of the framework we know only surfaceRedrawNeededAsync
+        // will be called.
+    }
+
+
+    /**
+     * Pause the rendering thread, optionally tearing down the EGL context
+     * depending upon the value of {@link #setPreserveEGLContextOnPause(boolean)}.
+     *
+     * This method should be called when it is no longer desirable for the
+     * GLSurfaceView to continue rendering, such as in response to
+     * {@link android.app.Activity#onStop Activity.onStop}.
+     *
+     * Must not be called before a renderer has been set.
+     */
+    public void onPause() {
+        mGLThread.onPause();
+    }
+
+    /**
+     * Resumes the rendering thread, re-creating the OpenGL context if necessary. It
+     * is the counterpart to {@link #onPause()}.
+     *
+     * This method should typically be called in
+     * {@link android.app.Activity#onStart Activity.onStart}.
+     *
+     * Must not be called before a renderer has been set.
+     */
+    public void onResume() {
+        mGLThread.onResume();
+    }
+
+    /**
+     * Queue a runnable to be run on the GL rendering thread. This can be used
+     * to communicate with the Renderer on the rendering thread.
+     * Must not be called before a renderer has been set.
+     * @param r the runnable to be run on the GL rendering thread.
+     */
+    public void queueEvent(Runnable r) {
+        mGLThread.queueEvent(r);
+    }
+
+    /**
+     * This method is used as part of the View class and is not normally
+     * called or subclassed by clients of GLSurfaceView.
+     */
+    @Override
+    protected void onAttachedToWindow() {
+        super.onAttachedToWindow();
+        if (LOG_ATTACH_DETACH) {
+            Log.d(TAG, "onAttachedToWindow reattach =" + mDetached);
+        }
+        if (mDetached && (mRenderer != null)) {
+            int renderMode = RENDERMODE_CONTINUOUSLY;
+            if (mGLThread != null) {
+                renderMode = mGLThread.getRenderMode();
+            }
+            mGLThread = new GLThread(mThisWeakRef);
+            if (renderMode != RENDERMODE_CONTINUOUSLY) {
+                mGLThread.setRenderMode(renderMode);
+            }
+            mGLThread.start();
+        }
+        mDetached = false;
+    }
+
+    @Override
+    protected void onDetachedFromWindow() {
+        if (LOG_ATTACH_DETACH) {
+            Log.d(TAG, "onDetachedFromWindow");
+        }
+        if (mGLThread != null) {
+            mGLThread.requestExitAndWait();
+        }
+        mDetached = true;
+        super.onDetachedFromWindow();
+    }
+
+    // ----------------------------------------------------------------------
+
+    /**
+     * An interface used to wrap a GL interface.
+     * <p>Typically
+     * used for implementing debugging and tracing on top of the default
+     * GL interface. You would typically use this by creating your own class
+     * that implemented all the GL methods by delegating to another GL instance.
+     * Then you could add your own behavior before or after calling the
+     * delegate. All the GLWrapper would do was instantiate and return the
+     * wrapper GL instance:
+     * <pre class="prettyprint">
+     * class MyGLWrapper implements GLWrapper {
+     *     GL wrap(GL gl) {
+     *         return new MyGLImplementation(gl);
+     *     }
+     *     static class MyGLImplementation implements GL,GL10,GL11,... {
+     *         ...
+     *     }
+     * }
+     * </pre>
+     * @see #setGLWrapper(GLWrapper)
+     */
+    public interface GLWrapper {
+        /**
+         * Wraps a gl interface in another gl interface.
+         * @param gl a GL interface that is to be wrapped.
+         * @return either the input argument or another GL object that wraps the input argument.
+         */
+        GL wrap(GL gl);
+    }
+
+    /**
+     * A generic renderer interface.
+     * <p>
+     * The renderer is responsible for making OpenGL calls to render a frame.
+     * <p>
+     * GLSurfaceView clients typically create their own classes that implement
+     * this interface, and then call {@link GLSurfaceView#setRenderer} to
+     * register the renderer with the GLSurfaceView.
+     * <p>
+     *
+     * <div class="special reference">
+     * <h3>Developer Guides</h3>
+     * <p>For more information about how to use OpenGL, read the
+     * <a href="{@docRoot}guide/topics/graphics/opengl.html">OpenGL</a> developer guide.</p>
+     * </div>
+     *
+     * <h3>Threading</h3>
+     * The renderer will be called on a separate thread, so that rendering
+     * performance is decoupled from the UI thread. Clients typically need to
+     * communicate with the renderer from the UI thread, because that's where
+     * input events are received. Clients can communicate using any of the
+     * standard Java techniques for cross-thread communication, or they can
+     * use the {@link GLSurfaceView#queueEvent(Runnable)} convenience method.
+     * <p>
+     * <h3>EGL Context Lost</h3>
+     * There are situations where the EGL rendering context will be lost. This
+     * typically happens when device wakes up after going to sleep. When
+     * the EGL context is lost, all OpenGL resources (such as textures) that are
+     * associated with that context will be automatically deleted. In order to
+     * keep rendering correctly, a renderer must recreate any lost resources
+     * that it still needs. The {@link #onSurfaceCreated(GL10, EGLConfig)} method
+     * is a convenient place to do this.
+     *
+     *
+     * @see #setRenderer(Renderer)
+     */
+    public interface Renderer {
+        /**
+         * Called when the surface is created or recreated.
+         * <p>
+         * Called when the rendering thread
+         * starts and whenever the EGL context is lost. The EGL context will typically
+         * be lost when the Android device awakes after going to sleep.
+         * <p>
+         * Since this method is called at the beginning of rendering, as well as
+         * every time the EGL context is lost, this method is a convenient place to put
+         * code to create resources that need to be created when the rendering
+         * starts, and that need to be recreated when the EGL context is lost.
+         * Textures are an example of a resource that you might want to create
+         * here.
+         * <p>
+         * Note that when the EGL context is lost, all OpenGL resources associated
+         * with that context will be automatically deleted. You do not need to call
+         * the corresponding "glDelete" methods such as glDeleteTextures to
+         * manually delete these lost resources.
+         * <p>
+         * @param gl the GL interface. Use <code>instanceof</code> to
+         * test if the interface supports GL11 or higher interfaces.
+         * @param config the EGLConfig of the created surface. Can be used
+         * to create matching pbuffers.
+         */
+        void onSurfaceCreated(GL10 gl, EGLConfig config);
+
+        /**
+         * Called when the surface changed size.
+         * <p>
+         * Called after the surface is created and whenever
+         * the OpenGL ES surface size changes.
+         * <p>
+         * Typically you will set your viewport here. If your camera
+         * is fixed then you could also set your projection matrix here:
+         * <pre class="prettyprint">
+         * void onSurfaceChanged(GL10 gl, int width, int height) {
+         *     gl.glViewport(0, 0, width, height);
+         *     // for a fixed camera, set the projection too
+         *     float ratio = (float) width / height;
+         *     gl.glMatrixMode(GL10.GL_PROJECTION);
+         *     gl.glLoadIdentity();
+         *     gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10);
+         * }
+         * </pre>
+         * @param gl the GL interface. Use <code>instanceof</code> to
+         * test if the interface supports GL11 or higher interfaces.
+         * @param width
+         * @param height
+         */
+        void onSurfaceChanged(GL10 gl, int width, int height);
+
+        /**
+         * Called to draw the current frame.
+         * <p>
+         * This method is responsible for drawing the current frame.
+         * <p>
+         * The implementation of this method typically looks like this:
+         * <pre class="prettyprint">
+         * void onDrawFrame(GL10 gl) {
+         *     gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
+         *     //... other gl calls to render the scene ...
+         * }
+         * </pre>
+         * @param gl the GL interface. Use <code>instanceof</code> to
+         * test if the interface supports GL11 or higher interfaces.
+         */
+        void onDrawFrame(GL10 gl);
+    }
+
+    /**
+     * An interface for customizing the eglCreateContext and eglDestroyContext calls.
+     * <p>
+     * This interface must be implemented by clients wishing to call
+     * {@link GLSurfaceView#setEGLContextFactory(EGLContextFactory)}
+     */
+    public interface EGLContextFactory {
+        EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig);
+        void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context);
+    }
+
+    private class DefaultContextFactory implements EGLContextFactory {
+        private int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
+
+        public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig config) {
+            int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, mEGLContextClientVersion,
+                    EGL10.EGL_NONE };
+
+            return egl.eglCreateContext(display, config, EGL10.EGL_NO_CONTEXT,
+                    mEGLContextClientVersion != 0 ? attrib_list : null);
+        }
+
+        public void destroyContext(EGL10 egl, EGLDisplay display,
+                EGLContext context) {
+            if (!egl.eglDestroyContext(display, context)) {
+                Log.e("DefaultContextFactory", "display:" + display + " context: " + context);
+                if (LOG_THREADS) {
+                    Log.i("DefaultContextFactory", "tid=" + Thread.currentThread().getId());
+                }
+                EglHelper.throwEglException("eglDestroyContex", egl.eglGetError());
+            }
+        }
+    }
+
+    /**
+     * An interface for customizing the eglCreateWindowSurface and eglDestroySurface calls.
+     * <p>
+     * This interface must be implemented by clients wishing to call
+     * {@link GLSurfaceView#setEGLWindowSurfaceFactory(EGLWindowSurfaceFactory)}
+     */
+    public interface EGLWindowSurfaceFactory {
+        /**
+         *  @return null if the surface cannot be constructed.
+         */
+        EGLSurface createWindowSurface(EGL10 egl, EGLDisplay display, EGLConfig config,
+                Object nativeWindow);
+        void destroySurface(EGL10 egl, EGLDisplay display, EGLSurface surface);
+    }
+
+    private static class DefaultWindowSurfaceFactory implements EGLWindowSurfaceFactory {
+
+        public EGLSurface createWindowSurface(EGL10 egl, EGLDisplay display,
+                EGLConfig config, Object nativeWindow) {
+            EGLSurface result = null;
+            try {
+                result = egl.eglCreateWindowSurface(display, config, nativeWindow, null);
+            } catch (IllegalArgumentException e) {
+                // This exception indicates that the surface flinger surface
+                // is not valid. This can happen if the surface flinger surface has
+                // been torn down, but the application has not yet been
+                // notified via SurfaceHolder.Callback.surfaceDestroyed.
+                // In theory the application should be notified first,
+                // but in practice sometimes it is not. See b/4588890
+                Log.e(TAG, "eglCreateWindowSurface", e);
+            }
+            return result;
+        }
+
+        public void destroySurface(EGL10 egl, EGLDisplay display,
+                EGLSurface surface) {
+            egl.eglDestroySurface(display, surface);
+        }
+    }
+
+    /**
+     * An interface for choosing an EGLConfig configuration from a list of
+     * potential configurations.
+     * <p>
+     * This interface must be implemented by clients wishing to call
+     * {@link GLSurfaceView#setEGLConfigChooser(EGLConfigChooser)}
+     */
+    public interface EGLConfigChooser {
+        /**
+         * Choose a configuration from the list. Implementors typically
+         * implement this method by calling
+         * {@link EGL10#eglChooseConfig} and iterating through the results. Please consult the
+         * EGL specification available from The Khronos Group to learn how to call eglChooseConfig.
+         * @param egl the EGL10 for the current display.
+         * @param display the current display.
+         * @return the chosen configuration.
+         */
+        EGLConfig chooseConfig(EGL10 egl, EGLDisplay display);
+    }
+
+    private abstract class BaseConfigChooser
+            implements EGLConfigChooser {
+        public BaseConfigChooser(int[] configSpec) {
+            mConfigSpec = filterConfigSpec(configSpec);
+        }
+
+        public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
+            int[] num_config = new int[1];
+            if (!egl.eglChooseConfig(display, mConfigSpec, null, 0,
+                    num_config)) {
+                throw new IllegalArgumentException("eglChooseConfig failed");
+            }
+
+            int numConfigs = num_config[0];
+
+            if (numConfigs <= 0) {
+                throw new IllegalArgumentException(
+                        "No configs match configSpec");
+            }
+
+            EGLConfig[] configs = new EGLConfig[numConfigs];
+            if (!egl.eglChooseConfig(display, mConfigSpec, configs, numConfigs,
+                    num_config)) {
+                throw new IllegalArgumentException("eglChooseConfig#2 failed");
+            }
+            EGLConfig config = chooseConfig(egl, display, configs);
+            if (config == null) {
+                throw new IllegalArgumentException("No config chosen");
+            }
+            return config;
+        }
+
+        abstract EGLConfig chooseConfig(EGL10 egl, EGLDisplay display,
+                EGLConfig[] configs);
+
+        protected int[] mConfigSpec;
+
+        private int[] filterConfigSpec(int[] configSpec) {
+            if (mEGLContextClientVersion != 2 && mEGLContextClientVersion != 3) {
+                return configSpec;
+            }
+            /* We know none of the subclasses define EGL_RENDERABLE_TYPE.
+             * And we know the configSpec is well formed.
+             */
+            int len = configSpec.length;
+            int[] newConfigSpec = new int[len + 2];
+            System.arraycopy(configSpec, 0, newConfigSpec, 0, len-1);
+            newConfigSpec[len-1] = EGL10.EGL_RENDERABLE_TYPE;
+            if (mEGLContextClientVersion == 2) {
+                newConfigSpec[len] = EGL14.EGL_OPENGL_ES2_BIT;  /* EGL_OPENGL_ES2_BIT */
+            } else {
+                newConfigSpec[len] = EGLExt.EGL_OPENGL_ES3_BIT_KHR; /* EGL_OPENGL_ES3_BIT_KHR */
+            }
+            newConfigSpec[len+1] = EGL10.EGL_NONE;
+            return newConfigSpec;
+        }
+    }
+
+    /**
+     * Choose a configuration with exactly the specified r,g,b,a sizes,
+     * and at least the specified depth and stencil sizes.
+     */
+    private class ComponentSizeChooser extends BaseConfigChooser {
+        public ComponentSizeChooser(int redSize, int greenSize, int blueSize,
+                int alphaSize, int depthSize, int stencilSize) {
+            super(new int[] {
+                    EGL10.EGL_RED_SIZE, redSize,
+                    EGL10.EGL_GREEN_SIZE, greenSize,
+                    EGL10.EGL_BLUE_SIZE, blueSize,
+                    EGL10.EGL_ALPHA_SIZE, alphaSize,
+                    EGL10.EGL_DEPTH_SIZE, depthSize,
+                    EGL10.EGL_STENCIL_SIZE, stencilSize,
+                    EGL10.EGL_NONE});
+            mValue = new int[1];
+            mRedSize = redSize;
+            mGreenSize = greenSize;
+            mBlueSize = blueSize;
+            mAlphaSize = alphaSize;
+            mDepthSize = depthSize;
+            mStencilSize = stencilSize;
+       }
+
+        @Override
+        public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display,
+                EGLConfig[] configs) {
+            for (EGLConfig config : configs) {
+                int d = findConfigAttrib(egl, display, config,
+                        EGL10.EGL_DEPTH_SIZE, 0);
+                int s = findConfigAttrib(egl, display, config,
+                        EGL10.EGL_STENCIL_SIZE, 0);
+                if ((d >= mDepthSize) && (s >= mStencilSize)) {
+                    int r = findConfigAttrib(egl, display, config,
+                            EGL10.EGL_RED_SIZE, 0);
+                    int g = findConfigAttrib(egl, display, config,
+                             EGL10.EGL_GREEN_SIZE, 0);
+                    int b = findConfigAttrib(egl, display, config,
+                              EGL10.EGL_BLUE_SIZE, 0);
+                    int a = findConfigAttrib(egl, display, config,
+                            EGL10.EGL_ALPHA_SIZE, 0);
+                    if ((r == mRedSize) && (g == mGreenSize)
+                            && (b == mBlueSize) && (a == mAlphaSize)) {
+                        return config;
+                    }
+                }
+            }
+            return null;
+        }
+
+        private int findConfigAttrib(EGL10 egl, EGLDisplay display,
+                EGLConfig config, int attribute, int defaultValue) {
+
+            if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) {
+                return mValue[0];
+            }
+            return defaultValue;
+        }
+
+        private int[] mValue;
+        // Subclasses can adjust these values:
+        protected int mRedSize;
+        protected int mGreenSize;
+        protected int mBlueSize;
+        protected int mAlphaSize;
+        protected int mDepthSize;
+        protected int mStencilSize;
+        }
+
+    /**
+     * This class will choose a RGB_888 surface with
+     * or without a depth buffer.
+     *
+     */
+    private class SimpleEGLConfigChooser extends ComponentSizeChooser {
+        public SimpleEGLConfigChooser(boolean withDepthBuffer) {
+            super(8, 8, 8, 0, withDepthBuffer ? 16 : 0, 0);
+        }
+    }
+
+    /**
+     * An EGL helper class.
+     */
+
+    private static class EglHelper {
+        public EglHelper(WeakReference<GLSurfaceView> glSurfaceViewWeakRef) {
+            mGLSurfaceViewWeakRef = glSurfaceViewWeakRef;
+        }
+
+        /**
+         * Initialize EGL for a given configuration spec.
+         * @param configSpec
+         */
+        public void start() {
+            if (LOG_EGL) {
+                Log.w("EglHelper", "start() tid=" + Thread.currentThread().getId());
+            }
+            /*
+             * Get an EGL instance
+             */
+            mEgl = (EGL10) EGLContext.getEGL();
+
+            /*
+             * Get to the default display.
+             */
+            mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
+
+            if (mEglDisplay == EGL10.EGL_NO_DISPLAY) {
+                throw new RuntimeException("eglGetDisplay failed");
+            }
+
+            /*
+             * We can now initialize EGL for that display
+             */
+            int[] version = new int[2];
+            if(!mEgl.eglInitialize(mEglDisplay, version)) {
+                throw new RuntimeException("eglInitialize failed");
+            }
+            GLSurfaceView view = mGLSurfaceViewWeakRef.get();
+            if (view == null) {
+                mEglConfig = null;
+                mEglContext = null;
+            } else {
+                mEglConfig = view.mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay);
+
+                /*
+                * Create an EGL context. We want to do this as rarely as we can, because an
+                * EGL context is a somewhat heavy object.
+                */
+                mEglContext = view.mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig);
+            }
+            if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
+                mEglContext = null;
+                throwEglException("createContext");
+            }
+            if (LOG_EGL) {
+                Log.w("EglHelper", "createContext " + mEglContext + " tid=" + Thread.currentThread().getId());
+            }
+
+            mEglSurface = null;
+        }
+
+        /**
+         * Create an egl surface for the current SurfaceHolder surface. If a surface
+         * already exists, destroy it before creating the new surface.
+         *
+         * @return true if the surface was created successfully.
+         */
+        public boolean createSurface() {
+            if (LOG_EGL) {
+                Log.w("EglHelper", "createSurface()  tid=" + Thread.currentThread().getId());
+            }
+            /*
+             * Check preconditions.
+             */
+            if (mEgl == null) {
+                throw new RuntimeException("egl not initialized");
+            }
+            if (mEglDisplay == null) {
+                throw new RuntimeException("eglDisplay not initialized");
+            }
+            if (mEglConfig == null) {
+                throw new RuntimeException("mEglConfig not initialized");
+            }
+
+            /*
+             *  The window size has changed, so we need to create a new
+             *  surface.
+             */
+            destroySurfaceImp();
+
+            /*
+             * Create an EGL surface we can render into.
+             */
+            GLSurfaceView view = mGLSurfaceViewWeakRef.get();
+            if (view != null) {
+                mEglSurface = view.mEGLWindowSurfaceFactory.createWindowSurface(mEgl,
+                        mEglDisplay, mEglConfig, view.getHolder());
+            } else {
+                mEglSurface = null;
+            }
+
+            if (mEglSurface == null || mEglSurface == EGL10.EGL_NO_SURFACE) {
+                int error = mEgl.eglGetError();
+                if (error == EGL10.EGL_BAD_NATIVE_WINDOW) {
+                    Log.e("EglHelper", "createWindowSurface returned EGL_BAD_NATIVE_WINDOW.");
+                }
+                return false;
+            }
+
+            /*
+             * Before we can issue GL commands, we need to make sure
+             * the context is current and bound to a surface.
+             */
+            if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) {
+                /*
+                 * Could not make the context current, probably because the underlying
+                 * SurfaceView surface has been destroyed.
+                 */
+                logEglErrorAsWarning("EGLHelper", "eglMakeCurrent", mEgl.eglGetError());
+                return false;
+            }
+
+            return true;
+        }
+
+        /**
+         * Create a GL object for the current EGL context.
+         * @return
+         */
+        GL createGL() {
+
+            GL gl = mEglContext.getGL();
+            GLSurfaceView view = mGLSurfaceViewWeakRef.get();
+            if (view != null) {
+                if (view.mGLWrapper != null) {
+                    gl = view.mGLWrapper.wrap(gl);
+                }
+
+                if ((view.mDebugFlags & (DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS)) != 0) {
+                    int configFlags = 0;
+                    Writer log = null;
+                    if ((view.mDebugFlags & DEBUG_CHECK_GL_ERROR) != 0) {
+                        configFlags |= GLDebugHelper.CONFIG_CHECK_GL_ERROR;
+                    }
+                    if ((view.mDebugFlags & DEBUG_LOG_GL_CALLS) != 0) {
+                        log = new LogWriter();
+                    }
+                    gl = GLDebugHelper.wrap(gl, configFlags, log);
+                }
+            }
+            return gl;
+        }
+
+        /**
+         * Display the current render surface.
+         * @return the EGL error code from eglSwapBuffers.
+         */
+        public int swap() {
+            if (! mEgl.eglSwapBuffers(mEglDisplay, mEglSurface)) {
+                return mEgl.eglGetError();
+            }
+            return EGL10.EGL_SUCCESS;
+        }
+
+        public void destroySurface() {
+            if (LOG_EGL) {
+                Log.w("EglHelper", "destroySurface()  tid=" + Thread.currentThread().getId());
+            }
+            destroySurfaceImp();
+        }
+
+        private void destroySurfaceImp() {
+            if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) {
+                mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE,
+                        EGL10.EGL_NO_SURFACE,
+                        EGL10.EGL_NO_CONTEXT);
+                GLSurfaceView view = mGLSurfaceViewWeakRef.get();
+                if (view != null) {
+                    view.mEGLWindowSurfaceFactory.destroySurface(mEgl, mEglDisplay, mEglSurface);
+                }
+                mEglSurface = null;
+            }
+        }
+
+        public void finish() {
+            if (LOG_EGL) {
+                Log.w("EglHelper", "finish() tid=" + Thread.currentThread().getId());
+            }
+            if (mEglContext != null) {
+                GLSurfaceView view = mGLSurfaceViewWeakRef.get();
+                if (view != null) {
+                    view.mEGLContextFactory.destroyContext(mEgl, mEglDisplay, mEglContext);
+                }
+                mEglContext = null;
+            }
+            if (mEglDisplay != null) {
+                mEgl.eglTerminate(mEglDisplay);
+                mEglDisplay = null;
+            }
+        }
+
+        private void throwEglException(String function) {
+            throwEglException(function, mEgl.eglGetError());
+        }
+
+        public static void throwEglException(String function, int error) {
+            String message = formatEglError(function, error);
+            if (LOG_THREADS) {
+                Log.e("EglHelper", "throwEglException tid=" + Thread.currentThread().getId() + " "
+                        + message);
+            }
+            throw new RuntimeException(message);
+        }
+
+        public static void logEglErrorAsWarning(String tag, String function, int error) {
+            Log.w(tag, formatEglError(function, error));
+        }
+
+        public static String formatEglError(String function, int error) {
+            return function + " failed: " + EGLLogWrapper.getErrorString(error);
+        }
+
+        private WeakReference<GLSurfaceView> mGLSurfaceViewWeakRef;
+        EGL10 mEgl;
+        EGLDisplay mEglDisplay;
+        EGLSurface mEglSurface;
+        EGLConfig mEglConfig;
+        @UnsupportedAppUsage
+        EGLContext mEglContext;
+
+    }
+
+    /**
+     * A generic GL Thread. Takes care of initializing EGL and GL. Delegates
+     * to a Renderer instance to do the actual drawing. Can be configured to
+     * render continuously or on request.
+     *
+     * All potentially blocking synchronization is done through the
+     * sGLThreadManager object. This avoids multiple-lock ordering issues.
+     *
+     */
+    static class GLThread extends Thread {
+        GLThread(WeakReference<GLSurfaceView> glSurfaceViewWeakRef) {
+            super();
+            mWidth = 0;
+            mHeight = 0;
+            mRequestRender = true;
+            mRenderMode = RENDERMODE_CONTINUOUSLY;
+            mWantRenderNotification = false;
+            mGLSurfaceViewWeakRef = glSurfaceViewWeakRef;
+        }
+
+        @Override
+        public void run() {
+            setName("GLThread " + getId());
+            if (LOG_THREADS) {
+                Log.i("GLThread", "starting tid=" + getId());
+            }
+
+            try {
+                guardedRun();
+            } catch (InterruptedException e) {
+                // fall thru and exit normally
+            } finally {
+                sGLThreadManager.threadExiting(this);
+            }
+        }
+
+        /*
+         * This private method should only be called inside a
+         * synchronized(sGLThreadManager) block.
+         */
+        private void stopEglSurfaceLocked() {
+            if (mHaveEglSurface) {
+                mHaveEglSurface = false;
+                mEglHelper.destroySurface();
+            }
+        }
+
+        /*
+         * This private method should only be called inside a
+         * synchronized(sGLThreadManager) block.
+         */
+        private void stopEglContextLocked() {
+            if (mHaveEglContext) {
+                mEglHelper.finish();
+                mHaveEglContext = false;
+                sGLThreadManager.releaseEglContextLocked(this);
+            }
+        }
+        private void guardedRun() throws InterruptedException {
+            mEglHelper = new EglHelper(mGLSurfaceViewWeakRef);
+            mHaveEglContext = false;
+            mHaveEglSurface = false;
+            mWantRenderNotification = false;
+
+            try {
+                GL10 gl = null;
+                boolean createEglContext = false;
+                boolean createEglSurface = false;
+                boolean createGlInterface = false;
+                boolean lostEglContext = false;
+                boolean sizeChanged = false;
+                boolean wantRenderNotification = false;
+                boolean doRenderNotification = false;
+                boolean askedToReleaseEglContext = false;
+                int w = 0;
+                int h = 0;
+                Runnable event = null;
+                Runnable finishDrawingRunnable = null;
+
+                while (true) {
+                    synchronized (sGLThreadManager) {
+                        while (true) {
+                            if (mShouldExit) {
+                                return;
+                            }
+
+                            if (! mEventQueue.isEmpty()) {
+                                event = mEventQueue.remove(0);
+                                break;
+                            }
+
+                            // Update the pause state.
+                            boolean pausing = false;
+                            if (mPaused != mRequestPaused) {
+                                pausing = mRequestPaused;
+                                mPaused = mRequestPaused;
+                                sGLThreadManager.notifyAll();
+                                if (LOG_PAUSE_RESUME) {
+                                    Log.i("GLThread", "mPaused is now " + mPaused + " tid=" + getId());
+                                }
+                            }
+
+                            // Do we need to give up the EGL context?
+                            if (mShouldReleaseEglContext) {
+                                if (LOG_SURFACE) {
+                                    Log.i("GLThread", "releasing EGL context because asked to tid=" + getId());
+                                }
+                                stopEglSurfaceLocked();
+                                stopEglContextLocked();
+                                mShouldReleaseEglContext = false;
+                                askedToReleaseEglContext = true;
+                            }
+
+                            // Have we lost the EGL context?
+                            if (lostEglContext) {
+                                stopEglSurfaceLocked();
+                                stopEglContextLocked();
+                                lostEglContext = false;
+                            }
+
+                            // When pausing, release the EGL surface:
+                            if (pausing && mHaveEglSurface) {
+                                if (LOG_SURFACE) {
+                                    Log.i("GLThread", "releasing EGL surface because paused tid=" + getId());
+                                }
+                                stopEglSurfaceLocked();
+                            }
+
+                            // When pausing, optionally release the EGL Context:
+                            if (pausing && mHaveEglContext) {
+                                GLSurfaceView view = mGLSurfaceViewWeakRef.get();
+                                boolean preserveEglContextOnPause = view == null ?
+                                        false : view.mPreserveEGLContextOnPause;
+                                if (!preserveEglContextOnPause) {
+                                    stopEglContextLocked();
+                                    if (LOG_SURFACE) {
+                                        Log.i("GLThread", "releasing EGL context because paused tid=" + getId());
+                                    }
+                                }
+                            }
+
+                            // Have we lost the SurfaceView surface?
+                            if ((! mHasSurface) && (! mWaitingForSurface)) {
+                                if (LOG_SURFACE) {
+                                    Log.i("GLThread", "noticed surfaceView surface lost tid=" + getId());
+                                }
+                                if (mHaveEglSurface) {
+                                    stopEglSurfaceLocked();
+                                }
+                                mWaitingForSurface = true;
+                                mSurfaceIsBad = false;
+                                sGLThreadManager.notifyAll();
+                            }
+
+                            // Have we acquired the surface view surface?
+                            if (mHasSurface && mWaitingForSurface) {
+                                if (LOG_SURFACE) {
+                                    Log.i("GLThread", "noticed surfaceView surface acquired tid=" + getId());
+                                }
+                                mWaitingForSurface = false;
+                                sGLThreadManager.notifyAll();
+                            }
+
+                            if (doRenderNotification) {
+                                if (LOG_SURFACE) {
+                                    Log.i("GLThread", "sending render notification tid=" + getId());
+                                }
+                                mWantRenderNotification = false;
+                                doRenderNotification = false;
+                                mRenderComplete = true;
+                                sGLThreadManager.notifyAll();
+                            }
+
+                            if (mFinishDrawingRunnable != null) {
+                                finishDrawingRunnable = mFinishDrawingRunnable;
+                                mFinishDrawingRunnable = null;
+                            }
+
+                            // Ready to draw?
+                            if (readyToDraw()) {
+
+                                // If we don't have an EGL context, try to acquire one.
+                                if (! mHaveEglContext) {
+                                    if (askedToReleaseEglContext) {
+                                        askedToReleaseEglContext = false;
+                                    } else {
+                                        try {
+                                            mEglHelper.start();
+                                        } catch (RuntimeException t) {
+                                            sGLThreadManager.releaseEglContextLocked(this);
+                                            throw t;
+                                        }
+                                        mHaveEglContext = true;
+                                        createEglContext = true;
+
+                                        sGLThreadManager.notifyAll();
+                                    }
+                                }
+
+                                if (mHaveEglContext && !mHaveEglSurface) {
+                                    mHaveEglSurface = true;
+                                    createEglSurface = true;
+                                    createGlInterface = true;
+                                    sizeChanged = true;
+                                }
+
+                                if (mHaveEglSurface) {
+                                    if (mSizeChanged) {
+                                        sizeChanged = true;
+                                        w = mWidth;
+                                        h = mHeight;
+                                        mWantRenderNotification = true;
+                                        if (LOG_SURFACE) {
+                                            Log.i("GLThread",
+                                                    "noticing that we want render notification tid="
+                                                    + getId());
+                                        }
+
+                                        // Destroy and recreate the EGL surface.
+                                        createEglSurface = true;
+
+                                        mSizeChanged = false;
+                                    }
+                                    mRequestRender = false;
+                                    sGLThreadManager.notifyAll();
+                                    if (mWantRenderNotification) {
+                                        wantRenderNotification = true;
+                                    }
+                                    break;
+                                }
+                            } else {
+                                if (finishDrawingRunnable != null) {
+                                    Log.w(TAG, "Warning, !readyToDraw() but waiting for " +
+                                            "draw finished! Early reporting draw finished.");
+                                    finishDrawingRunnable.run();
+                                    finishDrawingRunnable = null;
+                                }
+                            }
+                            // By design, this is the only place in a GLThread thread where we wait().
+                            if (LOG_THREADS) {
+                                Log.i("GLThread", "waiting tid=" + getId()
+                                    + " mHaveEglContext: " + mHaveEglContext
+                                    + " mHaveEglSurface: " + mHaveEglSurface
+                                    + " mFinishedCreatingEglSurface: " + mFinishedCreatingEglSurface
+                                    + " mPaused: " + mPaused
+                                    + " mHasSurface: " + mHasSurface
+                                    + " mSurfaceIsBad: " + mSurfaceIsBad
+                                    + " mWaitingForSurface: " + mWaitingForSurface
+                                    + " mWidth: " + mWidth
+                                    + " mHeight: " + mHeight
+                                    + " mRequestRender: " + mRequestRender
+                                    + " mRenderMode: " + mRenderMode);
+                            }
+                            sGLThreadManager.wait();
+                        }
+                    } // end of synchronized(sGLThreadManager)
+
+                    if (event != null) {
+                        event.run();
+                        event = null;
+                        continue;
+                    }
+
+                    if (createEglSurface) {
+                        if (LOG_SURFACE) {
+                            Log.w("GLThread", "egl createSurface");
+                        }
+                        if (mEglHelper.createSurface()) {
+                            synchronized(sGLThreadManager) {
+                                mFinishedCreatingEglSurface = true;
+                                sGLThreadManager.notifyAll();
+                            }
+                        } else {
+                            synchronized(sGLThreadManager) {
+                                mFinishedCreatingEglSurface = true;
+                                mSurfaceIsBad = true;
+                                sGLThreadManager.notifyAll();
+                            }
+                            continue;
+                        }
+                        createEglSurface = false;
+                    }
+
+                    if (createGlInterface) {
+                        gl = (GL10) mEglHelper.createGL();
+
+                        createGlInterface = false;
+                    }
+
+                    if (createEglContext) {
+                        if (LOG_RENDERER) {
+                            Log.w("GLThread", "onSurfaceCreated");
+                        }
+                        GLSurfaceView view = mGLSurfaceViewWeakRef.get();
+                        if (view != null) {
+                            try {
+                                Trace.traceBegin(Trace.TRACE_TAG_VIEW, "onSurfaceCreated");
+                                view.mRenderer.onSurfaceCreated(gl, mEglHelper.mEglConfig);
+                            } finally {
+                                Trace.traceEnd(Trace.TRACE_TAG_VIEW);
+                            }
+                        }
+                        createEglContext = false;
+                    }
+
+                    if (sizeChanged) {
+                        if (LOG_RENDERER) {
+                            Log.w("GLThread", "onSurfaceChanged(" + w + ", " + h + ")");
+                        }
+                        GLSurfaceView view = mGLSurfaceViewWeakRef.get();
+                        if (view != null) {
+                            try {
+                                Trace.traceBegin(Trace.TRACE_TAG_VIEW, "onSurfaceChanged");
+                                view.mRenderer.onSurfaceChanged(gl, w, h);
+                            } finally {
+                                Trace.traceEnd(Trace.TRACE_TAG_VIEW);
+                            }
+                        }
+                        sizeChanged = false;
+                    }
+
+                    if (LOG_RENDERER_DRAW_FRAME) {
+                        Log.w("GLThread", "onDrawFrame tid=" + getId());
+                    }
+                    {
+                        GLSurfaceView view = mGLSurfaceViewWeakRef.get();
+                        if (view != null) {
+                            try {
+                                Trace.traceBegin(Trace.TRACE_TAG_VIEW, "onDrawFrame");
+                                view.mRenderer.onDrawFrame(gl);
+                                if (finishDrawingRunnable != null) {
+                                    finishDrawingRunnable.run();
+                                    finishDrawingRunnable = null;
+                                }
+                            } finally {
+                                Trace.traceEnd(Trace.TRACE_TAG_VIEW);
+                            }
+                        }
+                    }
+                    int swapError = mEglHelper.swap();
+                    switch (swapError) {
+                        case EGL10.EGL_SUCCESS:
+                            break;
+                        case EGL11.EGL_CONTEXT_LOST:
+                            if (LOG_SURFACE) {
+                                Log.i("GLThread", "egl context lost tid=" + getId());
+                            }
+                            lostEglContext = true;
+                            break;
+                        default:
+                            // Other errors typically mean that the current surface is bad,
+                            // probably because the SurfaceView surface has been destroyed,
+                            // but we haven't been notified yet.
+                            // Log the error to help developers understand why rendering stopped.
+                            EglHelper.logEglErrorAsWarning("GLThread", "eglSwapBuffers", swapError);
+
+                            synchronized(sGLThreadManager) {
+                                mSurfaceIsBad = true;
+                                sGLThreadManager.notifyAll();
+                            }
+                            break;
+                    }
+
+                    if (wantRenderNotification) {
+                        doRenderNotification = true;
+                        wantRenderNotification = false;
+                    }
+                }
+
+            } finally {
+                /*
+                 * clean-up everything...
+                 */
+                synchronized (sGLThreadManager) {
+                    stopEglSurfaceLocked();
+                    stopEglContextLocked();
+                }
+            }
+        }
+
+        public boolean ableToDraw() {
+            return mHaveEglContext && mHaveEglSurface && readyToDraw();
+        }
+
+        private boolean readyToDraw() {
+            return (!mPaused) && mHasSurface && (!mSurfaceIsBad)
+                && (mWidth > 0) && (mHeight > 0)
+                && (mRequestRender || (mRenderMode == RENDERMODE_CONTINUOUSLY));
+        }
+
+        public void setRenderMode(int renderMode) {
+            if ( !((RENDERMODE_WHEN_DIRTY <= renderMode) && (renderMode <= RENDERMODE_CONTINUOUSLY)) ) {
+                throw new IllegalArgumentException("renderMode");
+            }
+            synchronized(sGLThreadManager) {
+                mRenderMode = renderMode;
+                sGLThreadManager.notifyAll();
+            }
+        }
+
+        public int getRenderMode() {
+            synchronized(sGLThreadManager) {
+                return mRenderMode;
+            }
+        }
+
+        public void requestRender() {
+            synchronized(sGLThreadManager) {
+                mRequestRender = true;
+                sGLThreadManager.notifyAll();
+            }
+        }
+
+        public void requestRenderAndNotify(Runnable finishDrawing) {
+            synchronized(sGLThreadManager) {
+                // If we are already on the GL thread, this means a client callback
+                // has caused reentrancy, for example via updating the SurfaceView parameters.
+                // We will return to the client rendering code, so here we don't need to
+                // do anything.
+                if (Thread.currentThread() == this) {
+                    return;
+                }
+
+                mWantRenderNotification = true;
+                mRequestRender = true;
+                mRenderComplete = false;
+                mFinishDrawingRunnable = finishDrawing;
+
+                sGLThreadManager.notifyAll();
+            }
+        }
+
+        public void surfaceCreated() {
+            synchronized(sGLThreadManager) {
+                if (LOG_THREADS) {
+                    Log.i("GLThread", "surfaceCreated tid=" + getId());
+                }
+                mHasSurface = true;
+                mFinishedCreatingEglSurface = false;
+                sGLThreadManager.notifyAll();
+                while (mWaitingForSurface
+                       && !mFinishedCreatingEglSurface
+                       && !mExited) {
+                    try {
+                        sGLThreadManager.wait();
+                    } catch (InterruptedException e) {
+                        Thread.currentThread().interrupt();
+                    }
+                }
+            }
+        }
+
+        public void surfaceDestroyed() {
+            synchronized(sGLThreadManager) {
+                if (LOG_THREADS) {
+                    Log.i("GLThread", "surfaceDestroyed tid=" + getId());
+                }
+                mHasSurface = false;
+                sGLThreadManager.notifyAll();
+                while((!mWaitingForSurface) && (!mExited)) {
+                    try {
+                        sGLThreadManager.wait();
+                    } catch (InterruptedException e) {
+                        Thread.currentThread().interrupt();
+                    }
+                }
+            }
+        }
+
+        public void onPause() {
+            synchronized (sGLThreadManager) {
+                if (LOG_PAUSE_RESUME) {
+                    Log.i("GLThread", "onPause tid=" + getId());
+                }
+                mRequestPaused = true;
+                sGLThreadManager.notifyAll();
+                while ((! mExited) && (! mPaused)) {
+                    if (LOG_PAUSE_RESUME) {
+                        Log.i("Main thread", "onPause waiting for mPaused.");
+                    }
+                    try {
+                        sGLThreadManager.wait();
+                    } catch (InterruptedException ex) {
+                        Thread.currentThread().interrupt();
+                    }
+                }
+            }
+        }
+
+        public void onResume() {
+            synchronized (sGLThreadManager) {
+                if (LOG_PAUSE_RESUME) {
+                    Log.i("GLThread", "onResume tid=" + getId());
+                }
+                mRequestPaused = false;
+                mRequestRender = true;
+                mRenderComplete = false;
+                sGLThreadManager.notifyAll();
+                while ((! mExited) && mPaused && (!mRenderComplete)) {
+                    if (LOG_PAUSE_RESUME) {
+                        Log.i("Main thread", "onResume waiting for !mPaused.");
+                    }
+                    try {
+                        sGLThreadManager.wait();
+                    } catch (InterruptedException ex) {
+                        Thread.currentThread().interrupt();
+                    }
+                }
+            }
+        }
+
+        public void onWindowResize(int w, int h) {
+            synchronized (sGLThreadManager) {
+                mWidth = w;
+                mHeight = h;
+                mSizeChanged = true;
+                mRequestRender = true;
+                mRenderComplete = false;
+
+                // If we are already on the GL thread, this means a client callback
+                // has caused reentrancy, for example via updating the SurfaceView parameters.
+                // We need to process the size change eventually though and update our EGLSurface.
+                // So we set the parameters and return so they can be processed on our
+                // next iteration.
+                if (Thread.currentThread() == this) {
+                    return;
+                }
+
+                sGLThreadManager.notifyAll();
+
+                // Wait for thread to react to resize and render a frame
+                while (! mExited && !mPaused && !mRenderComplete
+                        && ableToDraw()) {
+                    if (LOG_SURFACE) {
+                        Log.i("Main thread", "onWindowResize waiting for render complete from tid=" + getId());
+                    }
+                    try {
+                        sGLThreadManager.wait();
+                    } catch (InterruptedException ex) {
+                        Thread.currentThread().interrupt();
+                    }
+                }
+            }
+        }
+
+        public void requestExitAndWait() {
+            // don't call this from GLThread thread or it is a guaranteed
+            // deadlock!
+            synchronized(sGLThreadManager) {
+                mShouldExit = true;
+                sGLThreadManager.notifyAll();
+                while (! mExited) {
+                    try {
+                        sGLThreadManager.wait();
+                    } catch (InterruptedException ex) {
+                        Thread.currentThread().interrupt();
+                    }
+                }
+            }
+        }
+
+        public void requestReleaseEglContextLocked() {
+            mShouldReleaseEglContext = true;
+            sGLThreadManager.notifyAll();
+        }
+
+        /**
+         * Queue an "event" to be run on the GL rendering thread.
+         * @param r the runnable to be run on the GL rendering thread.
+         */
+        public void queueEvent(Runnable r) {
+            if (r == null) {
+                throw new IllegalArgumentException("r must not be null");
+            }
+            synchronized(sGLThreadManager) {
+                mEventQueue.add(r);
+                sGLThreadManager.notifyAll();
+            }
+        }
+
+        // Once the thread is started, all accesses to the following member
+        // variables are protected by the sGLThreadManager monitor
+        private boolean mShouldExit;
+        private boolean mExited;
+        private boolean mRequestPaused;
+        private boolean mPaused;
+        private boolean mHasSurface;
+        private boolean mSurfaceIsBad;
+        private boolean mWaitingForSurface;
+        private boolean mHaveEglContext;
+        private boolean mHaveEglSurface;
+        private boolean mFinishedCreatingEglSurface;
+        private boolean mShouldReleaseEglContext;
+        private int mWidth;
+        private int mHeight;
+        private int mRenderMode;
+        private boolean mRequestRender;
+        private boolean mWantRenderNotification;
+        private boolean mRenderComplete;
+        private ArrayList<Runnable> mEventQueue = new ArrayList<Runnable>();
+        private boolean mSizeChanged = true;
+        private Runnable mFinishDrawingRunnable = null;
+
+        // End of member variables protected by the sGLThreadManager monitor.
+
+        @UnsupportedAppUsage
+        private EglHelper mEglHelper;
+
+        /**
+         * Set once at thread construction time, nulled out when the parent view is garbage
+         * called. This weak reference allows the GLSurfaceView to be garbage collected while
+         * the GLThread is still alive.
+         */
+        private WeakReference<GLSurfaceView> mGLSurfaceViewWeakRef;
+
+    }
+
+    static class LogWriter extends Writer {
+
+        @Override public void close() {
+            flushBuilder();
+        }
+
+        @Override public void flush() {
+            flushBuilder();
+        }
+
+        @Override public void write(char[] buf, int offset, int count) {
+            for(int i = 0; i < count; i++) {
+                char c = buf[offset + i];
+                if ( c == '\n') {
+                    flushBuilder();
+                }
+                else {
+                    mBuilder.append(c);
+                }
+            }
+        }
+
+        private void flushBuilder() {
+            if (mBuilder.length() > 0) {
+                Log.v("GLSurfaceView", mBuilder.toString());
+                mBuilder.delete(0, mBuilder.length());
+            }
+        }
+
+        private StringBuilder mBuilder = new StringBuilder();
+    }
+
+
+    private void checkRenderThreadState() {
+        if (mGLThread != null) {
+            throw new IllegalStateException(
+                    "setRenderer has already been called for this instance.");
+        }
+    }
+
+    private static class GLThreadManager {
+        private static String TAG = "GLThreadManager";
+
+        public synchronized void threadExiting(GLThread thread) {
+            if (LOG_THREADS) {
+                Log.i("GLThread", "exiting tid=" +  thread.getId());
+            }
+            thread.mExited = true;
+            notifyAll();
+        }
+
+        /*
+         * Releases the EGL context. Requires that we are already in the
+         * sGLThreadManager monitor when this is called.
+         */
+        public void releaseEglContextLocked(GLThread thread) {
+            notifyAll();
+        }
+    }
+
+    private static final GLThreadManager sGLThreadManager = new GLThreadManager();
+
+    private final WeakReference<GLSurfaceView> mThisWeakRef =
+            new WeakReference<GLSurfaceView>(this);
+    @UnsupportedAppUsage
+    private GLThread mGLThread;
+    @UnsupportedAppUsage
+    private Renderer mRenderer;
+    private boolean mDetached;
+    private EGLConfigChooser mEGLConfigChooser;
+    private EGLContextFactory mEGLContextFactory;
+    private EGLWindowSurfaceFactory mEGLWindowSurfaceFactory;
+    private GLWrapper mGLWrapper;
+    private int mDebugFlags;
+    private int mEGLContextClientVersion;
+    private boolean mPreserveEGLContextOnPause;
+}
diff --git a/android/opengl/GLU.java b/android/opengl/GLU.java
new file mode 100644
index 0000000..ef9bf16
--- /dev/null
+++ b/android/opengl/GLU.java
@@ -0,0 +1,245 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.opengl;
+
+import javax.microedition.khronos.opengles.GL10;
+
+/**
+ * A set of GL utilities inspired by the OpenGL Utility Toolkit.
+ *
+ */
+
+public class GLU {
+
+    /**
+     * Return an error string from a GL or GLU error code.
+     *
+     * @param error - a GL or GLU error code.
+     * @return the error string for the input error code, or NULL if the input
+     *         was not a valid GL or GLU error code.
+     */
+    public static String gluErrorString(int error) {
+        switch (error) {
+        case GL10.GL_NO_ERROR:
+            return "no error";
+        case GL10.GL_INVALID_ENUM:
+            return "invalid enum";
+        case GL10.GL_INVALID_VALUE:
+            return "invalid value";
+        case GL10.GL_INVALID_OPERATION:
+            return "invalid operation";
+        case GL10.GL_STACK_OVERFLOW:
+            return "stack overflow";
+        case GL10.GL_STACK_UNDERFLOW:
+            return "stack underflow";
+        case GL10.GL_OUT_OF_MEMORY:
+            return "out of memory";
+        default:
+            return null;
+        }
+    }
+
+    /**
+     * Define a viewing transformation in terms of an eye point, a center of
+     * view, and an up vector.
+     *
+     * @param gl a GL10 interface
+     * @param eyeX eye point X
+     * @param eyeY eye point Y
+     * @param eyeZ eye point Z
+     * @param centerX center of view X
+     * @param centerY center of view Y
+     * @param centerZ center of view Z
+     * @param upX up vector X
+     * @param upY up vector Y
+     * @param upZ up vector Z
+     */
+    public static void gluLookAt(GL10 gl, float eyeX, float eyeY, float eyeZ,
+            float centerX, float centerY, float centerZ, float upX, float upY,
+            float upZ) {
+
+        float[] scratch = sScratch;
+        synchronized(scratch) {
+            Matrix.setLookAtM(scratch, 0, eyeX, eyeY, eyeZ, centerX, centerY, centerZ,
+                    upX, upY, upZ);
+            gl.glMultMatrixf(scratch, 0);
+        }
+    }
+
+    /**
+     * Set up a 2D orthographic projection matrix
+     *
+     * @param gl
+     * @param left
+     * @param right
+     * @param bottom
+     * @param top
+     */
+    public static void gluOrtho2D(GL10 gl, float left, float right,
+            float bottom, float top) {
+        gl.glOrthof(left, right, bottom, top, -1.0f, 1.0f);
+    }
+
+    /**
+     * Set up a perspective projection matrix
+     *
+     * @param gl a GL10 interface
+     * @param fovy specifies the field of view angle, in degrees, in the Y
+     *        direction.
+     * @param aspect specifies the aspect ration that determins the field of
+     *        view in the x direction. The aspect ratio is the ratio of x
+     *        (width) to y (height).
+     * @param zNear specifies the distance from the viewer to the near clipping
+     *        plane (always positive).
+     * @param zFar specifies the distance from the viewer to the far clipping
+     *        plane (always positive).
+     */
+    public static void gluPerspective(GL10 gl, float fovy, float aspect,
+            float zNear, float zFar) {
+        float top = zNear * (float) Math.tan(fovy * (Math.PI / 360.0));
+        float bottom = -top;
+        float left = bottom * aspect;
+        float right = top * aspect;
+        gl.glFrustumf(left, right, bottom, top, zNear, zFar);
+    }
+
+    /**
+     * Map object coordinates into window coordinates. gluProject transforms the
+     * specified object coordinates into window coordinates using model, proj,
+     * and view. The result is stored in win.
+     * <p>
+     * Note that you can use the OES_matrix_get extension, if present, to get
+     * the current modelView and projection matrices.
+     *
+     * @param objX object coordinates X
+     * @param objY object coordinates Y
+     * @param objZ object coordinates Z
+     * @param model the current modelview matrix
+     * @param modelOffset the offset into the model array where the modelview
+     *        maxtrix data starts.
+     * @param project the current projection matrix
+     * @param projectOffset the offset into the project array where the project
+     *        matrix data starts.
+     * @param view the current view, {x, y, width, height}
+     * @param viewOffset the offset into the view array where the view vector
+     *        data starts.
+     * @param win the output vector {winX, winY, winZ}, that returns the
+     *        computed window coordinates.
+     * @param winOffset the offset into the win array where the win vector data
+     *        starts.
+     * @return A return value of GL_TRUE indicates success, a return value of
+     *         GL_FALSE indicates failure.
+     */
+    public static int gluProject(float objX, float objY, float objZ,
+            float[] model, int modelOffset, float[] project, int projectOffset,
+            int[] view, int viewOffset, float[] win, int winOffset) {
+        float[] scratch = sScratch;
+        synchronized(scratch) {
+            final int M_OFFSET = 0; // 0..15
+            final int V_OFFSET = 16; // 16..19
+            final int V2_OFFSET = 20; // 20..23
+            Matrix.multiplyMM(scratch, M_OFFSET, project, projectOffset,
+                    model, modelOffset);
+
+            scratch[V_OFFSET + 0] = objX;
+            scratch[V_OFFSET + 1] = objY;
+            scratch[V_OFFSET + 2] = objZ;
+            scratch[V_OFFSET + 3] = 1.0f;
+
+            Matrix.multiplyMV(scratch, V2_OFFSET,
+                    scratch, M_OFFSET, scratch, V_OFFSET);
+
+            float w = scratch[V2_OFFSET + 3];
+            if (w == 0.0f) {
+                return GL10.GL_FALSE;
+            }
+
+            float rw = 1.0f / w;
+
+            win[winOffset] =
+                    view[viewOffset] + view[viewOffset + 2]
+                            * (scratch[V2_OFFSET + 0] * rw + 1.0f)
+                            * 0.5f;
+            win[winOffset + 1] =
+                    view[viewOffset + 1] + view[viewOffset + 3]
+                            * (scratch[V2_OFFSET + 1] * rw + 1.0f) * 0.5f;
+            win[winOffset + 2] = (scratch[V2_OFFSET + 2] * rw + 1.0f) * 0.5f;
+        }
+
+        return GL10.GL_TRUE;
+    }
+
+    /**
+     * Map window coordinates to object coordinates. gluUnProject maps the
+     * specified window coordinates into object coordinates using model, proj,
+     * and view. The result is stored in obj.
+     * <p>
+     * Note that you can use the OES_matrix_get extension, if present, to get
+     * the current modelView and projection matrices.
+     *
+     * @param winX window coordinates X
+     * @param winY window coordinates Y
+     * @param winZ window coordinates Z
+     * @param model the current modelview matrix
+     * @param modelOffset the offset into the model array where the modelview
+     *        maxtrix data starts.
+     * @param project the current projection matrix
+     * @param projectOffset the offset into the project array where the project
+     *        matrix data starts.
+     * @param view the current view, {x, y, width, height}
+     * @param viewOffset the offset into the view array where the view vector
+     *        data starts.
+     * @param obj the output vector {objX, objY, objZ, objW}, that returns the
+     *        computed homogeneous object coordinates.
+     * @param objOffset the offset into the obj array where the obj vector data
+     *        starts.
+     * @return A return value of GL10.GL_TRUE indicates success, a return value
+     *         of GL10.GL_FALSE indicates failure.
+     */
+    public static int gluUnProject(float winX, float winY, float winZ,
+            float[] model, int modelOffset, float[] project, int projectOffset,
+            int[] view, int viewOffset, float[] obj, int objOffset) {
+        float[] scratch = sScratch;
+        synchronized(scratch) {
+            final int PM_OFFSET = 0; // 0..15
+            final int INVPM_OFFSET = 16; // 16..31
+               final int V_OFFSET = 0; // 0..3 Reuses PM_OFFSET space
+            Matrix.multiplyMM(scratch, PM_OFFSET, project, projectOffset,
+                    model, modelOffset);
+
+            if (!Matrix.invertM(scratch, INVPM_OFFSET, scratch, PM_OFFSET)) {
+                return GL10.GL_FALSE;
+            }
+
+            scratch[V_OFFSET + 0] =
+                    2.0f * (winX - view[viewOffset + 0]) / view[viewOffset + 2]
+                            - 1.0f;
+            scratch[V_OFFSET + 1] =
+                    2.0f * (winY - view[viewOffset + 1]) / view[viewOffset + 3]
+                            - 1.0f;
+            scratch[V_OFFSET + 2] = 2.0f * winZ - 1.0f;
+            scratch[V_OFFSET + 3] = 1.0f;
+
+            Matrix.multiplyMV(obj, objOffset, scratch, INVPM_OFFSET,
+                    scratch, V_OFFSET);
+        }
+
+        return GL10.GL_TRUE;
+    }
+
+    private static final float[] sScratch = new float[32];
+ }
diff --git a/android/opengl/GLUtils.java b/android/opengl/GLUtils.java
new file mode 100644
index 0000000..cc46514
--- /dev/null
+++ b/android/opengl/GLUtils.java
@@ -0,0 +1,270 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.opengl;
+
+import android.graphics.Bitmap;
+
+import javax.microedition.khronos.egl.EGL10;
+import javax.microedition.khronos.egl.EGL11;
+
+/**
+ *
+ * Utility class to help bridging OpenGL ES and Android APIs.
+ *
+ */
+
+public final class GLUtils {
+
+    private GLUtils() {
+    }
+
+    /**
+     * return the internal format as defined by OpenGL ES of the supplied bitmap.
+     * @param bitmap
+     * @return the internal format of the bitmap.
+     */
+    public static int getInternalFormat(Bitmap bitmap) {
+        if (bitmap == null) {
+            throw new NullPointerException("getInternalFormat can't be used with a null Bitmap");
+        }
+        if (bitmap.isRecycled()) {
+            throw new IllegalArgumentException("bitmap is recycled");
+        }
+        int result = native_getInternalFormat(bitmap);
+        if (result < 0) {
+            throw new IllegalArgumentException("Unknown internalformat");
+        }
+        return result;
+    }
+
+    /**
+     * Return the type as defined by OpenGL ES of the supplied bitmap, if there
+     * is one. If the bitmap is stored in a compressed format, it may not have
+     * a valid OpenGL ES type.
+     * @throws IllegalArgumentException if the bitmap does not have a type.
+     * @param bitmap
+     * @return the OpenGL ES type of the bitmap.
+     */
+    public static int getType(Bitmap bitmap) {
+        if (bitmap == null) {
+            throw new NullPointerException("getType can't be used with a null Bitmap");
+        }
+        if (bitmap.isRecycled()) {
+            throw new IllegalArgumentException("bitmap is recycled");
+        }
+        int result = native_getType(bitmap);
+        if (result < 0) {
+            throw new IllegalArgumentException("Unknown type");
+        }
+        return result;
+    }
+
+    /**
+     * Calls glTexImage2D() on the current OpenGL context. If no context is
+     * current the behavior is the same as calling glTexImage2D() with  no
+     * current context, that is, eglGetError() will return the appropriate
+     * error.
+     * Unlike glTexImage2D() bitmap cannot be null and will raise an exception
+     * in that case.
+     * All other parameters are identical to those used for glTexImage2D().
+     *
+     * NOTE: this method doesn't change GL_UNPACK_ALIGNMENT, you must make
+     * sure to set it properly according to the supplied bitmap.
+     *
+     * Whether or not bitmap can have non power of two dimensions depends on
+     * the current OpenGL context. Always check glGetError() some time
+     * after calling this method, just like when using OpenGL directly.
+     *
+     * @param target
+     * @param level
+     * @param internalformat
+     * @param bitmap
+     * @param border
+     */
+    public static void texImage2D(int target, int level, int internalformat,
+            Bitmap bitmap, int border) {
+        if (bitmap == null) {
+            throw new NullPointerException("texImage2D can't be used with a null Bitmap");
+        }
+        if (bitmap.isRecycled()) {
+            throw new IllegalArgumentException("bitmap is recycled");
+        }
+        if (native_texImage2D(target, level, internalformat, bitmap, -1, border) != 0) {
+            throw new IllegalArgumentException("invalid Bitmap format");
+        }
+    }
+
+    /**
+     * A version of texImage2D() that takes an explicit type parameter
+     * as defined by the OpenGL ES specification. The actual type and
+     * internalformat of the bitmap must be compatible with the specified
+     * type and internalformat parameters.
+     *
+     * @param target
+     * @param level
+     * @param internalformat
+     * @param bitmap
+     * @param type
+     * @param border
+     */
+    public static void texImage2D(int target, int level, int internalformat,
+            Bitmap bitmap, int type, int border) {
+        if (bitmap == null) {
+            throw new NullPointerException("texImage2D can't be used with a null Bitmap");
+        }
+        if (bitmap.isRecycled()) {
+            throw new IllegalArgumentException("bitmap is recycled");
+        }
+        if (native_texImage2D(target, level, internalformat, bitmap, type, border) != 0) {
+            throw new IllegalArgumentException("invalid Bitmap format");
+        }
+    }
+
+    /**
+     * A version of texImage2D that determines the internalFormat and type
+     * automatically.
+     *
+     * @param target
+     * @param level
+     * @param bitmap
+     * @param border
+     */
+    public static void texImage2D(int target, int level, Bitmap bitmap,
+            int border) {
+        if (bitmap == null) {
+            throw new NullPointerException("texImage2D can't be used with a null Bitmap");
+        }
+        if (bitmap.isRecycled()) {
+            throw new IllegalArgumentException("bitmap is recycled");
+        }
+        if (native_texImage2D(target, level, -1, bitmap, -1, border) != 0) {
+            throw new IllegalArgumentException("invalid Bitmap format");
+        }
+    }
+
+    /**
+     * Calls glTexSubImage2D() on the current OpenGL context. If no context is
+     * current the behavior is the same as calling glTexSubImage2D() with  no
+     * current context, that is, eglGetError() will return the appropriate
+     * error.
+     * Unlike glTexSubImage2D() bitmap cannot be null and will raise an exception
+     * in that case.
+     * All other parameters are identical to those used for glTexSubImage2D().
+     *
+     * NOTE: this method doesn't change GL_UNPACK_ALIGNMENT, you must make
+     * sure to set it properly according to the supplied bitmap.
+     *
+     * Whether or not bitmap can have non power of two dimensions depends on
+     * the current OpenGL context. Always check glGetError() some time
+     * after calling this method, just like when using OpenGL directly.
+     *
+     * @param target
+     * @param level
+     * @param xoffset
+     * @param yoffset
+     * @param bitmap
+     */
+    public static void texSubImage2D(int target, int level, int xoffset, int yoffset,
+            Bitmap bitmap) {
+        if (bitmap == null) {
+            throw new NullPointerException("texSubImage2D can't be used with a null Bitmap");
+        }
+        if (bitmap.isRecycled()) {
+            throw new IllegalArgumentException("bitmap is recycled");
+        }
+        int type = getType(bitmap);
+        if (native_texSubImage2D(target, level, xoffset, yoffset, bitmap, -1, type) != 0) {
+            throw new IllegalArgumentException("invalid Bitmap format");
+        }
+    }
+
+    /**
+     * A version of texSubImage2D() that takes an explicit type parameter
+     * as defined by the OpenGL ES specification.
+     *
+     * @param target
+     * @param level
+     * @param xoffset
+     * @param yoffset
+     * @param bitmap
+     * @param type
+     */
+    public static void texSubImage2D(int target, int level, int xoffset, int yoffset,
+            Bitmap bitmap, int format, int type) {
+        if (bitmap == null) {
+            throw new NullPointerException("texSubImage2D can't be used with a null Bitmap");
+        }
+        if (bitmap.isRecycled()) {
+            throw new IllegalArgumentException("bitmap is recycled");
+        }
+        if (native_texSubImage2D(target, level, xoffset, yoffset, bitmap, format, type) != 0) {
+            throw new IllegalArgumentException("invalid Bitmap format");
+        }
+    }
+
+    /**
+     * Return a string for the EGL error code, or the hex representation
+     * if the error is unknown.
+     *
+     * @param error The EGL error to convert into a String.
+     *
+     * @return An error string corresponding to the EGL error code.
+     */
+    public static String getEGLErrorString(int error) {
+        switch (error) {
+            case EGL10.EGL_SUCCESS:
+                return "EGL_SUCCESS";
+            case EGL10.EGL_NOT_INITIALIZED:
+                return "EGL_NOT_INITIALIZED";
+            case EGL10.EGL_BAD_ACCESS:
+                return "EGL_BAD_ACCESS";
+            case EGL10.EGL_BAD_ALLOC:
+                return "EGL_BAD_ALLOC";
+            case EGL10.EGL_BAD_ATTRIBUTE:
+                return "EGL_BAD_ATTRIBUTE";
+            case EGL10.EGL_BAD_CONFIG:
+                return "EGL_BAD_CONFIG";
+            case EGL10.EGL_BAD_CONTEXT:
+                return "EGL_BAD_CONTEXT";
+            case EGL10.EGL_BAD_CURRENT_SURFACE:
+                return "EGL_BAD_CURRENT_SURFACE";
+            case EGL10.EGL_BAD_DISPLAY:
+                return "EGL_BAD_DISPLAY";
+            case EGL10.EGL_BAD_MATCH:
+                return "EGL_BAD_MATCH";
+            case EGL10.EGL_BAD_NATIVE_PIXMAP:
+                return "EGL_BAD_NATIVE_PIXMAP";
+            case EGL10.EGL_BAD_NATIVE_WINDOW:
+                return "EGL_BAD_NATIVE_WINDOW";
+            case EGL10.EGL_BAD_PARAMETER:
+                return "EGL_BAD_PARAMETER";
+            case EGL10.EGL_BAD_SURFACE:
+                return "EGL_BAD_SURFACE";
+            case EGL11.EGL_CONTEXT_LOST:
+                return "EGL_CONTEXT_LOST";
+            default:
+                return "0x" + Integer.toHexString(error);
+        }
+    }
+
+    private static native int native_getInternalFormat(Bitmap bitmap);
+    private static native int native_getType(Bitmap bitmap);
+    private static native int native_texImage2D(int target, int level, int internalformat,
+            Bitmap bitmap, int type, int border);
+    private static native int native_texSubImage2D(int target, int level, int xoffset, int yoffset,
+            Bitmap bitmap, int format, int type);
+}
diff --git a/android/opengl/GLWallpaperService.java b/android/opengl/GLWallpaperService.java
new file mode 100644
index 0000000..c954fed
--- /dev/null
+++ b/android/opengl/GLWallpaperService.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.opengl;
+
+/**
+ * reserve this namespace for future use
+ * (making sure external developers don't use it)
+ * @hide
+ */
+class GLWallpaperService {
+}
diff --git a/android/opengl/GLWrapperBase.java b/android/opengl/GLWrapperBase.java
new file mode 100644
index 0000000..cf252f9
--- /dev/null
+++ b/android/opengl/GLWrapperBase.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.opengl;
+
+import javax.microedition.khronos.opengles.GL;
+import javax.microedition.khronos.opengles.GL10;
+import javax.microedition.khronos.opengles.GL10Ext;
+import javax.microedition.khronos.opengles.GL11;
+import javax.microedition.khronos.opengles.GL11Ext;
+import javax.microedition.khronos.opengles.GL11ExtensionPack;
+
+/**
+ * The abstract base class for a GL wrapper. Provides
+ * some convenient instance variables and default implementations.
+ */
+abstract class GLWrapperBase
+    implements GL, GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
+    public GLWrapperBase(GL gl) {
+        mgl = (GL10) gl;
+        if (gl instanceof GL10Ext) {
+            mgl10Ext = (GL10Ext) gl;
+        }
+        if (gl instanceof GL11) {
+            mgl11 = (GL11) gl;
+        }
+        if (gl instanceof GL11Ext) {
+            mgl11Ext = (GL11Ext) gl;
+        }
+        if (gl instanceof GL11ExtensionPack) {
+            mgl11ExtensionPack = (GL11ExtensionPack) gl;
+        }
+    }
+
+    protected GL10 mgl;
+    protected GL10Ext mgl10Ext;
+    protected GL11 mgl11;
+    protected GL11Ext mgl11Ext;
+    protected GL11ExtensionPack mgl11ExtensionPack;
+}
diff --git a/android/opengl/Matrix.java b/android/opengl/Matrix.java
new file mode 100644
index 0000000..ce3f57e
--- /dev/null
+++ b/android/opengl/Matrix.java
@@ -0,0 +1,753 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.opengl;
+
+/**
+ * Matrix math utilities. These methods operate on OpenGL ES format
+ * matrices and vectors stored in float arrays.
+ * <p>
+ * Matrices are 4 x 4 column-vector matrices stored in column-major
+ * order:
+ * <pre>
+ *  m[offset +  0] m[offset +  4] m[offset +  8] m[offset + 12]
+ *  m[offset +  1] m[offset +  5] m[offset +  9] m[offset + 13]
+ *  m[offset +  2] m[offset +  6] m[offset + 10] m[offset + 14]
+ *  m[offset +  3] m[offset +  7] m[offset + 11] m[offset + 15]</pre>
+ *
+ * Vectors are 4 x 1 column vectors stored in order:
+ * <pre>
+ * v[offset + 0]
+ * v[offset + 1]
+ * v[offset + 2]
+ * v[offset + 3]</pre>
+ */
+public class Matrix {
+
+    /** Temporary memory for operations that need temporary matrix data. */
+    private final static float[] sTemp = new float[32];
+
+    /**
+     * @deprecated All methods are static, do not instantiate this class.
+     */
+    @Deprecated
+    public Matrix() {}
+
+    /**
+     * Multiplies two 4x4 matrices together and stores the result in a third 4x4
+     * matrix. In matrix notation: result = lhs x rhs. Due to the way
+     * matrix multiplication works, the result matrix will have the same
+     * effect as first multiplying by the rhs matrix, then multiplying by
+     * the lhs matrix. This is the opposite of what you might expect.
+     * <p>
+     * The same float array may be passed for result, lhs, and/or rhs. However,
+     * the result element values are undefined if the result elements overlap
+     * either the lhs or rhs elements.
+     *
+     * @param result The float array that holds the result.
+     * @param resultOffset The offset into the result array where the result is
+     *        stored.
+     * @param lhs The float array that holds the left-hand-side matrix.
+     * @param lhsOffset The offset into the lhs array where the lhs is stored
+     * @param rhs The float array that holds the right-hand-side matrix.
+     * @param rhsOffset The offset into the rhs array where the rhs is stored.
+     *
+     * @throws IllegalArgumentException if result, lhs, or rhs are null, or if
+     * resultOffset + 16 > result.length or lhsOffset + 16 > lhs.length or
+     * rhsOffset + 16 > rhs.length.
+     */
+    public static native void multiplyMM(float[] result, int resultOffset,
+            float[] lhs, int lhsOffset, float[] rhs, int rhsOffset);
+
+    /**
+     * Multiplies a 4 element vector by a 4x4 matrix and stores the result in a
+     * 4-element column vector. In matrix notation: result = lhs x rhs
+     * <p>
+     * The same float array may be passed for resultVec, lhsMat, and/or rhsVec.
+     * However, the resultVec element values are undefined if the resultVec
+     * elements overlap either the lhsMat or rhsVec elements.
+     *
+     * @param resultVec The float array that holds the result vector.
+     * @param resultVecOffset The offset into the result array where the result
+     *        vector is stored.
+     * @param lhsMat The float array that holds the left-hand-side matrix.
+     * @param lhsMatOffset The offset into the lhs array where the lhs is stored
+     * @param rhsVec The float array that holds the right-hand-side vector.
+     * @param rhsVecOffset The offset into the rhs vector where the rhs vector
+     *        is stored.
+     *
+     * @throws IllegalArgumentException if resultVec, lhsMat,
+     * or rhsVec are null, or if resultVecOffset + 4 > resultVec.length
+     * or lhsMatOffset + 16 > lhsMat.length or
+     * rhsVecOffset + 4 > rhsVec.length.
+     */
+    public static native void multiplyMV(float[] resultVec,
+            int resultVecOffset, float[] lhsMat, int lhsMatOffset,
+            float[] rhsVec, int rhsVecOffset);
+
+    /**
+     * Transposes a 4 x 4 matrix.
+     * <p>
+     * mTrans and m must not overlap.
+     *
+     * @param mTrans the array that holds the output transposed matrix
+     * @param mTransOffset an offset into mTrans where the transposed matrix is
+     *        stored.
+     * @param m the input array
+     * @param mOffset an offset into m where the input matrix is stored.
+     */
+    public static void transposeM(float[] mTrans, int mTransOffset, float[] m,
+            int mOffset) {
+        for (int i = 0; i < 4; i++) {
+            int mBase = i * 4 + mOffset;
+            mTrans[i + mTransOffset] = m[mBase];
+            mTrans[i + 4 + mTransOffset] = m[mBase + 1];
+            mTrans[i + 8 + mTransOffset] = m[mBase + 2];
+            mTrans[i + 12 + mTransOffset] = m[mBase + 3];
+        }
+    }
+
+    /**
+     * Inverts a 4 x 4 matrix.
+     * <p>
+     * mInv and m must not overlap.
+     *
+     * @param mInv the array that holds the output inverted matrix
+     * @param mInvOffset an offset into mInv where the inverted matrix is
+     *        stored.
+     * @param m the input array
+     * @param mOffset an offset into m where the input matrix is stored.
+     * @return true if the matrix could be inverted, false if it could not.
+     */
+    public static boolean invertM(float[] mInv, int mInvOffset, float[] m,
+            int mOffset) {
+        // Invert a 4 x 4 matrix using Cramer's Rule
+
+        // transpose matrix
+        final float src0  = m[mOffset +  0];
+        final float src4  = m[mOffset +  1];
+        final float src8  = m[mOffset +  2];
+        final float src12 = m[mOffset +  3];
+
+        final float src1  = m[mOffset +  4];
+        final float src5  = m[mOffset +  5];
+        final float src9  = m[mOffset +  6];
+        final float src13 = m[mOffset +  7];
+
+        final float src2  = m[mOffset +  8];
+        final float src6  = m[mOffset +  9];
+        final float src10 = m[mOffset + 10];
+        final float src14 = m[mOffset + 11];
+
+        final float src3  = m[mOffset + 12];
+        final float src7  = m[mOffset + 13];
+        final float src11 = m[mOffset + 14];
+        final float src15 = m[mOffset + 15];
+
+        // calculate pairs for first 8 elements (cofactors)
+        final float atmp0  = src10 * src15;
+        final float atmp1  = src11 * src14;
+        final float atmp2  = src9  * src15;
+        final float atmp3  = src11 * src13;
+        final float atmp4  = src9  * src14;
+        final float atmp5  = src10 * src13;
+        final float atmp6  = src8  * src15;
+        final float atmp7  = src11 * src12;
+        final float atmp8  = src8  * src14;
+        final float atmp9  = src10 * src12;
+        final float atmp10 = src8  * src13;
+        final float atmp11 = src9  * src12;
+
+        // calculate first 8 elements (cofactors)
+        final float dst0  = (atmp0 * src5 + atmp3 * src6 + atmp4  * src7)
+                          - (atmp1 * src5 + atmp2 * src6 + atmp5  * src7);
+        final float dst1  = (atmp1 * src4 + atmp6 * src6 + atmp9  * src7)
+                          - (atmp0 * src4 + atmp7 * src6 + atmp8  * src7);
+        final float dst2  = (atmp2 * src4 + atmp7 * src5 + atmp10 * src7)
+                          - (atmp3 * src4 + atmp6 * src5 + atmp11 * src7);
+        final float dst3  = (atmp5 * src4 + atmp8 * src5 + atmp11 * src6)
+                          - (atmp4 * src4 + atmp9 * src5 + atmp10 * src6);
+        final float dst4  = (atmp1 * src1 + atmp2 * src2 + atmp5  * src3)
+                          - (atmp0 * src1 + atmp3 * src2 + atmp4  * src3);
+        final float dst5  = (atmp0 * src0 + atmp7 * src2 + atmp8  * src3)
+                          - (atmp1 * src0 + atmp6 * src2 + atmp9  * src3);
+        final float dst6  = (atmp3 * src0 + atmp6 * src1 + atmp11 * src3)
+                          - (atmp2 * src0 + atmp7 * src1 + atmp10 * src3);
+        final float dst7  = (atmp4 * src0 + atmp9 * src1 + atmp10 * src2)
+                          - (atmp5 * src0 + atmp8 * src1 + atmp11 * src2);
+
+        // calculate pairs for second 8 elements (cofactors)
+        final float btmp0  = src2 * src7;
+        final float btmp1  = src3 * src6;
+        final float btmp2  = src1 * src7;
+        final float btmp3  = src3 * src5;
+        final float btmp4  = src1 * src6;
+        final float btmp5  = src2 * src5;
+        final float btmp6  = src0 * src7;
+        final float btmp7  = src3 * src4;
+        final float btmp8  = src0 * src6;
+        final float btmp9  = src2 * src4;
+        final float btmp10 = src0 * src5;
+        final float btmp11 = src1 * src4;
+
+        // calculate second 8 elements (cofactors)
+        final float dst8  = (btmp0  * src13 + btmp3  * src14 + btmp4  * src15)
+                          - (btmp1  * src13 + btmp2  * src14 + btmp5  * src15);
+        final float dst9  = (btmp1  * src12 + btmp6  * src14 + btmp9  * src15)
+                          - (btmp0  * src12 + btmp7  * src14 + btmp8  * src15);
+        final float dst10 = (btmp2  * src12 + btmp7  * src13 + btmp10 * src15)
+                          - (btmp3  * src12 + btmp6  * src13 + btmp11 * src15);
+        final float dst11 = (btmp5  * src12 + btmp8  * src13 + btmp11 * src14)
+                          - (btmp4  * src12 + btmp9  * src13 + btmp10 * src14);
+        final float dst12 = (btmp2  * src10 + btmp5  * src11 + btmp1  * src9 )
+                          - (btmp4  * src11 + btmp0  * src9  + btmp3  * src10);
+        final float dst13 = (btmp8  * src11 + btmp0  * src8  + btmp7  * src10)
+                          - (btmp6  * src10 + btmp9  * src11 + btmp1  * src8 );
+        final float dst14 = (btmp6  * src9  + btmp11 * src11 + btmp3  * src8 )
+                          - (btmp10 * src11 + btmp2  * src8  + btmp7  * src9 );
+        final float dst15 = (btmp10 * src10 + btmp4  * src8  + btmp9  * src9 )
+                          - (btmp8  * src9  + btmp11 * src10 + btmp5  * src8 );
+
+        // calculate determinant
+        final float det =
+                src0 * dst0 + src1 * dst1 + src2 * dst2 + src3 * dst3;
+
+        if (det == 0.0f) {
+            return false;
+        }
+
+        // calculate matrix inverse
+        final float invdet = 1.0f / det;
+        mInv[     mInvOffset] = dst0  * invdet;
+        mInv[ 1 + mInvOffset] = dst1  * invdet;
+        mInv[ 2 + mInvOffset] = dst2  * invdet;
+        mInv[ 3 + mInvOffset] = dst3  * invdet;
+
+        mInv[ 4 + mInvOffset] = dst4  * invdet;
+        mInv[ 5 + mInvOffset] = dst5  * invdet;
+        mInv[ 6 + mInvOffset] = dst6  * invdet;
+        mInv[ 7 + mInvOffset] = dst7  * invdet;
+
+        mInv[ 8 + mInvOffset] = dst8  * invdet;
+        mInv[ 9 + mInvOffset] = dst9  * invdet;
+        mInv[10 + mInvOffset] = dst10 * invdet;
+        mInv[11 + mInvOffset] = dst11 * invdet;
+
+        mInv[12 + mInvOffset] = dst12 * invdet;
+        mInv[13 + mInvOffset] = dst13 * invdet;
+        mInv[14 + mInvOffset] = dst14 * invdet;
+        mInv[15 + mInvOffset] = dst15 * invdet;
+
+        return true;
+    }
+
+    /**
+     * Computes an orthographic projection matrix.
+     *
+     * @param m returns the result
+     * @param mOffset
+     * @param left
+     * @param right
+     * @param bottom
+     * @param top
+     * @param near
+     * @param far
+     */
+    public static void orthoM(float[] m, int mOffset,
+        float left, float right, float bottom, float top,
+        float near, float far) {
+        if (left == right) {
+            throw new IllegalArgumentException("left == right");
+        }
+        if (bottom == top) {
+            throw new IllegalArgumentException("bottom == top");
+        }
+        if (near == far) {
+            throw new IllegalArgumentException("near == far");
+        }
+
+        final float r_width  = 1.0f / (right - left);
+        final float r_height = 1.0f / (top - bottom);
+        final float r_depth  = 1.0f / (far - near);
+        final float x =  2.0f * (r_width);
+        final float y =  2.0f * (r_height);
+        final float z = -2.0f * (r_depth);
+        final float tx = -(right + left) * r_width;
+        final float ty = -(top + bottom) * r_height;
+        final float tz = -(far + near) * r_depth;
+        m[mOffset + 0] = x;
+        m[mOffset + 5] = y;
+        m[mOffset +10] = z;
+        m[mOffset +12] = tx;
+        m[mOffset +13] = ty;
+        m[mOffset +14] = tz;
+        m[mOffset +15] = 1.0f;
+        m[mOffset + 1] = 0.0f;
+        m[mOffset + 2] = 0.0f;
+        m[mOffset + 3] = 0.0f;
+        m[mOffset + 4] = 0.0f;
+        m[mOffset + 6] = 0.0f;
+        m[mOffset + 7] = 0.0f;
+        m[mOffset + 8] = 0.0f;
+        m[mOffset + 9] = 0.0f;
+        m[mOffset + 11] = 0.0f;
+    }
+
+
+    /**
+     * Defines a projection matrix in terms of six clip planes.
+     *
+     * @param m the float array that holds the output perspective matrix
+     * @param offset the offset into float array m where the perspective
+     *        matrix data is written
+     * @param left
+     * @param right
+     * @param bottom
+     * @param top
+     * @param near
+     * @param far
+     */
+    public static void frustumM(float[] m, int offset,
+            float left, float right, float bottom, float top,
+            float near, float far) {
+        if (left == right) {
+            throw new IllegalArgumentException("left == right");
+        }
+        if (top == bottom) {
+            throw new IllegalArgumentException("top == bottom");
+        }
+        if (near == far) {
+            throw new IllegalArgumentException("near == far");
+        }
+        if (near <= 0.0f) {
+            throw new IllegalArgumentException("near <= 0.0f");
+        }
+        if (far <= 0.0f) {
+            throw new IllegalArgumentException("far <= 0.0f");
+        }
+        final float r_width  = 1.0f / (right - left);
+        final float r_height = 1.0f / (top - bottom);
+        final float r_depth  = 1.0f / (near - far);
+        final float x = 2.0f * (near * r_width);
+        final float y = 2.0f * (near * r_height);
+        final float A = (right + left) * r_width;
+        final float B = (top + bottom) * r_height;
+        final float C = (far + near) * r_depth;
+        final float D = 2.0f * (far * near * r_depth);
+        m[offset + 0] = x;
+        m[offset + 5] = y;
+        m[offset + 8] = A;
+        m[offset +  9] = B;
+        m[offset + 10] = C;
+        m[offset + 14] = D;
+        m[offset + 11] = -1.0f;
+        m[offset +  1] = 0.0f;
+        m[offset +  2] = 0.0f;
+        m[offset +  3] = 0.0f;
+        m[offset +  4] = 0.0f;
+        m[offset +  6] = 0.0f;
+        m[offset +  7] = 0.0f;
+        m[offset + 12] = 0.0f;
+        m[offset + 13] = 0.0f;
+        m[offset + 15] = 0.0f;
+    }
+
+    /**
+     * Defines a projection matrix in terms of a field of view angle, an
+     * aspect ratio, and z clip planes.
+     *
+     * @param m the float array that holds the perspective matrix
+     * @param offset the offset into float array m where the perspective
+     *        matrix data is written
+     * @param fovy field of view in y direction, in degrees
+     * @param aspect width to height aspect ratio of the viewport
+     * @param zNear
+     * @param zFar
+     */
+    public static void perspectiveM(float[] m, int offset,
+          float fovy, float aspect, float zNear, float zFar) {
+        float f = 1.0f / (float) Math.tan(fovy * (Math.PI / 360.0));
+        float rangeReciprocal = 1.0f / (zNear - zFar);
+
+        m[offset + 0] = f / aspect;
+        m[offset + 1] = 0.0f;
+        m[offset + 2] = 0.0f;
+        m[offset + 3] = 0.0f;
+
+        m[offset + 4] = 0.0f;
+        m[offset + 5] = f;
+        m[offset + 6] = 0.0f;
+        m[offset + 7] = 0.0f;
+
+        m[offset + 8] = 0.0f;
+        m[offset + 9] = 0.0f;
+        m[offset + 10] = (zFar + zNear) * rangeReciprocal;
+        m[offset + 11] = -1.0f;
+
+        m[offset + 12] = 0.0f;
+        m[offset + 13] = 0.0f;
+        m[offset + 14] = 2.0f * zFar * zNear * rangeReciprocal;
+        m[offset + 15] = 0.0f;
+    }
+
+    /**
+     * Computes the length of a vector.
+     *
+     * @param x x coordinate of a vector
+     * @param y y coordinate of a vector
+     * @param z z coordinate of a vector
+     * @return the length of a vector
+     */
+    public static float length(float x, float y, float z) {
+        return (float) Math.sqrt(x * x + y * y + z * z);
+    }
+
+    /**
+     * Sets matrix m to the identity matrix.
+     *
+     * @param sm returns the result
+     * @param smOffset index into sm where the result matrix starts
+     */
+    public static void setIdentityM(float[] sm, int smOffset) {
+        for (int i=0 ; i<16 ; i++) {
+            sm[smOffset + i] = 0;
+        }
+        for(int i = 0; i < 16; i += 5) {
+            sm[smOffset + i] = 1.0f;
+        }
+    }
+
+    /**
+     * Scales matrix m by x, y, and z, putting the result in sm.
+     * <p>
+     * m and sm must not overlap.
+     *
+     * @param sm returns the result
+     * @param smOffset index into sm where the result matrix starts
+     * @param m source matrix
+     * @param mOffset index into m where the source matrix starts
+     * @param x scale factor x
+     * @param y scale factor y
+     * @param z scale factor z
+     */
+    public static void scaleM(float[] sm, int smOffset,
+            float[] m, int mOffset,
+            float x, float y, float z) {
+        for (int i=0 ; i<4 ; i++) {
+            int smi = smOffset + i;
+            int mi = mOffset + i;
+            sm[     smi] = m[     mi] * x;
+            sm[ 4 + smi] = m[ 4 + mi] * y;
+            sm[ 8 + smi] = m[ 8 + mi] * z;
+            sm[12 + smi] = m[12 + mi];
+        }
+    }
+
+    /**
+     * Scales matrix m in place by sx, sy, and sz.
+     *
+     * @param m matrix to scale
+     * @param mOffset index into m where the matrix starts
+     * @param x scale factor x
+     * @param y scale factor y
+     * @param z scale factor z
+     */
+    public static void scaleM(float[] m, int mOffset,
+            float x, float y, float z) {
+        for (int i=0 ; i<4 ; i++) {
+            int mi = mOffset + i;
+            m[     mi] *= x;
+            m[ 4 + mi] *= y;
+            m[ 8 + mi] *= z;
+        }
+    }
+
+    /**
+     * Translates matrix m by x, y, and z, putting the result in tm.
+     * <p>
+     * m and tm must not overlap.
+     *
+     * @param tm returns the result
+     * @param tmOffset index into sm where the result matrix starts
+     * @param m source matrix
+     * @param mOffset index into m where the source matrix starts
+     * @param x translation factor x
+     * @param y translation factor y
+     * @param z translation factor z
+     */
+    public static void translateM(float[] tm, int tmOffset,
+            float[] m, int mOffset,
+            float x, float y, float z) {
+        for (int i=0 ; i<12 ; i++) {
+            tm[tmOffset + i] = m[mOffset + i];
+        }
+        for (int i=0 ; i<4 ; i++) {
+            int tmi = tmOffset + i;
+            int mi = mOffset + i;
+            tm[12 + tmi] = m[mi] * x + m[4 + mi] * y + m[8 + mi] * z +
+                m[12 + mi];
+        }
+    }
+
+    /**
+     * Translates matrix m by x, y, and z in place.
+     *
+     * @param m matrix
+     * @param mOffset index into m where the matrix starts
+     * @param x translation factor x
+     * @param y translation factor y
+     * @param z translation factor z
+     */
+    public static void translateM(
+            float[] m, int mOffset,
+            float x, float y, float z) {
+        for (int i=0 ; i<4 ; i++) {
+            int mi = mOffset + i;
+            m[12 + mi] += m[mi] * x + m[4 + mi] * y + m[8 + mi] * z;
+        }
+    }
+
+    /**
+     * Rotates matrix m by angle a (in degrees) around the axis (x, y, z).
+     * <p>
+     * m and rm must not overlap.
+     *
+     * @param rm returns the result
+     * @param rmOffset index into rm where the result matrix starts
+     * @param m source matrix
+     * @param mOffset index into m where the source matrix starts
+     * @param a angle to rotate in degrees
+     * @param x X axis component
+     * @param y Y axis component
+     * @param z Z axis component
+     */
+    public static void rotateM(float[] rm, int rmOffset,
+            float[] m, int mOffset,
+            float a, float x, float y, float z) {
+        synchronized(sTemp) {
+            setRotateM(sTemp, 0, a, x, y, z);
+            multiplyMM(rm, rmOffset, m, mOffset, sTemp, 0);
+        }
+    }
+
+    /**
+     * Rotates matrix m in place by angle a (in degrees)
+     * around the axis (x, y, z).
+     *
+     * @param m source matrix
+     * @param mOffset index into m where the matrix starts
+     * @param a angle to rotate in degrees
+     * @param x X axis component
+     * @param y Y axis component
+     * @param z Z axis component
+     */
+    public static void rotateM(float[] m, int mOffset,
+            float a, float x, float y, float z) {
+        synchronized(sTemp) {
+            setRotateM(sTemp, 0, a, x, y, z);
+            multiplyMM(sTemp, 16, m, mOffset, sTemp, 0);
+            System.arraycopy(sTemp, 16, m, mOffset, 16);
+        }
+    }
+
+    /**
+     * Creates a matrix for rotation by angle a (in degrees)
+     * around the axis (x, y, z).
+     * <p>
+     * An optimized path will be used for rotation about a major axis
+     * (e.g. x=1.0f y=0.0f z=0.0f).
+     *
+     * @param rm returns the result
+     * @param rmOffset index into rm where the result matrix starts
+     * @param a angle to rotate in degrees
+     * @param x X axis component
+     * @param y Y axis component
+     * @param z Z axis component
+     */
+    public static void setRotateM(float[] rm, int rmOffset,
+            float a, float x, float y, float z) {
+        rm[rmOffset + 3] = 0;
+        rm[rmOffset + 7] = 0;
+        rm[rmOffset + 11]= 0;
+        rm[rmOffset + 12]= 0;
+        rm[rmOffset + 13]= 0;
+        rm[rmOffset + 14]= 0;
+        rm[rmOffset + 15]= 1;
+        a *= (float) (Math.PI / 180.0f);
+        float s = (float) Math.sin(a);
+        float c = (float) Math.cos(a);
+        if (1.0f == x && 0.0f == y && 0.0f == z) {
+            rm[rmOffset + 5] = c;   rm[rmOffset + 10]= c;
+            rm[rmOffset + 6] = s;   rm[rmOffset + 9] = -s;
+            rm[rmOffset + 1] = 0;   rm[rmOffset + 2] = 0;
+            rm[rmOffset + 4] = 0;   rm[rmOffset + 8] = 0;
+            rm[rmOffset + 0] = 1;
+        } else if (0.0f == x && 1.0f == y && 0.0f == z) {
+            rm[rmOffset + 0] = c;   rm[rmOffset + 10]= c;
+            rm[rmOffset + 8] = s;   rm[rmOffset + 2] = -s;
+            rm[rmOffset + 1] = 0;   rm[rmOffset + 4] = 0;
+            rm[rmOffset + 6] = 0;   rm[rmOffset + 9] = 0;
+            rm[rmOffset + 5] = 1;
+        } else if (0.0f == x && 0.0f == y && 1.0f == z) {
+            rm[rmOffset + 0] = c;   rm[rmOffset + 5] = c;
+            rm[rmOffset + 1] = s;   rm[rmOffset + 4] = -s;
+            rm[rmOffset + 2] = 0;   rm[rmOffset + 6] = 0;
+            rm[rmOffset + 8] = 0;   rm[rmOffset + 9] = 0;
+            rm[rmOffset + 10]= 1;
+        } else {
+            float len = length(x, y, z);
+            if (1.0f != len) {
+                float recipLen = 1.0f / len;
+                x *= recipLen;
+                y *= recipLen;
+                z *= recipLen;
+            }
+            float nc = 1.0f - c;
+            float xy = x * y;
+            float yz = y * z;
+            float zx = z * x;
+            float xs = x * s;
+            float ys = y * s;
+            float zs = z * s;
+            rm[rmOffset +  0] = x*x*nc +  c;
+            rm[rmOffset +  4] =  xy*nc - zs;
+            rm[rmOffset +  8] =  zx*nc + ys;
+            rm[rmOffset +  1] =  xy*nc + zs;
+            rm[rmOffset +  5] = y*y*nc +  c;
+            rm[rmOffset +  9] =  yz*nc - xs;
+            rm[rmOffset +  2] =  zx*nc - ys;
+            rm[rmOffset +  6] =  yz*nc + xs;
+            rm[rmOffset + 10] = z*z*nc +  c;
+        }
+    }
+
+    /**
+     * Converts Euler angles to a rotation matrix.
+     *
+     * @param rm returns the result
+     * @param rmOffset index into rm where the result matrix starts
+     * @param x angle of rotation, in degrees
+     * @param y angle of rotation, in degrees
+     * @param z angle of rotation, in degrees
+     */
+    public static void setRotateEulerM(float[] rm, int rmOffset,
+            float x, float y, float z) {
+        x *= (float) (Math.PI / 180.0f);
+        y *= (float) (Math.PI / 180.0f);
+        z *= (float) (Math.PI / 180.0f);
+        float cx = (float) Math.cos(x);
+        float sx = (float) Math.sin(x);
+        float cy = (float) Math.cos(y);
+        float sy = (float) Math.sin(y);
+        float cz = (float) Math.cos(z);
+        float sz = (float) Math.sin(z);
+        float cxsy = cx * sy;
+        float sxsy = sx * sy;
+
+        rm[rmOffset + 0]  =   cy * cz;
+        rm[rmOffset + 1]  =  -cy * sz;
+        rm[rmOffset + 2]  =   sy;
+        rm[rmOffset + 3]  =  0.0f;
+
+        rm[rmOffset + 4]  =  cxsy * cz + cx * sz;
+        rm[rmOffset + 5]  = -cxsy * sz + cx * cz;
+        rm[rmOffset + 6]  =  -sx * cy;
+        rm[rmOffset + 7]  =  0.0f;
+
+        rm[rmOffset + 8]  = -sxsy * cz + sx * sz;
+        rm[rmOffset + 9]  =  sxsy * sz + sx * cz;
+        rm[rmOffset + 10] =  cx * cy;
+        rm[rmOffset + 11] =  0.0f;
+
+        rm[rmOffset + 12] =  0.0f;
+        rm[rmOffset + 13] =  0.0f;
+        rm[rmOffset + 14] =  0.0f;
+        rm[rmOffset + 15] =  1.0f;
+    }
+
+    /**
+     * Defines a viewing transformation in terms of an eye point, a center of
+     * view, and an up vector.
+     *
+     * @param rm returns the result
+     * @param rmOffset index into rm where the result matrix starts
+     * @param eyeX eye point X
+     * @param eyeY eye point Y
+     * @param eyeZ eye point Z
+     * @param centerX center of view X
+     * @param centerY center of view Y
+     * @param centerZ center of view Z
+     * @param upX up vector X
+     * @param upY up vector Y
+     * @param upZ up vector Z
+     */
+    public static void setLookAtM(float[] rm, int rmOffset,
+            float eyeX, float eyeY, float eyeZ,
+            float centerX, float centerY, float centerZ, float upX, float upY,
+            float upZ) {
+
+        // See the OpenGL GLUT documentation for gluLookAt for a description
+        // of the algorithm. We implement it in a straightforward way:
+
+        float fx = centerX - eyeX;
+        float fy = centerY - eyeY;
+        float fz = centerZ - eyeZ;
+
+        // Normalize f
+        float rlf = 1.0f / Matrix.length(fx, fy, fz);
+        fx *= rlf;
+        fy *= rlf;
+        fz *= rlf;
+
+        // compute s = f x up (x means "cross product")
+        float sx = fy * upZ - fz * upY;
+        float sy = fz * upX - fx * upZ;
+        float sz = fx * upY - fy * upX;
+
+        // and normalize s
+        float rls = 1.0f / Matrix.length(sx, sy, sz);
+        sx *= rls;
+        sy *= rls;
+        sz *= rls;
+
+        // compute u = s x f
+        float ux = sy * fz - sz * fy;
+        float uy = sz * fx - sx * fz;
+        float uz = sx * fy - sy * fx;
+
+        rm[rmOffset + 0] = sx;
+        rm[rmOffset + 1] = ux;
+        rm[rmOffset + 2] = -fx;
+        rm[rmOffset + 3] = 0.0f;
+
+        rm[rmOffset + 4] = sy;
+        rm[rmOffset + 5] = uy;
+        rm[rmOffset + 6] = -fy;
+        rm[rmOffset + 7] = 0.0f;
+
+        rm[rmOffset + 8] = sz;
+        rm[rmOffset + 9] = uz;
+        rm[rmOffset + 10] = -fz;
+        rm[rmOffset + 11] = 0.0f;
+
+        rm[rmOffset + 12] = 0.0f;
+        rm[rmOffset + 13] = 0.0f;
+        rm[rmOffset + 14] = 0.0f;
+        rm[rmOffset + 15] = 1.0f;
+
+        translateM(rm, rmOffset, -eyeX, -eyeY, -eyeZ);
+    }
+}
diff --git a/android/opengl/Visibility.java b/android/opengl/Visibility.java
new file mode 100644
index 0000000..40e446f
--- /dev/null
+++ b/android/opengl/Visibility.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.opengl;
+
+/**
+ * A collection of utility methods for computing the visibility of triangle
+ * meshes.
+ *
+ */
+public class Visibility {
+    /**
+     * Test whether a given triangle mesh is visible on the screen. The mesh
+     * is specified as an indexed triangle list.
+     *
+     * @param ws the world space to screen space transform matrix, as an OpenGL
+     * column matrix.
+     * @param wsOffset an index into the ws array where the data starts.
+     * @param positions the vertex positions (x, y, z).
+     * @param positionsOffset the index in the positions array where the data
+     *        starts.
+     * @param indices the indices of the triangle list. The indices are
+     * expressed as chars because they are unsigned 16-bit values.
+     * @param indicesOffset the index in the indices array where the index data
+     *        starts.
+     * @param indexCount the number of indices in use. Typically a multiple of
+     * three. If not a multiple of three, the remaining one or two indices will
+     * be ignored.
+     * @return 2 if all of the mesh is visible, 1 if some part of the mesh is
+     *         visible, 0 if no part is visible.
+     *
+     * @throws IllegalArgumentException if ws is null, wsOffset < 0,
+     * positions is null, positionsOffset < 0, indices is null,
+     * indicesOffset < 0, indicesOffset > indices.length - indexCount
+     */
+    public static native int visibilityTest(float[] ws, int wsOffset,
+            float[] positions, int positionsOffset, char[] indices,
+            int indicesOffset, int indexCount);
+
+    /**
+     * Given an OpenGL ES ModelView-Projection matrix (which implicitly
+     * describes a frustum) and a list of spheres, determine which spheres
+     * intersect the frustum.
+     * <p>
+     * A ModelView-Projection matrix can be computed by multiplying the
+     * a Projection matrix by the a ModelView matrix (in that order.). There
+     * are several possible ways to obtain the current ModelView and
+     * Projection matrices. The most generally applicable way is to keep
+     * track of the current matrices in application code. If that is not
+     * convenient, there are two optional OpenGL ES extensions which may
+     * be used to read the current matrices from OpenGL ES:
+     * <ul>
+     * <li>GL10Ext.glQueryMatrixxOES
+     * <li>GL11.GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES and
+     * GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES
+     * </ul>
+     * The problem with reading back the matrices is that your application
+     * will only work with devices that support the extension(s) that
+     * it uses.
+     * <p>
+     * A frustum is a six-sided truncated pyramid that defines the portion of
+     * world space that is visible in the view.
+     * <p>
+     * Spheres are described as four floating point values: x, y, z, and r, in
+     * world-space coordinates. R is the radius of the sphere.
+     * <p>
+     * @param mvp a float array containing the mode-view-projection matrix
+     * @param mvpOffset The offset of the mvp data within the mvp array.
+     * @param spheres a float array containing the sphere data.
+     * @param spheresOffset an offset into the sphere array where the sphere
+     *        data starts
+     * @param spheresCount the number of spheres to cull.
+     * @param results an integer array containing the indices of the spheres
+     * that are either contained entirely within or intersect the frustum.
+     * @param resultsOffset an offset into the results array where the results
+     *        start.
+     * @param resultsCapacity the number of array elements available for storing
+     *        results.
+     * @return the number of spheres that intersected the frustum. Can be
+     * larger than resultsCapacity, in which case only the first resultsCapacity
+     * results are written into the results array.
+     *
+     * @throws IllegalArgumentException if mvp is null, mvpOffset < 0,
+     * mvpOffset > mvp.length - 16, spheres is null, spheresOffset < 0,
+     * spheresOffset > spheres.length - sphereCount,
+     * results is null, resultsOffset < 0, resultsOffset > results.length -
+     * resultsCapacity.
+     */
+    public static native int frustumCullSpheres(float[] mvp, int mvpOffset,
+            float[] spheres, int spheresOffset, int spheresCount,
+            int[] results, int resultsOffset, int resultsCapacity);
+
+    /**
+     * Compute a bounding sphere for a set of points. It is approximately the
+     * minimal bounding sphere of an axis-aligned box that bounds the points.
+     *
+     * @param positions positions in x, y, z triples
+     * @param positionsOffset offset into positions array
+     * @param positionsCount number of position triples to process
+     * @param sphere array containing the output as (x, y, z, r)
+     * @param sphereOffset offset where the sphere data will be written
+     *
+     * @throws IllegalArgumentException if positions is null,
+     * positionsOffset < 0, positionsOffset > positions.length - positionsCount,
+     * sphere is null, sphereOffset < 0, sphereOffset > sphere.length - 4.
+     */
+    public static native void computeBoundingSphere(float[] positions,
+            int positionsOffset, int positionsCount, float[] sphere,
+            int sphereOffset);
+}