Home | History | Annotate | Download | only in jni
      1 /*
      2 **
      3 ** Copyright 2009, The Android Open Source Project
      4 **
      5 ** Licensed under the Apache License, Version 2.0 (the "License");
      6 ** you may not use this file except in compliance with the License.
      7 ** You may obtain a copy of the License at
      8 **
      9 **     http://www.apache.org/licenses/LICENSE-2.0
     10 **
     11 ** Unless required by applicable law or agreed to in writing, software
     12 ** distributed under the License is distributed on an "AS IS" BASIS,
     13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 ** See the License for the specific language governing permissions and
     15 ** limitations under the License.
     16 */
     17 
     18 // This source file is automatically generated
     19 
     20 #include <android_runtime/AndroidRuntime.h>
     21 #include <utils/misc.h>
     22 
     23 #include <assert.h>
     24 #include <GLES/gl.h>
     25 #include <GLES/glext.h>
     26 
     27 /* special calls implemented in Android's GLES wrapper used to more
     28  * efficiently bound-check passed arrays */
     29 extern "C" {
     30 GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
     31         const GLvoid *ptr, GLsizei count);
     32 GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
     33         const GLvoid *pointer, GLsizei count);
     34 GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
     35         GLsizei stride, const GLvoid *pointer, GLsizei count);
     36 GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
     37         GLsizei stride, const GLvoid *pointer, GLsizei count);
     38 }
     39 
     40 static int initialized = 0;
     41 
     42 static jclass nioAccessClass;
     43 static jclass bufferClass;
     44 static jclass OOMEClass;
     45 static jclass UOEClass;
     46 static jclass IAEClass;
     47 static jclass AIOOBEClass;
     48 static jmethodID getBasePointerID;
     49 static jmethodID getBaseArrayID;
     50 static jmethodID getBaseArrayOffsetID;
     51 static jfieldID positionID;
     52 static jfieldID limitID;
     53 static jfieldID elementSizeShiftID;
     54 
     55 /* Cache method IDs each time the class is loaded. */
     56 
     57 static void
     58 nativeClassInitBuffer(JNIEnv *_env)
     59 {
     60     jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
     61     nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
     62 
     63     jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
     64     bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
     65 
     66     getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
     67             "getBasePointer", "(Ljava/nio/Buffer;)J");
     68     getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
     69             "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
     70     getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
     71             "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
     72 
     73     positionID = _env->GetFieldID(bufferClass, "position", "I");
     74     limitID = _env->GetFieldID(bufferClass, "limit", "I");
     75     elementSizeShiftID =
     76         _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
     77 }
     78 
     79 static void
     80 nativeClassInit(JNIEnv *_env, jclass glImplClass)
     81 {
     82     nativeClassInitBuffer(_env);
     83 
     84     jclass IAEClassLocal =
     85         _env->FindClass("java/lang/IllegalArgumentException");
     86     jclass OOMEClassLocal =
     87          _env->FindClass("java/lang/OutOfMemoryError");
     88     jclass UOEClassLocal =
     89          _env->FindClass("java/lang/UnsupportedOperationException");
     90     jclass AIOOBEClassLocal =
     91          _env->FindClass("java/lang/ArrayIndexOutOfBoundsException");
     92 
     93     IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal);
     94     OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal);
     95     UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal);
     96     AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal);
     97 }
     98 
     99 static void *
    100 getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
    101 {
    102     jint position;
    103     jint limit;
    104     jint elementSizeShift;
    105     jlong pointer;
    106     jint offset;
    107     void *data;
    108 
    109     position = _env->GetIntField(buffer, positionID);
    110     limit = _env->GetIntField(buffer, limitID);
    111     elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
    112     *remaining = (limit - position) << elementSizeShift;
    113     pointer = _env->CallStaticLongMethod(nioAccessClass,
    114             getBasePointerID, buffer);
    115     if (pointer != 0L) {
    116         *array = NULL;
    117         return (void *) (jint) pointer;
    118     }
    119 
    120     *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
    121             getBaseArrayID, buffer);
    122     offset = _env->CallStaticIntMethod(nioAccessClass,
    123             getBaseArrayOffsetID, buffer);
    124     data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0);
    125 
    126     return (void *) ((char *) data + offset);
    127 }
    128 
    129 static void
    130 releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
    131 {
    132     _env->ReleasePrimitiveArrayCritical(array, data,
    133 					   commit ? 0 : JNI_ABORT);
    134 }
    135 
    136 static void *
    137 getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
    138     char* buf = (char*) _env->GetDirectBufferAddress(buffer);
    139     if (buf) {
    140         jint position = _env->GetIntField(buffer, positionID);
    141         jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
    142         buf += position << elementSizeShift;
    143     } else {
    144         _env->ThrowNew(IAEClass, "Must use a native order direct Buffer");
    145     }
    146     return (void*) buf;
    147 }
    148 
    149 static int
    150 getNumCompressedTextureFormats() {
    151     int numCompressedTextureFormats = 0;
    152     glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats);
    153     return numCompressedTextureFormats;
    154 }
    155 
    156 // --------------------------------------------------------------------------
    157 
    158 /* void glActiveTexture ( GLenum texture ) */
    159 static void
    160 android_glActiveTexture__I
    161   (JNIEnv *_env, jobject _this, jint texture) {
    162     glActiveTexture(
    163         (GLenum)texture
    164     );
    165 }
    166 
    167 /* void glAlphaFunc ( GLenum func, GLclampf ref ) */
    168 static void
    169 android_glAlphaFunc__IF
    170   (JNIEnv *_env, jobject _this, jint func, jfloat ref) {
    171     glAlphaFunc(
    172         (GLenum)func,
    173         (GLclampf)ref
    174     );
    175 }
    176 
    177 /* void glAlphaFuncx ( GLenum func, GLclampx ref ) */
    178 static void
    179 android_glAlphaFuncx__II
    180   (JNIEnv *_env, jobject _this, jint func, jint ref) {
    181     glAlphaFuncx(
    182         (GLenum)func,
    183         (GLclampx)ref
    184     );
    185 }
    186 
    187 /* void glBindTexture ( GLenum target, GLuint texture ) */
    188 static void
    189 android_glBindTexture__II
    190   (JNIEnv *_env, jobject _this, jint target, jint texture) {
    191     glBindTexture(
    192         (GLenum)target,
    193         (GLuint)texture
    194     );
    195 }
    196 
    197 /* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */
    198 static void
    199 android_glBlendFunc__II
    200   (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) {
    201     glBlendFunc(
    202         (GLenum)sfactor,
    203         (GLenum)dfactor
    204     );
    205 }
    206 
    207 /* void glClear ( GLbitfield mask ) */
    208 static void
    209 android_glClear__I
    210   (JNIEnv *_env, jobject _this, jint mask) {
    211     glClear(
    212         (GLbitfield)mask
    213     );
    214 }
    215 
    216 /* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
    217 static void
    218 android_glClearColor__FFFF
    219   (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
    220     glClearColor(
    221         (GLclampf)red,
    222         (GLclampf)green,
    223         (GLclampf)blue,
    224         (GLclampf)alpha
    225     );
    226 }
    227 
    228 /* void glClearColorx ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha ) */
    229 static void
    230 android_glClearColorx__IIII
    231   (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) {
    232     glClearColorx(
    233         (GLclampx)red,
    234         (GLclampx)green,
    235         (GLclampx)blue,
    236         (GLclampx)alpha
    237     );
    238 }
    239 
    240 /* void glClearDepthf ( GLclampf depth ) */
    241 static void
    242 android_glClearDepthf__F
    243   (JNIEnv *_env, jobject _this, jfloat depth) {
    244     glClearDepthf(
    245         (GLclampf)depth
    246     );
    247 }
    248 
    249 /* void glClearDepthx ( GLclampx depth ) */
    250 static void
    251 android_glClearDepthx__I
    252   (JNIEnv *_env, jobject _this, jint depth) {
    253     glClearDepthx(
    254         (GLclampx)depth
    255     );
    256 }
    257 
    258 /* void glClearStencil ( GLint s ) */
    259 static void
    260 android_glClearStencil__I
    261   (JNIEnv *_env, jobject _this, jint s) {
    262     glClearStencil(
    263         (GLint)s
    264     );
    265 }
    266 
    267 /* void glClientActiveTexture ( GLenum texture ) */
    268 static void
    269 android_glClientActiveTexture__I
    270   (JNIEnv *_env, jobject _this, jint texture) {
    271     glClientActiveTexture(
    272         (GLenum)texture
    273     );
    274 }
    275 
    276 /* void glColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) */
    277 static void
    278 android_glColor4f__FFFF
    279   (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
    280     glColor4f(
    281         (GLfloat)red,
    282         (GLfloat)green,
    283         (GLfloat)blue,
    284         (GLfloat)alpha
    285     );
    286 }
    287 
    288 /* void glColor4x ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha ) */
    289 static void
    290 android_glColor4x__IIII
    291   (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) {
    292     glColor4x(
    293         (GLfixed)red,
    294         (GLfixed)green,
    295         (GLfixed)blue,
    296         (GLfixed)alpha
    297     );
    298 }
    299 
    300 /* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */
    301 static void
    302 android_glColorMask__ZZZZ
    303   (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) {
    304     glColorMask(
    305         (GLboolean)red,
    306         (GLboolean)green,
    307         (GLboolean)blue,
    308         (GLboolean)alpha
    309     );
    310 }
    311 
    312 /* void glColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
    313 static void
    314 android_glColorPointerBounds__IIILjava_nio_Buffer_2I
    315   (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
    316     jarray _array = (jarray) 0;
    317     jint _remaining;
    318     GLvoid *pointer = (GLvoid *) 0;
    319 
    320     if (pointer_buf) {
    321         pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
    322         if ( ! pointer ) {
    323             return;
    324         }
    325     }
    326     glColorPointerBounds(
    327         (GLint)size,
    328         (GLenum)type,
    329         (GLsizei)stride,
    330         (GLvoid *)pointer,
    331         (GLsizei)remaining
    332     );
    333 }
    334 
    335 /* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */
    336 static void
    337 android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2
    338   (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) {
    339     jarray _array = (jarray) 0;
    340     jint _remaining;
    341     GLvoid *data = (GLvoid *) 0;
    342 
    343     data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining);
    344     glCompressedTexImage2D(
    345         (GLenum)target,
    346         (GLint)level,
    347         (GLenum)internalformat,
    348         (GLsizei)width,
    349         (GLsizei)height,
    350         (GLint)border,
    351         (GLsizei)imageSize,
    352         (GLvoid *)data
    353     );
    354     if (_array) {
    355         releasePointer(_env, _array, data, JNI_FALSE);
    356     }
    357 }
    358 
    359 /* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */
    360 static void
    361 android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
    362   (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) {
    363     jarray _array = (jarray) 0;
    364     jint _remaining;
    365     GLvoid *data = (GLvoid *) 0;
    366 
    367     data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining);
    368     glCompressedTexSubImage2D(
    369         (GLenum)target,
    370         (GLint)level,
    371         (GLint)xoffset,
    372         (GLint)yoffset,
    373         (GLsizei)width,
    374         (GLsizei)height,
    375         (GLenum)format,
    376         (GLsizei)imageSize,
    377         (GLvoid *)data
    378     );
    379     if (_array) {
    380         releasePointer(_env, _array, data, JNI_FALSE);
    381     }
    382 }
    383 
    384 /* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */
    385 static void
    386 android_glCopyTexImage2D__IIIIIIII
    387   (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) {
    388     glCopyTexImage2D(
    389         (GLenum)target,
    390         (GLint)level,
    391         (GLenum)internalformat,
    392         (GLint)x,
    393         (GLint)y,
    394         (GLsizei)width,
    395         (GLsizei)height,
    396         (GLint)border
    397     );
    398 }
    399 
    400 /* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */
    401 static void
    402 android_glCopyTexSubImage2D__IIIIIIII
    403   (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) {
    404     glCopyTexSubImage2D(
    405         (GLenum)target,
    406         (GLint)level,
    407         (GLint)xoffset,
    408         (GLint)yoffset,
    409         (GLint)x,
    410         (GLint)y,
    411         (GLsizei)width,
    412         (GLsizei)height
    413     );
    414 }
    415 
    416 /* void glCullFace ( GLenum mode ) */
    417 static void
    418 android_glCullFace__I
    419   (JNIEnv *_env, jobject _this, jint mode) {
    420     glCullFace(
    421         (GLenum)mode
    422     );
    423 }
    424 
    425 /* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
    426 static void
    427 android_glDeleteTextures__I_3II
    428   (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
    429     GLuint *textures_base = (GLuint *) 0;
    430     jint _remaining;
    431     GLuint *textures = (GLuint *) 0;
    432 
    433     if (!textures_ref) {
    434         _env->ThrowNew(IAEClass, "textures == null");
    435         goto exit;
    436     }
    437     if (offset < 0) {
    438         _env->ThrowNew(IAEClass, "offset < 0");
    439         goto exit;
    440     }
    441     _remaining = _env->GetArrayLength(textures_ref) - offset;
    442     if (_remaining < n) {
    443         _env->ThrowNew(IAEClass, "length - offset < n");
    444         goto exit;
    445     }
    446     textures_base = (GLuint *)
    447         _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
    448     textures = textures_base + offset;
    449 
    450     glDeleteTextures(
    451         (GLsizei)n,
    452         (GLuint *)textures
    453     );
    454 
    455 exit:
    456     if (textures_base) {
    457         _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
    458             JNI_ABORT);
    459     }
    460 }
    461 
    462 /* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
    463 static void
    464 android_glDeleteTextures__ILjava_nio_IntBuffer_2
    465   (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
    466     jarray _array = (jarray) 0;
    467     jint _remaining;
    468     GLuint *textures = (GLuint *) 0;
    469 
    470     textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining);
    471     if (_remaining < n) {
    472         _env->ThrowNew(IAEClass, "remaining() < n");
    473         goto exit;
    474     }
    475     glDeleteTextures(
    476         (GLsizei)n,
    477         (GLuint *)textures
    478     );
    479 
    480 exit:
    481     if (_array) {
    482         releasePointer(_env, _array, textures, JNI_FALSE);
    483     }
    484 }
    485 
    486 /* void glDepthFunc ( GLenum func ) */
    487 static void
    488 android_glDepthFunc__I
    489   (JNIEnv *_env, jobject _this, jint func) {
    490     glDepthFunc(
    491         (GLenum)func
    492     );
    493 }
    494 
    495 /* void glDepthMask ( GLboolean flag ) */
    496 static void
    497 android_glDepthMask__Z
    498   (JNIEnv *_env, jobject _this, jboolean flag) {
    499     glDepthMask(
    500         (GLboolean)flag
    501     );
    502 }
    503 
    504 /* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */
    505 static void
    506 android_glDepthRangef__FF
    507   (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) {
    508     glDepthRangef(
    509         (GLclampf)zNear,
    510         (GLclampf)zFar
    511     );
    512 }
    513 
    514 /* void glDepthRangex ( GLclampx zNear, GLclampx zFar ) */
    515 static void
    516 android_glDepthRangex__II
    517   (JNIEnv *_env, jobject _this, jint zNear, jint zFar) {
    518     glDepthRangex(
    519         (GLclampx)zNear,
    520         (GLclampx)zFar
    521     );
    522 }
    523 
    524 /* void glDisable ( GLenum cap ) */
    525 static void
    526 android_glDisable__I
    527   (JNIEnv *_env, jobject _this, jint cap) {
    528     glDisable(
    529         (GLenum)cap
    530     );
    531 }
    532 
    533 /* void glDisableClientState ( GLenum array ) */
    534 static void
    535 android_glDisableClientState__I
    536   (JNIEnv *_env, jobject _this, jint array) {
    537     glDisableClientState(
    538         (GLenum)array
    539     );
    540 }
    541 
    542 /* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */
    543 static void
    544 android_glDrawArrays__III
    545   (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) {
    546     glDrawArrays(
    547         (GLenum)mode,
    548         (GLint)first,
    549         (GLsizei)count
    550     );
    551 }
    552 
    553 /* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */
    554 static void
    555 android_glDrawElements__IIILjava_nio_Buffer_2
    556   (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) {
    557     jarray _array = (jarray) 0;
    558     jint _remaining;
    559     GLvoid *indices = (GLvoid *) 0;
    560 
    561     indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining);
    562     if (_remaining < count) {
    563         _env->ThrowNew(AIOOBEClass, "remaining() < count");
    564         goto exit;
    565     }
    566     glDrawElements(
    567         (GLenum)mode,
    568         (GLsizei)count,
    569         (GLenum)type,
    570         (GLvoid *)indices
    571     );
    572 
    573 exit:
    574     if (_array) {
    575         releasePointer(_env, _array, indices, JNI_FALSE);
    576     }
    577 }
    578 
    579 /* void glEnable ( GLenum cap ) */
    580 static void
    581 android_glEnable__I
    582   (JNIEnv *_env, jobject _this, jint cap) {
    583     glEnable(
    584         (GLenum)cap
    585     );
    586 }
    587 
    588 /* void glEnableClientState ( GLenum array ) */
    589 static void
    590 android_glEnableClientState__I
    591   (JNIEnv *_env, jobject _this, jint array) {
    592     glEnableClientState(
    593         (GLenum)array
    594     );
    595 }
    596 
    597 /* void glFinish ( void ) */
    598 static void
    599 android_glFinish__
    600   (JNIEnv *_env, jobject _this) {
    601     glFinish();
    602 }
    603 
    604 /* void glFlush ( void ) */
    605 static void
    606 android_glFlush__
    607   (JNIEnv *_env, jobject _this) {
    608     glFlush();
    609 }
    610 
    611 /* void glFogf ( GLenum pname, GLfloat param ) */
    612 static void
    613 android_glFogf__IF
    614   (JNIEnv *_env, jobject _this, jint pname, jfloat param) {
    615     glFogf(
    616         (GLenum)pname,
    617         (GLfloat)param
    618     );
    619 }
    620 
    621 /* void glFogfv ( GLenum pname, const GLfloat *params ) */
    622 static void
    623 android_glFogfv__I_3FI
    624   (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
    625     GLfloat *params_base = (GLfloat *) 0;
    626     jint _remaining;
    627     GLfloat *params = (GLfloat *) 0;
    628 
    629     if (!params_ref) {
    630         _env->ThrowNew(IAEClass, "params == null");
    631         goto exit;
    632     }
    633     if (offset < 0) {
    634         _env->ThrowNew(IAEClass, "offset < 0");
    635         goto exit;
    636     }
    637     _remaining = _env->GetArrayLength(params_ref) - offset;
    638     int _needed;
    639     switch (pname) {
    640 #if defined(GL_FOG_MODE)
    641         case GL_FOG_MODE:
    642 #endif // defined(GL_FOG_MODE)
    643 #if defined(GL_FOG_DENSITY)
    644         case GL_FOG_DENSITY:
    645 #endif // defined(GL_FOG_DENSITY)
    646 #if defined(GL_FOG_START)
    647         case GL_FOG_START:
    648 #endif // defined(GL_FOG_START)
    649 #if defined(GL_FOG_END)
    650         case GL_FOG_END:
    651 #endif // defined(GL_FOG_END)
    652             _needed = 1;
    653             break;
    654 #if defined(GL_FOG_COLOR)
    655         case GL_FOG_COLOR:
    656 #endif // defined(GL_FOG_COLOR)
    657             _needed = 4;
    658             break;
    659         default:
    660             _needed = 0;
    661             break;
    662     }
    663     if (_remaining < _needed) {
    664         _env->ThrowNew(IAEClass, "length - offset < needed");
    665         goto exit;
    666     }
    667     params_base = (GLfloat *)
    668         _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
    669     params = params_base + offset;
    670 
    671     glFogfv(
    672         (GLenum)pname,
    673         (GLfloat *)params
    674     );
    675 
    676 exit:
    677     if (params_base) {
    678         _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
    679             JNI_ABORT);
    680     }
    681 }
    682 
    683 /* void glFogfv ( GLenum pname, const GLfloat *params ) */
    684 static void
    685 android_glFogfv__ILjava_nio_FloatBuffer_2
    686   (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
    687     jarray _array = (jarray) 0;
    688     jint _remaining;
    689     GLfloat *params = (GLfloat *) 0;
    690 
    691     params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
    692     int _needed;
    693     switch (pname) {
    694 #if defined(GL_FOG_MODE)
    695         case GL_FOG_MODE:
    696 #endif // defined(GL_FOG_MODE)
    697 #if defined(GL_FOG_DENSITY)
    698         case GL_FOG_DENSITY:
    699 #endif // defined(GL_FOG_DENSITY)
    700 #if defined(GL_FOG_START)
    701         case GL_FOG_START:
    702 #endif // defined(GL_FOG_START)
    703 #if defined(GL_FOG_END)
    704         case GL_FOG_END:
    705 #endif // defined(GL_FOG_END)
    706             _needed = 1;
    707             break;
    708 #if defined(GL_FOG_COLOR)
    709         case GL_FOG_COLOR:
    710 #endif // defined(GL_FOG_COLOR)
    711             _needed = 4;
    712             break;
    713         default:
    714             _needed = 0;
    715             break;
    716     }
    717     if (_remaining < _needed) {
    718         _env->ThrowNew(IAEClass, "remaining() < needed");
    719         goto exit;
    720     }
    721     glFogfv(
    722         (GLenum)pname,
    723         (GLfloat *)params
    724     );
    725 
    726 exit:
    727     if (_array) {
    728         releasePointer(_env, _array, params, JNI_FALSE);
    729     }
    730 }
    731 
    732 /* void glFogx ( GLenum pname, GLfixed param ) */
    733 static void
    734 android_glFogx__II
    735   (JNIEnv *_env, jobject _this, jint pname, jint param) {
    736     glFogx(
    737         (GLenum)pname,
    738         (GLfixed)param
    739     );
    740 }
    741 
    742 /* void glFogxv ( GLenum pname, const GLfixed *params ) */
    743 static void
    744 android_glFogxv__I_3II
    745   (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
    746     GLfixed *params_base = (GLfixed *) 0;
    747     jint _remaining;
    748     GLfixed *params = (GLfixed *) 0;
    749 
    750     if (!params_ref) {
    751         _env->ThrowNew(IAEClass, "params == null");
    752         goto exit;
    753     }
    754     if (offset < 0) {
    755         _env->ThrowNew(IAEClass, "offset < 0");
    756         goto exit;
    757     }
    758     _remaining = _env->GetArrayLength(params_ref) - offset;
    759     int _needed;
    760     switch (pname) {
    761 #if defined(GL_FOG_MODE)
    762         case GL_FOG_MODE:
    763 #endif // defined(GL_FOG_MODE)
    764 #if defined(GL_FOG_DENSITY)
    765         case GL_FOG_DENSITY:
    766 #endif // defined(GL_FOG_DENSITY)
    767 #if defined(GL_FOG_START)
    768         case GL_FOG_START:
    769 #endif // defined(GL_FOG_START)
    770 #if defined(GL_FOG_END)
    771         case GL_FOG_END:
    772 #endif // defined(GL_FOG_END)
    773             _needed = 1;
    774             break;
    775 #if defined(GL_FOG_COLOR)
    776         case GL_FOG_COLOR:
    777 #endif // defined(GL_FOG_COLOR)
    778             _needed = 4;
    779             break;
    780         default:
    781             _needed = 0;
    782             break;
    783     }
    784     if (_remaining < _needed) {
    785         _env->ThrowNew(IAEClass, "length - offset < needed");
    786         goto exit;
    787     }
    788     params_base = (GLfixed *)
    789         _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
    790     params = params_base + offset;
    791 
    792     glFogxv(
    793         (GLenum)pname,
    794         (GLfixed *)params
    795     );
    796 
    797 exit:
    798     if (params_base) {
    799         _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
    800             JNI_ABORT);
    801     }
    802 }
    803 
    804 /* void glFogxv ( GLenum pname, const GLfixed *params ) */
    805 static void
    806 android_glFogxv__ILjava_nio_IntBuffer_2
    807   (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
    808     jarray _array = (jarray) 0;
    809     jint _remaining;
    810     GLfixed *params = (GLfixed *) 0;
    811 
    812     params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
    813     int _needed;
    814     switch (pname) {
    815 #if defined(GL_FOG_MODE)
    816         case GL_FOG_MODE:
    817 #endif // defined(GL_FOG_MODE)
    818 #if defined(GL_FOG_DENSITY)
    819         case GL_FOG_DENSITY:
    820 #endif // defined(GL_FOG_DENSITY)
    821 #if defined(GL_FOG_START)
    822         case GL_FOG_START:
    823 #endif // defined(GL_FOG_START)
    824 #if defined(GL_FOG_END)
    825         case GL_FOG_END:
    826 #endif // defined(GL_FOG_END)
    827             _needed = 1;
    828             break;
    829 #if defined(GL_FOG_COLOR)
    830         case GL_FOG_COLOR:
    831 #endif // defined(GL_FOG_COLOR)
    832             _needed = 4;
    833             break;
    834         default:
    835             _needed = 0;
    836             break;
    837     }
    838     if (_remaining < _needed) {
    839         _env->ThrowNew(IAEClass, "remaining() < needed");
    840         goto exit;
    841     }
    842     glFogxv(
    843         (GLenum)pname,
    844         (GLfixed *)params
    845     );
    846 
    847 exit:
    848     if (_array) {
    849         releasePointer(_env, _array, params, JNI_FALSE);
    850     }
    851 }
    852 
    853 /* void glFrontFace ( GLenum mode ) */
    854 static void
    855 android_glFrontFace__I
    856   (JNIEnv *_env, jobject _this, jint mode) {
    857     glFrontFace(
    858         (GLenum)mode
    859     );
    860 }
    861 
    862 /* void glFrustumf ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */
    863 static void
    864 android_glFrustumf__FFFFFF
    865   (JNIEnv *_env, jobject _this, jfloat left, jfloat right, jfloat bottom, jfloat top, jfloat zNear, jfloat zFar) {
    866     glFrustumf(
    867         (GLfloat)left,
    868         (GLfloat)right,
    869         (GLfloat)bottom,
    870         (GLfloat)top,
    871         (GLfloat)zNear,
    872         (GLfloat)zFar
    873     );
    874 }
    875 
    876 /* void glFrustumx ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) */
    877 static void
    878 android_glFrustumx__IIIIII
    879   (JNIEnv *_env, jobject _this, jint left, jint right, jint bottom, jint top, jint zNear, jint zFar) {
    880     glFrustumx(
    881         (GLfixed)left,
    882         (GLfixed)right,
    883         (GLfixed)bottom,
    884         (GLfixed)top,
    885         (GLfixed)zNear,
    886         (GLfixed)zFar
    887     );
    888 }
    889 
    890 /* void glGenTextures ( GLsizei n, GLuint *textures ) */
    891 static void
    892 android_glGenTextures__I_3II
    893   (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
    894     jint _exception = 0;
    895     GLuint *textures_base = (GLuint *) 0;
    896     jint _remaining;
    897     GLuint *textures = (GLuint *) 0;
    898 
    899     if (!textures_ref) {
    900         _exception = 1;
    901         _env->ThrowNew(IAEClass, "textures == null");
    902         goto exit;
    903     }
    904     if (offset < 0) {
    905         _exception = 1;
    906         _env->ThrowNew(IAEClass, "offset < 0");
    907         goto exit;
    908     }
    909     _remaining = _env->GetArrayLength(textures_ref) - offset;
    910     if (_remaining < n) {
    911         _exception = 1;
    912         _env->ThrowNew(IAEClass, "length - offset < n");
    913         goto exit;
    914     }
    915     textures_base = (GLuint *)
    916         _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
    917     textures = textures_base + offset;
    918 
    919     glGenTextures(
    920         (GLsizei)n,
    921         (GLuint *)textures
    922     );
    923 
    924 exit:
    925     if (textures_base) {
    926         _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
    927             _exception ? JNI_ABORT: 0);
    928     }
    929 }
    930 
    931 /* void glGenTextures ( GLsizei n, GLuint *textures ) */
    932 static void
    933 android_glGenTextures__ILjava_nio_IntBuffer_2
    934   (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
    935     jint _exception = 0;
    936     jarray _array = (jarray) 0;
    937     jint _remaining;
    938     GLuint *textures = (GLuint *) 0;
    939 
    940     textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining);
    941     if (_remaining < n) {
    942         _exception = 1;
    943         _env->ThrowNew(IAEClass, "remaining() < n");
    944         goto exit;
    945     }
    946     glGenTextures(
    947         (GLsizei)n,
    948         (GLuint *)textures
    949     );
    950 
    951 exit:
    952     if (_array) {
    953         releasePointer(_env, _array, textures, _exception ? JNI_FALSE : JNI_TRUE);
    954     }
    955 }
    956 
    957 /* GLenum glGetError ( void ) */
    958 static jint
    959 android_glGetError__
    960   (JNIEnv *_env, jobject _this) {
    961     GLenum _returnValue;
    962     _returnValue = glGetError();
    963     return _returnValue;
    964 }
    965 
    966 /* void glGetIntegerv ( GLenum pname, GLint *params ) */
    967 static void
    968 android_glGetIntegerv__I_3II
    969   (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
    970     jint _exception = 0;
    971     GLint *params_base = (GLint *) 0;
    972     jint _remaining;
    973     GLint *params = (GLint *) 0;
    974 
    975     if (!params_ref) {
    976         _exception = 1;
    977         _env->ThrowNew(IAEClass, "params == null");
    978         goto exit;
    979     }
    980     if (offset < 0) {
    981         _exception = 1;
    982         _env->ThrowNew(IAEClass, "offset < 0");
    983         goto exit;
    984     }
    985     _remaining = _env->GetArrayLength(params_ref) - offset;
    986     int _needed;
    987     switch (pname) {
    988 #if defined(GL_ALPHA_BITS)
    989         case GL_ALPHA_BITS:
    990 #endif // defined(GL_ALPHA_BITS)
    991 #if defined(GL_ALPHA_TEST_FUNC)
    992         case GL_ALPHA_TEST_FUNC:
    993 #endif // defined(GL_ALPHA_TEST_FUNC)
    994 #if defined(GL_ALPHA_TEST_REF)
    995         case GL_ALPHA_TEST_REF:
    996 #endif // defined(GL_ALPHA_TEST_REF)
    997 #if defined(GL_BLEND_DST)
    998         case GL_BLEND_DST:
    999 #endif // defined(GL_BLEND_DST)
   1000 #if defined(GL_BLUE_BITS)
   1001         case GL_BLUE_BITS:
   1002 #endif // defined(GL_BLUE_BITS)
   1003 #if defined(GL_COLOR_ARRAY_BUFFER_BINDING)
   1004         case GL_COLOR_ARRAY_BUFFER_BINDING:
   1005 #endif // defined(GL_COLOR_ARRAY_BUFFER_BINDING)
   1006 #if defined(GL_COLOR_ARRAY_SIZE)
   1007         case GL_COLOR_ARRAY_SIZE:
   1008 #endif // defined(GL_COLOR_ARRAY_SIZE)
   1009 #if defined(GL_COLOR_ARRAY_STRIDE)
   1010         case GL_COLOR_ARRAY_STRIDE:
   1011 #endif // defined(GL_COLOR_ARRAY_STRIDE)
   1012 #if defined(GL_COLOR_ARRAY_TYPE)
   1013         case GL_COLOR_ARRAY_TYPE:
   1014 #endif // defined(GL_COLOR_ARRAY_TYPE)
   1015 #if defined(GL_CULL_FACE)
   1016         case GL_CULL_FACE:
   1017 #endif // defined(GL_CULL_FACE)
   1018 #if defined(GL_DEPTH_BITS)
   1019         case GL_DEPTH_BITS:
   1020 #endif // defined(GL_DEPTH_BITS)
   1021 #if defined(GL_DEPTH_CLEAR_VALUE)
   1022         case GL_DEPTH_CLEAR_VALUE:
   1023 #endif // defined(GL_DEPTH_CLEAR_VALUE)
   1024 #if defined(GL_DEPTH_FUNC)
   1025         case GL_DEPTH_FUNC:
   1026 #endif // defined(GL_DEPTH_FUNC)
   1027 #if defined(GL_DEPTH_WRITEMASK)
   1028         case GL_DEPTH_WRITEMASK:
   1029 #endif // defined(GL_DEPTH_WRITEMASK)
   1030 #if defined(GL_FOG_DENSITY)
   1031         case GL_FOG_DENSITY:
   1032 #endif // defined(GL_FOG_DENSITY)
   1033 #if defined(GL_FOG_END)
   1034         case GL_FOG_END:
   1035 #endif // defined(GL_FOG_END)
   1036 #if defined(GL_FOG_MODE)
   1037         case GL_FOG_MODE:
   1038 #endif // defined(GL_FOG_MODE)
   1039 #if defined(GL_FOG_START)
   1040         case GL_FOG_START:
   1041 #endif // defined(GL_FOG_START)
   1042 #if defined(GL_FRONT_FACE)
   1043         case GL_FRONT_FACE:
   1044 #endif // defined(GL_FRONT_FACE)
   1045 #if defined(GL_GREEN_BITS)
   1046         case GL_GREEN_BITS:
   1047 #endif // defined(GL_GREEN_BITS)
   1048 #if defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)
   1049         case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
   1050 #endif // defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)
   1051 #if defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)
   1052         case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
   1053 #endif // defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)
   1054 #if defined(GL_LIGHT_MODEL_COLOR_CONTROL)
   1055         case GL_LIGHT_MODEL_COLOR_CONTROL:
   1056 #endif // defined(GL_LIGHT_MODEL_COLOR_CONTROL)
   1057 #if defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
   1058         case GL_LIGHT_MODEL_LOCAL_VIEWER:
   1059 #endif // defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
   1060 #if defined(GL_LIGHT_MODEL_TWO_SIDE)
   1061         case GL_LIGHT_MODEL_TWO_SIDE:
   1062 #endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
   1063 #if defined(GL_LINE_SMOOTH_HINT)
   1064         case GL_LINE_SMOOTH_HINT:
   1065 #endif // defined(GL_LINE_SMOOTH_HINT)
   1066 #if defined(GL_LINE_WIDTH)
   1067         case GL_LINE_WIDTH:
   1068 #endif // defined(GL_LINE_WIDTH)
   1069 #if defined(GL_LOGIC_OP_MODE)
   1070         case GL_LOGIC_OP_MODE:
   1071 #endif // defined(GL_LOGIC_OP_MODE)
   1072 #if defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES)
   1073         case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES:
   1074 #endif // defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES)
   1075 #if defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES)
   1076         case GL_MATRIX_INDEX_ARRAY_SIZE_OES:
   1077 #endif // defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES)
   1078 #if defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES)
   1079         case GL_MATRIX_INDEX_ARRAY_STRIDE_OES:
   1080 #endif // defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES)
   1081 #if defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES)
   1082         case GL_MATRIX_INDEX_ARRAY_TYPE_OES:
   1083 #endif // defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES)
   1084 #if defined(GL_MATRIX_MODE)
   1085         case GL_MATRIX_MODE:
   1086 #endif // defined(GL_MATRIX_MODE)
   1087 #if defined(GL_MAX_CLIP_PLANES)
   1088         case GL_MAX_CLIP_PLANES:
   1089 #endif // defined(GL_MAX_CLIP_PLANES)
   1090 #if defined(GL_MAX_ELEMENTS_INDICES)
   1091         case GL_MAX_ELEMENTS_INDICES:
   1092 #endif // defined(GL_MAX_ELEMENTS_INDICES)
   1093 #if defined(GL_MAX_ELEMENTS_VERTICES)
   1094         case GL_MAX_ELEMENTS_VERTICES:
   1095 #endif // defined(GL_MAX_ELEMENTS_VERTICES)
   1096 #if defined(GL_MAX_LIGHTS)
   1097         case GL_MAX_LIGHTS:
   1098 #endif // defined(GL_MAX_LIGHTS)
   1099 #if defined(GL_MAX_MODELVIEW_STACK_DEPTH)
   1100         case GL_MAX_MODELVIEW_STACK_DEPTH:
   1101 #endif // defined(GL_MAX_MODELVIEW_STACK_DEPTH)
   1102 #if defined(GL_MAX_PALETTE_MATRICES_OES)
   1103         case GL_MAX_PALETTE_MATRICES_OES:
   1104 #endif // defined(GL_MAX_PALETTE_MATRICES_OES)
   1105 #if defined(GL_MAX_PROJECTION_STACK_DEPTH)
   1106         case GL_MAX_PROJECTION_STACK_DEPTH:
   1107 #endif // defined(GL_MAX_PROJECTION_STACK_DEPTH)
   1108 #if defined(GL_MAX_TEXTURE_SIZE)
   1109         case GL_MAX_TEXTURE_SIZE:
   1110 #endif // defined(GL_MAX_TEXTURE_SIZE)
   1111 #if defined(GL_MAX_TEXTURE_STACK_DEPTH)
   1112         case GL_MAX_TEXTURE_STACK_DEPTH:
   1113 #endif // defined(GL_MAX_TEXTURE_STACK_DEPTH)
   1114 #if defined(GL_MAX_TEXTURE_UNITS)
   1115         case GL_MAX_TEXTURE_UNITS:
   1116 #endif // defined(GL_MAX_TEXTURE_UNITS)
   1117 #if defined(GL_MAX_VERTEX_UNITS_OES)
   1118         case GL_MAX_VERTEX_UNITS_OES:
   1119 #endif // defined(GL_MAX_VERTEX_UNITS_OES)
   1120 #if defined(GL_MODELVIEW_STACK_DEPTH)
   1121         case GL_MODELVIEW_STACK_DEPTH:
   1122 #endif // defined(GL_MODELVIEW_STACK_DEPTH)
   1123 #if defined(GL_NORMAL_ARRAY_BUFFER_BINDING)
   1124         case GL_NORMAL_ARRAY_BUFFER_BINDING:
   1125 #endif // defined(GL_NORMAL_ARRAY_BUFFER_BINDING)
   1126 #if defined(GL_NORMAL_ARRAY_STRIDE)
   1127         case GL_NORMAL_ARRAY_STRIDE:
   1128 #endif // defined(GL_NORMAL_ARRAY_STRIDE)
   1129 #if defined(GL_NORMAL_ARRAY_TYPE)
   1130         case GL_NORMAL_ARRAY_TYPE:
   1131 #endif // defined(GL_NORMAL_ARRAY_TYPE)
   1132 #if defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
   1133         case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
   1134 #endif // defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
   1135 #if defined(GL_PACK_ALIGNMENT)
   1136         case GL_PACK_ALIGNMENT:
   1137 #endif // defined(GL_PACK_ALIGNMENT)
   1138 #if defined(GL_PERSPECTIVE_CORRECTION_HINT)
   1139         case GL_PERSPECTIVE_CORRECTION_HINT:
   1140 #endif // defined(GL_PERSPECTIVE_CORRECTION_HINT)
   1141 #if defined(GL_POINT_SIZE)
   1142         case GL_POINT_SIZE:
   1143 #endif // defined(GL_POINT_SIZE)
   1144 #if defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES)
   1145         case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
   1146 #endif // defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES)
   1147 #if defined(GL_POINT_SIZE_ARRAY_STRIDE_OES)
   1148         case GL_POINT_SIZE_ARRAY_STRIDE_OES:
   1149 #endif // defined(GL_POINT_SIZE_ARRAY_STRIDE_OES)
   1150 #if defined(GL_POINT_SIZE_ARRAY_TYPE_OES)
   1151         case GL_POINT_SIZE_ARRAY_TYPE_OES:
   1152 #endif // defined(GL_POINT_SIZE_ARRAY_TYPE_OES)
   1153 #if defined(GL_POINT_SMOOTH_HINT)
   1154         case GL_POINT_SMOOTH_HINT:
   1155 #endif // defined(GL_POINT_SMOOTH_HINT)
   1156 #if defined(GL_POLYGON_OFFSET_FACTOR)
   1157         case GL_POLYGON_OFFSET_FACTOR:
   1158 #endif // defined(GL_POLYGON_OFFSET_FACTOR)
   1159 #if defined(GL_POLYGON_OFFSET_UNITS)
   1160         case GL_POLYGON_OFFSET_UNITS:
   1161 #endif // defined(GL_POLYGON_OFFSET_UNITS)
   1162 #if defined(GL_PROJECTION_STACK_DEPTH)
   1163         case GL_PROJECTION_STACK_DEPTH:
   1164 #endif // defined(GL_PROJECTION_STACK_DEPTH)
   1165 #if defined(GL_RED_BITS)
   1166         case GL_RED_BITS:
   1167 #endif // defined(GL_RED_BITS)
   1168 #if defined(GL_SHADE_MODEL)
   1169         case GL_SHADE_MODEL:
   1170 #endif // defined(GL_SHADE_MODEL)
   1171 #if defined(GL_STENCIL_BITS)
   1172         case GL_STENCIL_BITS:
   1173 #endif // defined(GL_STENCIL_BITS)
   1174 #if defined(GL_STENCIL_CLEAR_VALUE)
   1175         case GL_STENCIL_CLEAR_VALUE:
   1176 #endif // defined(GL_STENCIL_CLEAR_VALUE)
   1177 #if defined(GL_STENCIL_FAIL)
   1178         case GL_STENCIL_FAIL:
   1179 #endif // defined(GL_STENCIL_FAIL)
   1180 #if defined(GL_STENCIL_FUNC)
   1181         case GL_STENCIL_FUNC:
   1182 #endif // defined(GL_STENCIL_FUNC)
   1183 #if defined(GL_STENCIL_PASS_DEPTH_FAIL)
   1184         case GL_STENCIL_PASS_DEPTH_FAIL:
   1185 #endif // defined(GL_STENCIL_PASS_DEPTH_FAIL)
   1186 #if defined(GL_STENCIL_PASS_DEPTH_PASS)
   1187         case GL_STENCIL_PASS_DEPTH_PASS:
   1188 #endif // defined(GL_STENCIL_PASS_DEPTH_PASS)
   1189 #if defined(GL_STENCIL_REF)
   1190         case GL_STENCIL_REF:
   1191 #endif // defined(GL_STENCIL_REF)
   1192 #if defined(GL_STENCIL_VALUE_MASK)
   1193         case GL_STENCIL_VALUE_MASK:
   1194 #endif // defined(GL_STENCIL_VALUE_MASK)
   1195 #if defined(GL_STENCIL_WRITEMASK)
   1196         case GL_STENCIL_WRITEMASK:
   1197 #endif // defined(GL_STENCIL_WRITEMASK)
   1198 #if defined(GL_SUBPIXEL_BITS)
   1199         case GL_SUBPIXEL_BITS:
   1200 #endif // defined(GL_SUBPIXEL_BITS)
   1201 #if defined(GL_TEXTURE_BINDING_2D)
   1202         case GL_TEXTURE_BINDING_2D:
   1203 #endif // defined(GL_TEXTURE_BINDING_2D)
   1204 #if defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)
   1205         case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
   1206 #endif // defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)
   1207 #if defined(GL_TEXTURE_COORD_ARRAY_SIZE)
   1208         case GL_TEXTURE_COORD_ARRAY_SIZE:
   1209 #endif // defined(GL_TEXTURE_COORD_ARRAY_SIZE)
   1210 #if defined(GL_TEXTURE_COORD_ARRAY_STRIDE)
   1211         case GL_TEXTURE_COORD_ARRAY_STRIDE:
   1212 #endif // defined(GL_TEXTURE_COORD_ARRAY_STRIDE)
   1213 #if defined(GL_TEXTURE_COORD_ARRAY_TYPE)
   1214         case GL_TEXTURE_COORD_ARRAY_TYPE:
   1215 #endif // defined(GL_TEXTURE_COORD_ARRAY_TYPE)
   1216 #if defined(GL_TEXTURE_STACK_DEPTH)
   1217         case GL_TEXTURE_STACK_DEPTH:
   1218 #endif // defined(GL_TEXTURE_STACK_DEPTH)
   1219 #if defined(GL_UNPACK_ALIGNMENT)
   1220         case GL_UNPACK_ALIGNMENT:
   1221 #endif // defined(GL_UNPACK_ALIGNMENT)
   1222 #if defined(GL_VERTEX_ARRAY_BUFFER_BINDING)
   1223         case GL_VERTEX_ARRAY_BUFFER_BINDING:
   1224 #endif // defined(GL_VERTEX_ARRAY_BUFFER_BINDING)
   1225 #if defined(GL_VERTEX_ARRAY_SIZE)
   1226         case GL_VERTEX_ARRAY_SIZE:
   1227 #endif // defined(GL_VERTEX_ARRAY_SIZE)
   1228 #if defined(GL_VERTEX_ARRAY_STRIDE)
   1229         case GL_VERTEX_ARRAY_STRIDE:
   1230 #endif // defined(GL_VERTEX_ARRAY_STRIDE)
   1231 #if defined(GL_VERTEX_ARRAY_TYPE)
   1232         case GL_VERTEX_ARRAY_TYPE:
   1233 #endif // defined(GL_VERTEX_ARRAY_TYPE)
   1234 #if defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES)
   1235         case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES:
   1236 #endif // defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES)
   1237 #if defined(GL_WEIGHT_ARRAY_SIZE_OES)
   1238         case GL_WEIGHT_ARRAY_SIZE_OES:
   1239 #endif // defined(GL_WEIGHT_ARRAY_SIZE_OES)
   1240 #if defined(GL_WEIGHT_ARRAY_STRIDE_OES)
   1241         case GL_WEIGHT_ARRAY_STRIDE_OES:
   1242 #endif // defined(GL_WEIGHT_ARRAY_STRIDE_OES)
   1243 #if defined(GL_WEIGHT_ARRAY_TYPE_OES)
   1244         case GL_WEIGHT_ARRAY_TYPE_OES:
   1245 #endif // defined(GL_WEIGHT_ARRAY_TYPE_OES)
   1246             _needed = 1;
   1247             break;
   1248 #if defined(GL_ALIASED_POINT_SIZE_RANGE)
   1249         case GL_ALIASED_POINT_SIZE_RANGE:
   1250 #endif // defined(GL_ALIASED_POINT_SIZE_RANGE)
   1251 #if defined(GL_ALIASED_LINE_WIDTH_RANGE)
   1252         case GL_ALIASED_LINE_WIDTH_RANGE:
   1253 #endif // defined(GL_ALIASED_LINE_WIDTH_RANGE)
   1254 #if defined(GL_DEPTH_RANGE)
   1255         case GL_DEPTH_RANGE:
   1256 #endif // defined(GL_DEPTH_RANGE)
   1257 #if defined(GL_MAX_VIEWPORT_DIMS)
   1258         case GL_MAX_VIEWPORT_DIMS:
   1259 #endif // defined(GL_MAX_VIEWPORT_DIMS)
   1260 #if defined(GL_SMOOTH_LINE_WIDTH_RANGE)
   1261         case GL_SMOOTH_LINE_WIDTH_RANGE:
   1262 #endif // defined(GL_SMOOTH_LINE_WIDTH_RANGE)
   1263 #if defined(GL_SMOOTH_POINT_SIZE_RANGE)
   1264         case GL_SMOOTH_POINT_SIZE_RANGE:
   1265 #endif // defined(GL_SMOOTH_POINT_SIZE_RANGE)
   1266             _needed = 2;
   1267             break;
   1268 #if defined(GL_COLOR_CLEAR_VALUE)
   1269         case GL_COLOR_CLEAR_VALUE:
   1270 #endif // defined(GL_COLOR_CLEAR_VALUE)
   1271 #if defined(GL_COLOR_WRITEMASK)
   1272         case GL_COLOR_WRITEMASK:
   1273 #endif // defined(GL_COLOR_WRITEMASK)
   1274 #if defined(GL_FOG_COLOR)
   1275         case GL_FOG_COLOR:
   1276 #endif // defined(GL_FOG_COLOR)
   1277 #if defined(GL_LIGHT_MODEL_AMBIENT)
   1278         case GL_LIGHT_MODEL_AMBIENT:
   1279 #endif // defined(GL_LIGHT_MODEL_AMBIENT)
   1280 #if defined(GL_SCISSOR_BOX)
   1281         case GL_SCISSOR_BOX:
   1282 #endif // defined(GL_SCISSOR_BOX)
   1283 #if defined(GL_VIEWPORT)
   1284         case GL_VIEWPORT:
   1285 #endif // defined(GL_VIEWPORT)
   1286             _needed = 4;
   1287             break;
   1288 #if defined(GL_MODELVIEW_MATRIX)
   1289         case GL_MODELVIEW_MATRIX:
   1290 #endif // defined(GL_MODELVIEW_MATRIX)
   1291 #if defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES)
   1292         case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES:
   1293 #endif // defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES)
   1294 #if defined(GL_PROJECTION_MATRIX)
   1295         case GL_PROJECTION_MATRIX:
   1296 #endif // defined(GL_PROJECTION_MATRIX)
   1297 #if defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES)
   1298         case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES:
   1299 #endif // defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES)
   1300 #if defined(GL_TEXTURE_MATRIX)
   1301         case GL_TEXTURE_MATRIX:
   1302 #endif // defined(GL_TEXTURE_MATRIX)
   1303 #if defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES)
   1304         case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES:
   1305 #endif // defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES)
   1306             _needed = 16;
   1307             break;
   1308 #if defined(GL_COMPRESSED_TEXTURE_FORMATS)
   1309         case GL_COMPRESSED_TEXTURE_FORMATS:
   1310 #endif // defined(GL_COMPRESSED_TEXTURE_FORMATS)
   1311             _needed = getNumCompressedTextureFormats();
   1312             break;
   1313         default:
   1314             _needed = 0;
   1315             break;
   1316     }
   1317     if (_remaining < _needed) {
   1318         _exception = 1;
   1319         _env->ThrowNew(IAEClass, "length - offset < needed");
   1320         goto exit;
   1321     }
   1322     params_base = (GLint *)
   1323         _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
   1324     params = params_base + offset;
   1325 
   1326     glGetIntegerv(
   1327         (GLenum)pname,
   1328         (GLint *)params
   1329     );
   1330 
   1331 exit:
   1332     if (params_base) {
   1333         _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
   1334             _exception ? JNI_ABORT: 0);
   1335     }
   1336 }
   1337 
   1338 /* void glGetIntegerv ( GLenum pname, GLint *params ) */
   1339 static void
   1340 android_glGetIntegerv__ILjava_nio_IntBuffer_2
   1341   (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
   1342     jint _exception = 0;
   1343     jarray _array = (jarray) 0;
   1344     jint _remaining;
   1345     GLint *params = (GLint *) 0;
   1346 
   1347     params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
   1348     int _needed;
   1349     switch (pname) {
   1350 #if defined(GL_ALPHA_BITS)
   1351         case GL_ALPHA_BITS:
   1352 #endif // defined(GL_ALPHA_BITS)
   1353 #if defined(GL_ALPHA_TEST_FUNC)
   1354         case GL_ALPHA_TEST_FUNC:
   1355 #endif // defined(GL_ALPHA_TEST_FUNC)
   1356 #if defined(GL_ALPHA_TEST_REF)
   1357         case GL_ALPHA_TEST_REF:
   1358 #endif // defined(GL_ALPHA_TEST_REF)
   1359 #if defined(GL_BLEND_DST)
   1360         case GL_BLEND_DST:
   1361 #endif // defined(GL_BLEND_DST)
   1362 #if defined(GL_BLUE_BITS)
   1363         case GL_BLUE_BITS:
   1364 #endif // defined(GL_BLUE_BITS)
   1365 #if defined(GL_COLOR_ARRAY_BUFFER_BINDING)
   1366         case GL_COLOR_ARRAY_BUFFER_BINDING:
   1367 #endif // defined(GL_COLOR_ARRAY_BUFFER_BINDING)
   1368 #if defined(GL_COLOR_ARRAY_SIZE)
   1369         case GL_COLOR_ARRAY_SIZE:
   1370 #endif // defined(GL_COLOR_ARRAY_SIZE)
   1371 #if defined(GL_COLOR_ARRAY_STRIDE)
   1372         case GL_COLOR_ARRAY_STRIDE:
   1373 #endif // defined(GL_COLOR_ARRAY_STRIDE)
   1374 #if defined(GL_COLOR_ARRAY_TYPE)
   1375         case GL_COLOR_ARRAY_TYPE:
   1376 #endif // defined(GL_COLOR_ARRAY_TYPE)
   1377 #if defined(GL_CULL_FACE)
   1378         case GL_CULL_FACE:
   1379 #endif // defined(GL_CULL_FACE)
   1380 #if defined(GL_DEPTH_BITS)
   1381         case GL_DEPTH_BITS:
   1382 #endif // defined(GL_DEPTH_BITS)
   1383 #if defined(GL_DEPTH_CLEAR_VALUE)
   1384         case GL_DEPTH_CLEAR_VALUE:
   1385 #endif // defined(GL_DEPTH_CLEAR_VALUE)
   1386 #if defined(GL_DEPTH_FUNC)
   1387         case GL_DEPTH_FUNC:
   1388 #endif // defined(GL_DEPTH_FUNC)
   1389 #if defined(GL_DEPTH_WRITEMASK)
   1390         case GL_DEPTH_WRITEMASK:
   1391 #endif // defined(GL_DEPTH_WRITEMASK)
   1392 #if defined(GL_FOG_DENSITY)
   1393         case GL_FOG_DENSITY:
   1394 #endif // defined(GL_FOG_DENSITY)
   1395 #if defined(GL_FOG_END)
   1396         case GL_FOG_END:
   1397 #endif // defined(GL_FOG_END)
   1398 #if defined(GL_FOG_MODE)
   1399         case GL_FOG_MODE:
   1400 #endif // defined(GL_FOG_MODE)
   1401 #if defined(GL_FOG_START)
   1402         case GL_FOG_START:
   1403 #endif // defined(GL_FOG_START)
   1404 #if defined(GL_FRONT_FACE)
   1405         case GL_FRONT_FACE:
   1406 #endif // defined(GL_FRONT_FACE)
   1407 #if defined(GL_GREEN_BITS)
   1408         case GL_GREEN_BITS:
   1409 #endif // defined(GL_GREEN_BITS)
   1410 #if defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)
   1411         case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
   1412 #endif // defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)
   1413 #if defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)
   1414         case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
   1415 #endif // defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)
   1416 #if defined(GL_LIGHT_MODEL_COLOR_CONTROL)
   1417         case GL_LIGHT_MODEL_COLOR_CONTROL:
   1418 #endif // defined(GL_LIGHT_MODEL_COLOR_CONTROL)
   1419 #if defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
   1420         case GL_LIGHT_MODEL_LOCAL_VIEWER:
   1421 #endif // defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
   1422 #if defined(GL_LIGHT_MODEL_TWO_SIDE)
   1423         case GL_LIGHT_MODEL_TWO_SIDE:
   1424 #endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
   1425 #if defined(GL_LINE_SMOOTH_HINT)
   1426         case GL_LINE_SMOOTH_HINT:
   1427 #endif // defined(GL_LINE_SMOOTH_HINT)
   1428 #if defined(GL_LINE_WIDTH)
   1429         case GL_LINE_WIDTH:
   1430 #endif // defined(GL_LINE_WIDTH)
   1431 #if defined(GL_LOGIC_OP_MODE)
   1432         case GL_LOGIC_OP_MODE:
   1433 #endif // defined(GL_LOGIC_OP_MODE)
   1434 #if defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES)
   1435         case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES:
   1436 #endif // defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES)
   1437 #if defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES)
   1438         case GL_MATRIX_INDEX_ARRAY_SIZE_OES:
   1439 #endif // defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES)
   1440 #if defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES)
   1441         case GL_MATRIX_INDEX_ARRAY_STRIDE_OES:
   1442 #endif // defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES)
   1443 #if defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES)
   1444         case GL_MATRIX_INDEX_ARRAY_TYPE_OES:
   1445 #endif // defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES)
   1446 #if defined(GL_MATRIX_MODE)
   1447         case GL_MATRIX_MODE:
   1448 #endif // defined(GL_MATRIX_MODE)
   1449 #if defined(GL_MAX_CLIP_PLANES)
   1450         case GL_MAX_CLIP_PLANES:
   1451 #endif // defined(GL_MAX_CLIP_PLANES)
   1452 #if defined(GL_MAX_ELEMENTS_INDICES)
   1453         case GL_MAX_ELEMENTS_INDICES:
   1454 #endif // defined(GL_MAX_ELEMENTS_INDICES)
   1455 #if defined(GL_MAX_ELEMENTS_VERTICES)
   1456         case GL_MAX_ELEMENTS_VERTICES:
   1457 #endif // defined(GL_MAX_ELEMENTS_VERTICES)
   1458 #if defined(GL_MAX_LIGHTS)
   1459         case GL_MAX_LIGHTS:
   1460 #endif // defined(GL_MAX_LIGHTS)
   1461 #if defined(GL_MAX_MODELVIEW_STACK_DEPTH)
   1462         case GL_MAX_MODELVIEW_STACK_DEPTH:
   1463 #endif // defined(GL_MAX_MODELVIEW_STACK_DEPTH)
   1464 #if defined(GL_MAX_PALETTE_MATRICES_OES)
   1465         case GL_MAX_PALETTE_MATRICES_OES:
   1466 #endif // defined(GL_MAX_PALETTE_MATRICES_OES)
   1467 #if defined(GL_MAX_PROJECTION_STACK_DEPTH)
   1468         case GL_MAX_PROJECTION_STACK_DEPTH:
   1469 #endif // defined(GL_MAX_PROJECTION_STACK_DEPTH)
   1470 #if defined(GL_MAX_TEXTURE_SIZE)
   1471         case GL_MAX_TEXTURE_SIZE:
   1472 #endif // defined(GL_MAX_TEXTURE_SIZE)
   1473 #if defined(GL_MAX_TEXTURE_STACK_DEPTH)
   1474         case GL_MAX_TEXTURE_STACK_DEPTH:
   1475 #endif // defined(GL_MAX_TEXTURE_STACK_DEPTH)
   1476 #if defined(GL_MAX_TEXTURE_UNITS)
   1477         case GL_MAX_TEXTURE_UNITS:
   1478 #endif // defined(GL_MAX_TEXTURE_UNITS)
   1479 #if defined(GL_MAX_VERTEX_UNITS_OES)
   1480         case GL_MAX_VERTEX_UNITS_OES:
   1481 #endif // defined(GL_MAX_VERTEX_UNITS_OES)
   1482 #if defined(GL_MODELVIEW_STACK_DEPTH)
   1483         case GL_MODELVIEW_STACK_DEPTH:
   1484 #endif // defined(GL_MODELVIEW_STACK_DEPTH)
   1485 #if defined(GL_NORMAL_ARRAY_BUFFER_BINDING)
   1486         case GL_NORMAL_ARRAY_BUFFER_BINDING:
   1487 #endif // defined(GL_NORMAL_ARRAY_BUFFER_BINDING)
   1488 #if defined(GL_NORMAL_ARRAY_STRIDE)
   1489         case GL_NORMAL_ARRAY_STRIDE:
   1490 #endif // defined(GL_NORMAL_ARRAY_STRIDE)
   1491 #if defined(GL_NORMAL_ARRAY_TYPE)
   1492         case GL_NORMAL_ARRAY_TYPE:
   1493 #endif // defined(GL_NORMAL_ARRAY_TYPE)
   1494 #if defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
   1495         case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
   1496 #endif // defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
   1497 #if defined(GL_PACK_ALIGNMENT)
   1498         case GL_PACK_ALIGNMENT:
   1499 #endif // defined(GL_PACK_ALIGNMENT)
   1500 #if defined(GL_PERSPECTIVE_CORRECTION_HINT)
   1501         case GL_PERSPECTIVE_CORRECTION_HINT:
   1502 #endif // defined(GL_PERSPECTIVE_CORRECTION_HINT)
   1503 #if defined(GL_POINT_SIZE)
   1504         case GL_POINT_SIZE:
   1505 #endif // defined(GL_POINT_SIZE)
   1506 #if defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES)
   1507         case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
   1508 #endif // defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES)
   1509 #if defined(GL_POINT_SIZE_ARRAY_STRIDE_OES)
   1510         case GL_POINT_SIZE_ARRAY_STRIDE_OES:
   1511 #endif // defined(GL_POINT_SIZE_ARRAY_STRIDE_OES)
   1512 #if defined(GL_POINT_SIZE_ARRAY_TYPE_OES)
   1513         case GL_POINT_SIZE_ARRAY_TYPE_OES:
   1514 #endif // defined(GL_POINT_SIZE_ARRAY_TYPE_OES)
   1515 #if defined(GL_POINT_SMOOTH_HINT)
   1516         case GL_POINT_SMOOTH_HINT:
   1517 #endif // defined(GL_POINT_SMOOTH_HINT)
   1518 #if defined(GL_POLYGON_OFFSET_FACTOR)
   1519         case GL_POLYGON_OFFSET_FACTOR:
   1520 #endif // defined(GL_POLYGON_OFFSET_FACTOR)
   1521 #if defined(GL_POLYGON_OFFSET_UNITS)
   1522         case GL_POLYGON_OFFSET_UNITS:
   1523 #endif // defined(GL_POLYGON_OFFSET_UNITS)
   1524 #if defined(GL_PROJECTION_STACK_DEPTH)
   1525         case GL_PROJECTION_STACK_DEPTH:
   1526 #endif // defined(GL_PROJECTION_STACK_DEPTH)
   1527 #if defined(GL_RED_BITS)
   1528         case GL_RED_BITS:
   1529 #endif // defined(GL_RED_BITS)
   1530 #if defined(GL_SHADE_MODEL)
   1531         case GL_SHADE_MODEL:
   1532 #endif // defined(GL_SHADE_MODEL)
   1533 #if defined(GL_STENCIL_BITS)
   1534         case GL_STENCIL_BITS:
   1535 #endif // defined(GL_STENCIL_BITS)
   1536 #if defined(GL_STENCIL_CLEAR_VALUE)
   1537         case GL_STENCIL_CLEAR_VALUE:
   1538 #endif // defined(GL_STENCIL_CLEAR_VALUE)
   1539 #if defined(GL_STENCIL_FAIL)
   1540         case GL_STENCIL_FAIL:
   1541 #endif // defined(GL_STENCIL_FAIL)
   1542 #if defined(GL_STENCIL_FUNC)
   1543         case GL_STENCIL_FUNC:
   1544 #endif // defined(GL_STENCIL_FUNC)
   1545 #if defined(GL_STENCIL_PASS_DEPTH_FAIL)
   1546         case GL_STENCIL_PASS_DEPTH_FAIL:
   1547 #endif // defined(GL_STENCIL_PASS_DEPTH_FAIL)
   1548 #if defined(GL_STENCIL_PASS_DEPTH_PASS)
   1549         case GL_STENCIL_PASS_DEPTH_PASS:
   1550 #endif // defined(GL_STENCIL_PASS_DEPTH_PASS)
   1551 #if defined(GL_STENCIL_REF)
   1552         case GL_STENCIL_REF:
   1553 #endif // defined(GL_STENCIL_REF)
   1554 #if defined(GL_STENCIL_VALUE_MASK)
   1555         case GL_STENCIL_VALUE_MASK:
   1556 #endif // defined(GL_STENCIL_VALUE_MASK)
   1557 #if defined(GL_STENCIL_WRITEMASK)
   1558         case GL_STENCIL_WRITEMASK:
   1559 #endif // defined(GL_STENCIL_WRITEMASK)
   1560 #if defined(GL_SUBPIXEL_BITS)
   1561         case GL_SUBPIXEL_BITS:
   1562 #endif // defined(GL_SUBPIXEL_BITS)
   1563 #if defined(GL_TEXTURE_BINDING_2D)
   1564         case GL_TEXTURE_BINDING_2D:
   1565 #endif // defined(GL_TEXTURE_BINDING_2D)
   1566 #if defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)
   1567         case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
   1568 #endif // defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)
   1569 #if defined(GL_TEXTURE_COORD_ARRAY_SIZE)
   1570         case GL_TEXTURE_COORD_ARRAY_SIZE:
   1571 #endif // defined(GL_TEXTURE_COORD_ARRAY_SIZE)
   1572 #if defined(GL_TEXTURE_COORD_ARRAY_STRIDE)
   1573         case GL_TEXTURE_COORD_ARRAY_STRIDE:
   1574 #endif // defined(GL_TEXTURE_COORD_ARRAY_STRIDE)
   1575 #if defined(GL_TEXTURE_COORD_ARRAY_TYPE)
   1576         case GL_TEXTURE_COORD_ARRAY_TYPE:
   1577 #endif // defined(GL_TEXTURE_COORD_ARRAY_TYPE)
   1578 #if defined(GL_TEXTURE_STACK_DEPTH)
   1579         case GL_TEXTURE_STACK_DEPTH:
   1580 #endif // defined(GL_TEXTURE_STACK_DEPTH)
   1581 #if defined(GL_UNPACK_ALIGNMENT)
   1582         case GL_UNPACK_ALIGNMENT:
   1583 #endif // defined(GL_UNPACK_ALIGNMENT)
   1584 #if defined(GL_VERTEX_ARRAY_BUFFER_BINDING)
   1585         case GL_VERTEX_ARRAY_BUFFER_BINDING:
   1586 #endif // defined(GL_VERTEX_ARRAY_BUFFER_BINDING)
   1587 #if defined(GL_VERTEX_ARRAY_SIZE)
   1588         case GL_VERTEX_ARRAY_SIZE:
   1589 #endif // defined(GL_VERTEX_ARRAY_SIZE)
   1590 #if defined(GL_VERTEX_ARRAY_STRIDE)
   1591         case GL_VERTEX_ARRAY_STRIDE:
   1592 #endif // defined(GL_VERTEX_ARRAY_STRIDE)
   1593 #if defined(GL_VERTEX_ARRAY_TYPE)
   1594         case GL_VERTEX_ARRAY_TYPE:
   1595 #endif // defined(GL_VERTEX_ARRAY_TYPE)
   1596 #if defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES)
   1597         case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES:
   1598 #endif // defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES)
   1599 #if defined(GL_WEIGHT_ARRAY_SIZE_OES)
   1600         case GL_WEIGHT_ARRAY_SIZE_OES:
   1601 #endif // defined(GL_WEIGHT_ARRAY_SIZE_OES)
   1602 #if defined(GL_WEIGHT_ARRAY_STRIDE_OES)
   1603         case GL_WEIGHT_ARRAY_STRIDE_OES:
   1604 #endif // defined(GL_WEIGHT_ARRAY_STRIDE_OES)
   1605 #if defined(GL_WEIGHT_ARRAY_TYPE_OES)
   1606         case GL_WEIGHT_ARRAY_TYPE_OES:
   1607 #endif // defined(GL_WEIGHT_ARRAY_TYPE_OES)
   1608             _needed = 1;
   1609             break;
   1610 #if defined(GL_ALIASED_POINT_SIZE_RANGE)
   1611         case GL_ALIASED_POINT_SIZE_RANGE:
   1612 #endif // defined(GL_ALIASED_POINT_SIZE_RANGE)
   1613 #if defined(GL_ALIASED_LINE_WIDTH_RANGE)
   1614         case GL_ALIASED_LINE_WIDTH_RANGE:
   1615 #endif // defined(GL_ALIASED_LINE_WIDTH_RANGE)
   1616 #if defined(GL_DEPTH_RANGE)
   1617         case GL_DEPTH_RANGE:
   1618 #endif // defined(GL_DEPTH_RANGE)
   1619 #if defined(GL_MAX_VIEWPORT_DIMS)
   1620         case GL_MAX_VIEWPORT_DIMS:
   1621 #endif // defined(GL_MAX_VIEWPORT_DIMS)
   1622 #if defined(GL_SMOOTH_LINE_WIDTH_RANGE)
   1623         case GL_SMOOTH_LINE_WIDTH_RANGE:
   1624 #endif // defined(GL_SMOOTH_LINE_WIDTH_RANGE)
   1625 #if defined(GL_SMOOTH_POINT_SIZE_RANGE)
   1626         case GL_SMOOTH_POINT_SIZE_RANGE:
   1627 #endif // defined(GL_SMOOTH_POINT_SIZE_RANGE)
   1628             _needed = 2;
   1629             break;
   1630 #if defined(GL_COLOR_CLEAR_VALUE)
   1631         case GL_COLOR_CLEAR_VALUE:
   1632 #endif // defined(GL_COLOR_CLEAR_VALUE)
   1633 #if defined(GL_COLOR_WRITEMASK)
   1634         case GL_COLOR_WRITEMASK:
   1635 #endif // defined(GL_COLOR_WRITEMASK)
   1636 #if defined(GL_FOG_COLOR)
   1637         case GL_FOG_COLOR:
   1638 #endif // defined(GL_FOG_COLOR)
   1639 #if defined(GL_LIGHT_MODEL_AMBIENT)
   1640         case GL_LIGHT_MODEL_AMBIENT:
   1641 #endif // defined(GL_LIGHT_MODEL_AMBIENT)
   1642 #if defined(GL_SCISSOR_BOX)
   1643         case GL_SCISSOR_BOX:
   1644 #endif // defined(GL_SCISSOR_BOX)
   1645 #if defined(GL_VIEWPORT)
   1646         case GL_VIEWPORT:
   1647 #endif // defined(GL_VIEWPORT)
   1648             _needed = 4;
   1649             break;
   1650 #if defined(GL_MODELVIEW_MATRIX)
   1651         case GL_MODELVIEW_MATRIX:
   1652 #endif // defined(GL_MODELVIEW_MATRIX)
   1653 #if defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES)
   1654         case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES:
   1655 #endif // defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES)
   1656 #if defined(GL_PROJECTION_MATRIX)
   1657         case GL_PROJECTION_MATRIX:
   1658 #endif // defined(GL_PROJECTION_MATRIX)
   1659 #if defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES)
   1660         case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES:
   1661 #endif // defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES)
   1662 #if defined(GL_TEXTURE_MATRIX)
   1663         case GL_TEXTURE_MATRIX:
   1664 #endif // defined(GL_TEXTURE_MATRIX)
   1665 #if defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES)
   1666         case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES:
   1667 #endif // defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES)
   1668             _needed = 16;
   1669             break;
   1670 #if defined(GL_COMPRESSED_TEXTURE_FORMATS)
   1671         case GL_COMPRESSED_TEXTURE_FORMATS:
   1672 #endif // defined(GL_COMPRESSED_TEXTURE_FORMATS)
   1673             _needed = getNumCompressedTextureFormats();
   1674             break;
   1675         default:
   1676             _needed = 0;
   1677             break;
   1678     }
   1679     if (_remaining < _needed) {
   1680         _exception = 1;
   1681         _env->ThrowNew(IAEClass, "remaining() < needed");
   1682         goto exit;
   1683     }
   1684     glGetIntegerv(
   1685         (GLenum)pname,
   1686         (GLint *)params
   1687     );
   1688 
   1689 exit:
   1690     if (_array) {
   1691         releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
   1692     }
   1693 }
   1694 
   1695 #include <string.h>
   1696 
   1697 /* const GLubyte * glGetString ( GLenum name ) */
   1698 static
   1699 jstring
   1700 android_glGetString
   1701   (JNIEnv *_env, jobject _this, jint name) {
   1702     const char * chars = (const char *)glGetString((GLenum)name);
   1703     jstring output = _env->NewStringUTF(chars);
   1704     return output;
   1705 }
   1706 /* void glHint ( GLenum target, GLenum mode ) */
   1707 static void
   1708 android_glHint__II
   1709   (JNIEnv *_env, jobject _this, jint target, jint mode) {
   1710     glHint(
   1711         (GLenum)target,
   1712         (GLenum)mode
   1713     );
   1714 }
   1715 
   1716 /* void glLightModelf ( GLenum pname, GLfloat param ) */
   1717 static void
   1718 android_glLightModelf__IF
   1719   (JNIEnv *_env, jobject _this, jint pname, jfloat param) {
   1720     glLightModelf(
   1721         (GLenum)pname,
   1722         (GLfloat)param
   1723     );
   1724 }
   1725 
   1726 /* void glLightModelfv ( GLenum pname, const GLfloat *params ) */
   1727 static void
   1728 android_glLightModelfv__I_3FI
   1729   (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
   1730     GLfloat *params_base = (GLfloat *) 0;
   1731     jint _remaining;
   1732     GLfloat *params = (GLfloat *) 0;
   1733 
   1734     if (!params_ref) {
   1735         _env->ThrowNew(IAEClass, "params == null");
   1736         goto exit;
   1737     }
   1738     if (offset < 0) {
   1739         _env->ThrowNew(IAEClass, "offset < 0");
   1740         goto exit;
   1741     }
   1742     _remaining = _env->GetArrayLength(params_ref) - offset;
   1743     int _needed;
   1744     switch (pname) {
   1745 #if defined(GL_LIGHT_MODEL_TWO_SIDE)
   1746         case GL_LIGHT_MODEL_TWO_SIDE:
   1747 #endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
   1748             _needed = 1;
   1749             break;
   1750 #if defined(GL_LIGHT_MODEL_AMBIENT)
   1751         case GL_LIGHT_MODEL_AMBIENT:
   1752 #endif // defined(GL_LIGHT_MODEL_AMBIENT)
   1753             _needed = 4;
   1754             break;
   1755         default:
   1756             _needed = 0;
   1757             break;
   1758     }
   1759     if (_remaining < _needed) {
   1760         _env->ThrowNew(IAEClass, "length - offset < needed");
   1761         goto exit;
   1762     }
   1763     params_base = (GLfloat *)
   1764         _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
   1765     params = params_base + offset;
   1766 
   1767     glLightModelfv(
   1768         (GLenum)pname,
   1769         (GLfloat *)params
   1770     );
   1771 
   1772 exit:
   1773     if (params_base) {
   1774         _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
   1775             JNI_ABORT);
   1776     }
   1777 }
   1778 
   1779 /* void glLightModelfv ( GLenum pname, const GLfloat *params ) */
   1780 static void
   1781 android_glLightModelfv__ILjava_nio_FloatBuffer_2
   1782   (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
   1783     jarray _array = (jarray) 0;
   1784     jint _remaining;
   1785     GLfloat *params = (GLfloat *) 0;
   1786 
   1787     params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
   1788     int _needed;
   1789     switch (pname) {
   1790 #if defined(GL_LIGHT_MODEL_TWO_SIDE)
   1791         case GL_LIGHT_MODEL_TWO_SIDE:
   1792 #endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
   1793             _needed = 1;
   1794             break;
   1795 #if defined(GL_LIGHT_MODEL_AMBIENT)
   1796         case GL_LIGHT_MODEL_AMBIENT:
   1797 #endif // defined(GL_LIGHT_MODEL_AMBIENT)
   1798             _needed = 4;
   1799             break;
   1800         default:
   1801             _needed = 0;
   1802             break;
   1803     }
   1804     if (_remaining < _needed) {
   1805         _env->ThrowNew(IAEClass, "remaining() < needed");
   1806         goto exit;
   1807     }
   1808     glLightModelfv(
   1809         (GLenum)pname,
   1810         (GLfloat *)params
   1811     );
   1812 
   1813 exit:
   1814     if (_array) {
   1815         releasePointer(_env, _array, params, JNI_FALSE);
   1816     }
   1817 }
   1818 
   1819 /* void glLightModelx ( GLenum pname, GLfixed param ) */
   1820 static void
   1821 android_glLightModelx__II
   1822   (JNIEnv *_env, jobject _this, jint pname, jint param) {
   1823     glLightModelx(
   1824         (GLenum)pname,
   1825         (GLfixed)param
   1826     );
   1827 }
   1828 
   1829 /* void glLightModelxv ( GLenum pname, const GLfixed *params ) */
   1830 static void
   1831 android_glLightModelxv__I_3II
   1832   (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
   1833     GLfixed *params_base = (GLfixed *) 0;
   1834     jint _remaining;
   1835     GLfixed *params = (GLfixed *) 0;
   1836 
   1837     if (!params_ref) {
   1838         _env->ThrowNew(IAEClass, "params == null");
   1839         goto exit;
   1840     }
   1841     if (offset < 0) {
   1842         _env->ThrowNew(IAEClass, "offset < 0");
   1843         goto exit;
   1844     }
   1845     _remaining = _env->GetArrayLength(params_ref) - offset;
   1846     int _needed;
   1847     switch (pname) {
   1848 #if defined(GL_LIGHT_MODEL_TWO_SIDE)
   1849         case GL_LIGHT_MODEL_TWO_SIDE:
   1850 #endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
   1851             _needed = 1;
   1852             break;
   1853 #if defined(GL_LIGHT_MODEL_AMBIENT)
   1854         case GL_LIGHT_MODEL_AMBIENT:
   1855 #endif // defined(GL_LIGHT_MODEL_AMBIENT)
   1856             _needed = 4;
   1857             break;
   1858         default:
   1859             _needed = 0;
   1860             break;
   1861     }
   1862     if (_remaining < _needed) {
   1863         _env->ThrowNew(IAEClass, "length - offset < needed");
   1864         goto exit;
   1865     }
   1866     params_base = (GLfixed *)
   1867         _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
   1868     params = params_base + offset;
   1869 
   1870     glLightModelxv(
   1871         (GLenum)pname,
   1872         (GLfixed *)params
   1873     );
   1874 
   1875 exit:
   1876     if (params_base) {
   1877         _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
   1878             JNI_ABORT);
   1879     }
   1880 }
   1881 
   1882 /* void glLightModelxv ( GLenum pname, const GLfixed *params ) */
   1883 static void
   1884 android_glLightModelxv__ILjava_nio_IntBuffer_2
   1885   (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
   1886     jarray _array = (jarray) 0;
   1887     jint _remaining;
   1888     GLfixed *params = (GLfixed *) 0;
   1889 
   1890     params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
   1891     int _needed;
   1892     switch (pname) {
   1893 #if defined(GL_LIGHT_MODEL_TWO_SIDE)
   1894         case GL_LIGHT_MODEL_TWO_SIDE:
   1895 #endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
   1896             _needed = 1;
   1897             break;
   1898 #if defined(GL_LIGHT_MODEL_AMBIENT)
   1899         case GL_LIGHT_MODEL_AMBIENT:
   1900 #endif // defined(GL_LIGHT_MODEL_AMBIENT)
   1901             _needed = 4;
   1902             break;
   1903         default:
   1904             _needed = 0;
   1905             break;
   1906     }
   1907     if (_remaining < _needed) {
   1908         _env->ThrowNew(IAEClass, "remaining() < needed");
   1909         goto exit;
   1910     }
   1911     glLightModelxv(
   1912         (GLenum)pname,
   1913         (GLfixed *)params
   1914     );
   1915 
   1916 exit:
   1917     if (_array) {
   1918         releasePointer(_env, _array, params, JNI_FALSE);
   1919     }
   1920 }
   1921 
   1922 /* void glLightf ( GLenum light, GLenum pname, GLfloat param ) */
   1923 static void
   1924 android_glLightf__IIF
   1925   (JNIEnv *_env, jobject _this, jint light, jint pname, jfloat param) {
   1926     glLightf(
   1927         (GLenum)light,
   1928         (GLenum)pname,
   1929         (GLfloat)param
   1930     );
   1931 }
   1932 
   1933 /* void glLightfv ( GLenum light, GLenum pname, const GLfloat *params ) */
   1934 static void
   1935 android_glLightfv__II_3FI
   1936   (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) {
   1937     GLfloat *params_base = (GLfloat *) 0;
   1938     jint _remaining;
   1939     GLfloat *params = (GLfloat *) 0;
   1940 
   1941     if (!params_ref) {
   1942         _env->ThrowNew(IAEClass, "params == null");
   1943         goto exit;
   1944     }
   1945     if (offset < 0) {
   1946         _env->ThrowNew(IAEClass, "offset < 0");
   1947         goto exit;
   1948     }
   1949     _remaining = _env->GetArrayLength(params_ref) - offset;
   1950     int _needed;
   1951     switch (pname) {
   1952 #if defined(GL_SPOT_EXPONENT)
   1953         case GL_SPOT_EXPONENT:
   1954 #endif // defined(GL_SPOT_EXPONENT)
   1955 #if defined(GL_SPOT_CUTOFF)
   1956         case GL_SPOT_CUTOFF:
   1957 #endif // defined(GL_SPOT_CUTOFF)
   1958 #if defined(GL_CONSTANT_ATTENUATION)
   1959         case GL_CONSTANT_ATTENUATION:
   1960 #endif // defined(GL_CONSTANT_ATTENUATION)
   1961 #if defined(GL_LINEAR_ATTENUATION)
   1962         case GL_LINEAR_ATTENUATION:
   1963 #endif // defined(GL_LINEAR_ATTENUATION)
   1964 #if defined(GL_QUADRATIC_ATTENUATION)
   1965         case GL_QUADRATIC_ATTENUATION:
   1966 #endif // defined(GL_QUADRATIC_ATTENUATION)
   1967             _needed = 1;
   1968             break;
   1969 #if defined(GL_SPOT_DIRECTION)
   1970         case GL_SPOT_DIRECTION:
   1971 #endif // defined(GL_SPOT_DIRECTION)
   1972             _needed = 3;
   1973             break;
   1974 #if defined(GL_AMBIENT)
   1975         case GL_AMBIENT:
   1976 #endif // defined(GL_AMBIENT)
   1977 #if defined(GL_DIFFUSE)
   1978         case GL_DIFFUSE:
   1979 #endif // defined(GL_DIFFUSE)
   1980 #if defined(GL_SPECULAR)
   1981         case GL_SPECULAR:
   1982 #endif // defined(GL_SPECULAR)
   1983 #if defined(GL_EMISSION)
   1984         case GL_EMISSION:
   1985 #endif // defined(GL_EMISSION)
   1986             _needed = 4;
   1987             break;
   1988         default:
   1989             _needed = 0;
   1990             break;
   1991     }
   1992     if (_remaining < _needed) {
   1993         _env->ThrowNew(IAEClass, "length - offset < needed");
   1994         goto exit;
   1995     }
   1996     params_base = (GLfloat *)
   1997         _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
   1998     params = params_base + offset;
   1999 
   2000     glLightfv(
   2001         (GLenum)light,
   2002         (GLenum)pname,
   2003         (GLfloat *)params
   2004     );
   2005 
   2006 exit:
   2007     if (params_base) {
   2008         _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
   2009             JNI_ABORT);
   2010     }
   2011 }
   2012 
   2013 /* void glLightfv ( GLenum light, GLenum pname, const GLfloat *params ) */
   2014 static void
   2015 android_glLightfv__IILjava_nio_FloatBuffer_2
   2016   (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
   2017     jarray _array = (jarray) 0;
   2018     jint _remaining;
   2019     GLfloat *params = (GLfloat *) 0;
   2020 
   2021     params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
   2022     int _needed;
   2023     switch (pname) {
   2024 #if defined(GL_SPOT_EXPONENT)
   2025         case GL_SPOT_EXPONENT:
   2026 #endif // defined(GL_SPOT_EXPONENT)
   2027 #if defined(GL_SPOT_CUTOFF)
   2028         case GL_SPOT_CUTOFF:
   2029 #endif // defined(GL_SPOT_CUTOFF)
   2030 #if defined(GL_CONSTANT_ATTENUATION)
   2031         case GL_CONSTANT_ATTENUATION:
   2032 #endif // defined(GL_CONSTANT_ATTENUATION)
   2033 #if defined(GL_LINEAR_ATTENUATION)
   2034         case GL_LINEAR_ATTENUATION:
   2035 #endif // defined(GL_LINEAR_ATTENUATION)
   2036 #if defined(GL_QUADRATIC_ATTENUATION)
   2037         case GL_QUADRATIC_ATTENUATION:
   2038 #endif // defined(GL_QUADRATIC_ATTENUATION)
   2039             _needed = 1;
   2040             break;
   2041 #if defined(GL_SPOT_DIRECTION)
   2042         case GL_SPOT_DIRECTION:
   2043 #endif // defined(GL_SPOT_DIRECTION)
   2044             _needed = 3;
   2045             break;
   2046 #if defined(GL_AMBIENT)
   2047         case GL_AMBIENT:
   2048 #endif // defined(GL_AMBIENT)
   2049 #if defined(GL_DIFFUSE)
   2050         case GL_DIFFUSE:
   2051 #endif // defined(GL_DIFFUSE)
   2052 #if defined(GL_SPECULAR)
   2053         case GL_SPECULAR:
   2054 #endif // defined(GL_SPECULAR)
   2055 #if defined(GL_EMISSION)
   2056         case GL_EMISSION:
   2057 #endif // defined(GL_EMISSION)
   2058             _needed = 4;
   2059             break;
   2060         default:
   2061             _needed = 0;
   2062             break;
   2063     }
   2064     if (_remaining < _needed) {
   2065         _env->ThrowNew(IAEClass, "remaining() < needed");
   2066         goto exit;
   2067     }
   2068     glLightfv(
   2069         (GLenum)light,
   2070         (GLenum)pname,
   2071         (GLfloat *)params
   2072     );
   2073 
   2074 exit:
   2075     if (_array) {
   2076         releasePointer(_env, _array, params, JNI_FALSE);
   2077     }
   2078 }
   2079 
   2080 /* void glLightx ( GLenum light, GLenum pname, GLfixed param ) */
   2081 static void
   2082 android_glLightx__III
   2083   (JNIEnv *_env, jobject _this, jint light, jint pname, jint param) {
   2084     glLightx(
   2085         (GLenum)light,
   2086         (GLenum)pname,
   2087         (GLfixed)param
   2088     );
   2089 }
   2090 
   2091 /* void glLightxv ( GLenum light, GLenum pname, const GLfixed *params ) */
   2092 static void
   2093 android_glLightxv__II_3II
   2094   (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) {
   2095     GLfixed *params_base = (GLfixed *) 0;
   2096     jint _remaining;
   2097     GLfixed *params = (GLfixed *) 0;
   2098 
   2099     if (!params_ref) {
   2100         _env->ThrowNew(IAEClass, "params == null");
   2101         goto exit;
   2102     }
   2103     if (offset < 0) {
   2104         _env->ThrowNew(IAEClass, "offset < 0");
   2105         goto exit;
   2106     }
   2107     _remaining = _env->GetArrayLength(params_ref) - offset;
   2108     int _needed;
   2109     switch (pname) {
   2110 #if defined(GL_SPOT_EXPONENT)
   2111         case GL_SPOT_EXPONENT:
   2112 #endif // defined(GL_SPOT_EXPONENT)
   2113 #if defined(GL_SPOT_CUTOFF)
   2114         case GL_SPOT_CUTOFF:
   2115 #endif // defined(GL_SPOT_CUTOFF)
   2116 #if defined(GL_CONSTANT_ATTENUATION)
   2117         case GL_CONSTANT_ATTENUATION:
   2118 #endif // defined(GL_CONSTANT_ATTENUATION)
   2119 #if defined(GL_LINEAR_ATTENUATION)
   2120         case GL_LINEAR_ATTENUATION:
   2121 #endif // defined(GL_LINEAR_ATTENUATION)
   2122 #if defined(GL_QUADRATIC_ATTENUATION)
   2123         case GL_QUADRATIC_ATTENUATION:
   2124 #endif // defined(GL_QUADRATIC_ATTENUATION)
   2125             _needed = 1;
   2126             break;
   2127 #if defined(GL_SPOT_DIRECTION)
   2128         case GL_SPOT_DIRECTION:
   2129 #endif // defined(GL_SPOT_DIRECTION)
   2130             _needed = 3;
   2131             break;
   2132 #if defined(GL_AMBIENT)
   2133         case GL_AMBIENT:
   2134 #endif // defined(GL_AMBIENT)
   2135 #if defined(GL_DIFFUSE)
   2136         case GL_DIFFUSE:
   2137 #endif // defined(GL_DIFFUSE)
   2138 #if defined(GL_SPECULAR)
   2139         case GL_SPECULAR:
   2140 #endif // defined(GL_SPECULAR)
   2141 #if defined(GL_EMISSION)
   2142         case GL_EMISSION:
   2143 #endif // defined(GL_EMISSION)
   2144             _needed = 4;
   2145             break;
   2146         default:
   2147             _needed = 0;
   2148             break;
   2149     }
   2150     if (_remaining < _needed) {
   2151         _env->ThrowNew(IAEClass, "length - offset < needed");
   2152         goto exit;
   2153     }
   2154     params_base = (GLfixed *)
   2155         _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
   2156     params = params_base + offset;
   2157 
   2158     glLightxv(
   2159         (GLenum)light,
   2160         (GLenum)pname,
   2161         (GLfixed *)params
   2162     );
   2163 
   2164 exit:
   2165     if (params_base) {
   2166         _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
   2167             JNI_ABORT);
   2168     }
   2169 }
   2170 
   2171 /* void glLightxv ( GLenum light, GLenum pname, const GLfixed *params ) */
   2172 static void
   2173 android_glLightxv__IILjava_nio_IntBuffer_2
   2174   (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
   2175     jarray _array = (jarray) 0;
   2176     jint _remaining;
   2177     GLfixed *params = (GLfixed *) 0;
   2178 
   2179     params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
   2180     int _needed;
   2181     switch (pname) {
   2182 #if defined(GL_SPOT_EXPONENT)
   2183         case GL_SPOT_EXPONENT:
   2184 #endif // defined(GL_SPOT_EXPONENT)
   2185 #if defined(GL_SPOT_CUTOFF)
   2186         case GL_SPOT_CUTOFF:
   2187 #endif // defined(GL_SPOT_CUTOFF)
   2188 #if defined(GL_CONSTANT_ATTENUATION)
   2189         case GL_CONSTANT_ATTENUATION:
   2190 #endif // defined(GL_CONSTANT_ATTENUATION)
   2191 #if defined(GL_LINEAR_ATTENUATION)
   2192         case GL_LINEAR_ATTENUATION:
   2193 #endif // defined(GL_LINEAR_ATTENUATION)
   2194 #if defined(GL_QUADRATIC_ATTENUATION)
   2195         case GL_QUADRATIC_ATTENUATION:
   2196 #endif // defined(GL_QUADRATIC_ATTENUATION)
   2197             _needed = 1;
   2198             break;
   2199 #if defined(GL_SPOT_DIRECTION)
   2200         case GL_SPOT_DIRECTION:
   2201 #endif // defined(GL_SPOT_DIRECTION)
   2202             _needed = 3;
   2203             break;
   2204 #if defined(GL_AMBIENT)
   2205         case GL_AMBIENT:
   2206 #endif // defined(GL_AMBIENT)
   2207 #if defined(GL_DIFFUSE)
   2208         case GL_DIFFUSE:
   2209 #endif // defined(GL_DIFFUSE)
   2210 #if defined(GL_SPECULAR)
   2211         case GL_SPECULAR:
   2212 #endif // defined(GL_SPECULAR)
   2213 #if defined(GL_EMISSION)
   2214         case GL_EMISSION:
   2215 #endif // defined(GL_EMISSION)
   2216             _needed = 4;
   2217             break;
   2218         default:
   2219             _needed = 0;
   2220             break;
   2221     }
   2222     if (_remaining < _needed) {
   2223         _env->ThrowNew(IAEClass, "remaining() < needed");
   2224         goto exit;
   2225     }
   2226     glLightxv(
   2227         (GLenum)light,
   2228         (GLenum)pname,
   2229         (GLfixed *)params
   2230     );
   2231 
   2232 exit:
   2233     if (_array) {
   2234         releasePointer(_env, _array, params, JNI_FALSE);
   2235     }
   2236 }
   2237 
   2238 /* void glLineWidth ( GLfloat width ) */
   2239 static void
   2240 android_glLineWidth__F
   2241   (JNIEnv *_env, jobject _this, jfloat width) {
   2242     glLineWidth(
   2243         (GLfloat)width
   2244     );
   2245 }
   2246 
   2247 /* void glLineWidthx ( GLfixed width ) */
   2248 static void
   2249 android_glLineWidthx__I
   2250   (JNIEnv *_env, jobject _this, jint width) {
   2251     glLineWidthx(
   2252         (GLfixed)width
   2253     );
   2254 }
   2255 
   2256 /* void glLoadIdentity ( void ) */
   2257 static void
   2258 android_glLoadIdentity__
   2259   (JNIEnv *_env, jobject _this) {
   2260     glLoadIdentity();
   2261 }
   2262 
   2263 /* void glLoadMatrixf ( const GLfloat *m ) */
   2264 static void
   2265 android_glLoadMatrixf___3FI
   2266   (JNIEnv *_env, jobject _this, jfloatArray m_ref, jint offset) {
   2267     GLfloat *m_base = (GLfloat *) 0;
   2268     jint _remaining;
   2269     GLfloat *m = (GLfloat *) 0;
   2270 
   2271     if (!m_ref) {
   2272         _env->ThrowNew(IAEClass, "m == null");
   2273         goto exit;
   2274     }
   2275     if (offset < 0) {
   2276         _env->ThrowNew(IAEClass, "offset < 0");
   2277         goto exit;
   2278     }
   2279     _remaining = _env->GetArrayLength(m_ref) - offset;
   2280     m_base = (GLfloat *)
   2281         _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
   2282     m = m_base + offset;
   2283 
   2284     glLoadMatrixf(
   2285         (GLfloat *)m
   2286     );
   2287 
   2288 exit:
   2289     if (m_base) {
   2290         _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
   2291             JNI_ABORT);
   2292     }
   2293 }
   2294 
   2295 /* void glLoadMatrixf ( const GLfloat *m ) */
   2296 static void
   2297 android_glLoadMatrixf__Ljava_nio_FloatBuffer_2
   2298   (JNIEnv *_env, jobject _this, jobject m_buf) {
   2299     jarray _array = (jarray) 0;
   2300     jint _remaining;
   2301     GLfloat *m = (GLfloat *) 0;
   2302 
   2303     m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining);
   2304     glLoadMatrixf(
   2305         (GLfloat *)m
   2306     );
   2307     if (_array) {
   2308         releasePointer(_env, _array, m, JNI_FALSE);
   2309     }
   2310 }
   2311 
   2312 /* void glLoadMatrixx ( const GLfixed *m ) */
   2313 static void
   2314 android_glLoadMatrixx___3II
   2315   (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) {
   2316     GLfixed *m_base = (GLfixed *) 0;
   2317     jint _remaining;
   2318     GLfixed *m = (GLfixed *) 0;
   2319 
   2320     if (!m_ref) {
   2321         _env->ThrowNew(IAEClass, "m == null");
   2322         goto exit;
   2323     }
   2324     if (offset < 0) {
   2325         _env->ThrowNew(IAEClass, "offset < 0");
   2326         goto exit;
   2327     }
   2328     _remaining = _env->GetArrayLength(m_ref) - offset;
   2329     m_base = (GLfixed *)
   2330         _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
   2331     m = m_base + offset;
   2332 
   2333     glLoadMatrixx(
   2334         (GLfixed *)m
   2335     );
   2336 
   2337 exit:
   2338     if (m_base) {
   2339         _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
   2340             JNI_ABORT);
   2341     }
   2342 }
   2343 
   2344 /* void glLoadMatrixx ( const GLfixed *m ) */
   2345 static void
   2346 android_glLoadMatrixx__Ljava_nio_IntBuffer_2
   2347   (JNIEnv *_env, jobject _this, jobject m_buf) {
   2348     jarray _array = (jarray) 0;
   2349     jint _remaining;
   2350     GLfixed *m = (GLfixed *) 0;
   2351 
   2352     m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining);
   2353     glLoadMatrixx(
   2354         (GLfixed *)m
   2355     );
   2356     if (_array) {
   2357         releasePointer(_env, _array, m, JNI_FALSE);
   2358     }
   2359 }
   2360 
   2361 /* void glLogicOp ( GLenum opcode ) */
   2362 static void
   2363 android_glLogicOp__I
   2364   (JNIEnv *_env, jobject _this, jint opcode) {
   2365     glLogicOp(
   2366         (GLenum)opcode
   2367     );
   2368 }
   2369 
   2370 /* void glMaterialf ( GLenum face, GLenum pname, GLfloat param ) */
   2371 static void
   2372 android_glMaterialf__IIF
   2373   (JNIEnv *_env, jobject _this, jint face, jint pname, jfloat param) {
   2374     glMaterialf(
   2375         (GLenum)face,
   2376         (GLenum)pname,
   2377         (GLfloat)param
   2378     );
   2379 }
   2380 
   2381 /* void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) */
   2382 static void
   2383 android_glMaterialfv__II_3FI
   2384   (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) {
   2385     GLfloat *params_base = (GLfloat *) 0;
   2386     jint _remaining;
   2387     GLfloat *params = (GLfloat *) 0;
   2388 
   2389     if (!params_ref) {
   2390         _env->ThrowNew(IAEClass, "params == null");
   2391         goto exit;
   2392     }
   2393     if (offset < 0) {
   2394         _env->ThrowNew(IAEClass, "offset < 0");
   2395         goto exit;
   2396     }
   2397     _remaining = _env->GetArrayLength(params_ref) - offset;
   2398     int _needed;
   2399     switch (pname) {
   2400 #if defined(GL_SHININESS)
   2401         case GL_SHININESS:
   2402 #endif // defined(GL_SHININESS)
   2403             _needed = 1;
   2404             break;
   2405 #if defined(GL_AMBIENT)
   2406         case GL_AMBIENT:
   2407 #endif // defined(GL_AMBIENT)
   2408 #if defined(GL_DIFFUSE)
   2409         case GL_DIFFUSE:
   2410 #endif // defined(GL_DIFFUSE)
   2411 #if defined(GL_SPECULAR)
   2412         case GL_SPECULAR:
   2413 #endif // defined(GL_SPECULAR)
   2414 #if defined(GL_EMISSION)
   2415         case GL_EMISSION:
   2416 #endif // defined(GL_EMISSION)
   2417 #if defined(GL_AMBIENT_AND_DIFFUSE)
   2418         case GL_AMBIENT_AND_DIFFUSE:
   2419 #endif // defined(GL_AMBIENT_AND_DIFFUSE)
   2420             _needed = 4;
   2421             break;
   2422         default:
   2423             _needed = 0;
   2424             break;
   2425     }
   2426     if (_remaining < _needed) {
   2427         _env->ThrowNew(IAEClass, "length - offset < needed");
   2428         goto exit;
   2429     }
   2430     params_base = (GLfloat *)
   2431         _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
   2432     params = params_base + offset;
   2433 
   2434     glMaterialfv(
   2435         (GLenum)face,
   2436         (GLenum)pname,
   2437         (GLfloat *)params
   2438     );
   2439 
   2440 exit:
   2441     if (params_base) {
   2442         _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
   2443             JNI_ABORT);
   2444     }
   2445 }
   2446 
   2447 /* void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) */
   2448 static void
   2449 android_glMaterialfv__IILjava_nio_FloatBuffer_2
   2450   (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
   2451     jarray _array = (jarray) 0;
   2452     jint _remaining;
   2453     GLfloat *params = (GLfloat *) 0;
   2454 
   2455     params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
   2456     int _needed;
   2457     switch (pname) {
   2458 #if defined(GL_SHININESS)
   2459         case GL_SHININESS:
   2460 #endif // defined(GL_SHININESS)
   2461             _needed = 1;
   2462             break;
   2463 #if defined(GL_AMBIENT)
   2464         case GL_AMBIENT:
   2465 #endif // defined(GL_AMBIENT)
   2466 #if defined(GL_DIFFUSE)
   2467         case GL_DIFFUSE:
   2468 #endif // defined(GL_DIFFUSE)
   2469 #if defined(GL_SPECULAR)
   2470         case GL_SPECULAR:
   2471 #endif // defined(GL_SPECULAR)
   2472 #if defined(GL_EMISSION)
   2473         case GL_EMISSION:
   2474 #endif // defined(GL_EMISSION)
   2475 #if defined(GL_AMBIENT_AND_DIFFUSE)
   2476         case GL_AMBIENT_AND_DIFFUSE:
   2477 #endif // defined(GL_AMBIENT_AND_DIFFUSE)
   2478             _needed = 4;
   2479             break;
   2480         default:
   2481             _needed = 0;
   2482             break;
   2483     }
   2484     if (_remaining < _needed) {
   2485         _env->ThrowNew(IAEClass, "remaining() < needed");
   2486         goto exit;
   2487     }
   2488     glMaterialfv(
   2489         (GLenum)face,
   2490         (GLenum)pname,
   2491         (GLfloat *)params
   2492     );
   2493 
   2494 exit:
   2495     if (_array) {
   2496         releasePointer(_env, _array, params, JNI_FALSE);
   2497     }
   2498 }
   2499 
   2500 /* void glMaterialx ( GLenum face, GLenum pname, GLfixed param ) */
   2501 static void
   2502 android_glMaterialx__III
   2503   (JNIEnv *_env, jobject _this, jint face, jint pname, jint param) {
   2504     glMaterialx(
   2505         (GLenum)face,
   2506         (GLenum)pname,
   2507         (GLfixed)param
   2508     );
   2509 }
   2510 
   2511 /* void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params ) */
   2512 static void
   2513 android_glMaterialxv__II_3II
   2514   (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) {
   2515     GLfixed *params_base = (GLfixed *) 0;
   2516     jint _remaining;
   2517     GLfixed *params = (GLfixed *) 0;
   2518 
   2519     if (!params_ref) {
   2520         _env->ThrowNew(IAEClass, "params == null");
   2521         goto exit;
   2522     }
   2523     if (offset < 0) {
   2524         _env->ThrowNew(IAEClass, "offset < 0");
   2525         goto exit;
   2526     }
   2527     _remaining = _env->GetArrayLength(params_ref) - offset;
   2528     int _needed;
   2529     switch (pname) {
   2530 #if defined(GL_SHININESS)
   2531         case GL_SHININESS:
   2532 #endif // defined(GL_SHININESS)
   2533             _needed = 1;
   2534             break;
   2535 #if defined(GL_AMBIENT)
   2536         case GL_AMBIENT:
   2537 #endif // defined(GL_AMBIENT)
   2538 #if defined(GL_DIFFUSE)
   2539         case GL_DIFFUSE:
   2540 #endif // defined(GL_DIFFUSE)
   2541 #if defined(GL_SPECULAR)
   2542         case GL_SPECULAR:
   2543 #endif // defined(GL_SPECULAR)
   2544 #if defined(GL_EMISSION)
   2545         case GL_EMISSION:
   2546 #endif // defined(GL_EMISSION)
   2547 #if defined(GL_AMBIENT_AND_DIFFUSE)
   2548         case GL_AMBIENT_AND_DIFFUSE:
   2549 #endif // defined(GL_AMBIENT_AND_DIFFUSE)
   2550             _needed = 4;
   2551             break;
   2552         default:
   2553             _needed = 0;
   2554             break;
   2555     }
   2556     if (_remaining < _needed) {
   2557         _env->ThrowNew(IAEClass, "length - offset < needed");
   2558         goto exit;
   2559     }
   2560     params_base = (GLfixed *)
   2561         _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
   2562     params = params_base + offset;
   2563 
   2564     glMaterialxv(
   2565         (GLenum)face,
   2566         (GLenum)pname,
   2567         (GLfixed *)params
   2568     );
   2569 
   2570 exit:
   2571     if (params_base) {
   2572         _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
   2573             JNI_ABORT);
   2574     }
   2575 }
   2576 
   2577 /* void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params ) */
   2578 static void
   2579 android_glMaterialxv__IILjava_nio_IntBuffer_2
   2580   (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
   2581     jarray _array = (jarray) 0;
   2582     jint _remaining;
   2583     GLfixed *params = (GLfixed *) 0;
   2584 
   2585     params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
   2586     int _needed;
   2587     switch (pname) {
   2588 #if defined(GL_SHININESS)
   2589         case GL_SHININESS:
   2590 #endif // defined(GL_SHININESS)
   2591             _needed = 1;
   2592             break;
   2593 #if defined(GL_AMBIENT)
   2594         case GL_AMBIENT:
   2595 #endif // defined(GL_AMBIENT)
   2596 #if defined(GL_DIFFUSE)
   2597         case GL_DIFFUSE:
   2598 #endif // defined(GL_DIFFUSE)
   2599 #if defined(GL_SPECULAR)
   2600         case GL_SPECULAR:
   2601 #endif // defined(GL_SPECULAR)
   2602 #if defined(GL_EMISSION)
   2603         case GL_EMISSION:
   2604 #endif // defined(GL_EMISSION)
   2605 #if defined(GL_AMBIENT_AND_DIFFUSE)
   2606         case GL_AMBIENT_AND_DIFFUSE:
   2607 #endif // defined(GL_AMBIENT_AND_DIFFUSE)
   2608             _needed = 4;
   2609             break;
   2610         default:
   2611             _needed = 0;
   2612             break;
   2613     }
   2614     if (_remaining < _needed) {
   2615         _env->ThrowNew(IAEClass, "remaining() < needed");
   2616         goto exit;
   2617     }
   2618     glMaterialxv(
   2619         (GLenum)face,
   2620         (GLenum)pname,
   2621         (GLfixed *)params
   2622     );
   2623 
   2624 exit:
   2625     if (_array) {
   2626         releasePointer(_env, _array, params, JNI_FALSE);
   2627     }
   2628 }
   2629 
   2630 /* void glMatrixMode ( GLenum mode ) */
   2631 static void
   2632 android_glMatrixMode__I
   2633   (JNIEnv *_env, jobject _this, jint mode) {
   2634     glMatrixMode(
   2635         (GLenum)mode
   2636     );
   2637 }
   2638 
   2639 /* void glMultMatrixf ( const GLfloat *m ) */
   2640 static void
   2641 android_glMultMatrixf___3FI
   2642   (JNIEnv *_env, jobject _this, jfloatArray m_ref, jint offset) {
   2643     GLfloat *m_base = (GLfloat *) 0;
   2644     jint _remaining;
   2645     GLfloat *m = (GLfloat *) 0;
   2646 
   2647     if (!m_ref) {
   2648         _env->ThrowNew(IAEClass, "m == null");
   2649         goto exit;
   2650     }
   2651     if (offset < 0) {
   2652         _env->ThrowNew(IAEClass, "offset < 0");
   2653         goto exit;
   2654     }
   2655     _remaining = _env->GetArrayLength(m_ref) - offset;
   2656     m_base = (GLfloat *)
   2657         _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
   2658     m = m_base + offset;
   2659 
   2660     glMultMatrixf(
   2661         (GLfloat *)m
   2662     );
   2663 
   2664 exit:
   2665     if (m_base) {
   2666         _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
   2667             JNI_ABORT);
   2668     }
   2669 }
   2670 
   2671 /* void glMultMatrixf ( const GLfloat *m ) */
   2672 static void
   2673 android_glMultMatrixf__Ljava_nio_FloatBuffer_2
   2674   (JNIEnv *_env, jobject _this, jobject m_buf) {
   2675     jarray _array = (jarray) 0;
   2676     jint _remaining;
   2677     GLfloat *m = (GLfloat *) 0;
   2678 
   2679     m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining);
   2680     glMultMatrixf(
   2681         (GLfloat *)m
   2682     );
   2683     if (_array) {
   2684         releasePointer(_env, _array, m, JNI_FALSE);
   2685     }
   2686 }
   2687 
   2688 /* void glMultMatrixx ( const GLfixed *m ) */
   2689 static void
   2690 android_glMultMatrixx___3II
   2691   (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) {
   2692     GLfixed *m_base = (GLfixed *) 0;
   2693     jint _remaining;
   2694     GLfixed *m = (GLfixed *) 0;
   2695 
   2696     if (!m_ref) {
   2697         _env->ThrowNew(IAEClass, "m == null");
   2698         goto exit;
   2699     }
   2700     if (offset < 0) {
   2701         _env->ThrowNew(IAEClass, "offset < 0");
   2702         goto exit;
   2703     }
   2704     _remaining = _env->GetArrayLength(m_ref) - offset;
   2705     m_base = (GLfixed *)
   2706         _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
   2707     m = m_base + offset;
   2708 
   2709     glMultMatrixx(
   2710         (GLfixed *)m
   2711     );
   2712 
   2713 exit:
   2714     if (m_base) {
   2715         _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
   2716             JNI_ABORT);
   2717     }
   2718 }
   2719 
   2720 /* void glMultMatrixx ( const GLfixed *m ) */
   2721 static void
   2722 android_glMultMatrixx__Ljava_nio_IntBuffer_2
   2723   (JNIEnv *_env, jobject _this, jobject m_buf) {
   2724     jarray _array = (jarray) 0;
   2725     jint _remaining;
   2726     GLfixed *m = (GLfixed *) 0;
   2727 
   2728     m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining);
   2729     glMultMatrixx(
   2730         (GLfixed *)m
   2731     );
   2732     if (_array) {
   2733         releasePointer(_env, _array, m, JNI_FALSE);
   2734     }
   2735 }
   2736 
   2737 /* void glMultiTexCoord4f ( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ) */
   2738 static void
   2739 android_glMultiTexCoord4f__IFFFF
   2740   (JNIEnv *_env, jobject _this, jint target, jfloat s, jfloat t, jfloat r, jfloat q) {
   2741     glMultiTexCoord4f(
   2742         (GLenum)target,
   2743         (GLfloat)s,
   2744         (GLfloat)t,
   2745         (GLfloat)r,
   2746         (GLfloat)q
   2747     );
   2748 }
   2749 
   2750 /* void glMultiTexCoord4x ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q ) */
   2751 static void
   2752 android_glMultiTexCoord4x__IIIII
   2753   (JNIEnv *_env, jobject _this, jint target, jint s, jint t, jint r, jint q) {
   2754     glMultiTexCoord4x(
   2755         (GLenum)target,
   2756         (GLfixed)s,
   2757         (GLfixed)t,
   2758         (GLfixed)r,
   2759         (GLfixed)q
   2760     );
   2761 }
   2762 
   2763 /* void glNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz ) */
   2764 static void
   2765 android_glNormal3f__FFF
   2766   (JNIEnv *_env, jobject _this, jfloat nx, jfloat ny, jfloat nz) {
   2767     glNormal3f(
   2768         (GLfloat)nx,
   2769         (GLfloat)ny,
   2770         (GLfloat)nz
   2771     );
   2772 }
   2773 
   2774 /* void glNormal3x ( GLfixed nx, GLfixed ny, GLfixed nz ) */
   2775 static void
   2776 android_glNormal3x__III
   2777   (JNIEnv *_env, jobject _this, jint nx, jint ny, jint nz) {
   2778     glNormal3x(
   2779         (GLfixed)nx,
   2780         (GLfixed)ny,
   2781         (GLfixed)nz
   2782     );
   2783 }
   2784 
   2785 /* void glNormalPointer ( GLenum type, GLsizei stride, const GLvoid *pointer ) */
   2786 static void
   2787 android_glNormalPointerBounds__IILjava_nio_Buffer_2I
   2788   (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) {
   2789     jarray _array = (jarray) 0;
   2790     jint _remaining;
   2791     GLvoid *pointer = (GLvoid *) 0;
   2792 
   2793     if (pointer_buf) {
   2794         pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
   2795         if ( ! pointer ) {
   2796             return;
   2797         }
   2798     }
   2799     glNormalPointerBounds(
   2800         (GLenum)type,
   2801         (GLsizei)stride,
   2802         (GLvoid *)pointer,
   2803         (GLsizei)remaining
   2804     );
   2805 }
   2806 
   2807 /* void glOrthof ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */
   2808 static void
   2809 android_glOrthof__FFFFFF
   2810   (JNIEnv *_env, jobject _this, jfloat left, jfloat right, jfloat bottom, jfloat top, jfloat zNear, jfloat zFar) {
   2811     glOrthof(
   2812         (GLfloat)left,
   2813         (GLfloat)right,
   2814         (GLfloat)bottom,
   2815         (GLfloat)top,
   2816         (GLfloat)zNear,
   2817         (GLfloat)zFar
   2818     );
   2819 }
   2820 
   2821 /* void glOrthox ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) */
   2822 static void
   2823 android_glOrthox__IIIIII
   2824   (JNIEnv *_env, jobject _this, jint left, jint right, jint bottom, jint top, jint zNear, jint zFar) {
   2825     glOrthox(
   2826         (GLfixed)left,
   2827         (GLfixed)right,
   2828         (GLfixed)bottom,
   2829         (GLfixed)top,
   2830         (GLfixed)zNear,
   2831         (GLfixed)zFar
   2832     );
   2833 }
   2834 
   2835 /* void glPixelStorei ( GLenum pname, GLint param ) */
   2836 static void
   2837 android_glPixelStorei__II
   2838   (JNIEnv *_env, jobject _this, jint pname, jint param) {
   2839     glPixelStorei(
   2840         (GLenum)pname,
   2841         (GLint)param
   2842     );
   2843 }
   2844 
   2845 /* void glPointSize ( GLfloat size ) */
   2846 static void
   2847 android_glPointSize__F
   2848   (JNIEnv *_env, jobject _this, jfloat size) {
   2849     glPointSize(
   2850         (GLfloat)size
   2851     );
   2852 }
   2853 
   2854 /* void glPointSizex ( GLfixed size ) */
   2855 static void
   2856 android_glPointSizex__I
   2857   (JNIEnv *_env, jobject _this, jint size) {
   2858     glPointSizex(
   2859         (GLfixed)size
   2860     );
   2861 }
   2862 
   2863 /* void glPolygonOffset ( GLfloat factor, GLfloat units ) */
   2864 static void
   2865 android_glPolygonOffset__FF
   2866   (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) {
   2867     glPolygonOffset(
   2868         (GLfloat)factor,
   2869         (GLfloat)units
   2870     );
   2871 }
   2872 
   2873 /* void glPolygonOffsetx ( GLfixed factor, GLfixed units ) */
   2874 static void
   2875 android_glPolygonOffsetx__II
   2876   (JNIEnv *_env, jobject _this, jint factor, jint units) {
   2877     glPolygonOffsetx(
   2878         (GLfixed)factor,
   2879         (GLfixed)units
   2880     );
   2881 }
   2882 
   2883 /* void glPopMatrix ( void ) */
   2884 static void
   2885 android_glPopMatrix__
   2886   (JNIEnv *_env, jobject _this) {
   2887     glPopMatrix();
   2888 }
   2889 
   2890 /* void glPushMatrix ( void ) */
   2891 static void
   2892 android_glPushMatrix__
   2893   (JNIEnv *_env, jobject _this) {
   2894     glPushMatrix();
   2895 }
   2896 
   2897 /* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */
   2898 static void
   2899 android_glReadPixels__IIIIIILjava_nio_Buffer_2
   2900   (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) {
   2901     jint _exception = 0;
   2902     jarray _array = (jarray) 0;
   2903     jint _remaining;
   2904     GLvoid *pixels = (GLvoid *) 0;
   2905 
   2906     pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining);
   2907     glReadPixels(
   2908         (GLint)x,
   2909         (GLint)y,
   2910         (GLsizei)width,
   2911         (GLsizei)height,
   2912         (GLenum)format,
   2913         (GLenum)type,
   2914         (GLvoid *)pixels
   2915     );
   2916     if (_array) {
   2917         releasePointer(_env, _array, pixels, _exception ? JNI_FALSE : JNI_TRUE);
   2918     }
   2919 }
   2920 
   2921 /* void glRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) */
   2922 static void
   2923 android_glRotatef__FFFF
   2924   (JNIEnv *_env, jobject _this, jfloat angle, jfloat x, jfloat y, jfloat z) {
   2925     glRotatef(
   2926         (GLfloat)angle,
   2927         (GLfloat)x,
   2928         (GLfloat)y,
   2929         (GLfloat)z
   2930     );
   2931 }
   2932 
   2933 /* void glRotatex ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z ) */
   2934 static void
   2935 android_glRotatex__IIII
   2936   (JNIEnv *_env, jobject _this, jint angle, jint x, jint y, jint z) {
   2937     glRotatex(
   2938         (GLfixed)angle,
   2939         (GLfixed)x,
   2940         (GLfixed)y,
   2941         (GLfixed)z
   2942     );
   2943 }
   2944 
   2945 /* void glSampleCoverage ( GLclampf value, GLboolean invert ) */
   2946 static void
   2947 android_glSampleCoverage__FZ
   2948   (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) {
   2949     glSampleCoverage(
   2950         (GLclampf)value,
   2951         (GLboolean)invert
   2952     );
   2953 }
   2954 
   2955 /* void glSampleCoveragex ( GLclampx value, GLboolean invert ) */
   2956 static void
   2957 android_glSampleCoveragex__IZ
   2958   (JNIEnv *_env, jobject _this, jint value, jboolean invert) {
   2959     glSampleCoveragex(
   2960         (GLclampx)value,
   2961         (GLboolean)invert
   2962     );
   2963 }
   2964 
   2965 /* void glScalef ( GLfloat x, GLfloat y, GLfloat z ) */
   2966 static void
   2967 android_glScalef__FFF
   2968   (JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat z) {
   2969     glScalef(
   2970         (GLfloat)x,
   2971         (GLfloat)y,
   2972         (GLfloat)z
   2973     );
   2974 }
   2975 
   2976 /* void glScalex ( GLfixed x, GLfixed y, GLfixed z ) */
   2977 static void
   2978 android_glScalex__III
   2979   (JNIEnv *_env, jobject _this, jint x, jint y, jint z) {
   2980     glScalex(
   2981         (GLfixed)x,
   2982         (GLfixed)y,
   2983         (GLfixed)z
   2984     );
   2985 }
   2986 
   2987 /* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */
   2988 static void
   2989 android_glScissor__IIII
   2990   (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
   2991     glScissor(
   2992         (GLint)x,
   2993         (GLint)y,
   2994         (GLsizei)width,
   2995         (GLsizei)height
   2996     );
   2997 }
   2998 
   2999 /* void glShadeModel ( GLenum mode ) */
   3000 static void
   3001 android_glShadeModel__I
   3002   (JNIEnv *_env, jobject _this, jint mode) {
   3003     glShadeModel(
   3004         (GLenum)mode
   3005     );
   3006 }
   3007 
   3008 /* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */
   3009 static void
   3010 android_glStencilFunc__III
   3011   (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) {
   3012     glStencilFunc(
   3013         (GLenum)func,
   3014         (GLint)ref,
   3015         (GLuint)mask
   3016     );
   3017 }
   3018 
   3019 /* void glStencilMask ( GLuint mask ) */
   3020 static void
   3021 android_glStencilMask__I
   3022   (JNIEnv *_env, jobject _this, jint mask) {
   3023     glStencilMask(
   3024         (GLuint)mask
   3025     );
   3026 }
   3027 
   3028 /* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */
   3029 static void
   3030 android_glStencilOp__III
   3031   (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) {
   3032     glStencilOp(
   3033         (GLenum)fail,
   3034         (GLenum)zfail,
   3035         (GLenum)zpass
   3036     );
   3037 }
   3038 
   3039 /* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
   3040 static void
   3041 android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I
   3042   (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
   3043     jarray _array = (jarray) 0;
   3044     jint _remaining;
   3045     GLvoid *pointer = (GLvoid *) 0;
   3046 
   3047     if (pointer_buf) {
   3048         pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
   3049         if ( ! pointer ) {
   3050             return;
   3051         }
   3052     }
   3053     glTexCoordPointerBounds(
   3054         (GLint)size,
   3055         (GLenum)type,
   3056         (GLsizei)stride,
   3057         (GLvoid *)pointer,
   3058         (GLsizei)remaining
   3059     );
   3060 }
   3061 
   3062 /* void glTexEnvf ( GLenum target, GLenum pname, GLfloat param ) */
   3063 static void
   3064 android_glTexEnvf__IIF
   3065   (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
   3066     glTexEnvf(
   3067         (GLenum)target,
   3068         (GLenum)pname,
   3069         (GLfloat)param
   3070     );
   3071 }
   3072 
   3073 /* void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) */
   3074 static void
   3075 android_glTexEnvfv__II_3FI
   3076   (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
   3077     GLfloat *params_base = (GLfloat *) 0;
   3078     jint _remaining;
   3079     GLfloat *params = (GLfloat *) 0;
   3080 
   3081     if (!params_ref) {
   3082         _env->ThrowNew(IAEClass, "params == null");
   3083         goto exit;
   3084     }
   3085     if (offset < 0) {
   3086         _env->ThrowNew(IAEClass, "offset < 0");
   3087         goto exit;
   3088     }
   3089     _remaining = _env->GetArrayLength(params_ref) - offset;
   3090     int _needed;
   3091     switch (pname) {
   3092 #if defined(GL_TEXTURE_ENV_MODE)
   3093         case GL_TEXTURE_ENV_MODE:
   3094 #endif // defined(GL_TEXTURE_ENV_MODE)
   3095 #if defined(GL_COMBINE_RGB)
   3096         case GL_COMBINE_RGB:
   3097 #endif // defined(GL_COMBINE_RGB)
   3098 #if defined(GL_COMBINE_ALPHA)
   3099         case GL_COMBINE_ALPHA:
   3100 #endif // defined(GL_COMBINE_ALPHA)
   3101             _needed = 1;
   3102             break;
   3103 #if defined(GL_TEXTURE_ENV_COLOR)
   3104         case GL_TEXTURE_ENV_COLOR:
   3105 #endif // defined(GL_TEXTURE_ENV_COLOR)
   3106             _needed = 4;
   3107             break;
   3108         default:
   3109             _needed = 0;
   3110             break;
   3111     }
   3112     if (_remaining < _needed) {
   3113         _env->ThrowNew(IAEClass, "length - offset < needed");
   3114         goto exit;
   3115     }
   3116     params_base = (GLfloat *)
   3117         _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
   3118     params = params_base + offset;
   3119 
   3120     glTexEnvfv(
   3121         (GLenum)target,
   3122         (GLenum)pname,
   3123         (GLfloat *)params
   3124     );
   3125 
   3126 exit:
   3127     if (params_base) {
   3128         _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
   3129             JNI_ABORT);
   3130     }
   3131 }
   3132 
   3133 /* void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) */
   3134 static void
   3135 android_glTexEnvfv__IILjava_nio_FloatBuffer_2
   3136   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
   3137     jarray _array = (jarray) 0;
   3138     jint _remaining;
   3139     GLfloat *params = (GLfloat *) 0;
   3140 
   3141     params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
   3142     int _needed;
   3143     switch (pname) {
   3144 #if defined(GL_TEXTURE_ENV_MODE)
   3145         case GL_TEXTURE_ENV_MODE:
   3146 #endif // defined(GL_TEXTURE_ENV_MODE)
   3147 #if defined(GL_COMBINE_RGB)
   3148         case GL_COMBINE_RGB:
   3149 #endif // defined(GL_COMBINE_RGB)
   3150 #if defined(GL_COMBINE_ALPHA)
   3151         case GL_COMBINE_ALPHA:
   3152 #endif // defined(GL_COMBINE_ALPHA)
   3153             _needed = 1;
   3154             break;
   3155 #if defined(GL_TEXTURE_ENV_COLOR)
   3156         case GL_TEXTURE_ENV_COLOR:
   3157 #endif // defined(GL_TEXTURE_ENV_COLOR)
   3158             _needed = 4;
   3159             break;
   3160         default:
   3161             _needed = 0;
   3162             break;
   3163     }
   3164     if (_remaining < _needed) {
   3165         _env->ThrowNew(IAEClass, "remaining() < needed");
   3166         goto exit;
   3167     }
   3168     glTexEnvfv(
   3169         (GLenum)target,
   3170         (GLenum)pname,
   3171         (GLfloat *)params
   3172     );
   3173 
   3174 exit:
   3175     if (_array) {
   3176         releasePointer(_env, _array, params, JNI_FALSE);
   3177     }
   3178 }
   3179 
   3180 /* void glTexEnvx ( GLenum target, GLenum pname, GLfixed param ) */
   3181 static void
   3182 android_glTexEnvx__III
   3183   (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
   3184     glTexEnvx(
   3185         (GLenum)target,
   3186         (GLenum)pname,
   3187         (GLfixed)param
   3188     );
   3189 }
   3190 
   3191 /* void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params ) */
   3192 static void
   3193 android_glTexEnvxv__II_3II
   3194   (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
   3195     GLfixed *params_base = (GLfixed *) 0;
   3196     jint _remaining;
   3197     GLfixed *params = (GLfixed *) 0;
   3198 
   3199     if (!params_ref) {
   3200         _env->ThrowNew(IAEClass, "params == null");
   3201         goto exit;
   3202     }
   3203     if (offset < 0) {
   3204         _env->ThrowNew(IAEClass, "offset < 0");
   3205         goto exit;
   3206     }
   3207     _remaining = _env->GetArrayLength(params_ref) - offset;
   3208     int _needed;
   3209     switch (pname) {
   3210 #if defined(GL_TEXTURE_ENV_MODE)
   3211         case GL_TEXTURE_ENV_MODE:
   3212 #endif // defined(GL_TEXTURE_ENV_MODE)
   3213 #if defined(GL_COMBINE_RGB)
   3214         case GL_COMBINE_RGB:
   3215 #endif // defined(GL_COMBINE_RGB)
   3216 #if defined(GL_COMBINE_ALPHA)
   3217         case GL_COMBINE_ALPHA:
   3218 #endif // defined(GL_COMBINE_ALPHA)
   3219             _needed = 1;
   3220             break;
   3221 #if defined(GL_TEXTURE_ENV_COLOR)
   3222         case GL_TEXTURE_ENV_COLOR:
   3223 #endif // defined(GL_TEXTURE_ENV_COLOR)
   3224             _needed = 4;
   3225             break;
   3226         default:
   3227             _needed = 0;
   3228             break;
   3229     }
   3230     if (_remaining < _needed) {
   3231         _env->ThrowNew(IAEClass, "length - offset < needed");
   3232         goto exit;
   3233     }
   3234     params_base = (GLfixed *)
   3235         _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
   3236     params = params_base + offset;
   3237 
   3238     glTexEnvxv(
   3239         (GLenum)target,
   3240         (GLenum)pname,
   3241         (GLfixed *)params
   3242     );
   3243 
   3244 exit:
   3245     if (params_base) {
   3246         _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
   3247             JNI_ABORT);
   3248     }
   3249 }
   3250 
   3251 /* void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params ) */
   3252 static void
   3253 android_glTexEnvxv__IILjava_nio_IntBuffer_2
   3254   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
   3255     jarray _array = (jarray) 0;
   3256     jint _remaining;
   3257     GLfixed *params = (GLfixed *) 0;
   3258 
   3259     params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
   3260     int _needed;
   3261     switch (pname) {
   3262 #if defined(GL_TEXTURE_ENV_MODE)
   3263         case GL_TEXTURE_ENV_MODE:
   3264 #endif // defined(GL_TEXTURE_ENV_MODE)
   3265 #if defined(GL_COMBINE_RGB)
   3266         case GL_COMBINE_RGB:
   3267 #endif // defined(GL_COMBINE_RGB)
   3268 #if defined(GL_COMBINE_ALPHA)
   3269         case GL_COMBINE_ALPHA:
   3270 #endif // defined(GL_COMBINE_ALPHA)
   3271             _needed = 1;
   3272             break;
   3273 #if defined(GL_TEXTURE_ENV_COLOR)
   3274         case GL_TEXTURE_ENV_COLOR:
   3275 #endif // defined(GL_TEXTURE_ENV_COLOR)
   3276             _needed = 4;
   3277             break;
   3278         default:
   3279             _needed = 0;
   3280             break;
   3281     }
   3282     if (_remaining < _needed) {
   3283         _env->ThrowNew(IAEClass, "remaining() < needed");
   3284         goto exit;
   3285     }
   3286     glTexEnvxv(
   3287         (GLenum)target,
   3288         (GLenum)pname,
   3289         (GLfixed *)params
   3290     );
   3291 
   3292 exit:
   3293     if (_array) {
   3294         releasePointer(_env, _array, params, JNI_FALSE);
   3295     }
   3296 }
   3297 
   3298 /* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */
   3299 static void
   3300 android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2
   3301   (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) {
   3302     jarray _array = (jarray) 0;
   3303     jint _remaining;
   3304     GLvoid *pixels = (GLvoid *) 0;
   3305 
   3306     if (pixels_buf) {
   3307         pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining);
   3308     }
   3309     glTexImage2D(
   3310         (GLenum)target,
   3311         (GLint)level,
   3312         (GLint)internalformat,
   3313         (GLsizei)width,
   3314         (GLsizei)height,
   3315         (GLint)border,
   3316         (GLenum)format,
   3317         (GLenum)type,
   3318         (GLvoid *)pixels
   3319     );
   3320     if (_array) {
   3321         releasePointer(_env, _array, pixels, JNI_FALSE);
   3322     }
   3323 }
   3324 
   3325 /* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */
   3326 static void
   3327 android_glTexParameterf__IIF
   3328   (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
   3329     glTexParameterf(
   3330         (GLenum)target,
   3331         (GLenum)pname,
   3332         (GLfloat)param
   3333     );
   3334 }
   3335 
   3336 /* void glTexParameterx ( GLenum target, GLenum pname, GLfixed param ) */
   3337 static void
   3338 android_glTexParameterx__III
   3339   (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
   3340     glTexParameterx(
   3341         (GLenum)target,
   3342         (GLenum)pname,
   3343         (GLfixed)param
   3344     );
   3345 }
   3346 
   3347 /* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */
   3348 static void
   3349 android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
   3350   (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) {
   3351     jarray _array = (jarray) 0;
   3352     jint _remaining;
   3353     GLvoid *pixels = (GLvoid *) 0;
   3354 
   3355     if (pixels_buf) {
   3356         pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining);
   3357     }
   3358     glTexSubImage2D(
   3359         (GLenum)target,
   3360         (GLint)level,
   3361         (GLint)xoffset,
   3362         (GLint)yoffset,
   3363         (GLsizei)width,
   3364         (GLsizei)height,
   3365         (GLenum)format,
   3366         (GLenum)type,
   3367         (GLvoid *)pixels
   3368     );
   3369     if (_array) {
   3370         releasePointer(_env, _array, pixels, JNI_FALSE);
   3371     }
   3372 }
   3373 
   3374 /* void glTranslatef ( GLfloat x, GLfloat y, GLfloat z ) */
   3375 static void
   3376 android_glTranslatef__FFF
   3377   (JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat z) {
   3378     glTranslatef(
   3379         (GLfloat)x,
   3380         (GLfloat)y,
   3381         (GLfloat)z
   3382     );
   3383 }
   3384 
   3385 /* void glTranslatex ( GLfixed x, GLfixed y, GLfixed z ) */
   3386 static void
   3387 android_glTranslatex__III
   3388   (JNIEnv *_env, jobject _this, jint x, jint y, jint z) {
   3389     glTranslatex(
   3390         (GLfixed)x,
   3391         (GLfixed)y,
   3392         (GLfixed)z
   3393     );
   3394 }
   3395 
   3396 /* void glVertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
   3397 static void
   3398 android_glVertexPointerBounds__IIILjava_nio_Buffer_2I
   3399   (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
   3400     jarray _array = (jarray) 0;
   3401     jint _remaining;
   3402     GLvoid *pointer = (GLvoid *) 0;
   3403 
   3404     if (pointer_buf) {
   3405         pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
   3406         if ( ! pointer ) {
   3407             return;
   3408         }
   3409     }
   3410     glVertexPointerBounds(
   3411         (GLint)size,
   3412         (GLenum)type,
   3413         (GLsizei)stride,
   3414         (GLvoid *)pointer,
   3415         (GLsizei)remaining
   3416     );
   3417 }
   3418 
   3419 /* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */
   3420 static void
   3421 android_glViewport__IIII
   3422   (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
   3423     glViewport(
   3424         (GLint)x,
   3425         (GLint)y,
   3426         (GLsizei)width,
   3427         (GLsizei)height
   3428     );
   3429 }
   3430 
   3431 static const char *classPathName = "android/opengl/GLES10";
   3432 
   3433 static JNINativeMethod methods[] = {
   3434 {"_nativeClassInit", "()V", (void*)nativeClassInit },
   3435 {"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I },
   3436 {"glAlphaFunc", "(IF)V", (void *) android_glAlphaFunc__IF },
   3437 {"glAlphaFuncx", "(II)V", (void *) android_glAlphaFuncx__II },
   3438 {"glBindTexture", "(II)V", (void *) android_glBindTexture__II },
   3439 {"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II },
   3440 {"glClear", "(I)V", (void *) android_glClear__I },
   3441 {"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF },
   3442 {"glClearColorx", "(IIII)V", (void *) android_glClearColorx__IIII },
   3443 {"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F },
   3444 {"glClearDepthx", "(I)V", (void *) android_glClearDepthx__I },
   3445 {"glClearStencil", "(I)V", (void *) android_glClearStencil__I },
   3446 {"glClientActiveTexture", "(I)V", (void *) android_glClientActiveTexture__I },
   3447 {"glColor4f", "(FFFF)V", (void *) android_glColor4f__FFFF },
   3448 {"glColor4x", "(IIII)V", (void *) android_glColor4x__IIII },
   3449 {"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ },
   3450 {"glColorPointerBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glColorPointerBounds__IIILjava_nio_Buffer_2I },
   3451 {"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 },
   3452 {"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
   3453 {"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII },
   3454 {"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII },
   3455 {"glCullFace", "(I)V", (void *) android_glCullFace__I },
   3456 {"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II },
   3457 {"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 },
   3458 {"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I },
   3459 {"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z },
   3460 {"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF },
   3461 {"glDepthRangex", "(II)V", (void *) android_glDepthRangex__II },
   3462 {"glDisable", "(I)V", (void *) android_glDisable__I },
   3463 {"glDisableClientState", "(I)V", (void *) android_glDisableClientState__I },
   3464 {"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III },
   3465 {"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 },
   3466 {"glEnable", "(I)V", (void *) android_glEnable__I },
   3467 {"glEnableClientState", "(I)V", (void *) android_glEnableClientState__I },
   3468 {"glFinish", "()V", (void *) android_glFinish__ },
   3469 {"glFlush", "()V", (void *) android_glFlush__ },
   3470 {"glFogf", "(IF)V", (void *) android_glFogf__IF },
   3471 {"glFogfv", "(I[FI)V", (void *) android_glFogfv__I_3FI },
   3472 {"glFogfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glFogfv__ILjava_nio_FloatBuffer_2 },
   3473 {"glFogx", "(II)V", (void *) android_glFogx__II },
   3474 {"glFogxv", "(I[II)V", (void *) android_glFogxv__I_3II },
   3475 {"glFogxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glFogxv__ILjava_nio_IntBuffer_2 },
   3476 {"glFrontFace", "(I)V", (void *) android_glFrontFace__I },
   3477 {"glFrustumf", "(FFFFFF)V", (void *) android_glFrustumf__FFFFFF },
   3478 {"glFrustumx", "(IIIIII)V", (void *) android_glFrustumx__IIIIII },
   3479 {"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II },
   3480 {"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 },
   3481 {"glGetError", "()I", (void *) android_glGetError__ },
   3482 {"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II },
   3483 {"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 },
   3484 {"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString },
   3485 {"glHint", "(II)V", (void *) android_glHint__II },
   3486 {"glLightModelf", "(IF)V", (void *) android_glLightModelf__IF },
   3487 {"glLightModelfv", "(I[FI)V", (void *) android_glLightModelfv__I_3FI },
   3488 {"glLightModelfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glLightModelfv__ILjava_nio_FloatBuffer_2 },
   3489 {"glLightModelx", "(II)V", (void *) android_glLightModelx__II },
   3490 {"glLightModelxv", "(I[II)V", (void *) android_glLightModelxv__I_3II },
   3491 {"glLightModelxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glLightModelxv__ILjava_nio_IntBuffer_2 },
   3492 {"glLightf", "(IIF)V", (void *) android_glLightf__IIF },
   3493 {"glLightfv", "(II[FI)V", (void *) android_glLightfv__II_3FI },
   3494 {"glLightfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glLightfv__IILjava_nio_FloatBuffer_2 },
   3495 {"glLightx", "(III)V", (void *) android_glLightx__III },
   3496 {"glLightxv", "(II[II)V", (void *) android_glLightxv__II_3II },
   3497 {"glLightxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glLightxv__IILjava_nio_IntBuffer_2 },
   3498 {"glLineWidth", "(F)V", (void *) android_glLineWidth__F },
   3499 {"glLineWidthx", "(I)V", (void *) android_glLineWidthx__I },
   3500 {"glLoadIdentity", "()V", (void *) android_glLoadIdentity__ },
   3501 {"glLoadMatrixf", "([FI)V", (void *) android_glLoadMatrixf___3FI },
   3502 {"glLoadMatrixf", "(Ljava/nio/FloatBuffer;)V", (void *) android_glLoadMatrixf__Ljava_nio_FloatBuffer_2 },
   3503 {"glLoadMatrixx", "([II)V", (void *) android_glLoadMatrixx___3II },
   3504 {"glLoadMatrixx", "(Ljava/nio/IntBuffer;)V", (void *) android_glLoadMatrixx__Ljava_nio_IntBuffer_2 },
   3505 {"glLogicOp", "(I)V", (void *) android_glLogicOp__I },
   3506 {"glMaterialf", "(IIF)V", (void *) android_glMaterialf__IIF },
   3507 {"glMaterialfv", "(II[FI)V", (void *) android_glMaterialfv__II_3FI },
   3508 {"glMaterialfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glMaterialfv__IILjava_nio_FloatBuffer_2 },
   3509 {"glMaterialx", "(III)V", (void *) android_glMaterialx__III },
   3510 {"glMaterialxv", "(II[II)V", (void *) android_glMaterialxv__II_3II },
   3511 {"glMaterialxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glMaterialxv__IILjava_nio_IntBuffer_2 },
   3512 {"glMatrixMode", "(I)V", (void *) android_glMatrixMode__I },
   3513 {"glMultMatrixf", "([FI)V", (void *) android_glMultMatrixf___3FI },
   3514 {"glMultMatrixf", "(Ljava/nio/FloatBuffer;)V", (void *) android_glMultMatrixf__Ljava_nio_FloatBuffer_2 },
   3515 {"glMultMatrixx", "([II)V", (void *) android_glMultMatrixx___3II },
   3516 {"glMultMatrixx", "(Ljava/nio/IntBuffer;)V", (void *) android_glMultMatrixx__Ljava_nio_IntBuffer_2 },
   3517 {"glMultiTexCoord4f", "(IFFFF)V", (void *) android_glMultiTexCoord4f__IFFFF },
   3518 {"glMultiTexCoord4x", "(IIIII)V", (void *) android_glMultiTexCoord4x__IIIII },
   3519 {"glNormal3f", "(FFF)V", (void *) android_glNormal3f__FFF },
   3520 {"glNormal3x", "(III)V", (void *) android_glNormal3x__III },
   3521 {"glNormalPointerBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glNormalPointerBounds__IILjava_nio_Buffer_2I },
   3522 {"glOrthof", "(FFFFFF)V", (void *) android_glOrthof__FFFFFF },
   3523 {"glOrthox", "(IIIIII)V", (void *) android_glOrthox__IIIIII },
   3524 {"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II },
   3525 {"glPointSize", "(F)V", (void *) android_glPointSize__F },
   3526 {"glPointSizex", "(I)V", (void *) android_glPointSizex__I },
   3527 {"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF },
   3528 {"glPolygonOffsetx", "(II)V", (void *) android_glPolygonOffsetx__II },
   3529 {"glPopMatrix", "()V", (void *) android_glPopMatrix__ },
   3530 {"glPushMatrix", "()V", (void *) android_glPushMatrix__ },
   3531 {"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 },
   3532 {"glRotatef", "(FFFF)V", (void *) android_glRotatef__FFFF },
   3533 {"glRotatex", "(IIII)V", (void *) android_glRotatex__IIII },
   3534 {"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ },
   3535 {"glSampleCoveragex", "(IZ)V", (void *) android_glSampleCoveragex__IZ },
   3536 {"glScalef", "(FFF)V", (void *) android_glScalef__FFF },
   3537 {"glScalex", "(III)V", (void *) android_glScalex__III },
   3538 {"glScissor", "(IIII)V", (void *) android_glScissor__IIII },
   3539 {"glShadeModel", "(I)V", (void *) android_glShadeModel__I },
   3540 {"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III },
   3541 {"glStencilMask", "(I)V", (void *) android_glStencilMask__I },
   3542 {"glStencilOp", "(III)V", (void *) android_glStencilOp__III },
   3543 {"glTexCoordPointerBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I },
   3544 {"glTexEnvf", "(IIF)V", (void *) android_glTexEnvf__IIF },
   3545 {"glTexEnvfv", "(II[FI)V", (void *) android_glTexEnvfv__II_3FI },
   3546 {"glTexEnvfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexEnvfv__IILjava_nio_FloatBuffer_2 },
   3547 {"glTexEnvx", "(III)V", (void *) android_glTexEnvx__III },
   3548 {"glTexEnvxv", "(II[II)V", (void *) android_glTexEnvxv__II_3II },
   3549 {"glTexEnvxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexEnvxv__IILjava_nio_IntBuffer_2 },
   3550 {"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 },
   3551 {"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF },
   3552 {"glTexParameterx", "(III)V", (void *) android_glTexParameterx__III },
   3553 {"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
   3554 {"glTranslatef", "(FFF)V", (void *) android_glTranslatef__FFF },
   3555 {"glTranslatex", "(III)V", (void *) android_glTranslatex__III },
   3556 {"glVertexPointerBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glVertexPointerBounds__IIILjava_nio_Buffer_2I },
   3557 {"glViewport", "(IIII)V", (void *) android_glViewport__IIII },
   3558 };
   3559 
   3560 int register_android_opengl_jni_GLES10(JNIEnv *_env)
   3561 {
   3562     int err;
   3563     err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
   3564     return err;
   3565 }
   3566