donut snapshot
diff --git a/opengl/include/GLES/glext.h b/opengl/include/GLES/glext.h
index 4c01871..a8fe2e9 100644
--- a/opengl/include/GLES/glext.h
+++ b/opengl/include/GLES/glext.h
@@ -599,21 +599,6 @@
 #define GL_EXT_texture_filter_anisotropic 1
 #endif
 
-/*------------------------------------------------------------------------*
- * dalvik extension functions
- *------------------------------------------------------------------------*/
-#ifdef ANDROID
-void glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
-        const GLvoid *ptr, GLsizei count);
-void glNormalPointerBounds(GLenum type, GLsizei stride,
-        const GLvoid *pointer, GLsizei count);
-void glTexCoordPointerBounds(GLint size, GLenum type,
-        GLsizei stride, const GLvoid *pointer, GLsizei count);
-void glVertexPointerBounds(GLint size, GLenum type,
-        GLsizei stride, const GLvoid *pointer, GLsizei count);
-#endif
-
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/opengl/include/KHR/khrplatform.h b/opengl/include/KHR/khrplatform.h
index 4cc27c5..1660bd7 100644
--- a/opengl/include/KHR/khrplatform.h
+++ b/opengl/include/KHR/khrplatform.h
@@ -91,6 +91,8 @@
 #   define KHRONOS_APICALL __declspec(dllimport)
 #elif defined (__SYMBIAN32__)
 #   define KHRONOS_APICALL IMPORT_C
+#elif defined(ANDROID)
+#   define KHRONOS_APICALL __attribute__((visibility("default")))
 #else
 #   define KHRONOS_APICALL
 #endif
diff --git a/opengl/libagl/Android.mk b/opengl/libagl/Android.mk
index 99efe4c..3ce0414 100644
--- a/opengl/libagl/Android.mk
+++ b/opengl/libagl/Android.mk
@@ -33,6 +33,8 @@
 endif
 
 LOCAL_SHARED_LIBRARIES := libcutils libutils libpixelflinger
+LOCAL_CFLAGS += -fvisibility=hidden
+
 LOCAL_LDLIBS := -lpthread -ldl
 LOCAL_MODULE:= libagl
 
diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp
index 3b4c041..c44478d 100644
--- a/opengl/libagl/egl.cpp
+++ b/opengl/libagl/egl.cpp
@@ -1,17 +1,17 @@
-/* 
+/*
 **
 ** Copyright 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 
+** 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 
+**     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 
+** 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.
 */
 
@@ -478,22 +478,38 @@
 };
 
 static const extention_map_t gExtentionMap[] = {
-    { "glDrawTexsOES",              (void(*)())&glDrawTexsOES },
-    { "glDrawTexiOES",              (void(*)())&glDrawTexiOES },
-    { "glDrawTexfOES",              (void(*)())&glDrawTexfOES },
-    { "glDrawTexxOES",              (void(*)())&glDrawTexxOES },
-    { "glDrawTexsvOES",             (void(*)())&glDrawTexsvOES },
-    { "glDrawTexivOES",             (void(*)())&glDrawTexivOES },
-    { "glDrawTexfvOES",             (void(*)())&glDrawTexfvOES },
-    { "glDrawTexxvOES",             (void(*)())&glDrawTexxvOES },
-    { "glQueryMatrixxOES",          (void(*)())&glQueryMatrixxOES },
-    { "glClipPlanef",               (void(*)())&glClipPlanef },
-    { "glClipPlanex",               (void(*)())&glClipPlanex },
-    { "glBindBuffer",               (void(*)())&glBindBuffer },
-    { "glBufferData",               (void(*)())&glBufferData },
-    { "glBufferSubData",            (void(*)())&glBufferSubData },
-    { "glDeleteBuffers",            (void(*)())&glDeleteBuffers },
-    { "glGenBuffers",               (void(*)())&glGenBuffers },
+    { "glDrawTexsOES",
+            (__eglMustCastToProperFunctionPointerType)&glDrawTexsOES },
+    { "glDrawTexiOES",
+            (__eglMustCastToProperFunctionPointerType)&glDrawTexiOES },
+    { "glDrawTexfOES",
+            (__eglMustCastToProperFunctionPointerType)&glDrawTexfOES },
+    { "glDrawTexxOES",
+            (__eglMustCastToProperFunctionPointerType)&glDrawTexxOES },
+    { "glDrawTexsvOES",
+            (__eglMustCastToProperFunctionPointerType)&glDrawTexsvOES },
+    { "glDrawTexivOES",
+            (__eglMustCastToProperFunctionPointerType)&glDrawTexivOES },
+    { "glDrawTexfvOES",
+            (__eglMustCastToProperFunctionPointerType)&glDrawTexfvOES },
+    { "glDrawTexxvOES",
+            (__eglMustCastToProperFunctionPointerType)&glDrawTexxvOES },
+    { "glQueryMatrixxOES",
+            (__eglMustCastToProperFunctionPointerType)&glQueryMatrixxOES },
+    { "glClipPlanef",
+            (__eglMustCastToProperFunctionPointerType)&glClipPlanef },
+    { "glClipPlanex",
+            (__eglMustCastToProperFunctionPointerType)&glClipPlanex },
+    { "glBindBuffer",
+            (__eglMustCastToProperFunctionPointerType)&glBindBuffer },
+    { "glBufferData",
+            (__eglMustCastToProperFunctionPointerType)&glBufferData },
+    { "glBufferSubData",
+            (__eglMustCastToProperFunctionPointerType)&glBufferSubData },
+    { "glDeleteBuffers",
+            (__eglMustCastToProperFunctionPointerType)&glDeleteBuffers },
+    { "glGenBuffers",
+            (__eglMustCastToProperFunctionPointerType)&glGenBuffers },
 };
 
 /* 
@@ -1299,6 +1315,8 @@
         }
     }
 
+    // TODO: call connect / disconnect on the surface
+
     ogles_context_t* gl = (ogles_context_t*)ctx;
     if (makeCurrent(gl) == 0) {
         if (ctx) {
diff --git a/opengl/libs/Android.mk b/opengl/libs/Android.mk
index 2ecc776..5ba6b76 100644
--- a/opengl/libs/Android.mk
+++ b/opengl/libs/Android.mk
@@ -23,6 +23,8 @@
     LOCAL_CFLAGS += -I$(LOCAL_PATH)/../../../../bionic/libc/private
 endif
 
+LOCAL_CFLAGS += -fvisibility=hidden
+
 include $(BUILD_SHARED_LIBRARY)
 
 
@@ -35,7 +37,6 @@
 
 LOCAL_SRC_FILES:= 	\
 	GLES_CM/gl.cpp.arm 		\
-	GLES_CM/gl_logger.cpp 	\
 #
 
 LOCAL_SHARED_LIBRARIES += libcutils libutils libui libEGL
@@ -50,4 +51,6 @@
     LOCAL_CFLAGS += -I$(LOCAL_PATH)/../../../../bionic/libc/private
 endif
 
+LOCAL_CFLAGS += -fvisibility=hidden
+
 include $(BUILD_SHARED_LIBRARY)
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index 0b4bcce..25e31ee 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -14,7 +14,7 @@
  ** limitations under the License.
  */
 
-#define LOG_TAG "GLLogger"
+#define LOG_TAG "libEGL"
 
 #include <ctype.h>
 #include <string.h>
@@ -69,9 +69,9 @@
 
 struct egl_display_t : public egl_object_t<'_dpy'>
 {
-    EGLDisplay  dpys[2];
-    EGLConfig*  configs[2];
-    EGLint      numConfigs[2];
+    EGLDisplay  dpys[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
+    EGLConfig*  configs[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
+    EGLint      numConfigs[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
     EGLint      numTotalConfigs;
     char const* extensionsString;
     volatile int32_t refs;
@@ -81,7 +81,7 @@
         char const * clientApi;
         char const * extensions;
     };
-    strings_t   queryString[2];
+    strings_t   queryString[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
 };
 
 struct egl_surface_t : public egl_object_t<'_srf'>
@@ -143,6 +143,7 @@
 
 static char const * const gl_names[] = {
     #include "gl_entries.in"
+    #include "glext_entries.in"
     NULL
 };
 
@@ -156,15 +157,15 @@
 
 // ----------------------------------------------------------------------------
 
-egl_connection_t gEGLImpl[2];
+egl_connection_t gEGLImpl[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
 static egl_display_t gDisplay[NUM_DISPLAYS];
 static pthread_mutex_t gThreadLocalStorageKeyMutex = PTHREAD_MUTEX_INITIALIZER;
 static pthread_key_t gEGLThreadLocalStorageKey = -1;
 
 // ----------------------------------------------------------------------------
 
-gl_hooks_t gHooks[IMPL_NUM_IMPLEMENTATIONS];
-pthread_key_t gGLWrapperKey = -1;
+EGLAPI gl_hooks_t gHooks[IMPL_NUM_IMPLEMENTATIONS];
+EGLAPI pthread_key_t gGLWrapperKey = -1;
 
 // ----------------------------------------------------------------------------
 
@@ -272,35 +273,81 @@
 static __attribute__((noinline))
 void *load_driver(const char* driver, gl_hooks_t* hooks)
 {
+    //LOGD("%s", driver);
+    char scrap[256];
     void* dso = dlopen(driver, RTLD_NOW | RTLD_LOCAL);
     LOGE_IF(!dso,
             "couldn't load <%s> library (%s)",
             driver, dlerror());
 
     if (dso) {
-        void** curr;
+        // first find the symbol for eglGetProcAddress
+        
+        typedef __eglMustCastToProperFunctionPointerType (*getProcAddressType)(
+                const char*);
+        
+        getProcAddressType getProcAddress = 
+            (getProcAddressType)dlsym(dso, "eglGetProcAddress");
+        
+        LOGE_IF(!getProcAddress, 
+                "can't find eglGetProcAddress() in %s", driver);        
+        
+        __eglMustCastToProperFunctionPointerType* curr;
         char const * const * api;
-        gl_hooks_t::gl_t* gl = &hooks->gl;
-        curr = (void**)gl;
-        api = gl_names;
+
+        gl_hooks_t::egl_t* egl = &hooks->egl;
+        curr = (__eglMustCastToProperFunctionPointerType*)egl;
+        api = egl_names;
         while (*api) {
-            void* f = dlsym(dso, *api);
-            //LOGD("<%s> @ 0x%p", *api, f);
+            char const * name = *api;
+            __eglMustCastToProperFunctionPointerType f = 
+                (__eglMustCastToProperFunctionPointerType)dlsym(dso, name);
             if (f == NULL) {
-                //LOGW("<%s> not found in %s", *api, driver);
-                f = (void*)gl_unimplemented;
+                // couldn't find the entry-point, use eglGetProcAddress()
+                f = getProcAddress(name);
+                if (f == NULL) {
+                    f = (__eglMustCastToProperFunctionPointerType)0;
+                }
             }
             *curr++ = f;
             api++;
         }
-        gl_hooks_t::egl_t* egl = &hooks->egl;
-        curr = (void**)egl;
-        api = egl_names;
+
+        gl_hooks_t::gl_t* gl = &hooks->gl;
+        curr = (__eglMustCastToProperFunctionPointerType*)gl;
+        api = gl_names;
         while (*api) {
-            void* f = dlsym(dso, *api);
+            char const * name = *api;
+            __eglMustCastToProperFunctionPointerType f = 
+                (__eglMustCastToProperFunctionPointerType)dlsym(dso, name);
             if (f == NULL) {
-                //LOGW("<%s> not found in %s", *api, driver);
-                f = (void*)0;
+                // couldn't find the entry-point, use eglGetProcAddress()
+                f = getProcAddress(name);
+            }
+            if (f == NULL) {
+                // Try without the OES postfix
+                ssize_t index = ssize_t(strlen(name)) - 3;
+                if ((index>0 && (index<255)) && (!strcmp(name+index, "OES"))) {
+                    strncpy(scrap, name, index);
+                    scrap[index] = 0;
+                    f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap);
+                    //LOGD_IF(f, "found <%s> instead", scrap);
+                }
+            }
+            if (f == NULL) {
+                // Try with the OES postfix
+                ssize_t index = ssize_t(strlen(name)) - 3;
+                if ((index>0 && (index<252)) && (strcmp(name+index, "OES"))) {
+                    strncpy(scrap, name, index);
+                    scrap[index] = 0;
+                    strcat(scrap, "OES");
+                    f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap);
+                    //LOGD_IF(f, "found <%s> instead", scrap);
+                }
+            }
+            if (f == NULL) {
+                //LOGD("%s", name);
+                f = (__eglMustCastToProperFunctionPointerType)gl_unimplemented;
             }
             *curr++ = f;
             api++;
@@ -429,18 +476,19 @@
     return (index >= NUM_DISPLAYS) ? NULL : &gDisplay[index];
 }
 
-static inline
-egl_surface_t* get_surface(EGLSurface surface)
-{
-    egl_surface_t* s = (egl_surface_t *)surface;
-    return s;
+template<typename NATIVE, typename EGL>
+static inline NATIVE* egl_to_native_cast(EGL arg) {
+    return reinterpret_cast<NATIVE*>(arg);
 }
 
 static inline
-egl_context_t* get_context(EGLContext context)
-{
-    egl_context_t* c = (egl_context_t *)context;
-    return c;
+egl_surface_t* get_surface(EGLSurface surface) {   
+    return egl_to_native_cast<egl_surface_t>(surface);
+}
+
+static inline
+egl_context_t* get_context(EGLContext context) {
+    return egl_to_native_cast<egl_context_t>(context);
 }
 
 static egl_connection_t* validate_display_config(
@@ -451,7 +499,7 @@
     if (!dp) return setError(EGL_BAD_DISPLAY, (egl_connection_t*)NULL);
 
     impl = uintptr_t(config)>>24;
-    if (uint32_t(impl) >= 2) {
+    if (uint32_t(impl) >= IMPL_NUM_DRIVERS_IMPLEMENTATIONS) {
         return setError(EGL_BAD_CONFIG, (egl_connection_t*)NULL);
     } 
     index = uintptr_t(config) & 0xFFFFFF;
@@ -491,13 +539,8 @@
     return EGL_TRUE;
 }
 
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
 
-using namespace android;
-
-EGLDisplay eglGetDisplay(NativeDisplayType display)
+EGLDisplay egl_init_displays(NativeDisplayType display)
 {
     if (sEarlyInitState) {
         return EGL_NO_DISPLAY;
@@ -510,7 +553,7 @@
     
     EGLDisplay dpy = EGLDisplay(uintptr_t(display) + 1LU);
     egl_display_t* d = &gDisplay[index];
-        
+
     // dynamically load all our EGL implementations for that display
     // and call into the real eglGetGisplay()
     egl_connection_t* cnx = &gEGLImpl[IMPL_SOFTWARE];
@@ -573,6 +616,18 @@
     return dpy;
 }
 
+
+// ----------------------------------------------------------------------------
+}; // namespace android
+// ----------------------------------------------------------------------------
+
+using namespace android;
+
+EGLDisplay eglGetDisplay(NativeDisplayType display)
+{
+    return egl_init_displays(display);
+}
+
 // ----------------------------------------------------------------------------
 // Initialization
 // ----------------------------------------------------------------------------
@@ -594,7 +649,7 @@
     // build our own extension string first, based on the extension we know
     // and the extension supported by our client implementation
     dp->extensionsString = strdup(gExtensionString);
-    for (int i=0 ; i<2 ; i++) {
+    for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
         egl_connection_t* const cnx = &gEGLImpl[i];
         cnx->major = -1;
         cnx->minor = -1;
@@ -624,7 +679,7 @@
     }
 
     EGLBoolean res = EGL_FALSE;
-    for (int i=0 ; i<2 ; i++) {
+    for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
         egl_connection_t* const cnx = &gEGLImpl[i];
         if (cnx->dso && cnx->major>=0 && cnx->minor>=0) {
             EGLint n;
@@ -663,7 +718,7 @@
         return EGL_TRUE;
         
     EGLBoolean res = EGL_FALSE;
-    for (int i=0 ; i<2 ; i++) {
+    for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
         egl_connection_t* const cnx = &gEGLImpl[i];
         if (cnx->dso) {
             cnx->hooks->egl.eglTerminate(dp->dpys[i]);
@@ -706,7 +761,7 @@
         return EGL_TRUE;
     }
     GLint n = 0;
-    for (int j=0 ; j<2 ; j++) {
+    for (int j=0 ; j<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; j++) {
         for (int i=0 ; i<dp->numConfigs[j] && config_size ; i++) {
             *configs++ = MAKE_CONFIG(j, i);
             config_size--;
@@ -794,7 +849,7 @@
         return res;
     }
 
-    for (int i=0 ; i<2 ; i++) {
+    for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
         egl_connection_t* const cnx = &gEGLImpl[i];
         if (cnx->dso) {
             if (cnx->hooks->egl.eglChooseConfig(
@@ -1107,7 +1162,7 @@
 EGLint eglGetError(void)
 {
     EGLint result = EGL_SUCCESS;
-    for (int i=0 ; i<2 ; i++) {
+    for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
         EGLint err = EGL_SUCCESS;
         egl_connection_t* const cnx = &gEGLImpl[i];
         if (cnx->dso)
@@ -1120,8 +1175,15 @@
     return result;
 }
 
-void (*eglGetProcAddress(const char *procname))()
+__eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
 {
+    // eglGetProcAddress() could be the very first function called
+    // in which case we must make sure we've initialized ourselves, this
+    // happens the first time egl_get_display() is called.
+    
+    if (egl_init_displays(EGL_DEFAULT_DISPLAY) == EGL_NO_DISPLAY)
+        return NULL;
+
     __eglMustCastToProperFunctionPointerType addr;
     addr = findProcAddress(procname, gExtentionMap, NELEM(gExtentionMap));
     if (addr) return addr;
@@ -1133,7 +1195,7 @@
     
     addr = 0;
     int slot = -1;
-    for (int i=0 ; i<2 ; i++) {
+    for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
         egl_connection_t* const cnx = &gEGLImpl[i];
         if (cnx->dso) {
             if (cnx->hooks->egl.eglGetProcAddress) {
@@ -1266,7 +1328,7 @@
     if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE);
 
     EGLBoolean res = EGL_TRUE;
-    for (int i=0 ; i<2 ; i++) {
+    for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
         egl_connection_t* const cnx = &gEGLImpl[i];
         if (cnx->dso) {
             if (cnx->hooks->egl.eglSwapInterval) {
@@ -1309,7 +1371,7 @@
 {
     // bind this API on all EGLs
     EGLBoolean res = EGL_TRUE;
-    for (int i=0 ; i<2 ; i++) {
+    for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
         egl_connection_t* const cnx = &gEGLImpl[i];
         if (cnx->dso) {
             if (cnx->hooks->egl.eglBindAPI) {
@@ -1324,7 +1386,7 @@
 
 EGLenum eglQueryAPI(void)
 {
-    for (int i=0 ; i<2 ; i++) {
+    for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
         egl_connection_t* const cnx = &gEGLImpl[i];
         if (cnx->dso) {
             if (cnx->hooks->egl.eglQueryAPI) {
@@ -1340,7 +1402,7 @@
 
 EGLBoolean eglReleaseThread(void)
 {
-    for (int i=0 ; i<2 ; i++) {
+    for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
         egl_connection_t* const cnx = &gEGLImpl[i];
         if (cnx->dso) {
             if (cnx->hooks->egl.eglReleaseThread) {
diff --git a/opengl/libs/EGL/gpu.cpp b/opengl/libs/EGL/gpu.cpp
index 3f9fd63..f9dc5f1 100644
--- a/opengl/libs/EGL/gpu.cpp
+++ b/opengl/libs/EGL/gpu.cpp
@@ -53,7 +53,7 @@
 static Mutex                            gRegionsLock;
 static request_gpu_t                    gRegions;
 static sp<ISurfaceComposer>             gSurfaceManager;
-ISurfaceComposer*                       GLES_localSurfaceManager = 0;
+GL_API ISurfaceComposer*                GLES_localSurfaceManager = 0;
 
 extern egl_connection_t gEGLImpl[2];
 
diff --git a/opengl/libs/GLES_CM/gl.cpp b/opengl/libs/GLES_CM/gl.cpp
index 865cf44..384b59a 100644
--- a/opengl/libs/GLES_CM/gl.cpp
+++ b/opengl/libs/GLES_CM/gl.cpp
@@ -29,6 +29,7 @@
 #include <cutils/properties.h>
 
 #include "hooks.h"
+#include "egl_impl.h"
 
 using namespace android;
 
@@ -36,6 +37,17 @@
 // extensions for the framework
 // ----------------------------------------------------------------------------
 
+extern "C" {
+GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
+        const GLvoid *ptr, GLsizei count);
+GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
+        const GLvoid *pointer, GLsizei count);
+GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
+        GLsizei stride, const GLvoid *pointer, GLsizei count);
+GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
+        GLsizei stride, const GLvoid *pointer, GLsizei count);
+}
+
 void glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
         const GLvoid *ptr, GLsizei count) {
     glColorPointer(size, type, stride, ptr);
@@ -57,13 +69,6 @@
 // Actual GL entry-points
 // ----------------------------------------------------------------------------
 
-#if GL_LOGGER
-#   include "gl_logger.h"
-#   define GL_LOGGER_IMPL(_x) _x
-#else
-#   define GL_LOGGER_IMPL(_x)
-#endif
-
 #undef API_ENTRY
 #undef CALL_GL_API
 #undef CALL_GL_API_RETURN
@@ -96,21 +101,36 @@
 
     #define CALL_GL_API(_api, ...)                                      \
         gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
-        GL_LOGGER_IMPL( log_##_api(__VA_ARGS__); )                      \
         _c->_api(__VA_ARGS__)
     
     #define CALL_GL_API_RETURN(_api, ...)                               \
         gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
-        GL_LOGGER_IMPL( log_##_api(__VA_ARGS__); )                      \
         return _c->_api(__VA_ARGS__)
 
 #endif
 
+
 extern "C" {
 #include "gl_api.in"
+#include "glext_api.in"
 }
 
 #undef API_ENTRY
 #undef CALL_GL_API
 #undef CALL_GL_API_RETURN
 
+
+/*
+ * These GL calls are special because they need to call into EGL to retrieve
+ * some informations before they can execute.
+ */
+
+
+void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
+{
+}
+
+void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
+{
+}
+
diff --git a/opengl/libs/GLES_CM/gl_api.in b/opengl/libs/GLES_CM/gl_api.in
index 9234ef2..5437d47 100644
--- a/opengl/libs/GLES_CM/gl_api.in
+++ b/opengl/libs/GLES_CM/gl_api.in
@@ -1,532 +1,285 @@
-void API_ENTRY(glActiveTexture)(GLenum texture) {
-    CALL_GL_API(glActiveTexture, texture);
-}
-
 void API_ENTRY(glAlphaFunc)(GLenum func, GLclampf ref) {
     CALL_GL_API(glAlphaFunc, func, ref);
 }
-
-void API_ENTRY(glAlphaFuncx)(GLenum func, GLclampx ref) {
-    CALL_GL_API(glAlphaFuncx, func, ref);
-}
-
-void API_ENTRY(glBindTexture)(GLenum target, GLuint texture) {
-    CALL_GL_API(glBindTexture, target, texture);
-}
-
-void API_ENTRY(glBlendFunc)(GLenum sfactor, GLenum dfactor) {
-    CALL_GL_API(glBlendFunc, sfactor, dfactor);
-}
-
-void API_ENTRY(glClear)(GLbitfield mask) {
-    CALL_GL_API(glClear, mask);
-}
-
 void API_ENTRY(glClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
     CALL_GL_API(glClearColor, red, green, blue, alpha);
 }
-
-void API_ENTRY(glClearColorx)(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) {
-    CALL_GL_API(glClearColorx, red, green, blue, alpha);
-}
-
 void API_ENTRY(glClearDepthf)(GLclampf depth) {
     CALL_GL_API(glClearDepthf, depth);
 }
-
-void API_ENTRY(glClearDepthx)(GLclampx depth) {
-    CALL_GL_API(glClearDepthx, depth);
-}
-
-void API_ENTRY(glClearStencil)(GLint s) {
-    CALL_GL_API(glClearStencil, s);
-}
-
-void API_ENTRY(glClientActiveTexture)(GLenum texture) {
-    CALL_GL_API(glClientActiveTexture, texture);
-}
-
-void API_ENTRY(glColor4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {
-    CALL_GL_API(glColor4f, red, green, blue, alpha);
-}
-
-void API_ENTRY(glColor4x)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) {
-    CALL_GL_API(glColor4x, red, green, blue, alpha);
-}
-
-void API_ENTRY(glColorMask)(GLboolean r, GLboolean g, GLboolean b, GLboolean a) {
-    CALL_GL_API(glColorMask, r, g, b, a);
-}
-
-void API_ENTRY(glColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
-{
-    CALL_GL_API(glColorPointer, size, type, stride, ptr);
-}
-
-void API_ENTRY(glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat,
-                            GLsizei width, GLsizei height, GLint border,
-                            GLsizei imageSize, const GLvoid *data) {
-    CALL_GL_API(glCompressedTexImage2D, target, level, internalformat,
-            width, height, border, imageSize, data);
-}
-
-void API_ENTRY(glCompressedTexSubImage2D)( GLenum target, GLint level, GLint xoffset,
-                                GLint yoffset, GLsizei width, GLsizei height,
-                                GLenum format, GLsizei imageSize,
-                                const GLvoid *data) {
-    CALL_GL_API(glCompressedTexSubImage2D, target, level, xoffset, yoffset,
-            width, height, format, imageSize, data);
-}
-
-void API_ENTRY(glCopyTexImage2D)(  GLenum target, GLint level, GLenum internalformat,
-                        GLint x, GLint y, GLsizei width, GLsizei height,
-                        GLint border) {
-    CALL_GL_API(glCopyTexImage2D, target, level, internalformat, x, y,
-            width, height, border);
-}
-
-void API_ENTRY(glCopyTexSubImage2D)(   GLenum target, GLint level, GLint xoffset,
-                            GLint yoffset, GLint x, GLint y, GLsizei width,
-                            GLsizei height) {
-    CALL_GL_API(glCopyTexSubImage2D, target, level, xoffset, yoffset, x, y,
-            width, height);
-}
-
-void API_ENTRY(glCullFace)(GLenum mode) {
-    CALL_GL_API(glCullFace, mode);
-}
-
-void API_ENTRY(glDeleteTextures)(GLsizei n, const GLuint *textures) {
-    CALL_GL_API(glDeleteTextures, n, textures);
-}
-
-void API_ENTRY(glDepthFunc)(GLenum func) {
-    CALL_GL_API(glDepthFunc, func);
-}
-
-void API_ENTRY(glDepthMask)(GLboolean flag) {
-    CALL_GL_API(glDepthMask, flag);
-}
-
-void API_ENTRY(glDepthRangef)(GLclampf zNear, GLclampf zFar) {
-    CALL_GL_API(glDepthRangef, zNear, zFar);
-}
-
-void API_ENTRY(glDepthRangex)(GLclampx zNear, GLclampx zFar) {
-    CALL_GL_API(glDepthRangex, zNear, zFar);
-}
-
-void API_ENTRY(glDisable)(GLenum cap) {
-    CALL_GL_API(glDisable, cap);
-}
-
-void API_ENTRY(glDisableClientState)(GLenum array) {
-    CALL_GL_API(glDisableClientState, array);
-}
-
-void API_ENTRY(glDrawArrays)(GLenum mode, GLint first, GLsizei count) {
-    CALL_GL_API(glDrawArrays, mode, first, count);
-}
-
-void API_ENTRY(glDrawElements)(GLenum mode, GLsizei count,
-                    GLenum type, const GLvoid *indices) {
-    CALL_GL_API(glDrawElements, mode, count, type, indices);
-}
-
-void API_ENTRY(glEnable)(GLenum cap) {
-    CALL_GL_API(glEnable, cap);
-}
-
-void API_ENTRY(glEnableClientState)(GLenum array) {
-    CALL_GL_API(glEnableClientState, array);
-}
-
-void API_ENTRY(glFinish)(void) {
-    CALL_GL_API(glFinish);
-}
-
-void API_ENTRY(glFlush)(void) {
-    CALL_GL_API(glFlush);
-}
-
-void API_ENTRY(glFogf)(GLenum pname, GLfloat param) {
-    CALL_GL_API(glFogf, pname, param);
-}
-
-void API_ENTRY(glFogfv)(GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glFogfv, pname, params);
-}
-
-void API_ENTRY(glFogx)(GLenum pname, GLfixed param) {
-    CALL_GL_API(glFogx, pname, param);
-}
-
-void API_ENTRY(glFogxv)(GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glFogxv, pname, params);
-}
-
-void API_ENTRY(glFrontFace)(GLenum mode) {
-    CALL_GL_API(glFrontFace, mode);
-}
-
-void API_ENTRY(glFrustumf)(GLfloat left, GLfloat right,
-                GLfloat bottom, GLfloat top,
-                GLfloat zNear, GLfloat zFar) {
-    CALL_GL_API(glFrustumf, left, right, bottom, top, zNear, zFar);
-}
-
-void API_ENTRY(glFrustumx)(GLfixed left, GLfixed right,
-                GLfixed bottom, GLfixed top,
-                GLfixed zNear, GLfixed zFar) {
-    CALL_GL_API(glFrustumx, left, right, bottom, top, zNear, zFar);
-}
-
-void API_ENTRY(glGenTextures)(GLsizei n, GLuint *textures) {
-    CALL_GL_API(glGenTextures, n, textures);
-}
-
-GLenum API_ENTRY(glGetError)(void) {
-    CALL_GL_API_RETURN(glGetError);
-}
-
-void API_ENTRY(glGetIntegerv)(GLenum pname, GLint *params) {
-    CALL_GL_API(glGetIntegerv, pname, params);
-}
-
-const GLubyte * API_ENTRY(glGetString)(GLenum name) {
-    CALL_GL_API_RETURN(glGetString, name);
-}
-
-void API_ENTRY(glHint)(GLenum target, GLenum mode) {
-    CALL_GL_API(glHint, target, mode);
-}
-
-void API_ENTRY(glLightModelf)(GLenum pname, GLfloat param) {
-    CALL_GL_API(glLightModelf, pname, param);
-}
-
-void API_ENTRY(glLightModelfv)(GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glLightModelfv, pname, params);
-}
-
-void API_ENTRY(glLightModelx)(GLenum pname, GLfixed param) {
-    CALL_GL_API(glLightModelx, pname, param);
-}
-
-void API_ENTRY(glLightModelxv)(GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glLightModelxv, pname, params);
-}
-
-void API_ENTRY(glLightf)(GLenum light, GLenum pname, GLfloat param) {
-    CALL_GL_API(glLightf, light, pname, param);
-}
-
-void API_ENTRY(glLightfv)(GLenum light, GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glLightfv, light, pname, params);
-}
-
-void API_ENTRY(glLightx)(GLenum light, GLenum pname, GLfixed param) {
-    CALL_GL_API(glLightx, light, pname, param);
-}
-
-void API_ENTRY(glLightxv)(GLenum light, GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glLightxv, light, pname, params);
-}
-
-void API_ENTRY(glLineWidth)(GLfloat width) {
-    CALL_GL_API(glLineWidth, width);
-}
-
-void API_ENTRY(glLineWidthx)(GLfixed width) {
-    CALL_GL_API(glLineWidthx, width);
-}
-
-void API_ENTRY(glLoadIdentity)(void) {
-    CALL_GL_API(glLoadIdentity);
-}
-
-void API_ENTRY(glLoadMatrixf)(const GLfloat *m) {
-    CALL_GL_API(glLoadMatrixf, m);
-}
-
-void API_ENTRY(glLoadMatrixx)(const GLfixed *m) {
-    CALL_GL_API(glLoadMatrixx, m);
-}
-
-void API_ENTRY(glLogicOp)(GLenum opcode) {
-    CALL_GL_API(glLogicOp, opcode);
-}
-
-void API_ENTRY(glMaterialf)(GLenum face, GLenum pname, GLfloat param) {
-    CALL_GL_API(glMaterialf, face, pname, param);
-}
-
-void API_ENTRY(glMaterialfv)(GLenum face, GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glMaterialfv, face, pname, params);
-}
-
-void API_ENTRY(glMaterialx)(GLenum face, GLenum pname, GLfixed param) {
-    CALL_GL_API(glMaterialx, face, pname, param);
-}
-
-void API_ENTRY(glMaterialxv)(GLenum face, GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glMaterialxv, face, pname, params);
-}
-
-void API_ENTRY(glMatrixMode)(GLenum mode) {
-    CALL_GL_API(glMatrixMode, mode);
-}
-
-void API_ENTRY(glMultMatrixf)(const GLfloat *m) {
-    CALL_GL_API(glMultMatrixf, m);
-}
-
-void API_ENTRY(glMultMatrixx)(const GLfixed *m) {
-    CALL_GL_API(glMultMatrixx, m);
-}
-
-void API_ENTRY(glMultiTexCoord4f)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) {
-    CALL_GL_API(glMultiTexCoord4f, target, s, t, r, q);
-}
-
-void API_ENTRY(glMultiTexCoord4x)(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) {
-    CALL_GL_API(glMultiTexCoord4x, target, s, t, r, q);
-}
-
-void API_ENTRY(glNormal3f)(GLfloat nx, GLfloat ny, GLfloat nz) {
-    CALL_GL_API(glNormal3f, nx, ny, nz);
-}
-
-void API_ENTRY(glNormal3x)(GLfixed nx, GLfixed ny, GLfixed nz) {
-    CALL_GL_API(glNormal3x, nx, ny, nz);
-}
-
-void API_ENTRY(glNormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer) {
-    CALL_GL_API(glNormalPointer, type, stride, pointer);
-}
-
-void API_ENTRY(glOrthof)(  GLfloat left, GLfloat right,
-                GLfloat bottom, GLfloat top,
-                GLfloat zNear, GLfloat zFar) {
-    CALL_GL_API(glOrthof, left, right, bottom, top, zNear, zFar);
-}
-
-void API_ENTRY(glOrthox)(  GLfixed left, GLfixed right,
-                GLfixed bottom, GLfixed top,
-                GLfixed zNear, GLfixed zFar) {
-    CALL_GL_API(glOrthox, left, right, bottom, top, zNear, zFar);
-}
-
-void API_ENTRY(glPixelStorei)(GLenum pname, GLint param) {
-    CALL_GL_API(glPixelStorei, pname, param);
-}
-
-void API_ENTRY(glPointSize)(GLfloat size) {
-    CALL_GL_API(glPointSize, size);
-}
-
-void API_ENTRY(glPointSizex)(GLfixed size) {
-    CALL_GL_API(glPointSizex, size);
-}
-
-void API_ENTRY(glPolygonOffset)(GLfloat factor, GLfloat units) {
-    CALL_GL_API(glPolygonOffset, factor, units);
-}
-
-void API_ENTRY(glPolygonOffsetx)(GLfixed factor, GLfixed units) {
-    CALL_GL_API(glPolygonOffsetx, factor, units);
-}
-
-void API_ENTRY(glPopMatrix)(void) {
-    CALL_GL_API(glPopMatrix);
-}
-
-void API_ENTRY(glPushMatrix)(void) {
-    CALL_GL_API(glPushMatrix);
-}
-
-void API_ENTRY(glReadPixels)(  GLint x, GLint y, GLsizei width, GLsizei height,
-                    GLenum format, GLenum type, GLvoid *pixels) {
-    CALL_GL_API(glReadPixels, x, y, width, height, format, type, pixels);
-}
-
-void API_ENTRY(glRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) {
-    CALL_GL_API(glRotatef, angle, x, y, z);
-}
-
-void API_ENTRY(glRotatex)(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) {
-    CALL_GL_API(glRotatex, angle, x, y, z);
-}
-
-void API_ENTRY(glSampleCoverage)(GLclampf value, GLboolean invert) {
-    CALL_GL_API(glSampleCoverage, value, invert);
-}
-
-void API_ENTRY(glSampleCoveragex)(GLclampx value, GLboolean invert) {
-    CALL_GL_API(glSampleCoveragex, value, invert);
-}
-
-void API_ENTRY(glScalef)(GLfloat x, GLfloat y, GLfloat z) {
-    CALL_GL_API(glScalef, x, y, z);
-}
-
-void API_ENTRY(glScalex)(GLfixed x, GLfixed y, GLfixed z) {
-    CALL_GL_API(glScalex, x, y, z);
-}
-
-void API_ENTRY(glScissor)(GLint x, GLint y, GLsizei width, GLsizei height) {
-    CALL_GL_API(glScissor, x, y, width, height);
-}
-
-void API_ENTRY(glShadeModel)(GLenum mode) {
-    CALL_GL_API(glShadeModel, mode);
-}
-
-void API_ENTRY(glStencilFunc)(GLenum func, GLint ref, GLuint mask) {
-    CALL_GL_API(glStencilFunc, func, ref, mask);
-}
-
-void API_ENTRY(glStencilMask)(GLuint mask) {
-    CALL_GL_API(glStencilMask, mask);
-}
-
-void API_ENTRY(glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass) {
-    CALL_GL_API(glStencilOp, fail, zfail, zpass);
-}
-
-void API_ENTRY(glTexCoordPointer)( GLint size, GLenum type,
-                        GLsizei stride, const GLvoid *pointer) {
-    CALL_GL_API(glTexCoordPointer, size, type, stride, pointer);
-}
-
-void API_ENTRY(glTexEnvf)(GLenum target, GLenum pname, GLfloat param) {
-    CALL_GL_API(glTexEnvf, target, pname, param);
-}
-
-void API_ENTRY(glTexEnvfv)(GLenum target, GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glTexEnvfv, target, pname, params);
-}
-
-void API_ENTRY(glTexEnvx)(GLenum target, GLenum pname, GLfixed param) {
-    CALL_GL_API(glTexEnvx, target, pname, param);
-}
-
-void API_ENTRY(glTexEnvxv)(GLenum target, GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glTexEnvxv, target, pname, params);
-}
-
-void API_ENTRY(glTexImage2D)(  GLenum target, GLint level, GLint internalformat,
-                    GLsizei width, GLsizei height, GLint border, GLenum format,
-                    GLenum type, const GLvoid *pixels) {
-    CALL_GL_API(glTexImage2D, target, level, internalformat, width, height,
-            border, format, type, pixels);
-}
-
-void API_ENTRY(glTexParameterf)(GLenum target, GLenum pname, GLfloat param) {
-    CALL_GL_API(glTexParameterf, target, pname, param);
-}
-
-void API_ENTRY(glTexParameterx)(GLenum target, GLenum pname, GLfixed param) {
-    CALL_GL_API(glTexParameterx, target, pname, param);
-}
-
-void API_ENTRY(glTexSubImage2D)(   GLenum target, GLint level, GLint xoffset,
-                        GLint yoffset, GLsizei width, GLsizei height,
-                        GLenum format, GLenum type, const GLvoid *pixels) {
-    CALL_GL_API(glTexSubImage2D, target, level, xoffset, yoffset,
-            width, height, format, type, pixels);
-}
-
-void API_ENTRY(glTranslatef)(GLfloat x, GLfloat y, GLfloat z) {
-    CALL_GL_API(glTranslatef, x, y, z);
-}
-
-void API_ENTRY(glTranslatex)(GLfixed x, GLfixed y, GLfixed z) {
-    CALL_GL_API(glTranslatex, x, y, z);
-}
-
-void API_ENTRY(glVertexPointer)(   GLint size, GLenum type,
-                        GLsizei stride, const GLvoid *pointer) {
-    CALL_GL_API(glVertexPointer, size, type, stride, pointer);
-}
-
-void API_ENTRY(glViewport)(GLint x, GLint y, GLsizei width, GLsizei height) {
-    CALL_GL_API(glViewport, x, y, width, height);
-}
-
-// ES 1.1
 void API_ENTRY(glClipPlanef)(GLenum plane, const GLfloat *equation) {
     CALL_GL_API(glClipPlanef, plane, equation);
 }
-void API_ENTRY(glClipPlanex)(GLenum plane, const GLfixed *equation) {
-    CALL_GL_API(glClipPlanex, plane, equation);
+void API_ENTRY(glColor4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {
+    CALL_GL_API(glColor4f, red, green, blue, alpha);
 }
-void API_ENTRY(glBindBuffer)(GLenum target, GLuint buffer) {
-    CALL_GL_API(glBindBuffer, target, buffer);
+void API_ENTRY(glDepthRangef)(GLclampf zNear, GLclampf zFar) {
+    CALL_GL_API(glDepthRangef, zNear, zFar);
 }
-void API_ENTRY(glBufferData)(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) {
-    CALL_GL_API(glBufferData, target, size, data, usage);
+void API_ENTRY(glFogf)(GLenum pname, GLfloat param) {
+    CALL_GL_API(glFogf, pname, param);
 }
-void API_ENTRY(glBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) {
-    CALL_GL_API(glBufferSubData, target, offset, size, data);
+void API_ENTRY(glFogfv)(GLenum pname, const GLfloat *params) {
+    CALL_GL_API(glFogfv, pname, params);
 }
-void API_ENTRY(glDeleteBuffers)(GLsizei n, const GLuint* buffers) {
-    CALL_GL_API(glDeleteBuffers, n, buffers);
-}
-void API_ENTRY(glGenBuffers)(GLsizei n, GLuint* buffers) {
-    CALL_GL_API(glGenBuffers, n, buffers);
-}
-void API_ENTRY(glGetBooleanv)(GLenum pname, GLboolean *params) {
-    CALL_GL_API(glGetBooleanv, pname, params);
-}
-void API_ENTRY(glGetFixedv)(GLenum pname, GLfixed *params) {
-    CALL_GL_API(glGetFixedv, pname, params);
-}
-void API_ENTRY(glGetFloatv)(GLenum pname, GLfloat *params) {
-    CALL_GL_API(glGetFloatv, pname, params);
-}
-void API_ENTRY(glGetPointerv)(GLenum pname, void **params) {
-    CALL_GL_API(glGetPointerv, pname, params);
-}
-void API_ENTRY(glGetBufferParameteriv)(GLenum target, GLenum pname, GLint *params) {
-    CALL_GL_API(glGetBufferParameteriv, target, pname, params);
+void API_ENTRY(glFrustumf)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) {
+    CALL_GL_API(glFrustumf, left, right, bottom, top, zNear, zFar);
 }
 void API_ENTRY(glGetClipPlanef)(GLenum pname, GLfloat eqn[4]) {
     CALL_GL_API(glGetClipPlanef, pname, eqn);
 }
-void API_ENTRY(glGetClipPlanex)(GLenum pname, GLfixed eqn[4]) {
-    CALL_GL_API(glGetClipPlanex, pname, eqn);
-}
-void API_ENTRY(glGetLightxv)(GLenum light, GLenum pname, GLfixed *params) {
-    CALL_GL_API(glGetLightxv, light, pname, params);
+void API_ENTRY(glGetFloatv)(GLenum pname, GLfloat *params) {
+    CALL_GL_API(glGetFloatv, pname, params);
 }
 void API_ENTRY(glGetLightfv)(GLenum light, GLenum pname, GLfloat *params) {
     CALL_GL_API(glGetLightfv, light, pname, params);
 }
-void API_ENTRY(glGetMaterialxv)(GLenum face, GLenum pname, GLfixed *params) {
-    CALL_GL_API(glGetMaterialxv, face, pname, params);
-}
 void API_ENTRY(glGetMaterialfv)(GLenum face, GLenum pname, GLfloat *params) {
     CALL_GL_API(glGetMaterialfv, face, pname, params);
 }
 void API_ENTRY(glGetTexEnvfv)(GLenum env, GLenum pname, GLfloat *params) {
     CALL_GL_API(glGetTexEnvfv, env, pname, params);
 }
+void API_ENTRY(glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat *params) {
+    CALL_GL_API(glGetTexParameterfv, target, pname, params);
+}
+void API_ENTRY(glLightModelf)(GLenum pname, GLfloat param) {
+    CALL_GL_API(glLightModelf, pname, param);
+}
+void API_ENTRY(glLightModelfv)(GLenum pname, const GLfloat *params) {
+    CALL_GL_API(glLightModelfv, pname, params);
+}
+void API_ENTRY(glLightf)(GLenum light, GLenum pname, GLfloat param) {
+    CALL_GL_API(glLightf, light, pname, param);
+}
+void API_ENTRY(glLightfv)(GLenum light, GLenum pname, const GLfloat *params) {
+    CALL_GL_API(glLightfv, light, pname, params);
+}
+void API_ENTRY(glLineWidth)(GLfloat width) {
+    CALL_GL_API(glLineWidth, width);
+}
+void API_ENTRY(glLoadMatrixf)(const GLfloat *m) {
+    CALL_GL_API(glLoadMatrixf, m);
+}
+void API_ENTRY(glMaterialf)(GLenum face, GLenum pname, GLfloat param) {
+    CALL_GL_API(glMaterialf, face, pname, param);
+}
+void API_ENTRY(glMaterialfv)(GLenum face, GLenum pname, const GLfloat *params) {
+    CALL_GL_API(glMaterialfv, face, pname, params);
+}
+void API_ENTRY(glMultMatrixf)(const GLfloat *m) {
+    CALL_GL_API(glMultMatrixf, m);
+}
+void API_ENTRY(glMultiTexCoord4f)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) {
+    CALL_GL_API(glMultiTexCoord4f, target, s, t, r, q);
+}
+void API_ENTRY(glNormal3f)(GLfloat nx, GLfloat ny, GLfloat nz) {
+    CALL_GL_API(glNormal3f, nx, ny, nz);
+}
+void API_ENTRY(glOrthof)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) {
+    CALL_GL_API(glOrthof, left, right, bottom, top, zNear, zFar);
+}
+void API_ENTRY(glPointParameterf)(GLenum pname, GLfloat param) {
+    CALL_GL_API(glPointParameterf, pname, param);
+}
+void API_ENTRY(glPointParameterfv)(GLenum pname, const GLfloat *params) {
+    CALL_GL_API(glPointParameterfv, pname, params);
+}
+void API_ENTRY(glPointSize)(GLfloat size) {
+    CALL_GL_API(glPointSize, size);
+}
+void API_ENTRY(glPolygonOffset)(GLfloat factor, GLfloat units) {
+    CALL_GL_API(glPolygonOffset, factor, units);
+}
+void API_ENTRY(glRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) {
+    CALL_GL_API(glRotatef, angle, x, y, z);
+}
+void API_ENTRY(glScalef)(GLfloat x, GLfloat y, GLfloat z) {
+    CALL_GL_API(glScalef, x, y, z);
+}
+void API_ENTRY(glTexEnvf)(GLenum target, GLenum pname, GLfloat param) {
+    CALL_GL_API(glTexEnvf, target, pname, param);
+}
+void API_ENTRY(glTexEnvfv)(GLenum target, GLenum pname, const GLfloat *params) {
+    CALL_GL_API(glTexEnvfv, target, pname, params);
+}
+void API_ENTRY(glTexParameterf)(GLenum target, GLenum pname, GLfloat param) {
+    CALL_GL_API(glTexParameterf, target, pname, param);
+}
+void API_ENTRY(glTexParameterfv)(GLenum target, GLenum pname, const GLfloat *params) {
+    CALL_GL_API(glTexParameterfv, target, pname, params);
+}
+void API_ENTRY(glTranslatef)(GLfloat x, GLfloat y, GLfloat z) {
+    CALL_GL_API(glTranslatef, x, y, z);
+}
+void API_ENTRY(glActiveTexture)(GLenum texture) {
+    CALL_GL_API(glActiveTexture, texture);
+}
+void API_ENTRY(glAlphaFuncx)(GLenum func, GLclampx ref) {
+    CALL_GL_API(glAlphaFuncx, func, ref);
+}
+void API_ENTRY(glBindBuffer)(GLenum target, GLuint buffer) {
+    CALL_GL_API(glBindBuffer, target, buffer);
+}
+void API_ENTRY(glBindTexture)(GLenum target, GLuint texture) {
+    CALL_GL_API(glBindTexture, target, texture);
+}
+void API_ENTRY(glBlendFunc)(GLenum sfactor, GLenum dfactor) {
+    CALL_GL_API(glBlendFunc, sfactor, dfactor);
+}
+void API_ENTRY(glBufferData)(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage) {
+    CALL_GL_API(glBufferData, target, size, data, usage);
+}
+void API_ENTRY(glBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data) {
+    CALL_GL_API(glBufferSubData, target, offset, size, data);
+}
+void API_ENTRY(glClear)(GLbitfield mask) {
+    CALL_GL_API(glClear, mask);
+}
+void API_ENTRY(glClearColorx)(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) {
+    CALL_GL_API(glClearColorx, red, green, blue, alpha);
+}
+void API_ENTRY(glClearDepthx)(GLclampx depth) {
+    CALL_GL_API(glClearDepthx, depth);
+}
+void API_ENTRY(glClearStencil)(GLint s) {
+    CALL_GL_API(glClearStencil, s);
+}
+void API_ENTRY(glClientActiveTexture)(GLenum texture) {
+    CALL_GL_API(glClientActiveTexture, texture);
+}
+void API_ENTRY(glClipPlanex)(GLenum plane, const GLfixed *equation) {
+    CALL_GL_API(glClipPlanex, plane, equation);
+}
+void API_ENTRY(glColor4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) {
+    CALL_GL_API(glColor4ub, red, green, blue, alpha);
+}
+void API_ENTRY(glColor4x)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) {
+    CALL_GL_API(glColor4x, red, green, blue, alpha);
+}
+void API_ENTRY(glColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) {
+    CALL_GL_API(glColorMask, red, green, blue, alpha);
+}
+void API_ENTRY(glColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
+    CALL_GL_API(glColorPointer, size, type, stride, pointer);
+}
+void API_ENTRY(glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) {
+    CALL_GL_API(glCompressedTexImage2D, target, level, internalformat, width, height, border, imageSize, data);
+}
+void API_ENTRY(glCompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) {
+    CALL_GL_API(glCompressedTexSubImage2D, target, level, xoffset, yoffset, width, height, format, imageSize, data);
+}
+void API_ENTRY(glCopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) {
+    CALL_GL_API(glCopyTexImage2D, target, level, internalformat, x, y, width, height, border);
+}
+void API_ENTRY(glCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) {
+    CALL_GL_API(glCopyTexSubImage2D, target, level, xoffset, yoffset, x, y, width, height);
+}
+void API_ENTRY(glCullFace)(GLenum mode) {
+    CALL_GL_API(glCullFace, mode);
+}
+void API_ENTRY(glDeleteBuffers)(GLsizei n, const GLuint *buffers) {
+    CALL_GL_API(glDeleteBuffers, n, buffers);
+}
+void API_ENTRY(glDeleteTextures)(GLsizei n, const GLuint *textures) {
+    CALL_GL_API(glDeleteTextures, n, textures);
+}
+void API_ENTRY(glDepthFunc)(GLenum func) {
+    CALL_GL_API(glDepthFunc, func);
+}
+void API_ENTRY(glDepthMask)(GLboolean flag) {
+    CALL_GL_API(glDepthMask, flag);
+}
+void API_ENTRY(glDepthRangex)(GLclampx zNear, GLclampx zFar) {
+    CALL_GL_API(glDepthRangex, zNear, zFar);
+}
+void API_ENTRY(glDisable)(GLenum cap) {
+    CALL_GL_API(glDisable, cap);
+}
+void API_ENTRY(glDisableClientState)(GLenum array) {
+    CALL_GL_API(glDisableClientState, array);
+}
+void API_ENTRY(glDrawArrays)(GLenum mode, GLint first, GLsizei count) {
+    CALL_GL_API(glDrawArrays, mode, first, count);
+}
+void API_ENTRY(glDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) {
+    CALL_GL_API(glDrawElements, mode, count, type, indices);
+}
+void API_ENTRY(glEnable)(GLenum cap) {
+    CALL_GL_API(glEnable, cap);
+}
+void API_ENTRY(glEnableClientState)(GLenum array) {
+    CALL_GL_API(glEnableClientState, array);
+}
+void API_ENTRY(glFinish)(void) {
+    CALL_GL_API(glFinish);
+}
+void API_ENTRY(glFlush)(void) {
+    CALL_GL_API(glFlush);
+}
+void API_ENTRY(glFogx)(GLenum pname, GLfixed param) {
+    CALL_GL_API(glFogx, pname, param);
+}
+void API_ENTRY(glFogxv)(GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glFogxv, pname, params);
+}
+void API_ENTRY(glFrontFace)(GLenum mode) {
+    CALL_GL_API(glFrontFace, mode);
+}
+void API_ENTRY(glFrustumx)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) {
+    CALL_GL_API(glFrustumx, left, right, bottom, top, zNear, zFar);
+}
+void API_ENTRY(glGetBooleanv)(GLenum pname, GLboolean *params) {
+    CALL_GL_API(glGetBooleanv, pname, params);
+}
+void API_ENTRY(glGetBufferParameteriv)(GLenum target, GLenum pname, GLint *params) {
+    CALL_GL_API(glGetBufferParameteriv, target, pname, params);
+}
+void API_ENTRY(glGetClipPlanex)(GLenum pname, GLfixed eqn[4]) {
+    CALL_GL_API(glGetClipPlanex, pname, eqn);
+}
+void API_ENTRY(glGenBuffers)(GLsizei n, GLuint *buffers) {
+    CALL_GL_API(glGenBuffers, n, buffers);
+}
+void API_ENTRY(glGenTextures)(GLsizei n, GLuint *textures) {
+    CALL_GL_API(glGenTextures, n, textures);
+}
+GLenum API_ENTRY(glGetError)(void) {
+    CALL_GL_API_RETURN(glGetError);
+}
+void API_ENTRY(glGetFixedv)(GLenum pname, GLfixed *params) {
+    CALL_GL_API(glGetFixedv, pname, params);
+}
+void API_ENTRY(glGetIntegerv)(GLenum pname, GLint *params) {
+    CALL_GL_API(glGetIntegerv, pname, params);
+}
+void API_ENTRY(glGetLightxv)(GLenum light, GLenum pname, GLfixed *params) {
+    CALL_GL_API(glGetLightxv, light, pname, params);
+}
+void API_ENTRY(glGetMaterialxv)(GLenum face, GLenum pname, GLfixed *params) {
+    CALL_GL_API(glGetMaterialxv, face, pname, params);
+}
+void API_ENTRY(glGetPointerv)(GLenum pname, void **params) {
+    CALL_GL_API(glGetPointerv, pname, params);
+}
+const GLubyte * API_ENTRY(glGetString)(GLenum name) {
+    CALL_GL_API_RETURN(glGetString, name);
+}
 void API_ENTRY(glGetTexEnviv)(GLenum env, GLenum pname, GLint *params) {
     CALL_GL_API(glGetTexEnviv, env, pname, params);
 }
 void API_ENTRY(glGetTexEnvxv)(GLenum env, GLenum pname, GLfixed *params) {
     CALL_GL_API(glGetTexEnvxv, env, pname, params);
 }
-void API_ENTRY(glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat *params) {
-    CALL_GL_API(glGetTexParameterfv, target, pname, params);
-}
 void API_ENTRY(glGetTexParameteriv)(GLenum target, GLenum pname, GLint *params) {
     CALL_GL_API(glGetTexParameteriv, target, pname, params);
 }
 void API_ENTRY(glGetTexParameterxv)(GLenum target, GLenum pname, GLfixed *params) {
     CALL_GL_API(glGetTexParameterxv, target, pname, params);
 }
+void API_ENTRY(glHint)(GLenum target, GLenum mode) {
+    CALL_GL_API(glHint, target, mode);
+}
 GLboolean API_ENTRY(glIsBuffer)(GLuint buffer) {
     CALL_GL_API_RETURN(glIsBuffer, buffer);
 }
@@ -536,11 +289,56 @@
 GLboolean API_ENTRY(glIsTexture)(GLuint texture) {
     CALL_GL_API_RETURN(glIsTexture, texture);
 }
-void API_ENTRY(glPointParameterf)(GLenum pname, GLfloat param) {
-    CALL_GL_API(glPointParameterf, pname, param);
+void API_ENTRY(glLightModelx)(GLenum pname, GLfixed param) {
+    CALL_GL_API(glLightModelx, pname, param);
 }
-void API_ENTRY(glPointParameterfv)(GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glPointParameterfv, pname, params);
+void API_ENTRY(glLightModelxv)(GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glLightModelxv, pname, params);
+}
+void API_ENTRY(glLightx)(GLenum light, GLenum pname, GLfixed param) {
+    CALL_GL_API(glLightx, light, pname, param);
+}
+void API_ENTRY(glLightxv)(GLenum light, GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glLightxv, light, pname, params);
+}
+void API_ENTRY(glLineWidthx)(GLfixed width) {
+    CALL_GL_API(glLineWidthx, width);
+}
+void API_ENTRY(glLoadIdentity)(void) {
+    CALL_GL_API(glLoadIdentity);
+}
+void API_ENTRY(glLoadMatrixx)(const GLfixed *m) {
+    CALL_GL_API(glLoadMatrixx, m);
+}
+void API_ENTRY(glLogicOp)(GLenum opcode) {
+    CALL_GL_API(glLogicOp, opcode);
+}
+void API_ENTRY(glMaterialx)(GLenum face, GLenum pname, GLfixed param) {
+    CALL_GL_API(glMaterialx, face, pname, param);
+}
+void API_ENTRY(glMaterialxv)(GLenum face, GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glMaterialxv, face, pname, params);
+}
+void API_ENTRY(glMatrixMode)(GLenum mode) {
+    CALL_GL_API(glMatrixMode, mode);
+}
+void API_ENTRY(glMultMatrixx)(const GLfixed *m) {
+    CALL_GL_API(glMultMatrixx, m);
+}
+void API_ENTRY(glMultiTexCoord4x)(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) {
+    CALL_GL_API(glMultiTexCoord4x, target, s, t, r, q);
+}
+void API_ENTRY(glNormal3x)(GLfixed nx, GLfixed ny, GLfixed nz) {
+    CALL_GL_API(glNormal3x, nx, ny, nz);
+}
+void API_ENTRY(glNormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer) {
+    CALL_GL_API(glNormalPointer, type, stride, pointer);
+}
+void API_ENTRY(glOrthox)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) {
+    CALL_GL_API(glOrthox, left, right, bottom, top, zNear, zFar);
+}
+void API_ENTRY(glPixelStorei)(GLenum pname, GLint param) {
+    CALL_GL_API(glPixelStorei, pname, param);
 }
 void API_ENTRY(glPointParameterx)(GLenum pname, GLfixed param) {
     CALL_GL_API(glPointParameterx, pname, param);
@@ -548,59 +346,90 @@
 void API_ENTRY(glPointParameterxv)(GLenum pname, const GLfixed *params) {
     CALL_GL_API(glPointParameterxv, pname, params);
 }
-void API_ENTRY(glColor4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) {
-    CALL_GL_API(glColor4ub, red, green, blue, alpha);
+void API_ENTRY(glPointSizex)(GLfixed size) {
+    CALL_GL_API(glPointSizex, size);
+}
+void API_ENTRY(glPolygonOffsetx)(GLfixed factor, GLfixed units) {
+    CALL_GL_API(glPolygonOffsetx, factor, units);
+}
+void API_ENTRY(glPopMatrix)(void) {
+    CALL_GL_API(glPopMatrix);
+}
+void API_ENTRY(glPushMatrix)(void) {
+    CALL_GL_API(glPushMatrix);
+}
+void API_ENTRY(glReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) {
+    CALL_GL_API(glReadPixels, x, y, width, height, format, type, pixels);
+}
+void API_ENTRY(glRotatex)(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) {
+    CALL_GL_API(glRotatex, angle, x, y, z);
+}
+void API_ENTRY(glSampleCoverage)(GLclampf value, GLboolean invert) {
+    CALL_GL_API(glSampleCoverage, value, invert);
+}
+void API_ENTRY(glSampleCoveragex)(GLclampx value, GLboolean invert) {
+    CALL_GL_API(glSampleCoveragex, value, invert);
+}
+void API_ENTRY(glScalex)(GLfixed x, GLfixed y, GLfixed z) {
+    CALL_GL_API(glScalex, x, y, z);
+}
+void API_ENTRY(glScissor)(GLint x, GLint y, GLsizei width, GLsizei height) {
+    CALL_GL_API(glScissor, x, y, width, height);
+}
+void API_ENTRY(glShadeModel)(GLenum mode) {
+    CALL_GL_API(glShadeModel, mode);
+}
+void API_ENTRY(glStencilFunc)(GLenum func, GLint ref, GLuint mask) {
+    CALL_GL_API(glStencilFunc, func, ref, mask);
+}
+void API_ENTRY(glStencilMask)(GLuint mask) {
+    CALL_GL_API(glStencilMask, mask);
+}
+void API_ENTRY(glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass) {
+    CALL_GL_API(glStencilOp, fail, zfail, zpass);
+}
+void API_ENTRY(glTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
+    CALL_GL_API(glTexCoordPointer, size, type, stride, pointer);
 }
 void API_ENTRY(glTexEnvi)(GLenum target, GLenum pname, GLint param) {
     CALL_GL_API(glTexEnvi, target, pname, param);
 }
+void API_ENTRY(glTexEnvx)(GLenum target, GLenum pname, GLfixed param) {
+    CALL_GL_API(glTexEnvx, target, pname, param);
+}
 void API_ENTRY(glTexEnviv)(GLenum target, GLenum pname, const GLint *params) {
     CALL_GL_API(glTexEnviv, target, pname, params);
 }
-
-void API_ENTRY(glTexParameterfv)(GLenum target, GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glTexParameterfv, target, pname, params);
+void API_ENTRY(glTexEnvxv)(GLenum target, GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glTexEnvxv, target, pname, params);
 }
-
-void API_ENTRY(glTexParameteriv)(GLenum target, GLenum pname, const GLint *params) {
-    CALL_GL_API(glTexParameteriv, target, pname, params);
+void API_ENTRY(glTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) {
+    CALL_GL_API(glTexImage2D, target, level, internalformat, width, height, border, format, type, pixels);
 }
-
 void API_ENTRY(glTexParameteri)(GLenum target, GLenum pname, GLint param) {
     CALL_GL_API(glTexParameteri, target, pname, param);
 }
+void API_ENTRY(glTexParameterx)(GLenum target, GLenum pname, GLfixed param) {
+    CALL_GL_API(glTexParameterx, target, pname, param);
+}
+void API_ENTRY(glTexParameteriv)(GLenum target, GLenum pname, const GLint *params) {
+    CALL_GL_API(glTexParameteriv, target, pname, params);
+}
 void API_ENTRY(glTexParameterxv)(GLenum target, GLenum pname, const GLfixed *params) {
     CALL_GL_API(glTexParameterxv, target, pname, params);
 }
+void API_ENTRY(glTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) {
+    CALL_GL_API(glTexSubImage2D, target, level, xoffset, yoffset, width, height, format, type, pixels);
+}
+void API_ENTRY(glTranslatex)(GLfixed x, GLfixed y, GLfixed z) {
+    CALL_GL_API(glTranslatex, x, y, z);
+}
+void API_ENTRY(glVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
+    CALL_GL_API(glVertexPointer, size, type, stride, pointer);
+}
+void API_ENTRY(glViewport)(GLint x, GLint y, GLsizei width, GLsizei height) {
+    CALL_GL_API(glViewport, x, y, width, height);
+}
 void API_ENTRY(glPointSizePointerOES)(GLenum type, GLsizei stride, const GLvoid *pointer) {
     CALL_GL_API(glPointSizePointerOES, type, stride, pointer);
 }
-
-// Extensions
-void API_ENTRY(glDrawTexsOES)(GLshort x , GLshort y, GLshort z, GLshort w, GLshort h) {
-    CALL_GL_API(glDrawTexsOES, x, y, z, w, h);
-}
-void API_ENTRY(glDrawTexiOES)(GLint x, GLint y, GLint z, GLint w, GLint h) {
-    CALL_GL_API(glDrawTexiOES, x, y, z, w, h);
-}
-void API_ENTRY(glDrawTexfOES)(GLfloat x, GLfloat y, GLfloat z, GLfloat w, GLfloat h) {
-    CALL_GL_API(glDrawTexfOES, x, y, z, w, h);
-}
-void API_ENTRY(glDrawTexxOES)(GLfixed x, GLfixed y, GLfixed z, GLfixed w, GLfixed h) {
-    CALL_GL_API(glDrawTexxOES, x, y, z, w, h);
-}
-void API_ENTRY(glDrawTexsvOES)(const GLshort* coords) {
-    CALL_GL_API(glDrawTexsvOES, coords);
-}
-void API_ENTRY(glDrawTexivOES)(const GLint* coords) {
-    CALL_GL_API(glDrawTexivOES, coords);
-}
-void API_ENTRY(glDrawTexfvOES)(const GLfloat* coords) {
-    CALL_GL_API(glDrawTexfvOES, coords);
-}
-void API_ENTRY(glDrawTexxvOES)(const GLfixed* coords) {
-    CALL_GL_API(glDrawTexxvOES, coords);
-}
-GLbitfield API_ENTRY(glQueryMatrixxOES)(GLfixed* mantissa, GLint* exponent) {
-    CALL_GL_API_RETURN(glQueryMatrixxOES, mantissa, exponent);
-}
diff --git a/opengl/libs/GLES_CM/gl_logger.cpp b/opengl/libs/GLES_CM/gl_logger.cpp
deleted file mode 100644
index 27be5c9..0000000
--- a/opengl/libs/GLES_CM/gl_logger.cpp
+++ /dev/null
@@ -1,1060 +0,0 @@
-/*
- ** Copyright 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.
- */
-
-#define LOG_TAG "GLLogger"
-
-#include <ctype.h>
-#include <string.h>
-#include <errno.h>
-#include <dlfcn.h>
-
-#include <sys/ioctl.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <cutils/log.h>
-#include <cutils/atomic.h>
-#include <cutils/properties.h>
-
-#include <utils/String8.h>
-
-#include "gl_logger.h"
-
-#undef NELEM
-#define NELEM(x) (sizeof(x)/sizeof(*(x)))
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-template<typename T>
-static int binarySearch(T const sortedArray[], int first, int last, EGLint key)
-{
-   while (first <= last) {
-       int mid = (first + last) / 2;
-       if (key > sortedArray[mid].key) {
-           first = mid + 1;
-       } else if (key < sortedArray[mid].key) {
-           last = mid - 1;
-       } else {
-           return mid;
-       }
-   }
-   return -1;
-}
-
-struct pair_t {
-    const char* name;
-    int         key;
-};
-
-static const pair_t gEnumMap[] = {
-    #define GLENUM(NAME, VALUE) { #NAME, VALUE },
-    #include "gl_enums.in"
-    #undef GLENUM
-};
-
-// ----------------------------------------------------------------------------
-
-template<typename TYPE>
-class GLLogValue {
-public:
-    GLLogValue(TYPE value) : mValue(value) { }
-    const TYPE& getValue() const { return mValue; }
-    String8 toString() const {
-        return convertToString(mValue);
-    }
-private:
-    const TYPE& mValue;
-    String8 convertToString(unsigned int v) const {
-        char buf[16];
-        snprintf(buf, 16, "%u", v);
-        return String8(buf);
-    }
-    String8 convertToString(unsigned long v) const {
-        char buf[16];
-        snprintf(buf, 16, "%lu", v);
-        return String8(buf);
-    }
-    String8 convertToString(int v) const {
-        char buf[16];
-        snprintf(buf, 16, "%d", v);
-        return String8(buf);
-    }
-    String8 convertToString(long v) const {
-        char buf[16];
-        snprintf(buf, 16, "%ld", v);
-        return String8(buf);
-    }
-    String8 convertToString(float v) const {
-        char buf[16];
-        snprintf(buf, 16, "%f", v);
-        return String8(buf);
-    }
-    String8 convertToString(void const* v) const {
-        char buf[16];
-        snprintf(buf, 16, "%p", v);
-        return String8(buf);
-    }
-};
-
-class GLLogEnum : public GLLogValue<GLenum> {
-public:
-    GLLogEnum(GLenum v) : GLLogValue<GLenum>(v) { }
-    String8 toString() const {
-        GLenum v = getValue();
-        int i = binarySearch<pair_t>(gEnumMap, 0, NELEM(gEnumMap)-1, v);
-        if (i >= 0) {
-            return String8(gEnumMap[i].name);
-        } else {
-            char buf[16];
-            snprintf(buf, 16, "0x%04x", v);
-            return String8(buf);
-        }
-    }
-};
-
-class GLLogClearBitfield : public GLLogValue<GLbitfield> {
-public:
-    GLLogClearBitfield(GLbitfield v) : GLLogValue<GLbitfield>(v) { }
-    String8 toString() const {
-        char buf[16];
-        snprintf(buf, 16, "0x%08x", getValue());
-        return String8(buf);
-    }
-};
-
-class GLLogBool : public GLLogValue<GLboolean> {
-public:
-    GLLogBool(GLboolean v) : GLLogValue<GLboolean>(v) { }
-    String8 toString() const {
-        GLboolean v = getValue();
-        if (v == GL_TRUE)   return String8("GL_TRUE");
-        if (v == GL_FALSE)  return String8("GL_FALSE");
-        return GLLogValue<GLboolean>::toString();
-    }
-};
-
-class GLLogFixed : public GLLogValue<GLfixed> {
-public:
-    GLLogFixed(GLfixed v) : GLLogValue<GLfixed>(v) { }
-    String8 toString() const {
-        char buf[16];
-        snprintf(buf, 16, "0x%08x", getValue());
-        return String8(buf);
-    }
-};
-
-
-template <typename TYPE>
-class GLLogBuffer : public GLLogValue<TYPE *> {
-public:
-    GLLogBuffer(TYPE* buffer, size_t count = -1)
-        : GLLogValue<TYPE*>(buffer)
-    { // output buffer
-    }
-    GLLogBuffer(TYPE const* buffer, size_t count = -1)
-    : GLLogValue<TYPE*>(const_cast<TYPE*>(buffer))
-    { // input buffer
-    }
-};
-
-class GLLog
-{
-public:
-    GLLog(const char* name) : mNumParams(0) {
-        mString.append(name);
-        mString.append("(");
-    }
-
-    ~GLLog() {
-        LOGD("%s);", mString.string());
-    }
-
-    GLLog& operator << (unsigned char v) {
-        return *this << GLLogValue<unsigned int>(v);
-    }
-    GLLog& operator << (short v) {
-        return *this << GLLogValue<unsigned int>(v);
-    }
-    GLLog& operator << (unsigned int v) {
-        return *this << GLLogValue<unsigned int>(v);
-    }
-    GLLog& operator << (int v) {
-        return *this << GLLogValue<int>(v);
-    }
-    GLLog& operator << (long v) {
-        return *this << GLLogValue<long>(v);
-    }
-    GLLog& operator << (unsigned long v) {
-        return *this << GLLogValue<unsigned long>(v);
-    }
-    GLLog& operator << (float v) {
-        return *this << GLLogValue<float>(v);
-    }
-    GLLog& operator << (const void* v) {
-        return *this << GLLogValue<const void* >(v);
-    }
-
-    template <typename TYPE>
-    GLLog& operator << (const TYPE& rhs) {
-        if (mNumParams > 0)
-            mString.append(", ");
-        mString.append(rhs.toString());
-        mNumParams++;
-        return *this;
-    }
-
-    const String8& string() const { return mString; }
-private:
-    GLLog(const GLLog&);
-
-    String8 mString;
-    int mNumParams;
-};
-
-#define API_ENTRY(api)                      log_##api
-#define CALL_GL_API(_x, ...)
-#define CALL_GL_API_RETURN(_x, ...)         return(0);
-
-void API_ENTRY(glActiveTexture)(GLenum texture) {
-    CALL_GL_API(glActiveTexture, texture);
-    GLLog("glActiveTexture") << GLLogEnum(texture);
-}
-
-void API_ENTRY(glAlphaFunc)(GLenum func, GLclampf ref) {
-    CALL_GL_API(glAlphaFunc, func, ref);
-    GLLog("glAlphaFunc") << GLLogEnum(func) << ref;
-}
-
-void API_ENTRY(glAlphaFuncx)(GLenum func, GLclampx ref) {
-    CALL_GL_API(glAlphaFuncx, func, ref);
-    GLLog("glAlphaFuncx") << GLLogEnum(func) << GLLogFixed(ref);
-}
-
-void API_ENTRY(glBindTexture)(GLenum target, GLuint texture) {
-    CALL_GL_API(glBindTexture, target, texture);
-    GLLog("glBindTexture") << GLLogEnum(target) << texture;
-}
-
-void API_ENTRY(glBlendFunc)(GLenum sfactor, GLenum dfactor) {
-    CALL_GL_API(glBlendFunc, sfactor, dfactor);
-    GLLog("glBlendFunc") << GLLogEnum(sfactor) << GLLogEnum(dfactor);
-}
-
-void API_ENTRY(glClear)(GLbitfield mask) {
-    CALL_GL_API(glClear, mask);
-    GLLog("glClear") << GLLogClearBitfield(mask);
-}
-
-void API_ENTRY(glClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
-    CALL_GL_API(glClearColor, red, green, blue, alpha);
-    GLLog("glClearColor") << red << green << blue << alpha;
-}
-
-void API_ENTRY(glClearColorx)(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) {
-    CALL_GL_API(glClearColorx, red, green, blue, alpha);
-    GLLog("glClearColorx") << GLLogFixed(red) << GLLogFixed(green) << GLLogFixed(blue) << GLLogFixed(alpha);
-}
-
-void API_ENTRY(glClearDepthf)(GLclampf depth) {
-    CALL_GL_API(glClearDepthf, depth);
-    GLLog("glClearDepthf") << depth;
-}
-
-void API_ENTRY(glClearDepthx)(GLclampx depth) {
-    CALL_GL_API(glClearDepthx, depth);
-    GLLog("glClearDepthx") << GLLogFixed(depth);
-}
-
-void API_ENTRY(glClearStencil)(GLint s) {
-    CALL_GL_API(glClearStencil, s);
-    GLLog("glClearStencil") << s;
-}
-
-void API_ENTRY(glClientActiveTexture)(GLenum texture) {
-    CALL_GL_API(glClientActiveTexture, texture);
-    GLLog("glClientActiveTexture") << GLLogEnum(texture);
-}
-
-void API_ENTRY(glColor4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {
-    CALL_GL_API(glColor4f, red, green, blue, alpha);
-    GLLog("glColor4f") << red << green << blue << alpha;
-}
-
-void API_ENTRY(glColor4x)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) {
-    CALL_GL_API(glColor4x, red, green, blue, alpha);
-    GLLog("glColor4x") << GLLogFixed(red) << GLLogFixed(green) << GLLogFixed(blue) << GLLogFixed(alpha);
-}
-
-void API_ENTRY(glColorMask)(GLboolean r, GLboolean g, GLboolean b, GLboolean a) {
-    CALL_GL_API(glColorMask, r, g, b, a);
-    GLLog("glColorMask") << GLLogBool(r) << GLLogBool(g) << GLLogBool(b) << GLLogBool(a);
-}
-
-void API_ENTRY(glColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
-{
-    CALL_GL_API(glColorPointer, size, type, stride, ptr);
-    GLLog("glColorPointer") << size << GLLogEnum(type) << stride << ptr;
-}
-
-void API_ENTRY(glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat,
-                            GLsizei width, GLsizei height, GLint border,
-                            GLsizei imageSize, const GLvoid *data) {
-    CALL_GL_API(glCompressedTexImage2D, target, level, internalformat,
-            width, height, border, imageSize, data);
-    GLLog("glCompressedTexImage2D")
-                << GLLogEnum(target) << level << GLLogEnum(internalformat)
-                << width << height << border << imageSize << data;
-}
-
-void API_ENTRY(glCompressedTexSubImage2D)( GLenum target, GLint level, GLint xoffset,
-                                GLint yoffset, GLsizei width, GLsizei height,
-                                GLenum format, GLsizei imageSize,
-                                const GLvoid *data) {
-    CALL_GL_API(glCompressedTexSubImage2D, target, level, xoffset, yoffset,
-            width, height, format, imageSize, data);
-    GLLog("glCompressedTexSubImage2D")
-            << GLLogEnum(target) << level << xoffset << yoffset
-            << width << height << GLLogEnum(format) << imageSize << data;
-}
-
-void API_ENTRY(glCopyTexImage2D)(  GLenum target, GLint level, GLenum internalformat,
-                        GLint x, GLint y, GLsizei width, GLsizei height,
-                        GLint border) {
-    CALL_GL_API(glCopyTexImage2D, target, level, internalformat, x, y,
-            width, height, border);
-    GLLog("glCopyTexImage2D")
-            << GLLogEnum(target) << level << GLLogEnum(internalformat)
-            << x << y << width << height << border;
-}
-
-void API_ENTRY(glCopyTexSubImage2D)(   GLenum target, GLint level, GLint xoffset,
-                            GLint yoffset, GLint x, GLint y, GLsizei width,
-                            GLsizei height) {
-    CALL_GL_API(glCopyTexSubImage2D, target, level, xoffset, yoffset, x, y,
-            width, height);
-    GLLog("glCopyTexSubImage2D")
-            << GLLogEnum(target) << level << xoffset << yoffset
-            << x << y << width << height;
-}
-
-void API_ENTRY(glCullFace)(GLenum mode) {
-    CALL_GL_API(glCullFace, mode);
-    GLLog("glCullFace") << GLLogEnum(mode);
-}
-
-void API_ENTRY(glDeleteTextures)(GLsizei n, const GLuint *textures) {
-    CALL_GL_API(glDeleteTextures, n, textures);
-    GLLog("glDeleteTextures") << n << GLLogBuffer<GLuint>(textures, n);
-}
-
-void API_ENTRY(glDepthFunc)(GLenum func) {
-    CALL_GL_API(glDepthFunc, func);
-    GLLog("glDepthFunc") << GLLogEnum(func);
-}
-
-void API_ENTRY(glDepthMask)(GLboolean flag) {
-    CALL_GL_API(glDepthMask, flag);
-    GLLog("glDepthMask") << GLLogBool(flag);
-}
-
-void API_ENTRY(glDepthRangef)(GLclampf zNear, GLclampf zFar) {
-    CALL_GL_API(glDepthRangef, zNear, zFar);
-    GLLog("glDepthRangef") << zNear << zFar;
-}
-
-void API_ENTRY(glDepthRangex)(GLclampx zNear, GLclampx zFar) {
-    CALL_GL_API(glDepthRangex, zNear, zFar);
-    GLLog("glDepthRangex") << GLLogFixed(zNear) << GLLogFixed(zFar);
-}
-
-void API_ENTRY(glDisable)(GLenum cap) {
-    CALL_GL_API(glDisable, cap);
-    GLLog("glDisable") << GLLogEnum(cap);
-}
-
-void API_ENTRY(glDisableClientState)(GLenum array) {
-    CALL_GL_API(glDisableClientState, array);
-    GLLog("glDisableClientState") << GLLogEnum(array);
-}
-
-void API_ENTRY(glDrawArrays)(GLenum mode, GLint first, GLsizei count) {
-    CALL_GL_API(glDrawArrays, mode, first, count);
-    GLLog("glDrawArrays") << GLLogEnum(mode) << first << count;
-}
-
-void API_ENTRY(glDrawElements)(GLenum mode, GLsizei count,
-                    GLenum type, const GLvoid *indices) {
-    CALL_GL_API(glDrawElements, mode, count, type, indices);
-    GLLog log("glDrawElements");
-    log << GLLogEnum(mode) << count << GLLogEnum(type);
-    if (type == GL_UNSIGNED_BYTE) {
-        log << GLLogBuffer<GLubyte>(static_cast<const GLubyte*>(indices), count);
-    } else {
-        log << GLLogBuffer<GLushort>(static_cast<const GLushort*>(indices), count);
-    }
-    log;
-}
-
-void API_ENTRY(glEnable)(GLenum cap) {
-    CALL_GL_API(glEnable, cap);
-    GLLog("glEnable") << GLLogEnum(cap);
-}
-
-void API_ENTRY(glEnableClientState)(GLenum array) {
-    CALL_GL_API(glEnableClientState, array);
-    GLLog("glEnableClientState") << GLLogEnum(array);
-}
-
-void API_ENTRY(glFinish)(void) {
-    CALL_GL_API(glFinish);
-    GLLog("glFinish");
-}
-
-void API_ENTRY(glFlush)(void) {
-    CALL_GL_API(glFlush);
-    GLLog("glFlush");
-}
-
-void API_ENTRY(glFogf)(GLenum pname, GLfloat param) {
-    CALL_GL_API(glFogf, pname, param);
-    GLLog("glFogf") << GLLogEnum(pname) << param;
-}
-
-void API_ENTRY(glFogfv)(GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glFogfv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glFogfv") << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-
-void API_ENTRY(glFogx)(GLenum pname, GLfixed param) {
-    CALL_GL_API(glFogx, pname, param);
-    GLLog("glFogx") << GLLogEnum(pname) << GLLogFixed(param);
-}
-
-void API_ENTRY(glFogxv)(GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glFogxv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glFogfx") << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-
-void API_ENTRY(glFrontFace)(GLenum mode) {
-    CALL_GL_API(glFrontFace, mode);
-    GLLog("glFrontFace") << GLLogEnum(mode);
- }
-
-void API_ENTRY(glFrustumf)(GLfloat left, GLfloat right,
-                GLfloat bottom, GLfloat top,
-                GLfloat zNear, GLfloat zFar) {
-    CALL_GL_API(glFrustumf, left, right, bottom, top, zNear, zFar);
-    GLLog("glFrustumf") << left << right << bottom << top << zNear << zFar;
-}
-
-void API_ENTRY(glFrustumx)(GLfixed left, GLfixed right,
-                GLfixed bottom, GLfixed top,
-                GLfixed zNear, GLfixed zFar) {
-    CALL_GL_API(glFrustumx, left, right, bottom, top, zNear, zFar);
-    GLLog("glFrustumx")
-            << GLLogFixed(left) << GLLogFixed(right)
-            << GLLogFixed(bottom) << GLLogFixed(top)
-            << GLLogFixed(zNear) << GLLogFixed(zFar);
-}
-
-void API_ENTRY(glGenTextures)(GLsizei n, GLuint *textures) {
-    CALL_GL_API(glGenTextures, n, textures);
-    GLLog("glGenTextures") << n << GLLogBuffer<GLuint>(textures, n);
-}
-
-GLenum API_ENTRY(glGetError)(void) {
-    GLLog("glGetError");
-    CALL_GL_API_RETURN(glGetError);
-}
-
-void API_ENTRY(glGetIntegerv)(GLenum pname, GLint *params) {
-    CALL_GL_API(glGetIntegerv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetIntegerv") << GLLogEnum(pname) << GLLogBuffer<GLint>(params);
-}
-
-const GLubyte * API_ENTRY(glGetString)(GLenum name) {
-    GLLog("glGetString") << GLLogEnum(name);
-    CALL_GL_API_RETURN(glGetString, name);
-}
-
-void API_ENTRY(glHint)(GLenum target, GLenum mode) {
-    CALL_GL_API(glHint, target, mode);
-    GLLog("GLenum") << GLLogEnum(target) << GLLogEnum(mode);
-}
-
-void API_ENTRY(glLightModelf)(GLenum pname, GLfloat param) {
-    CALL_GL_API(glLightModelf, pname, param);
-    GLLog("glLightModelf") << GLLogEnum(pname) << param;
-}
-
-void API_ENTRY(glLightModelfv)(GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glLightModelfv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glLightModelfv") << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-
-void API_ENTRY(glLightModelx)(GLenum pname, GLfixed param) {
-    CALL_GL_API(glLightModelx, pname, param);
-    GLLog("glLightModelx") << GLLogEnum(pname) << GLLogFixed(param);
-}
-
-void API_ENTRY(glLightModelxv)(GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glLightModelxv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glLightModelxv") << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-
-void API_ENTRY(glLightf)(GLenum light, GLenum pname, GLfloat param) {
-    CALL_GL_API(glLightf, light, pname, param);
-    GLLog("glLightf") << GLLogEnum(light) << GLLogEnum(pname) << param;
-}
-
-void API_ENTRY(glLightfv)(GLenum light, GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glLightfv, light, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glLightfv") << GLLogEnum(light) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-
-void API_ENTRY(glLightx)(GLenum light, GLenum pname, GLfixed param) {
-   CALL_GL_API(glLightx, light, pname, param);
-   GLLog("glLightx") << GLLogEnum(light) << GLLogEnum(pname) << GLLogFixed(param);
-}
-
-void API_ENTRY(glLightxv)(GLenum light, GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glLightxv, light, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glLightxv") << GLLogEnum(light) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-
-void API_ENTRY(glLineWidth)(GLfloat width) {
-    CALL_GL_API(glLineWidth, width);
-    GLLog("glLineWidth") << width;
-}
-
-void API_ENTRY(glLineWidthx)(GLfixed width) {
-    CALL_GL_API(glLineWidthx, width);
-    GLLog("glLineWidth") << GLLogFixed(width);
-}
-
-void API_ENTRY(glLoadIdentity)(void) {
-    CALL_GL_API(glLoadIdentity);
-    GLLog("glLoadIdentity");
-}
-
-void API_ENTRY(glLoadMatrixf)(const GLfloat *m) {
-    CALL_GL_API(glLoadMatrixf, m);
-    GLLog("glLoadMatrixf") << GLLogBuffer<GLfloat>(m, 16);
-}
-
-void API_ENTRY(glLoadMatrixx)(const GLfixed *m) {
-    CALL_GL_API(glLoadMatrixx, m);
-    GLLog("glLoadMatrixx") << GLLogBuffer<GLfixed>(m, 16);
-}
-
-void API_ENTRY(glLogicOp)(GLenum opcode) {
-    CALL_GL_API(glLogicOp, opcode);
-    GLLog("glLogicOp") << GLLogEnum(opcode);
-}
-
-void API_ENTRY(glMaterialf)(GLenum face, GLenum pname, GLfloat param) {
-    CALL_GL_API(glMaterialf, face, pname, param);
-    GLLog("glMaterialf") << GLLogEnum(face) << GLLogEnum(pname) << param;
-}
-
-void API_ENTRY(glMaterialfv)(GLenum face, GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glMaterialfv, face, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glMaterialfv") << GLLogEnum(face) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-
-void API_ENTRY(glMaterialx)(GLenum face, GLenum pname, GLfixed param) {
-    CALL_GL_API(glMaterialx, face, pname, param);
-    GLLog("glMaterialx") << GLLogEnum(face) << GLLogEnum(pname) << GLLogFixed(param);
-}
-
-void API_ENTRY(glMaterialxv)(GLenum face, GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glMaterialxv, face, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glMaterialxv") << GLLogEnum(face) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-
-void API_ENTRY(glMatrixMode)(GLenum mode) {
-    CALL_GL_API(glMatrixMode, mode);
-    GLLog("glMatrixMode") << GLLogEnum(mode);
-}
-
-void API_ENTRY(glMultMatrixf)(const GLfloat *m) {
-    CALL_GL_API(glMultMatrixf, m);
-    GLLog("glMultMatrixf") << GLLogBuffer<GLfloat>(m, 16);
-}
-
-void API_ENTRY(glMultMatrixx)(const GLfixed *m) {
-    CALL_GL_API(glMultMatrixx, m);
-    GLLog("glMultMatrixx") << GLLogBuffer<GLfixed>(m, 16);
-}
-
-void API_ENTRY(glMultiTexCoord4f)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) {
-    CALL_GL_API(glMultiTexCoord4f, target, s, t, r, q);
-    GLLog("glMultiTexCoord4f") << GLLogEnum(target) << s << t << r << q;
-}
-
-void API_ENTRY(glMultiTexCoord4x)(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) {
-    CALL_GL_API(glMultiTexCoord4x, target, s, t, r, q);
-    GLLog("glMultiTexCoord4x") << GLLogEnum(target)
-        << GLLogFixed(s) << GLLogFixed(t) << GLLogFixed(r) << GLLogFixed(q);
-}
-
-void API_ENTRY(glNormal3f)(GLfloat nx, GLfloat ny, GLfloat nz) {
-    CALL_GL_API(glNormal3f, nx, ny, nz);
-    GLLog("glNormal3f") << nx << ny << nz;
-}
-
-void API_ENTRY(glNormal3x)(GLfixed nx, GLfixed ny, GLfixed nz) {
-    CALL_GL_API(glNormal3x, nx, ny, nz);
-    GLLog("glNormal3x") << GLLogFixed(nx) << GLLogFixed(ny) << GLLogFixed(nz);
-}
-
-void API_ENTRY(glNormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer) {
-    CALL_GL_API(glNormalPointer, type, stride, pointer);
-    GLLog("glNormalPointer") << GLLogEnum(type) << stride << pointer;
-}
-
-void API_ENTRY(glOrthof)(  GLfloat left, GLfloat right,
-                GLfloat bottom, GLfloat top,
-                GLfloat zNear, GLfloat zFar) {
-    CALL_GL_API(glOrthof, left, right, bottom, top, zNear, zFar);
-    GLLog("glOrthof") << left << right << bottom << top << zNear << zFar;
-}
-
-void API_ENTRY(glOrthox)(  GLfixed left, GLfixed right,
-                GLfixed bottom, GLfixed top,
-                GLfixed zNear, GLfixed zFar) {
-    CALL_GL_API(glOrthox, left, right, bottom, top, zNear, zFar);
-    GLLog("glOrthox") << GLLogFixed(left) << GLLogFixed(right)
-            << GLLogFixed(bottom) << GLLogFixed(top)
-            << GLLogFixed(zNear) << GLLogFixed(zFar);
-}
-
-void API_ENTRY(glPixelStorei)(GLenum pname, GLint param) {
-    CALL_GL_API(glPixelStorei, pname, param);
-    GLLog("glPixelStorei") << GLLogEnum(pname) << param;
-}
-
-void API_ENTRY(glPointSize)(GLfloat size) {
-    CALL_GL_API(glPointSize, size);
-    GLLog("glPointSize") << size;
-}
-
-void API_ENTRY(glPointSizex)(GLfixed size) {
-    CALL_GL_API(glPointSizex, size);
-    GLLog("glPointSizex") << GLLogFixed(size);
-}
-
-void API_ENTRY(glPolygonOffset)(GLfloat factor, GLfloat units) {
-    CALL_GL_API(glPolygonOffset, factor, units);
-    GLLog("glPolygonOffset") << factor << units;
-}
-
-void API_ENTRY(glPolygonOffsetx)(GLfixed factor, GLfixed units) {
-    CALL_GL_API(glPolygonOffsetx, factor, units);
-    GLLog("glPolygonOffsetx") << GLLogFixed(factor) << GLLogFixed(units);
-}
-
-void API_ENTRY(glPopMatrix)(void) {
-    CALL_GL_API(glPopMatrix);
-    GLLog("glPopMatrix");
-}
-
-void API_ENTRY(glPushMatrix)(void) {
-    CALL_GL_API(glPushMatrix);
-    GLLog("glPushMatrix");
-}
-
-void API_ENTRY(glReadPixels)(  GLint x, GLint y, GLsizei width, GLsizei height,
-                    GLenum format, GLenum type, GLvoid *pixels) {
-    CALL_GL_API(glReadPixels, x, y, width, height, format, type, pixels);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glReadPixels") << x << y << width << height << GLLogEnum(format) << GLLogEnum(type)
-            << GLLogBuffer<unsigned char>(static_cast<unsigned char *>(pixels));
-}
-
-void API_ENTRY(glRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) {
-    CALL_GL_API(glRotatef, angle, x, y, z);
-    GLLog("glRotatef") << angle << x << y << z;
-}
-
-void API_ENTRY(glRotatex)(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) {
-    CALL_GL_API(glRotatex, angle, x, y, z);
-    GLLog("glRotatex") << GLLogFixed(angle) << GLLogFixed(x) << GLLogFixed(y) << GLLogFixed(z);
-}
-
-void API_ENTRY(glSampleCoverage)(GLclampf value, GLboolean invert) {
-    CALL_GL_API(glSampleCoverage, value, invert);
-    GLLog("glSampleCoverage") << value << GLLogBool(invert);
-}
-
-void API_ENTRY(glSampleCoveragex)(GLclampx value, GLboolean invert) {
-    CALL_GL_API(glSampleCoveragex, value, invert);
-    GLLog("glSampleCoveragex") << GLLogFixed(value) << GLLogBool(invert);
-}
-
-void API_ENTRY(glScalef)(GLfloat x, GLfloat y, GLfloat z) {
-    CALL_GL_API(glScalef, x, y, z);
-    GLLog("glScalef") << x << y << z;
-}
-
-void API_ENTRY(glScalex)(GLfixed x, GLfixed y, GLfixed z) {
-    CALL_GL_API(glScalex, x, y, z);
-    GLLog("glScalex") << GLLogFixed(x) << GLLogFixed(y) << GLLogFixed(z);
-}
-
-void API_ENTRY(glScissor)(GLint x, GLint y, GLsizei width, GLsizei height) {
-    CALL_GL_API(glScissor, x, y, width, height);
-    GLLog("glScissor") << x << y << width << height;
-}
-
-void API_ENTRY(glShadeModel)(GLenum mode) {
-    CALL_GL_API(glShadeModel, mode);
-    GLLog("glShadeModel") << GLLogEnum(mode);
-}
-
-void API_ENTRY(glStencilFunc)(GLenum func, GLint ref, GLuint mask) {
-    CALL_GL_API(glStencilFunc, func, ref, mask);
-    GLLog("glStencilFunc") << GLLogEnum(func) << ref << mask;
-}
-
-void API_ENTRY(glStencilMask)(GLuint mask) {
-    CALL_GL_API(glStencilMask, mask);
-    GLLog("glStencilMask") << mask;
-}
-
-void API_ENTRY(glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass) {
-    CALL_GL_API(glStencilOp, fail, zfail, zpass);
-    GLLog("glStencilOp") << GLLogEnum(fail) << GLLogEnum(zfail) << GLLogEnum(zpass);
-}
-
-void API_ENTRY(glTexCoordPointer)( GLint size, GLenum type,
-                        GLsizei stride, const GLvoid *pointer) {
-    CALL_GL_API(glTexCoordPointer, size, type, stride, pointer);
-    GLLog("glTexCoordPointer") << size << GLLogEnum(type) << stride << pointer;
-}
-
-void API_ENTRY(glTexEnvf)(GLenum target, GLenum pname, GLfloat param) {
-    CALL_GL_API(glTexEnvf, target, pname, param);
-    GLLog("glTexEnvf") << GLLogEnum(target) << GLLogEnum(pname) << param;
-}
-
-void API_ENTRY(glTexEnvfv)(GLenum target, GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glTexEnvfv, target, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glTexEnvx") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-
-void API_ENTRY(glTexEnvx)(GLenum target, GLenum pname, GLfixed param) {
-    CALL_GL_API(glTexEnvx, target, pname, param);
-    GLLog("glTexEnvx") << GLLogEnum(target) << GLLogEnum(pname) << GLLogFixed(param);
-}
-
-void API_ENTRY(glTexEnvxv)(GLenum target, GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glTexEnvxv, target, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glTexEnvxv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-
-void API_ENTRY(glTexImage2D)(  GLenum target, GLint level, GLint internalformat,
-                    GLsizei width, GLsizei height, GLint border, GLenum format,
-                    GLenum type, const GLvoid *pixels) {
-    CALL_GL_API(glTexImage2D, target, level, internalformat, width, height,
-            border, format, type, pixels);
-    GLLog("glTexImage2D") << GLLogEnum(target) << level << GLLogEnum(internalformat)
-            << width << height << border << GLLogEnum(format) << GLLogEnum(type)
-            << GLLogBuffer<unsigned char>( static_cast<const unsigned char *>(pixels));
-}
-
-void API_ENTRY(glTexParameterf)(GLenum target, GLenum pname, GLfloat param) {
-    CALL_GL_API(glTexParameterf, target, pname, param);
-    GLLog("glTexParameterf") << GLLogEnum(target) << GLLogEnum(pname) << param;
-}
-
-void API_ENTRY(glTexParameterx)(GLenum target, GLenum pname, GLfixed param) {
-    CALL_GL_API(glTexParameterx, target, pname, param);
-    GLLog("glTexParameterx") << GLLogEnum(target) << GLLogEnum(pname) << GLLogFixed(param);
-}
-
-void API_ENTRY(glTexSubImage2D)(   GLenum target, GLint level, GLint xoffset,
-                        GLint yoffset, GLsizei width, GLsizei height,
-                        GLenum format, GLenum type, const GLvoid *pixels) {
-    CALL_GL_API(glTexSubImage2D, target, level, xoffset, yoffset,
-            width, height, format, type, pixels);
-    GLLog("glTexSubImage2D") << GLLogEnum(target) << level << xoffset << yoffset
-            << width << height << GLLogEnum(format) << GLLogEnum(type)
-            << GLLogBuffer<unsigned char>( static_cast<const unsigned char *>(pixels));
-}
-
-void API_ENTRY(glTranslatef)(GLfloat x, GLfloat y, GLfloat z) {
-    CALL_GL_API(glTranslatef, x, y, z);
-    GLLog("glTranslatef") << x << y << z;
-}
-
-void API_ENTRY(glTranslatex)(GLfixed x, GLfixed y, GLfixed z) {
-    CALL_GL_API(glTranslatex, x, y, z);
-    GLLog("glTranslatex") << GLLogFixed(x) << GLLogFixed(y) << GLLogFixed(z);
-}
-
-void API_ENTRY(glVertexPointer)(   GLint size, GLenum type,
-                        GLsizei stride, const GLvoid *pointer) {
-    CALL_GL_API(glVertexPointer, size, type, stride, pointer);
-    GLLog("glVertexPointer") << size << GLLogEnum(type) << stride << pointer;
-}
-
-void API_ENTRY(glViewport)(GLint x, GLint y, GLsizei width, GLsizei height) {
-    CALL_GL_API(glViewport, x, y, width, height);
-    GLLog("glViewport") << x << y << width << height;
-}
-
-// ES 1.1
-void API_ENTRY(glClipPlanef)(GLenum plane, const GLfloat *equation) {
-    CALL_GL_API(glClipPlanef, plane, equation);
-    GLLog("glClipPlanef") << GLLogEnum(plane) << GLLogBuffer<GLfloat>(equation, 4);
-}
-void API_ENTRY(glClipPlanex)(GLenum plane, const GLfixed *equation) {
-    CALL_GL_API(glClipPlanex, plane, equation);
-    GLLog("glClipPlanex") << GLLogEnum(plane) << GLLogBuffer<GLfixed>(equation, 4);
-}
-void API_ENTRY(glBindBuffer)(GLenum target, GLuint buffer) {
-    CALL_GL_API(glBindBuffer, target, buffer);
-    GLLog("glBindBuffer") << GLLogEnum(target) << buffer;
-}
-void API_ENTRY(glBufferData)(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) {
-    CALL_GL_API(glBufferData, target, size, data, usage);
-    GLLog("glBufferData") << GLLogEnum(target) << size
-        << GLLogBuffer<unsigned char>(static_cast<const unsigned char*>(data), size);
-}
-void API_ENTRY(glBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) {
-    CALL_GL_API(glBufferSubData, target, offset, size, data);
-    GLLog("glBufferSubData") << GLLogEnum(target) << offset << size
-        << GLLogBuffer<unsigned char>(static_cast<const unsigned char*>(data), size);
-}
-void API_ENTRY(glDeleteBuffers)(GLsizei n, const GLuint* buffers) {
-    CALL_GL_API(glDeleteBuffers, n, buffers);
-    GLLog("glDeleteBuffers") << n << GLLogBuffer<GLuint>(buffers, n);
-}
-void API_ENTRY(glGenBuffers)(GLsizei n, GLuint* buffers) {
-    CALL_GL_API(glGenBuffers, n, buffers);
-    GLLog("glGenBuffers") << n << GLLogBuffer<GLuint>(buffers, n);
-}
-void API_ENTRY(glGetBooleanv)(GLenum pname, GLboolean *params) {
-    CALL_GL_API(glGetBooleanv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetBooleanv") << GLLogEnum(pname) << GLLogBuffer<GLboolean>(params);
-}
-void API_ENTRY(glGetFixedv)(GLenum pname, GLfixed *params) {
-    CALL_GL_API(glGetFixedv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetFixedv") << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-void API_ENTRY(glGetFloatv)(GLenum pname, GLfloat *params) {
-    CALL_GL_API(glGetFloatv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetFloatv") << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-void API_ENTRY(glGetPointerv)(GLenum pname, void **params) {
-    CALL_GL_API(glGetPointerv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetPointerv") << GLLogEnum(pname) << GLLogBuffer<void*>(params);
-}
-void API_ENTRY(glGetBufferParameteriv)(GLenum target, GLenum pname, GLint *params) {
-    // XXX: we need to compute the size of this buffer
-    CALL_GL_API(glGetBufferParameteriv, target, pname, params);
-    GLLog("glGetBufferParameteriv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLint>(params);
-}
-void API_ENTRY(glGetClipPlanef)(GLenum pname, GLfloat eqn[4]) {
-    CALL_GL_API(glGetClipPlanef, pname, eqn);
-    GLLog("glGetClipPlanef") << GLLogEnum(pname) << GLLogBuffer<GLfloat>(eqn, 4);
-}
-void API_ENTRY(glGetClipPlanex)(GLenum pname, GLfixed eqn[4]) {
-    CALL_GL_API(glGetClipPlanex, pname, eqn);
-    GLLog("glGetClipPlanex") << GLLogEnum(pname) << GLLogBuffer<GLfixed>(eqn, 4);
-}
-void API_ENTRY(glGetLightxv)(GLenum light, GLenum pname, GLfixed *params) {
-    CALL_GL_API(glGetLightxv, light, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetLightxv") << GLLogEnum(light) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-void API_ENTRY(glGetLightfv)(GLenum light, GLenum pname, GLfloat *params) {
-    CALL_GL_API(glGetLightfv, light, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetLightfv") << GLLogEnum(light) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-void API_ENTRY(glGetMaterialxv)(GLenum face, GLenum pname, GLfixed *params) {
-    CALL_GL_API(glGetMaterialxv, face, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetMaterialxv") << GLLogEnum(face) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-void API_ENTRY(glGetMaterialfv)(GLenum face, GLenum pname, GLfloat *params) {
-    CALL_GL_API(glGetMaterialfv, face, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetMaterialfv") << GLLogEnum(face) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-void API_ENTRY(glGetTexEnvfv)(GLenum env, GLenum pname, GLfloat *params) {
-    CALL_GL_API(glGetTexEnvfv, env, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetTexEnvfv") << GLLogEnum(env) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-void API_ENTRY(glGetTexEnviv)(GLenum env, GLenum pname, GLint *params) {
-    CALL_GL_API(glGetTexEnviv, env, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetTexEnviv") << GLLogEnum(env) << GLLogEnum(pname) << GLLogBuffer<GLint>(params);
-}
-void API_ENTRY(glGetTexEnvxv)(GLenum env, GLenum pname, GLfixed *params) {
-    CALL_GL_API(glGetTexEnvxv, env, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetTexEnvxv") << GLLogEnum(env) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-void API_ENTRY(glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat *params) {
-    CALL_GL_API(glGetTexParameterfv, target, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetTexParameterfv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-void API_ENTRY(glGetTexParameteriv)(GLenum target, GLenum pname, GLint *params) {
-    CALL_GL_API(glGetTexParameteriv, target, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetTexParameteriv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLint>(params);
-}
-void API_ENTRY(glGetTexParameterxv)(GLenum target, GLenum pname, GLfixed *params) {
-    CALL_GL_API(glGetTexParameterxv, target, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetTexParameterxv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-GLboolean API_ENTRY(glIsBuffer)(GLuint buffer) {
-    GLLog("glIsBuffer") << buffer;
-    CALL_GL_API_RETURN(glIsBuffer, buffer);
-}
-GLboolean API_ENTRY(glIsEnabled)(GLenum cap) {
-    GLLog("glIsEnabled") << GLLogEnum(cap);
-    CALL_GL_API_RETURN(glIsEnabled, cap);
-}
-GLboolean API_ENTRY(glIsTexture)(GLuint texture) {
-    GLLog("glIsTexture") << texture;
-    CALL_GL_API_RETURN(glIsTexture, texture);
-}
-void API_ENTRY(glPointParameterf)(GLenum pname, GLfloat param) {
-    CALL_GL_API(glPointParameterf, pname, param);
-    GLLog("glPointParameterf") << GLLogEnum(pname) << param;
-}
-void API_ENTRY(glPointParameterfv)(GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glPointParameterfv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glPointParameterfv") << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-void API_ENTRY(glPointParameterx)(GLenum pname, GLfixed param) {
-    CALL_GL_API(glPointParameterx, pname, param);
-    GLLog("glPointParameterx") << GLLogEnum(pname) << GLLogFixed(param);
-}
-void API_ENTRY(glPointParameterxv)(GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glPointParameterxv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glPointParameterxv") << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-void API_ENTRY(glColor4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) {
-    CALL_GL_API(glColor4ub, red, green, blue, alpha);
-    GLLog("glColor4ub") << red << green << blue << alpha;
-}
-void API_ENTRY(glTexEnvi)(GLenum target, GLenum pname, GLint param) {
-    CALL_GL_API(glTexEnvi, target, pname, param);
-    GLLog("glTexEnvi") << GLLogEnum(target) << GLLogEnum(pname) << param;
-}
-void API_ENTRY(glTexEnviv)(GLenum target, GLenum pname, const GLint *params) {
-    CALL_GL_API(glTexEnviv, target, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glTexEnviv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLint>(params);
-}
-
-void API_ENTRY(glTexParameterfv)(GLenum target, GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glTexParameterfv, target, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glTexParameterfv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-
-void API_ENTRY(glTexParameteriv)(GLenum target, GLenum pname, const GLint *params) {
-    CALL_GL_API(glTexParameteriv, target, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glTexParameteriv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLint>(params);
-}
-
-void API_ENTRY(glTexParameteri)(GLenum target, GLenum pname, GLint param) {
-    CALL_GL_API(glTexParameteri, target, pname, param);
-    GLLog("glTexParameteri") << GLLogEnum(target) << GLLogEnum(pname) << param;
-}
-void API_ENTRY(glTexParameterxv)(GLenum target, GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glTexParameterxv, target, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glTexParameterxv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-void API_ENTRY(glPointSizePointerOES)(GLenum type, GLsizei stride, const GLvoid *pointer) {
-    CALL_GL_API(glPointSizePointerOES, type, stride, pointer);
-    GLLog("glPointSizePointerOES") << GLLogEnum(type) << stride << pointer;
-}
-
-// Extensions
-void API_ENTRY(glDrawTexsOES)(GLshort x , GLshort y, GLshort z, GLshort w, GLshort h) {
-    CALL_GL_API(glDrawTexsOES, x, y, z, w, h);
-    GLLog("glDrawTexsOES") << x << y << z << w << h;
-}
-void API_ENTRY(glDrawTexiOES)(GLint x, GLint y, GLint z, GLint w, GLint h) {
-    CALL_GL_API(glDrawTexiOES, x, y, z, w, h);
-    GLLog("glDrawTexiOES") << x << y << z << w << h;
-}
-void API_ENTRY(glDrawTexfOES)(GLfloat x, GLfloat y, GLfloat z, GLfloat w, GLfloat h) {
-    CALL_GL_API(glDrawTexfOES, x, y, z, w, h);
-    GLLog("glDrawTexfOES") << x << y << z << w << h;
-}
-void API_ENTRY(glDrawTexxOES)(GLfixed x, GLfixed y, GLfixed z, GLfixed w, GLfixed h) {
-    CALL_GL_API(glDrawTexxOES, x, y, z, w, h);
-    GLLog("glDrawTexfOES") << GLLogFixed(x) << GLLogFixed(y) << GLLogFixed(z) << GLLogFixed(w) << GLLogFixed(h);
-}
-void API_ENTRY(glDrawTexsvOES)(const GLshort* coords) {
-    CALL_GL_API(glDrawTexsvOES, coords);
-    GLLog("glDrawTexsvOES") << GLLogBuffer<GLshort>(coords, 5);
-}
-void API_ENTRY(glDrawTexivOES)(const GLint* coords) {
-    CALL_GL_API(glDrawTexivOES, coords);
-    GLLog("glDrawTexivOES") << GLLogBuffer<GLint>(coords, 5);
-}
-void API_ENTRY(glDrawTexfvOES)(const GLfloat* coords) {
-    CALL_GL_API(glDrawTexfvOES, coords);
-    GLLog("glDrawTexfvOES") << GLLogBuffer<GLfloat>(coords, 5);
-}
-void API_ENTRY(glDrawTexxvOES)(const GLfixed* coords) {
-    CALL_GL_API(glDrawTexxvOES, coords);
-    GLLog("glDrawTexxvOES") << GLLogBuffer<GLfixed>(coords, 5);
-}
-GLbitfield API_ENTRY(glQueryMatrixxOES)(GLfixed* mantissa, GLint* exponent) {
-    GLLog("glQueryMatrixxOES") << GLLogBuffer<GLfixed>(mantissa, 16) << GLLogBuffer<GLfixed>(exponent, 16);
-    CALL_GL_API_RETURN(glQueryMatrixxOES, mantissa, exponent);
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
diff --git a/opengl/libs/GLES_CM/glext_api.in b/opengl/libs/GLES_CM/glext_api.in
new file mode 100644
index 0000000..2c8648e
--- /dev/null
+++ b/opengl/libs/GLES_CM/glext_api.in
@@ -0,0 +1,270 @@
+void API_ENTRY(glBlendEquationSeparateOES)(GLenum modeRGB, GLenum modeAlpha) {
+    CALL_GL_API(glBlendEquationSeparateOES, modeRGB, modeAlpha);
+}
+void API_ENTRY(glBlendFuncSeparateOES)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) {
+    CALL_GL_API(glBlendFuncSeparateOES, srcRGB, dstRGB, srcAlpha, dstAlpha);
+}
+void API_ENTRY(glBlendEquationOES)(GLenum mode) {
+    CALL_GL_API(glBlendEquationOES, mode);
+}
+void API_ENTRY(glDrawTexsOES)(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height) {
+    CALL_GL_API(glDrawTexsOES, x, y, z, width, height);
+}
+void API_ENTRY(glDrawTexiOES)(GLint x, GLint y, GLint z, GLint width, GLint height) {
+    CALL_GL_API(glDrawTexiOES, x, y, z, width, height);
+}
+void API_ENTRY(glDrawTexxOES)(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height) {
+    CALL_GL_API(glDrawTexxOES, x, y, z, width, height);
+}
+void API_ENTRY(glDrawTexsvOES)(const GLshort *coords) {
+    CALL_GL_API(glDrawTexsvOES, coords);
+}
+void API_ENTRY(glDrawTexivOES)(const GLint *coords) {
+    CALL_GL_API(glDrawTexivOES, coords);
+}
+void API_ENTRY(glDrawTexxvOES)(const GLfixed *coords) {
+    CALL_GL_API(glDrawTexxvOES, coords);
+}
+void API_ENTRY(glDrawTexfOES)(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height) {
+    CALL_GL_API(glDrawTexfOES, x, y, z, width, height);
+}
+void API_ENTRY(glDrawTexfvOES)(const GLfloat *coords) {
+    CALL_GL_API(glDrawTexfvOES, coords);
+}
+void API_ENTRY(__glEGLImageTargetTexture2DOES)(GLenum target, GLeglImageOES image) {
+    CALL_GL_API(glEGLImageTargetTexture2DOES, target, image);
+}
+void API_ENTRY(__glEGLImageTargetRenderbufferStorageOES)(GLenum target, GLeglImageOES image) {
+    CALL_GL_API(glEGLImageTargetRenderbufferStorageOES, target, image);
+}
+void API_ENTRY(glAlphaFuncxOES)(GLenum func, GLclampx ref) {
+    CALL_GL_API(glAlphaFuncxOES, func, ref);
+}
+void API_ENTRY(glClearColorxOES)(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) {
+    CALL_GL_API(glClearColorxOES, red, green, blue, alpha);
+}
+void API_ENTRY(glClearDepthxOES)(GLclampx depth) {
+    CALL_GL_API(glClearDepthxOES, depth);
+}
+void API_ENTRY(glClipPlanexOES)(GLenum plane, const GLfixed *equation) {
+    CALL_GL_API(glClipPlanexOES, plane, equation);
+}
+void API_ENTRY(glColor4xOES)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) {
+    CALL_GL_API(glColor4xOES, red, green, blue, alpha);
+}
+void API_ENTRY(glDepthRangexOES)(GLclampx zNear, GLclampx zFar) {
+    CALL_GL_API(glDepthRangexOES, zNear, zFar);
+}
+void API_ENTRY(glFogxOES)(GLenum pname, GLfixed param) {
+    CALL_GL_API(glFogxOES, pname, param);
+}
+void API_ENTRY(glFogxvOES)(GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glFogxvOES, pname, params);
+}
+void API_ENTRY(glFrustumxOES)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) {
+    CALL_GL_API(glFrustumxOES, left, right, bottom, top, zNear, zFar);
+}
+void API_ENTRY(glGetClipPlanexOES)(GLenum pname, GLfixed eqn[4]) {
+    CALL_GL_API(glGetClipPlanexOES, pname, eqn);
+}
+void API_ENTRY(glGetFixedvOES)(GLenum pname, GLfixed *params) {
+    CALL_GL_API(glGetFixedvOES, pname, params);
+}
+void API_ENTRY(glGetLightxvOES)(GLenum light, GLenum pname, GLfixed *params) {
+    CALL_GL_API(glGetLightxvOES, light, pname, params);
+}
+void API_ENTRY(glGetMaterialxvOES)(GLenum face, GLenum pname, GLfixed *params) {
+    CALL_GL_API(glGetMaterialxvOES, face, pname, params);
+}
+void API_ENTRY(glGetTexEnvxvOES)(GLenum env, GLenum pname, GLfixed *params) {
+    CALL_GL_API(glGetTexEnvxvOES, env, pname, params);
+}
+void API_ENTRY(glGetTexParameterxvOES)(GLenum target, GLenum pname, GLfixed *params) {
+    CALL_GL_API(glGetTexParameterxvOES, target, pname, params);
+}
+void API_ENTRY(glLightModelxOES)(GLenum pname, GLfixed param) {
+    CALL_GL_API(glLightModelxOES, pname, param);
+}
+void API_ENTRY(glLightModelxvOES)(GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glLightModelxvOES, pname, params);
+}
+void API_ENTRY(glLightxOES)(GLenum light, GLenum pname, GLfixed param) {
+    CALL_GL_API(glLightxOES, light, pname, param);
+}
+void API_ENTRY(glLightxvOES)(GLenum light, GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glLightxvOES, light, pname, params);
+}
+void API_ENTRY(glLineWidthxOES)(GLfixed width) {
+    CALL_GL_API(glLineWidthxOES, width);
+}
+void API_ENTRY(glLoadMatrixxOES)(const GLfixed *m) {
+    CALL_GL_API(glLoadMatrixxOES, m);
+}
+void API_ENTRY(glMaterialxOES)(GLenum face, GLenum pname, GLfixed param) {
+    CALL_GL_API(glMaterialxOES, face, pname, param);
+}
+void API_ENTRY(glMaterialxvOES)(GLenum face, GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glMaterialxvOES, face, pname, params);
+}
+void API_ENTRY(glMultMatrixxOES)(const GLfixed *m) {
+    CALL_GL_API(glMultMatrixxOES, m);
+}
+void API_ENTRY(glMultiTexCoord4xOES)(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) {
+    CALL_GL_API(glMultiTexCoord4xOES, target, s, t, r, q);
+}
+void API_ENTRY(glNormal3xOES)(GLfixed nx, GLfixed ny, GLfixed nz) {
+    CALL_GL_API(glNormal3xOES, nx, ny, nz);
+}
+void API_ENTRY(glOrthoxOES)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) {
+    CALL_GL_API(glOrthoxOES, left, right, bottom, top, zNear, zFar);
+}
+void API_ENTRY(glPointParameterxOES)(GLenum pname, GLfixed param) {
+    CALL_GL_API(glPointParameterxOES, pname, param);
+}
+void API_ENTRY(glPointParameterxvOES)(GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glPointParameterxvOES, pname, params);
+}
+void API_ENTRY(glPointSizexOES)(GLfixed size) {
+    CALL_GL_API(glPointSizexOES, size);
+}
+void API_ENTRY(glPolygonOffsetxOES)(GLfixed factor, GLfixed units) {
+    CALL_GL_API(glPolygonOffsetxOES, factor, units);
+}
+void API_ENTRY(glRotatexOES)(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) {
+    CALL_GL_API(glRotatexOES, angle, x, y, z);
+}
+void API_ENTRY(glSampleCoveragexOES)(GLclampx value, GLboolean invert) {
+    CALL_GL_API(glSampleCoveragexOES, value, invert);
+}
+void API_ENTRY(glScalexOES)(GLfixed x, GLfixed y, GLfixed z) {
+    CALL_GL_API(glScalexOES, x, y, z);
+}
+void API_ENTRY(glTexEnvxOES)(GLenum target, GLenum pname, GLfixed param) {
+    CALL_GL_API(glTexEnvxOES, target, pname, param);
+}
+void API_ENTRY(glTexEnvxvOES)(GLenum target, GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glTexEnvxvOES, target, pname, params);
+}
+void API_ENTRY(glTexParameterxOES)(GLenum target, GLenum pname, GLfixed param) {
+    CALL_GL_API(glTexParameterxOES, target, pname, param);
+}
+void API_ENTRY(glTexParameterxvOES)(GLenum target, GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glTexParameterxvOES, target, pname, params);
+}
+void API_ENTRY(glTranslatexOES)(GLfixed x, GLfixed y, GLfixed z) {
+    CALL_GL_API(glTranslatexOES, x, y, z);
+}
+GLboolean API_ENTRY(glIsRenderbufferOES)(GLuint renderbuffer) {
+    CALL_GL_API_RETURN(glIsRenderbufferOES, renderbuffer);
+}
+void API_ENTRY(glBindRenderbufferOES)(GLenum target, GLuint renderbuffer) {
+    CALL_GL_API(glBindRenderbufferOES, target, renderbuffer);
+}
+void API_ENTRY(glDeleteRenderbuffersOES)(GLsizei n, const GLuint* renderbuffers) {
+    CALL_GL_API(glDeleteRenderbuffersOES, n, renderbuffers);
+}
+void API_ENTRY(glGenRenderbuffersOES)(GLsizei n, GLuint* renderbuffers) {
+    CALL_GL_API(glGenRenderbuffersOES, n, renderbuffers);
+}
+void API_ENTRY(glRenderbufferStorageOES)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) {
+    CALL_GL_API(glRenderbufferStorageOES, target, internalformat, width, height);
+}
+void API_ENTRY(glGetRenderbufferParameterivOES)(GLenum target, GLenum pname, GLint* params) {
+    CALL_GL_API(glGetRenderbufferParameterivOES, target, pname, params);
+}
+GLboolean API_ENTRY(glIsFramebufferOES)(GLuint framebuffer) {
+    CALL_GL_API_RETURN(glIsFramebufferOES, framebuffer);
+}
+void API_ENTRY(glBindFramebufferOES)(GLenum target, GLuint framebuffer) {
+    CALL_GL_API(glBindFramebufferOES, target, framebuffer);
+}
+void API_ENTRY(glDeleteFramebuffersOES)(GLsizei n, const GLuint* framebuffers) {
+    CALL_GL_API(glDeleteFramebuffersOES, n, framebuffers);
+}
+void API_ENTRY(glGenFramebuffersOES)(GLsizei n, GLuint* framebuffers) {
+    CALL_GL_API(glGenFramebuffersOES, n, framebuffers);
+}
+GLenum API_ENTRY(glCheckFramebufferStatusOES)(GLenum target) {
+    CALL_GL_API_RETURN(glCheckFramebufferStatusOES, target);
+}
+void API_ENTRY(glFramebufferRenderbufferOES)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) {
+    CALL_GL_API(glFramebufferRenderbufferOES, target, attachment, renderbuffertarget, renderbuffer);
+}
+void API_ENTRY(glFramebufferTexture2DOES)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) {
+    CALL_GL_API(glFramebufferTexture2DOES, target, attachment, textarget, texture, level);
+}
+void API_ENTRY(glGetFramebufferAttachmentParameterivOES)(GLenum target, GLenum attachment, GLenum pname, GLint* params) {
+    CALL_GL_API(glGetFramebufferAttachmentParameterivOES, target, attachment, pname, params);
+}
+void API_ENTRY(glGenerateMipmapOES)(GLenum target) {
+    CALL_GL_API(glGenerateMipmapOES, target);
+}
+void* API_ENTRY(glMapBufferOES)(GLenum target, GLenum access) {
+    CALL_GL_API_RETURN(glMapBufferOES, target, access);
+}
+GLboolean API_ENTRY(glUnmapBufferOES)(GLenum target) {
+    CALL_GL_API_RETURN(glUnmapBufferOES, target);
+}
+void API_ENTRY(glGetBufferPointervOES)(GLenum target, GLenum pname, void** params) {
+    CALL_GL_API(glGetBufferPointervOES, target, pname, params);
+}
+void API_ENTRY(glCurrentPaletteMatrixOES)(GLuint matrixpaletteindex) {
+    CALL_GL_API(glCurrentPaletteMatrixOES, matrixpaletteindex);
+}
+void API_ENTRY(glLoadPaletteFromModelViewMatrixOES)(void) {
+    CALL_GL_API(glLoadPaletteFromModelViewMatrixOES);
+}
+void API_ENTRY(glMatrixIndexPointerOES)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
+    CALL_GL_API(glMatrixIndexPointerOES, size, type, stride, pointer);
+}
+void API_ENTRY(glWeightPointerOES)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
+    CALL_GL_API(glWeightPointerOES, size, type, stride, pointer);
+}
+GLbitfield API_ENTRY(glQueryMatrixxOES)(GLfixed mantissa[16], GLint exponent[16]) {
+    CALL_GL_API_RETURN(glQueryMatrixxOES, mantissa, exponent);
+}
+void API_ENTRY(glDepthRangefOES)(GLclampf zNear, GLclampf zFar) {
+    CALL_GL_API(glDepthRangefOES, zNear, zFar);
+}
+void API_ENTRY(glFrustumfOES)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) {
+    CALL_GL_API(glFrustumfOES, left, right, bottom, top, zNear, zFar);
+}
+void API_ENTRY(glOrthofOES)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) {
+    CALL_GL_API(glOrthofOES, left, right, bottom, top, zNear, zFar);
+}
+void API_ENTRY(glClipPlanefOES)(GLenum plane, const GLfloat *equation) {
+    CALL_GL_API(glClipPlanefOES, plane, equation);
+}
+void API_ENTRY(glGetClipPlanefOES)(GLenum pname, GLfloat eqn[4]) {
+    CALL_GL_API(glGetClipPlanefOES, pname, eqn);
+}
+void API_ENTRY(glClearDepthfOES)(GLclampf depth) {
+    CALL_GL_API(glClearDepthfOES, depth);
+}
+void API_ENTRY(glTexGenfOES)(GLenum coord, GLenum pname, GLfloat param) {
+    CALL_GL_API(glTexGenfOES, coord, pname, param);
+}
+void API_ENTRY(glTexGenfvOES)(GLenum coord, GLenum pname, const GLfloat *params) {
+    CALL_GL_API(glTexGenfvOES, coord, pname, params);
+}
+void API_ENTRY(glTexGeniOES)(GLenum coord, GLenum pname, GLint param) {
+    CALL_GL_API(glTexGeniOES, coord, pname, param);
+}
+void API_ENTRY(glTexGenivOES)(GLenum coord, GLenum pname, const GLint *params) {
+    CALL_GL_API(glTexGenivOES, coord, pname, params);
+}
+void API_ENTRY(glTexGenxOES)(GLenum coord, GLenum pname, GLfixed param) {
+    CALL_GL_API(glTexGenxOES, coord, pname, param);
+}
+void API_ENTRY(glTexGenxvOES)(GLenum coord, GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glTexGenxvOES, coord, pname, params);
+}
+void API_ENTRY(glGetTexGenfvOES)(GLenum coord, GLenum pname, GLfloat *params) {
+    CALL_GL_API(glGetTexGenfvOES, coord, pname, params);
+}
+void API_ENTRY(glGetTexGenivOES)(GLenum coord, GLenum pname, GLint *params) {
+    CALL_GL_API(glGetTexGenivOES, coord, pname, params);
+}
+void API_ENTRY(glGetTexGenxvOES)(GLenum coord, GLenum pname, GLfixed *params) {
+    CALL_GL_API(glGetTexGenxvOES, coord, pname, params);
+}
diff --git a/opengl/libs/egl_entries.in b/opengl/libs/egl_entries.in
index 33b4c65..3b4551b 100644
--- a/opengl/libs/egl_entries.in
+++ b/opengl/libs/egl_entries.in
@@ -43,3 +43,10 @@
 /* EGL 1.3 */
 
 /* EGL 1.4 */
+
+/* EGL_EGLEXT_VERSION 3 */
+
+EGL_ENTRY(EGLBoolean,  eglLockSurfaceKHR,   EGLDisplay, EGLSurface, const EGLint *)
+EGL_ENTRY(EGLBoolean,  eglUnlockSurfaceKHR, EGLDisplay, EGLSurface)
+EGL_ENTRY(EGLImageKHR, eglCreateImageKHR,   EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, const EGLint *)
+EGL_ENTRY(EGLBoolean,  eglDestroyImageKHR,  EGLDisplay, EGLImageKHR)
diff --git a/opengl/libs/egl_impl.h b/opengl/libs/egl_impl.h
index 62ce3fc..312b176 100644
--- a/opengl/libs/egl_impl.h
+++ b/opengl/libs/egl_impl.h
@@ -20,6 +20,8 @@
 #include <ctype.h>
 
 #include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <EGL/eglplatform.h>
 
 // ----------------------------------------------------------------------------
 namespace android {
diff --git a/opengl/libs/gl_entries.in b/opengl/libs/gl_entries.in
index b97e8fe..d7cc5da 100644
--- a/opengl/libs/gl_entries.in
+++ b/opengl/libs/gl_entries.in
@@ -1,159 +1,145 @@
-GL_ENTRY(void, glColor4f, GLfloat, GLfloat, GLfloat, GLfloat)
-GL_ENTRY(void, glColor4x, GLfixed, GLfixed, GLfixed, GLfixed)
-GL_ENTRY(void, glNormal3f, GLfloat, GLfloat, GLfloat)
-GL_ENTRY(void, glNormal3x, GLfixed, GLfixed, GLfixed)
-GL_ENTRY(void, glCullFace, GLenum)
-GL_ENTRY(void, glFrontFace, GLenum)
-GL_ENTRY(void, glDisable, GLenum)
-GL_ENTRY(void, glEnable, GLenum)
-GL_ENTRY(void, glFinish, void)
-GL_ENTRY(void, glFlush, void)
-GL_ENTRY(GLenum, glGetError, void)
-GL_ENTRY(const GLubyte*, glGetString, GLenum)
-GL_ENTRY(void, glGetIntegerv, GLenum, GLint *)
-GL_ENTRY(void, glColorMask, GLboolean, GLboolean, GLboolean, GLboolean)
-GL_ENTRY(void, glDepthMask, GLboolean)
-GL_ENTRY(void, glStencilMask, GLuint)
-GL_ENTRY(void, glDepthFunc, GLenum)
-GL_ENTRY(void, glDepthRangef, GLclampf zNear, GLclampf zFar)
-GL_ENTRY(void, glDepthRangex, GLclampx zNear, GLclampx zFar)
-GL_ENTRY(void, glPolygonOffset, GLfloat factor, GLfloat units)
-GL_ENTRY(void, glPolygonOffsetx, GLfixed factor, GLfixed units)
-GL_ENTRY(void, glLogicOp, GLenum opcode)
-GL_ENTRY(void, glAlphaFuncx, GLenum func, GLclampx ref)
 GL_ENTRY(void, glAlphaFunc, GLenum func, GLclampf ref)
-GL_ENTRY(void, glBlendFunc, GLenum sfactor, GLenum dfactor)
-GL_ENTRY(void, glClear, GLbitfield mask)
-GL_ENTRY(void, glClearColor, GLclampf r, GLclampf g, GLclampf b, GLclampf a)
-GL_ENTRY(void, glClearColorx, GLclampx r, GLclampx g, GLclampx b, GLclampx a)
+GL_ENTRY(void, glClearColor, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
 GL_ENTRY(void, glClearDepthf, GLclampf depth)
+GL_ENTRY(void, glClipPlanef, GLenum plane, const GLfloat *equation)
+GL_ENTRY(void, glColor4f, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+GL_ENTRY(void, glDepthRangef, GLclampf zNear, GLclampf zFar)
+GL_ENTRY(void, glFogf, GLenum pname, GLfloat param)
+GL_ENTRY(void, glFogfv, GLenum pname, const GLfloat *params)
+GL_ENTRY(void, glFrustumf, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
+GL_ENTRY(void, glGetClipPlanef, GLenum pname, GLfloat eqn[4])
+GL_ENTRY(void, glGetFloatv, GLenum pname, GLfloat *params)
+GL_ENTRY(void, glGetLightfv, GLenum light, GLenum pname, GLfloat *params)
+GL_ENTRY(void, glGetMaterialfv, GLenum face, GLenum pname, GLfloat *params)
+GL_ENTRY(void, glGetTexEnvfv, GLenum env, GLenum pname, GLfloat *params)
+GL_ENTRY(void, glGetTexParameterfv, GLenum target, GLenum pname, GLfloat *params)
+GL_ENTRY(void, glLightModelf, GLenum pname, GLfloat param)
+GL_ENTRY(void, glLightModelfv, GLenum pname, const GLfloat *params)
+GL_ENTRY(void, glLightf, GLenum light, GLenum pname, GLfloat param)
+GL_ENTRY(void, glLightfv, GLenum light, GLenum pname, const GLfloat *params)
+GL_ENTRY(void, glLineWidth, GLfloat width)
+GL_ENTRY(void, glLoadMatrixf, const GLfloat *m)
+GL_ENTRY(void, glMaterialf, GLenum face, GLenum pname, GLfloat param)
+GL_ENTRY(void, glMaterialfv, GLenum face, GLenum pname, const GLfloat *params)
+GL_ENTRY(void, glMultMatrixf, const GLfloat *m)
+GL_ENTRY(void, glMultiTexCoord4f, GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
+GL_ENTRY(void, glNormal3f, GLfloat nx, GLfloat ny, GLfloat nz)
+GL_ENTRY(void, glOrthof, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
+GL_ENTRY(void, glPointParameterf, GLenum pname, GLfloat param)
+GL_ENTRY(void, glPointParameterfv, GLenum pname, const GLfloat *params)
+GL_ENTRY(void, glPointSize, GLfloat size)
+GL_ENTRY(void, glPolygonOffset, GLfloat factor, GLfloat units)
+GL_ENTRY(void, glRotatef, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
+GL_ENTRY(void, glScalef, GLfloat x, GLfloat y, GLfloat z)
+GL_ENTRY(void, glTexEnvf, GLenum target, GLenum pname, GLfloat param)
+GL_ENTRY(void, glTexEnvfv, GLenum target, GLenum pname, const GLfloat *params)
+GL_ENTRY(void, glTexParameterf, GLenum target, GLenum pname, GLfloat param)
+GL_ENTRY(void, glTexParameterfv, GLenum target, GLenum pname, const GLfloat *params)
+GL_ENTRY(void, glTranslatef, GLfloat x, GLfloat y, GLfloat z)
+GL_ENTRY(void, glActiveTexture, GLenum texture)
+GL_ENTRY(void, glAlphaFuncx, GLenum func, GLclampx ref)
+GL_ENTRY(void, glBindBuffer, GLenum target, GLuint buffer)
+GL_ENTRY(void, glBindTexture, GLenum target, GLuint texture)
+GL_ENTRY(void, glBlendFunc, GLenum sfactor, GLenum dfactor)
+GL_ENTRY(void, glBufferData, GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
+GL_ENTRY(void, glBufferSubData, GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
+GL_ENTRY(void, glClear, GLbitfield mask)
+GL_ENTRY(void, glClearColorx, GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
 GL_ENTRY(void, glClearDepthx, GLclampx depth)
 GL_ENTRY(void, glClearStencil, GLint s)
-GL_ENTRY(void, glPointSize, GLfloat)
-GL_ENTRY(void, glPointSizex, GLfixed)
-GL_ENTRY(void, glSampleCoverage, GLclampf value, GLboolean invert)
-GL_ENTRY(void, glSampleCoveragex, GLclampx value, GLboolean invert)
-GL_ENTRY(void, glStencilFunc, GLenum func, GLint ref, GLuint mask)
-GL_ENTRY(void, glStencilOp, GLenum fail, GLenum zfail, GLenum zpass)
-GL_ENTRY(void, glScissor, GLint x, GLint y, GLsizei width, GLsizei height)
-GL_ENTRY(void, glHint, GLenum, GLenum mode)
-GL_ENTRY(void, glLineWidth, GLfloat width)
+GL_ENTRY(void, glClientActiveTexture, GLenum texture)
+GL_ENTRY(void, glClipPlanex, GLenum plane, const GLfixed *equation)
+GL_ENTRY(void, glColor4ub, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
+GL_ENTRY(void, glColor4x, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
+GL_ENTRY(void, glColorMask, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
+GL_ENTRY(void, glColorPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
+GL_ENTRY(void, glCompressedTexImage2D, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
+GL_ENTRY(void, glCompressedTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
+GL_ENTRY(void, glCopyTexImage2D, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
+GL_ENTRY(void, glCopyTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+GL_ENTRY(void, glCullFace, GLenum mode)
+GL_ENTRY(void, glDeleteBuffers, GLsizei n, const GLuint *buffers)
+GL_ENTRY(void, glDeleteTextures, GLsizei n, const GLuint *textures)
+GL_ENTRY(void, glDepthFunc, GLenum func)
+GL_ENTRY(void, glDepthMask, GLboolean flag)
+GL_ENTRY(void, glDepthRangex, GLclampx zNear, GLclampx zFar)
+GL_ENTRY(void, glDisable, GLenum cap)
+GL_ENTRY(void, glDisableClientState, GLenum array)
+GL_ENTRY(void, glDrawArrays, GLenum mode, GLint first, GLsizei count)
+GL_ENTRY(void, glDrawElements, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
+GL_ENTRY(void, glEnable, GLenum cap)
+GL_ENTRY(void, glEnableClientState, GLenum array)
+GL_ENTRY(void, glFinish, void)
+GL_ENTRY(void, glFlush, void)
+GL_ENTRY(void, glFogx, GLenum pname, GLfixed param)
+GL_ENTRY(void, glFogxv, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glFrontFace, GLenum mode)
+GL_ENTRY(void, glFrustumx, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
+GL_ENTRY(void, glGetBooleanv, GLenum pname, GLboolean *params)
+GL_ENTRY(void, glGetBufferParameteriv, GLenum target, GLenum pname, GLint *params)
+GL_ENTRY(void, glGetClipPlanex, GLenum pname, GLfixed eqn[4])
+GL_ENTRY(void, glGenBuffers, GLsizei n, GLuint *buffers)
+GL_ENTRY(void, glGenTextures, GLsizei n, GLuint *textures)
+GL_ENTRY(GLenum, glGetError, void)
+GL_ENTRY(void, glGetFixedv, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glGetIntegerv, GLenum pname, GLint *params)
+GL_ENTRY(void, glGetLightxv, GLenum light, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glGetMaterialxv, GLenum face, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glGetPointerv, GLenum pname, void **params)
+GL_ENTRY(const GLubyte *, glGetString, GLenum name)
+GL_ENTRY(void, glGetTexEnviv, GLenum env, GLenum pname, GLint *params)
+GL_ENTRY(void, glGetTexEnvxv, GLenum env, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glGetTexParameteriv, GLenum target, GLenum pname, GLint *params)
+GL_ENTRY(void, glGetTexParameterxv, GLenum target, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glHint, GLenum target, GLenum mode)
+GL_ENTRY(GLboolean, glIsBuffer, GLuint buffer)
+GL_ENTRY(GLboolean, glIsEnabled, GLenum cap)
+GL_ENTRY(GLboolean, glIsTexture, GLuint texture)
+GL_ENTRY(void, glLightModelx, GLenum pname, GLfixed param)
+GL_ENTRY(void, glLightModelxv, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glLightx, GLenum light, GLenum pname, GLfixed param)
+GL_ENTRY(void, glLightxv, GLenum light, GLenum pname, const GLfixed *params)
 GL_ENTRY(void, glLineWidthx, GLfixed width)
-GL_ENTRY(void, glShadeModel, GLenum)
-GL_ENTRY(void, glLightModelf, GLenum, GLfloat)
-GL_ENTRY(void, glLightModelfv, GLenum, const GLfloat *)
-GL_ENTRY(void, glLightModelx, GLenum, GLfixed)
-GL_ENTRY(void, glLightModelxv, GLenum, const GLfixed *)
-GL_ENTRY(void, glLightf, GLenum, GLenum, GLfloat)
-GL_ENTRY(void, glLightfv, GLenum, GLenum, const GLfloat *)
-GL_ENTRY(void, glLightx, GLenum, GLenum, GLfixed)
-GL_ENTRY(void, glLightxv, GLenum, GLenum, const GLfixed *)
-GL_ENTRY(void, glMaterialf, GLenum, GLenum, GLfloat)
-GL_ENTRY(void, glMaterialfv, GLenum, GLenum, const GLfloat *)
-GL_ENTRY(void, glMaterialx, GLenum, GLenum, GLfixed)
-GL_ENTRY(void, glMaterialxv, GLenum, GLenum, const GLfixed *)
-GL_ENTRY(void, glFogf, GLenum, GLfloat)
-GL_ENTRY(void, glFogfv, GLenum, const GLfloat *)
-GL_ENTRY(void, glFogx, GLenum, GLfixed)
-GL_ENTRY(void, glFogxv, GLenum, const GLfixed *)
-GL_ENTRY(void, glVertexPointer, GLint, GLenum, GLsizei, const GLvoid *)
-GL_ENTRY(void, glColorPointer, GLint, GLenum, GLsizei, const GLvoid *)
-GL_ENTRY(void, glNormalPointer, GLenum, GLsizei, const GLvoid *)
-GL_ENTRY(void, glTexCoordPointer, GLint, GLenum, GLsizei, const GLvoid *)
-GL_ENTRY(void, glEnableClientState, GLenum)
-GL_ENTRY(void, glDisableClientState, GLenum)
-GL_ENTRY(void, glClientActiveTexture, GLenum)
-GL_ENTRY(void, glDrawArrays, GLenum, GLint first, GLsizei)
-GL_ENTRY(void, glDrawElements, GLenum, GLsizei, GLenum, const GLvoid *)
 GL_ENTRY(void, glLoadIdentity, void)
-GL_ENTRY(void, glLoadMatrixf, const GLfloat*)
-GL_ENTRY(void, glLoadMatrixx, const GLfixed*)
+GL_ENTRY(void, glLoadMatrixx, const GLfixed *m)
+GL_ENTRY(void, glLogicOp, GLenum opcode)
+GL_ENTRY(void, glMaterialx, GLenum face, GLenum pname, GLfixed param)
+GL_ENTRY(void, glMaterialxv, GLenum face, GLenum pname, const GLfixed *params)
 GL_ENTRY(void, glMatrixMode, GLenum mode)
-GL_ENTRY(void, glMultMatrixf, const GLfloat*)
-GL_ENTRY(void, glMultMatrixx, const GLfixed*)
+GL_ENTRY(void, glMultMatrixx, const GLfixed *m)
+GL_ENTRY(void, glMultiTexCoord4x, GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
+GL_ENTRY(void, glNormal3x, GLfixed nx, GLfixed ny, GLfixed nz)
+GL_ENTRY(void, glNormalPointer, GLenum type, GLsizei stride, const GLvoid *pointer)
+GL_ENTRY(void, glOrthox, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
+GL_ENTRY(void, glPixelStorei, GLenum pname, GLint param)
+GL_ENTRY(void, glPointParameterx, GLenum pname, GLfixed param)
+GL_ENTRY(void, glPointParameterxv, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glPointSizex, GLfixed size)
+GL_ENTRY(void, glPolygonOffsetx, GLfixed factor, GLfixed units)
 GL_ENTRY(void, glPopMatrix, void)
 GL_ENTRY(void, glPushMatrix, void)
-GL_ENTRY(void, glFrustumf, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat)
-GL_ENTRY(void, glFrustumx, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed)
-GL_ENTRY(void, glOrthof, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat)
-GL_ENTRY(void, glOrthox, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed)
-GL_ENTRY(void, glRotatef, GLfloat, GLfloat, GLfloat, GLfloat)
-GL_ENTRY(void, glRotatex, GLfixed, GLfixed, GLfixed, GLfixed)
-GL_ENTRY(void, glScalef, GLfloat, GLfloat, GLfloat)
-GL_ENTRY(void, glScalex, GLfixed, GLfixed, GLfixed)
-GL_ENTRY(void, glTranslatef, GLfloat, GLfloat, GLfloat)
-GL_ENTRY(void, glTranslatex, GLfixed, GLfixed, GLfixed)
-GL_ENTRY(void, glViewport, GLint, GLint, GLsizei, GLsizei)
-GL_ENTRY(void, glActiveTexture, GLenum)
-GL_ENTRY(void, glBindTexture, GLenum, GLuint)
-GL_ENTRY(void, glGenTextures, GLsizei, GLuint*)
-GL_ENTRY(void, glDeleteTextures, GLsizei n, const GLuint *)
-GL_ENTRY(void, glMultiTexCoord4f, GLenum, GLfloat, GLfloat, GLfloat, GLfloat)
-GL_ENTRY(void, glMultiTexCoord4x, GLenum, GLfixed, GLfixed, GLfixed, GLfixed)
-GL_ENTRY(void, glPixelStorei, GLenum, GLint)
-GL_ENTRY(void, glTexEnvf, GLenum, GLenum, GLfloat)
-GL_ENTRY(void, glTexEnvfv, GLenum, GLenum, const GLfloat*)
-GL_ENTRY(void, glTexEnvx, GLenum, GLenum, GLfixed)
-GL_ENTRY(void, glTexEnvxv, GLenum, GLenum, const GLfixed*)
-GL_ENTRY(void, glTexParameterf, GLenum, GLenum, GLfloat)
-GL_ENTRY(void, glTexParameterx, GLenum, GLenum, GLfixed)
-GL_ENTRY(void, glCompressedTexImage2D,    GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*)
-GL_ENTRY(void, glCompressedTexSubImage2D, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*)
-GL_ENTRY(void, glCopyTexImage2D, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint)
-GL_ENTRY(void, glCopyTexSubImage2D, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei)
-GL_ENTRY(void, glTexImage2D, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*)
-GL_ENTRY(void, glTexSubImage2D, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*)
-GL_ENTRY(void, glReadPixels, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *)
-
-// 1.1 additions
-GL_ENTRY(void, glClipPlanef, GLenum plane, const GLfloat*)
-GL_ENTRY(void, glClipPlanex, GLenum plane, const GLfixed*)
-GL_ENTRY(void, glBindBuffer, GLenum, GLuint)
-GL_ENTRY(void, glBufferData, GLenum, GLsizeiptr, const GLvoid*, GLenum)
-GL_ENTRY(void, glBufferSubData, GLenum, GLintptr, GLsizeiptr, const GLvoid*)
-GL_ENTRY(void, glDeleteBuffers, GLsizei, const GLuint*)
-GL_ENTRY(void, glGenBuffers, GLsizei, GLuint*)
-GL_ENTRY(void, glGetBooleanv, GLenum, GLboolean *)
-GL_ENTRY(void, glGetFixedv, GLenum, GLfixed *)
-GL_ENTRY(void, glGetFloatv, GLenum, GLfloat *)
-GL_ENTRY(void, glGetPointerv, GLenum, void **)
-GL_ENTRY(void, glGetBufferParameteriv, GLenum, GLenum, GLint *)
-GL_ENTRY(void, glGetClipPlanef, GLenum, GLfloat[4])
-GL_ENTRY(void, glGetClipPlanex, GLenum, GLfixed[4])
-GL_ENTRY(void, glGetLightxv, GLenum, GLenum, GLfixed *)
-GL_ENTRY(void, glGetLightfv, GLenum, GLenum, GLfloat *)
-GL_ENTRY(void, glGetMaterialxv, GLenum, GLenum, GLfixed *)
-GL_ENTRY(void, glGetMaterialfv, GLenum, GLenum, GLfloat *)
-GL_ENTRY(void, glGetTexEnvfv, GLenum, GLenum, GLfloat *)
-GL_ENTRY(void, glGetTexEnviv, GLenum, GLenum, GLint *)
-GL_ENTRY(void, glGetTexEnvxv, GLenum, GLenum, GLfixed *)
-GL_ENTRY(void, glGetTexParameterfv, GLenum, GLenum, GLfloat *)
-GL_ENTRY(void, glGetTexParameteriv, GLenum, GLenum, GLint *)
-GL_ENTRY(void, glGetTexParameterxv, GLenum, GLenum, GLfixed *)
-GL_ENTRY(GLboolean, glIsBuffer, GLuint)
-GL_ENTRY(GLboolean, glIsEnabled, GLenum)
-GL_ENTRY(GLboolean, glIsTexture, GLuint)
-GL_ENTRY(void, glPointParameterf, GLenum, GLfloat)
-GL_ENTRY(void, glPointParameterfv, GLenum, const GLfloat *)
-GL_ENTRY(void, glPointParameterx, GLenum, GLfixed)
-GL_ENTRY(void, glPointParameterxv, GLenum, const GLfixed *)
-GL_ENTRY(void, glColor4ub, GLubyte, GLubyte, GLubyte, GLubyte)
-GL_ENTRY(void, glTexEnvi, GLenum, GLenum, GLint)
-GL_ENTRY(void, glTexEnviv, GLenum, GLenum, const GLint *)
-GL_ENTRY(void, glTexParameterfv, GLenum, GLenum, const GLfloat *)
-GL_ENTRY(void, glTexParameteriv, GLenum, GLenum, const GLint *)
-GL_ENTRY(void, glTexParameteri, GLenum, GLenum, GLint)
-GL_ENTRY(void, glTexParameterxv, GLenum, GLenum, const GLfixed *)
-GL_ENTRY(void, glPointSizePointerOES, GLenum type, GLsizei stride, const GLvoid*)
-
-// Extensions
-GL_ENTRY(void, glDrawTexsOES, GLshort, GLshort, GLshort, GLshort, GLshort)
-GL_ENTRY(void, glDrawTexiOES, GLint, GLint, GLint, GLint, GLint)
-GL_ENTRY(void, glDrawTexfOES, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat)
-GL_ENTRY(void, glDrawTexxOES, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed)
-GL_ENTRY(void, glDrawTexsvOES, const GLshort*)
-GL_ENTRY(void, glDrawTexivOES, const GLint*)
-GL_ENTRY(void, glDrawTexfvOES, const GLfloat*)
-GL_ENTRY(void, glDrawTexxvOES, const GLfixed*)
-GL_ENTRY(GLbitfield, glQueryMatrixxOES, GLfixed* mantissa, GLint* exponent)
-
+GL_ENTRY(void, glReadPixels, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
+GL_ENTRY(void, glRotatex, GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
+GL_ENTRY(void, glSampleCoverage, GLclampf value, GLboolean invert)
+GL_ENTRY(void, glSampleCoveragex, GLclampx value, GLboolean invert)
+GL_ENTRY(void, glScalex, GLfixed x, GLfixed y, GLfixed z)
+GL_ENTRY(void, glScissor, GLint x, GLint y, GLsizei width, GLsizei height)
+GL_ENTRY(void, glShadeModel, GLenum mode)
+GL_ENTRY(void, glStencilFunc, GLenum func, GLint ref, GLuint mask)
+GL_ENTRY(void, glStencilMask, GLuint mask)
+GL_ENTRY(void, glStencilOp, GLenum fail, GLenum zfail, GLenum zpass)
+GL_ENTRY(void, glTexCoordPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
+GL_ENTRY(void, glTexEnvi, GLenum target, GLenum pname, GLint param)
+GL_ENTRY(void, glTexEnvx, GLenum target, GLenum pname, GLfixed param)
+GL_ENTRY(void, glTexEnviv, GLenum target, GLenum pname, const GLint *params)
+GL_ENTRY(void, glTexEnvxv, GLenum target, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glTexImage2D, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
+GL_ENTRY(void, glTexParameteri, GLenum target, GLenum pname, GLint param)
+GL_ENTRY(void, glTexParameterx, GLenum target, GLenum pname, GLfixed param)
+GL_ENTRY(void, glTexParameteriv, GLenum target, GLenum pname, const GLint *params)
+GL_ENTRY(void, glTexParameterxv, GLenum target, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
+GL_ENTRY(void, glTranslatex, GLfixed x, GLfixed y, GLfixed z)
+GL_ENTRY(void, glVertexPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
+GL_ENTRY(void, glViewport, GLint x, GLint y, GLsizei width, GLsizei height)
+GL_ENTRY(void, glPointSizePointerOES, GLenum type, GLsizei stride, const GLvoid *pointer)
diff --git a/opengl/libs/gl_logger.h b/opengl/libs/gl_logger.h
deleted file mode 100644
index ce85dd1..0000000
--- a/opengl/libs/gl_logger.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* 
- ** Copyright 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.
- */
-
-#ifndef ANDROID_GL_LOGGER_H
-#define ANDROID_GL_LOGGER_H
-
-namespace android {
-#define GL_ENTRY(r, api, ...) r log_##api(__VA_ARGS__);
-#include "gl_entries.in"
-#undef GL_ENTRY
-}; // namespace android
-
-#endif /* ANDROID_GL_LOGGER_H */
diff --git a/opengl/libs/glext_entries.in b/opengl/libs/glext_entries.in
new file mode 100644
index 0000000..dd09c71
--- /dev/null
+++ b/opengl/libs/glext_entries.in
@@ -0,0 +1,90 @@
+GL_ENTRY(void, glBlendEquationSeparateOES, GLenum modeRGB, GLenum modeAlpha)
+GL_ENTRY(void, glBlendFuncSeparateOES, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
+GL_ENTRY(void, glBlendEquationOES, GLenum mode)
+GL_ENTRY(void, glDrawTexsOES, GLshort x, GLshort y, GLshort z, GLshort width, GLshort height)
+GL_ENTRY(void, glDrawTexiOES, GLint x, GLint y, GLint z, GLint width, GLint height)
+GL_ENTRY(void, glDrawTexxOES, GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height)
+GL_ENTRY(void, glDrawTexsvOES, const GLshort *coords)
+GL_ENTRY(void, glDrawTexivOES, const GLint *coords)
+GL_ENTRY(void, glDrawTexxvOES, const GLfixed *coords)
+GL_ENTRY(void, glDrawTexfOES, GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height)
+GL_ENTRY(void, glDrawTexfvOES, const GLfloat *coords)
+GL_ENTRY(void, glEGLImageTargetTexture2DOES, GLenum target, GLeglImageOES image)
+GL_ENTRY(void, glEGLImageTargetRenderbufferStorageOES, GLenum target, GLeglImageOES image)
+GL_ENTRY(void, glAlphaFuncxOES, GLenum func, GLclampx ref)
+GL_ENTRY(void, glClearColorxOES, GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
+GL_ENTRY(void, glClearDepthxOES, GLclampx depth)
+GL_ENTRY(void, glClipPlanexOES, GLenum plane, const GLfixed *equation)
+GL_ENTRY(void, glColor4xOES, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
+GL_ENTRY(void, glDepthRangexOES, GLclampx zNear, GLclampx zFar)
+GL_ENTRY(void, glFogxOES, GLenum pname, GLfixed param)
+GL_ENTRY(void, glFogxvOES, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glFrustumxOES, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
+GL_ENTRY(void, glGetClipPlanexOES, GLenum pname, GLfixed eqn[4])
+GL_ENTRY(void, glGetFixedvOES, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glGetLightxvOES, GLenum light, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glGetMaterialxvOES, GLenum face, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glGetTexEnvxvOES, GLenum env, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glGetTexParameterxvOES, GLenum target, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glLightModelxOES, GLenum pname, GLfixed param)
+GL_ENTRY(void, glLightModelxvOES, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glLightxOES, GLenum light, GLenum pname, GLfixed param)
+GL_ENTRY(void, glLightxvOES, GLenum light, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glLineWidthxOES, GLfixed width)
+GL_ENTRY(void, glLoadMatrixxOES, const GLfixed *m)
+GL_ENTRY(void, glMaterialxOES, GLenum face, GLenum pname, GLfixed param)
+GL_ENTRY(void, glMaterialxvOES, GLenum face, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glMultMatrixxOES, const GLfixed *m)
+GL_ENTRY(void, glMultiTexCoord4xOES, GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
+GL_ENTRY(void, glNormal3xOES, GLfixed nx, GLfixed ny, GLfixed nz)
+GL_ENTRY(void, glOrthoxOES, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
+GL_ENTRY(void, glPointParameterxOES, GLenum pname, GLfixed param)
+GL_ENTRY(void, glPointParameterxvOES, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glPointSizexOES, GLfixed size)
+GL_ENTRY(void, glPolygonOffsetxOES, GLfixed factor, GLfixed units)
+GL_ENTRY(void, glRotatexOES, GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
+GL_ENTRY(void, glSampleCoveragexOES, GLclampx value, GLboolean invert)
+GL_ENTRY(void, glScalexOES, GLfixed x, GLfixed y, GLfixed z)
+GL_ENTRY(void, glTexEnvxOES, GLenum target, GLenum pname, GLfixed param)
+GL_ENTRY(void, glTexEnvxvOES, GLenum target, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glTexParameterxOES, GLenum target, GLenum pname, GLfixed param)
+GL_ENTRY(void, glTexParameterxvOES, GLenum target, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glTranslatexOES, GLfixed x, GLfixed y, GLfixed z)
+GL_ENTRY(GLboolean, glIsRenderbufferOES, GLuint renderbuffer)
+GL_ENTRY(void, glBindRenderbufferOES, GLenum target, GLuint renderbuffer)
+GL_ENTRY(void, glDeleteRenderbuffersOES, GLsizei n, const GLuint* renderbuffers)
+GL_ENTRY(void, glGenRenderbuffersOES, GLsizei n, GLuint* renderbuffers)
+GL_ENTRY(void, glRenderbufferStorageOES, GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
+GL_ENTRY(void, glGetRenderbufferParameterivOES, GLenum target, GLenum pname, GLint* params)
+GL_ENTRY(GLboolean, glIsFramebufferOES, GLuint framebuffer)
+GL_ENTRY(void, glBindFramebufferOES, GLenum target, GLuint framebuffer)
+GL_ENTRY(void, glDeleteFramebuffersOES, GLsizei n, const GLuint* framebuffers)
+GL_ENTRY(void, glGenFramebuffersOES, GLsizei n, GLuint* framebuffers)
+GL_ENTRY(GLenum, glCheckFramebufferStatusOES, GLenum target)
+GL_ENTRY(void, glFramebufferRenderbufferOES, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
+GL_ENTRY(void, glFramebufferTexture2DOES, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
+GL_ENTRY(void, glGetFramebufferAttachmentParameterivOES, GLenum target, GLenum attachment, GLenum pname, GLint* params)
+GL_ENTRY(void, glGenerateMipmapOES, GLenum target)
+GL_ENTRY(void*, glMapBufferOES, GLenum target, GLenum access)
+GL_ENTRY(GLboolean, glUnmapBufferOES, GLenum target)
+GL_ENTRY(void, glGetBufferPointervOES, GLenum target, GLenum pname, void** params)
+GL_ENTRY(void, glCurrentPaletteMatrixOES, GLuint matrixpaletteindex)
+GL_ENTRY(void, glLoadPaletteFromModelViewMatrixOES, void)
+GL_ENTRY(void, glMatrixIndexPointerOES, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
+GL_ENTRY(void, glWeightPointerOES, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
+GL_ENTRY(GLbitfield, glQueryMatrixxOES, GLfixed mantissa[16], GLint exponent[16])
+GL_ENTRY(void, glDepthRangefOES, GLclampf zNear, GLclampf zFar)
+GL_ENTRY(void, glFrustumfOES, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
+GL_ENTRY(void, glOrthofOES, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
+GL_ENTRY(void, glClipPlanefOES, GLenum plane, const GLfloat *equation)
+GL_ENTRY(void, glGetClipPlanefOES, GLenum pname, GLfloat eqn[4])
+GL_ENTRY(void, glClearDepthfOES, GLclampf depth)
+GL_ENTRY(void, glTexGenfOES, GLenum coord, GLenum pname, GLfloat param)
+GL_ENTRY(void, glTexGenfvOES, GLenum coord, GLenum pname, const GLfloat *params)
+GL_ENTRY(void, glTexGeniOES, GLenum coord, GLenum pname, GLint param)
+GL_ENTRY(void, glTexGenivOES, GLenum coord, GLenum pname, const GLint *params)
+GL_ENTRY(void, glTexGenxOES, GLenum coord, GLenum pname, GLfixed param)
+GL_ENTRY(void, glTexGenxvOES, GLenum coord, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glGetTexGenfvOES, GLenum coord, GLenum pname, GLfloat *params)
+GL_ENTRY(void, glGetTexGenivOES, GLenum coord, GLenum pname, GLint *params)
+GL_ENTRY(void, glGetTexGenxvOES, GLenum coord, GLenum pname, GLfixed *params)
diff --git a/opengl/libs/hooks.h b/opengl/libs/hooks.h
index 63fb017..fd97254 100644
--- a/opengl/libs/hooks.h
+++ b/opengl/libs/hooks.h
@@ -22,9 +22,10 @@
 #include <errno.h>
 
 #include <EGL/egl.h>
+#include <EGL/eglext.h>
 #include <GLES/gl.h>
+#include <GLES/glext.h>
 
-#define GL_LOGGER                   0
 #if !defined(__arm__)
 #define USE_SLOW_BINDING            1
 #else
@@ -35,7 +36,7 @@
 #define MAX_NUMBER_OF_GL_EXTENSIONS 32
 
 
-#if defined(HAVE_ANDROID_OS) && !USE_SLOW_BINDING && !GL_LOGGER && __OPTIMIZE__
+#if defined(HAVE_ANDROID_OS) && !USE_SLOW_BINDING && __OPTIMIZE__
 #define USE_FAST_TLS_KEY            1
 #else
 #define USE_FAST_TLS_KEY            0
@@ -55,7 +56,10 @@
 enum {
     IMPL_HARDWARE = 0,
     IMPL_SOFTWARE,
-    IMPL_CONTEXT_LOST,
+    
+    IMPL_NUM_DRIVERS_IMPLEMENTATIONS,
+
+    IMPL_CONTEXT_LOST = IMPL_NUM_DRIVERS_IMPLEMENTATIONS,
     IMPL_NO_CONTEXT,
     
     IMPL_NUM_IMPLEMENTATIONS
@@ -73,6 +77,7 @@
 struct gl_hooks_t {
     struct gl_t {
         #include "gl_entries.in"
+        #include "glext_entries.in"
     } gl;
     struct egl_t {
         #include "egl_entries.in"
diff --git a/opengl/libs/tools/genfiles b/opengl/libs/tools/genfiles
new file mode 100755
index 0000000..107768b
--- /dev/null
+++ b/opengl/libs/tools/genfiles
@@ -0,0 +1,20 @@
+#! /bin/sh
+#
+# Copyright (C) 2008 Google Inc.
+#
+# 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.
+
+./glapigen ../../include/GLES/gl.h > ../GLES_CM/gl_api.in 
+./glentrygen ../../include/GLES/gl.h > ../gl_entries.in 
+./glapigen ../../include/GLES/glext.h > ../GLES_CM/glext_api.in 
+./glentrygen ../../include/GLES/glext.h > ../glext_entries.in 
diff --git a/opengl/libs/tools/glapigen b/opengl/libs/tools/glapigen
new file mode 100755
index 0000000..a2c3a7b
--- /dev/null
+++ b/opengl/libs/tools/glapigen
@@ -0,0 +1,72 @@
+#! /usr/bin/perl
+#
+# Copyright (C) 2008 Google Inc.
+#
+# 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.
+
+use strict;
+
+while (my $line = <>) {
+  next if $line =~ /^\//;
+  next if $line =~ /^#/;
+  next if $line =~ /^\s*$/;
+  if ($line !~ /^GL_API\s+(.+)\s+GL_APIENTRY\s+([\w]+)\s*\(([^\)]+)\);/) {
+    next;
+  }
+  my $type = $1;
+  my $name = $2;
+  my $args = $3;
+
+  #printf("%s", $line);
+  
+  my $prefix = "";
+  if ($name eq "glEGLImageTargetTexture2DOES") {
+    $prefix = "__";
+  }
+  if ($name eq "glEGLImageTargetRenderbufferStorageOES") {
+    $prefix = "__";
+  }
+  
+  printf("%s API_ENTRY(%s%s)(%s)", $type, $prefix, $name, $args);
+  
+  printf(" {\n");
+  if ($type eq "void") {
+    printf("    CALL_GL_API(%s", $name);
+  } else {
+    printf("    CALL_GL_API_RETURN(%s", $name);
+  }
+  my @args = split ',', $args;
+  my $len = scalar(@args);
+  for (my $num = 0; $num < $len; $num++) {
+    if ($args[$num] ne "void") {
+      print ", ";
+      #
+      # extract the name from the parameter
+      # type name
+      # const type *name
+      # type *name
+      # type name[4]
+      #
+      if ($args[$num] =~ /(\S+\s)+\**\s*([\w]+)/) {
+        printf("%s", $2);
+      }
+    }
+  }
+  printf(");\n");
+  printf("}\n");
+}
+
+
+
+
+
diff --git a/opengl/libs/tools/glentrygen b/opengl/libs/tools/glentrygen
new file mode 100755
index 0000000..5e0f7b6
--- /dev/null
+++ b/opengl/libs/tools/glentrygen
@@ -0,0 +1,31 @@
+#! /usr/bin/perl
+#
+# Copyright (C) 2008 Google Inc.
+#
+# 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.
+
+use strict;
+
+while (my $line = <>) {
+  next if $line =~ /^\//;
+  next if $line =~ /^#/;
+  next if $line =~ /^\s*$/;
+  if ($line !~ /^GL_API\s+(.+)\s+GL_APIENTRY\s+([\w]+)\s*\(([^\)]+)\);/) {
+    next;
+  }
+  my $type = $1;
+  my $name = $2;
+  my $args = $3;
+
+  printf("GL_ENTRY(%s, %s, %s)\n", $type, $name, $args);
+}
diff --git a/opengl/tools/glgen/.gitignore b/opengl/tools/glgen/.gitignore
new file mode 100644
index 0000000..007ec65
--- /dev/null
+++ b/opengl/tools/glgen/.gitignore
@@ -0,0 +1,2 @@
+generated
+out
diff --git a/opengl/tools/glgen/gen b/opengl/tools/glgen/gen
index 1c49861..011a6ed 100755
--- a/opengl/tools/glgen/gen
+++ b/opengl/tools/glgen/gen
@@ -1,28 +1,58 @@
-#!/bin/sh
+#!/bin/bash
+set -u
+set -e
 rm -rf out generated
 
 mkdir out
 mkdir -p out/javax/microedition/khronos/opengles
 mkdir -p out/com/google/android/gles_jni
 mkdir -p out/android/graphics
+mkdir -p out/android/opengl
 
 echo "package android.graphics;" > out/android/graphics/Canvas.java
 echo "public interface Canvas {}" >> out/android/graphics/Canvas.java
 
 GLFILE=out/javax/microedition/khronos/opengles/GL.java
-cp stubs/GLHeader.java-if $GLFILE
+cp stubs/jsr239/GLHeader.java-if $GLFILE
 
-GLGEN_FILES="CFunc.java CType.java CodeEmitter.java GenerateGL.java JFunc.java JType.java JniCodeEmitter.java ParameterChecker.java"
+GLGEN_FILES="CFunc.java CType.java CodeEmitter.java GenerateGL.java GenerateGLES.java GLESCodeEmitter.java JFunc.java JniCodeEmitter.java JType.java Jsr239CodeEmitter.java ParameterChecker.java"
 
 pushd src > /dev/null
 javac ${GLGEN_FILES}
+JAVAC_RESULT=$?
+if [ $JAVAC_RESULT -ne 0 ]; then
+    echo "Could not compile glgen."
+    exit $JAVAC_RESULT
+fi
 popd > /dev/null
-java -classpath src GenerateGL -c glspec-1.0 glspec-1.0ext glspec-1.1 glspec-1.1ext glspec-1.1extpack glspec-checks
+
+echo "Generating JSR239-like APIs"
+java -classpath src GenerateGL -c specs/jsr239/glspec-1.0 specs/jsr239/glspec-1.0ext specs/jsr239/glspec-1.1 specs/jsr239/glspec-1.1ext specs/jsr239/glspec-1.1extpack specs/jsr239/glspec-checks
+JAVA_RESULT=$?
+if [ $JAVA_RESULT -ne 0 ]; then
+    echo "Could not run GenerateGL."
+    exit $JAVA_RESULT
+fi
+
+echo "Generating static OpenGLES 1.1 bindings"
+java -classpath src GenerateGLES
+JAVA_RESULT=$?
+if [ $JAVA_RESULT -ne 0 ]; then
+    echo "Could not run GenerateGLES."
+    exit $JAVA_RESULT
+fi
+
+rm src/*.class
 
 pushd out > /dev/null
 mkdir classes
-javac -d classes com/google/android/gles_jni/GLImpl.java javax/microedition/khronos/opengles/GL10.java javax/microedition/khronos/opengles/GL10Ext.java javax/microedition/khronos/opengles/GL11.java javax/microedition/khronos/opengles/GL11Ext.java javax/microedition/khronos/opengles/GL11ExtensionPack.java
+javac -d classes com/google/android/gles_jni/GLImpl.java javax/microedition/khronos/opengles/GL10.java javax/microedition/khronos/opengles/GL10Ext.java javax/microedition/khronos/opengles/GL11.java javax/microedition/khronos/opengles/GL11Ext.java javax/microedition/khronos/opengles/GL11ExtensionPack.java android/opengl/GLES10.java android/opengl/GLES10Ext.java android/opengl/GLES11.java android/opengl/GLES11Ext.java
 popd > /dev/null
+JAVA_RESULT=$?
+if [ $JAVA_RESULT -ne 0 ]; then
+    echo "Could not compile generated classes."
+    exit $JAVA_RESULT
+fi
 
 rm -rf generated
 mkdir -p generated/C
@@ -30,70 +60,44 @@
 cp -r out/com generated
 cp -r out/javax generated
 
+cp out/android_opengl_*.cpp generated/C
+mkdir -p generated/android/opengl
+cp -r out/android/opengl generated/android
+
 rm -rf out
+KEEP_GENERATED=0
+SAID_PLEASE=0
 
-# com_google_android_gles_jni_GLImpl.cpp
-if cmp ../../../frameworks/base/core/jni/com_google_android_gles_jni_GLImpl.cpp generated/C/com_google_android_gles_jni_GLImpl.cpp ; then
-echo com_google_android_gles_jni_GLImpl.cpp unchanged
-else
-echo Please edit ../../../frameworks/base/core/jni/com_google_android_gles_jni_GLImpl.cpp
-echo Please cp generated/C/com_google_android_gles_jni_GLImpl.cpp ../../../frameworks/base/core/jni
+# compareGenerated destDir generatedDir file
+compareGenerated() {
+    if cmp -s $1/$3 $2/$3 ; then
+        echo "#    " $3 unchanged
+    else
+        if [ $SAID_PLEASE == "0" ] ; then
+            echo Please evaluate the following commands:
+            echo
+            SAID_PLEASE=1
+        fi
+        echo "    " cp $2/$3 $1
+        echo "    " git add $1/$3
+        KEEP_GENERATED=1
+    fi
+}
+
+compareGenerated ../../../core/jni generated/C com_google_android_gles_jni_GLImpl.cpp
+compareGenerated ../../java/com/google/android/gles_jni generated/com/google/android/gles_jni GLImpl.java
+
+for x in GL.java GL10.java GL10Ext.java GL11.java GL11Ext.java GL11ExtensionPack.java
+do
+    compareGenerated ../../java/javax/microedition/khronos/opengles generated/javax/microedition/khronos/opengles $x
+done
+
+for x in GLES10 GLES10Ext GLES11 GLES11Ext
+do
+    compareGenerated ../../java/android/opengl generated/android/opengl ${x}.java
+    compareGenerated ../../../core/jni generated/C android_opengl_${x}.cpp
+done
+
+if [ $KEEP_GENERATED == "0" ] ; then
+    rm -rf generated
 fi
-
-# GLImpl.java
-if cmp ../../java/com/google/android/gles_jni/GLImpl.java generated/com/google/android/gles_jni/GLImpl.java ; then
-echo GLImpl.java unchanged
-else
-echo Please edit ../../java/com/google/android/gles_jni/GLImpl.java
-echo Please cp generated/com/google/android/gles_jni/GLImpl.java ../../java/com/google/android/gles_jni
-fi
-
-# GL.java
-if cmp ../../java/javax/microedition/khronos/opengles/GL.java generated/javax/microedition/khronos/opengles/GL.java ; then
-echo GL.java unchanged
-else
-echo Please edit ../../java/javax/microedition/khronos/opengles/GL.java
-echo Please cp generated/javax/microedition/khronos/opengles/GL.java ../../java/javax/microedition/khronos/opengles/GL.java
-fi
-
-# GL10.java
-if cmp ../../java/javax/microedition/khronos/opengles/GL10.java generated/javax/microedition/khronos/opengles/GL10.java ; then
-echo GL10.java unchanged
-else
-echo Please edit ../../java/javax/microedition/khronos/opengles/GL10.java
-echo Please cp generated/javax/microedition/khronos/opengles/GL10.java ../../java/javax/microedition/khronos/opengles/GL10.java
-fi
-
-# GL10Ext.java
-if cmp ../../java/javax/microedition/khronos/opengles/GL10Ext.java generated/javax/microedition/khronos/opengles/GL10Ext.java ; then
-echo GL10Ext.java unchanged
-else
-echo Please edit ../../java/javax/microedition/khronos/opengles/GL10Ext.java
-echo Please cp generated/javax/microedition/khronos/opengles/GL10Ext.java ../../java/javax/microedition/khronos/opengles/GL10Ext.java
-fi
-
-# GL11.java
-if cmp ../../java/javax/microedition/khronos/opengles/GL11.java generated/javax/microedition/khronos/opengles/GL11.java ; then
-echo GL11.java unchanged
-else
-echo Please edit ../../java/javax/microedition/khronos/opengles/GL11.java
-echo Please cp generated/javax/microedition/khronos/opengles/GL11.java ../../java/javax/microedition/khronos/opengles/GL11.java
-fi
-
-# GL11Ext.java
-if cmp ../../java/javax/microedition/khronos/opengles/GL11Ext.java generated/javax/microedition/khronos/opengles/GL11Ext.java ; then
-echo GL11Ext.java unchanged
-else
-echo Please edit ../../java/javax/microedition/khronos/opengles/GL11Ext.java
-echo Please cp generated/javax/microedition/khronos/opengles/GL11Ext.java ../../java/javax/microedition/khronos/opengles/GL11Ext.java
-fi
-
-# GL11ExtensionPack.java
-if cmp ../../java/javax/microedition/khronos/opengles/GL11ExtensionPack.java generated/javax/microedition/khronos/opengles/GL11ExtensionPack.java ; then
-echo GL11ExtensionPack.java unchanged
-else
-echo Please edit ../../java/javax/microedition/khronos/opengles/GL11ExtensionPack.java
-echo Please cp generated/javax/microedition/khronos/opengles/GL11ExtensionPack.java ../../java/javax/microedition/khronos/opengles/GL11ExtensionPack.java
-fi
-
-rm -rf generated
diff --git a/opengl/tools/glgen/specs/gles11/GLES10.spec b/opengl/tools/glgen/specs/gles11/GLES10.spec
new file mode 100644
index 0000000..8e1152d
--- /dev/null
+++ b/opengl/tools/glgen/specs/gles11/GLES10.spec
@@ -0,0 +1,106 @@
+void glActiveTexture ( GLenum texture )
+void glAlphaFunc ( GLenum func, GLclampf ref )
+void glAlphaFuncx ( GLenum func, GLclampx ref )
+void glBindTexture ( GLenum target, GLuint texture )
+void glBlendFunc ( GLenum sfactor, GLenum dfactor )
+void glClear ( GLbitfield mask )
+void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
+void glClearColorx ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha )
+void glClearDepthf ( GLclampf depth )
+void glClearDepthx ( GLclampx depth )
+void glClearStencil ( GLint s )
+void glClientActiveTexture ( GLenum texture )
+void glColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
+void glColor4x ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha )
+void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha )
+void glColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data )
+void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data )
+void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border )
+void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height )
+void glCullFace ( GLenum mode )
+void glDeleteTextures ( GLsizei n, const GLuint *textures )
+void glDepthFunc ( GLenum func )
+void glDepthMask ( GLboolean flag )
+void glDepthRangef ( GLclampf zNear, GLclampf zFar )
+void glDepthRangex ( GLclampx zNear, GLclampx zFar )
+void glDisable ( GLenum cap )
+void glDisableClientState ( GLenum array )
+void glDrawArrays ( GLenum mode, GLint first, GLsizei count )
+void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices )
+void glEnable ( GLenum cap )
+void glEnableClientState ( GLenum array )
+void glFinish ( void )
+void glFlush ( void )
+void glFogf ( GLenum pname, GLfloat param )
+void glFogfv ( GLenum pname, const GLfloat *params )
+void glFogx ( GLenum pname, GLfixed param )
+void glFogxv ( GLenum pname, const GLfixed *params )
+void glFrontFace ( GLenum mode )
+void glFrustumf ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
+void glFrustumx ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
+void glGenTextures ( GLsizei n, GLuint *textures )
+GLenum glGetError ( void )
+void glGetIntegerv ( GLenum pname, GLint *params )
+const GLubyte * glGetString ( GLenum name )
+void glHint ( GLenum target, GLenum mode )
+void glLightModelf ( GLenum pname, GLfloat param )
+void glLightModelfv ( GLenum pname, const GLfloat *params )
+void glLightModelx ( GLenum pname, GLfixed param )
+void glLightModelxv ( GLenum pname, const GLfixed *params )
+void glLightf ( GLenum light, GLenum pname, GLfloat param )
+void glLightfv ( GLenum light, GLenum pname, const GLfloat *params )
+void glLightx ( GLenum light, GLenum pname, GLfixed param )
+void glLightxv ( GLenum light, GLenum pname, const GLfixed *params )
+void glLineWidth ( GLfloat width )
+void glLineWidthx ( GLfixed width )
+void glLoadIdentity ( void )
+void glLoadMatrixf ( const GLfloat *m )
+void glLoadMatrixx ( const GLfixed *m )
+void glLogicOp ( GLenum opcode )
+void glMaterialf ( GLenum face, GLenum pname, GLfloat param )
+void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params )
+void glMaterialx ( GLenum face, GLenum pname, GLfixed param )
+void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params )
+void glMatrixMode ( GLenum mode )
+void glMultMatrixf ( const GLfloat *m )
+void glMultMatrixx ( const GLfixed *m )
+void glMultiTexCoord4f ( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q )
+void glMultiTexCoord4x ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q )
+void glNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz )
+void glNormal3x ( GLfixed nx, GLfixed ny, GLfixed nz )
+void glNormalPointer ( GLenum type, GLsizei stride, const GLvoid *pointer )
+void glOrthof ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
+void glOrthox ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
+void glPixelStorei ( GLenum pname, GLint param )
+void glPointSize ( GLfloat size )
+void glPointSizex ( GLfixed size )
+void glPolygonOffset ( GLfloat factor, GLfloat units )
+void glPolygonOffsetx ( GLfixed factor, GLfixed units )
+void glPopMatrix ( void )
+void glPushMatrix ( void )
+void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels )
+void glRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z )
+void glRotatex ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z )
+void glSampleCoverage ( GLclampf value, GLboolean invert )
+void glSampleCoveragex ( GLclampx value, GLboolean invert )
+void glScalef ( GLfloat x, GLfloat y, GLfloat z )
+void glScalex ( GLfixed x, GLfixed y, GLfixed z )
+void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height )
+void glShadeModel ( GLenum mode )
+void glStencilFunc ( GLenum func, GLint ref, GLuint mask )
+void glStencilMask ( GLuint mask )
+void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass )
+void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+void glTexEnvf ( GLenum target, GLenum pname, GLfloat param )
+void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params )
+void glTexEnvx ( GLenum target, GLenum pname, GLfixed param )
+void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params )
+void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
+void glTexParameterf ( GLenum target, GLenum pname, GLfloat param )
+void glTexParameterx ( GLenum target, GLenum pname, GLfixed param )
+void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels )
+void glTranslatef ( GLfloat x, GLfloat y, GLfloat z )
+void glTranslatex ( GLfixed x, GLfixed y, GLfixed z )
+void glVertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height )
diff --git a/opengl/tools/glgen/specs/gles11/GLES10Ext.spec b/opengl/tools/glgen/specs/gles11/GLES10Ext.spec
new file mode 100644
index 0000000..53f6c65
--- /dev/null
+++ b/opengl/tools/glgen/specs/gles11/GLES10Ext.spec
@@ -0,0 +1 @@
+GLbitfield glQueryMatrixxOES ( GLfixed *mantissa, GLint *exponent )
diff --git a/opengl/tools/glgen/specs/gles11/GLES11.spec b/opengl/tools/glgen/specs/gles11/GLES11.spec
new file mode 100644
index 0000000..5527c18
--- /dev/null
+++ b/opengl/tools/glgen/specs/gles11/GLES11.spec
@@ -0,0 +1,44 @@
+void glBindBuffer ( GLenum target, GLuint buffer )
+void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage )
+void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data )
+void glClipPlanef ( GLenum plane, const GLfloat *equation )
+void glClipPlanex ( GLenum plane, const GLfixed *equation )
+void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha )
+void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )
+void glDeleteBuffers ( GLsizei n, const GLuint *buffers )
+void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset )
+void glGenBuffers ( GLsizei n, GLuint *buffers )
+void glGetBooleanv ( GLenum pname, GLboolean *params )
+void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params )
+void glGetClipPlanef ( GLenum pname, GLfloat *eqn )
+void glGetClipPlanex ( GLenum pname, GLfixed *eqn )
+void glGetFixedv ( GLenum pname, GLfixed *params )
+void glGetFloatv ( GLenum pname, GLfloat *params )
+void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params )
+void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params )
+void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params )
+void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params )
+// void glGetPointerv ( GLenum pname, void **params )
+void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params )
+void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params )
+void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params )
+void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params )
+void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params )
+void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params )
+GLboolean glIsBuffer ( GLuint buffer )
+GLboolean glIsEnabled ( GLenum cap )
+GLboolean glIsTexture ( GLuint texture )
+void glNormalPointer ( GLenum type, GLsizei stride, GLint offset )
+void glPointParameterf ( GLenum pname, GLfloat param )
+void glPointParameterfv ( GLenum pname, const GLfloat *params )
+void glPointParameterx ( GLenum pname, GLfixed param )
+void glPointParameterxv ( GLenum pname, const GLfixed *params )
+void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer )
+void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )
+void glTexEnvi ( GLenum target, GLenum pname, GLint param )
+void glTexEnviv ( GLenum target, GLenum pname, const GLint *params )
+void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params )
+void glTexParameteri ( GLenum target, GLenum pname, GLint param )
+void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params )
+void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params )
+void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )
diff --git a/opengl/tools/glgen/specs/gles11/GLES11Ext.spec b/opengl/tools/glgen/specs/gles11/GLES11Ext.spec
new file mode 100644
index 0000000..cd7333a
--- /dev/null
+++ b/opengl/tools/glgen/specs/gles11/GLES11Ext.spec
@@ -0,0 +1,90 @@
+void glBlendEquationSeparateOES ( GLenum modeRGB, GLenum modeAlpha )
+void glBlendFuncSeparateOES ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha )
+void glBlendEquationOES ( GLenum mode )
+void glDrawTexsOES ( GLshort x, GLshort y, GLshort z, GLshort width, GLshort height )
+void glDrawTexiOES ( GLint x, GLint y, GLint z, GLint width, GLint height )
+void glDrawTexxOES ( GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height )
+void glDrawTexsvOES ( const GLshort *coords )
+void glDrawTexivOES ( const GLint *coords )
+void glDrawTexxvOES ( const GLfixed *coords )
+void glDrawTexfOES ( GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height )
+void glDrawTexfvOES ( const GLfloat *coords )
+void glEGLImageTargetTexture2DOES ( GLenum target, GLeglImageOES image )
+void glEGLImageTargetRenderbufferStorageOES ( GLenum target, GLeglImageOES image )
+void glAlphaFuncxOES ( GLenum func, GLclampx ref )
+void glClearColorxOES ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha )
+void glClearDepthxOES ( GLclampx depth )
+void glClipPlanexOES ( GLenum plane, const GLfixed *equation )
+void glColor4xOES ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha )
+void glDepthRangexOES ( GLclampx zNear, GLclampx zFar )
+void glFogxOES ( GLenum pname, GLfixed param )
+void glFogxvOES ( GLenum pname, const GLfixed *params )
+void glFrustumxOES ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
+void glGetClipPlanexOES ( GLenum pname, GLfixed *eqn )
+void glGetFixedvOES ( GLenum pname, GLfixed *params )
+void glGetLightxvOES ( GLenum light, GLenum pname, GLfixed *params )
+void glGetMaterialxvOES ( GLenum face, GLenum pname, GLfixed *params )
+void glGetTexEnvxvOES ( GLenum env, GLenum pname, GLfixed *params )
+void glGetTexParameterxvOES ( GLenum target, GLenum pname, GLfixed *params )
+void glLightModelxOES ( GLenum pname, GLfixed param )
+void glLightModelxvOES ( GLenum pname, const GLfixed *params )
+void glLightxOES ( GLenum light, GLenum pname, GLfixed param )
+void glLightxvOES ( GLenum light, GLenum pname, const GLfixed *params )
+void glLineWidthxOES ( GLfixed width )
+void glLoadMatrixxOES ( const GLfixed *m )
+void glMaterialxOES ( GLenum face, GLenum pname, GLfixed param )
+void glMaterialxvOES ( GLenum face, GLenum pname, const GLfixed *params )
+void glMultMatrixxOES ( const GLfixed *m )
+void glMultiTexCoord4xOES ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q )
+void glNormal3xOES ( GLfixed nx, GLfixed ny, GLfixed nz )
+void glOrthoxOES ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
+void glPointParameterxOES ( GLenum pname, GLfixed param )
+void glPointParameterxvOES ( GLenum pname, const GLfixed *params )
+void glPointSizexOES ( GLfixed size )
+void glPolygonOffsetxOES ( GLfixed factor, GLfixed units )
+void glRotatexOES ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z )
+void glSampleCoveragexOES ( GLclampx value, GLboolean invert )
+void glScalexOES ( GLfixed x, GLfixed y, GLfixed z )
+void glTexEnvxOES ( GLenum target, GLenum pname, GLfixed param )
+void glTexEnvxvOES ( GLenum target, GLenum pname, const GLfixed *params )
+void glTexParameterxOES ( GLenum target, GLenum pname, GLfixed param )
+void glTexParameterxvOES ( GLenum target, GLenum pname, const GLfixed *params )
+void glTranslatexOES ( GLfixed x, GLfixed y, GLfixed z )
+GLboolean glIsRenderbufferOES ( GLuint renderbuffer )
+void glBindRenderbufferOES ( GLenum target, GLuint renderbuffer )
+void glDeleteRenderbuffersOES ( GLsizei n, const GLuint *renderbuffers )
+void glGenRenderbuffersOES ( GLsizei n, GLuint *renderbuffers )
+void glRenderbufferStorageOES ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height )
+void glGetRenderbufferParameterivOES ( GLenum target, GLenum pname, GLint *params )
+GLboolean glIsFramebufferOES ( GLuint framebuffer )
+void glBindFramebufferOES ( GLenum target, GLuint framebuffer )
+void glDeleteFramebuffersOES ( GLsizei n, const GLuint *framebuffers )
+void glGenFramebuffersOES ( GLsizei n, GLuint *framebuffers )
+GLenum glCheckFramebufferStatusOES ( GLenum target )
+void glFramebufferRenderbufferOES ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer )
+void glFramebufferTexture2DOES ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level )
+void glGetFramebufferAttachmentParameterivOES ( GLenum target, GLenum attachment, GLenum pname, GLint *params )
+void glGenerateMipmapOES ( GLenum target )
+// Hard to export to Java:
+// void *glMapBufferOES ( GLenum target, GLenum access )
+// GLboolean glUnmapBufferOES ( GLenum target )
+// void glGetBufferPointervOES ( GLenum target, GLenum pname, void **params )
+void glCurrentPaletteMatrixOES ( GLuint matrixpaletteindex )
+void glLoadPaletteFromModelViewMatrixOES ( void )
+void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+void glDepthRangefOES ( GLclampf zNear, GLclampf zFar )
+void glFrustumfOES ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
+void glOrthofOES ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
+void glClipPlanefOES ( GLenum plane, const GLfloat *equation )
+void glGetClipPlanefOES ( GLenum pname, GLfloat *eqn )
+void glClearDepthfOES ( GLclampf depth )
+void glTexGenfOES ( GLenum coord, GLenum pname, GLfloat param )
+void glTexGenfvOES ( GLenum coord, GLenum pname, const GLfloat *params )
+void glTexGeniOES ( GLenum coord, GLenum pname, GLint param )
+void glTexGenivOES ( GLenum coord, GLenum pname, const GLint *params )
+void glTexGenxOES ( GLenum coord, GLenum pname, GLfixed param )
+void glTexGenxvOES ( GLenum coord, GLenum pname, const GLfixed *params )
+void glGetTexGenfvOES ( GLenum coord, GLenum pname, GLfloat *params )
+void glGetTexGenivOES ( GLenum coord, GLenum pname, GLint *params )
+void glGetTexGenxvOES ( GLenum coord, GLenum pname, GLfixed *params )
diff --git a/opengl/tools/glgen/specs/gles11/checks.spec b/opengl/tools/glgen/specs/gles11/checks.spec
new file mode 100644
index 0000000..e31a2ce
--- /dev/null
+++ b/opengl/tools/glgen/specs/gles11/checks.spec
@@ -0,0 +1,61 @@
+glClipPlanef check eqn 4

+glClipPlanex check eqn 4

+glGetClipPlanefOES check eqn 4

+glGetClipPlanexOES check eqn 4

+glDeleteBuffers check buffers n 

+glDeleteTextures check textures n

+glDrawElements check_AIOOBE indices count

+glFog ifcheck params 1 pname GL_FOG_MODE,GL_FOG_DENSITY,GL_FOG_START,GL_FOG_END ifcheck params 4 pname GL_FOG_COLOR

+glGenBuffers check buffers n

+glGenTextures check textures n

+glGetClipPlane check eqn 4

+glGetIntegerv ifcheck params 1 pname GL_ALPHA_BITS,GL_ALPHA_TEST_FUNC,GL_ALPHA_TEST_REF,GL_BLEND_DST,GL_BLUE_BITS,GL_COLOR_ARRAY_BUFFER_BINDING,GL_COLOR_ARRAY_SIZE,GL_COLOR_ARRAY_STRIDE,GL_COLOR_ARRAY_TYPE,GL_CULL_FACE,GL_DEPTH_BITS,GL_DEPTH_CLEAR_VALUE,GL_DEPTH_FUNC,GL_DEPTH_WRITEMASK,GL_FOG_DENSITY,GL_FOG_END,GL_FOG_MODE,GL_FOG_START,GL_FRONT_FACE,GL_GREEN_BITS,GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES,GL_IMPLEMENTATION_COLOR_READ_TYPE_OES,GL_LIGHT_MODEL_COLOR_CONTROL,GL_LIGHT_MODEL_LOCAL_VIEWER,GL_LIGHT_MODEL_TWO_SIDE,GL_LINE_SMOOTH_HINT,GL_LINE_WIDTH,GL_LOGIC_OP_MODE,GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES,GL_MATRIX_INDEX_ARRAY_SIZE_OES,GL_MATRIX_INDEX_ARRAY_STRIDE_OES,GL_MATRIX_INDEX_ARRAY_TYPE_OES,GL_MATRIX_MODE,GL_MAX_CLIP_PLANES,GL_MAX_ELEMENTS_INDICES,GL_MAX_ELEMENTS_VERTICES,GL_MAX_LIGHTS,GL_MAX_MODELVIEW_STACK_DEPTH,GL_MAX_PALETTE_MATRICES_OES,GL_MAX_PROJECTION_STACK_DEPTH,GL_MAX_TEXTURE_SIZE,GL_MAX_TEXTURE_STACK_DEPTH,GL_MAX_TEXTURE_UNITS,GL_MAX_VERTEX_UNITS_OES,GL_MODELVIEW_STACK_DEPTH,GL_NORMAL_ARRAY_BUFFER_BINDING,GL_NORMAL_ARRAY_STRIDE,GL_NORMAL_ARRAY_TYPE,GL_NUM_COMPRESSED_TEXTURE_FORMATS,GL_PACK_ALIGNMENT,GL_PERSPECTIVE_CORRECTION_HINT,GL_POINT_SIZE,GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES,GL_POINT_SIZE_ARRAY_STRIDE_OES,GL_POINT_SIZE_ARRAY_TYPE_OES,GL_POINT_SMOOTH_HINT,GL_POLYGON_OFFSET_FACTOR,GL_POLYGON_OFFSET_UNITS,GL_PROJECTION_STACK_DEPTH,GL_RED_BITS,GL_SHADE_MODEL,GL_STENCIL_BITS,GL_STENCIL_CLEAR_VALUE,GL_STENCIL_FAIL,GL_STENCIL_FUNC,GL_STENCIL_PASS_DEPTH_FAIL,GL_STENCIL_PASS_DEPTH_PASS,GL_STENCIL_REF,GL_STENCIL_VALUE_MASK,GL_STENCIL_WRITEMASK,GL_SUBPIXEL_BITS,GL_TEXTURE_BINDING_2D,GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING,GL_TEXTURE_COORD_ARRAY_SIZE,GL_TEXTURE_COORD_ARRAY_STRIDE,GL_TEXTURE_COORD_ARRAY_TYPE,GL_TEXTURE_STACK_DEPTH,GL_UNPACK_ALIGNMENT,GL_VERTEX_ARRAY_BUFFER_BINDING,GL_VERTEX_ARRAY_SIZE,GL_VERTEX_ARRAY_STRIDE,GL_VERTEX_ARRAY_TYPE,GL_WEIGHT_ARRAY_BUFFER_BINDING_OES,GL_WEIGHT_ARRAY_SIZE_OES,GL_WEIGHT_ARRAY_STRIDE_OES,GL_WEIGHT_ARRAY_TYPE_OES ifcheck params 2 pname GL_ALIASED_POINT_SIZE_RANGE,GL_ALIASED_LINE_WIDTH_RANGE,GL_DEPTH_RANGE,GL_MAX_VIEWPORT_DIMS,GL_SMOOTH_LINE_WIDTH_RANGE,GL_SMOOTH_POINT_SIZE_RANGE ifcheck params 4 pname GL_COLOR_CLEAR_VALUE,GL_COLOR_WRITEMASK,GL_FOG_COLOR,GL_LIGHT_MODEL_AMBIENT,GL_SCISSOR_BOX,GL_VIEWPORT ifcheck params 16 pname GL_MODELVIEW_MATRIX,GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES,GL_PROJECTION_MATRIX,GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES,GL_TEXTURE_MATRIX,GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES ifcheck params getNumCompressedTextureFormats() pname GL_COMPRESSED_TEXTURE_FORMATS

+glGetLight ifcheck params 1 pname GL_SPOT_EXPONENT,GL_SPOT_CUTOFF,GL_CONSTANT_ATTENUATION,GL_LINEAR_ATTENUATION,GL_QUADRATIC_ATTENUATION ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION

+glGetMaterial ifcheck params 1 pname GL_SHININESS ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE

+glGetTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR

+glGetTexParameter check params 1

+glLightModel ifcheck params 1 pname GL_LIGHT_MODEL_TWO_SIDE ifcheck params 4 pname GL_LIGHT_MODEL_AMBIENT

+glLight ifcheck params 1 pname GL_SPOT_EXPONENT,GL_SPOT_CUTOFF,GL_CONSTANT_ATTENUATION,GL_LINEAR_ATTENUATION,GL_QUADRATIC_ATTENUATION ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION

+glLoadMatrix check m 16

+glMaterial ifcheck params 1 pname GL_SHININESS ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE

+glMultMatrix check m 16

+glPointParameter check params 1

+glTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR

+glTexImage2D nullAllowed

+glTexSubImage2D nullAllowed

+glBufferData nullAllowed

+glTexParameter check params 1

+glQueryMatrixxOES check mantissa 16 check exponent 16 return -1

+glDrawTexfvOES check coords 5

+glDrawTexivOES check coords 5

+glDrawTexsvOES check coords 5

+glDrawTexxvOES check coords 5

+glBindFramebufferOES unsupported

+glBindRenderbufferOES unsupported

+glBlendEquation unsupported

+glBlendEquationSeparate unsupported

+glBlendFuncSeparate unsupported

+glCheckFramebufferStatusOES unsupported return 0

+glCurrentPaletteMatrixOES unsupported

+glDeleteFramebuffersOES unsupported

+glDeleteRenderbuffersOES unsupported

+glFramebufferRenderbufferOES unsupported

+glFramebufferStorageOES unsupported

+glFramebufferTexture2DOES unsupported

+glGenFramebuffersOES unsupported

+glGenRenderbuffersOES unsupported

+glGenerateMipmapOES unsupported

+glGetBufferParameter unsupported

+glGetFramebufferAttachmentParameterivOES unsupported

+glGetRenderbufferParameterivOES unsupported

+glGetTexGen unsupported

+glIsFramebufferOES unsupported return JNI_FALSE

+glIsRenderbufferOES unsupported return JNI_FALSE

+glLoadPaletteFromModelViewMatrixOES unsupported

+glMatrixIndexPointerOES unsupported

+glRenderbufferStorageOES unsupported return false

+glTexGen unsupported

+glTexGenf unsupported

+glTexGeni unsupported

+glTexGenx unsupported

+glWeightPointerOES unsupported

diff --git a/opengl/tools/glgen/glspec-1.0 b/opengl/tools/glgen/specs/jsr239/glspec-1.0
similarity index 100%
rename from opengl/tools/glgen/glspec-1.0
rename to opengl/tools/glgen/specs/jsr239/glspec-1.0
diff --git a/opengl/tools/glgen/glspec-1.0ext b/opengl/tools/glgen/specs/jsr239/glspec-1.0ext
similarity index 100%
rename from opengl/tools/glgen/glspec-1.0ext
rename to opengl/tools/glgen/specs/jsr239/glspec-1.0ext
diff --git a/opengl/tools/glgen/glspec-1.1 b/opengl/tools/glgen/specs/jsr239/glspec-1.1
similarity index 100%
rename from opengl/tools/glgen/glspec-1.1
rename to opengl/tools/glgen/specs/jsr239/glspec-1.1
diff --git a/opengl/tools/glgen/glspec-1.1ext b/opengl/tools/glgen/specs/jsr239/glspec-1.1ext
similarity index 100%
rename from opengl/tools/glgen/glspec-1.1ext
rename to opengl/tools/glgen/specs/jsr239/glspec-1.1ext
diff --git a/opengl/tools/glgen/glspec-1.1extpack b/opengl/tools/glgen/specs/jsr239/glspec-1.1extpack
similarity index 100%
rename from opengl/tools/glgen/glspec-1.1extpack
rename to opengl/tools/glgen/specs/jsr239/glspec-1.1extpack
diff --git a/opengl/tools/glgen/glspec-checks b/opengl/tools/glgen/specs/jsr239/glspec-checks
similarity index 61%
rename from opengl/tools/glgen/glspec-checks
rename to opengl/tools/glgen/specs/jsr239/glspec-checks
index a84ed65..55840fa 100644
--- a/opengl/tools/glgen/glspec-checks
+++ b/opengl/tools/glgen/specs/jsr239/glspec-checks
@@ -7,7 +7,7 @@
 glGenBuffers check buffers n

 glGenTextures check textures n

 glGetClipPlane check eqn 4

-glGetIntegerv ifcheck params 1 pname GL_ALPHA_BITS,GL_ALPHA_TEST_FUNC,GL_ALPHA_TEST_REF,GL_BLEND_DST,GL_BLUE_BITS,GL_COLOR_ARRAY_BUFFER_BINDING,GL_COLOR_ARRAY_SIZE,GL_COLOR_ARRAY_STRIDE,GL_COLOR_ARRAY_TYPE,GL_CULL_FACE,GL_DEPTH_BITS,GL_DEPTH_CLEAR_VALUE,GL_DEPTH_FUNC,GL_DEPTH_WRITEMASK,GL_FOG_DENSITY,GL_FOG_END,GL_FOG_MODE,GL_FOG_START,GL_FRONT_FACE,GL_GREEN_BITS,GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES,GL_IMPLEMENTATION_COLOR_READ_TYPE_OES,GL_LIGHT_MODEL_TWO_SIDE,GL_LINE_SMOOTH_HINT,GL_LINE_WIDTH,GL_LOGIC_OP_MODE,GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES,GL_MATRIX_INDEX_ARRAY_SIZE_OES,GL_MATRIX_INDEX_ARRAY_STRIDE_OES,GL_MATRIX_INDEX_ARRAY_TYPE_OES,GL_MATRIX_MODE,GL_MAX_CLIP_PLANES,GL_MAX_ELEMENTS_INDICES,GL_MAX_ELEMENTS_VERTICES,GL_MAX_LIGHTS,GL_MAX_MODELVIEW_STACK_DEPTH,GL_MAX_PALETTE_MATRICES_OES,GL_MAX_PROJECTION_STACK_DEPTH,GL_MAX_TEXTURE_SIZE,GL_MAX_TEXTURE_STACK_DEPTH,GL_MAX_TEXTURE_UNITS,GL_MAX_VERTEX_UNITS_OES,GL_MODELVIEW_STACK_DEPTH,GL_NORMAL_ARRAY_BUFFER_BINDING,GL_NORMAL_ARRAY_STRIDE,GL_NORMAL_ARRAY_TYPE,GL_NUM_COMPRESSED_TEXTURE_FORMATS,GL_PACK_ALIGNMENT,GL_PERSPECTIVE_CORRECTION_HINT,GL_POINT_SIZE,GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES,GL_POINT_SIZE_ARRAY_STRIDE_OES,GL_POINT_SIZE_ARRAY_TYPE_OES,GL_POINT_SMOOTH_HINT,GL_POLYGON_OFFSET_FACTOR,GL_POLYGON_OFFSET_UNITS,GL_PROJECTION_STACK_DEPTH,GL_RED_BITS,GL_SHADE_MODEL,GL_STENCIL_BITS,GL_STENCIL_CLEAR_VALUE,GL_STENCIL_FAIL,GL_STENCIL_FUNC,GL_STENCIL_PASS_DEPTH_FAIL,GL_STENCIL_PASS_DEPTH_PASS,GL_STENCIL_REF,GL_STENCIL_VALUE_MASK,GL_STENCIL_WRITEMASK,GL_SUBPIXEL_BITS,GL_TEXTURE_BINDING_2D,GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING,GL_TEXTURE_COORD_ARRAY_SIZE,GL_TEXTURE_COORD_ARRAY_STRIDE,GL_TEXTURE_COORD_ARRAY_TYPE,GL_TEXTURE_STACK_DEPTH,GL_UNPACK_ALIGNMENT,GL_VERTEX_ARRAY_BUFFER_BINDING,GL_VERTEX_ARRAY_SIZE,GL_VERTEX_ARRAY_STRIDE,GL_VERTEX_ARRAY_TYPE,GL_WEIGHT_ARRAY_BUFFER_BINDING_OES,GL_WEIGHT_ARRAY_SIZE_OES,GL_WEIGHT_ARRAY_STRIDE_OES,GL_WEIGHT_ARRAY_TYPE_OES ifcheck params 2 pname GL_ALIASED_POINT_SIZE_RANGE,GL_ALIASED_LINE_WIDTH_RANGE,GL_DEPTH_RANGE,GL_MAX_VIEWPORT_DIMS,GL_SMOOTH_LINE_WIDTH_RANGE,GL_SMOOTH_POINT_SIZE_RANGE ifcheck params 4 pname GL_COLOR_CLEAR_VALUE,GL_COLOR_WRITEMASK,GL_SCISSOR_BOX,GL_VIEWPORT ifcheck params 16 pname GL_MODELVIEW_MATRIX,GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES,GL_PROJECTION_MATRIX,GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES,GL_TEXTURE_MATRIX,GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES ifcheck params _NUM_COMPRESSED_TEXTURE_FORMATS pname GL_COMPRESSED_TEXTURE_FORMATS,GL_FOG_COLOR,GL_LIGHT_MODEL_AMBIENT

+glGetIntegerv ifcheck params 1 pname GL_ALPHA_BITS,GL_ALPHA_TEST_FUNC,GL_ALPHA_TEST_REF,GL_BLEND_DST,GL_BLUE_BITS,GL_COLOR_ARRAY_BUFFER_BINDING,GL_COLOR_ARRAY_SIZE,GL_COLOR_ARRAY_STRIDE,GL_COLOR_ARRAY_TYPE,GL_CULL_FACE,GL_DEPTH_BITS,GL_DEPTH_CLEAR_VALUE,GL_DEPTH_FUNC,GL_DEPTH_WRITEMASK,GL_FOG_DENSITY,GL_FOG_END,GL_FOG_MODE,GL_FOG_START,GL_FRONT_FACE,GL_GREEN_BITS,GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES,GL_IMPLEMENTATION_COLOR_READ_TYPE_OES,GL_LIGHT_MODEL_COLOR_CONTROL,GL_LIGHT_MODEL_LOCAL_VIEWER,GL_LIGHT_MODEL_TWO_SIDE,GL_LINE_SMOOTH_HINT,GL_LINE_WIDTH,GL_LOGIC_OP_MODE,GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES,GL_MATRIX_INDEX_ARRAY_SIZE_OES,GL_MATRIX_INDEX_ARRAY_STRIDE_OES,GL_MATRIX_INDEX_ARRAY_TYPE_OES,GL_MATRIX_MODE,GL_MAX_CLIP_PLANES,GL_MAX_ELEMENTS_INDICES,GL_MAX_ELEMENTS_VERTICES,GL_MAX_LIGHTS,GL_MAX_MODELVIEW_STACK_DEPTH,GL_MAX_PALETTE_MATRICES_OES,GL_MAX_PROJECTION_STACK_DEPTH,GL_MAX_TEXTURE_SIZE,GL_MAX_TEXTURE_STACK_DEPTH,GL_MAX_TEXTURE_UNITS,GL_MAX_VERTEX_UNITS_OES,GL_MODELVIEW_STACK_DEPTH,GL_NORMAL_ARRAY_BUFFER_BINDING,GL_NORMAL_ARRAY_STRIDE,GL_NORMAL_ARRAY_TYPE,GL_NUM_COMPRESSED_TEXTURE_FORMATS,GL_PACK_ALIGNMENT,GL_PERSPECTIVE_CORRECTION_HINT,GL_POINT_SIZE,GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES,GL_POINT_SIZE_ARRAY_STRIDE_OES,GL_POINT_SIZE_ARRAY_TYPE_OES,GL_POINT_SMOOTH_HINT,GL_POLYGON_OFFSET_FACTOR,GL_POLYGON_OFFSET_UNITS,GL_PROJECTION_STACK_DEPTH,GL_RED_BITS,GL_SHADE_MODEL,GL_STENCIL_BITS,GL_STENCIL_CLEAR_VALUE,GL_STENCIL_FAIL,GL_STENCIL_FUNC,GL_STENCIL_PASS_DEPTH_FAIL,GL_STENCIL_PASS_DEPTH_PASS,GL_STENCIL_REF,GL_STENCIL_VALUE_MASK,GL_STENCIL_WRITEMASK,GL_SUBPIXEL_BITS,GL_TEXTURE_BINDING_2D,GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING,GL_TEXTURE_COORD_ARRAY_SIZE,GL_TEXTURE_COORD_ARRAY_STRIDE,GL_TEXTURE_COORD_ARRAY_TYPE,GL_TEXTURE_STACK_DEPTH,GL_UNPACK_ALIGNMENT,GL_VERTEX_ARRAY_BUFFER_BINDING,GL_VERTEX_ARRAY_SIZE,GL_VERTEX_ARRAY_STRIDE,GL_VERTEX_ARRAY_TYPE,GL_WEIGHT_ARRAY_BUFFER_BINDING_OES,GL_WEIGHT_ARRAY_SIZE_OES,GL_WEIGHT_ARRAY_STRIDE_OES,GL_WEIGHT_ARRAY_TYPE_OES ifcheck params 2 pname GL_ALIASED_POINT_SIZE_RANGE,GL_ALIASED_LINE_WIDTH_RANGE,GL_DEPTH_RANGE,GL_MAX_VIEWPORT_DIMS,GL_SMOOTH_LINE_WIDTH_RANGE,GL_SMOOTH_POINT_SIZE_RANGE ifcheck params 4 pname GL_COLOR_CLEAR_VALUE,GL_COLOR_WRITEMASK,GL_FOG_COLOR,GL_LIGHT_MODEL_AMBIENT,GL_SCISSOR_BOX,GL_VIEWPORT ifcheck params 16 pname GL_MODELVIEW_MATRIX,GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES,GL_PROJECTION_MATRIX,GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES,GL_TEXTURE_MATRIX,GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES ifcheck params getNumCompressedTextureFormats() pname GL_COMPRESSED_TEXTURE_FORMATS

 glGetLight ifcheck params 1 pname GL_SPOT_EXPONENT,GL_SPOT_CUTOFF,GL_CONSTANT_ATTENUATION,GL_LINEAR_ATTENUATION,GL_QUADRATIC_ATTENUATION ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION

 glGetMaterial ifcheck params 1 pname GL_SHININESS ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE

 glGetTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR

diff --git a/opengl/tools/glgen/src/.gitignore b/opengl/tools/glgen/src/.gitignore
new file mode 100644
index 0000000..6b468b6
--- /dev/null
+++ b/opengl/tools/glgen/src/.gitignore
@@ -0,0 +1 @@
+*.class
diff --git a/opengl/tools/glgen/src/CFunc.java b/opengl/tools/glgen/src/CFunc.java
index 0794f41..a89e1c5 100644
--- a/opengl/tools/glgen/src/CFunc.java
+++ b/opengl/tools/glgen/src/CFunc.java
@@ -1,155 +1,156 @@
-

-import java.util.*;

-

-public class CFunc {

-

-    String original;

-

-    CType ftype;

-    String fname;

-

-    List<String> argNames = new ArrayList<String>();

-    List<CType> argTypes = new ArrayList<CType>();

-

-    boolean hasPointerArg = false;

-    boolean hasTypedPointerArg = false;

-

-    public CFunc(String original) {

-        this.original = original;

-    }

-

-    public String getOriginal() {

-        return original;

-    }

-

-    public void setName(String fname) {

-        this.fname = fname;

-    }

-

-    public String getName() {

-        return fname;

-    }

-

-    public void setType(CType ftype) {

-        this.ftype = ftype;

-    }

-

-    public CType getType() {

-        return ftype;

-    }

-

-    public void addArgument(String argName, CType argType) {

-        argNames.add(argName);

-        argTypes.add(argType);

-

-        if (argType.isPointer()) {

-            hasPointerArg = true;

-        }

-        if (argType.isTypedPointer()) {

-            hasTypedPointerArg = true;

-        }

-    }

-

-    public int getNumArgs() {

-        return argNames.size();

-    }

-

-    public int getArgIndex(String name) {

-        int len = argNames.size();

-        for (int i = 0; i < len; i++) {

-            if (name.equals(argNames.get(i))) {

-                return i;

-            }

-        }

-        return -1;

-    }

-

-    public String getArgName(int index) {

-        return argNames.get(index);

-    }

-

-    public CType getArgType(int index) {

-        return argTypes.get(index);

-    }

-

-    public boolean hasPointerArg() {

-        return hasPointerArg;

-    }

-

-    public boolean hasTypedPointerArg() {

-        return hasTypedPointerArg;

-    }

-

-    public String toString() {

-        String s =  "Function " + fname + " returns " + ftype + ": ";

-        for (int i = 0; i < argNames.size(); i++) {

-            if (i > 0) {

-                s += ", ";

-            }

-            s += argTypes.get(i) + " " + argNames.get(i);

-        }

-        return s;

-    }

-

-    public static CFunc parseCFunc(String s) {

-        CFunc cfunc = new CFunc(s);

-        String[] tokens = s.split("\\s");

-

-        int i = 0;

-        CType ftype = new CType();

-        String ftypeName = tokens[i++];

-        if (ftypeName.equals("const")) {

-            ftype.setIsConst(true);

-            ftypeName = tokens[i++];

-        }

-        ftype.setBaseType(ftypeName);

-

-        String fname = tokens[i++];

-        if (fname.equals("*")) {

-            ftype.setIsPointer(true);

-            fname = tokens[i++];

-        }

-	

-        cfunc.setName(fname);

-        cfunc.setType(ftype);

-	

-        while (i < tokens.length) {

-            String tok = tokens[i++];

-	    

-            if (tok.equals("(")) {

-                continue;

-            }

-            if (tok.equals(")")) {

-                break;

-            }

-

-            CType argType = new CType();

-	    

-            String argTypeName = tok;

-            String argName = "";

-	    

-            if (argTypeName.equals("const")) {

-                argType.setIsConst(true);

-                argTypeName = tokens[i++];

-            }

-            argType.setBaseType(argTypeName);

-

-            if (argTypeName.equals("void")) {

-                break;

-            }

-	    

-            argName = tokens[i++];

-            if (argName.startsWith("*")) {

-                argType.setIsPointer(true);

-                argName = argName.substring(1, argName.length());

-            }

-            if (argName.endsWith(",")) {

-                argName = argName.substring(0, argName.length() - 1);

-            }

-	    

-            cfunc.addArgument(argName, argType);

-        }

-

-        return cfunc;

-    }

-}

+
+import java.util.*;
+
+public class CFunc {
+
+    String original;
+
+    CType ftype;
+    String fname;
+
+    List<String> argNames = new ArrayList<String>();
+    List<CType> argTypes = new ArrayList<CType>();
+
+    boolean hasPointerArg = false;
+    boolean hasTypedPointerArg = false;
+
+    public CFunc(String original) {
+        this.original = original;
+    }
+
+    public String getOriginal() {
+        return original;
+    }
+
+    public void setName(String fname) {
+        this.fname = fname;
+    }
+
+    public String getName() {
+        return fname;
+    }
+
+    public void setType(CType ftype) {
+        this.ftype = ftype;
+    }
+
+    public CType getType() {
+        return ftype;
+    }
+
+    public void addArgument(String argName, CType argType) {
+        argNames.add(argName);
+        argTypes.add(argType);
+
+        if (argType.isPointer()) {
+            hasPointerArg = true;
+        }
+        if (argType.isTypedPointer()) {
+            hasTypedPointerArg = true;
+        }
+    }
+
+    public int getNumArgs() {
+        return argNames.size();
+    }
+
+    public int getArgIndex(String name) {
+        int len = argNames.size();
+        for (int i = 0; i < len; i++) {
+            if (name.equals(argNames.get(i))) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
+    public String getArgName(int index) {
+        return argNames.get(index);
+    }
+
+    public CType getArgType(int index) {
+        return argTypes.get(index);
+    }
+
+    public boolean hasPointerArg() {
+        return hasPointerArg;
+    }
+
+    public boolean hasTypedPointerArg() {
+        return hasTypedPointerArg;
+    }
+
+    @Override
+    public String toString() {
+        String s =  "Function " + fname + " returns " + ftype + ": ";
+        for (int i = 0; i < argNames.size(); i++) {
+            if (i > 0) {
+                s += ", ";
+            }
+            s += argTypes.get(i) + " " + argNames.get(i);
+        }
+        return s;
+    }
+
+    public static CFunc parseCFunc(String s) {
+        CFunc cfunc = new CFunc(s);
+        String[] tokens = s.split("\\s");
+
+        int i = 0;
+        CType ftype = new CType();
+        String ftypeName = tokens[i++];
+        if (ftypeName.equals("const")) {
+            ftype.setIsConst(true);
+            ftypeName = tokens[i++];
+        }
+        ftype.setBaseType(ftypeName);
+
+        String fname = tokens[i++];
+        if (fname.equals("*")) {
+            ftype.setIsPointer(true);
+            fname = tokens[i++];
+        }
+
+        cfunc.setName(fname);
+        cfunc.setType(ftype);
+
+        while (i < tokens.length) {
+            String tok = tokens[i++];
+
+            if (tok.equals("(")) {
+                continue;
+            }
+            if (tok.equals(")")) {
+                break;
+            }
+
+            CType argType = new CType();
+
+            String argTypeName = tok;
+            String argName = "";
+
+            if (argTypeName.equals("const")) {
+                argType.setIsConst(true);
+                argTypeName = tokens[i++];
+            }
+            argType.setBaseType(argTypeName);
+
+            if (argTypeName.equals("void")) {
+                break;
+            }
+
+            argName = tokens[i++];
+            if (argName.startsWith("*")) {
+                argType.setIsPointer(true);
+                argName = argName.substring(1, argName.length());
+            }
+            if (argName.endsWith(",")) {
+                argName = argName.substring(0, argName.length() - 1);
+            }
+
+            cfunc.addArgument(argName, argType);
+        }
+
+        return cfunc;
+    }
+}
diff --git a/opengl/tools/glgen/src/CType.java b/opengl/tools/glgen/src/CType.java
index 331ec62..826c90d 100644
--- a/opengl/tools/glgen/src/CType.java
+++ b/opengl/tools/glgen/src/CType.java
@@ -1,85 +1,88 @@
-

-public class CType {

-

-    String baseType;

-    boolean isConst;

-    boolean isPointer;

-

-    public CType() {

-    }

-

-    public CType(String baseType) {

-	setBaseType(baseType);

-    }

-

-    public CType(String baseType, boolean isConst, boolean isPointer) {

-	setBaseType(baseType);

-	setIsConst(isConst);

-	setIsPointer(isPointer);

-    }

-

-    public String getDeclaration() {

-	return baseType + (isPointer ? " *" : "");

-    }

-    

-    public void setIsConst(boolean isConst) {

-	this.isConst = isConst;

-    }

-

-    public boolean isConst() {

-	return isConst;

-    }

-

-    public void setIsPointer(boolean isPointer) {

-	this.isPointer = isPointer;

-    }

-

-    public boolean isPointer() {

-	return isPointer;

-    }

-

-    boolean isVoid() {

-	String baseType = getBaseType();

-	return baseType.equals("GLvoid") ||

-	    baseType.equals("void");

-    }

-

-    public boolean isTypedPointer() {

-	return isPointer() && !isVoid();

-    }

-

-    public void setBaseType(String baseType) {

-	this.baseType = baseType;

-    }

-

-    public String getBaseType() {

-	return baseType;

-    }

-

-    public String toString() {

-	String s = "";

-	if (isConst()) {

-	    s += "const ";

-	}

-	s += baseType;

-	if (isPointer()) {

-	    s += "*";

-	}

-

-	return s;

-    }

-

-    public int hashCode() {

-	return baseType.hashCode() ^ (isPointer ? 2 : 0) ^ (isConst ? 1 : 0);

-    }

-

-    public boolean equals(Object o) {

-	if (o != null && o instanceof CType) {

-	    CType c = (CType)o;

-	    return baseType.equals(c.baseType) &&

-		isPointer() == c.isPointer() &&

-		isConst() == c.isConst();

-	}

-	return false;

-    }

-}

+
+public class CType {
+
+    String baseType;
+    boolean isConst;
+    boolean isPointer;
+
+    public CType() {
+    }
+
+    public CType(String baseType) {
+    setBaseType(baseType);
+    }
+
+    public CType(String baseType, boolean isConst, boolean isPointer) {
+    setBaseType(baseType);
+    setIsConst(isConst);
+    setIsPointer(isPointer);
+    }
+
+    public String getDeclaration() {
+    return baseType + (isPointer ? " *" : "");
+    }
+
+    public void setIsConst(boolean isConst) {
+    this.isConst = isConst;
+    }
+
+    public boolean isConst() {
+    return isConst;
+    }
+
+    public void setIsPointer(boolean isPointer) {
+    this.isPointer = isPointer;
+    }
+
+    public boolean isPointer() {
+    return isPointer;
+    }
+
+    boolean isVoid() {
+    String baseType = getBaseType();
+    return baseType.equals("GLvoid") ||
+        baseType.equals("void");
+    }
+
+    public boolean isTypedPointer() {
+    return isPointer() && !isVoid();
+    }
+
+    public void setBaseType(String baseType) {
+    this.baseType = baseType;
+    }
+
+    public String getBaseType() {
+    return baseType;
+    }
+
+    @Override
+    public String toString() {
+    String s = "";
+    if (isConst()) {
+        s += "const ";
+    }
+    s += baseType;
+    if (isPointer()) {
+        s += "*";
+    }
+
+    return s;
+    }
+
+    @Override
+    public int hashCode() {
+    return baseType.hashCode() ^ (isPointer ? 2 : 0) ^ (isConst ? 1 : 0);
+    }
+
+    @Override
+    public boolean equals(Object o) {
+    if (o != null && o instanceof CType) {
+        CType c = (CType)o;
+        return baseType.equals(c.baseType) &&
+        isPointer() == c.isPointer() &&
+        isConst() == c.isConst();
+    }
+    return false;
+    }
+}
diff --git a/opengl/tools/glgen/src/CodeEmitter.java b/opengl/tools/glgen/src/CodeEmitter.java
index 3e9b90a..ebb9727 100644
--- a/opengl/tools/glgen/src/CodeEmitter.java
+++ b/opengl/tools/glgen/src/CodeEmitter.java
@@ -1,8 +1,8 @@
-

-public interface CodeEmitter {

-

-    void setVersion(int version, boolean ext, boolean pack);

-    void emitCode(CFunc cfunc, String original);

-    void addNativeRegistration(String fname);

-    void emitNativeRegistration();

-}

+
+public interface CodeEmitter {
+
+    void setVersion(int version, boolean ext, boolean pack);
+    void emitCode(CFunc cfunc, String original);
+    void addNativeRegistration(String fname);
+    void emitNativeRegistration();
+}
diff --git a/opengl/tools/glgen/src/GLESCodeEmitter.java b/opengl/tools/glgen/src/GLESCodeEmitter.java
new file mode 100644
index 0000000..b303503
--- /dev/null
+++ b/opengl/tools/glgen/src/GLESCodeEmitter.java
@@ -0,0 +1,40 @@
+import java.io.PrintStream;
+
+/**
+ * Emits a Java interface and Java & C implementation for a C function.
+ *
+ * <p> The Java interface will have Buffer and array variants for functions that
+ * have a typed pointer argument.  The array variant will convert a single "<type> *data"
+ * argument to a pair of arguments "<type>[] data, int offset".
+ */
+public class GLESCodeEmitter extends JniCodeEmitter {
+
+    PrintStream mJavaImplStream;
+    PrintStream mCStream;
+
+    PrintStream mJavaInterfaceStream;
+
+    /**
+      */
+    public GLESCodeEmitter(String classPathName,
+                          ParameterChecker checker,
+                          PrintStream javaImplStream,
+                          PrintStream cStream) {
+        mClassPathName = classPathName;
+        mChecker = checker;
+
+        mJavaImplStream = javaImplStream;
+        mCStream = cStream;
+        mUseContextPointer = false;
+        mUseStaticMethods = true;
+    }
+
+    public void emitCode(CFunc cfunc, String original) {
+        emitCode(cfunc, original, null, mJavaImplStream,
+                mCStream);
+    }
+
+    public void emitNativeRegistration(String nativeRegistrationName) {
+        emitNativeRegistration(nativeRegistrationName, mCStream);
+    }
+}
diff --git a/opengl/tools/glgen/src/GenerateGL.java b/opengl/tools/glgen/src/GenerateGL.java
index 657ee6e..3715a96 100644
--- a/opengl/tools/glgen/src/GenerateGL.java
+++ b/opengl/tools/glgen/src/GenerateGL.java
@@ -1,164 +1,167 @@
-

-import java.io.*;

-import java.util.*;

-

-public class GenerateGL {

-

-    static void copy(String filename, PrintStream out) throws IOException {

-        BufferedReader br = new BufferedReader(new FileReader(filename));

-        String s;

-        while ((s = br.readLine()) != null) {

-            out.println(s);

-        }

-    }

-

-    private static void emit(int version, boolean ext, boolean pack,

-                             CodeEmitter emitter,

-                             BufferedReader specReader,

-                             PrintStream glStream,

-                             PrintStream glImplStream,

-                             PrintStream cStream) throws Exception {

-        String s = null;

-        int counter = 0;

-        while ((s = specReader.readLine()) != null) {

-            if (s.trim().startsWith("//")) {

-                continue;

-            }

-

-            CFunc cfunc = CFunc.parseCFunc(s);

-

-            String fname = cfunc.getName();

-            File f = new File("stubs/" + fname +

-                              ".java-1" + version + "-if");

-            if (f.exists()) {

-                System.out.println("Special-casing function " + fname);

-                copy("stubs/" + fname +

-                     ".java-1" + version + "-if", glStream);

-                copy("stubs/" + fname + ".java-impl", glImplStream);

-                copy("stubs/" + fname + ".cpp", cStream);

-

-                // Register native function names

-                // This should be improved to require fewer discrete files

-                String filename = "stubs/" + fname + ".nativeReg";

-                BufferedReader br =

-                    new BufferedReader(new FileReader(filename));

-                String nfunc;

-                while ((nfunc = br.readLine()) != null) {

-                    emitter.addNativeRegistration(nfunc);

-                }

-            } else {

-                emitter.setVersion(version, ext, pack);

-                emitter.emitCode(cfunc, s);

-            }

-        }

-    }

-

-    public static void main(String[] args) throws Exception {

-        String classPathName = "com/google/android/gles_jni/GLImpl";

-        boolean useContextPointer = true;

-

-        int aidx = 0;

-        while (args[aidx].charAt(0) == '-') {

-            switch (args[aidx].charAt(1)) {

-            case 'c':

-                useContextPointer = false;

-                break;

-

-            default:

-                System.err.println("Unknown flag: " + args[aidx]);

-                System.exit(1);

-            }

-

-            aidx++;

-        }

-

-        System.out.println("useContextPointer = " + useContextPointer);

-

-        BufferedReader spec10Reader =

-            new BufferedReader(new FileReader(args[aidx++]));

-        BufferedReader spec10ExtReader =

-            new BufferedReader(new FileReader(args[aidx++]));

-        BufferedReader spec11Reader =

-            new BufferedReader(new FileReader(args[aidx++]));

-        BufferedReader spec11ExtReader =

-            new BufferedReader(new FileReader(args[aidx++]));

-        BufferedReader spec11ExtPackReader =

-            new BufferedReader(new FileReader(args[aidx++]));

-        BufferedReader checksReader =

-            new BufferedReader(new FileReader(args[aidx++]));

-

-        String gl10Filename = "javax/microedition/khronos/opengles/GL10.java";

-        String gl10ExtFilename =

-            "javax/microedition/khronos/opengles/GL10Ext.java";

-        String gl11Filename = "javax/microedition/khronos/opengles/GL11.java";

-        String gl11ExtFilename =

-            "javax/microedition/khronos/opengles/GL11Ext.java";

-        String gl11ExtPackFilename =

-            "javax/microedition/khronos/opengles/GL11ExtensionPack.java";

-        String glImplFilename = "com/google/android/gles_jni/GLImpl.java";

-        String cFilename = "com_google_android_gles_jni_GLImpl.cpp";

-

-        PrintStream gl10Stream =

-            new PrintStream(new FileOutputStream("out/" + gl10Filename));

-        PrintStream gl10ExtStream =

-            new PrintStream(new FileOutputStream("out/" + gl10ExtFilename));

-        PrintStream gl11Stream =

-            new PrintStream(new FileOutputStream("out/" + gl11Filename));

-        PrintStream gl11ExtStream =

-            new PrintStream(new FileOutputStream("out/" + gl11ExtFilename));

-        PrintStream gl11ExtPackStream =

-            new PrintStream(new FileOutputStream("out/" + gl11ExtPackFilename));

-        PrintStream glImplStream =

-            new PrintStream(new FileOutputStream("out/" + glImplFilename));

-        PrintStream cStream =

-            new PrintStream(new FileOutputStream("out/" + cFilename));

-

-        ParameterChecker checker = new ParameterChecker(checksReader);

-

-        CodeEmitter emitter =

-            new JniCodeEmitter(classPathName,

-                               checker,

-                               gl10Stream, gl10ExtStream,

-                               gl11Stream, gl11ExtStream, gl11ExtPackStream,

-                               glImplStream, cStream,

-                               useContextPointer);

-

-        gl10Stream.println("/* //device/java/android/" + gl10Filename);

-        gl10ExtStream.println("/* //device/java/android/" + gl10ExtFilename);

-        gl11Stream.println("/* //device/java/android/" + gl11Filename);

-        gl11ExtStream.println("/* //device/java/android/" + gl11ExtFilename);

-        gl11ExtPackStream.println("/* //device/java/android/" +

-            gl11ExtPackFilename);

-        glImplStream.println("/* //device/java/android/" + glImplFilename);

-        cStream.println("/* //device/libs/android_runtime/" + cFilename);

-

-        copy("stubs/GL10Header.java-if", gl10Stream);

-        copy("stubs/GL10ExtHeader.java-if", gl10ExtStream);

-        copy("stubs/GL11Header.java-if", gl11Stream);

-        copy("stubs/GL11ExtHeader.java-if", gl11ExtStream);

-        copy("stubs/GL11ExtensionPackHeader.java-if", gl11ExtPackStream);

-        copy("stubs/GLImplHeader.java-impl", glImplStream);

-        copy("stubs/GLCHeader.cpp", cStream);

-

-        emit(0, false, false,

-             emitter, spec10Reader, gl10Stream, glImplStream, cStream);

-        emit(0, true, false,

-             emitter, spec10ExtReader, gl10ExtStream, glImplStream, cStream);

-        emit(1, false, false,

-             emitter, spec11Reader, gl11Stream, glImplStream, cStream);

-        emit(1, true, false,

-             emitter, spec11ExtReader, gl11ExtStream, glImplStream, cStream);

-        emit(1, true, true,

-             emitter, spec11ExtPackReader, gl11ExtPackStream, glImplStream,

-             cStream);

-

-        emitter.emitNativeRegistration();

-

-        gl10Stream.println("}");

-        gl10ExtStream.println("}");

-        gl11Stream.println("}");

-        gl11ExtStream.println("}");

-        gl11ExtPackStream.println("}");

-        glImplStream.println("}");

-    }

-}

+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintStream;
+
+public class GenerateGL {
+
+    static void copy(String filename, PrintStream out) throws IOException {
+        BufferedReader br = new BufferedReader(new FileReader(filename));
+        String s;
+        while ((s = br.readLine()) != null) {
+            out.println(s);
+        }
+    }
+
+    private static void emit(int version, boolean ext, boolean pack,
+                             CodeEmitter emitter,
+                             BufferedReader specReader,
+                             PrintStream glStream,
+                             PrintStream glImplStream,
+                             PrintStream cStream) throws Exception {
+        String s = null;
+        while ((s = specReader.readLine()) != null) {
+            if (s.trim().startsWith("//")) {
+                continue;
+            }
+
+            CFunc cfunc = CFunc.parseCFunc(s);
+
+            String fname = cfunc.getName();
+            File f = new File("stubs/jsr239/" + fname +
+                              ".java-1" + version + "-if");
+            if (f.exists()) {
+                System.out.println("Special-casing function " + fname);
+                copy("stubs/jsr239/" + fname +
+                     ".java-1" + version + "-if", glStream);
+                copy("stubs/jsr239/" + fname + ".java-impl", glImplStream);
+                copy("stubs/jsr239/" + fname + ".cpp", cStream);
+
+                // Register native function names
+                // This should be improved to require fewer discrete files
+                String filename = "stubs/jsr239/" + fname + ".nativeReg";
+                BufferedReader br =
+                    new BufferedReader(new FileReader(filename));
+                String nfunc;
+                while ((nfunc = br.readLine()) != null) {
+                    emitter.addNativeRegistration(nfunc);
+                }
+            } else {
+                emitter.setVersion(version, ext, pack);
+                emitter.emitCode(cfunc, s);
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        String classPathName = "com/google/android/gles_jni/GLImpl";
+        boolean useContextPointer = true;
+
+        int aidx = 0;
+        while (args[aidx].charAt(0) == '-') {
+            switch (args[aidx].charAt(1)) {
+            case 'c':
+                useContextPointer = false;
+                break;
+
+            default:
+                System.err.println("Unknown flag: " + args[aidx]);
+                System.exit(1);
+            }
+
+            aidx++;
+        }
+
+        System.out.println("useContextPointer = " + useContextPointer);
+
+        BufferedReader spec10Reader =
+            new BufferedReader(new FileReader(args[aidx++]));
+        BufferedReader spec10ExtReader =
+            new BufferedReader(new FileReader(args[aidx++]));
+        BufferedReader spec11Reader =
+            new BufferedReader(new FileReader(args[aidx++]));
+        BufferedReader spec11ExtReader =
+            new BufferedReader(new FileReader(args[aidx++]));
+        BufferedReader spec11ExtPackReader =
+            new BufferedReader(new FileReader(args[aidx++]));
+        BufferedReader checksReader =
+            new BufferedReader(new FileReader(args[aidx++]));
+
+        String gl10Filename = "javax/microedition/khronos/opengles/GL10.java";
+        String gl10ExtFilename =
+            "javax/microedition/khronos/opengles/GL10Ext.java";
+        String gl11Filename = "javax/microedition/khronos/opengles/GL11.java";
+        String gl11ExtFilename =
+            "javax/microedition/khronos/opengles/GL11Ext.java";
+        String gl11ExtPackFilename =
+            "javax/microedition/khronos/opengles/GL11ExtensionPack.java";
+        String glImplFilename = "com/google/android/gles_jni/GLImpl.java";
+        String cFilename = "com_google_android_gles_jni_GLImpl.cpp";
+
+        PrintStream gl10Stream =
+            new PrintStream(new FileOutputStream("out/" + gl10Filename));
+        PrintStream gl10ExtStream =
+            new PrintStream(new FileOutputStream("out/" + gl10ExtFilename));
+        PrintStream gl11Stream =
+            new PrintStream(new FileOutputStream("out/" + gl11Filename));
+        PrintStream gl11ExtStream =
+            new PrintStream(new FileOutputStream("out/" + gl11ExtFilename));
+        PrintStream gl11ExtPackStream =
+            new PrintStream(new FileOutputStream("out/" + gl11ExtPackFilename));
+        PrintStream glImplStream =
+            new PrintStream(new FileOutputStream("out/" + glImplFilename));
+        PrintStream cStream =
+            new PrintStream(new FileOutputStream("out/" + cFilename));
+
+        ParameterChecker checker = new ParameterChecker(checksReader);
+
+        CodeEmitter emitter =
+            new Jsr239CodeEmitter(classPathName,
+                               checker,
+                               gl10Stream, gl10ExtStream,
+                               gl11Stream, gl11ExtStream, gl11ExtPackStream,
+                               glImplStream, cStream,
+                               useContextPointer);
+
+        gl10Stream.println("/* //device/java/android/" + gl10Filename);
+        gl10ExtStream.println("/* //device/java/android/" + gl10ExtFilename);
+        gl11Stream.println("/* //device/java/android/" + gl11Filename);
+        gl11ExtStream.println("/* //device/java/android/" + gl11ExtFilename);
+        gl11ExtPackStream.println("/* //device/java/android/" +
+            gl11ExtPackFilename);
+        glImplStream.println("/* //device/java/android/" + glImplFilename);
+        cStream.println("/* //device/libs/android_runtime/" + cFilename);
+
+        copy("stubs/jsr239/GL10Header.java-if", gl10Stream);
+        copy("stubs/jsr239/GL10ExtHeader.java-if", gl10ExtStream);
+        copy("stubs/jsr239/GL11Header.java-if", gl11Stream);
+        copy("stubs/jsr239/GL11ExtHeader.java-if", gl11ExtStream);
+        copy("stubs/jsr239/GL11ExtensionPackHeader.java-if", gl11ExtPackStream);
+        copy("stubs/jsr239/GLImplHeader.java-impl", glImplStream);
+        copy("stubs/jsr239/GLCHeader.cpp", cStream);
+
+        emit(0, false, false,
+             emitter, spec10Reader, gl10Stream, glImplStream, cStream);
+        emit(0, true, false,
+             emitter, spec10ExtReader, gl10ExtStream, glImplStream, cStream);
+        emit(1, false, false,
+             emitter, spec11Reader, gl11Stream, glImplStream, cStream);
+        emit(1, true, false,
+             emitter, spec11ExtReader, gl11ExtStream, glImplStream, cStream);
+        emit(1, true, true,
+             emitter, spec11ExtPackReader, gl11ExtPackStream, glImplStream,
+             cStream);
+
+        emitter.emitNativeRegistration();
+
+        gl10Stream.println("}");
+        gl10ExtStream.println("}");
+        gl11Stream.println("}");
+        gl11ExtStream.println("}");
+        gl11ExtPackStream.println("}");
+        glImplStream.println("}");
+    }
+}
diff --git a/opengl/tools/glgen/src/GenerateGLES.java b/opengl/tools/glgen/src/GenerateGLES.java
new file mode 100644
index 0000000..60775b7
--- /dev/null
+++ b/opengl/tools/glgen/src/GenerateGLES.java
@@ -0,0 +1,99 @@
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintStream;
+
+public class GenerateGLES {
+
+    static void copy(String filename, PrintStream out) throws IOException {
+        BufferedReader br = new BufferedReader(new FileReader(filename));
+        String s;
+        while ((s = br.readLine()) != null) {
+            out.println(s);
+        }
+    }
+
+    private static void emit(GLESCodeEmitter emitter,
+                             BufferedReader specReader,
+                             PrintStream glStream,
+                             PrintStream cStream) throws Exception {
+        String s = null;
+        while ((s = specReader.readLine()) != null) {
+            if (s.trim().startsWith("//")) {
+                continue;
+            }
+
+            CFunc cfunc = CFunc.parseCFunc(s);
+
+            String fname = cfunc.getName();
+            String stubRoot = "stubs/gles11/" + fname;
+            String javaPath = stubRoot + ".java";
+            File f = new File(javaPath);
+            if (f.exists()) {
+                System.out.println("Special-casing function " + fname);
+                copy(javaPath, glStream);
+                copy(stubRoot + ".cpp", cStream);
+
+                // Register native function names
+                // This should be improved to require fewer discrete files
+                String filename = stubRoot + ".nativeReg";
+                BufferedReader br =
+                    new BufferedReader(new FileReader(filename));
+                String nfunc;
+                while ((nfunc = br.readLine()) != null) {
+                    emitter.addNativeRegistration(nfunc);
+                }
+            } else {
+                emitter.emitCode(cfunc, s);
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        int aidx = 0;
+        while ((aidx < args.length) && (args[aidx].charAt(0) == '-')) {
+            switch (args[aidx].charAt(1)) {
+            default:
+                System.err.println("Unknown flag: " + args[aidx]);
+                System.exit(1);
+            }
+
+            aidx++;
+        }
+
+        BufferedReader checksReader =
+            new BufferedReader(new FileReader("specs/gles11/checks.spec"));
+        ParameterChecker checker = new ParameterChecker(checksReader);
+
+        // Generate files
+        for(String suffix: new String[] {"GLES10", "GLES10Ext",
+                "GLES11", "GLES11Ext"})
+        {
+            BufferedReader spec11Reader =
+                new BufferedReader(new FileReader("specs/gles11/"
+                        + suffix + ".spec"));
+            String gl11Filename = "android/opengl/" + suffix + ".java";
+            String gl11cFilename = "android_opengl_" + suffix + ".cpp";
+            PrintStream gl11Stream =
+                new PrintStream(new FileOutputStream("out/" + gl11Filename));
+            PrintStream gl11cStream =
+                new PrintStream(new FileOutputStream("out/" + gl11cFilename));
+            gl11Stream.println("/*");
+            gl11cStream.println("/*");
+            copy("stubs/gles11/" + suffix + "Header.java-if", gl11Stream);
+            copy("stubs/gles11/" + suffix + "cHeader.cpp", gl11cStream);
+            GLESCodeEmitter emitter = new GLESCodeEmitter(
+                    "android/opengl/" + suffix,
+                    checker, gl11Stream, gl11cStream);
+            emit(emitter, spec11Reader, gl11Stream, gl11cStream);
+            emitter.emitNativeRegistration("register_android_opengl_jni_"
+                    + suffix);
+            gl11Stream.println("}");
+            gl11Stream.close();
+            gl11cStream.close();
+        }
+    }
+}
diff --git a/opengl/tools/glgen/src/JFunc.java b/opengl/tools/glgen/src/JFunc.java
index 42d466c..63c045b 100644
--- a/opengl/tools/glgen/src/JFunc.java
+++ b/opengl/tools/glgen/src/JFunc.java
@@ -1,148 +1,154 @@
-

-import java.util.ArrayList;

-import java.util.List;

-

-public class JFunc {

-

-    String className = "com.google.android.gles_jni.GL11Impl";

-

-    CFunc cfunc;

-    JType ftype;

-    String fname;

-

-    List<String> argNames = new ArrayList<String>();

-    List<JType> argTypes = new ArrayList<JType>();

-    List<Integer> argCIndices = new ArrayList<Integer>();

-

-    boolean hasBufferArg = false;

-    boolean hasTypedBufferArg = false;

-    ArrayList<String> bufferArgNames = new ArrayList<String>();

-

-    public JFunc(CFunc cfunc) {

-        this.cfunc = cfunc;

-    }

-

-    public CFunc getCFunc() {

-        return cfunc;

-    }

-

-    public void setName(String fname) {

-        this.fname = fname;

-    }

-

-    public String getName() {

-        return fname;

-    }

-

-    public void setType(JType ftype) {

-        this.ftype = ftype;

-    }

-

-    public JType getType() {

-        return ftype;

-    }

-

-    public void setClassName(String className) {

-        this.className = className;

-    }

-

-    public String getClassName() {

-        return className;

-    }

-    

-    public boolean hasBufferArg() {

-        return hasBufferArg;

-    }

-

-    public boolean hasTypedBufferArg() {

-        return hasTypedBufferArg;

-    }

-

-    public String getBufferArgName(int index) {

-        return bufferArgNames.get(index);

-    }

-

-    public void addArgument(String argName, JType argType, int cindex) {

-        argNames.add(argName);

-        argTypes.add(argType);

-        argCIndices.add(new Integer(cindex));

-

-        if (argType.isBuffer()) {

-            hasBufferArg = true;

-            bufferArgNames.add(argName);

-        }

-        if (argType.isTypedBuffer()) {

-            hasTypedBufferArg = true;

-            bufferArgNames.add(argName);

-        }

-    }

-

-    public int getNumArgs() {

-        return argNames.size();

-    }

-

-    public int getArgIndex(String name) {

-        int len = argNames.size();

-        for (int i = 0; i < len; i++) {

-            if (name.equals(argNames.get(i))) {

-                return i;

-            }

-        }

-        return -1;

-    }

-

-    public String getArgName(int index) {

-        return argNames.get(index);

-    }

-

-    public JType getArgType(int index) {

-        return argTypes.get(index);

-    }

-

-    public int getArgCIndex(int index) {

-        return argCIndices.get(index).intValue();

-    }

-

-    public static JFunc convert(CFunc cfunc, boolean useArray) {

-        JFunc jfunc = new JFunc(cfunc);

-        jfunc.setName(cfunc.getName());

-        jfunc.setType(JType.convert(cfunc.getType(), false));

-	

-        int numArgs = cfunc.getNumArgs();

-        int numOffsets = 0;

-        for (int i = 0; i < numArgs; i++) {

-            CType cArgType = cfunc.getArgType(i);

-            if (cArgType.isTypedPointer() && useArray) {

-                ++numOffsets;

-            }

-        }

-

-        for (int i = 0; i < numArgs; i++) {

-            String cArgName = cfunc.getArgName(i);

-            CType cArgType = cfunc.getArgType(i);

-

-            jfunc.addArgument(cArgName, JType.convert(cArgType, useArray), i);

-            if (cArgType.isTypedPointer() && useArray) {

-                if (numOffsets > 1) {

-                    jfunc.addArgument(cArgName + "Offset", new JType("int"), i);

-                } else {

-                    jfunc.addArgument("offset", new JType("int"), i);

-                }

-            }

-        }

-

-        return jfunc;

-    }

-

-    public String toString() {

-        String s =  "Function " + fname + " returns " + ftype + ": ";

-        for (int i = 0; i < argNames.size(); i++) {

-            if (i > 0) {

-                s += ", ";

-            }

-            s += argTypes.get(i) + " " + argNames.get(i);

-        }

-        return s;

-    }

-

-}

+
+import java.util.ArrayList;
+import java.util.List;
+
+public class JFunc {
+
+    String className = "com.google.android.gles_jni.GL11Impl";
+
+    CFunc cfunc;
+    JType ftype;
+    String fname;
+
+    List<String> argNames = new ArrayList<String>();
+    List<JType> argTypes = new ArrayList<JType>();
+    List<Integer> argCIndices = new ArrayList<Integer>();
+
+    boolean hasBufferArg = false;
+    boolean hasTypedBufferArg = false;
+    ArrayList<String> bufferArgNames = new ArrayList<String>();
+
+    public JFunc(CFunc cfunc) {
+        this.cfunc = cfunc;
+    }
+
+    public CFunc getCFunc() {
+        return cfunc;
+    }
+
+    public void setName(String fname) {
+        this.fname = fname;
+    }
+
+    public String getName() {
+        return fname;
+    }
+
+    public void setType(JType ftype) {
+        this.ftype = ftype;
+    }
+
+    public JType getType() {
+        return ftype;
+    }
+
+    public void setClassName(String className) {
+        this.className = className;
+    }
+
+    public String getClassName() {
+        return className;
+    }
+
+    public boolean hasBufferArg() {
+        return hasBufferArg;
+    }
+
+    public boolean hasTypedBufferArg() {
+        return hasTypedBufferArg;
+    }
+
+    public String getBufferArgName(int index) {
+        return bufferArgNames.get(index);
+    }
+
+    public void addArgument(String argName, JType argType, int cindex) {
+        argNames.add(argName);
+        argTypes.add(argType);
+        argCIndices.add(new Integer(cindex));
+
+        if (argType.isBuffer()) {
+            hasBufferArg = true;
+            bufferArgNames.add(argName);
+        }
+        if (argType.isTypedBuffer()) {
+            hasTypedBufferArg = true;
+            bufferArgNames.add(argName);
+        }
+    }
+
+    public int getNumArgs() {
+        return argNames.size();
+    }
+
+    public int getArgIndex(String name) {
+        int len = argNames.size();
+        for (int i = 0; i < len; i++) {
+            if (name.equals(argNames.get(i))) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
+    public String getArgName(int index) {
+        return argNames.get(index);
+    }
+
+    public JType getArgType(int index) {
+        return argTypes.get(index);
+    }
+
+    public int getArgCIndex(int index) {
+        return argCIndices.get(index).intValue();
+    }
+
+    public static JFunc convert(CFunc cfunc, boolean useArray) {
+        try {
+            JFunc jfunc = new JFunc(cfunc);
+            jfunc.setName(cfunc.getName());
+            jfunc.setType(JType.convert(cfunc.getType(), false));
+
+            int numArgs = cfunc.getNumArgs();
+            int numOffsets = 0;
+            for (int i = 0; i < numArgs; i++) {
+                CType cArgType = cfunc.getArgType(i);
+                if (cArgType.isTypedPointer() && useArray) {
+                    ++numOffsets;
+                }
+            }
+
+            for (int i = 0; i < numArgs; i++) {
+                String cArgName = cfunc.getArgName(i);
+                CType cArgType = cfunc.getArgType(i);
+
+                jfunc.addArgument(cArgName, JType.convert(cArgType, useArray), i);
+                if (cArgType.isTypedPointer() && useArray) {
+                    if (numOffsets > 1) {
+                        jfunc.addArgument(cArgName + "Offset", new JType("int"), i);
+                    } else {
+                        jfunc.addArgument("offset", new JType("int"), i);
+                    }
+                }
+            }
+
+            return jfunc;
+        } catch (RuntimeException e) {
+            System.err.println("Failed to convert function " + cfunc);
+            throw e;
+        }
+    }
+
+    @Override
+    public String toString() {
+        String s =  "Function " + fname + " returns " + ftype + ": ";
+        for (int i = 0; i < argNames.size(); i++) {
+            if (i > 0) {
+                s += ", ";
+            }
+            s += argTypes.get(i) + " " + argNames.get(i);
+        }
+        return s;
+    }
+
+}
diff --git a/opengl/tools/glgen/src/JType.java b/opengl/tools/glgen/src/JType.java
index a16d440..df1177b 100644
--- a/opengl/tools/glgen/src/JType.java
+++ b/opengl/tools/glgen/src/JType.java
@@ -1,139 +1,142 @@
-

-import java.util.HashMap;

-

-public class JType {

-    

-    String baseType;

-    boolean isArray;

-    boolean isClass;

-

-    static HashMap<CType,JType> typeMapping = new HashMap<CType,JType>();

-    static HashMap<CType,JType> arrayTypeMapping = new HashMap<CType,JType>();

-

-    static {

-	// Primitive types

-	typeMapping.put(new CType("GLbitfield"), new JType("int"));

-	typeMapping.put(new CType("GLboolean"), new JType("boolean"));

-	typeMapping.put(new CType("GLclampf"), new JType("float"));

-	typeMapping.put(new CType("GLclampx"), new JType("int"));

-	typeMapping.put(new CType("GLenum"), new JType("int"));

-	typeMapping.put(new CType("GLfloat"), new JType("float"));

-	typeMapping.put(new CType("GLfixed"), new JType("int"));

-	typeMapping.put(new CType("GLint"), new JType("int"));

-	typeMapping.put(new CType("GLintptr"), new JType("int"));

-	typeMapping.put(new CType("GLshort"), new JType("short"));

-	typeMapping.put(new CType("GLsizei"), new JType("int"));

-	typeMapping.put(new CType("GLsizeiptr"), new JType("int"));

-	typeMapping.put(new CType("GLubyte"), new JType("byte"));

-	typeMapping.put(new CType("GLuint"), new JType("int"));

-	typeMapping.put(new CType("void"), new JType("void"));

-	typeMapping.put(new CType("GLubyte", true, true), new JType("String"));

-

-	// Untyped pointers map to untyped Buffers

-	typeMapping.put(new CType("GLvoid", true, true),

-			new JType("java.nio.Buffer", true, false));

-	typeMapping.put(new CType("GLvoid", false, true),

-			new JType("java.nio.Buffer", true, false));

-	typeMapping.put(new CType("void", false, true),

-			new JType("java.nio.Buffer", true, false));

-

-	// Typed pointers map to typed Buffers

-	typeMapping.put(new CType("GLboolean", false, true),

-			new JType("java.nio.IntBuffer", true, false));

-	typeMapping.put(new CType("GLfixed", false, true),

-			new JType("java.nio.IntBuffer", true, false));

-	typeMapping.put(new CType("GLfixed", true, true),

-			new JType("java.nio.IntBuffer", true, false));

-	typeMapping.put(new CType("GLfloat", false, true),

-			new JType("java.nio.FloatBuffer", true, false));

-	typeMapping.put(new CType("GLfloat", true, true),

-			new JType("java.nio.FloatBuffer", true, false));

-	typeMapping.put(new CType("GLint", false, true),

-			new JType("java.nio.IntBuffer", true, false));

-	typeMapping.put(new CType("GLint", true, true),

-			new JType("java.nio.IntBuffer", true, false));

-	typeMapping.put(new CType("GLuint", false, true),

-			new JType("java.nio.IntBuffer", true, false));

-	typeMapping.put(new CType("GLuint", true, true),

-			new JType("java.nio.IntBuffer", true, false));

-	typeMapping.put(new CType("GLshort", true, true),

-			new JType("java.nio.ShortBuffer", true, false));

-

-	// Typed pointers map to arrays + offsets

-	arrayTypeMapping.put(new CType("GLboolean", false, true),

-			     new JType("boolean", false, true));

-	arrayTypeMapping.put(new CType("GLfixed", true, true), new JType("int", false, true));

-	arrayTypeMapping.put(new CType("GLfixed", false, true), new JType("int", false, true));

-	arrayTypeMapping.put(new CType("GLfloat", false, true), new JType("float", false, true));

-	arrayTypeMapping.put(new CType("GLfloat", true, true), new JType("float", false, true));

-	arrayTypeMapping.put(new CType("GLint", false, true), new JType("int", false, true));

-	arrayTypeMapping.put(new CType("GLint", true, true), new JType("int", false, true));

-	arrayTypeMapping.put(new CType("GLshort", true, true), new JType("short", false, true));

-	arrayTypeMapping.put(new CType("GLuint", false, true), new JType("int", false, true));

-	arrayTypeMapping.put(new CType("GLuint", true, true), new JType("int", false, true));

-	arrayTypeMapping.put(new CType("GLintptr"), new JType("int", false, true));

-	arrayTypeMapping.put(new CType("GLsizeiptr"), new JType("int", false, true));

-    }

-

-    public JType() {

-    }

-

-    public JType(String primitiveTypeName) {

-	this.baseType = primitiveTypeName;

-	this.isClass = false;

-	this.isArray = false;

-    }

-

-    public JType(String primitiveTypeName, boolean isClass, boolean isArray) {

-	this.baseType = primitiveTypeName;

-	this.isClass = isClass;

-	this.isArray = isArray;

-    }

-

-    public String getBaseType() {

-	return baseType;

-    }

-

-    public String toString() {

-	return baseType + (isArray ? "[]" : "");

-    }

-

-    public boolean isArray() {

-	return isArray;

-    }

-

-    public boolean isClass() {

-	return isClass;

-    }

-

-    public boolean isPrimitive() {

-	return !isClass() && !isArray();

-    }

-

-    public boolean isVoid() {

-	return baseType.equals("void");

-    }

-

-    public boolean isBuffer() {

-	return baseType.indexOf("Buffer") != -1;

-    }

-

-    public boolean isTypedBuffer() {

-	return !baseType.equals("java.nio.Buffer") &&

-	    (baseType.indexOf("Buffer") != -1);

-    }

-

-    public static JType convert(CType ctype, boolean useArray) {

- 	JType javaType = null;

- 	if (useArray) {

- 	    javaType = arrayTypeMapping.get(ctype);

- 	}

- 	if (javaType == null) {

- 	    javaType = typeMapping.get(ctype);

- 	}

- 	if (javaType == null) {

- 	    throw new RuntimeException("Unsupported C type: " + ctype);

- 	}

- 	return javaType;

-    }

-}

+
+import java.util.HashMap;
+
+public class JType {
+
+    String baseType;
+    boolean isArray;
+    boolean isClass;
+
+    static HashMap<CType,JType> typeMapping = new HashMap<CType,JType>();
+    static HashMap<CType,JType> arrayTypeMapping = new HashMap<CType,JType>();
+
+    static {
+    // Primitive types
+    typeMapping.put(new CType("GLbitfield"), new JType("int"));
+    typeMapping.put(new CType("GLboolean"), new JType("boolean"));
+    typeMapping.put(new CType("GLclampf"), new JType("float"));
+    typeMapping.put(new CType("GLclampx"), new JType("int"));
+    typeMapping.put(new CType("GLenum"), new JType("int"));
+    typeMapping.put(new CType("GLfloat"), new JType("float"));
+    typeMapping.put(new CType("GLfixed"), new JType("int"));
+    typeMapping.put(new CType("GLint"), new JType("int"));
+    typeMapping.put(new CType("GLintptr"), new JType("int"));
+    typeMapping.put(new CType("GLshort"), new JType("short"));
+    typeMapping.put(new CType("GLsizei"), new JType("int"));
+    typeMapping.put(new CType("GLsizeiptr"), new JType("int"));
+    typeMapping.put(new CType("GLubyte"), new JType("byte"));
+    typeMapping.put(new CType("GLuint"), new JType("int"));
+    typeMapping.put(new CType("void"), new JType("void"));
+    typeMapping.put(new CType("GLubyte", true, true), new JType("String"));
+
+    // Untyped pointers map to untyped Buffers
+    typeMapping.put(new CType("GLvoid", true, true),
+            new JType("java.nio.Buffer", true, false));
+    typeMapping.put(new CType("GLvoid", false, true),
+            new JType("java.nio.Buffer", true, false));
+    typeMapping.put(new CType("void", false, true),
+            new JType("java.nio.Buffer", true, false));
+    typeMapping.put(new CType("GLeglImageOES", false, false),
+            new JType("java.nio.Buffer", true, false));
+
+    // Typed pointers map to typed Buffers
+    typeMapping.put(new CType("GLboolean", false, true),
+            new JType("java.nio.IntBuffer", true, false));
+    typeMapping.put(new CType("GLfixed", false, true),
+            new JType("java.nio.IntBuffer", true, false));
+    typeMapping.put(new CType("GLfixed", true, true),
+            new JType("java.nio.IntBuffer", true, false));
+    typeMapping.put(new CType("GLfloat", false, true),
+            new JType("java.nio.FloatBuffer", true, false));
+    typeMapping.put(new CType("GLfloat", true, true),
+            new JType("java.nio.FloatBuffer", true, false));
+    typeMapping.put(new CType("GLint", false, true),
+            new JType("java.nio.IntBuffer", true, false));
+    typeMapping.put(new CType("GLint", true, true),
+            new JType("java.nio.IntBuffer", true, false));
+    typeMapping.put(new CType("GLuint", false, true),
+            new JType("java.nio.IntBuffer", true, false));
+    typeMapping.put(new CType("GLuint", true, true),
+            new JType("java.nio.IntBuffer", true, false));
+    typeMapping.put(new CType("GLshort", true, true),
+            new JType("java.nio.ShortBuffer", true, false));
+
+    // Typed pointers map to arrays + offsets
+    arrayTypeMapping.put(new CType("GLboolean", false, true),
+                 new JType("boolean", false, true));
+    arrayTypeMapping.put(new CType("GLfixed", true, true), new JType("int", false, true));
+    arrayTypeMapping.put(new CType("GLfixed", false, true), new JType("int", false, true));
+    arrayTypeMapping.put(new CType("GLfloat", false, true), new JType("float", false, true));
+    arrayTypeMapping.put(new CType("GLfloat", true, true), new JType("float", false, true));
+    arrayTypeMapping.put(new CType("GLint", false, true), new JType("int", false, true));
+    arrayTypeMapping.put(new CType("GLint", true, true), new JType("int", false, true));
+    arrayTypeMapping.put(new CType("GLshort", true, true), new JType("short", false, true));
+    arrayTypeMapping.put(new CType("GLuint", false, true), new JType("int", false, true));
+    arrayTypeMapping.put(new CType("GLuint", true, true), new JType("int", false, true));
+    arrayTypeMapping.put(new CType("GLintptr"), new JType("int", false, true));
+    arrayTypeMapping.put(new CType("GLsizeiptr"), new JType("int", false, true));
+    }
+
+    public JType() {
+    }
+
+    public JType(String primitiveTypeName) {
+    this.baseType = primitiveTypeName;
+    this.isClass = false;
+    this.isArray = false;
+    }
+
+    public JType(String primitiveTypeName, boolean isClass, boolean isArray) {
+    this.baseType = primitiveTypeName;
+    this.isClass = isClass;
+    this.isArray = isArray;
+    }
+
+    public String getBaseType() {
+    return baseType;
+    }
+
+    @Override
+    public String toString() {
+    return baseType + (isArray ? "[]" : "");
+    }
+
+    public boolean isArray() {
+    return isArray;
+    }
+
+    public boolean isClass() {
+    return isClass;
+    }
+
+    public boolean isPrimitive() {
+    return !isClass() && !isArray();
+    }
+
+    public boolean isVoid() {
+    return baseType.equals("void");
+    }
+
+    public boolean isBuffer() {
+    return baseType.indexOf("Buffer") != -1;
+    }
+
+    public boolean isTypedBuffer() {
+    return !baseType.equals("java.nio.Buffer") &&
+        (baseType.indexOf("Buffer") != -1);
+    }
+
+    public static JType convert(CType ctype, boolean useArray) {
+     JType javaType = null;
+     if (useArray) {
+         javaType = arrayTypeMapping.get(ctype);
+     }
+     if (javaType == null) {
+         javaType = typeMapping.get(ctype);
+     }
+     if (javaType == null) {
+         throw new RuntimeException("Unsupported C type: " + ctype);
+     }
+     return javaType;
+    }
+}
diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java
index 33b9a3e..b0997b1 100644
--- a/opengl/tools/glgen/src/JniCodeEmitter.java
+++ b/opengl/tools/glgen/src/JniCodeEmitter.java
@@ -1,99 +1,55 @@
 import java.io.PrintStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 
-/**
- * Emits a Java interface and Java & C implementation for a C function.
- *
- * <p> The Java interface will have Buffer and array variants for functions that
- * have a typed pointer argument.  The array variant will convert a single "<type> *data"
- * argument to a pair of arguments "<type>[] data, int offset".
- */
-public class JniCodeEmitter implements CodeEmitter {
+public class JniCodeEmitter {
 
-    // If true, use C++ style for calling through a JNIEnv *:
-    // env->Func(...)
-    // If false, use C style:
-    // (*env)->Func(env, ...)
     static final boolean mUseCPlusPlus = true;
-
-    boolean mUseContextPointer = true;
-
-    String mClassPathName;
-    
-    ParameterChecker mChecker;
-    PrintStream mJava10InterfaceStream;
-    PrintStream mJava10ExtInterfaceStream;
-    PrintStream mJava11InterfaceStream;
-    PrintStream mJava11ExtInterfaceStream;
-    PrintStream mJava11ExtPackInterfaceStream;
-    PrintStream mJavaImplStream;
-    PrintStream mCStream;
-
-    PrintStream mJavaInterfaceStream;
-
-    List<String> nativeRegistrations = new ArrayList<String>();
-
+    protected boolean mUseContextPointer = true;
+    protected boolean mUseStaticMethods = false;
+    protected String mClassPathName;
+    protected ParameterChecker mChecker;
+    protected List<String> nativeRegistrations = new ArrayList<String>();
     boolean needsExit;
-
-    static String indent = "    ";
-
+    protected static String indent = "    ";
     HashSet<String> mFunctionsEmitted = new HashSet<String>();
 
-    /**
-     * @param java10InterfaceStream the PrintStream to which to emit the Java interface for GL 1.0 functions
-     * @param java10ExtInterfaceStream the PrintStream to which to emit the Java interface for GL 1.0 extension functions
-     * @param java11InterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 functions 
-     * @param java11ExtInterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 Extension functions
-     * @param java11ExtPackInterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 Extension Pack functions
-     * @param javaImplStream the PrintStream to which to emit the Java implementation
-     * @param cStream the PrintStream to which to emit the C implementation
-     */
-    public JniCodeEmitter(String classPathName,
-                          ParameterChecker checker,
-                          PrintStream java10InterfaceStream,
-                          PrintStream java10ExtInterfaceStream,
-                          PrintStream java11InterfaceStream,
-                          PrintStream java11ExtInterfaceStream,
-                          PrintStream java11ExtPackInterfaceStream,
-                          PrintStream javaImplStream,
-                          PrintStream cStream,
-                          boolean useContextPointer) {
-        mClassPathName = classPathName;
-        mChecker = checker;
-        mJava10InterfaceStream = java10InterfaceStream;
-        mJava10ExtInterfaceStream = java10ExtInterfaceStream;
-        mJava11InterfaceStream = java11InterfaceStream;
-        mJava11ExtInterfaceStream = java11ExtInterfaceStream;
-        mJava11ExtPackInterfaceStream = java11ExtPackInterfaceStream;
-        mJavaImplStream = javaImplStream;
-        mCStream = cStream;
-        mUseContextPointer = useContextPointer;
-    }
-
-    public void setVersion(int version, boolean ext, boolean pack) {
-        if (version == 0) {
-            mJavaInterfaceStream = ext ? mJava10ExtInterfaceStream :
-                mJava10InterfaceStream;
-        } else if (version == 1) {
-            mJavaInterfaceStream = ext ?
-                (pack ? mJava11ExtPackInterfaceStream :
-                 mJava11ExtInterfaceStream) :
-                mJava11InterfaceStream;
-        } else {
-            throw new RuntimeException("Bad version: " + version);
+    public static String getJniName(JType jType) {
+        String jniName = "";
+        if (jType.isClass()) {
+            return "L" + jType.getBaseType() + ";";
+        } else if (jType.isArray()) {
+            jniName = "[";
         }
+
+        String baseType = jType.getBaseType();
+        if (baseType.equals("int")) {
+            jniName += "I";
+        } else if (baseType.equals("float")) {
+            jniName += "F";
+        } else if (baseType.equals("boolean")) {
+            jniName += "Z";
+        } else if (baseType.equals("short")) {
+            jniName += "S";
+        } else if (baseType.equals("long")) {
+            jniName += "L";
+        } else if (baseType.equals("byte")) {
+            jniName += "B";
+        }
+        return jniName;
     }
 
-    public void emitCode(CFunc cfunc, String original) {
+
+    public void emitCode(CFunc cfunc, String original,
+            PrintStream javaInterfaceStream,
+            PrintStream javaImplStream,
+            PrintStream cStream) {
         JFunc jfunc;
         String signature;
         boolean duplicate;
-        
+
         if (cfunc.hasTypedPointerArg()) {
             jfunc = JFunc.convert(cfunc, true);
 
@@ -109,12 +65,14 @@
             }
 
             if (!duplicate) {
-                emitNativeDeclaration(jfunc, mJavaImplStream);
-                emitJavaCode(jfunc, mJavaImplStream);
+                emitNativeDeclaration(jfunc, javaImplStream);
+                emitJavaCode(jfunc, javaImplStream);
             }
-            emitJavaInterfaceCode(jfunc, mJavaInterfaceStream);
+            if (javaInterfaceStream != null) {
+                emitJavaInterfaceCode(jfunc, javaInterfaceStream);
+            }
             if (!duplicate) {
-                emitJniCode(jfunc, mCStream);
+                emitJniCode(jfunc, cStream);
             }
         }
 
@@ -129,12 +87,14 @@
         }
 
         if (!duplicate) {
-            emitNativeDeclaration(jfunc, mJavaImplStream);
+            emitNativeDeclaration(jfunc, javaImplStream);
         }
-        emitJavaInterfaceCode(jfunc, mJavaInterfaceStream);
+        if (javaInterfaceStream != null) {
+            emitJavaInterfaceCode(jfunc, javaInterfaceStream);
+        }
         if (!duplicate) {
-            emitJavaCode(jfunc, mJavaImplStream);
-            emitJniCode(jfunc, mCStream);
+            emitJavaCode(jfunc, javaImplStream);
+            emitJniCode(jfunc, cStream);
         }
     }
 
@@ -152,8 +112,8 @@
     public void emitJavaCode(JFunc jfunc, PrintStream out) {
         emitFunction(jfunc, out, false, false);
     }
-    
-    void emitFunctionCall(JFunc jfunc, PrintStream out, String iii, boolean grabArray ) {
+
+    void emitFunctionCall(JFunc jfunc, PrintStream out, String iii, boolean grabArray) {
         boolean isVoid = jfunc.getType().isVoid();
         boolean isPointerFunc = jfunc.getName().endsWith("Pointer") &&
             jfunc.getCFunc().hasPointerArg();
@@ -167,7 +127,7 @@
                     jfunc.getName() +
                     (isPointerFunc ? "Bounds" : "" ) +
                     "(");
-	
+
         int numArgs = jfunc.getNumArgs();
         for (int i = 0; i < numArgs; i++) {
             String argName = jfunc.getArgName(i);
@@ -177,7 +137,7 @@
                 String typeName = argType.getBaseType();
                 typeName = typeName.substring(9, typeName.length() - 6);
                 out.println(iii + indent + "get" + typeName + "Array(" + argName + "),");
-                out.print(iii + indent + "getOffset(" + argName + ")"); 
+                out.print(iii + indent + "getOffset(" + argName + ")");
             } else {
                 out.print(iii + indent + argName);
             }
@@ -192,41 +152,40 @@
                 out.println(",");
             }
         }
-	
+
         out.println(iii + ");");
     }
 
-    void printIfcheckPostamble(PrintStream out, boolean isBuffer,
-                               boolean emitExceptionCheck, String iii) {
-        printIfcheckPostamble(out, isBuffer, emitExceptionCheck,
-                              "offset", "_remaining", iii);
-    }
+    void printIfcheckPostamble(PrintStream out, boolean isBuffer, boolean emitExceptionCheck,
+            String iii) {
+                printIfcheckPostamble(out, isBuffer, emitExceptionCheck,
+                                      "offset", "_remaining", iii);
+            }
 
-    void printIfcheckPostamble(PrintStream out, boolean isBuffer,
-                               boolean emitExceptionCheck,
-                               String offset, String remaining, String iii) {
-        out.println(iii + "    default:");
-        out.println(iii + "        _needed = 0;");
-        out.println(iii + "        break;");
-        out.println(iii + "}");
+    void printIfcheckPostamble(PrintStream out, boolean isBuffer, boolean emitExceptionCheck,
+            String offset, String remaining, String iii) {
+                out.println(iii + "    default:");
+                out.println(iii + "        _needed = 0;");
+                out.println(iii + "        break;");
+                out.println(iii + "}");
 
-        out.println(iii + "if (" + remaining + " < _needed) {");
-        if (emitExceptionCheck) {
-            out.println(iii + indent + "_exception = 1;");
-        }
-        out.println(iii + indent +
-                    (mUseCPlusPlus ? "_env" : "(*_env)") +
-                    "->ThrowNew(" +
-                    (mUseCPlusPlus ? "" : "_env, ") +
-                    "IAEClass, " +
-                    "\"" +
-                    (isBuffer ? 
-                     "remaining()" : "length - " + offset) +
-                    " < needed\");");
-        out.println(iii + indent + "goto exit;");
-        needsExit = true;
-        out.println(iii + "}");
-    }
+                out.println(iii + "if (" + remaining + " < _needed) {");
+                if (emitExceptionCheck) {
+                    out.println(iii + indent + "_exception = 1;");
+                }
+                out.println(iii + indent +
+                            (mUseCPlusPlus ? "_env" : "(*_env)") +
+                            "->ThrowNew(" +
+                            (mUseCPlusPlus ? "" : "_env, ") +
+                            "IAEClass, " +
+                            "\"" +
+                            (isBuffer ?
+                             "remaining()" : "length - " + offset) +
+                            " < needed\");");
+                out.println(iii + indent + "goto exit;");
+                needsExit = true;
+                out.println(iii + "}");
+            }
 
     boolean isNullAllowed(CFunc cfunc) {
         String[] checks = mChecker.getChecks(cfunc.getName());
@@ -312,115 +271,106 @@
     }
 
     void emitNativeBoundsChecks(CFunc cfunc, String cname, PrintStream out,
-                                boolean isBuffer, boolean emitExceptionCheck,
-                                String offset, String remaining, String iii) {
-        CType returnType = cfunc.getType();
-        boolean isVoid = returnType.isVoid();
+            boolean isBuffer, boolean emitExceptionCheck, String offset, String remaining, String iii) {
 
-        String[] checks = mChecker.getChecks(cfunc.getName());
-        String checkVar;
-        String retval = getErrorReturnValue(cfunc);
+                String[] checks = mChecker.getChecks(cfunc.getName());
 
-        boolean lastWasIfcheck = false;
+                boolean lastWasIfcheck = false;
 
-        int index = 1;
-        if (checks != null) {
-            boolean remainingDeclared = false;
-            boolean nullCheckDeclared = false;
-            boolean offsetChecked = false;
-            while (index < checks.length) {
-                if (checks[index].startsWith("check")) {
-                    if (lastWasIfcheck) {
-                        printIfcheckPostamble(out, isBuffer, emitExceptionCheck,
-                                              offset, remaining, iii);
+                int index = 1;
+                if (checks != null) {
+                    while (index < checks.length) {
+                        if (checks[index].startsWith("check")) {
+                            if (lastWasIfcheck) {
+                                printIfcheckPostamble(out, isBuffer, emitExceptionCheck,
+                                                      offset, remaining, iii);
+                            }
+                            lastWasIfcheck = false;
+                            if (cname != null && !cname.equals(checks[index + 1])) {
+                                index += 3;
+                                continue;
+                            }
+                            out.println(iii + "if (" + remaining + " < " +
+                                        checks[index + 2] +
+                                        ") {");
+                            if (emitExceptionCheck) {
+                                out.println(iii + indent + "_exception = 1;");
+                            }
+                    String exceptionClassName = "IAEClass";
+                    // If the "check" keyword was of the form
+                    // "check_<class name>", use the class name in the
+                    // exception to be thrown
+                    int underscore = checks[index].indexOf('_');
+                    if (underscore >= 0) {
+                    exceptionClassName = checks[index].substring(underscore + 1) + "Class";
                     }
-                    lastWasIfcheck = false;
-                    if (cname != null && !cname.equals(checks[index + 1])) {
-                        index += 3;
-                        continue;
-                    }
-                    out.println(iii + "if (" + remaining + " < " +
-                                checks[index + 2] +
-                                ") {");
-                    if (emitExceptionCheck) {
-                        out.println(iii + indent + "_exception = 1;");
-                    }
-		    String exceptionClassName = "IAEClass";
-		    // If the "check" keyword was of the form
-		    // "check_<class name>", use the class name in the
-		    // exception to be thrown
-		    int underscore = checks[index].indexOf('_');
-		    if (underscore >= 0) {
-			exceptionClassName = checks[index].substring(underscore + 1) + "Class";
-		    }
-                    out.println(iii + indent +
-                                (mUseCPlusPlus ? "_env" : "(*_env)") +
-                                "->ThrowNew(" +
-                                (mUseCPlusPlus ? "" : "_env, ") +
-				exceptionClassName + ", " +
-                                "\"" +
-                                (isBuffer ? 
-                                 "remaining()" : "length - " + offset) +
-                                " < " + checks[index + 2] +
-                                "\");");
+                            out.println(iii + indent +
+                                        (mUseCPlusPlus ? "_env" : "(*_env)") +
+                                        "->ThrowNew(" +
+                                        (mUseCPlusPlus ? "" : "_env, ") +
+                        exceptionClassName + ", " +
+                                        "\"" +
+                                        (isBuffer ?
+                                         "remaining()" : "length - " + offset) +
+                                        " < " + checks[index + 2] +
+                                        "\");");
 
-                    out.println(iii + indent + "goto exit;");
-                    needsExit = true;
-                    out.println(iii + "}");
-                
-                    index += 3;
-                } else if (checks[index].equals("ifcheck")) {
-                    String[] matches = checks[index + 4].split(",");
+                            out.println(iii + indent + "goto exit;");
+                            needsExit = true;
+                            out.println(iii + "}");
 
-                    if (!lastWasIfcheck) {
-                        out.println(iii + "int _needed;");
-                        out.println(iii +
-                                    "switch (" +
-                                    checks[index + 3] +
-                                    ") {");
+                            index += 3;
+                        } else if (checks[index].equals("ifcheck")) {
+                            String[] matches = checks[index + 4].split(",");
+
+                            if (!lastWasIfcheck) {
+                                out.println(iii + "int _needed;");
+                                out.println(iii +
+                                            "switch (" +
+                                            checks[index + 3] +
+                                            ") {");
+                            }
+
+                            for (int i = 0; i < matches.length; i++) {
+                                out.println("#if defined(" + matches[i] + ")");
+                                out.println(iii +
+                                            "    case " +
+                                            matches[i] +
+                                            ":");
+                                out.println("#endif // defined(" + matches[i] + ")");
+                            }
+                            out.println(iii +
+                                        "        _needed = " +
+                                        checks[index + 2] +
+                                        ";");
+                            out.println(iii +
+                                        "        break;");
+
+                            lastWasIfcheck = true;
+                            index += 5;
+                        } else if (checks[index].equals("return")) {
+                            // ignore
+                            index += 2;
+                        } else if (checks[index].equals("unsupported")) {
+                            // ignore
+                            index += 1;
+                        } else if (checks[index].equals("nullAllowed")) {
+                            // ignore
+                            index += 1;
+                        } else {
+                            System.out.println("Error: unknown keyword \"" +
+                                               checks[index] + "\"");
+                            System.exit(0);
+                        }
                     }
-                    
-                    for (int i = 0; i < matches.length; i++) {
-                        out.println("#if defined(" + matches[i] + ")");
-                        out.println(iii +
-                                    "    case " +
-                                    matches[i] +
-                                    ":");
-                        out.println("#endif // defined(" + matches[i] + ")");
-                    }
-                    out.println(iii +
-                                "        _needed = " +
-                                checks[index + 2] +
-                                ";");
-                    out.println(iii +
-                                "        break;");
-                
-                    lastWasIfcheck = true;
-                    index += 5;
-                } else if (checks[index].equals("return")) {
-                    // ignore
-                    index += 2;
-                } else if (checks[index].equals("unsupported")) {
-                    // ignore
-                    index += 1;
-                } else if (checks[index].equals("nullAllowed")) {
-                    // ignore
-                    index += 1;
-                } else {
-                    System.out.println("Error: unknown keyword \"" +
-                                       checks[index] + "\"");
-                    System.exit(0);
+                }
+
+                if (lastWasIfcheck) {
+                    printIfcheckPostamble(out, isBuffer, emitExceptionCheck, iii);
                 }
             }
-        }
 
-        if (lastWasIfcheck) {
-            printIfcheckPostamble(out, isBuffer, emitExceptionCheck, iii);
-        }
-    }
-
-    boolean hasNonConstArg(JFunc jfunc, CFunc cfunc,
-        List<Integer> nonPrimitiveArgs) {
+    boolean hasNonConstArg(JFunc jfunc, CFunc cfunc, List<Integer> nonPrimitiveArgs) {
         if (nonPrimitiveArgs.size() > 0) {
             for (int i = nonPrimitiveArgs.size() - 1; i >= 0; i--) {
                 int idx = nonPrimitiveArgs.get(i).intValue();
@@ -439,7 +389,7 @@
 
         return false;
     }
-    
+
     /**
      * Emit a function in several variants:
      *
@@ -449,9 +399,7 @@
      *   if interfaceDecl:  public <returntype> func(args);
      *   if !interfaceDecl: public <returntype> func(args) { body }
      */
-    void emitFunction(JFunc jfunc,
-                      PrintStream out,
-                      boolean nativeDecl, boolean interfaceDecl) {
+    void emitFunction(JFunc jfunc, PrintStream out, boolean nativeDecl, boolean interfaceDecl) {
         boolean isPointerFunc =
             jfunc.getName().endsWith("Pointer") &&
             jfunc.getCFunc().hasPointerArg();
@@ -462,28 +410,30 @@
             return;
         }
 
+        String maybeStatic = mUseStaticMethods ? "static " : "";
+
         if (isPointerFunc) {
             out.println(indent +
-                        (nativeDecl ? "private native " :
-                         (interfaceDecl ? "" : "public ")) +
+                        (nativeDecl ? "private " + maybeStatic +"native " :
+                         (interfaceDecl ? "" : "public ") + maybeStatic) +
                         jfunc.getType() + " " +
                         jfunc.getName() +
                         (nativeDecl ? "Bounds" : "") +
                         "(");
         } else {
             out.println(indent +
-                        (nativeDecl ? "public native " :
-                         (interfaceDecl ? "" : "public ")) +
+                        (nativeDecl ? "public " + maybeStatic +"native " :
+                         (interfaceDecl ? "" : "public ") + maybeStatic) +
                         jfunc.getType() + " " +
                         jfunc.getName() +
                         "(");
         }
-	
+
         int numArgs = jfunc.getNumArgs();
         for (int i = 0; i < numArgs; i++) {
             String argName = jfunc.getArgName(i);
             JType argType = jfunc.getArgType(i);
-	    
+
             out.print(indent + indent + argType + " " + argName);
             if (i == numArgs - 1) {
                 if (isPointerFunc && nativeDecl) {
@@ -504,6 +454,15 @@
 
             String iii = indent + indent;
 
+            // emitBoundsChecks(jfunc, out, iii);
+            emitFunctionCall(jfunc, out, iii, false);
+
+            // Set the pointer after we call the native code, so that if
+            // the native code throws an exception we don't modify the
+            // pointer. We assume that the native code is written so that
+            // if an exception is thrown, then the underlying glXXXPointer
+            // function will not have been called.
+
             String fname = jfunc.getName();
             if (isPointerFunc) {
                 // TODO - deal with VBO variants
@@ -548,9 +507,6 @@
                 }
             }
 
-            // emitBoundsChecks(jfunc, out, iii);
-            emitFunctionCall(jfunc, out, iii, false);
-
             boolean isVoid = jfunc.getType().isVoid();
 
             if (!isVoid) {
@@ -561,29 +517,44 @@
         out.println();
     }
 
-    public static String getJniName(JType jType) {
-        String jniName = "";
-        if (jType.isClass()) {
-            return "L" + jType.getBaseType() + ";";
-        } else if (jType.isArray()) {
-            jniName = "[";
+    public void addNativeRegistration(String s) {
+        nativeRegistrations.add(s);
+    }
+
+    public void emitNativeRegistration(String registrationFunctionName,
+            PrintStream cStream) {
+        cStream.println("static const char *classPathName = \"" +
+                        mClassPathName +
+                        "\";");
+        cStream.println();
+
+        cStream.println("static JNINativeMethod methods[] = {");
+
+        cStream.println("{\"_nativeClassInit\", \"()V\", (void*)nativeClassInit },");
+
+        Iterator<String> i = nativeRegistrations.iterator();
+        while (i.hasNext()) {
+            cStream.println(i.next());
         }
-	
-        String baseType = jType.getBaseType();
-        if (baseType.equals("int")) {
-            jniName += "I";
-        } else if (baseType.equals("float")) {
-            jniName += "F";
-        } else if (baseType.equals("boolean")) {
-            jniName += "Z";
-        } else if (baseType.equals("short")) {
-            jniName += "S";
-        } else if (baseType.equals("long")) {
-            jniName += "L";
-        } else if (baseType.equals("byte")) {
-            jniName += "B";
-        }
-        return jniName;
+
+        cStream.println("};");
+        cStream.println();
+
+
+        cStream.println("int " + registrationFunctionName + "(JNIEnv *_env)");
+        cStream.println("{");
+        cStream.println(indent +
+                        "int err;");
+
+        cStream.println(indent +
+                        "err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));");
+
+        cStream.println(indent + "return err;");
+        cStream.println("}");
+    }
+
+    public JniCodeEmitter() {
+        super();
     }
 
     String getJniType(JType jType) {
@@ -604,7 +575,7 @@
             return "jobject";
         }
     }
-    
+
     String getJniMangledName(String name) {
         name = name.replaceAll("_", "_1");
         name = name.replaceAll(";", "_2");
@@ -614,7 +585,7 @@
 
     public void emitJniCode(JFunc jfunc, PrintStream out) {
         CFunc cfunc = jfunc.getCFunc();
-	
+
         // Emit comment identifying original C function
         //
         // Example:
@@ -658,13 +629,13 @@
         }
 
         // Append signature to function name
-        String sig = getJniMangledName(signature).replace('.', '_');        
+        String sig = getJniMangledName(signature).replace('.', '_');
         out.print("__" + sig);
         outName += "__" + sig;
-	
+
         signature = signature.replace('.', '/');
         rsignature = rsignature.replace('.', '/');
-	
+
         out.println();
         if (rsignature.length() == 0) {
             rsignature = "V";
@@ -718,13 +689,11 @@
             out.print(", jint remaining");
         }
         out.println(") {");
-	
+
         int numArrays = 0;
         int numBuffers = 0;
         for (int i = 0; i < nonPrimitiveArgs.size(); i++) {
             int idx = nonPrimitiveArgs.get(i).intValue();
-            int cIndex = jfunc.getArgCIndex(idx);
-            String cname = cfunc.getArgName(cIndex);
             if (jfunc.getArgType(idx).isArray()) {
                 ++numArrays;
             }
@@ -740,7 +709,7 @@
         // Example:
         //
         // android::gl::ogles_context_t *ctx;
-        // 
+        //
         // jint _exception;
         // GLenum _returnValue;
         //
@@ -827,15 +796,13 @@
                 out.println(indent +
                             decl +
                             (decl.endsWith("*") ? "" : " ") +
-                            jfunc.getArgName(idx) + 
+                            jfunc.getArgName(idx) +
                             " = (" + decl + ") 0;");
             }
 
             out.println();
         }
 
-        String retval = isVoid ? "" : " _returnValue";
-
         // Emit 'GetPrimitiveArrayCritical' for arrays
         // Emit 'GetPointer' calls for Buffer pointers
         int bufArgIdx = 0;
@@ -843,7 +810,7 @@
             for (int i = 0; i < nonPrimitiveArgs.size(); i++) {
                 int idx = nonPrimitiveArgs.get(i).intValue();
                 int cIndex = jfunc.getArgCIndex(idx);
-		
+
                 String cname = cfunc.getArgName(cIndex);
                 offset = numArrays <= 1 ? "offset" :
                     cname + "Offset";
@@ -852,7 +819,7 @@
 
                 if (jfunc.getArgType(idx).isArray()) {
                     out.println(indent +
-                                "if (!" + 
+                                "if (!" +
                                 cname +
                                 "_ref) {");
                     if (emitExceptionCheck) {
@@ -884,7 +851,7 @@
                     out.println(indent + "}");
 
                     out.println(indent + remaining + " = " +
-                                    (mUseCPlusPlus ? "_env" : "(*_env)") + 
+                                    (mUseCPlusPlus ? "_env" : "(*_env)") +
                                     "->GetArrayLength(" +
                                     (mUseCPlusPlus ? "" : "_env, ") +
                                     cname + "_ref) - " + offset + ";");
@@ -901,7 +868,7 @@
                     out.println(indent + "    " +
                                 (mUseCPlusPlus ? "_env" : "(*_env)") +
                                 "->GetPrimitiveArrayCritical(" +
-                                (mUseCPlusPlus ? "" : "_env, ") + 
+                                (mUseCPlusPlus ? "" : "_env, ") +
                                 jfunc.getArgName(idx) +
                                 "_ref, (jboolean *)0);");
                     out.println(indent +
@@ -912,19 +879,39 @@
                     String array = numBufferArgs <= 1 ? "_array" :
                         "_" + bufferArgNames.get(bufArgIdx++) + "Array";
 
-                    boolean nullAllowed = isNullAllowed(cfunc);
+                    boolean nullAllowed = isNullAllowed(cfunc) || isPointerFunc;
                     if (nullAllowed) {
                         out.println(indent + "if (" + cname + "_buf) {");
                         out.print(indent);
                     }
-                    
-                    out.println(indent +
+
+                    if (isPointerFunc) {
+                        out.println(indent +
                                 cname +
                                 " = (" +
                                 cfunc.getArgType(cIndex).getDeclaration() +
-                                ")getPointer(_env, " +
-                                cname +
-                                "_buf, &" + array + ", &" + remaining + ");");
+                                ") _env->GetDirectBufferAddress(" +
+                                (mUseCPlusPlus ? "" : "_env, ") +
+                                cname + "_buf);");
+                        String iii = "    ";
+                        out.println(iii + indent + "if ( ! " + cname + " ) {");
+                        out.println(iii + iii + indent +
+                                (mUseCPlusPlus ? "_env" : "(*_env)") +
+                                "->ThrowNew(" +
+                                (mUseCPlusPlus ? "" : "_env, ") +
+                                "IAEClass, \"Must use a native order direct Buffer\");");
+                        out.println(iii + iii + indent + "return;");
+                        out.println(iii + indent + "}");
+                    } else {
+                        out.println(indent +
+                                    cname +
+                                    " = (" +
+                                    cfunc.getArgType(cIndex).getDeclaration() +
+                                    ")getPointer(_env, " +
+                                    cname +
+                                    "_buf, &" + array + ", &" + remaining +
+                                    ");");
+                    }
 
                     if (nullAllowed) {
                         out.println(indent + "}");
@@ -950,10 +937,10 @@
                 name.substring(1, name.length());
             out.print("ctx->procs.");
         }
-        
+
         out.print(name + (isPointerFunc ? "Bounds" : "") + "(");
 
-        numArgs = cfunc.getNumArgs();    
+        numArgs = cfunc.getNumArgs();
         if (numArgs == 0) {
             if (mUseContextPointer) {
                 out.println("ctx);");
@@ -1006,7 +993,7 @@
 
                 int cIndex = jfunc.getArgCIndex(idx);
                 if (jfunc.getArgType(idx).isArray()) {
-		    
+
                     // If the argument is 'const', GL will not write to it.
                     // In this case, we can use the 'JNI_ABORT' flag to avoid
                     // the need to write back to the Java array
@@ -1015,7 +1002,7 @@
                     out.println(indent + indent +
                                 (mUseCPlusPlus ? "_env" : "(*_env)") +
                                 "->ReleasePrimitiveArrayCritical(" +
-                                (mUseCPlusPlus ? "" : "_env, ") + 
+                                (mUseCPlusPlus ? "" : "_env, ") +
                                 jfunc.getArgName(idx) + "_ref, " +
                                 cfunc.getArgName(cIndex) +
                                 "_base,");
@@ -1026,17 +1013,20 @@
                                 ");");
                     out.println(indent + "}");
                 } else if (jfunc.getArgType(idx).isBuffer()) {
-                    String array = numBufferArgs <= 1 ? "_array" :
-                        "_" + bufferArgNames.get(bufArgIdx++) + "Array";
-                    out.println(indent + "if (" + array + ") {");
-                    out.println(indent + indent +
-                                "releasePointer(_env, " + array + ", " +
-                                cfunc.getArgName(cIndex) +
-                                ", " +
-                                (cfunc.getArgType(cIndex).isConst() ?
-                                 "JNI_FALSE" : "_exception ? JNI_FALSE : JNI_TRUE") +
-                                ");");
-                    out.println(indent + "}");
+                    if (! isPointerFunc) {
+                        String array = numBufferArgs <= 1 ? "_array" :
+                            "_" + bufferArgNames.get(bufArgIdx++) + "Array";
+                        out.println(indent + "if (" + array + ") {");
+                        out.println(indent + indent +
+                                    "releasePointer(_env, " + array + ", " +
+                                    cfunc.getArgName(cIndex) +
+                                    ", " +
+                                    (cfunc.getArgType(cIndex).isConst() ?
+                                     "JNI_FALSE" : "_exception ? JNI_FALSE :" +
+                                             " JNI_TRUE") +
+                                    ");");
+                        out.println(indent + "}");
+                    }
                 }
             }
         }
@@ -1049,38 +1039,4 @@
         out.println();
     }
 
-    public void addNativeRegistration(String s) {
-        nativeRegistrations.add(s);
-    }
-
-    public void emitNativeRegistration() {
-        mCStream.println("static const char *classPathName = \"" +
-                        mClassPathName +
-                        "\";");
-        mCStream.println();
-
-        mCStream.println("static JNINativeMethod methods[] = {");
-
-        mCStream.println("{\"_nativeClassInit\", \"()V\", (void*)nativeClassInit },");
-
-        Iterator<String> i = nativeRegistrations.iterator();
-        while (i.hasNext()) {
-            mCStream.println(i.next());
-        }
-
-        mCStream.println("};");
-        mCStream.println();
-    
-
-        mCStream.println("int register_com_google_android_gles_jni_GLImpl(JNIEnv *_env)");
-        mCStream.println("{");
-        mCStream.println(indent +
-                        "int err;");
-
-        mCStream.println(indent +
-                        "err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));");
-
-        mCStream.println(indent + "return err;");
-        mCStream.println("}");
-    }
 }
diff --git a/opengl/tools/glgen/src/Jsr239CodeEmitter.java b/opengl/tools/glgen/src/Jsr239CodeEmitter.java
new file mode 100644
index 0000000..335d226
--- /dev/null
+++ b/opengl/tools/glgen/src/Jsr239CodeEmitter.java
@@ -0,0 +1,74 @@
+import java.io.PrintStream;
+
+/**
+ * Emits a Java interface and Java & C implementation for a C function.
+ *
+ * <p> The Java interface will have Buffer and array variants for functions that
+ * have a typed pointer argument.  The array variant will convert a single "<type> *data"
+ * argument to a pair of arguments "<type>[] data, int offset".
+ */
+public class Jsr239CodeEmitter extends JniCodeEmitter implements CodeEmitter {
+
+    PrintStream mJava10InterfaceStream;
+    PrintStream mJava10ExtInterfaceStream;
+    PrintStream mJava11InterfaceStream;
+    PrintStream mJava11ExtInterfaceStream;
+    PrintStream mJava11ExtPackInterfaceStream;
+    PrintStream mJavaImplStream;
+    PrintStream mCStream;
+
+    PrintStream mJavaInterfaceStream;
+
+    /**
+     * @param java10InterfaceStream the PrintStream to which to emit the Java interface for GL 1.0 functions
+     * @param java10ExtInterfaceStream the PrintStream to which to emit the Java interface for GL 1.0 extension functions
+     * @param java11InterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 functions
+     * @param java11ExtInterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 Extension functions
+     * @param java11ExtPackInterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 Extension Pack functions
+     * @param javaImplStream the PrintStream to which to emit the Java implementation
+     * @param cStream the PrintStream to which to emit the C implementation
+     */
+    public Jsr239CodeEmitter(String classPathName,
+                          ParameterChecker checker,
+                          PrintStream java10InterfaceStream,
+                          PrintStream java10ExtInterfaceStream,
+                          PrintStream java11InterfaceStream,
+                          PrintStream java11ExtInterfaceStream,
+                          PrintStream java11ExtPackInterfaceStream,
+                          PrintStream javaImplStream,
+                          PrintStream cStream,
+                          boolean useContextPointer) {
+        mClassPathName = classPathName;
+        mChecker = checker;
+        mJava10InterfaceStream = java10InterfaceStream;
+        mJava10ExtInterfaceStream = java10ExtInterfaceStream;
+        mJava11InterfaceStream = java11InterfaceStream;
+        mJava11ExtInterfaceStream = java11ExtInterfaceStream;
+        mJava11ExtPackInterfaceStream = java11ExtPackInterfaceStream;
+        mJavaImplStream = javaImplStream;
+        mCStream = cStream;
+        mUseContextPointer = useContextPointer;
+    }
+
+    public void setVersion(int version, boolean ext, boolean pack) {
+        if (version == 0) {
+            mJavaInterfaceStream = ext ? mJava10ExtInterfaceStream :
+                mJava10InterfaceStream;
+        } else if (version == 1) {
+            mJavaInterfaceStream = ext ?
+                (pack ? mJava11ExtPackInterfaceStream :
+                 mJava11ExtInterfaceStream) :
+                mJava11InterfaceStream;
+        } else {
+            throw new RuntimeException("Bad version: " + version);
+        }
+    }
+
+    public void emitCode(CFunc cfunc, String original) {
+        emitCode(cfunc, original, mJavaInterfaceStream, mJavaImplStream, mCStream);
+    }
+
+    public void emitNativeRegistration() {
+        emitNativeRegistration("register_com_google_android_gles_jni_GLImpl", mCStream);
+    }
+}
diff --git a/opengl/tools/glgen/stubs/gles11/GLES10ExtHeader.java-if b/opengl/tools/glgen/stubs/gles11/GLES10ExtHeader.java-if
new file mode 100644
index 0000000..42891ea
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/GLES10ExtHeader.java-if
@@ -0,0 +1,26 @@
+**
+** 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();
+    }
+    
\ No newline at end of file
diff --git a/opengl/tools/glgen/stubs/GLCHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp
similarity index 94%
rename from opengl/tools/glgen/stubs/GLCHeader.cpp
rename to opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp
index 6495686..294d1ce 100644
--- a/opengl/tools/glgen/stubs/GLCHeader.cpp
+++ b/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp
@@ -1,5 +1,5 @@
 **
-** Copyright 2006, The Android Open Source Project
+** 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. 
@@ -21,11 +21,7 @@
 
 #include <assert.h>
 #include <GLES/gl.h>
-
-#include <private/opengles/gl_context.h>
-
-#define _NUM_COMPRESSED_TEXTURE_FORMATS \
-        (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS)
+#include <GLES/glext.h>
 
 static int initialized = 0;
 
@@ -44,7 +40,7 @@
 
 /* Cache method IDs each time the class is loaded. */
 
-void
+static void
 nativeClassInitBuffer(JNIEnv *_env)
 {
     jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
diff --git a/opengl/tools/glgen/stubs/gles11/GLES10Header.java-if b/opengl/tools/glgen/stubs/gles11/GLES10Header.java-if
new file mode 100644
index 0000000..4b2a831
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/GLES10Header.java-if
@@ -0,0 +1,271 @@
+**
+** 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;
+
diff --git a/opengl/tools/glgen/stubs/GLCHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp
similarity index 80%
copy from opengl/tools/glgen/stubs/GLCHeader.cpp
copy to opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp
index 6495686..3948fd3 100644
--- a/opengl/tools/glgen/stubs/GLCHeader.cpp
+++ b/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp
@@ -1,5 +1,5 @@
 **
-** Copyright 2006, The Android Open Source Project
+** 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. 
@@ -21,11 +21,20 @@
 
 #include <assert.h>
 #include <GLES/gl.h>
+#include <GLES/glext.h>
 
-#include <private/opengles/gl_context.h>
-
-#define _NUM_COMPRESSED_TEXTURE_FORMATS \
-        (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS)
+/* special calls implemented in Android's GLES wrapper used to more
+ * efficiently bound-check passed arrays */
+extern "C" {
+GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
+        const GLvoid *ptr, GLsizei count);
+GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
+        const GLvoid *pointer, GLsizei count);
+GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
+        GLsizei stride, const GLvoid *pointer, GLsizei count);
+GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
+        GLsizei stride, const GLvoid *pointer, GLsizei count);
+}
 
 static int initialized = 0;
 
@@ -44,7 +53,7 @@
 
 /* Cache method IDs each time the class is loaded. */
 
-void
+static void
 nativeClassInitBuffer(JNIEnv *_env)
 {
     jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
@@ -66,7 +75,6 @@
         _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
 }
 
-
 static void
 nativeClassInit(JNIEnv *_env, jclass glImplClass)
 {
@@ -117,7 +125,6 @@
     return (void *) ((char *) data + offset);
 }
 
-
 static void
 releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
 {
@@ -125,5 +132,12 @@
 					   commit ? 0 : JNI_ABORT);
 }
 
+static int
+getNumCompressedTextureFormats() {
+    int numCompressedTextureFormats = 0;
+    glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats);
+    return numCompressedTextureFormats;
+}
+
 // --------------------------------------------------------------------------
 
diff --git a/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if b/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if
new file mode 100644
index 0000000..428ccee
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if
@@ -0,0 +1,130 @@
+**
+** 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 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;
+
+    native private static void _nativeClassInit();
+    static {
+	    _nativeClassInit();
+    }
+    
\ No newline at end of file
diff --git a/opengl/tools/glgen/stubs/GLCHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp
similarity index 94%
copy from opengl/tools/glgen/stubs/GLCHeader.cpp
copy to opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp
index 6495686..294d1ce 100644
--- a/opengl/tools/glgen/stubs/GLCHeader.cpp
+++ b/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp
@@ -1,5 +1,5 @@
 **
-** Copyright 2006, The Android Open Source Project
+** 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. 
@@ -21,11 +21,7 @@
 
 #include <assert.h>
 #include <GLES/gl.h>
-
-#include <private/opengles/gl_context.h>
-
-#define _NUM_COMPRESSED_TEXTURE_FORMATS \
-        (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS)
+#include <GLES/glext.h>
 
 static int initialized = 0;
 
@@ -44,7 +40,7 @@
 
 /* Cache method IDs each time the class is loaded. */
 
-void
+static void
 nativeClassInitBuffer(JNIEnv *_env)
 {
     jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
diff --git a/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if b/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if
new file mode 100644
index 0000000..26f466f
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if
@@ -0,0 +1,151 @@
+**
+** 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();
+    }
+
diff --git a/opengl/tools/glgen/stubs/GLCHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp
similarity index 94%
copy from opengl/tools/glgen/stubs/GLCHeader.cpp
copy to opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp
index 6495686..294d1ce 100644
--- a/opengl/tools/glgen/stubs/GLCHeader.cpp
+++ b/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp
@@ -1,5 +1,5 @@
 **
-** Copyright 2006, The Android Open Source Project
+** 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. 
@@ -21,11 +21,7 @@
 
 #include <assert.h>
 #include <GLES/gl.h>
-
-#include <private/opengles/gl_context.h>
-
-#define _NUM_COMPRESSED_TEXTURE_FORMATS \
-        (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS)
+#include <GLES/glext.h>
 
 static int initialized = 0;
 
@@ -44,7 +40,7 @@
 
 /* Cache method IDs each time the class is loaded. */
 
-void
+static void
 nativeClassInitBuffer(JNIEnv *_env)
 {
     jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
diff --git a/opengl/tools/glgen/stubs/glGetString.cpp b/opengl/tools/glgen/stubs/gles11/glGetString.cpp
similarity index 97%
rename from opengl/tools/glgen/stubs/glGetString.cpp
rename to opengl/tools/glgen/stubs/gles11/glGetString.cpp
index 22e1297..a400859 100644
--- a/opengl/tools/glgen/stubs/glGetString.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetString.cpp
@@ -1,6 +1,7 @@
 #include <string.h>

 

 /* const GLubyte * glGetString ( GLenum name ) */

+static

 jstring

 android_glGetString

   (JNIEnv *_env, jobject _this, jint name) {

diff --git a/opengl/tools/glgen/stubs/gles11/glGetString.java b/opengl/tools/glgen/stubs/gles11/glGetString.java
new file mode 100644
index 0000000..fba249b
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/glGetString.java
@@ -0,0 +1,5 @@
+    // C function const GLubyte * glGetString ( GLenum name )

+

+    public static native String glGetString(

+        int name

+    );

diff --git a/opengl/tools/glgen/stubs/gles11/glGetString.nativeReg b/opengl/tools/glgen/stubs/gles11/glGetString.nativeReg
new file mode 100644
index 0000000..a4af31f
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/glGetString.nativeReg
@@ -0,0 +1 @@
+{"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString },

diff --git a/opengl/tools/glgen/stubs/GL10ExtHeader.java-if b/opengl/tools/glgen/stubs/jsr239/GL10ExtHeader.java-if
similarity index 100%
rename from opengl/tools/glgen/stubs/GL10ExtHeader.java-if
rename to opengl/tools/glgen/stubs/jsr239/GL10ExtHeader.java-if
diff --git a/opengl/tools/glgen/stubs/GL10Header.java-if b/opengl/tools/glgen/stubs/jsr239/GL10Header.java-if
similarity index 100%
rename from opengl/tools/glgen/stubs/GL10Header.java-if
rename to opengl/tools/glgen/stubs/jsr239/GL10Header.java-if
diff --git a/opengl/tools/glgen/stubs/GL11ExtHeader.java-if b/opengl/tools/glgen/stubs/jsr239/GL11ExtHeader.java-if
similarity index 100%
rename from opengl/tools/glgen/stubs/GL11ExtHeader.java-if
rename to opengl/tools/glgen/stubs/jsr239/GL11ExtHeader.java-if
diff --git a/opengl/tools/glgen/stubs/GL11ExtensionPackHeader.java-if b/opengl/tools/glgen/stubs/jsr239/GL11ExtensionPackHeader.java-if
similarity index 100%
rename from opengl/tools/glgen/stubs/GL11ExtensionPackHeader.java-if
rename to opengl/tools/glgen/stubs/jsr239/GL11ExtensionPackHeader.java-if
diff --git a/opengl/tools/glgen/stubs/GL11Header.java-if b/opengl/tools/glgen/stubs/jsr239/GL11Header.java-if
similarity index 100%
rename from opengl/tools/glgen/stubs/GL11Header.java-if
rename to opengl/tools/glgen/stubs/jsr239/GL11Header.java-if
diff --git a/opengl/tools/glgen/stubs/GL11ImplHeader.java-impl b/opengl/tools/glgen/stubs/jsr239/GL11ImplHeader.java-impl
similarity index 100%
rename from opengl/tools/glgen/stubs/GL11ImplHeader.java-impl
rename to opengl/tools/glgen/stubs/jsr239/GL11ImplHeader.java-impl
diff --git a/opengl/tools/glgen/stubs/GLCHeader.cpp b/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
similarity index 81%
copy from opengl/tools/glgen/stubs/GLCHeader.cpp
copy to opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
index 6495686..11c6087 100644
--- a/opengl/tools/glgen/stubs/GLCHeader.cpp
+++ b/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
@@ -21,11 +21,20 @@
 
 #include <assert.h>
 #include <GLES/gl.h>
+#include <GLES/glext.h>
 
-#include <private/opengles/gl_context.h>
-
-#define _NUM_COMPRESSED_TEXTURE_FORMATS \
-        (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS)
+/* special calls implemented in Android's GLES wrapper used to more
+ * efficiently bound-check passed arrays */
+extern "C" {
+GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
+        const GLvoid *ptr, GLsizei count);
+GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
+        const GLvoid *pointer, GLsizei count);
+GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
+        GLsizei stride, const GLvoid *pointer, GLsizei count);
+GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
+        GLsizei stride, const GLvoid *pointer, GLsizei count);
+}
 
 static int initialized = 0;
 
@@ -44,7 +53,7 @@
 
 /* Cache method IDs each time the class is loaded. */
 
-void
+static void
 nativeClassInitBuffer(JNIEnv *_env)
 {
     jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
@@ -66,7 +75,6 @@
         _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
 }
 
-
 static void
 nativeClassInit(JNIEnv *_env, jclass glImplClass)
 {
@@ -117,7 +125,6 @@
     return (void *) ((char *) data + offset);
 }
 
-
 static void
 releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
 {
@@ -125,5 +132,12 @@
 					   commit ? 0 : JNI_ABORT);
 }
 
+static int
+getNumCompressedTextureFormats() {
+    int numCompressedTextureFormats = 0;
+    glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats);
+    return numCompressedTextureFormats;
+}
+
 // --------------------------------------------------------------------------
 
diff --git a/opengl/tools/glgen/stubs/GLHeader.java-if b/opengl/tools/glgen/stubs/jsr239/GLHeader.java-if
similarity index 100%
rename from opengl/tools/glgen/stubs/GLHeader.java-if
rename to opengl/tools/glgen/stubs/jsr239/GLHeader.java-if
diff --git a/opengl/tools/glgen/stubs/GLImplHeader.java-impl b/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl
similarity index 100%
rename from opengl/tools/glgen/stubs/GLImplHeader.java-impl
rename to opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl
diff --git a/opengl/tools/glgen/stubs/glGetString.cpp b/opengl/tools/glgen/stubs/jsr239/glGetString.cpp
similarity index 97%
copy from opengl/tools/glgen/stubs/glGetString.cpp
copy to opengl/tools/glgen/stubs/jsr239/glGetString.cpp
index 22e1297..a400859 100644
--- a/opengl/tools/glgen/stubs/glGetString.cpp
+++ b/opengl/tools/glgen/stubs/jsr239/glGetString.cpp
@@ -1,6 +1,7 @@
 #include <string.h>

 

 /* const GLubyte * glGetString ( GLenum name ) */

+static

 jstring

 android_glGetString

   (JNIEnv *_env, jobject _this, jint name) {

diff --git a/opengl/tools/glgen/stubs/glGetString.java-10-if b/opengl/tools/glgen/stubs/jsr239/glGetString.java-10-if
similarity index 100%
rename from opengl/tools/glgen/stubs/glGetString.java-10-if
rename to opengl/tools/glgen/stubs/jsr239/glGetString.java-10-if
diff --git a/opengl/tools/glgen/stubs/glGetString.java-if b/opengl/tools/glgen/stubs/jsr239/glGetString.java-if
similarity index 100%
rename from opengl/tools/glgen/stubs/glGetString.java-if
rename to opengl/tools/glgen/stubs/jsr239/glGetString.java-if
diff --git a/opengl/tools/glgen/stubs/glGetString.java-impl b/opengl/tools/glgen/stubs/jsr239/glGetString.java-impl
similarity index 100%
rename from opengl/tools/glgen/stubs/glGetString.java-impl
rename to opengl/tools/glgen/stubs/jsr239/glGetString.java-impl
diff --git a/opengl/tools/glgen/stubs/glGetString.nativeReg b/opengl/tools/glgen/stubs/jsr239/glGetString.nativeReg
similarity index 100%
rename from opengl/tools/glgen/stubs/glGetString.nativeReg
rename to opengl/tools/glgen/stubs/jsr239/glGetString.nativeReg