1/* //device/libs/android_runtime/com_google_android_gles_jni_GLImpl.cpp
2**
3** Copyright 2006, 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 "jni.h"
21#include "JNIHelp.h"
22#include <android_runtime/AndroidRuntime.h>
23#include <utils/misc.h>
24
25#include <assert.h>
26#include <GLES/gl.h>
27#include <GLES/glext.h>
28
29// Work around differences between the generated name and the actual name.
30
31#define glBlendEquation glBlendEquationOES
32#define glBlendEquationSeparate glBlendEquationSeparateOES
33#define glBlendFuncSeparate glBlendFuncSeparateOES
34#define glGetTexGenfv glGetTexGenfvOES
35#define glGetTexGeniv glGetTexGenivOES
36#define glGetTexGenxv glGetTexGenxvOES
37#define glTexGenf glTexGenfOES
38#define glTexGenfv glTexGenfvOES
39#define glTexGeni glTexGeniOES
40#define glTexGeniv glTexGenivOES
41#define glTexGenx glTexGenxOES
42#define glTexGenxv glTexGenxvOES
43
44
45
46/* special calls implemented in Android's GLES wrapper used to more
47 * efficiently bound-check passed arrays */
48extern "C" {
49GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
50        const GLvoid *ptr, GLsizei count);
51GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
52        const GLvoid *pointer, GLsizei count);
53GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
54        GLsizei stride, const GLvoid *pointer, GLsizei count);
55GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
56        GLsizei stride, const GLvoid *pointer, GLsizei count);
57GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
58        GLsizei stride, const GLvoid *pointer, GLsizei count);
59GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
60        GLsizei stride, const GLvoid *pointer, GLsizei count);
61GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
62        GLsizei stride, const GLvoid *pointer, GLsizei count);
63}
64
65static int initialized = 0;
66
67static jclass nioAccessClass;
68static jclass bufferClass;
69static jclass G11ImplClass;
70static jmethodID getBasePointerID;
71static jmethodID getBaseArrayID;
72static jmethodID getBaseArrayOffsetID;
73static jmethodID allowIndirectBuffersID;
74static jfieldID positionID;
75static jfieldID limitID;
76static jfieldID elementSizeShiftID;
77static jfieldID haveCheckedExtensionsID;
78static jfieldID have_OES_blend_equation_separateID;
79static jfieldID have_OES_blend_subtractID;
80static jfieldID have_OES_framebuffer_objectID;
81static jfieldID have_OES_texture_cube_mapID;
82
83/* Cache method IDs each time the class is loaded. */
84
85static void
86nativeClassInit(JNIEnv *_env, jclass glImplClass)
87{
88    jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
89    nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
90
91    jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
92    bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
93
94    jclass g11impClassLocal = _env->FindClass("com/google/android/gles_jni/GLImpl");
95    G11ImplClass = (jclass) _env->NewGlobalRef(g11impClassLocal);
96    haveCheckedExtensionsID =  _env->GetFieldID(G11ImplClass, "haveCheckedExtensions", "Z");
97    have_OES_blend_equation_separateID =  _env->GetFieldID(G11ImplClass, "have_OES_blend_equation_separate", "Z");
98    have_OES_blend_subtractID =  _env->GetFieldID(G11ImplClass, "have_OES_blend_subtract", "Z");
99    have_OES_framebuffer_objectID =  _env->GetFieldID(G11ImplClass, "have_OES_framebuffer_object", "Z");
100    have_OES_texture_cube_mapID =  _env->GetFieldID(G11ImplClass, "have_OES_texture_cube_map", "Z");
101
102    getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
103            "getBasePointer", "(Ljava/nio/Buffer;)J");
104    getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
105            "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
106    getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
107            "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
108    allowIndirectBuffersID = _env->GetStaticMethodID(g11impClassLocal,
109            "allowIndirectBuffers", "(Ljava/lang/String;)Z");
110    positionID = _env->GetFieldID(bufferClass, "position", "I");
111    limitID = _env->GetFieldID(bufferClass, "limit", "I");
112    elementSizeShiftID =
113        _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
114}
115
116static void *
117getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
118{
119    jint position;
120    jint limit;
121    jint elementSizeShift;
122    jlong pointer;
123
124    position = _env->GetIntField(buffer, positionID);
125    limit = _env->GetIntField(buffer, limitID);
126    elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
127    *remaining = (limit - position) << elementSizeShift;
128    pointer = _env->CallStaticLongMethod(nioAccessClass,
129            getBasePointerID, buffer);
130    if (pointer != 0L) {
131        *array = NULL;
132        return reinterpret_cast<void *>(pointer);
133    }
134
135    *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
136            getBaseArrayID, buffer);
137    if (*array == NULL) {
138        return (void*) NULL;
139    }
140    *offset = _env->CallStaticIntMethod(nioAccessClass,
141            getBaseArrayOffsetID, buffer);
142
143    return NULL;
144}
145
146static void
147releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
148{
149    _env->ReleasePrimitiveArrayCritical(array, data,
150					   commit ? 0 : JNI_ABORT);
151}
152
153extern "C" {
154extern char*  __progname;
155}
156
157static bool
158allowIndirectBuffers(JNIEnv *_env) {
159    static jint sIndirectBufferCompatability;
160    if (sIndirectBufferCompatability == 0) {
161        jobject appName = _env->NewStringUTF(::__progname);
162        sIndirectBufferCompatability = _env->CallStaticBooleanMethod(G11ImplClass, allowIndirectBuffersID, appName) ? 2 : 1;
163    }
164    return sIndirectBufferCompatability == 2;
165}
166
167static void *
168getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
169    if (!buffer) {
170        return NULL;
171    }
172    void* buf = _env->GetDirectBufferAddress(buffer);
173    if (buf) {
174        jint position = _env->GetIntField(buffer, positionID);
175        jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
176        buf = ((char*) buf) + (position << elementSizeShift);
177    } else {
178        if (allowIndirectBuffers(_env)) {
179            jarray array = 0;
180            jint remaining;
181            jint offset;
182            buf = getPointer(_env, buffer, &array, &remaining, &offset);
183            if (array) {
184                releasePointer(_env, array, buf, 0);
185            }
186            buf = (char*)buf + offset;
187        } else {
188            jniThrowException(_env, "java/lang/IllegalArgumentException",
189                              "Must use a native order direct Buffer");
190        }
191    }
192    return buf;
193}
194
195static int
196getNumCompressedTextureFormats() {
197    int numCompressedTextureFormats = 0;
198    glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats);
199    return numCompressedTextureFormats;
200}
201
202// Check if the extension at the head of pExtensions is pExtension. Note that pExtensions is
203// terminated by either 0 or space, while pExtension is terminated by 0.
204
205static bool
206extensionEqual(const GLubyte* pExtensions, const GLubyte* pExtension) {
207    while (true) {
208        char a = *pExtensions++;
209        char b = *pExtension++;
210        bool aEnd = a == '\0' || a == ' ';
211        bool bEnd = b == '\0';
212        if ( aEnd || bEnd) {
213            return aEnd == bEnd;
214        }
215        if ( a != b ) {
216            return false;
217        }
218    }
219}
220
221static const GLubyte*
222nextExtension(const GLubyte* pExtensions) {
223    while (true) {
224        char a = *pExtensions++;
225        if ( a == '\0') {
226            return pExtensions-1;
227        } else if ( a == ' ') {
228            return pExtensions;
229        }
230    }
231}
232
233static bool
234checkForExtension(const GLubyte* pExtensions, const GLubyte* pExtension) {
235    for (;*pExtensions != '\0'; pExtensions = nextExtension(pExtensions)) {
236        if (extensionEqual(pExtensions, pExtension)) {
237            return true;
238        }
239    }
240    return false;
241}
242
243static bool
244supportsExtension(JNIEnv *_env, jobject impl, jfieldID fieldId) {
245    if (!_env->GetBooleanField(impl, haveCheckedExtensionsID)) {
246        _env->SetBooleanField(impl, haveCheckedExtensionsID, true);
247        const GLubyte* sExtensions = glGetString(GL_EXTENSIONS);
248        _env->SetBooleanField(impl, have_OES_blend_equation_separateID,
249            checkForExtension(sExtensions, (const GLubyte*) "GL_OES_blend_equation_separate"));
250        _env->SetBooleanField(impl, have_OES_blend_subtractID,
251            checkForExtension(sExtensions, (const GLubyte*) "GL_OES_blend_subtract"));
252        _env->SetBooleanField(impl, have_OES_framebuffer_objectID,
253            checkForExtension(sExtensions, (const GLubyte*) "GL_OES_framebuffer_object"));
254        _env->SetBooleanField(impl, have_OES_texture_cube_mapID,
255            checkForExtension(sExtensions, (const GLubyte*) "GL_OES_texture_cube_map"));
256    }
257    return _env->GetBooleanField(impl, fieldId);
258}
259
260// --------------------------------------------------------------------------
261/* void glActiveTexture ( GLenum texture ) */
262static void
263android_glActiveTexture__I
264  (JNIEnv *_env, jobject _this, jint texture) {
265    glActiveTexture(
266        (GLenum)texture
267    );
268}
269
270/* void glAlphaFunc ( GLenum func, GLclampf ref ) */
271static void
272android_glAlphaFunc__IF
273  (JNIEnv *_env, jobject _this, jint func, jfloat ref) {
274    glAlphaFunc(
275        (GLenum)func,
276        (GLclampf)ref
277    );
278}
279
280/* void glAlphaFuncx ( GLenum func, GLclampx ref ) */
281static void
282android_glAlphaFuncx__II
283  (JNIEnv *_env, jobject _this, jint func, jint ref) {
284    glAlphaFuncx(
285        (GLenum)func,
286        (GLclampx)ref
287    );
288}
289
290/* void glBindTexture ( GLenum target, GLuint texture ) */
291static void
292android_glBindTexture__II
293  (JNIEnv *_env, jobject _this, jint target, jint texture) {
294    glBindTexture(
295        (GLenum)target,
296        (GLuint)texture
297    );
298}
299
300/* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */
301static void
302android_glBlendFunc__II
303  (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) {
304    glBlendFunc(
305        (GLenum)sfactor,
306        (GLenum)dfactor
307    );
308}
309
310/* void glClear ( GLbitfield mask ) */
311static void
312android_glClear__I
313  (JNIEnv *_env, jobject _this, jint mask) {
314    glClear(
315        (GLbitfield)mask
316    );
317}
318
319/* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
320static void
321android_glClearColor__FFFF
322  (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
323    glClearColor(
324        (GLclampf)red,
325        (GLclampf)green,
326        (GLclampf)blue,
327        (GLclampf)alpha
328    );
329}
330
331/* void glClearColorx ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha ) */
332static void
333android_glClearColorx__IIII
334  (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) {
335    glClearColorx(
336        (GLclampx)red,
337        (GLclampx)green,
338        (GLclampx)blue,
339        (GLclampx)alpha
340    );
341}
342
343/* void glClearDepthf ( GLclampf depth ) */
344static void
345android_glClearDepthf__F
346  (JNIEnv *_env, jobject _this, jfloat depth) {
347    glClearDepthf(
348        (GLclampf)depth
349    );
350}
351
352/* void glClearDepthx ( GLclampx depth ) */
353static void
354android_glClearDepthx__I
355  (JNIEnv *_env, jobject _this, jint depth) {
356    glClearDepthx(
357        (GLclampx)depth
358    );
359}
360
361/* void glClearStencil ( GLint s ) */
362static void
363android_glClearStencil__I
364  (JNIEnv *_env, jobject _this, jint s) {
365    glClearStencil(
366        (GLint)s
367    );
368}
369
370/* void glClientActiveTexture ( GLenum texture ) */
371static void
372android_glClientActiveTexture__I
373  (JNIEnv *_env, jobject _this, jint texture) {
374    glClientActiveTexture(
375        (GLenum)texture
376    );
377}
378
379/* void glColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) */
380static void
381android_glColor4f__FFFF
382  (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
383    glColor4f(
384        (GLfloat)red,
385        (GLfloat)green,
386        (GLfloat)blue,
387        (GLfloat)alpha
388    );
389}
390
391/* void glColor4x ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha ) */
392static void
393android_glColor4x__IIII
394  (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) {
395    glColor4x(
396        (GLfixed)red,
397        (GLfixed)green,
398        (GLfixed)blue,
399        (GLfixed)alpha
400    );
401}
402
403/* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */
404static void
405android_glColorMask__ZZZZ
406  (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) {
407    glColorMask(
408        (GLboolean)red,
409        (GLboolean)green,
410        (GLboolean)blue,
411        (GLboolean)alpha
412    );
413}
414
415/* void glColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
416static void
417android_glColorPointerBounds__IIILjava_nio_Buffer_2I
418  (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
419    jarray _array = (jarray) 0;
420    jint _bufferOffset = (jint) 0;
421    jint _remaining;
422    GLvoid *pointer = (GLvoid *) 0;
423
424    if (pointer_buf) {
425        pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
426        if ( ! pointer ) {
427            return;
428        }
429    }
430    glColorPointerBounds(
431        (GLint)size,
432        (GLenum)type,
433        (GLsizei)stride,
434        (GLvoid *)pointer,
435        (GLsizei)remaining
436    );
437}
438
439/* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */
440static void
441android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2
442  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) {
443    jarray _array = (jarray) 0;
444    jint _bufferOffset = (jint) 0;
445    jint _remaining;
446    GLvoid *data = (GLvoid *) 0;
447
448    data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
449    if (data == NULL) {
450        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
451        data = (GLvoid *) (_dataBase + _bufferOffset);
452    }
453    glCompressedTexImage2D(
454        (GLenum)target,
455        (GLint)level,
456        (GLenum)internalformat,
457        (GLsizei)width,
458        (GLsizei)height,
459        (GLint)border,
460        (GLsizei)imageSize,
461        (GLvoid *)data
462    );
463    if (_array) {
464        releasePointer(_env, _array, data, JNI_FALSE);
465    }
466}
467
468/* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */
469static void
470android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
471  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) {
472    jarray _array = (jarray) 0;
473    jint _bufferOffset = (jint) 0;
474    jint _remaining;
475    GLvoid *data = (GLvoid *) 0;
476
477    data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
478    if (data == NULL) {
479        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
480        data = (GLvoid *) (_dataBase + _bufferOffset);
481    }
482    glCompressedTexSubImage2D(
483        (GLenum)target,
484        (GLint)level,
485        (GLint)xoffset,
486        (GLint)yoffset,
487        (GLsizei)width,
488        (GLsizei)height,
489        (GLenum)format,
490        (GLsizei)imageSize,
491        (GLvoid *)data
492    );
493    if (_array) {
494        releasePointer(_env, _array, data, JNI_FALSE);
495    }
496}
497
498/* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */
499static void
500android_glCopyTexImage2D__IIIIIIII
501  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) {
502    glCopyTexImage2D(
503        (GLenum)target,
504        (GLint)level,
505        (GLenum)internalformat,
506        (GLint)x,
507        (GLint)y,
508        (GLsizei)width,
509        (GLsizei)height,
510        (GLint)border
511    );
512}
513
514/* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */
515static void
516android_glCopyTexSubImage2D__IIIIIIII
517  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) {
518    glCopyTexSubImage2D(
519        (GLenum)target,
520        (GLint)level,
521        (GLint)xoffset,
522        (GLint)yoffset,
523        (GLint)x,
524        (GLint)y,
525        (GLsizei)width,
526        (GLsizei)height
527    );
528}
529
530/* void glCullFace ( GLenum mode ) */
531static void
532android_glCullFace__I
533  (JNIEnv *_env, jobject _this, jint mode) {
534    glCullFace(
535        (GLenum)mode
536    );
537}
538
539/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
540static void
541android_glDeleteTextures__I_3II
542  (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
543    jint _exception = 0;
544    const char * _exceptionType = NULL;
545    const char * _exceptionMessage = NULL;
546    GLuint *textures_base = (GLuint *) 0;
547    jint _remaining;
548    GLuint *textures = (GLuint *) 0;
549
550    if (!textures_ref) {
551        _exception = 1;
552        _exceptionType = "java/lang/IllegalArgumentException";
553        _exceptionMessage = "textures == null";
554        goto exit;
555    }
556    if (offset < 0) {
557        _exception = 1;
558        _exceptionType = "java/lang/IllegalArgumentException";
559        _exceptionMessage = "offset < 0";
560        goto exit;
561    }
562    _remaining = _env->GetArrayLength(textures_ref) - offset;
563    if (_remaining < n) {
564        _exception = 1;
565        _exceptionType = "java/lang/IllegalArgumentException";
566        _exceptionMessage = "length - offset < n < needed";
567        goto exit;
568    }
569    textures_base = (GLuint *)
570        _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
571    textures = textures_base + offset;
572
573    glDeleteTextures(
574        (GLsizei)n,
575        (GLuint *)textures
576    );
577
578exit:
579    if (textures_base) {
580        _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
581            JNI_ABORT);
582    }
583    if (_exception) {
584        jniThrowException(_env, _exceptionType, _exceptionMessage);
585    }
586}
587
588/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
589static void
590android_glDeleteTextures__ILjava_nio_IntBuffer_2
591  (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
592    jint _exception = 0;
593    const char * _exceptionType = NULL;
594    const char * _exceptionMessage = NULL;
595    jarray _array = (jarray) 0;
596    jint _bufferOffset = (jint) 0;
597    jint _remaining;
598    GLuint *textures = (GLuint *) 0;
599
600    textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset);
601    if (_remaining < n) {
602        _exception = 1;
603        _exceptionType = "java/lang/IllegalArgumentException";
604        _exceptionMessage = "remaining() < n < needed";
605        goto exit;
606    }
607    if (textures == NULL) {
608        char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
609        textures = (GLuint *) (_texturesBase + _bufferOffset);
610    }
611    glDeleteTextures(
612        (GLsizei)n,
613        (GLuint *)textures
614    );
615
616exit:
617    if (_array) {
618        releasePointer(_env, _array, textures, JNI_FALSE);
619    }
620    if (_exception) {
621        jniThrowException(_env, _exceptionType, _exceptionMessage);
622    }
623}
624
625/* void glDepthFunc ( GLenum func ) */
626static void
627android_glDepthFunc__I
628  (JNIEnv *_env, jobject _this, jint func) {
629    glDepthFunc(
630        (GLenum)func
631    );
632}
633
634/* void glDepthMask ( GLboolean flag ) */
635static void
636android_glDepthMask__Z
637  (JNIEnv *_env, jobject _this, jboolean flag) {
638    glDepthMask(
639        (GLboolean)flag
640    );
641}
642
643/* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */
644static void
645android_glDepthRangef__FF
646  (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) {
647    glDepthRangef(
648        (GLclampf)zNear,
649        (GLclampf)zFar
650    );
651}
652
653/* void glDepthRangex ( GLclampx zNear, GLclampx zFar ) */
654static void
655android_glDepthRangex__II
656  (JNIEnv *_env, jobject _this, jint zNear, jint zFar) {
657    glDepthRangex(
658        (GLclampx)zNear,
659        (GLclampx)zFar
660    );
661}
662
663/* void glDisable ( GLenum cap ) */
664static void
665android_glDisable__I
666  (JNIEnv *_env, jobject _this, jint cap) {
667    glDisable(
668        (GLenum)cap
669    );
670}
671
672/* void glDisableClientState ( GLenum array ) */
673static void
674android_glDisableClientState__I
675  (JNIEnv *_env, jobject _this, jint array) {
676    glDisableClientState(
677        (GLenum)array
678    );
679}
680
681/* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */
682static void
683android_glDrawArrays__III
684  (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) {
685    glDrawArrays(
686        (GLenum)mode,
687        (GLint)first,
688        (GLsizei)count
689    );
690}
691
692/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */
693static void
694android_glDrawElements__IIILjava_nio_Buffer_2
695  (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) {
696    jint _exception = 0;
697    const char * _exceptionType = NULL;
698    const char * _exceptionMessage = NULL;
699    jarray _array = (jarray) 0;
700    jint _bufferOffset = (jint) 0;
701    jint _remaining;
702    GLvoid *indices = (GLvoid *) 0;
703
704    indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining, &_bufferOffset);
705    if (_remaining < count) {
706        _exception = 1;
707        _exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
708        _exceptionMessage = "remaining() < count < needed";
709        goto exit;
710    }
711    if (indices == NULL) {
712        char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
713        indices = (GLvoid *) (_indicesBase + _bufferOffset);
714    }
715    glDrawElements(
716        (GLenum)mode,
717        (GLsizei)count,
718        (GLenum)type,
719        (GLvoid *)indices
720    );
721
722exit:
723    if (_array) {
724        releasePointer(_env, _array, indices, JNI_FALSE);
725    }
726    if (_exception) {
727        jniThrowException(_env, _exceptionType, _exceptionMessage);
728    }
729}
730
731/* void glEnable ( GLenum cap ) */
732static void
733android_glEnable__I
734  (JNIEnv *_env, jobject _this, jint cap) {
735    glEnable(
736        (GLenum)cap
737    );
738}
739
740/* void glEnableClientState ( GLenum array ) */
741static void
742android_glEnableClientState__I
743  (JNIEnv *_env, jobject _this, jint array) {
744    glEnableClientState(
745        (GLenum)array
746    );
747}
748
749/* void glFinish ( void ) */
750static void
751android_glFinish__
752  (JNIEnv *_env, jobject _this) {
753    glFinish();
754}
755
756/* void glFlush ( void ) */
757static void
758android_glFlush__
759  (JNIEnv *_env, jobject _this) {
760    glFlush();
761}
762
763/* void glFogf ( GLenum pname, GLfloat param ) */
764static void
765android_glFogf__IF
766  (JNIEnv *_env, jobject _this, jint pname, jfloat param) {
767    glFogf(
768        (GLenum)pname,
769        (GLfloat)param
770    );
771}
772
773/* void glFogfv ( GLenum pname, const GLfloat *params ) */
774static void
775android_glFogfv__I_3FI
776  (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
777    jint _exception = 0;
778    const char * _exceptionType = NULL;
779    const char * _exceptionMessage = NULL;
780    GLfloat *params_base = (GLfloat *) 0;
781    jint _remaining;
782    GLfloat *params = (GLfloat *) 0;
783
784    if (!params_ref) {
785        _exception = 1;
786        _exceptionType = "java/lang/IllegalArgumentException";
787        _exceptionMessage = "params == null";
788        goto exit;
789    }
790    if (offset < 0) {
791        _exception = 1;
792        _exceptionType = "java/lang/IllegalArgumentException";
793        _exceptionMessage = "offset < 0";
794        goto exit;
795    }
796    _remaining = _env->GetArrayLength(params_ref) - offset;
797    int _needed;
798    switch (pname) {
799#if defined(GL_FOG_MODE)
800        case GL_FOG_MODE:
801#endif // defined(GL_FOG_MODE)
802#if defined(GL_FOG_DENSITY)
803        case GL_FOG_DENSITY:
804#endif // defined(GL_FOG_DENSITY)
805#if defined(GL_FOG_START)
806        case GL_FOG_START:
807#endif // defined(GL_FOG_START)
808#if defined(GL_FOG_END)
809        case GL_FOG_END:
810#endif // defined(GL_FOG_END)
811            _needed = 1;
812            break;
813#if defined(GL_FOG_COLOR)
814        case GL_FOG_COLOR:
815#endif // defined(GL_FOG_COLOR)
816            _needed = 4;
817            break;
818        default:
819            _needed = 1;
820            break;
821    }
822    if (_remaining < _needed) {
823        _exception = 1;
824        _exceptionType = "java/lang/IllegalArgumentException";
825        _exceptionMessage = "length - offset < needed";
826        goto exit;
827    }
828    params_base = (GLfloat *)
829        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
830    params = params_base + offset;
831
832    glFogfv(
833        (GLenum)pname,
834        (GLfloat *)params
835    );
836
837exit:
838    if (params_base) {
839        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
840            JNI_ABORT);
841    }
842    if (_exception) {
843        jniThrowException(_env, _exceptionType, _exceptionMessage);
844    }
845}
846
847/* void glFogfv ( GLenum pname, const GLfloat *params ) */
848static void
849android_glFogfv__ILjava_nio_FloatBuffer_2
850  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
851    jint _exception = 0;
852    const char * _exceptionType = NULL;
853    const char * _exceptionMessage = NULL;
854    jarray _array = (jarray) 0;
855    jint _bufferOffset = (jint) 0;
856    jint _remaining;
857    GLfloat *params = (GLfloat *) 0;
858
859    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
860    int _needed;
861    switch (pname) {
862#if defined(GL_FOG_MODE)
863        case GL_FOG_MODE:
864#endif // defined(GL_FOG_MODE)
865#if defined(GL_FOG_DENSITY)
866        case GL_FOG_DENSITY:
867#endif // defined(GL_FOG_DENSITY)
868#if defined(GL_FOG_START)
869        case GL_FOG_START:
870#endif // defined(GL_FOG_START)
871#if defined(GL_FOG_END)
872        case GL_FOG_END:
873#endif // defined(GL_FOG_END)
874            _needed = 1;
875            break;
876#if defined(GL_FOG_COLOR)
877        case GL_FOG_COLOR:
878#endif // defined(GL_FOG_COLOR)
879            _needed = 4;
880            break;
881        default:
882            _needed = 1;
883            break;
884    }
885    if (_remaining < _needed) {
886        _exception = 1;
887        _exceptionType = "java/lang/IllegalArgumentException";
888        _exceptionMessage = "remaining() < needed";
889        goto exit;
890    }
891    if (params == NULL) {
892        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
893        params = (GLfloat *) (_paramsBase + _bufferOffset);
894    }
895    glFogfv(
896        (GLenum)pname,
897        (GLfloat *)params
898    );
899
900exit:
901    if (_array) {
902        releasePointer(_env, _array, params, JNI_FALSE);
903    }
904    if (_exception) {
905        jniThrowException(_env, _exceptionType, _exceptionMessage);
906    }
907}
908
909/* void glFogx ( GLenum pname, GLfixed param ) */
910static void
911android_glFogx__II
912  (JNIEnv *_env, jobject _this, jint pname, jint param) {
913    glFogx(
914        (GLenum)pname,
915        (GLfixed)param
916    );
917}
918
919/* void glFogxv ( GLenum pname, const GLfixed *params ) */
920static void
921android_glFogxv__I_3II
922  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
923    jint _exception = 0;
924    const char * _exceptionType = NULL;
925    const char * _exceptionMessage = NULL;
926    GLfixed *params_base = (GLfixed *) 0;
927    jint _remaining;
928    GLfixed *params = (GLfixed *) 0;
929
930    if (!params_ref) {
931        _exception = 1;
932        _exceptionType = "java/lang/IllegalArgumentException";
933        _exceptionMessage = "params == null";
934        goto exit;
935    }
936    if (offset < 0) {
937        _exception = 1;
938        _exceptionType = "java/lang/IllegalArgumentException";
939        _exceptionMessage = "offset < 0";
940        goto exit;
941    }
942    _remaining = _env->GetArrayLength(params_ref) - offset;
943    int _needed;
944    switch (pname) {
945#if defined(GL_FOG_MODE)
946        case GL_FOG_MODE:
947#endif // defined(GL_FOG_MODE)
948#if defined(GL_FOG_DENSITY)
949        case GL_FOG_DENSITY:
950#endif // defined(GL_FOG_DENSITY)
951#if defined(GL_FOG_START)
952        case GL_FOG_START:
953#endif // defined(GL_FOG_START)
954#if defined(GL_FOG_END)
955        case GL_FOG_END:
956#endif // defined(GL_FOG_END)
957            _needed = 1;
958            break;
959#if defined(GL_FOG_COLOR)
960        case GL_FOG_COLOR:
961#endif // defined(GL_FOG_COLOR)
962            _needed = 4;
963            break;
964        default:
965            _needed = 1;
966            break;
967    }
968    if (_remaining < _needed) {
969        _exception = 1;
970        _exceptionType = "java/lang/IllegalArgumentException";
971        _exceptionMessage = "length - offset < needed";
972        goto exit;
973    }
974    params_base = (GLfixed *)
975        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
976    params = params_base + offset;
977
978    glFogxv(
979        (GLenum)pname,
980        (GLfixed *)params
981    );
982
983exit:
984    if (params_base) {
985        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
986            JNI_ABORT);
987    }
988    if (_exception) {
989        jniThrowException(_env, _exceptionType, _exceptionMessage);
990    }
991}
992
993/* void glFogxv ( GLenum pname, const GLfixed *params ) */
994static void
995android_glFogxv__ILjava_nio_IntBuffer_2
996  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
997    jint _exception = 0;
998    const char * _exceptionType = NULL;
999    const char * _exceptionMessage = NULL;
1000    jarray _array = (jarray) 0;
1001    jint _bufferOffset = (jint) 0;
1002    jint _remaining;
1003    GLfixed *params = (GLfixed *) 0;
1004
1005    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
1006    int _needed;
1007    switch (pname) {
1008#if defined(GL_FOG_MODE)
1009        case GL_FOG_MODE:
1010#endif // defined(GL_FOG_MODE)
1011#if defined(GL_FOG_DENSITY)
1012        case GL_FOG_DENSITY:
1013#endif // defined(GL_FOG_DENSITY)
1014#if defined(GL_FOG_START)
1015        case GL_FOG_START:
1016#endif // defined(GL_FOG_START)
1017#if defined(GL_FOG_END)
1018        case GL_FOG_END:
1019#endif // defined(GL_FOG_END)
1020            _needed = 1;
1021            break;
1022#if defined(GL_FOG_COLOR)
1023        case GL_FOG_COLOR:
1024#endif // defined(GL_FOG_COLOR)
1025            _needed = 4;
1026            break;
1027        default:
1028            _needed = 1;
1029            break;
1030    }
1031    if (_remaining < _needed) {
1032        _exception = 1;
1033        _exceptionType = "java/lang/IllegalArgumentException";
1034        _exceptionMessage = "remaining() < needed";
1035        goto exit;
1036    }
1037    if (params == NULL) {
1038        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1039        params = (GLfixed *) (_paramsBase + _bufferOffset);
1040    }
1041    glFogxv(
1042        (GLenum)pname,
1043        (GLfixed *)params
1044    );
1045
1046exit:
1047    if (_array) {
1048        releasePointer(_env, _array, params, JNI_FALSE);
1049    }
1050    if (_exception) {
1051        jniThrowException(_env, _exceptionType, _exceptionMessage);
1052    }
1053}
1054
1055/* void glFrontFace ( GLenum mode ) */
1056static void
1057android_glFrontFace__I
1058  (JNIEnv *_env, jobject _this, jint mode) {
1059    glFrontFace(
1060        (GLenum)mode
1061    );
1062}
1063
1064/* void glFrustumf ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */
1065static void
1066android_glFrustumf__FFFFFF
1067  (JNIEnv *_env, jobject _this, jfloat left, jfloat right, jfloat bottom, jfloat top, jfloat zNear, jfloat zFar) {
1068    glFrustumf(
1069        (GLfloat)left,
1070        (GLfloat)right,
1071        (GLfloat)bottom,
1072        (GLfloat)top,
1073        (GLfloat)zNear,
1074        (GLfloat)zFar
1075    );
1076}
1077
1078/* void glFrustumx ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) */
1079static void
1080android_glFrustumx__IIIIII
1081  (JNIEnv *_env, jobject _this, jint left, jint right, jint bottom, jint top, jint zNear, jint zFar) {
1082    glFrustumx(
1083        (GLfixed)left,
1084        (GLfixed)right,
1085        (GLfixed)bottom,
1086        (GLfixed)top,
1087        (GLfixed)zNear,
1088        (GLfixed)zFar
1089    );
1090}
1091
1092/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1093static void
1094android_glGenTextures__I_3II
1095  (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
1096    jint _exception = 0;
1097    const char * _exceptionType = NULL;
1098    const char * _exceptionMessage = NULL;
1099    GLuint *textures_base = (GLuint *) 0;
1100    jint _remaining;
1101    GLuint *textures = (GLuint *) 0;
1102
1103    if (!textures_ref) {
1104        _exception = 1;
1105        _exceptionType = "java/lang/IllegalArgumentException";
1106        _exceptionMessage = "textures == null";
1107        goto exit;
1108    }
1109    if (offset < 0) {
1110        _exception = 1;
1111        _exceptionType = "java/lang/IllegalArgumentException";
1112        _exceptionMessage = "offset < 0";
1113        goto exit;
1114    }
1115    _remaining = _env->GetArrayLength(textures_ref) - offset;
1116    if (_remaining < n) {
1117        _exception = 1;
1118        _exceptionType = "java/lang/IllegalArgumentException";
1119        _exceptionMessage = "length - offset < n < needed";
1120        goto exit;
1121    }
1122    textures_base = (GLuint *)
1123        _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
1124    textures = textures_base + offset;
1125
1126    glGenTextures(
1127        (GLsizei)n,
1128        (GLuint *)textures
1129    );
1130
1131exit:
1132    if (textures_base) {
1133        _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
1134            _exception ? JNI_ABORT: 0);
1135    }
1136    if (_exception) {
1137        jniThrowException(_env, _exceptionType, _exceptionMessage);
1138    }
1139}
1140
1141/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1142static void
1143android_glGenTextures__ILjava_nio_IntBuffer_2
1144  (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
1145    jint _exception = 0;
1146    const char * _exceptionType = NULL;
1147    const char * _exceptionMessage = NULL;
1148    jarray _array = (jarray) 0;
1149    jint _bufferOffset = (jint) 0;
1150    jint _remaining;
1151    GLuint *textures = (GLuint *) 0;
1152
1153    textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset);
1154    if (_remaining < n) {
1155        _exception = 1;
1156        _exceptionType = "java/lang/IllegalArgumentException";
1157        _exceptionMessage = "remaining() < n < needed";
1158        goto exit;
1159    }
1160    if (textures == NULL) {
1161        char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1162        textures = (GLuint *) (_texturesBase + _bufferOffset);
1163    }
1164    glGenTextures(
1165        (GLsizei)n,
1166        (GLuint *)textures
1167    );
1168
1169exit:
1170    if (_array) {
1171        releasePointer(_env, _array, textures, _exception ? JNI_FALSE : JNI_TRUE);
1172    }
1173    if (_exception) {
1174        jniThrowException(_env, _exceptionType, _exceptionMessage);
1175    }
1176}
1177
1178/* GLenum glGetError ( void ) */
1179static jint
1180android_glGetError__
1181  (JNIEnv *_env, jobject _this) {
1182    GLenum _returnValue;
1183    _returnValue = glGetError();
1184    return (jint)_returnValue;
1185}
1186
1187/* void glGetIntegerv ( GLenum pname, GLint *params ) */
1188static void
1189android_glGetIntegerv__I_3II
1190  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
1191    jint _exception = 0;
1192    const char * _exceptionType = NULL;
1193    const char * _exceptionMessage = NULL;
1194    GLint *params_base = (GLint *) 0;
1195    jint _remaining;
1196    GLint *params = (GLint *) 0;
1197
1198    if (!params_ref) {
1199        _exception = 1;
1200        _exceptionType = "java/lang/IllegalArgumentException";
1201        _exceptionMessage = "params == null";
1202        goto exit;
1203    }
1204    if (offset < 0) {
1205        _exception = 1;
1206        _exceptionType = "java/lang/IllegalArgumentException";
1207        _exceptionMessage = "offset < 0";
1208        goto exit;
1209    }
1210    _remaining = _env->GetArrayLength(params_ref) - offset;
1211    int _needed;
1212    switch (pname) {
1213#if defined(GL_ALPHA_BITS)
1214        case GL_ALPHA_BITS:
1215#endif // defined(GL_ALPHA_BITS)
1216#if defined(GL_ALPHA_TEST_FUNC)
1217        case GL_ALPHA_TEST_FUNC:
1218#endif // defined(GL_ALPHA_TEST_FUNC)
1219#if defined(GL_ALPHA_TEST_REF)
1220        case GL_ALPHA_TEST_REF:
1221#endif // defined(GL_ALPHA_TEST_REF)
1222#if defined(GL_BLEND_DST)
1223        case GL_BLEND_DST:
1224#endif // defined(GL_BLEND_DST)
1225#if defined(GL_BLUE_BITS)
1226        case GL_BLUE_BITS:
1227#endif // defined(GL_BLUE_BITS)
1228#if defined(GL_COLOR_ARRAY_BUFFER_BINDING)
1229        case GL_COLOR_ARRAY_BUFFER_BINDING:
1230#endif // defined(GL_COLOR_ARRAY_BUFFER_BINDING)
1231#if defined(GL_COLOR_ARRAY_SIZE)
1232        case GL_COLOR_ARRAY_SIZE:
1233#endif // defined(GL_COLOR_ARRAY_SIZE)
1234#if defined(GL_COLOR_ARRAY_STRIDE)
1235        case GL_COLOR_ARRAY_STRIDE:
1236#endif // defined(GL_COLOR_ARRAY_STRIDE)
1237#if defined(GL_COLOR_ARRAY_TYPE)
1238        case GL_COLOR_ARRAY_TYPE:
1239#endif // defined(GL_COLOR_ARRAY_TYPE)
1240#if defined(GL_CULL_FACE)
1241        case GL_CULL_FACE:
1242#endif // defined(GL_CULL_FACE)
1243#if defined(GL_DEPTH_BITS)
1244        case GL_DEPTH_BITS:
1245#endif // defined(GL_DEPTH_BITS)
1246#if defined(GL_DEPTH_CLEAR_VALUE)
1247        case GL_DEPTH_CLEAR_VALUE:
1248#endif // defined(GL_DEPTH_CLEAR_VALUE)
1249#if defined(GL_DEPTH_FUNC)
1250        case GL_DEPTH_FUNC:
1251#endif // defined(GL_DEPTH_FUNC)
1252#if defined(GL_DEPTH_WRITEMASK)
1253        case GL_DEPTH_WRITEMASK:
1254#endif // defined(GL_DEPTH_WRITEMASK)
1255#if defined(GL_FOG_DENSITY)
1256        case GL_FOG_DENSITY:
1257#endif // defined(GL_FOG_DENSITY)
1258#if defined(GL_FOG_END)
1259        case GL_FOG_END:
1260#endif // defined(GL_FOG_END)
1261#if defined(GL_FOG_MODE)
1262        case GL_FOG_MODE:
1263#endif // defined(GL_FOG_MODE)
1264#if defined(GL_FOG_START)
1265        case GL_FOG_START:
1266#endif // defined(GL_FOG_START)
1267#if defined(GL_FRONT_FACE)
1268        case GL_FRONT_FACE:
1269#endif // defined(GL_FRONT_FACE)
1270#if defined(GL_GREEN_BITS)
1271        case GL_GREEN_BITS:
1272#endif // defined(GL_GREEN_BITS)
1273#if defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)
1274        case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
1275#endif // defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)
1276#if defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)
1277        case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
1278#endif // defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)
1279#if defined(GL_LIGHT_MODEL_COLOR_CONTROL)
1280        case GL_LIGHT_MODEL_COLOR_CONTROL:
1281#endif // defined(GL_LIGHT_MODEL_COLOR_CONTROL)
1282#if defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
1283        case GL_LIGHT_MODEL_LOCAL_VIEWER:
1284#endif // defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
1285#if defined(GL_LIGHT_MODEL_TWO_SIDE)
1286        case GL_LIGHT_MODEL_TWO_SIDE:
1287#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
1288#if defined(GL_LINE_SMOOTH_HINT)
1289        case GL_LINE_SMOOTH_HINT:
1290#endif // defined(GL_LINE_SMOOTH_HINT)
1291#if defined(GL_LINE_WIDTH)
1292        case GL_LINE_WIDTH:
1293#endif // defined(GL_LINE_WIDTH)
1294#if defined(GL_LOGIC_OP_MODE)
1295        case GL_LOGIC_OP_MODE:
1296#endif // defined(GL_LOGIC_OP_MODE)
1297#if defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES)
1298        case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES:
1299#endif // defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES)
1300#if defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES)
1301        case GL_MATRIX_INDEX_ARRAY_SIZE_OES:
1302#endif // defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES)
1303#if defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES)
1304        case GL_MATRIX_INDEX_ARRAY_STRIDE_OES:
1305#endif // defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES)
1306#if defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES)
1307        case GL_MATRIX_INDEX_ARRAY_TYPE_OES:
1308#endif // defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES)
1309#if defined(GL_MATRIX_MODE)
1310        case GL_MATRIX_MODE:
1311#endif // defined(GL_MATRIX_MODE)
1312#if defined(GL_MAX_CLIP_PLANES)
1313        case GL_MAX_CLIP_PLANES:
1314#endif // defined(GL_MAX_CLIP_PLANES)
1315#if defined(GL_MAX_ELEMENTS_INDICES)
1316        case GL_MAX_ELEMENTS_INDICES:
1317#endif // defined(GL_MAX_ELEMENTS_INDICES)
1318#if defined(GL_MAX_ELEMENTS_VERTICES)
1319        case GL_MAX_ELEMENTS_VERTICES:
1320#endif // defined(GL_MAX_ELEMENTS_VERTICES)
1321#if defined(GL_MAX_LIGHTS)
1322        case GL_MAX_LIGHTS:
1323#endif // defined(GL_MAX_LIGHTS)
1324#if defined(GL_MAX_MODELVIEW_STACK_DEPTH)
1325        case GL_MAX_MODELVIEW_STACK_DEPTH:
1326#endif // defined(GL_MAX_MODELVIEW_STACK_DEPTH)
1327#if defined(GL_MAX_PALETTE_MATRICES_OES)
1328        case GL_MAX_PALETTE_MATRICES_OES:
1329#endif // defined(GL_MAX_PALETTE_MATRICES_OES)
1330#if defined(GL_MAX_PROJECTION_STACK_DEPTH)
1331        case GL_MAX_PROJECTION_STACK_DEPTH:
1332#endif // defined(GL_MAX_PROJECTION_STACK_DEPTH)
1333#if defined(GL_MAX_TEXTURE_SIZE)
1334        case GL_MAX_TEXTURE_SIZE:
1335#endif // defined(GL_MAX_TEXTURE_SIZE)
1336#if defined(GL_MAX_TEXTURE_STACK_DEPTH)
1337        case GL_MAX_TEXTURE_STACK_DEPTH:
1338#endif // defined(GL_MAX_TEXTURE_STACK_DEPTH)
1339#if defined(GL_MAX_TEXTURE_UNITS)
1340        case GL_MAX_TEXTURE_UNITS:
1341#endif // defined(GL_MAX_TEXTURE_UNITS)
1342#if defined(GL_MAX_VERTEX_UNITS_OES)
1343        case GL_MAX_VERTEX_UNITS_OES:
1344#endif // defined(GL_MAX_VERTEX_UNITS_OES)
1345#if defined(GL_MODELVIEW_STACK_DEPTH)
1346        case GL_MODELVIEW_STACK_DEPTH:
1347#endif // defined(GL_MODELVIEW_STACK_DEPTH)
1348#if defined(GL_NORMAL_ARRAY_BUFFER_BINDING)
1349        case GL_NORMAL_ARRAY_BUFFER_BINDING:
1350#endif // defined(GL_NORMAL_ARRAY_BUFFER_BINDING)
1351#if defined(GL_NORMAL_ARRAY_STRIDE)
1352        case GL_NORMAL_ARRAY_STRIDE:
1353#endif // defined(GL_NORMAL_ARRAY_STRIDE)
1354#if defined(GL_NORMAL_ARRAY_TYPE)
1355        case GL_NORMAL_ARRAY_TYPE:
1356#endif // defined(GL_NORMAL_ARRAY_TYPE)
1357#if defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
1358        case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
1359#endif // defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
1360#if defined(GL_PACK_ALIGNMENT)
1361        case GL_PACK_ALIGNMENT:
1362#endif // defined(GL_PACK_ALIGNMENT)
1363#if defined(GL_PERSPECTIVE_CORRECTION_HINT)
1364        case GL_PERSPECTIVE_CORRECTION_HINT:
1365#endif // defined(GL_PERSPECTIVE_CORRECTION_HINT)
1366#if defined(GL_POINT_SIZE)
1367        case GL_POINT_SIZE:
1368#endif // defined(GL_POINT_SIZE)
1369#if defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES)
1370        case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
1371#endif // defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES)
1372#if defined(GL_POINT_SIZE_ARRAY_STRIDE_OES)
1373        case GL_POINT_SIZE_ARRAY_STRIDE_OES:
1374#endif // defined(GL_POINT_SIZE_ARRAY_STRIDE_OES)
1375#if defined(GL_POINT_SIZE_ARRAY_TYPE_OES)
1376        case GL_POINT_SIZE_ARRAY_TYPE_OES:
1377#endif // defined(GL_POINT_SIZE_ARRAY_TYPE_OES)
1378#if defined(GL_POINT_SMOOTH_HINT)
1379        case GL_POINT_SMOOTH_HINT:
1380#endif // defined(GL_POINT_SMOOTH_HINT)
1381#if defined(GL_POLYGON_OFFSET_FACTOR)
1382        case GL_POLYGON_OFFSET_FACTOR:
1383#endif // defined(GL_POLYGON_OFFSET_FACTOR)
1384#if defined(GL_POLYGON_OFFSET_UNITS)
1385        case GL_POLYGON_OFFSET_UNITS:
1386#endif // defined(GL_POLYGON_OFFSET_UNITS)
1387#if defined(GL_PROJECTION_STACK_DEPTH)
1388        case GL_PROJECTION_STACK_DEPTH:
1389#endif // defined(GL_PROJECTION_STACK_DEPTH)
1390#if defined(GL_RED_BITS)
1391        case GL_RED_BITS:
1392#endif // defined(GL_RED_BITS)
1393#if defined(GL_SHADE_MODEL)
1394        case GL_SHADE_MODEL:
1395#endif // defined(GL_SHADE_MODEL)
1396#if defined(GL_STENCIL_BITS)
1397        case GL_STENCIL_BITS:
1398#endif // defined(GL_STENCIL_BITS)
1399#if defined(GL_STENCIL_CLEAR_VALUE)
1400        case GL_STENCIL_CLEAR_VALUE:
1401#endif // defined(GL_STENCIL_CLEAR_VALUE)
1402#if defined(GL_STENCIL_FAIL)
1403        case GL_STENCIL_FAIL:
1404#endif // defined(GL_STENCIL_FAIL)
1405#if defined(GL_STENCIL_FUNC)
1406        case GL_STENCIL_FUNC:
1407#endif // defined(GL_STENCIL_FUNC)
1408#if defined(GL_STENCIL_PASS_DEPTH_FAIL)
1409        case GL_STENCIL_PASS_DEPTH_FAIL:
1410#endif // defined(GL_STENCIL_PASS_DEPTH_FAIL)
1411#if defined(GL_STENCIL_PASS_DEPTH_PASS)
1412        case GL_STENCIL_PASS_DEPTH_PASS:
1413#endif // defined(GL_STENCIL_PASS_DEPTH_PASS)
1414#if defined(GL_STENCIL_REF)
1415        case GL_STENCIL_REF:
1416#endif // defined(GL_STENCIL_REF)
1417#if defined(GL_STENCIL_VALUE_MASK)
1418        case GL_STENCIL_VALUE_MASK:
1419#endif // defined(GL_STENCIL_VALUE_MASK)
1420#if defined(GL_STENCIL_WRITEMASK)
1421        case GL_STENCIL_WRITEMASK:
1422#endif // defined(GL_STENCIL_WRITEMASK)
1423#if defined(GL_SUBPIXEL_BITS)
1424        case GL_SUBPIXEL_BITS:
1425#endif // defined(GL_SUBPIXEL_BITS)
1426#if defined(GL_TEXTURE_BINDING_2D)
1427        case GL_TEXTURE_BINDING_2D:
1428#endif // defined(GL_TEXTURE_BINDING_2D)
1429#if defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)
1430        case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
1431#endif // defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)
1432#if defined(GL_TEXTURE_COORD_ARRAY_SIZE)
1433        case GL_TEXTURE_COORD_ARRAY_SIZE:
1434#endif // defined(GL_TEXTURE_COORD_ARRAY_SIZE)
1435#if defined(GL_TEXTURE_COORD_ARRAY_STRIDE)
1436        case GL_TEXTURE_COORD_ARRAY_STRIDE:
1437#endif // defined(GL_TEXTURE_COORD_ARRAY_STRIDE)
1438#if defined(GL_TEXTURE_COORD_ARRAY_TYPE)
1439        case GL_TEXTURE_COORD_ARRAY_TYPE:
1440#endif // defined(GL_TEXTURE_COORD_ARRAY_TYPE)
1441#if defined(GL_TEXTURE_STACK_DEPTH)
1442        case GL_TEXTURE_STACK_DEPTH:
1443#endif // defined(GL_TEXTURE_STACK_DEPTH)
1444#if defined(GL_UNPACK_ALIGNMENT)
1445        case GL_UNPACK_ALIGNMENT:
1446#endif // defined(GL_UNPACK_ALIGNMENT)
1447#if defined(GL_VERTEX_ARRAY_BUFFER_BINDING)
1448        case GL_VERTEX_ARRAY_BUFFER_BINDING:
1449#endif // defined(GL_VERTEX_ARRAY_BUFFER_BINDING)
1450#if defined(GL_VERTEX_ARRAY_SIZE)
1451        case GL_VERTEX_ARRAY_SIZE:
1452#endif // defined(GL_VERTEX_ARRAY_SIZE)
1453#if defined(GL_VERTEX_ARRAY_STRIDE)
1454        case GL_VERTEX_ARRAY_STRIDE:
1455#endif // defined(GL_VERTEX_ARRAY_STRIDE)
1456#if defined(GL_VERTEX_ARRAY_TYPE)
1457        case GL_VERTEX_ARRAY_TYPE:
1458#endif // defined(GL_VERTEX_ARRAY_TYPE)
1459#if defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES)
1460        case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES:
1461#endif // defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES)
1462#if defined(GL_WEIGHT_ARRAY_SIZE_OES)
1463        case GL_WEIGHT_ARRAY_SIZE_OES:
1464#endif // defined(GL_WEIGHT_ARRAY_SIZE_OES)
1465#if defined(GL_WEIGHT_ARRAY_STRIDE_OES)
1466        case GL_WEIGHT_ARRAY_STRIDE_OES:
1467#endif // defined(GL_WEIGHT_ARRAY_STRIDE_OES)
1468#if defined(GL_WEIGHT_ARRAY_TYPE_OES)
1469        case GL_WEIGHT_ARRAY_TYPE_OES:
1470#endif // defined(GL_WEIGHT_ARRAY_TYPE_OES)
1471            _needed = 1;
1472            break;
1473#if defined(GL_ALIASED_POINT_SIZE_RANGE)
1474        case GL_ALIASED_POINT_SIZE_RANGE:
1475#endif // defined(GL_ALIASED_POINT_SIZE_RANGE)
1476#if defined(GL_ALIASED_LINE_WIDTH_RANGE)
1477        case GL_ALIASED_LINE_WIDTH_RANGE:
1478#endif // defined(GL_ALIASED_LINE_WIDTH_RANGE)
1479#if defined(GL_DEPTH_RANGE)
1480        case GL_DEPTH_RANGE:
1481#endif // defined(GL_DEPTH_RANGE)
1482#if defined(GL_MAX_VIEWPORT_DIMS)
1483        case GL_MAX_VIEWPORT_DIMS:
1484#endif // defined(GL_MAX_VIEWPORT_DIMS)
1485#if defined(GL_SMOOTH_LINE_WIDTH_RANGE)
1486        case GL_SMOOTH_LINE_WIDTH_RANGE:
1487#endif // defined(GL_SMOOTH_LINE_WIDTH_RANGE)
1488#if defined(GL_SMOOTH_POINT_SIZE_RANGE)
1489        case GL_SMOOTH_POINT_SIZE_RANGE:
1490#endif // defined(GL_SMOOTH_POINT_SIZE_RANGE)
1491            _needed = 2;
1492            break;
1493#if defined(GL_COLOR_CLEAR_VALUE)
1494        case GL_COLOR_CLEAR_VALUE:
1495#endif // defined(GL_COLOR_CLEAR_VALUE)
1496#if defined(GL_COLOR_WRITEMASK)
1497        case GL_COLOR_WRITEMASK:
1498#endif // defined(GL_COLOR_WRITEMASK)
1499#if defined(GL_FOG_COLOR)
1500        case GL_FOG_COLOR:
1501#endif // defined(GL_FOG_COLOR)
1502#if defined(GL_LIGHT_MODEL_AMBIENT)
1503        case GL_LIGHT_MODEL_AMBIENT:
1504#endif // defined(GL_LIGHT_MODEL_AMBIENT)
1505#if defined(GL_SCISSOR_BOX)
1506        case GL_SCISSOR_BOX:
1507#endif // defined(GL_SCISSOR_BOX)
1508#if defined(GL_VIEWPORT)
1509        case GL_VIEWPORT:
1510#endif // defined(GL_VIEWPORT)
1511            _needed = 4;
1512            break;
1513#if defined(GL_MODELVIEW_MATRIX)
1514        case GL_MODELVIEW_MATRIX:
1515#endif // defined(GL_MODELVIEW_MATRIX)
1516#if defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES)
1517        case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES:
1518#endif // defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES)
1519#if defined(GL_PROJECTION_MATRIX)
1520        case GL_PROJECTION_MATRIX:
1521#endif // defined(GL_PROJECTION_MATRIX)
1522#if defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES)
1523        case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES:
1524#endif // defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES)
1525#if defined(GL_TEXTURE_MATRIX)
1526        case GL_TEXTURE_MATRIX:
1527#endif // defined(GL_TEXTURE_MATRIX)
1528#if defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES)
1529        case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES:
1530#endif // defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES)
1531            _needed = 16;
1532            break;
1533#if defined(GL_COMPRESSED_TEXTURE_FORMATS)
1534        case GL_COMPRESSED_TEXTURE_FORMATS:
1535#endif // defined(GL_COMPRESSED_TEXTURE_FORMATS)
1536            _needed = getNumCompressedTextureFormats();
1537            break;
1538        default:
1539            _needed = 1;
1540            break;
1541    }
1542    if (_remaining < _needed) {
1543        _exception = 1;
1544        _exceptionType = "java/lang/IllegalArgumentException";
1545        _exceptionMessage = "length - offset < needed";
1546        goto exit;
1547    }
1548    params_base = (GLint *)
1549        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1550    params = params_base + offset;
1551
1552    glGetIntegerv(
1553        (GLenum)pname,
1554        (GLint *)params
1555    );
1556
1557exit:
1558    if (params_base) {
1559        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1560            _exception ? JNI_ABORT: 0);
1561    }
1562    if (_exception) {
1563        jniThrowException(_env, _exceptionType, _exceptionMessage);
1564    }
1565}
1566
1567/* void glGetIntegerv ( GLenum pname, GLint *params ) */
1568static void
1569android_glGetIntegerv__ILjava_nio_IntBuffer_2
1570  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
1571    jint _exception = 0;
1572    const char * _exceptionType = NULL;
1573    const char * _exceptionMessage = NULL;
1574    jarray _array = (jarray) 0;
1575    jint _bufferOffset = (jint) 0;
1576    jint _remaining;
1577    GLint *params = (GLint *) 0;
1578
1579    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
1580    int _needed;
1581    switch (pname) {
1582#if defined(GL_ALPHA_BITS)
1583        case GL_ALPHA_BITS:
1584#endif // defined(GL_ALPHA_BITS)
1585#if defined(GL_ALPHA_TEST_FUNC)
1586        case GL_ALPHA_TEST_FUNC:
1587#endif // defined(GL_ALPHA_TEST_FUNC)
1588#if defined(GL_ALPHA_TEST_REF)
1589        case GL_ALPHA_TEST_REF:
1590#endif // defined(GL_ALPHA_TEST_REF)
1591#if defined(GL_BLEND_DST)
1592        case GL_BLEND_DST:
1593#endif // defined(GL_BLEND_DST)
1594#if defined(GL_BLUE_BITS)
1595        case GL_BLUE_BITS:
1596#endif // defined(GL_BLUE_BITS)
1597#if defined(GL_COLOR_ARRAY_BUFFER_BINDING)
1598        case GL_COLOR_ARRAY_BUFFER_BINDING:
1599#endif // defined(GL_COLOR_ARRAY_BUFFER_BINDING)
1600#if defined(GL_COLOR_ARRAY_SIZE)
1601        case GL_COLOR_ARRAY_SIZE:
1602#endif // defined(GL_COLOR_ARRAY_SIZE)
1603#if defined(GL_COLOR_ARRAY_STRIDE)
1604        case GL_COLOR_ARRAY_STRIDE:
1605#endif // defined(GL_COLOR_ARRAY_STRIDE)
1606#if defined(GL_COLOR_ARRAY_TYPE)
1607        case GL_COLOR_ARRAY_TYPE:
1608#endif // defined(GL_COLOR_ARRAY_TYPE)
1609#if defined(GL_CULL_FACE)
1610        case GL_CULL_FACE:
1611#endif // defined(GL_CULL_FACE)
1612#if defined(GL_DEPTH_BITS)
1613        case GL_DEPTH_BITS:
1614#endif // defined(GL_DEPTH_BITS)
1615#if defined(GL_DEPTH_CLEAR_VALUE)
1616        case GL_DEPTH_CLEAR_VALUE:
1617#endif // defined(GL_DEPTH_CLEAR_VALUE)
1618#if defined(GL_DEPTH_FUNC)
1619        case GL_DEPTH_FUNC:
1620#endif // defined(GL_DEPTH_FUNC)
1621#if defined(GL_DEPTH_WRITEMASK)
1622        case GL_DEPTH_WRITEMASK:
1623#endif // defined(GL_DEPTH_WRITEMASK)
1624#if defined(GL_FOG_DENSITY)
1625        case GL_FOG_DENSITY:
1626#endif // defined(GL_FOG_DENSITY)
1627#if defined(GL_FOG_END)
1628        case GL_FOG_END:
1629#endif // defined(GL_FOG_END)
1630#if defined(GL_FOG_MODE)
1631        case GL_FOG_MODE:
1632#endif // defined(GL_FOG_MODE)
1633#if defined(GL_FOG_START)
1634        case GL_FOG_START:
1635#endif // defined(GL_FOG_START)
1636#if defined(GL_FRONT_FACE)
1637        case GL_FRONT_FACE:
1638#endif // defined(GL_FRONT_FACE)
1639#if defined(GL_GREEN_BITS)
1640        case GL_GREEN_BITS:
1641#endif // defined(GL_GREEN_BITS)
1642#if defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)
1643        case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
1644#endif // defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)
1645#if defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)
1646        case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
1647#endif // defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)
1648#if defined(GL_LIGHT_MODEL_COLOR_CONTROL)
1649        case GL_LIGHT_MODEL_COLOR_CONTROL:
1650#endif // defined(GL_LIGHT_MODEL_COLOR_CONTROL)
1651#if defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
1652        case GL_LIGHT_MODEL_LOCAL_VIEWER:
1653#endif // defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
1654#if defined(GL_LIGHT_MODEL_TWO_SIDE)
1655        case GL_LIGHT_MODEL_TWO_SIDE:
1656#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
1657#if defined(GL_LINE_SMOOTH_HINT)
1658        case GL_LINE_SMOOTH_HINT:
1659#endif // defined(GL_LINE_SMOOTH_HINT)
1660#if defined(GL_LINE_WIDTH)
1661        case GL_LINE_WIDTH:
1662#endif // defined(GL_LINE_WIDTH)
1663#if defined(GL_LOGIC_OP_MODE)
1664        case GL_LOGIC_OP_MODE:
1665#endif // defined(GL_LOGIC_OP_MODE)
1666#if defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES)
1667        case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES:
1668#endif // defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES)
1669#if defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES)
1670        case GL_MATRIX_INDEX_ARRAY_SIZE_OES:
1671#endif // defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES)
1672#if defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES)
1673        case GL_MATRIX_INDEX_ARRAY_STRIDE_OES:
1674#endif // defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES)
1675#if defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES)
1676        case GL_MATRIX_INDEX_ARRAY_TYPE_OES:
1677#endif // defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES)
1678#if defined(GL_MATRIX_MODE)
1679        case GL_MATRIX_MODE:
1680#endif // defined(GL_MATRIX_MODE)
1681#if defined(GL_MAX_CLIP_PLANES)
1682        case GL_MAX_CLIP_PLANES:
1683#endif // defined(GL_MAX_CLIP_PLANES)
1684#if defined(GL_MAX_ELEMENTS_INDICES)
1685        case GL_MAX_ELEMENTS_INDICES:
1686#endif // defined(GL_MAX_ELEMENTS_INDICES)
1687#if defined(GL_MAX_ELEMENTS_VERTICES)
1688        case GL_MAX_ELEMENTS_VERTICES:
1689#endif // defined(GL_MAX_ELEMENTS_VERTICES)
1690#if defined(GL_MAX_LIGHTS)
1691        case GL_MAX_LIGHTS:
1692#endif // defined(GL_MAX_LIGHTS)
1693#if defined(GL_MAX_MODELVIEW_STACK_DEPTH)
1694        case GL_MAX_MODELVIEW_STACK_DEPTH:
1695#endif // defined(GL_MAX_MODELVIEW_STACK_DEPTH)
1696#if defined(GL_MAX_PALETTE_MATRICES_OES)
1697        case GL_MAX_PALETTE_MATRICES_OES:
1698#endif // defined(GL_MAX_PALETTE_MATRICES_OES)
1699#if defined(GL_MAX_PROJECTION_STACK_DEPTH)
1700        case GL_MAX_PROJECTION_STACK_DEPTH:
1701#endif // defined(GL_MAX_PROJECTION_STACK_DEPTH)
1702#if defined(GL_MAX_TEXTURE_SIZE)
1703        case GL_MAX_TEXTURE_SIZE:
1704#endif // defined(GL_MAX_TEXTURE_SIZE)
1705#if defined(GL_MAX_TEXTURE_STACK_DEPTH)
1706        case GL_MAX_TEXTURE_STACK_DEPTH:
1707#endif // defined(GL_MAX_TEXTURE_STACK_DEPTH)
1708#if defined(GL_MAX_TEXTURE_UNITS)
1709        case GL_MAX_TEXTURE_UNITS:
1710#endif // defined(GL_MAX_TEXTURE_UNITS)
1711#if defined(GL_MAX_VERTEX_UNITS_OES)
1712        case GL_MAX_VERTEX_UNITS_OES:
1713#endif // defined(GL_MAX_VERTEX_UNITS_OES)
1714#if defined(GL_MODELVIEW_STACK_DEPTH)
1715        case GL_MODELVIEW_STACK_DEPTH:
1716#endif // defined(GL_MODELVIEW_STACK_DEPTH)
1717#if defined(GL_NORMAL_ARRAY_BUFFER_BINDING)
1718        case GL_NORMAL_ARRAY_BUFFER_BINDING:
1719#endif // defined(GL_NORMAL_ARRAY_BUFFER_BINDING)
1720#if defined(GL_NORMAL_ARRAY_STRIDE)
1721        case GL_NORMAL_ARRAY_STRIDE:
1722#endif // defined(GL_NORMAL_ARRAY_STRIDE)
1723#if defined(GL_NORMAL_ARRAY_TYPE)
1724        case GL_NORMAL_ARRAY_TYPE:
1725#endif // defined(GL_NORMAL_ARRAY_TYPE)
1726#if defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
1727        case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
1728#endif // defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
1729#if defined(GL_PACK_ALIGNMENT)
1730        case GL_PACK_ALIGNMENT:
1731#endif // defined(GL_PACK_ALIGNMENT)
1732#if defined(GL_PERSPECTIVE_CORRECTION_HINT)
1733        case GL_PERSPECTIVE_CORRECTION_HINT:
1734#endif // defined(GL_PERSPECTIVE_CORRECTION_HINT)
1735#if defined(GL_POINT_SIZE)
1736        case GL_POINT_SIZE:
1737#endif // defined(GL_POINT_SIZE)
1738#if defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES)
1739        case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
1740#endif // defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES)
1741#if defined(GL_POINT_SIZE_ARRAY_STRIDE_OES)
1742        case GL_POINT_SIZE_ARRAY_STRIDE_OES:
1743#endif // defined(GL_POINT_SIZE_ARRAY_STRIDE_OES)
1744#if defined(GL_POINT_SIZE_ARRAY_TYPE_OES)
1745        case GL_POINT_SIZE_ARRAY_TYPE_OES:
1746#endif // defined(GL_POINT_SIZE_ARRAY_TYPE_OES)
1747#if defined(GL_POINT_SMOOTH_HINT)
1748        case GL_POINT_SMOOTH_HINT:
1749#endif // defined(GL_POINT_SMOOTH_HINT)
1750#if defined(GL_POLYGON_OFFSET_FACTOR)
1751        case GL_POLYGON_OFFSET_FACTOR:
1752#endif // defined(GL_POLYGON_OFFSET_FACTOR)
1753#if defined(GL_POLYGON_OFFSET_UNITS)
1754        case GL_POLYGON_OFFSET_UNITS:
1755#endif // defined(GL_POLYGON_OFFSET_UNITS)
1756#if defined(GL_PROJECTION_STACK_DEPTH)
1757        case GL_PROJECTION_STACK_DEPTH:
1758#endif // defined(GL_PROJECTION_STACK_DEPTH)
1759#if defined(GL_RED_BITS)
1760        case GL_RED_BITS:
1761#endif // defined(GL_RED_BITS)
1762#if defined(GL_SHADE_MODEL)
1763        case GL_SHADE_MODEL:
1764#endif // defined(GL_SHADE_MODEL)
1765#if defined(GL_STENCIL_BITS)
1766        case GL_STENCIL_BITS:
1767#endif // defined(GL_STENCIL_BITS)
1768#if defined(GL_STENCIL_CLEAR_VALUE)
1769        case GL_STENCIL_CLEAR_VALUE:
1770#endif // defined(GL_STENCIL_CLEAR_VALUE)
1771#if defined(GL_STENCIL_FAIL)
1772        case GL_STENCIL_FAIL:
1773#endif // defined(GL_STENCIL_FAIL)
1774#if defined(GL_STENCIL_FUNC)
1775        case GL_STENCIL_FUNC:
1776#endif // defined(GL_STENCIL_FUNC)
1777#if defined(GL_STENCIL_PASS_DEPTH_FAIL)
1778        case GL_STENCIL_PASS_DEPTH_FAIL:
1779#endif // defined(GL_STENCIL_PASS_DEPTH_FAIL)
1780#if defined(GL_STENCIL_PASS_DEPTH_PASS)
1781        case GL_STENCIL_PASS_DEPTH_PASS:
1782#endif // defined(GL_STENCIL_PASS_DEPTH_PASS)
1783#if defined(GL_STENCIL_REF)
1784        case GL_STENCIL_REF:
1785#endif // defined(GL_STENCIL_REF)
1786#if defined(GL_STENCIL_VALUE_MASK)
1787        case GL_STENCIL_VALUE_MASK:
1788#endif // defined(GL_STENCIL_VALUE_MASK)
1789#if defined(GL_STENCIL_WRITEMASK)
1790        case GL_STENCIL_WRITEMASK:
1791#endif // defined(GL_STENCIL_WRITEMASK)
1792#if defined(GL_SUBPIXEL_BITS)
1793        case GL_SUBPIXEL_BITS:
1794#endif // defined(GL_SUBPIXEL_BITS)
1795#if defined(GL_TEXTURE_BINDING_2D)
1796        case GL_TEXTURE_BINDING_2D:
1797#endif // defined(GL_TEXTURE_BINDING_2D)
1798#if defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)
1799        case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
1800#endif // defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)
1801#if defined(GL_TEXTURE_COORD_ARRAY_SIZE)
1802        case GL_TEXTURE_COORD_ARRAY_SIZE:
1803#endif // defined(GL_TEXTURE_COORD_ARRAY_SIZE)
1804#if defined(GL_TEXTURE_COORD_ARRAY_STRIDE)
1805        case GL_TEXTURE_COORD_ARRAY_STRIDE:
1806#endif // defined(GL_TEXTURE_COORD_ARRAY_STRIDE)
1807#if defined(GL_TEXTURE_COORD_ARRAY_TYPE)
1808        case GL_TEXTURE_COORD_ARRAY_TYPE:
1809#endif // defined(GL_TEXTURE_COORD_ARRAY_TYPE)
1810#if defined(GL_TEXTURE_STACK_DEPTH)
1811        case GL_TEXTURE_STACK_DEPTH:
1812#endif // defined(GL_TEXTURE_STACK_DEPTH)
1813#if defined(GL_UNPACK_ALIGNMENT)
1814        case GL_UNPACK_ALIGNMENT:
1815#endif // defined(GL_UNPACK_ALIGNMENT)
1816#if defined(GL_VERTEX_ARRAY_BUFFER_BINDING)
1817        case GL_VERTEX_ARRAY_BUFFER_BINDING:
1818#endif // defined(GL_VERTEX_ARRAY_BUFFER_BINDING)
1819#if defined(GL_VERTEX_ARRAY_SIZE)
1820        case GL_VERTEX_ARRAY_SIZE:
1821#endif // defined(GL_VERTEX_ARRAY_SIZE)
1822#if defined(GL_VERTEX_ARRAY_STRIDE)
1823        case GL_VERTEX_ARRAY_STRIDE:
1824#endif // defined(GL_VERTEX_ARRAY_STRIDE)
1825#if defined(GL_VERTEX_ARRAY_TYPE)
1826        case GL_VERTEX_ARRAY_TYPE:
1827#endif // defined(GL_VERTEX_ARRAY_TYPE)
1828#if defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES)
1829        case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES:
1830#endif // defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES)
1831#if defined(GL_WEIGHT_ARRAY_SIZE_OES)
1832        case GL_WEIGHT_ARRAY_SIZE_OES:
1833#endif // defined(GL_WEIGHT_ARRAY_SIZE_OES)
1834#if defined(GL_WEIGHT_ARRAY_STRIDE_OES)
1835        case GL_WEIGHT_ARRAY_STRIDE_OES:
1836#endif // defined(GL_WEIGHT_ARRAY_STRIDE_OES)
1837#if defined(GL_WEIGHT_ARRAY_TYPE_OES)
1838        case GL_WEIGHT_ARRAY_TYPE_OES:
1839#endif // defined(GL_WEIGHT_ARRAY_TYPE_OES)
1840            _needed = 1;
1841            break;
1842#if defined(GL_ALIASED_POINT_SIZE_RANGE)
1843        case GL_ALIASED_POINT_SIZE_RANGE:
1844#endif // defined(GL_ALIASED_POINT_SIZE_RANGE)
1845#if defined(GL_ALIASED_LINE_WIDTH_RANGE)
1846        case GL_ALIASED_LINE_WIDTH_RANGE:
1847#endif // defined(GL_ALIASED_LINE_WIDTH_RANGE)
1848#if defined(GL_DEPTH_RANGE)
1849        case GL_DEPTH_RANGE:
1850#endif // defined(GL_DEPTH_RANGE)
1851#if defined(GL_MAX_VIEWPORT_DIMS)
1852        case GL_MAX_VIEWPORT_DIMS:
1853#endif // defined(GL_MAX_VIEWPORT_DIMS)
1854#if defined(GL_SMOOTH_LINE_WIDTH_RANGE)
1855        case GL_SMOOTH_LINE_WIDTH_RANGE:
1856#endif // defined(GL_SMOOTH_LINE_WIDTH_RANGE)
1857#if defined(GL_SMOOTH_POINT_SIZE_RANGE)
1858        case GL_SMOOTH_POINT_SIZE_RANGE:
1859#endif // defined(GL_SMOOTH_POINT_SIZE_RANGE)
1860            _needed = 2;
1861            break;
1862#if defined(GL_COLOR_CLEAR_VALUE)
1863        case GL_COLOR_CLEAR_VALUE:
1864#endif // defined(GL_COLOR_CLEAR_VALUE)
1865#if defined(GL_COLOR_WRITEMASK)
1866        case GL_COLOR_WRITEMASK:
1867#endif // defined(GL_COLOR_WRITEMASK)
1868#if defined(GL_FOG_COLOR)
1869        case GL_FOG_COLOR:
1870#endif // defined(GL_FOG_COLOR)
1871#if defined(GL_LIGHT_MODEL_AMBIENT)
1872        case GL_LIGHT_MODEL_AMBIENT:
1873#endif // defined(GL_LIGHT_MODEL_AMBIENT)
1874#if defined(GL_SCISSOR_BOX)
1875        case GL_SCISSOR_BOX:
1876#endif // defined(GL_SCISSOR_BOX)
1877#if defined(GL_VIEWPORT)
1878        case GL_VIEWPORT:
1879#endif // defined(GL_VIEWPORT)
1880            _needed = 4;
1881            break;
1882#if defined(GL_MODELVIEW_MATRIX)
1883        case GL_MODELVIEW_MATRIX:
1884#endif // defined(GL_MODELVIEW_MATRIX)
1885#if defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES)
1886        case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES:
1887#endif // defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES)
1888#if defined(GL_PROJECTION_MATRIX)
1889        case GL_PROJECTION_MATRIX:
1890#endif // defined(GL_PROJECTION_MATRIX)
1891#if defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES)
1892        case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES:
1893#endif // defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES)
1894#if defined(GL_TEXTURE_MATRIX)
1895        case GL_TEXTURE_MATRIX:
1896#endif // defined(GL_TEXTURE_MATRIX)
1897#if defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES)
1898        case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES:
1899#endif // defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES)
1900            _needed = 16;
1901            break;
1902#if defined(GL_COMPRESSED_TEXTURE_FORMATS)
1903        case GL_COMPRESSED_TEXTURE_FORMATS:
1904#endif // defined(GL_COMPRESSED_TEXTURE_FORMATS)
1905            _needed = getNumCompressedTextureFormats();
1906            break;
1907        default:
1908            _needed = 1;
1909            break;
1910    }
1911    if (_remaining < _needed) {
1912        _exception = 1;
1913        _exceptionType = "java/lang/IllegalArgumentException";
1914        _exceptionMessage = "remaining() < needed";
1915        goto exit;
1916    }
1917    if (params == NULL) {
1918        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1919        params = (GLint *) (_paramsBase + _bufferOffset);
1920    }
1921    glGetIntegerv(
1922        (GLenum)pname,
1923        (GLint *)params
1924    );
1925
1926exit:
1927    if (_array) {
1928        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1929    }
1930    if (_exception) {
1931        jniThrowException(_env, _exceptionType, _exceptionMessage);
1932    }
1933}
1934
1935/* const GLubyte * glGetString ( GLenum name ) */
1936static jstring android_glGetString(JNIEnv *_env, jobject, jint name) {
1937    const char* chars = (const char*) glGetString((GLenum) name);
1938    return _env->NewStringUTF(chars);
1939}
1940/* void glHint ( GLenum target, GLenum mode ) */
1941static void
1942android_glHint__II
1943  (JNIEnv *_env, jobject _this, jint target, jint mode) {
1944    glHint(
1945        (GLenum)target,
1946        (GLenum)mode
1947    );
1948}
1949
1950/* void glLightModelf ( GLenum pname, GLfloat param ) */
1951static void
1952android_glLightModelf__IF
1953  (JNIEnv *_env, jobject _this, jint pname, jfloat param) {
1954    glLightModelf(
1955        (GLenum)pname,
1956        (GLfloat)param
1957    );
1958}
1959
1960/* void glLightModelfv ( GLenum pname, const GLfloat *params ) */
1961static void
1962android_glLightModelfv__I_3FI
1963  (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
1964    jint _exception = 0;
1965    const char * _exceptionType = NULL;
1966    const char * _exceptionMessage = NULL;
1967    GLfloat *params_base = (GLfloat *) 0;
1968    jint _remaining;
1969    GLfloat *params = (GLfloat *) 0;
1970
1971    if (!params_ref) {
1972        _exception = 1;
1973        _exceptionType = "java/lang/IllegalArgumentException";
1974        _exceptionMessage = "params == null";
1975        goto exit;
1976    }
1977    if (offset < 0) {
1978        _exception = 1;
1979        _exceptionType = "java/lang/IllegalArgumentException";
1980        _exceptionMessage = "offset < 0";
1981        goto exit;
1982    }
1983    _remaining = _env->GetArrayLength(params_ref) - offset;
1984    int _needed;
1985    switch (pname) {
1986#if defined(GL_LIGHT_MODEL_TWO_SIDE)
1987        case GL_LIGHT_MODEL_TWO_SIDE:
1988#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
1989            _needed = 1;
1990            break;
1991#if defined(GL_LIGHT_MODEL_AMBIENT)
1992        case GL_LIGHT_MODEL_AMBIENT:
1993#endif // defined(GL_LIGHT_MODEL_AMBIENT)
1994            _needed = 4;
1995            break;
1996        default:
1997            _needed = 1;
1998            break;
1999    }
2000    if (_remaining < _needed) {
2001        _exception = 1;
2002        _exceptionType = "java/lang/IllegalArgumentException";
2003        _exceptionMessage = "length - offset < needed";
2004        goto exit;
2005    }
2006    params_base = (GLfloat *)
2007        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2008    params = params_base + offset;
2009
2010    glLightModelfv(
2011        (GLenum)pname,
2012        (GLfloat *)params
2013    );
2014
2015exit:
2016    if (params_base) {
2017        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2018            JNI_ABORT);
2019    }
2020    if (_exception) {
2021        jniThrowException(_env, _exceptionType, _exceptionMessage);
2022    }
2023}
2024
2025/* void glLightModelfv ( GLenum pname, const GLfloat *params ) */
2026static void
2027android_glLightModelfv__ILjava_nio_FloatBuffer_2
2028  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
2029    jint _exception = 0;
2030    const char * _exceptionType = NULL;
2031    const char * _exceptionMessage = NULL;
2032    jarray _array = (jarray) 0;
2033    jint _bufferOffset = (jint) 0;
2034    jint _remaining;
2035    GLfloat *params = (GLfloat *) 0;
2036
2037    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
2038    int _needed;
2039    switch (pname) {
2040#if defined(GL_LIGHT_MODEL_TWO_SIDE)
2041        case GL_LIGHT_MODEL_TWO_SIDE:
2042#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
2043            _needed = 1;
2044            break;
2045#if defined(GL_LIGHT_MODEL_AMBIENT)
2046        case GL_LIGHT_MODEL_AMBIENT:
2047#endif // defined(GL_LIGHT_MODEL_AMBIENT)
2048            _needed = 4;
2049            break;
2050        default:
2051            _needed = 1;
2052            break;
2053    }
2054    if (_remaining < _needed) {
2055        _exception = 1;
2056        _exceptionType = "java/lang/IllegalArgumentException";
2057        _exceptionMessage = "remaining() < needed";
2058        goto exit;
2059    }
2060    if (params == NULL) {
2061        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2062        params = (GLfloat *) (_paramsBase + _bufferOffset);
2063    }
2064    glLightModelfv(
2065        (GLenum)pname,
2066        (GLfloat *)params
2067    );
2068
2069exit:
2070    if (_array) {
2071        releasePointer(_env, _array, params, JNI_FALSE);
2072    }
2073    if (_exception) {
2074        jniThrowException(_env, _exceptionType, _exceptionMessage);
2075    }
2076}
2077
2078/* void glLightModelx ( GLenum pname, GLfixed param ) */
2079static void
2080android_glLightModelx__II
2081  (JNIEnv *_env, jobject _this, jint pname, jint param) {
2082    glLightModelx(
2083        (GLenum)pname,
2084        (GLfixed)param
2085    );
2086}
2087
2088/* void glLightModelxv ( GLenum pname, const GLfixed *params ) */
2089static void
2090android_glLightModelxv__I_3II
2091  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
2092    jint _exception = 0;
2093    const char * _exceptionType = NULL;
2094    const char * _exceptionMessage = NULL;
2095    GLfixed *params_base = (GLfixed *) 0;
2096    jint _remaining;
2097    GLfixed *params = (GLfixed *) 0;
2098
2099    if (!params_ref) {
2100        _exception = 1;
2101        _exceptionType = "java/lang/IllegalArgumentException";
2102        _exceptionMessage = "params == null";
2103        goto exit;
2104    }
2105    if (offset < 0) {
2106        _exception = 1;
2107        _exceptionType = "java/lang/IllegalArgumentException";
2108        _exceptionMessage = "offset < 0";
2109        goto exit;
2110    }
2111    _remaining = _env->GetArrayLength(params_ref) - offset;
2112    int _needed;
2113    switch (pname) {
2114#if defined(GL_LIGHT_MODEL_TWO_SIDE)
2115        case GL_LIGHT_MODEL_TWO_SIDE:
2116#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
2117            _needed = 1;
2118            break;
2119#if defined(GL_LIGHT_MODEL_AMBIENT)
2120        case GL_LIGHT_MODEL_AMBIENT:
2121#endif // defined(GL_LIGHT_MODEL_AMBIENT)
2122            _needed = 4;
2123            break;
2124        default:
2125            _needed = 1;
2126            break;
2127    }
2128    if (_remaining < _needed) {
2129        _exception = 1;
2130        _exceptionType = "java/lang/IllegalArgumentException";
2131        _exceptionMessage = "length - offset < needed";
2132        goto exit;
2133    }
2134    params_base = (GLfixed *)
2135        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2136    params = params_base + offset;
2137
2138    glLightModelxv(
2139        (GLenum)pname,
2140        (GLfixed *)params
2141    );
2142
2143exit:
2144    if (params_base) {
2145        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2146            JNI_ABORT);
2147    }
2148    if (_exception) {
2149        jniThrowException(_env, _exceptionType, _exceptionMessage);
2150    }
2151}
2152
2153/* void glLightModelxv ( GLenum pname, const GLfixed *params ) */
2154static void
2155android_glLightModelxv__ILjava_nio_IntBuffer_2
2156  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
2157    jint _exception = 0;
2158    const char * _exceptionType = NULL;
2159    const char * _exceptionMessage = NULL;
2160    jarray _array = (jarray) 0;
2161    jint _bufferOffset = (jint) 0;
2162    jint _remaining;
2163    GLfixed *params = (GLfixed *) 0;
2164
2165    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
2166    int _needed;
2167    switch (pname) {
2168#if defined(GL_LIGHT_MODEL_TWO_SIDE)
2169        case GL_LIGHT_MODEL_TWO_SIDE:
2170#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
2171            _needed = 1;
2172            break;
2173#if defined(GL_LIGHT_MODEL_AMBIENT)
2174        case GL_LIGHT_MODEL_AMBIENT:
2175#endif // defined(GL_LIGHT_MODEL_AMBIENT)
2176            _needed = 4;
2177            break;
2178        default:
2179            _needed = 1;
2180            break;
2181    }
2182    if (_remaining < _needed) {
2183        _exception = 1;
2184        _exceptionType = "java/lang/IllegalArgumentException";
2185        _exceptionMessage = "remaining() < needed";
2186        goto exit;
2187    }
2188    if (params == NULL) {
2189        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2190        params = (GLfixed *) (_paramsBase + _bufferOffset);
2191    }
2192    glLightModelxv(
2193        (GLenum)pname,
2194        (GLfixed *)params
2195    );
2196
2197exit:
2198    if (_array) {
2199        releasePointer(_env, _array, params, JNI_FALSE);
2200    }
2201    if (_exception) {
2202        jniThrowException(_env, _exceptionType, _exceptionMessage);
2203    }
2204}
2205
2206/* void glLightf ( GLenum light, GLenum pname, GLfloat param ) */
2207static void
2208android_glLightf__IIF
2209  (JNIEnv *_env, jobject _this, jint light, jint pname, jfloat param) {
2210    glLightf(
2211        (GLenum)light,
2212        (GLenum)pname,
2213        (GLfloat)param
2214    );
2215}
2216
2217/* void glLightfv ( GLenum light, GLenum pname, const GLfloat *params ) */
2218static void
2219android_glLightfv__II_3FI
2220  (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) {
2221    jint _exception = 0;
2222    const char * _exceptionType = NULL;
2223    const char * _exceptionMessage = NULL;
2224    GLfloat *params_base = (GLfloat *) 0;
2225    jint _remaining;
2226    GLfloat *params = (GLfloat *) 0;
2227
2228    if (!params_ref) {
2229        _exception = 1;
2230        _exceptionType = "java/lang/IllegalArgumentException";
2231        _exceptionMessage = "params == null";
2232        goto exit;
2233    }
2234    if (offset < 0) {
2235        _exception = 1;
2236        _exceptionType = "java/lang/IllegalArgumentException";
2237        _exceptionMessage = "offset < 0";
2238        goto exit;
2239    }
2240    _remaining = _env->GetArrayLength(params_ref) - offset;
2241    int _needed;
2242    switch (pname) {
2243#if defined(GL_SPOT_EXPONENT)
2244        case GL_SPOT_EXPONENT:
2245#endif // defined(GL_SPOT_EXPONENT)
2246#if defined(GL_SPOT_CUTOFF)
2247        case GL_SPOT_CUTOFF:
2248#endif // defined(GL_SPOT_CUTOFF)
2249#if defined(GL_CONSTANT_ATTENUATION)
2250        case GL_CONSTANT_ATTENUATION:
2251#endif // defined(GL_CONSTANT_ATTENUATION)
2252#if defined(GL_LINEAR_ATTENUATION)
2253        case GL_LINEAR_ATTENUATION:
2254#endif // defined(GL_LINEAR_ATTENUATION)
2255#if defined(GL_QUADRATIC_ATTENUATION)
2256        case GL_QUADRATIC_ATTENUATION:
2257#endif // defined(GL_QUADRATIC_ATTENUATION)
2258            _needed = 1;
2259            break;
2260#if defined(GL_SPOT_DIRECTION)
2261        case GL_SPOT_DIRECTION:
2262#endif // defined(GL_SPOT_DIRECTION)
2263            _needed = 3;
2264            break;
2265#if defined(GL_AMBIENT)
2266        case GL_AMBIENT:
2267#endif // defined(GL_AMBIENT)
2268#if defined(GL_DIFFUSE)
2269        case GL_DIFFUSE:
2270#endif // defined(GL_DIFFUSE)
2271#if defined(GL_SPECULAR)
2272        case GL_SPECULAR:
2273#endif // defined(GL_SPECULAR)
2274#if defined(GL_EMISSION)
2275        case GL_EMISSION:
2276#endif // defined(GL_EMISSION)
2277            _needed = 4;
2278            break;
2279        default:
2280            _needed = 1;
2281            break;
2282    }
2283    if (_remaining < _needed) {
2284        _exception = 1;
2285        _exceptionType = "java/lang/IllegalArgumentException";
2286        _exceptionMessage = "length - offset < needed";
2287        goto exit;
2288    }
2289    params_base = (GLfloat *)
2290        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2291    params = params_base + offset;
2292
2293    glLightfv(
2294        (GLenum)light,
2295        (GLenum)pname,
2296        (GLfloat *)params
2297    );
2298
2299exit:
2300    if (params_base) {
2301        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2302            JNI_ABORT);
2303    }
2304    if (_exception) {
2305        jniThrowException(_env, _exceptionType, _exceptionMessage);
2306    }
2307}
2308
2309/* void glLightfv ( GLenum light, GLenum pname, const GLfloat *params ) */
2310static void
2311android_glLightfv__IILjava_nio_FloatBuffer_2
2312  (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
2313    jint _exception = 0;
2314    const char * _exceptionType = NULL;
2315    const char * _exceptionMessage = NULL;
2316    jarray _array = (jarray) 0;
2317    jint _bufferOffset = (jint) 0;
2318    jint _remaining;
2319    GLfloat *params = (GLfloat *) 0;
2320
2321    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
2322    int _needed;
2323    switch (pname) {
2324#if defined(GL_SPOT_EXPONENT)
2325        case GL_SPOT_EXPONENT:
2326#endif // defined(GL_SPOT_EXPONENT)
2327#if defined(GL_SPOT_CUTOFF)
2328        case GL_SPOT_CUTOFF:
2329#endif // defined(GL_SPOT_CUTOFF)
2330#if defined(GL_CONSTANT_ATTENUATION)
2331        case GL_CONSTANT_ATTENUATION:
2332#endif // defined(GL_CONSTANT_ATTENUATION)
2333#if defined(GL_LINEAR_ATTENUATION)
2334        case GL_LINEAR_ATTENUATION:
2335#endif // defined(GL_LINEAR_ATTENUATION)
2336#if defined(GL_QUADRATIC_ATTENUATION)
2337        case GL_QUADRATIC_ATTENUATION:
2338#endif // defined(GL_QUADRATIC_ATTENUATION)
2339            _needed = 1;
2340            break;
2341#if defined(GL_SPOT_DIRECTION)
2342        case GL_SPOT_DIRECTION:
2343#endif // defined(GL_SPOT_DIRECTION)
2344            _needed = 3;
2345            break;
2346#if defined(GL_AMBIENT)
2347        case GL_AMBIENT:
2348#endif // defined(GL_AMBIENT)
2349#if defined(GL_DIFFUSE)
2350        case GL_DIFFUSE:
2351#endif // defined(GL_DIFFUSE)
2352#if defined(GL_SPECULAR)
2353        case GL_SPECULAR:
2354#endif // defined(GL_SPECULAR)
2355#if defined(GL_EMISSION)
2356        case GL_EMISSION:
2357#endif // defined(GL_EMISSION)
2358            _needed = 4;
2359            break;
2360        default:
2361            _needed = 1;
2362            break;
2363    }
2364    if (_remaining < _needed) {
2365        _exception = 1;
2366        _exceptionType = "java/lang/IllegalArgumentException";
2367        _exceptionMessage = "remaining() < needed";
2368        goto exit;
2369    }
2370    if (params == NULL) {
2371        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2372        params = (GLfloat *) (_paramsBase + _bufferOffset);
2373    }
2374    glLightfv(
2375        (GLenum)light,
2376        (GLenum)pname,
2377        (GLfloat *)params
2378    );
2379
2380exit:
2381    if (_array) {
2382        releasePointer(_env, _array, params, JNI_FALSE);
2383    }
2384    if (_exception) {
2385        jniThrowException(_env, _exceptionType, _exceptionMessage);
2386    }
2387}
2388
2389/* void glLightx ( GLenum light, GLenum pname, GLfixed param ) */
2390static void
2391android_glLightx__III
2392  (JNIEnv *_env, jobject _this, jint light, jint pname, jint param) {
2393    glLightx(
2394        (GLenum)light,
2395        (GLenum)pname,
2396        (GLfixed)param
2397    );
2398}
2399
2400/* void glLightxv ( GLenum light, GLenum pname, const GLfixed *params ) */
2401static void
2402android_glLightxv__II_3II
2403  (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) {
2404    jint _exception = 0;
2405    const char * _exceptionType = NULL;
2406    const char * _exceptionMessage = NULL;
2407    GLfixed *params_base = (GLfixed *) 0;
2408    jint _remaining;
2409    GLfixed *params = (GLfixed *) 0;
2410
2411    if (!params_ref) {
2412        _exception = 1;
2413        _exceptionType = "java/lang/IllegalArgumentException";
2414        _exceptionMessage = "params == null";
2415        goto exit;
2416    }
2417    if (offset < 0) {
2418        _exception = 1;
2419        _exceptionType = "java/lang/IllegalArgumentException";
2420        _exceptionMessage = "offset < 0";
2421        goto exit;
2422    }
2423    _remaining = _env->GetArrayLength(params_ref) - offset;
2424    int _needed;
2425    switch (pname) {
2426#if defined(GL_SPOT_EXPONENT)
2427        case GL_SPOT_EXPONENT:
2428#endif // defined(GL_SPOT_EXPONENT)
2429#if defined(GL_SPOT_CUTOFF)
2430        case GL_SPOT_CUTOFF:
2431#endif // defined(GL_SPOT_CUTOFF)
2432#if defined(GL_CONSTANT_ATTENUATION)
2433        case GL_CONSTANT_ATTENUATION:
2434#endif // defined(GL_CONSTANT_ATTENUATION)
2435#if defined(GL_LINEAR_ATTENUATION)
2436        case GL_LINEAR_ATTENUATION:
2437#endif // defined(GL_LINEAR_ATTENUATION)
2438#if defined(GL_QUADRATIC_ATTENUATION)
2439        case GL_QUADRATIC_ATTENUATION:
2440#endif // defined(GL_QUADRATIC_ATTENUATION)
2441            _needed = 1;
2442            break;
2443#if defined(GL_SPOT_DIRECTION)
2444        case GL_SPOT_DIRECTION:
2445#endif // defined(GL_SPOT_DIRECTION)
2446            _needed = 3;
2447            break;
2448#if defined(GL_AMBIENT)
2449        case GL_AMBIENT:
2450#endif // defined(GL_AMBIENT)
2451#if defined(GL_DIFFUSE)
2452        case GL_DIFFUSE:
2453#endif // defined(GL_DIFFUSE)
2454#if defined(GL_SPECULAR)
2455        case GL_SPECULAR:
2456#endif // defined(GL_SPECULAR)
2457#if defined(GL_EMISSION)
2458        case GL_EMISSION:
2459#endif // defined(GL_EMISSION)
2460            _needed = 4;
2461            break;
2462        default:
2463            _needed = 1;
2464            break;
2465    }
2466    if (_remaining < _needed) {
2467        _exception = 1;
2468        _exceptionType = "java/lang/IllegalArgumentException";
2469        _exceptionMessage = "length - offset < needed";
2470        goto exit;
2471    }
2472    params_base = (GLfixed *)
2473        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2474    params = params_base + offset;
2475
2476    glLightxv(
2477        (GLenum)light,
2478        (GLenum)pname,
2479        (GLfixed *)params
2480    );
2481
2482exit:
2483    if (params_base) {
2484        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2485            JNI_ABORT);
2486    }
2487    if (_exception) {
2488        jniThrowException(_env, _exceptionType, _exceptionMessage);
2489    }
2490}
2491
2492/* void glLightxv ( GLenum light, GLenum pname, const GLfixed *params ) */
2493static void
2494android_glLightxv__IILjava_nio_IntBuffer_2
2495  (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
2496    jint _exception = 0;
2497    const char * _exceptionType = NULL;
2498    const char * _exceptionMessage = NULL;
2499    jarray _array = (jarray) 0;
2500    jint _bufferOffset = (jint) 0;
2501    jint _remaining;
2502    GLfixed *params = (GLfixed *) 0;
2503
2504    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
2505    int _needed;
2506    switch (pname) {
2507#if defined(GL_SPOT_EXPONENT)
2508        case GL_SPOT_EXPONENT:
2509#endif // defined(GL_SPOT_EXPONENT)
2510#if defined(GL_SPOT_CUTOFF)
2511        case GL_SPOT_CUTOFF:
2512#endif // defined(GL_SPOT_CUTOFF)
2513#if defined(GL_CONSTANT_ATTENUATION)
2514        case GL_CONSTANT_ATTENUATION:
2515#endif // defined(GL_CONSTANT_ATTENUATION)
2516#if defined(GL_LINEAR_ATTENUATION)
2517        case GL_LINEAR_ATTENUATION:
2518#endif // defined(GL_LINEAR_ATTENUATION)
2519#if defined(GL_QUADRATIC_ATTENUATION)
2520        case GL_QUADRATIC_ATTENUATION:
2521#endif // defined(GL_QUADRATIC_ATTENUATION)
2522            _needed = 1;
2523            break;
2524#if defined(GL_SPOT_DIRECTION)
2525        case GL_SPOT_DIRECTION:
2526#endif // defined(GL_SPOT_DIRECTION)
2527            _needed = 3;
2528            break;
2529#if defined(GL_AMBIENT)
2530        case GL_AMBIENT:
2531#endif // defined(GL_AMBIENT)
2532#if defined(GL_DIFFUSE)
2533        case GL_DIFFUSE:
2534#endif // defined(GL_DIFFUSE)
2535#if defined(GL_SPECULAR)
2536        case GL_SPECULAR:
2537#endif // defined(GL_SPECULAR)
2538#if defined(GL_EMISSION)
2539        case GL_EMISSION:
2540#endif // defined(GL_EMISSION)
2541            _needed = 4;
2542            break;
2543        default:
2544            _needed = 1;
2545            break;
2546    }
2547    if (_remaining < _needed) {
2548        _exception = 1;
2549        _exceptionType = "java/lang/IllegalArgumentException";
2550        _exceptionMessage = "remaining() < needed";
2551        goto exit;
2552    }
2553    if (params == NULL) {
2554        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2555        params = (GLfixed *) (_paramsBase + _bufferOffset);
2556    }
2557    glLightxv(
2558        (GLenum)light,
2559        (GLenum)pname,
2560        (GLfixed *)params
2561    );
2562
2563exit:
2564    if (_array) {
2565        releasePointer(_env, _array, params, JNI_FALSE);
2566    }
2567    if (_exception) {
2568        jniThrowException(_env, _exceptionType, _exceptionMessage);
2569    }
2570}
2571
2572/* void glLineWidth ( GLfloat width ) */
2573static void
2574android_glLineWidth__F
2575  (JNIEnv *_env, jobject _this, jfloat width) {
2576    glLineWidth(
2577        (GLfloat)width
2578    );
2579}
2580
2581/* void glLineWidthx ( GLfixed width ) */
2582static void
2583android_glLineWidthx__I
2584  (JNIEnv *_env, jobject _this, jint width) {
2585    glLineWidthx(
2586        (GLfixed)width
2587    );
2588}
2589
2590/* void glLoadIdentity ( void ) */
2591static void
2592android_glLoadIdentity__
2593  (JNIEnv *_env, jobject _this) {
2594    glLoadIdentity();
2595}
2596
2597/* void glLoadMatrixf ( const GLfloat *m ) */
2598static void
2599android_glLoadMatrixf___3FI
2600  (JNIEnv *_env, jobject _this, jfloatArray m_ref, jint offset) {
2601    jint _exception = 0;
2602    const char * _exceptionType = NULL;
2603    const char * _exceptionMessage = NULL;
2604    GLfloat *m_base = (GLfloat *) 0;
2605    jint _remaining;
2606    GLfloat *m = (GLfloat *) 0;
2607
2608    if (!m_ref) {
2609        _exception = 1;
2610        _exceptionType = "java/lang/IllegalArgumentException";
2611        _exceptionMessage = "m == null";
2612        goto exit;
2613    }
2614    if (offset < 0) {
2615        _exception = 1;
2616        _exceptionType = "java/lang/IllegalArgumentException";
2617        _exceptionMessage = "offset < 0";
2618        goto exit;
2619    }
2620    _remaining = _env->GetArrayLength(m_ref) - offset;
2621    m_base = (GLfloat *)
2622        _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
2623    m = m_base + offset;
2624
2625    glLoadMatrixf(
2626        (GLfloat *)m
2627    );
2628
2629exit:
2630    if (m_base) {
2631        _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
2632            JNI_ABORT);
2633    }
2634    if (_exception) {
2635        jniThrowException(_env, _exceptionType, _exceptionMessage);
2636    }
2637}
2638
2639/* void glLoadMatrixf ( const GLfloat *m ) */
2640static void
2641android_glLoadMatrixf__Ljava_nio_FloatBuffer_2
2642  (JNIEnv *_env, jobject _this, jobject m_buf) {
2643    jarray _array = (jarray) 0;
2644    jint _bufferOffset = (jint) 0;
2645    jint _remaining;
2646    GLfloat *m = (GLfloat *) 0;
2647
2648    m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset);
2649    if (m == NULL) {
2650        char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2651        m = (GLfloat *) (_mBase + _bufferOffset);
2652    }
2653    glLoadMatrixf(
2654        (GLfloat *)m
2655    );
2656    if (_array) {
2657        releasePointer(_env, _array, m, JNI_FALSE);
2658    }
2659}
2660
2661/* void glLoadMatrixx ( const GLfixed *m ) */
2662static void
2663android_glLoadMatrixx___3II
2664  (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) {
2665    jint _exception = 0;
2666    const char * _exceptionType = NULL;
2667    const char * _exceptionMessage = NULL;
2668    GLfixed *m_base = (GLfixed *) 0;
2669    jint _remaining;
2670    GLfixed *m = (GLfixed *) 0;
2671
2672    if (!m_ref) {
2673        _exception = 1;
2674        _exceptionType = "java/lang/IllegalArgumentException";
2675        _exceptionMessage = "m == null";
2676        goto exit;
2677    }
2678    if (offset < 0) {
2679        _exception = 1;
2680        _exceptionType = "java/lang/IllegalArgumentException";
2681        _exceptionMessage = "offset < 0";
2682        goto exit;
2683    }
2684    _remaining = _env->GetArrayLength(m_ref) - offset;
2685    m_base = (GLfixed *)
2686        _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
2687    m = m_base + offset;
2688
2689    glLoadMatrixx(
2690        (GLfixed *)m
2691    );
2692
2693exit:
2694    if (m_base) {
2695        _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
2696            JNI_ABORT);
2697    }
2698    if (_exception) {
2699        jniThrowException(_env, _exceptionType, _exceptionMessage);
2700    }
2701}
2702
2703/* void glLoadMatrixx ( const GLfixed *m ) */
2704static void
2705android_glLoadMatrixx__Ljava_nio_IntBuffer_2
2706  (JNIEnv *_env, jobject _this, jobject m_buf) {
2707    jarray _array = (jarray) 0;
2708    jint _bufferOffset = (jint) 0;
2709    jint _remaining;
2710    GLfixed *m = (GLfixed *) 0;
2711
2712    m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset);
2713    if (m == NULL) {
2714        char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2715        m = (GLfixed *) (_mBase + _bufferOffset);
2716    }
2717    glLoadMatrixx(
2718        (GLfixed *)m
2719    );
2720    if (_array) {
2721        releasePointer(_env, _array, m, JNI_FALSE);
2722    }
2723}
2724
2725/* void glLogicOp ( GLenum opcode ) */
2726static void
2727android_glLogicOp__I
2728  (JNIEnv *_env, jobject _this, jint opcode) {
2729    glLogicOp(
2730        (GLenum)opcode
2731    );
2732}
2733
2734/* void glMaterialf ( GLenum face, GLenum pname, GLfloat param ) */
2735static void
2736android_glMaterialf__IIF
2737  (JNIEnv *_env, jobject _this, jint face, jint pname, jfloat param) {
2738    glMaterialf(
2739        (GLenum)face,
2740        (GLenum)pname,
2741        (GLfloat)param
2742    );
2743}
2744
2745/* void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) */
2746static void
2747android_glMaterialfv__II_3FI
2748  (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) {
2749    jint _exception = 0;
2750    const char * _exceptionType = NULL;
2751    const char * _exceptionMessage = NULL;
2752    GLfloat *params_base = (GLfloat *) 0;
2753    jint _remaining;
2754    GLfloat *params = (GLfloat *) 0;
2755
2756    if (!params_ref) {
2757        _exception = 1;
2758        _exceptionType = "java/lang/IllegalArgumentException";
2759        _exceptionMessage = "params == null";
2760        goto exit;
2761    }
2762    if (offset < 0) {
2763        _exception = 1;
2764        _exceptionType = "java/lang/IllegalArgumentException";
2765        _exceptionMessage = "offset < 0";
2766        goto exit;
2767    }
2768    _remaining = _env->GetArrayLength(params_ref) - offset;
2769    int _needed;
2770    switch (pname) {
2771#if defined(GL_SHININESS)
2772        case GL_SHININESS:
2773#endif // defined(GL_SHININESS)
2774            _needed = 1;
2775            break;
2776#if defined(GL_AMBIENT)
2777        case GL_AMBIENT:
2778#endif // defined(GL_AMBIENT)
2779#if defined(GL_DIFFUSE)
2780        case GL_DIFFUSE:
2781#endif // defined(GL_DIFFUSE)
2782#if defined(GL_SPECULAR)
2783        case GL_SPECULAR:
2784#endif // defined(GL_SPECULAR)
2785#if defined(GL_EMISSION)
2786        case GL_EMISSION:
2787#endif // defined(GL_EMISSION)
2788#if defined(GL_AMBIENT_AND_DIFFUSE)
2789        case GL_AMBIENT_AND_DIFFUSE:
2790#endif // defined(GL_AMBIENT_AND_DIFFUSE)
2791            _needed = 4;
2792            break;
2793        default:
2794            _needed = 1;
2795            break;
2796    }
2797    if (_remaining < _needed) {
2798        _exception = 1;
2799        _exceptionType = "java/lang/IllegalArgumentException";
2800        _exceptionMessage = "length - offset < needed";
2801        goto exit;
2802    }
2803    params_base = (GLfloat *)
2804        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2805    params = params_base + offset;
2806
2807    glMaterialfv(
2808        (GLenum)face,
2809        (GLenum)pname,
2810        (GLfloat *)params
2811    );
2812
2813exit:
2814    if (params_base) {
2815        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2816            JNI_ABORT);
2817    }
2818    if (_exception) {
2819        jniThrowException(_env, _exceptionType, _exceptionMessage);
2820    }
2821}
2822
2823/* void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) */
2824static void
2825android_glMaterialfv__IILjava_nio_FloatBuffer_2
2826  (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
2827    jint _exception = 0;
2828    const char * _exceptionType = NULL;
2829    const char * _exceptionMessage = NULL;
2830    jarray _array = (jarray) 0;
2831    jint _bufferOffset = (jint) 0;
2832    jint _remaining;
2833    GLfloat *params = (GLfloat *) 0;
2834
2835    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
2836    int _needed;
2837    switch (pname) {
2838#if defined(GL_SHININESS)
2839        case GL_SHININESS:
2840#endif // defined(GL_SHININESS)
2841            _needed = 1;
2842            break;
2843#if defined(GL_AMBIENT)
2844        case GL_AMBIENT:
2845#endif // defined(GL_AMBIENT)
2846#if defined(GL_DIFFUSE)
2847        case GL_DIFFUSE:
2848#endif // defined(GL_DIFFUSE)
2849#if defined(GL_SPECULAR)
2850        case GL_SPECULAR:
2851#endif // defined(GL_SPECULAR)
2852#if defined(GL_EMISSION)
2853        case GL_EMISSION:
2854#endif // defined(GL_EMISSION)
2855#if defined(GL_AMBIENT_AND_DIFFUSE)
2856        case GL_AMBIENT_AND_DIFFUSE:
2857#endif // defined(GL_AMBIENT_AND_DIFFUSE)
2858            _needed = 4;
2859            break;
2860        default:
2861            _needed = 1;
2862            break;
2863    }
2864    if (_remaining < _needed) {
2865        _exception = 1;
2866        _exceptionType = "java/lang/IllegalArgumentException";
2867        _exceptionMessage = "remaining() < needed";
2868        goto exit;
2869    }
2870    if (params == NULL) {
2871        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2872        params = (GLfloat *) (_paramsBase + _bufferOffset);
2873    }
2874    glMaterialfv(
2875        (GLenum)face,
2876        (GLenum)pname,
2877        (GLfloat *)params
2878    );
2879
2880exit:
2881    if (_array) {
2882        releasePointer(_env, _array, params, JNI_FALSE);
2883    }
2884    if (_exception) {
2885        jniThrowException(_env, _exceptionType, _exceptionMessage);
2886    }
2887}
2888
2889/* void glMaterialx ( GLenum face, GLenum pname, GLfixed param ) */
2890static void
2891android_glMaterialx__III
2892  (JNIEnv *_env, jobject _this, jint face, jint pname, jint param) {
2893    glMaterialx(
2894        (GLenum)face,
2895        (GLenum)pname,
2896        (GLfixed)param
2897    );
2898}
2899
2900/* void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params ) */
2901static void
2902android_glMaterialxv__II_3II
2903  (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) {
2904    jint _exception = 0;
2905    const char * _exceptionType = NULL;
2906    const char * _exceptionMessage = NULL;
2907    GLfixed *params_base = (GLfixed *) 0;
2908    jint _remaining;
2909    GLfixed *params = (GLfixed *) 0;
2910
2911    if (!params_ref) {
2912        _exception = 1;
2913        _exceptionType = "java/lang/IllegalArgumentException";
2914        _exceptionMessage = "params == null";
2915        goto exit;
2916    }
2917    if (offset < 0) {
2918        _exception = 1;
2919        _exceptionType = "java/lang/IllegalArgumentException";
2920        _exceptionMessage = "offset < 0";
2921        goto exit;
2922    }
2923    _remaining = _env->GetArrayLength(params_ref) - offset;
2924    int _needed;
2925    switch (pname) {
2926#if defined(GL_SHININESS)
2927        case GL_SHININESS:
2928#endif // defined(GL_SHININESS)
2929            _needed = 1;
2930            break;
2931#if defined(GL_AMBIENT)
2932        case GL_AMBIENT:
2933#endif // defined(GL_AMBIENT)
2934#if defined(GL_DIFFUSE)
2935        case GL_DIFFUSE:
2936#endif // defined(GL_DIFFUSE)
2937#if defined(GL_SPECULAR)
2938        case GL_SPECULAR:
2939#endif // defined(GL_SPECULAR)
2940#if defined(GL_EMISSION)
2941        case GL_EMISSION:
2942#endif // defined(GL_EMISSION)
2943#if defined(GL_AMBIENT_AND_DIFFUSE)
2944        case GL_AMBIENT_AND_DIFFUSE:
2945#endif // defined(GL_AMBIENT_AND_DIFFUSE)
2946            _needed = 4;
2947            break;
2948        default:
2949            _needed = 1;
2950            break;
2951    }
2952    if (_remaining < _needed) {
2953        _exception = 1;
2954        _exceptionType = "java/lang/IllegalArgumentException";
2955        _exceptionMessage = "length - offset < needed";
2956        goto exit;
2957    }
2958    params_base = (GLfixed *)
2959        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2960    params = params_base + offset;
2961
2962    glMaterialxv(
2963        (GLenum)face,
2964        (GLenum)pname,
2965        (GLfixed *)params
2966    );
2967
2968exit:
2969    if (params_base) {
2970        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2971            JNI_ABORT);
2972    }
2973    if (_exception) {
2974        jniThrowException(_env, _exceptionType, _exceptionMessage);
2975    }
2976}
2977
2978/* void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params ) */
2979static void
2980android_glMaterialxv__IILjava_nio_IntBuffer_2
2981  (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
2982    jint _exception = 0;
2983    const char * _exceptionType = NULL;
2984    const char * _exceptionMessage = NULL;
2985    jarray _array = (jarray) 0;
2986    jint _bufferOffset = (jint) 0;
2987    jint _remaining;
2988    GLfixed *params = (GLfixed *) 0;
2989
2990    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
2991    int _needed;
2992    switch (pname) {
2993#if defined(GL_SHININESS)
2994        case GL_SHININESS:
2995#endif // defined(GL_SHININESS)
2996            _needed = 1;
2997            break;
2998#if defined(GL_AMBIENT)
2999        case GL_AMBIENT:
3000#endif // defined(GL_AMBIENT)
3001#if defined(GL_DIFFUSE)
3002        case GL_DIFFUSE:
3003#endif // defined(GL_DIFFUSE)
3004#if defined(GL_SPECULAR)
3005        case GL_SPECULAR:
3006#endif // defined(GL_SPECULAR)
3007#if defined(GL_EMISSION)
3008        case GL_EMISSION:
3009#endif // defined(GL_EMISSION)
3010#if defined(GL_AMBIENT_AND_DIFFUSE)
3011        case GL_AMBIENT_AND_DIFFUSE:
3012#endif // defined(GL_AMBIENT_AND_DIFFUSE)
3013            _needed = 4;
3014            break;
3015        default:
3016            _needed = 1;
3017            break;
3018    }
3019    if (_remaining < _needed) {
3020        _exception = 1;
3021        _exceptionType = "java/lang/IllegalArgumentException";
3022        _exceptionMessage = "remaining() < needed";
3023        goto exit;
3024    }
3025    if (params == NULL) {
3026        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3027        params = (GLfixed *) (_paramsBase + _bufferOffset);
3028    }
3029    glMaterialxv(
3030        (GLenum)face,
3031        (GLenum)pname,
3032        (GLfixed *)params
3033    );
3034
3035exit:
3036    if (_array) {
3037        releasePointer(_env, _array, params, JNI_FALSE);
3038    }
3039    if (_exception) {
3040        jniThrowException(_env, _exceptionType, _exceptionMessage);
3041    }
3042}
3043
3044/* void glMatrixMode ( GLenum mode ) */
3045static void
3046android_glMatrixMode__I
3047  (JNIEnv *_env, jobject _this, jint mode) {
3048    glMatrixMode(
3049        (GLenum)mode
3050    );
3051}
3052
3053/* void glMultMatrixf ( const GLfloat *m ) */
3054static void
3055android_glMultMatrixf___3FI
3056  (JNIEnv *_env, jobject _this, jfloatArray m_ref, jint offset) {
3057    jint _exception = 0;
3058    const char * _exceptionType = NULL;
3059    const char * _exceptionMessage = NULL;
3060    GLfloat *m_base = (GLfloat *) 0;
3061    jint _remaining;
3062    GLfloat *m = (GLfloat *) 0;
3063
3064    if (!m_ref) {
3065        _exception = 1;
3066        _exceptionType = "java/lang/IllegalArgumentException";
3067        _exceptionMessage = "m == null";
3068        goto exit;
3069    }
3070    if (offset < 0) {
3071        _exception = 1;
3072        _exceptionType = "java/lang/IllegalArgumentException";
3073        _exceptionMessage = "offset < 0";
3074        goto exit;
3075    }
3076    _remaining = _env->GetArrayLength(m_ref) - offset;
3077    m_base = (GLfloat *)
3078        _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
3079    m = m_base + offset;
3080
3081    glMultMatrixf(
3082        (GLfloat *)m
3083    );
3084
3085exit:
3086    if (m_base) {
3087        _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
3088            JNI_ABORT);
3089    }
3090    if (_exception) {
3091        jniThrowException(_env, _exceptionType, _exceptionMessage);
3092    }
3093}
3094
3095/* void glMultMatrixf ( const GLfloat *m ) */
3096static void
3097android_glMultMatrixf__Ljava_nio_FloatBuffer_2
3098  (JNIEnv *_env, jobject _this, jobject m_buf) {
3099    jarray _array = (jarray) 0;
3100    jint _bufferOffset = (jint) 0;
3101    jint _remaining;
3102    GLfloat *m = (GLfloat *) 0;
3103
3104    m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset);
3105    if (m == NULL) {
3106        char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3107        m = (GLfloat *) (_mBase + _bufferOffset);
3108    }
3109    glMultMatrixf(
3110        (GLfloat *)m
3111    );
3112    if (_array) {
3113        releasePointer(_env, _array, m, JNI_FALSE);
3114    }
3115}
3116
3117/* void glMultMatrixx ( const GLfixed *m ) */
3118static void
3119android_glMultMatrixx___3II
3120  (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) {
3121    jint _exception = 0;
3122    const char * _exceptionType = NULL;
3123    const char * _exceptionMessage = NULL;
3124    GLfixed *m_base = (GLfixed *) 0;
3125    jint _remaining;
3126    GLfixed *m = (GLfixed *) 0;
3127
3128    if (!m_ref) {
3129        _exception = 1;
3130        _exceptionType = "java/lang/IllegalArgumentException";
3131        _exceptionMessage = "m == null";
3132        goto exit;
3133    }
3134    if (offset < 0) {
3135        _exception = 1;
3136        _exceptionType = "java/lang/IllegalArgumentException";
3137        _exceptionMessage = "offset < 0";
3138        goto exit;
3139    }
3140    _remaining = _env->GetArrayLength(m_ref) - offset;
3141    m_base = (GLfixed *)
3142        _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
3143    m = m_base + offset;
3144
3145    glMultMatrixx(
3146        (GLfixed *)m
3147    );
3148
3149exit:
3150    if (m_base) {
3151        _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
3152            JNI_ABORT);
3153    }
3154    if (_exception) {
3155        jniThrowException(_env, _exceptionType, _exceptionMessage);
3156    }
3157}
3158
3159/* void glMultMatrixx ( const GLfixed *m ) */
3160static void
3161android_glMultMatrixx__Ljava_nio_IntBuffer_2
3162  (JNIEnv *_env, jobject _this, jobject m_buf) {
3163    jarray _array = (jarray) 0;
3164    jint _bufferOffset = (jint) 0;
3165    jint _remaining;
3166    GLfixed *m = (GLfixed *) 0;
3167
3168    m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset);
3169    if (m == NULL) {
3170        char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3171        m = (GLfixed *) (_mBase + _bufferOffset);
3172    }
3173    glMultMatrixx(
3174        (GLfixed *)m
3175    );
3176    if (_array) {
3177        releasePointer(_env, _array, m, JNI_FALSE);
3178    }
3179}
3180
3181/* void glMultiTexCoord4f ( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ) */
3182static void
3183android_glMultiTexCoord4f__IFFFF
3184  (JNIEnv *_env, jobject _this, jint target, jfloat s, jfloat t, jfloat r, jfloat q) {
3185    glMultiTexCoord4f(
3186        (GLenum)target,
3187        (GLfloat)s,
3188        (GLfloat)t,
3189        (GLfloat)r,
3190        (GLfloat)q
3191    );
3192}
3193
3194/* void glMultiTexCoord4x ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q ) */
3195static void
3196android_glMultiTexCoord4x__IIIII
3197  (JNIEnv *_env, jobject _this, jint target, jint s, jint t, jint r, jint q) {
3198    glMultiTexCoord4x(
3199        (GLenum)target,
3200        (GLfixed)s,
3201        (GLfixed)t,
3202        (GLfixed)r,
3203        (GLfixed)q
3204    );
3205}
3206
3207/* void glNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz ) */
3208static void
3209android_glNormal3f__FFF
3210  (JNIEnv *_env, jobject _this, jfloat nx, jfloat ny, jfloat nz) {
3211    glNormal3f(
3212        (GLfloat)nx,
3213        (GLfloat)ny,
3214        (GLfloat)nz
3215    );
3216}
3217
3218/* void glNormal3x ( GLfixed nx, GLfixed ny, GLfixed nz ) */
3219static void
3220android_glNormal3x__III
3221  (JNIEnv *_env, jobject _this, jint nx, jint ny, jint nz) {
3222    glNormal3x(
3223        (GLfixed)nx,
3224        (GLfixed)ny,
3225        (GLfixed)nz
3226    );
3227}
3228
3229/* void glNormalPointer ( GLenum type, GLsizei stride, const GLvoid *pointer ) */
3230static void
3231android_glNormalPointerBounds__IILjava_nio_Buffer_2I
3232  (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) {
3233    jarray _array = (jarray) 0;
3234    jint _bufferOffset = (jint) 0;
3235    jint _remaining;
3236    GLvoid *pointer = (GLvoid *) 0;
3237
3238    if (pointer_buf) {
3239        pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
3240        if ( ! pointer ) {
3241            return;
3242        }
3243    }
3244    glNormalPointerBounds(
3245        (GLenum)type,
3246        (GLsizei)stride,
3247        (GLvoid *)pointer,
3248        (GLsizei)remaining
3249    );
3250}
3251
3252/* void glOrthof ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */
3253static void
3254android_glOrthof__FFFFFF
3255  (JNIEnv *_env, jobject _this, jfloat left, jfloat right, jfloat bottom, jfloat top, jfloat zNear, jfloat zFar) {
3256    glOrthof(
3257        (GLfloat)left,
3258        (GLfloat)right,
3259        (GLfloat)bottom,
3260        (GLfloat)top,
3261        (GLfloat)zNear,
3262        (GLfloat)zFar
3263    );
3264}
3265
3266/* void glOrthox ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) */
3267static void
3268android_glOrthox__IIIIII
3269  (JNIEnv *_env, jobject _this, jint left, jint right, jint bottom, jint top, jint zNear, jint zFar) {
3270    glOrthox(
3271        (GLfixed)left,
3272        (GLfixed)right,
3273        (GLfixed)bottom,
3274        (GLfixed)top,
3275        (GLfixed)zNear,
3276        (GLfixed)zFar
3277    );
3278}
3279
3280/* void glPixelStorei ( GLenum pname, GLint param ) */
3281static void
3282android_glPixelStorei__II
3283  (JNIEnv *_env, jobject _this, jint pname, jint param) {
3284    glPixelStorei(
3285        (GLenum)pname,
3286        (GLint)param
3287    );
3288}
3289
3290/* void glPointSize ( GLfloat size ) */
3291static void
3292android_glPointSize__F
3293  (JNIEnv *_env, jobject _this, jfloat size) {
3294    glPointSize(
3295        (GLfloat)size
3296    );
3297}
3298
3299/* void glPointSizex ( GLfixed size ) */
3300static void
3301android_glPointSizex__I
3302  (JNIEnv *_env, jobject _this, jint size) {
3303    glPointSizex(
3304        (GLfixed)size
3305    );
3306}
3307
3308/* void glPolygonOffset ( GLfloat factor, GLfloat units ) */
3309static void
3310android_glPolygonOffset__FF
3311  (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) {
3312    glPolygonOffset(
3313        (GLfloat)factor,
3314        (GLfloat)units
3315    );
3316}
3317
3318/* void glPolygonOffsetx ( GLfixed factor, GLfixed units ) */
3319static void
3320android_glPolygonOffsetx__II
3321  (JNIEnv *_env, jobject _this, jint factor, jint units) {
3322    glPolygonOffsetx(
3323        (GLfixed)factor,
3324        (GLfixed)units
3325    );
3326}
3327
3328/* void glPopMatrix ( void ) */
3329static void
3330android_glPopMatrix__
3331  (JNIEnv *_env, jobject _this) {
3332    glPopMatrix();
3333}
3334
3335/* void glPushMatrix ( void ) */
3336static void
3337android_glPushMatrix__
3338  (JNIEnv *_env, jobject _this) {
3339    glPushMatrix();
3340}
3341
3342/* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */
3343static void
3344android_glReadPixels__IIIIIILjava_nio_Buffer_2
3345  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) {
3346    jarray _array = (jarray) 0;
3347    jint _bufferOffset = (jint) 0;
3348    jint _remaining;
3349    GLvoid *pixels = (GLvoid *) 0;
3350
3351    pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
3352    if (pixels == NULL) {
3353        char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3354        pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
3355    }
3356    glReadPixels(
3357        (GLint)x,
3358        (GLint)y,
3359        (GLsizei)width,
3360        (GLsizei)height,
3361        (GLenum)format,
3362        (GLenum)type,
3363        (GLvoid *)pixels
3364    );
3365    if (_array) {
3366        releasePointer(_env, _array, pixels, JNI_TRUE);
3367    }
3368}
3369
3370/* void glRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) */
3371static void
3372android_glRotatef__FFFF
3373  (JNIEnv *_env, jobject _this, jfloat angle, jfloat x, jfloat y, jfloat z) {
3374    glRotatef(
3375        (GLfloat)angle,
3376        (GLfloat)x,
3377        (GLfloat)y,
3378        (GLfloat)z
3379    );
3380}
3381
3382/* void glRotatex ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z ) */
3383static void
3384android_glRotatex__IIII
3385  (JNIEnv *_env, jobject _this, jint angle, jint x, jint y, jint z) {
3386    glRotatex(
3387        (GLfixed)angle,
3388        (GLfixed)x,
3389        (GLfixed)y,
3390        (GLfixed)z
3391    );
3392}
3393
3394/* void glSampleCoverage ( GLclampf value, GLboolean invert ) */
3395static void
3396android_glSampleCoverage__FZ
3397  (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) {
3398    glSampleCoverage(
3399        (GLclampf)value,
3400        (GLboolean)invert
3401    );
3402}
3403
3404/* void glSampleCoveragex ( GLclampx value, GLboolean invert ) */
3405static void
3406android_glSampleCoveragex__IZ
3407  (JNIEnv *_env, jobject _this, jint value, jboolean invert) {
3408    glSampleCoveragex(
3409        (GLclampx)value,
3410        (GLboolean)invert
3411    );
3412}
3413
3414/* void glScalef ( GLfloat x, GLfloat y, GLfloat z ) */
3415static void
3416android_glScalef__FFF
3417  (JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat z) {
3418    glScalef(
3419        (GLfloat)x,
3420        (GLfloat)y,
3421        (GLfloat)z
3422    );
3423}
3424
3425/* void glScalex ( GLfixed x, GLfixed y, GLfixed z ) */
3426static void
3427android_glScalex__III
3428  (JNIEnv *_env, jobject _this, jint x, jint y, jint z) {
3429    glScalex(
3430        (GLfixed)x,
3431        (GLfixed)y,
3432        (GLfixed)z
3433    );
3434}
3435
3436/* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */
3437static void
3438android_glScissor__IIII
3439  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
3440    glScissor(
3441        (GLint)x,
3442        (GLint)y,
3443        (GLsizei)width,
3444        (GLsizei)height
3445    );
3446}
3447
3448/* void glShadeModel ( GLenum mode ) */
3449static void
3450android_glShadeModel__I
3451  (JNIEnv *_env, jobject _this, jint mode) {
3452    glShadeModel(
3453        (GLenum)mode
3454    );
3455}
3456
3457/* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */
3458static void
3459android_glStencilFunc__III
3460  (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) {
3461    glStencilFunc(
3462        (GLenum)func,
3463        (GLint)ref,
3464        (GLuint)mask
3465    );
3466}
3467
3468/* void glStencilMask ( GLuint mask ) */
3469static void
3470android_glStencilMask__I
3471  (JNIEnv *_env, jobject _this, jint mask) {
3472    glStencilMask(
3473        (GLuint)mask
3474    );
3475}
3476
3477/* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */
3478static void
3479android_glStencilOp__III
3480  (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) {
3481    glStencilOp(
3482        (GLenum)fail,
3483        (GLenum)zfail,
3484        (GLenum)zpass
3485    );
3486}
3487
3488/* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
3489static void
3490android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I
3491  (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
3492    jarray _array = (jarray) 0;
3493    jint _bufferOffset = (jint) 0;
3494    jint _remaining;
3495    GLvoid *pointer = (GLvoid *) 0;
3496
3497    if (pointer_buf) {
3498        pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
3499        if ( ! pointer ) {
3500            return;
3501        }
3502    }
3503    glTexCoordPointerBounds(
3504        (GLint)size,
3505        (GLenum)type,
3506        (GLsizei)stride,
3507        (GLvoid *)pointer,
3508        (GLsizei)remaining
3509    );
3510}
3511
3512/* void glTexEnvf ( GLenum target, GLenum pname, GLfloat param ) */
3513static void
3514android_glTexEnvf__IIF
3515  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
3516    glTexEnvf(
3517        (GLenum)target,
3518        (GLenum)pname,
3519        (GLfloat)param
3520    );
3521}
3522
3523/* void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) */
3524static void
3525android_glTexEnvfv__II_3FI
3526  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
3527    jint _exception = 0;
3528    const char * _exceptionType = NULL;
3529    const char * _exceptionMessage = NULL;
3530    GLfloat *params_base = (GLfloat *) 0;
3531    jint _remaining;
3532    GLfloat *params = (GLfloat *) 0;
3533
3534    if (!params_ref) {
3535        _exception = 1;
3536        _exceptionType = "java/lang/IllegalArgumentException";
3537        _exceptionMessage = "params == null";
3538        goto exit;
3539    }
3540    if (offset < 0) {
3541        _exception = 1;
3542        _exceptionType = "java/lang/IllegalArgumentException";
3543        _exceptionMessage = "offset < 0";
3544        goto exit;
3545    }
3546    _remaining = _env->GetArrayLength(params_ref) - offset;
3547    int _needed;
3548    switch (pname) {
3549#if defined(GL_TEXTURE_ENV_MODE)
3550        case GL_TEXTURE_ENV_MODE:
3551#endif // defined(GL_TEXTURE_ENV_MODE)
3552#if defined(GL_COMBINE_RGB)
3553        case GL_COMBINE_RGB:
3554#endif // defined(GL_COMBINE_RGB)
3555#if defined(GL_COMBINE_ALPHA)
3556        case GL_COMBINE_ALPHA:
3557#endif // defined(GL_COMBINE_ALPHA)
3558            _needed = 1;
3559            break;
3560#if defined(GL_TEXTURE_ENV_COLOR)
3561        case GL_TEXTURE_ENV_COLOR:
3562#endif // defined(GL_TEXTURE_ENV_COLOR)
3563            _needed = 4;
3564            break;
3565        default:
3566            _needed = 1;
3567            break;
3568    }
3569    if (_remaining < _needed) {
3570        _exception = 1;
3571        _exceptionType = "java/lang/IllegalArgumentException";
3572        _exceptionMessage = "length - offset < needed";
3573        goto exit;
3574    }
3575    params_base = (GLfloat *)
3576        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3577    params = params_base + offset;
3578
3579    glTexEnvfv(
3580        (GLenum)target,
3581        (GLenum)pname,
3582        (GLfloat *)params
3583    );
3584
3585exit:
3586    if (params_base) {
3587        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3588            JNI_ABORT);
3589    }
3590    if (_exception) {
3591        jniThrowException(_env, _exceptionType, _exceptionMessage);
3592    }
3593}
3594
3595/* void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) */
3596static void
3597android_glTexEnvfv__IILjava_nio_FloatBuffer_2
3598  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3599    jint _exception = 0;
3600    const char * _exceptionType = NULL;
3601    const char * _exceptionMessage = NULL;
3602    jarray _array = (jarray) 0;
3603    jint _bufferOffset = (jint) 0;
3604    jint _remaining;
3605    GLfloat *params = (GLfloat *) 0;
3606
3607    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
3608    int _needed;
3609    switch (pname) {
3610#if defined(GL_TEXTURE_ENV_MODE)
3611        case GL_TEXTURE_ENV_MODE:
3612#endif // defined(GL_TEXTURE_ENV_MODE)
3613#if defined(GL_COMBINE_RGB)
3614        case GL_COMBINE_RGB:
3615#endif // defined(GL_COMBINE_RGB)
3616#if defined(GL_COMBINE_ALPHA)
3617        case GL_COMBINE_ALPHA:
3618#endif // defined(GL_COMBINE_ALPHA)
3619            _needed = 1;
3620            break;
3621#if defined(GL_TEXTURE_ENV_COLOR)
3622        case GL_TEXTURE_ENV_COLOR:
3623#endif // defined(GL_TEXTURE_ENV_COLOR)
3624            _needed = 4;
3625            break;
3626        default:
3627            _needed = 1;
3628            break;
3629    }
3630    if (_remaining < _needed) {
3631        _exception = 1;
3632        _exceptionType = "java/lang/IllegalArgumentException";
3633        _exceptionMessage = "remaining() < needed";
3634        goto exit;
3635    }
3636    if (params == NULL) {
3637        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3638        params = (GLfloat *) (_paramsBase + _bufferOffset);
3639    }
3640    glTexEnvfv(
3641        (GLenum)target,
3642        (GLenum)pname,
3643        (GLfloat *)params
3644    );
3645
3646exit:
3647    if (_array) {
3648        releasePointer(_env, _array, params, JNI_FALSE);
3649    }
3650    if (_exception) {
3651        jniThrowException(_env, _exceptionType, _exceptionMessage);
3652    }
3653}
3654
3655/* void glTexEnvx ( GLenum target, GLenum pname, GLfixed param ) */
3656static void
3657android_glTexEnvx__III
3658  (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
3659    glTexEnvx(
3660        (GLenum)target,
3661        (GLenum)pname,
3662        (GLfixed)param
3663    );
3664}
3665
3666/* void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params ) */
3667static void
3668android_glTexEnvxv__II_3II
3669  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
3670    jint _exception = 0;
3671    const char * _exceptionType = NULL;
3672    const char * _exceptionMessage = NULL;
3673    GLfixed *params_base = (GLfixed *) 0;
3674    jint _remaining;
3675    GLfixed *params = (GLfixed *) 0;
3676
3677    if (!params_ref) {
3678        _exception = 1;
3679        _exceptionType = "java/lang/IllegalArgumentException";
3680        _exceptionMessage = "params == null";
3681        goto exit;
3682    }
3683    if (offset < 0) {
3684        _exception = 1;
3685        _exceptionType = "java/lang/IllegalArgumentException";
3686        _exceptionMessage = "offset < 0";
3687        goto exit;
3688    }
3689    _remaining = _env->GetArrayLength(params_ref) - offset;
3690    int _needed;
3691    switch (pname) {
3692#if defined(GL_TEXTURE_ENV_MODE)
3693        case GL_TEXTURE_ENV_MODE:
3694#endif // defined(GL_TEXTURE_ENV_MODE)
3695#if defined(GL_COMBINE_RGB)
3696        case GL_COMBINE_RGB:
3697#endif // defined(GL_COMBINE_RGB)
3698#if defined(GL_COMBINE_ALPHA)
3699        case GL_COMBINE_ALPHA:
3700#endif // defined(GL_COMBINE_ALPHA)
3701            _needed = 1;
3702            break;
3703#if defined(GL_TEXTURE_ENV_COLOR)
3704        case GL_TEXTURE_ENV_COLOR:
3705#endif // defined(GL_TEXTURE_ENV_COLOR)
3706            _needed = 4;
3707            break;
3708        default:
3709            _needed = 1;
3710            break;
3711    }
3712    if (_remaining < _needed) {
3713        _exception = 1;
3714        _exceptionType = "java/lang/IllegalArgumentException";
3715        _exceptionMessage = "length - offset < needed";
3716        goto exit;
3717    }
3718    params_base = (GLfixed *)
3719        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3720    params = params_base + offset;
3721
3722    glTexEnvxv(
3723        (GLenum)target,
3724        (GLenum)pname,
3725        (GLfixed *)params
3726    );
3727
3728exit:
3729    if (params_base) {
3730        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3731            JNI_ABORT);
3732    }
3733    if (_exception) {
3734        jniThrowException(_env, _exceptionType, _exceptionMessage);
3735    }
3736}
3737
3738/* void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params ) */
3739static void
3740android_glTexEnvxv__IILjava_nio_IntBuffer_2
3741  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3742    jint _exception = 0;
3743    const char * _exceptionType = NULL;
3744    const char * _exceptionMessage = NULL;
3745    jarray _array = (jarray) 0;
3746    jint _bufferOffset = (jint) 0;
3747    jint _remaining;
3748    GLfixed *params = (GLfixed *) 0;
3749
3750    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
3751    int _needed;
3752    switch (pname) {
3753#if defined(GL_TEXTURE_ENV_MODE)
3754        case GL_TEXTURE_ENV_MODE:
3755#endif // defined(GL_TEXTURE_ENV_MODE)
3756#if defined(GL_COMBINE_RGB)
3757        case GL_COMBINE_RGB:
3758#endif // defined(GL_COMBINE_RGB)
3759#if defined(GL_COMBINE_ALPHA)
3760        case GL_COMBINE_ALPHA:
3761#endif // defined(GL_COMBINE_ALPHA)
3762            _needed = 1;
3763            break;
3764#if defined(GL_TEXTURE_ENV_COLOR)
3765        case GL_TEXTURE_ENV_COLOR:
3766#endif // defined(GL_TEXTURE_ENV_COLOR)
3767            _needed = 4;
3768            break;
3769        default:
3770            _needed = 1;
3771            break;
3772    }
3773    if (_remaining < _needed) {
3774        _exception = 1;
3775        _exceptionType = "java/lang/IllegalArgumentException";
3776        _exceptionMessage = "remaining() < needed";
3777        goto exit;
3778    }
3779    if (params == NULL) {
3780        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3781        params = (GLfixed *) (_paramsBase + _bufferOffset);
3782    }
3783    glTexEnvxv(
3784        (GLenum)target,
3785        (GLenum)pname,
3786        (GLfixed *)params
3787    );
3788
3789exit:
3790    if (_array) {
3791        releasePointer(_env, _array, params, JNI_FALSE);
3792    }
3793    if (_exception) {
3794        jniThrowException(_env, _exceptionType, _exceptionMessage);
3795    }
3796}
3797
3798/* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */
3799static void
3800android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2
3801  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) {
3802    jarray _array = (jarray) 0;
3803    jint _bufferOffset = (jint) 0;
3804    jint _remaining;
3805    GLvoid *pixels = (GLvoid *) 0;
3806
3807    if (pixels_buf) {
3808        pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
3809    }
3810    if (pixels_buf && pixels == NULL) {
3811        char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3812        pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
3813    }
3814    glTexImage2D(
3815        (GLenum)target,
3816        (GLint)level,
3817        (GLint)internalformat,
3818        (GLsizei)width,
3819        (GLsizei)height,
3820        (GLint)border,
3821        (GLenum)format,
3822        (GLenum)type,
3823        (GLvoid *)pixels
3824    );
3825    if (_array) {
3826        releasePointer(_env, _array, pixels, JNI_FALSE);
3827    }
3828}
3829
3830/* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */
3831static void
3832android_glTexParameterf__IIF
3833  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
3834    glTexParameterf(
3835        (GLenum)target,
3836        (GLenum)pname,
3837        (GLfloat)param
3838    );
3839}
3840
3841/* void glTexParameterx ( GLenum target, GLenum pname, GLfixed param ) */
3842static void
3843android_glTexParameterx__III
3844  (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
3845    glTexParameterx(
3846        (GLenum)target,
3847        (GLenum)pname,
3848        (GLfixed)param
3849    );
3850}
3851
3852/* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */
3853static void
3854android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
3855  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) {
3856    jarray _array = (jarray) 0;
3857    jint _bufferOffset = (jint) 0;
3858    jint _remaining;
3859    GLvoid *pixels = (GLvoid *) 0;
3860
3861    if (pixels_buf) {
3862        pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
3863    }
3864    if (pixels_buf && pixels == NULL) {
3865        char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3866        pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
3867    }
3868    glTexSubImage2D(
3869        (GLenum)target,
3870        (GLint)level,
3871        (GLint)xoffset,
3872        (GLint)yoffset,
3873        (GLsizei)width,
3874        (GLsizei)height,
3875        (GLenum)format,
3876        (GLenum)type,
3877        (GLvoid *)pixels
3878    );
3879    if (_array) {
3880        releasePointer(_env, _array, pixels, JNI_FALSE);
3881    }
3882}
3883
3884/* void glTranslatef ( GLfloat x, GLfloat y, GLfloat z ) */
3885static void
3886android_glTranslatef__FFF
3887  (JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat z) {
3888    glTranslatef(
3889        (GLfloat)x,
3890        (GLfloat)y,
3891        (GLfloat)z
3892    );
3893}
3894
3895/* void glTranslatex ( GLfixed x, GLfixed y, GLfixed z ) */
3896static void
3897android_glTranslatex__III
3898  (JNIEnv *_env, jobject _this, jint x, jint y, jint z) {
3899    glTranslatex(
3900        (GLfixed)x,
3901        (GLfixed)y,
3902        (GLfixed)z
3903    );
3904}
3905
3906/* void glVertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
3907static void
3908android_glVertexPointerBounds__IIILjava_nio_Buffer_2I
3909  (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
3910    jarray _array = (jarray) 0;
3911    jint _bufferOffset = (jint) 0;
3912    jint _remaining;
3913    GLvoid *pointer = (GLvoid *) 0;
3914
3915    if (pointer_buf) {
3916        pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
3917        if ( ! pointer ) {
3918            return;
3919        }
3920    }
3921    glVertexPointerBounds(
3922        (GLint)size,
3923        (GLenum)type,
3924        (GLsizei)stride,
3925        (GLvoid *)pointer,
3926        (GLsizei)remaining
3927    );
3928}
3929
3930/* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */
3931static void
3932android_glViewport__IIII
3933  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
3934    glViewport(
3935        (GLint)x,
3936        (GLint)y,
3937        (GLsizei)width,
3938        (GLsizei)height
3939    );
3940}
3941
3942/* GLbitfield glQueryMatrixxOES ( GLfixed *mantissa, GLint *exponent ) */
3943static jint
3944android_glQueryMatrixxOES___3II_3II
3945  (JNIEnv *_env, jobject _this, jintArray mantissa_ref, jint mantissaOffset, jintArray exponent_ref, jint exponentOffset) {
3946    jint _exception = 0;
3947    const char * _exceptionType = NULL;
3948    const char * _exceptionMessage = NULL;
3949    GLbitfield _returnValue = -1;
3950    GLfixed *mantissa_base = (GLfixed *) 0;
3951    jint _mantissaRemaining;
3952    GLfixed *mantissa = (GLfixed *) 0;
3953    GLint *exponent_base = (GLint *) 0;
3954    jint _exponentRemaining;
3955    GLint *exponent = (GLint *) 0;
3956
3957    if (!mantissa_ref) {
3958        _exception = 1;
3959        _exceptionType = "java/lang/IllegalArgumentException";
3960        _exceptionMessage = "mantissa == null";
3961        goto exit;
3962    }
3963    if (mantissaOffset < 0) {
3964        _exception = 1;
3965        _exceptionType = "java/lang/IllegalArgumentException";
3966        _exceptionMessage = "mantissaOffset < 0";
3967        goto exit;
3968    }
3969    _mantissaRemaining = _env->GetArrayLength(mantissa_ref) - mantissaOffset;
3970    if (_mantissaRemaining < 16) {
3971        _exception = 1;
3972        _exceptionType = "java/lang/IllegalArgumentException";
3973        _exceptionMessage = "length - mantissaOffset < 16 < needed";
3974        goto exit;
3975    }
3976    mantissa_base = (GLfixed *)
3977        _env->GetPrimitiveArrayCritical(mantissa_ref, (jboolean *)0);
3978    mantissa = mantissa_base + mantissaOffset;
3979
3980    if (!exponent_ref) {
3981        _exception = 1;
3982        _exceptionType = "java/lang/IllegalArgumentException";
3983        _exceptionMessage = "exponent == null";
3984        goto exit;
3985    }
3986    if (exponentOffset < 0) {
3987        _exception = 1;
3988        _exceptionType = "java/lang/IllegalArgumentException";
3989        _exceptionMessage = "exponentOffset < 0";
3990        goto exit;
3991    }
3992    _exponentRemaining = _env->GetArrayLength(exponent_ref) - exponentOffset;
3993    if (_exponentRemaining < 16) {
3994        _exception = 1;
3995        _exceptionType = "java/lang/IllegalArgumentException";
3996        _exceptionMessage = "length - exponentOffset < 16 < needed";
3997        goto exit;
3998    }
3999    exponent_base = (GLint *)
4000        _env->GetPrimitiveArrayCritical(exponent_ref, (jboolean *)0);
4001    exponent = exponent_base + exponentOffset;
4002
4003    _returnValue = glQueryMatrixxOES(
4004        (GLfixed *)mantissa,
4005        (GLint *)exponent
4006    );
4007
4008exit:
4009    if (exponent_base) {
4010        _env->ReleasePrimitiveArrayCritical(exponent_ref, exponent_base,
4011            _exception ? JNI_ABORT: 0);
4012    }
4013    if (mantissa_base) {
4014        _env->ReleasePrimitiveArrayCritical(mantissa_ref, mantissa_base,
4015            _exception ? JNI_ABORT: 0);
4016    }
4017    if (_exception) {
4018        jniThrowException(_env, _exceptionType, _exceptionMessage);
4019    }
4020    return (jint)_returnValue;
4021}
4022
4023/* GLbitfield glQueryMatrixxOES ( GLfixed *mantissa, GLint *exponent ) */
4024static jint
4025android_glQueryMatrixxOES__Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
4026  (JNIEnv *_env, jobject _this, jobject mantissa_buf, jobject exponent_buf) {
4027    jint _exception = 0;
4028    const char * _exceptionType = NULL;
4029    const char * _exceptionMessage = NULL;
4030    jarray _mantissaArray = (jarray) 0;
4031    jint _mantissaBufferOffset = (jint) 0;
4032    jarray _exponentArray = (jarray) 0;
4033    jint _exponentBufferOffset = (jint) 0;
4034    GLbitfield _returnValue = -1;
4035    jint _mantissaRemaining;
4036    GLfixed *mantissa = (GLfixed *) 0;
4037    jint _exponentRemaining;
4038    GLint *exponent = (GLint *) 0;
4039
4040    mantissa = (GLfixed *)getPointer(_env, mantissa_buf, &_mantissaArray, &_mantissaRemaining, &_mantissaBufferOffset);
4041    if (_mantissaRemaining < 16) {
4042        _exception = 1;
4043        _exceptionType = "java/lang/IllegalArgumentException";
4044        _exceptionMessage = "remaining() < 16 < needed";
4045        goto exit;
4046    }
4047    exponent = (GLint *)getPointer(_env, exponent_buf, &_exponentArray, &_exponentRemaining, &_exponentBufferOffset);
4048    if (_exponentRemaining < 16) {
4049        _exception = 1;
4050        _exceptionType = "java/lang/IllegalArgumentException";
4051        _exceptionMessage = "remaining() < 16 < needed";
4052        goto exit;
4053    }
4054    if (mantissa == NULL) {
4055        char * _mantissaBase = (char *)_env->GetPrimitiveArrayCritical(_mantissaArray, (jboolean *) 0);
4056        mantissa = (GLfixed *) (_mantissaBase + _mantissaBufferOffset);
4057    }
4058    if (exponent == NULL) {
4059        char * _exponentBase = (char *)_env->GetPrimitiveArrayCritical(_exponentArray, (jboolean *) 0);
4060        exponent = (GLint *) (_exponentBase + _exponentBufferOffset);
4061    }
4062    _returnValue = glQueryMatrixxOES(
4063        (GLfixed *)mantissa,
4064        (GLint *)exponent
4065    );
4066
4067exit:
4068    if (_exponentArray) {
4069        releasePointer(_env, _exponentArray, exponent, _exception ? JNI_FALSE : JNI_TRUE);
4070    }
4071    if (_mantissaArray) {
4072        releasePointer(_env, _mantissaArray, mantissa, _exception ? JNI_FALSE : JNI_TRUE);
4073    }
4074    if (_exception) {
4075        jniThrowException(_env, _exceptionType, _exceptionMessage);
4076    }
4077    return (jint)_returnValue;
4078}
4079
4080/* void glBindBuffer ( GLenum target, GLuint buffer ) */
4081static void
4082android_glBindBuffer__II
4083  (JNIEnv *_env, jobject _this, jint target, jint buffer) {
4084    glBindBuffer(
4085        (GLenum)target,
4086        (GLuint)buffer
4087    );
4088}
4089
4090/* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */
4091static void
4092android_glBufferData__IILjava_nio_Buffer_2I
4093  (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) {
4094    jint _exception = 0;
4095    const char * _exceptionType = NULL;
4096    const char * _exceptionMessage = NULL;
4097    jarray _array = (jarray) 0;
4098    jint _bufferOffset = (jint) 0;
4099    jint _remaining;
4100    GLvoid *data = (GLvoid *) 0;
4101
4102    if (data_buf) {
4103        data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
4104        if (_remaining < size) {
4105            _exception = 1;
4106            _exceptionType = "java/lang/IllegalArgumentException";
4107            _exceptionMessage = "remaining() < size < needed";
4108            goto exit;
4109        }
4110    }
4111    if (data_buf && data == NULL) {
4112        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4113        data = (GLvoid *) (_dataBase + _bufferOffset);
4114    }
4115    glBufferData(
4116        (GLenum)target,
4117        (GLsizeiptr)size,
4118        (GLvoid *)data,
4119        (GLenum)usage
4120    );
4121
4122exit:
4123    if (_array) {
4124        releasePointer(_env, _array, data, JNI_FALSE);
4125    }
4126    if (_exception) {
4127        jniThrowException(_env, _exceptionType, _exceptionMessage);
4128    }
4129}
4130
4131/* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */
4132static void
4133android_glBufferSubData__IIILjava_nio_Buffer_2
4134  (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) {
4135    jint _exception = 0;
4136    const char * _exceptionType = NULL;
4137    const char * _exceptionMessage = NULL;
4138    jarray _array = (jarray) 0;
4139    jint _bufferOffset = (jint) 0;
4140    jint _remaining;
4141    GLvoid *data = (GLvoid *) 0;
4142
4143    data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
4144    if (_remaining < size) {
4145        _exception = 1;
4146        _exceptionType = "java/lang/IllegalArgumentException";
4147        _exceptionMessage = "remaining() < size < needed";
4148        goto exit;
4149    }
4150    if (data == NULL) {
4151        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4152        data = (GLvoid *) (_dataBase + _bufferOffset);
4153    }
4154    glBufferSubData(
4155        (GLenum)target,
4156        (GLintptr)offset,
4157        (GLsizeiptr)size,
4158        (GLvoid *)data
4159    );
4160
4161exit:
4162    if (_array) {
4163        releasePointer(_env, _array, data, JNI_FALSE);
4164    }
4165    if (_exception) {
4166        jniThrowException(_env, _exceptionType, _exceptionMessage);
4167    }
4168}
4169
4170/* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */
4171static void
4172android_glClipPlanef__I_3FI
4173  (JNIEnv *_env, jobject _this, jint plane, jfloatArray equation_ref, jint offset) {
4174    jint _exception = 0;
4175    const char * _exceptionType = NULL;
4176    const char * _exceptionMessage = NULL;
4177    GLfloat *equation_base = (GLfloat *) 0;
4178    jint _remaining;
4179    GLfloat *equation = (GLfloat *) 0;
4180
4181    if (!equation_ref) {
4182        _exception = 1;
4183        _exceptionType = "java/lang/IllegalArgumentException";
4184        _exceptionMessage = "equation == null";
4185        goto exit;
4186    }
4187    if (offset < 0) {
4188        _exception = 1;
4189        _exceptionType = "java/lang/IllegalArgumentException";
4190        _exceptionMessage = "offset < 0";
4191        goto exit;
4192    }
4193    _remaining = _env->GetArrayLength(equation_ref) - offset;
4194    if (_remaining < 4) {
4195        _exception = 1;
4196        _exceptionType = "java/lang/IllegalArgumentException";
4197        _exceptionMessage = "length - offset < 4 < needed";
4198        goto exit;
4199    }
4200    equation_base = (GLfloat *)
4201        _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0);
4202    equation = equation_base + offset;
4203
4204    glClipPlanef(
4205        (GLenum)plane,
4206        (GLfloat *)equation
4207    );
4208
4209exit:
4210    if (equation_base) {
4211        _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base,
4212            JNI_ABORT);
4213    }
4214    if (_exception) {
4215        jniThrowException(_env, _exceptionType, _exceptionMessage);
4216    }
4217}
4218
4219/* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */
4220static void
4221android_glClipPlanef__ILjava_nio_FloatBuffer_2
4222  (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
4223    jint _exception = 0;
4224    const char * _exceptionType = NULL;
4225    const char * _exceptionMessage = NULL;
4226    jarray _array = (jarray) 0;
4227    jint _bufferOffset = (jint) 0;
4228    jint _remaining;
4229    GLfloat *equation = (GLfloat *) 0;
4230
4231    equation = (GLfloat *)getPointer(_env, equation_buf, &_array, &_remaining, &_bufferOffset);
4232    if (_remaining < 4) {
4233        _exception = 1;
4234        _exceptionType = "java/lang/IllegalArgumentException";
4235        _exceptionMessage = "remaining() < 4 < needed";
4236        goto exit;
4237    }
4238    if (equation == NULL) {
4239        char * _equationBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4240        equation = (GLfloat *) (_equationBase + _bufferOffset);
4241    }
4242    glClipPlanef(
4243        (GLenum)plane,
4244        (GLfloat *)equation
4245    );
4246
4247exit:
4248    if (_array) {
4249        releasePointer(_env, _array, equation, JNI_FALSE);
4250    }
4251    if (_exception) {
4252        jniThrowException(_env, _exceptionType, _exceptionMessage);
4253    }
4254}
4255
4256/* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */
4257static void
4258android_glClipPlanex__I_3II
4259  (JNIEnv *_env, jobject _this, jint plane, jintArray equation_ref, jint offset) {
4260    jint _exception = 0;
4261    const char * _exceptionType = NULL;
4262    const char * _exceptionMessage = NULL;
4263    GLfixed *equation_base = (GLfixed *) 0;
4264    jint _remaining;
4265    GLfixed *equation = (GLfixed *) 0;
4266
4267    if (!equation_ref) {
4268        _exception = 1;
4269        _exceptionType = "java/lang/IllegalArgumentException";
4270        _exceptionMessage = "equation == null";
4271        goto exit;
4272    }
4273    if (offset < 0) {
4274        _exception = 1;
4275        _exceptionType = "java/lang/IllegalArgumentException";
4276        _exceptionMessage = "offset < 0";
4277        goto exit;
4278    }
4279    _remaining = _env->GetArrayLength(equation_ref) - offset;
4280    if (_remaining < 4) {
4281        _exception = 1;
4282        _exceptionType = "java/lang/IllegalArgumentException";
4283        _exceptionMessage = "length - offset < 4 < needed";
4284        goto exit;
4285    }
4286    equation_base = (GLfixed *)
4287        _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0);
4288    equation = equation_base + offset;
4289
4290    glClipPlanex(
4291        (GLenum)plane,
4292        (GLfixed *)equation
4293    );
4294
4295exit:
4296    if (equation_base) {
4297        _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base,
4298            JNI_ABORT);
4299    }
4300    if (_exception) {
4301        jniThrowException(_env, _exceptionType, _exceptionMessage);
4302    }
4303}
4304
4305/* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */
4306static void
4307android_glClipPlanex__ILjava_nio_IntBuffer_2
4308  (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
4309    jint _exception = 0;
4310    const char * _exceptionType = NULL;
4311    const char * _exceptionMessage = NULL;
4312    jarray _array = (jarray) 0;
4313    jint _bufferOffset = (jint) 0;
4314    jint _remaining;
4315    GLfixed *equation = (GLfixed *) 0;
4316
4317    equation = (GLfixed *)getPointer(_env, equation_buf, &_array, &_remaining, &_bufferOffset);
4318    if (_remaining < 4) {
4319        _exception = 1;
4320        _exceptionType = "java/lang/IllegalArgumentException";
4321        _exceptionMessage = "remaining() < 4 < needed";
4322        goto exit;
4323    }
4324    if (equation == NULL) {
4325        char * _equationBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4326        equation = (GLfixed *) (_equationBase + _bufferOffset);
4327    }
4328    glClipPlanex(
4329        (GLenum)plane,
4330        (GLfixed *)equation
4331    );
4332
4333exit:
4334    if (_array) {
4335        releasePointer(_env, _array, equation, JNI_FALSE);
4336    }
4337    if (_exception) {
4338        jniThrowException(_env, _exceptionType, _exceptionMessage);
4339    }
4340}
4341
4342/* void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) */
4343static void
4344android_glColor4ub__BBBB
4345  (JNIEnv *_env, jobject _this, jbyte red, jbyte green, jbyte blue, jbyte alpha) {
4346    glColor4ub(
4347        (GLubyte)red,
4348        (GLubyte)green,
4349        (GLubyte)blue,
4350        (GLubyte)alpha
4351    );
4352}
4353
4354/* void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
4355static void
4356android_glColorPointer__IIII
4357  (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
4358    glColorPointer(
4359        (GLint)size,
4360        (GLenum)type,
4361        (GLsizei)stride,
4362        reinterpret_cast<GLvoid *>(offset)
4363    );
4364}
4365
4366/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
4367static void
4368android_glDeleteBuffers__I_3II
4369  (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
4370    jint _exception = 0;
4371    const char * _exceptionType = NULL;
4372    const char * _exceptionMessage = NULL;
4373    GLuint *buffers_base = (GLuint *) 0;
4374    jint _remaining;
4375    GLuint *buffers = (GLuint *) 0;
4376
4377    if (!buffers_ref) {
4378        _exception = 1;
4379        _exceptionType = "java/lang/IllegalArgumentException";
4380        _exceptionMessage = "buffers == null";
4381        goto exit;
4382    }
4383    if (offset < 0) {
4384        _exception = 1;
4385        _exceptionType = "java/lang/IllegalArgumentException";
4386        _exceptionMessage = "offset < 0";
4387        goto exit;
4388    }
4389    _remaining = _env->GetArrayLength(buffers_ref) - offset;
4390    if (_remaining < n) {
4391        _exception = 1;
4392        _exceptionType = "java/lang/IllegalArgumentException";
4393        _exceptionMessage = "length - offset < n < needed";
4394        goto exit;
4395    }
4396    buffers_base = (GLuint *)
4397        _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
4398    buffers = buffers_base + offset;
4399
4400    glDeleteBuffers(
4401        (GLsizei)n,
4402        (GLuint *)buffers
4403    );
4404
4405exit:
4406    if (buffers_base) {
4407        _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
4408            JNI_ABORT);
4409    }
4410    if (_exception) {
4411        jniThrowException(_env, _exceptionType, _exceptionMessage);
4412    }
4413}
4414
4415/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
4416static void
4417android_glDeleteBuffers__ILjava_nio_IntBuffer_2
4418  (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
4419    jint _exception = 0;
4420    const char * _exceptionType = NULL;
4421    const char * _exceptionMessage = NULL;
4422    jarray _array = (jarray) 0;
4423    jint _bufferOffset = (jint) 0;
4424    jint _remaining;
4425    GLuint *buffers = (GLuint *) 0;
4426
4427    buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset);
4428    if (_remaining < n) {
4429        _exception = 1;
4430        _exceptionType = "java/lang/IllegalArgumentException";
4431        _exceptionMessage = "remaining() < n < needed";
4432        goto exit;
4433    }
4434    if (buffers == NULL) {
4435        char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4436        buffers = (GLuint *) (_buffersBase + _bufferOffset);
4437    }
4438    glDeleteBuffers(
4439        (GLsizei)n,
4440        (GLuint *)buffers
4441    );
4442
4443exit:
4444    if (_array) {
4445        releasePointer(_env, _array, buffers, JNI_FALSE);
4446    }
4447    if (_exception) {
4448        jniThrowException(_env, _exceptionType, _exceptionMessage);
4449    }
4450}
4451
4452/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */
4453static void
4454android_glDrawElements__IIII
4455  (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) {
4456    jint _exception = 0;
4457    const char * _exceptionType = NULL;
4458    const char * _exceptionMessage = NULL;
4459    glDrawElements(
4460        (GLenum)mode,
4461        (GLsizei)count,
4462        (GLenum)type,
4463        reinterpret_cast<GLvoid *>(offset)
4464    );
4465    if (_exception) {
4466        jniThrowException(_env, _exceptionType, _exceptionMessage);
4467    }
4468}
4469
4470/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
4471static void
4472android_glGenBuffers__I_3II
4473  (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
4474    jint _exception = 0;
4475    const char * _exceptionType = NULL;
4476    const char * _exceptionMessage = NULL;
4477    GLuint *buffers_base = (GLuint *) 0;
4478    jint _remaining;
4479    GLuint *buffers = (GLuint *) 0;
4480
4481    if (!buffers_ref) {
4482        _exception = 1;
4483        _exceptionType = "java/lang/IllegalArgumentException";
4484        _exceptionMessage = "buffers == null";
4485        goto exit;
4486    }
4487    if (offset < 0) {
4488        _exception = 1;
4489        _exceptionType = "java/lang/IllegalArgumentException";
4490        _exceptionMessage = "offset < 0";
4491        goto exit;
4492    }
4493    _remaining = _env->GetArrayLength(buffers_ref) - offset;
4494    if (_remaining < n) {
4495        _exception = 1;
4496        _exceptionType = "java/lang/IllegalArgumentException";
4497        _exceptionMessage = "length - offset < n < needed";
4498        goto exit;
4499    }
4500    buffers_base = (GLuint *)
4501        _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
4502    buffers = buffers_base + offset;
4503
4504    glGenBuffers(
4505        (GLsizei)n,
4506        (GLuint *)buffers
4507    );
4508
4509exit:
4510    if (buffers_base) {
4511        _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
4512            _exception ? JNI_ABORT: 0);
4513    }
4514    if (_exception) {
4515        jniThrowException(_env, _exceptionType, _exceptionMessage);
4516    }
4517}
4518
4519/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
4520static void
4521android_glGenBuffers__ILjava_nio_IntBuffer_2
4522  (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
4523    jint _exception = 0;
4524    const char * _exceptionType = NULL;
4525    const char * _exceptionMessage = NULL;
4526    jarray _array = (jarray) 0;
4527    jint _bufferOffset = (jint) 0;
4528    jint _remaining;
4529    GLuint *buffers = (GLuint *) 0;
4530
4531    buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset);
4532    if (_remaining < n) {
4533        _exception = 1;
4534        _exceptionType = "java/lang/IllegalArgumentException";
4535        _exceptionMessage = "remaining() < n < needed";
4536        goto exit;
4537    }
4538    if (buffers == NULL) {
4539        char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4540        buffers = (GLuint *) (_buffersBase + _bufferOffset);
4541    }
4542    glGenBuffers(
4543        (GLsizei)n,
4544        (GLuint *)buffers
4545    );
4546
4547exit:
4548    if (_array) {
4549        releasePointer(_env, _array, buffers, _exception ? JNI_FALSE : JNI_TRUE);
4550    }
4551    if (_exception) {
4552        jniThrowException(_env, _exceptionType, _exceptionMessage);
4553    }
4554}
4555
4556/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
4557static void
4558android_glGetBooleanv__I_3ZI
4559  (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
4560    jint _exception = 0;
4561    const char * _exceptionType = NULL;
4562    const char * _exceptionMessage = NULL;
4563    GLboolean *params_base = (GLboolean *) 0;
4564    jint _remaining;
4565    GLboolean *params = (GLboolean *) 0;
4566
4567    if (!params_ref) {
4568        _exception = 1;
4569        _exceptionType = "java/lang/IllegalArgumentException";
4570        _exceptionMessage = "params == null";
4571        goto exit;
4572    }
4573    if (offset < 0) {
4574        _exception = 1;
4575        _exceptionType = "java/lang/IllegalArgumentException";
4576        _exceptionMessage = "offset < 0";
4577        goto exit;
4578    }
4579    _remaining = _env->GetArrayLength(params_ref) - offset;
4580    params_base = (GLboolean *)
4581        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
4582    params = params_base + offset;
4583
4584    glGetBooleanv(
4585        (GLenum)pname,
4586        (GLboolean *)params
4587    );
4588
4589exit:
4590    if (params_base) {
4591        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
4592            _exception ? JNI_ABORT: 0);
4593    }
4594    if (_exception) {
4595        jniThrowException(_env, _exceptionType, _exceptionMessage);
4596    }
4597}
4598
4599/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
4600static void
4601android_glGetBooleanv__ILjava_nio_IntBuffer_2
4602  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
4603    jarray _array = (jarray) 0;
4604    jint _bufferOffset = (jint) 0;
4605    jint _remaining;
4606    GLboolean *params = (GLboolean *) 0;
4607
4608    params = (GLboolean *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
4609    if (params == NULL) {
4610        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4611        params = (GLboolean *) (_paramsBase + _bufferOffset);
4612    }
4613    glGetBooleanv(
4614        (GLenum)pname,
4615        (GLboolean *)params
4616    );
4617    if (_array) {
4618        releasePointer(_env, _array, params, JNI_TRUE);
4619    }
4620}
4621
4622/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
4623static void
4624android_glGetBufferParameteriv__II_3II
4625  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
4626    jniThrowException(_env, "java/lang/UnsupportedOperationException",
4627        "glGetBufferParameteriv");
4628}
4629
4630/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
4631static void
4632android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
4633  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
4634    jniThrowException(_env, "java/lang/UnsupportedOperationException",
4635        "glGetBufferParameteriv");
4636}
4637
4638/* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */
4639static void
4640android_glGetClipPlanef__I_3FI
4641  (JNIEnv *_env, jobject _this, jint pname, jfloatArray eqn_ref, jint offset) {
4642    jint _exception = 0;
4643    const char * _exceptionType = NULL;
4644    const char * _exceptionMessage = NULL;
4645    GLfloat *eqn_base = (GLfloat *) 0;
4646    jint _remaining;
4647    GLfloat *eqn = (GLfloat *) 0;
4648
4649    if (!eqn_ref) {
4650        _exception = 1;
4651        _exceptionType = "java/lang/IllegalArgumentException";
4652        _exceptionMessage = "eqn == null";
4653        goto exit;
4654    }
4655    if (offset < 0) {
4656        _exception = 1;
4657        _exceptionType = "java/lang/IllegalArgumentException";
4658        _exceptionMessage = "offset < 0";
4659        goto exit;
4660    }
4661    _remaining = _env->GetArrayLength(eqn_ref) - offset;
4662    eqn_base = (GLfloat *)
4663        _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0);
4664    eqn = eqn_base + offset;
4665
4666    glGetClipPlanef(
4667        (GLenum)pname,
4668        (GLfloat *)eqn
4669    );
4670
4671exit:
4672    if (eqn_base) {
4673        _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base,
4674            _exception ? JNI_ABORT: 0);
4675    }
4676    if (_exception) {
4677        jniThrowException(_env, _exceptionType, _exceptionMessage);
4678    }
4679}
4680
4681/* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */
4682static void
4683android_glGetClipPlanef__ILjava_nio_FloatBuffer_2
4684  (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
4685    jarray _array = (jarray) 0;
4686    jint _bufferOffset = (jint) 0;
4687    jint _remaining;
4688    GLfloat *eqn = (GLfloat *) 0;
4689
4690    eqn = (GLfloat *)getPointer(_env, eqn_buf, &_array, &_remaining, &_bufferOffset);
4691    if (eqn == NULL) {
4692        char * _eqnBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4693        eqn = (GLfloat *) (_eqnBase + _bufferOffset);
4694    }
4695    glGetClipPlanef(
4696        (GLenum)pname,
4697        (GLfloat *)eqn
4698    );
4699    if (_array) {
4700        releasePointer(_env, _array, eqn, JNI_TRUE);
4701    }
4702}
4703
4704/* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */
4705static void
4706android_glGetClipPlanex__I_3II
4707  (JNIEnv *_env, jobject _this, jint pname, jintArray eqn_ref, jint offset) {
4708    jint _exception = 0;
4709    const char * _exceptionType = NULL;
4710    const char * _exceptionMessage = NULL;
4711    GLfixed *eqn_base = (GLfixed *) 0;
4712    jint _remaining;
4713    GLfixed *eqn = (GLfixed *) 0;
4714
4715    if (!eqn_ref) {
4716        _exception = 1;
4717        _exceptionType = "java/lang/IllegalArgumentException";
4718        _exceptionMessage = "eqn == null";
4719        goto exit;
4720    }
4721    if (offset < 0) {
4722        _exception = 1;
4723        _exceptionType = "java/lang/IllegalArgumentException";
4724        _exceptionMessage = "offset < 0";
4725        goto exit;
4726    }
4727    _remaining = _env->GetArrayLength(eqn_ref) - offset;
4728    eqn_base = (GLfixed *)
4729        _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0);
4730    eqn = eqn_base + offset;
4731
4732    glGetClipPlanex(
4733        (GLenum)pname,
4734        (GLfixed *)eqn
4735    );
4736
4737exit:
4738    if (eqn_base) {
4739        _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base,
4740            _exception ? JNI_ABORT: 0);
4741    }
4742    if (_exception) {
4743        jniThrowException(_env, _exceptionType, _exceptionMessage);
4744    }
4745}
4746
4747/* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */
4748static void
4749android_glGetClipPlanex__ILjava_nio_IntBuffer_2
4750  (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
4751    jarray _array = (jarray) 0;
4752    jint _bufferOffset = (jint) 0;
4753    jint _remaining;
4754    GLfixed *eqn = (GLfixed *) 0;
4755
4756    eqn = (GLfixed *)getPointer(_env, eqn_buf, &_array, &_remaining, &_bufferOffset);
4757    if (eqn == NULL) {
4758        char * _eqnBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4759        eqn = (GLfixed *) (_eqnBase + _bufferOffset);
4760    }
4761    glGetClipPlanex(
4762        (GLenum)pname,
4763        (GLfixed *)eqn
4764    );
4765    if (_array) {
4766        releasePointer(_env, _array, eqn, JNI_TRUE);
4767    }
4768}
4769
4770/* void glGetFixedv ( GLenum pname, GLfixed *params ) */
4771static void
4772android_glGetFixedv__I_3II
4773  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
4774    jint _exception = 0;
4775    const char * _exceptionType = NULL;
4776    const char * _exceptionMessage = NULL;
4777    GLfixed *params_base = (GLfixed *) 0;
4778    jint _remaining;
4779    GLfixed *params = (GLfixed *) 0;
4780
4781    if (!params_ref) {
4782        _exception = 1;
4783        _exceptionType = "java/lang/IllegalArgumentException";
4784        _exceptionMessage = "params == null";
4785        goto exit;
4786    }
4787    if (offset < 0) {
4788        _exception = 1;
4789        _exceptionType = "java/lang/IllegalArgumentException";
4790        _exceptionMessage = "offset < 0";
4791        goto exit;
4792    }
4793    _remaining = _env->GetArrayLength(params_ref) - offset;
4794    params_base = (GLfixed *)
4795        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
4796    params = params_base + offset;
4797
4798    glGetFixedv(
4799        (GLenum)pname,
4800        (GLfixed *)params
4801    );
4802
4803exit:
4804    if (params_base) {
4805        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
4806            _exception ? JNI_ABORT: 0);
4807    }
4808    if (_exception) {
4809        jniThrowException(_env, _exceptionType, _exceptionMessage);
4810    }
4811}
4812
4813/* void glGetFixedv ( GLenum pname, GLfixed *params ) */
4814static void
4815android_glGetFixedv__ILjava_nio_IntBuffer_2
4816  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
4817    jarray _array = (jarray) 0;
4818    jint _bufferOffset = (jint) 0;
4819    jint _remaining;
4820    GLfixed *params = (GLfixed *) 0;
4821
4822    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
4823    if (params == NULL) {
4824        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4825        params = (GLfixed *) (_paramsBase + _bufferOffset);
4826    }
4827    glGetFixedv(
4828        (GLenum)pname,
4829        (GLfixed *)params
4830    );
4831    if (_array) {
4832        releasePointer(_env, _array, params, JNI_TRUE);
4833    }
4834}
4835
4836/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
4837static void
4838android_glGetFloatv__I_3FI
4839  (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
4840    jint _exception = 0;
4841    const char * _exceptionType = NULL;
4842    const char * _exceptionMessage = NULL;
4843    GLfloat *params_base = (GLfloat *) 0;
4844    jint _remaining;
4845    GLfloat *params = (GLfloat *) 0;
4846
4847    if (!params_ref) {
4848        _exception = 1;
4849        _exceptionType = "java/lang/IllegalArgumentException";
4850        _exceptionMessage = "params == null";
4851        goto exit;
4852    }
4853    if (offset < 0) {
4854        _exception = 1;
4855        _exceptionType = "java/lang/IllegalArgumentException";
4856        _exceptionMessage = "offset < 0";
4857        goto exit;
4858    }
4859    _remaining = _env->GetArrayLength(params_ref) - offset;
4860    params_base = (GLfloat *)
4861        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
4862    params = params_base + offset;
4863
4864    glGetFloatv(
4865        (GLenum)pname,
4866        (GLfloat *)params
4867    );
4868
4869exit:
4870    if (params_base) {
4871        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
4872            _exception ? JNI_ABORT: 0);
4873    }
4874    if (_exception) {
4875        jniThrowException(_env, _exceptionType, _exceptionMessage);
4876    }
4877}
4878
4879/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
4880static void
4881android_glGetFloatv__ILjava_nio_FloatBuffer_2
4882  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
4883    jarray _array = (jarray) 0;
4884    jint _bufferOffset = (jint) 0;
4885    jint _remaining;
4886    GLfloat *params = (GLfloat *) 0;
4887
4888    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
4889    if (params == NULL) {
4890        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4891        params = (GLfloat *) (_paramsBase + _bufferOffset);
4892    }
4893    glGetFloatv(
4894        (GLenum)pname,
4895        (GLfloat *)params
4896    );
4897    if (_array) {
4898        releasePointer(_env, _array, params, JNI_TRUE);
4899    }
4900}
4901
4902/* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */
4903static void
4904android_glGetLightfv__II_3FI
4905  (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) {
4906    jint _exception = 0;
4907    const char * _exceptionType = NULL;
4908    const char * _exceptionMessage = NULL;
4909    GLfloat *params_base = (GLfloat *) 0;
4910    jint _remaining;
4911    GLfloat *params = (GLfloat *) 0;
4912
4913    if (!params_ref) {
4914        _exception = 1;
4915        _exceptionType = "java/lang/IllegalArgumentException";
4916        _exceptionMessage = "params == null";
4917        goto exit;
4918    }
4919    if (offset < 0) {
4920        _exception = 1;
4921        _exceptionType = "java/lang/IllegalArgumentException";
4922        _exceptionMessage = "offset < 0";
4923        goto exit;
4924    }
4925    _remaining = _env->GetArrayLength(params_ref) - offset;
4926    int _needed;
4927    switch (pname) {
4928#if defined(GL_SPOT_EXPONENT)
4929        case GL_SPOT_EXPONENT:
4930#endif // defined(GL_SPOT_EXPONENT)
4931#if defined(GL_SPOT_CUTOFF)
4932        case GL_SPOT_CUTOFF:
4933#endif // defined(GL_SPOT_CUTOFF)
4934#if defined(GL_CONSTANT_ATTENUATION)
4935        case GL_CONSTANT_ATTENUATION:
4936#endif // defined(GL_CONSTANT_ATTENUATION)
4937#if defined(GL_LINEAR_ATTENUATION)
4938        case GL_LINEAR_ATTENUATION:
4939#endif // defined(GL_LINEAR_ATTENUATION)
4940#if defined(GL_QUADRATIC_ATTENUATION)
4941        case GL_QUADRATIC_ATTENUATION:
4942#endif // defined(GL_QUADRATIC_ATTENUATION)
4943            _needed = 1;
4944            break;
4945#if defined(GL_SPOT_DIRECTION)
4946        case GL_SPOT_DIRECTION:
4947#endif // defined(GL_SPOT_DIRECTION)
4948            _needed = 3;
4949            break;
4950#if defined(GL_AMBIENT)
4951        case GL_AMBIENT:
4952#endif // defined(GL_AMBIENT)
4953#if defined(GL_DIFFUSE)
4954        case GL_DIFFUSE:
4955#endif // defined(GL_DIFFUSE)
4956#if defined(GL_SPECULAR)
4957        case GL_SPECULAR:
4958#endif // defined(GL_SPECULAR)
4959#if defined(GL_EMISSION)
4960        case GL_EMISSION:
4961#endif // defined(GL_EMISSION)
4962            _needed = 4;
4963            break;
4964        default:
4965            _needed = 1;
4966            break;
4967    }
4968    if (_remaining < _needed) {
4969        _exception = 1;
4970        _exceptionType = "java/lang/IllegalArgumentException";
4971        _exceptionMessage = "length - offset < needed";
4972        goto exit;
4973    }
4974    params_base = (GLfloat *)
4975        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
4976    params = params_base + offset;
4977
4978    glGetLightfv(
4979        (GLenum)light,
4980        (GLenum)pname,
4981        (GLfloat *)params
4982    );
4983
4984exit:
4985    if (params_base) {
4986        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
4987            _exception ? JNI_ABORT: 0);
4988    }
4989    if (_exception) {
4990        jniThrowException(_env, _exceptionType, _exceptionMessage);
4991    }
4992}
4993
4994/* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */
4995static void
4996android_glGetLightfv__IILjava_nio_FloatBuffer_2
4997  (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
4998    jint _exception = 0;
4999    const char * _exceptionType = NULL;
5000    const char * _exceptionMessage = NULL;
5001    jarray _array = (jarray) 0;
5002    jint _bufferOffset = (jint) 0;
5003    jint _remaining;
5004    GLfloat *params = (GLfloat *) 0;
5005
5006    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
5007    int _needed;
5008    switch (pname) {
5009#if defined(GL_SPOT_EXPONENT)
5010        case GL_SPOT_EXPONENT:
5011#endif // defined(GL_SPOT_EXPONENT)
5012#if defined(GL_SPOT_CUTOFF)
5013        case GL_SPOT_CUTOFF:
5014#endif // defined(GL_SPOT_CUTOFF)
5015#if defined(GL_CONSTANT_ATTENUATION)
5016        case GL_CONSTANT_ATTENUATION:
5017#endif // defined(GL_CONSTANT_ATTENUATION)
5018#if defined(GL_LINEAR_ATTENUATION)
5019        case GL_LINEAR_ATTENUATION:
5020#endif // defined(GL_LINEAR_ATTENUATION)
5021#if defined(GL_QUADRATIC_ATTENUATION)
5022        case GL_QUADRATIC_ATTENUATION:
5023#endif // defined(GL_QUADRATIC_ATTENUATION)
5024            _needed = 1;
5025            break;
5026#if defined(GL_SPOT_DIRECTION)
5027        case GL_SPOT_DIRECTION:
5028#endif // defined(GL_SPOT_DIRECTION)
5029            _needed = 3;
5030            break;
5031#if defined(GL_AMBIENT)
5032        case GL_AMBIENT:
5033#endif // defined(GL_AMBIENT)
5034#if defined(GL_DIFFUSE)
5035        case GL_DIFFUSE:
5036#endif // defined(GL_DIFFUSE)
5037#if defined(GL_SPECULAR)
5038        case GL_SPECULAR:
5039#endif // defined(GL_SPECULAR)
5040#if defined(GL_EMISSION)
5041        case GL_EMISSION:
5042#endif // defined(GL_EMISSION)
5043            _needed = 4;
5044            break;
5045        default:
5046            _needed = 1;
5047            break;
5048    }
5049    if (_remaining < _needed) {
5050        _exception = 1;
5051        _exceptionType = "java/lang/IllegalArgumentException";
5052        _exceptionMessage = "remaining() < needed";
5053        goto exit;
5054    }
5055    if (params == NULL) {
5056        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5057        params = (GLfloat *) (_paramsBase + _bufferOffset);
5058    }
5059    glGetLightfv(
5060        (GLenum)light,
5061        (GLenum)pname,
5062        (GLfloat *)params
5063    );
5064
5065exit:
5066    if (_array) {
5067        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
5068    }
5069    if (_exception) {
5070        jniThrowException(_env, _exceptionType, _exceptionMessage);
5071    }
5072}
5073
5074/* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */
5075static void
5076android_glGetLightxv__II_3II
5077  (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) {
5078    jint _exception = 0;
5079    const char * _exceptionType = NULL;
5080    const char * _exceptionMessage = NULL;
5081    GLfixed *params_base = (GLfixed *) 0;
5082    jint _remaining;
5083    GLfixed *params = (GLfixed *) 0;
5084
5085    if (!params_ref) {
5086        _exception = 1;
5087        _exceptionType = "java/lang/IllegalArgumentException";
5088        _exceptionMessage = "params == null";
5089        goto exit;
5090    }
5091    if (offset < 0) {
5092        _exception = 1;
5093        _exceptionType = "java/lang/IllegalArgumentException";
5094        _exceptionMessage = "offset < 0";
5095        goto exit;
5096    }
5097    _remaining = _env->GetArrayLength(params_ref) - offset;
5098    int _needed;
5099    switch (pname) {
5100#if defined(GL_SPOT_EXPONENT)
5101        case GL_SPOT_EXPONENT:
5102#endif // defined(GL_SPOT_EXPONENT)
5103#if defined(GL_SPOT_CUTOFF)
5104        case GL_SPOT_CUTOFF:
5105#endif // defined(GL_SPOT_CUTOFF)
5106#if defined(GL_CONSTANT_ATTENUATION)
5107        case GL_CONSTANT_ATTENUATION:
5108#endif // defined(GL_CONSTANT_ATTENUATION)
5109#if defined(GL_LINEAR_ATTENUATION)
5110        case GL_LINEAR_ATTENUATION:
5111#endif // defined(GL_LINEAR_ATTENUATION)
5112#if defined(GL_QUADRATIC_ATTENUATION)
5113        case GL_QUADRATIC_ATTENUATION:
5114#endif // defined(GL_QUADRATIC_ATTENUATION)
5115            _needed = 1;
5116            break;
5117#if defined(GL_SPOT_DIRECTION)
5118        case GL_SPOT_DIRECTION:
5119#endif // defined(GL_SPOT_DIRECTION)
5120            _needed = 3;
5121            break;
5122#if defined(GL_AMBIENT)
5123        case GL_AMBIENT:
5124#endif // defined(GL_AMBIENT)
5125#if defined(GL_DIFFUSE)
5126        case GL_DIFFUSE:
5127#endif // defined(GL_DIFFUSE)
5128#if defined(GL_SPECULAR)
5129        case GL_SPECULAR:
5130#endif // defined(GL_SPECULAR)
5131#if defined(GL_EMISSION)
5132        case GL_EMISSION:
5133#endif // defined(GL_EMISSION)
5134            _needed = 4;
5135            break;
5136        default:
5137            _needed = 1;
5138            break;
5139    }
5140    if (_remaining < _needed) {
5141        _exception = 1;
5142        _exceptionType = "java/lang/IllegalArgumentException";
5143        _exceptionMessage = "length - offset < needed";
5144        goto exit;
5145    }
5146    params_base = (GLfixed *)
5147        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
5148    params = params_base + offset;
5149
5150    glGetLightxv(
5151        (GLenum)light,
5152        (GLenum)pname,
5153        (GLfixed *)params
5154    );
5155
5156exit:
5157    if (params_base) {
5158        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
5159            _exception ? JNI_ABORT: 0);
5160    }
5161    if (_exception) {
5162        jniThrowException(_env, _exceptionType, _exceptionMessage);
5163    }
5164}
5165
5166/* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */
5167static void
5168android_glGetLightxv__IILjava_nio_IntBuffer_2
5169  (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
5170    jint _exception = 0;
5171    const char * _exceptionType = NULL;
5172    const char * _exceptionMessage = NULL;
5173    jarray _array = (jarray) 0;
5174    jint _bufferOffset = (jint) 0;
5175    jint _remaining;
5176    GLfixed *params = (GLfixed *) 0;
5177
5178    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
5179    int _needed;
5180    switch (pname) {
5181#if defined(GL_SPOT_EXPONENT)
5182        case GL_SPOT_EXPONENT:
5183#endif // defined(GL_SPOT_EXPONENT)
5184#if defined(GL_SPOT_CUTOFF)
5185        case GL_SPOT_CUTOFF:
5186#endif // defined(GL_SPOT_CUTOFF)
5187#if defined(GL_CONSTANT_ATTENUATION)
5188        case GL_CONSTANT_ATTENUATION:
5189#endif // defined(GL_CONSTANT_ATTENUATION)
5190#if defined(GL_LINEAR_ATTENUATION)
5191        case GL_LINEAR_ATTENUATION:
5192#endif // defined(GL_LINEAR_ATTENUATION)
5193#if defined(GL_QUADRATIC_ATTENUATION)
5194        case GL_QUADRATIC_ATTENUATION:
5195#endif // defined(GL_QUADRATIC_ATTENUATION)
5196            _needed = 1;
5197            break;
5198#if defined(GL_SPOT_DIRECTION)
5199        case GL_SPOT_DIRECTION:
5200#endif // defined(GL_SPOT_DIRECTION)
5201            _needed = 3;
5202            break;
5203#if defined(GL_AMBIENT)
5204        case GL_AMBIENT:
5205#endif // defined(GL_AMBIENT)
5206#if defined(GL_DIFFUSE)
5207        case GL_DIFFUSE:
5208#endif // defined(GL_DIFFUSE)
5209#if defined(GL_SPECULAR)
5210        case GL_SPECULAR:
5211#endif // defined(GL_SPECULAR)
5212#if defined(GL_EMISSION)
5213        case GL_EMISSION:
5214#endif // defined(GL_EMISSION)
5215            _needed = 4;
5216            break;
5217        default:
5218            _needed = 1;
5219            break;
5220    }
5221    if (_remaining < _needed) {
5222        _exception = 1;
5223        _exceptionType = "java/lang/IllegalArgumentException";
5224        _exceptionMessage = "remaining() < needed";
5225        goto exit;
5226    }
5227    if (params == NULL) {
5228        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5229        params = (GLfixed *) (_paramsBase + _bufferOffset);
5230    }
5231    glGetLightxv(
5232        (GLenum)light,
5233        (GLenum)pname,
5234        (GLfixed *)params
5235    );
5236
5237exit:
5238    if (_array) {
5239        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
5240    }
5241    if (_exception) {
5242        jniThrowException(_env, _exceptionType, _exceptionMessage);
5243    }
5244}
5245
5246/* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */
5247static void
5248android_glGetMaterialfv__II_3FI
5249  (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) {
5250    jint _exception = 0;
5251    const char * _exceptionType = NULL;
5252    const char * _exceptionMessage = NULL;
5253    GLfloat *params_base = (GLfloat *) 0;
5254    jint _remaining;
5255    GLfloat *params = (GLfloat *) 0;
5256
5257    if (!params_ref) {
5258        _exception = 1;
5259        _exceptionType = "java/lang/IllegalArgumentException";
5260        _exceptionMessage = "params == null";
5261        goto exit;
5262    }
5263    if (offset < 0) {
5264        _exception = 1;
5265        _exceptionType = "java/lang/IllegalArgumentException";
5266        _exceptionMessage = "offset < 0";
5267        goto exit;
5268    }
5269    _remaining = _env->GetArrayLength(params_ref) - offset;
5270    int _needed;
5271    switch (pname) {
5272#if defined(GL_SHININESS)
5273        case GL_SHININESS:
5274#endif // defined(GL_SHININESS)
5275            _needed = 1;
5276            break;
5277#if defined(GL_AMBIENT)
5278        case GL_AMBIENT:
5279#endif // defined(GL_AMBIENT)
5280#if defined(GL_DIFFUSE)
5281        case GL_DIFFUSE:
5282#endif // defined(GL_DIFFUSE)
5283#if defined(GL_SPECULAR)
5284        case GL_SPECULAR:
5285#endif // defined(GL_SPECULAR)
5286#if defined(GL_EMISSION)
5287        case GL_EMISSION:
5288#endif // defined(GL_EMISSION)
5289#if defined(GL_AMBIENT_AND_DIFFUSE)
5290        case GL_AMBIENT_AND_DIFFUSE:
5291#endif // defined(GL_AMBIENT_AND_DIFFUSE)
5292            _needed = 4;
5293            break;
5294        default:
5295            _needed = 1;
5296            break;
5297    }
5298    if (_remaining < _needed) {
5299        _exception = 1;
5300        _exceptionType = "java/lang/IllegalArgumentException";
5301        _exceptionMessage = "length - offset < needed";
5302        goto exit;
5303    }
5304    params_base = (GLfloat *)
5305        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
5306    params = params_base + offset;
5307
5308    glGetMaterialfv(
5309        (GLenum)face,
5310        (GLenum)pname,
5311        (GLfloat *)params
5312    );
5313
5314exit:
5315    if (params_base) {
5316        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
5317            _exception ? JNI_ABORT: 0);
5318    }
5319    if (_exception) {
5320        jniThrowException(_env, _exceptionType, _exceptionMessage);
5321    }
5322}
5323
5324/* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */
5325static void
5326android_glGetMaterialfv__IILjava_nio_FloatBuffer_2
5327  (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
5328    jint _exception = 0;
5329    const char * _exceptionType = NULL;
5330    const char * _exceptionMessage = NULL;
5331    jarray _array = (jarray) 0;
5332    jint _bufferOffset = (jint) 0;
5333    jint _remaining;
5334    GLfloat *params = (GLfloat *) 0;
5335
5336    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
5337    int _needed;
5338    switch (pname) {
5339#if defined(GL_SHININESS)
5340        case GL_SHININESS:
5341#endif // defined(GL_SHININESS)
5342            _needed = 1;
5343            break;
5344#if defined(GL_AMBIENT)
5345        case GL_AMBIENT:
5346#endif // defined(GL_AMBIENT)
5347#if defined(GL_DIFFUSE)
5348        case GL_DIFFUSE:
5349#endif // defined(GL_DIFFUSE)
5350#if defined(GL_SPECULAR)
5351        case GL_SPECULAR:
5352#endif // defined(GL_SPECULAR)
5353#if defined(GL_EMISSION)
5354        case GL_EMISSION:
5355#endif // defined(GL_EMISSION)
5356#if defined(GL_AMBIENT_AND_DIFFUSE)
5357        case GL_AMBIENT_AND_DIFFUSE:
5358#endif // defined(GL_AMBIENT_AND_DIFFUSE)
5359            _needed = 4;
5360            break;
5361        default:
5362            _needed = 1;
5363            break;
5364    }
5365    if (_remaining < _needed) {
5366        _exception = 1;
5367        _exceptionType = "java/lang/IllegalArgumentException";
5368        _exceptionMessage = "remaining() < needed";
5369        goto exit;
5370    }
5371    if (params == NULL) {
5372        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5373        params = (GLfloat *) (_paramsBase + _bufferOffset);
5374    }
5375    glGetMaterialfv(
5376        (GLenum)face,
5377        (GLenum)pname,
5378        (GLfloat *)params
5379    );
5380
5381exit:
5382    if (_array) {
5383        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
5384    }
5385    if (_exception) {
5386        jniThrowException(_env, _exceptionType, _exceptionMessage);
5387    }
5388}
5389
5390/* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */
5391static void
5392android_glGetMaterialxv__II_3II
5393  (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) {
5394    jint _exception = 0;
5395    const char * _exceptionType = NULL;
5396    const char * _exceptionMessage = NULL;
5397    GLfixed *params_base = (GLfixed *) 0;
5398    jint _remaining;
5399    GLfixed *params = (GLfixed *) 0;
5400
5401    if (!params_ref) {
5402        _exception = 1;
5403        _exceptionType = "java/lang/IllegalArgumentException";
5404        _exceptionMessage = "params == null";
5405        goto exit;
5406    }
5407    if (offset < 0) {
5408        _exception = 1;
5409        _exceptionType = "java/lang/IllegalArgumentException";
5410        _exceptionMessage = "offset < 0";
5411        goto exit;
5412    }
5413    _remaining = _env->GetArrayLength(params_ref) - offset;
5414    int _needed;
5415    switch (pname) {
5416#if defined(GL_SHININESS)
5417        case GL_SHININESS:
5418#endif // defined(GL_SHININESS)
5419            _needed = 1;
5420            break;
5421#if defined(GL_AMBIENT)
5422        case GL_AMBIENT:
5423#endif // defined(GL_AMBIENT)
5424#if defined(GL_DIFFUSE)
5425        case GL_DIFFUSE:
5426#endif // defined(GL_DIFFUSE)
5427#if defined(GL_SPECULAR)
5428        case GL_SPECULAR:
5429#endif // defined(GL_SPECULAR)
5430#if defined(GL_EMISSION)
5431        case GL_EMISSION:
5432#endif // defined(GL_EMISSION)
5433#if defined(GL_AMBIENT_AND_DIFFUSE)
5434        case GL_AMBIENT_AND_DIFFUSE:
5435#endif // defined(GL_AMBIENT_AND_DIFFUSE)
5436            _needed = 4;
5437            break;
5438        default:
5439            _needed = 1;
5440            break;
5441    }
5442    if (_remaining < _needed) {
5443        _exception = 1;
5444        _exceptionType = "java/lang/IllegalArgumentException";
5445        _exceptionMessage = "length - offset < needed";
5446        goto exit;
5447    }
5448    params_base = (GLfixed *)
5449        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
5450    params = params_base + offset;
5451
5452    glGetMaterialxv(
5453        (GLenum)face,
5454        (GLenum)pname,
5455        (GLfixed *)params
5456    );
5457
5458exit:
5459    if (params_base) {
5460        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
5461            _exception ? JNI_ABORT: 0);
5462    }
5463    if (_exception) {
5464        jniThrowException(_env, _exceptionType, _exceptionMessage);
5465    }
5466}
5467
5468/* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */
5469static void
5470android_glGetMaterialxv__IILjava_nio_IntBuffer_2
5471  (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
5472    jint _exception = 0;
5473    const char * _exceptionType = NULL;
5474    const char * _exceptionMessage = NULL;
5475    jarray _array = (jarray) 0;
5476    jint _bufferOffset = (jint) 0;
5477    jint _remaining;
5478    GLfixed *params = (GLfixed *) 0;
5479
5480    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
5481    int _needed;
5482    switch (pname) {
5483#if defined(GL_SHININESS)
5484        case GL_SHININESS:
5485#endif // defined(GL_SHININESS)
5486            _needed = 1;
5487            break;
5488#if defined(GL_AMBIENT)
5489        case GL_AMBIENT:
5490#endif // defined(GL_AMBIENT)
5491#if defined(GL_DIFFUSE)
5492        case GL_DIFFUSE:
5493#endif // defined(GL_DIFFUSE)
5494#if defined(GL_SPECULAR)
5495        case GL_SPECULAR:
5496#endif // defined(GL_SPECULAR)
5497#if defined(GL_EMISSION)
5498        case GL_EMISSION:
5499#endif // defined(GL_EMISSION)
5500#if defined(GL_AMBIENT_AND_DIFFUSE)
5501        case GL_AMBIENT_AND_DIFFUSE:
5502#endif // defined(GL_AMBIENT_AND_DIFFUSE)
5503            _needed = 4;
5504            break;
5505        default:
5506            _needed = 1;
5507            break;
5508    }
5509    if (_remaining < _needed) {
5510        _exception = 1;
5511        _exceptionType = "java/lang/IllegalArgumentException";
5512        _exceptionMessage = "remaining() < needed";
5513        goto exit;
5514    }
5515    if (params == NULL) {
5516        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5517        params = (GLfixed *) (_paramsBase + _bufferOffset);
5518    }
5519    glGetMaterialxv(
5520        (GLenum)face,
5521        (GLenum)pname,
5522        (GLfixed *)params
5523    );
5524
5525exit:
5526    if (_array) {
5527        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
5528    }
5529    if (_exception) {
5530        jniThrowException(_env, _exceptionType, _exceptionMessage);
5531    }
5532}
5533
5534/* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */
5535static void
5536android_glGetTexEnviv__II_3II
5537  (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) {
5538    jint _exception = 0;
5539    const char * _exceptionType = NULL;
5540    const char * _exceptionMessage = NULL;
5541    GLint *params_base = (GLint *) 0;
5542    jint _remaining;
5543    GLint *params = (GLint *) 0;
5544
5545    if (!params_ref) {
5546        _exception = 1;
5547        _exceptionType = "java/lang/IllegalArgumentException";
5548        _exceptionMessage = "params == null";
5549        goto exit;
5550    }
5551    if (offset < 0) {
5552        _exception = 1;
5553        _exceptionType = "java/lang/IllegalArgumentException";
5554        _exceptionMessage = "offset < 0";
5555        goto exit;
5556    }
5557    _remaining = _env->GetArrayLength(params_ref) - offset;
5558    int _needed;
5559    switch (pname) {
5560#if defined(GL_TEXTURE_ENV_MODE)
5561        case GL_TEXTURE_ENV_MODE:
5562#endif // defined(GL_TEXTURE_ENV_MODE)
5563#if defined(GL_COMBINE_RGB)
5564        case GL_COMBINE_RGB:
5565#endif // defined(GL_COMBINE_RGB)
5566#if defined(GL_COMBINE_ALPHA)
5567        case GL_COMBINE_ALPHA:
5568#endif // defined(GL_COMBINE_ALPHA)
5569            _needed = 1;
5570            break;
5571#if defined(GL_TEXTURE_ENV_COLOR)
5572        case GL_TEXTURE_ENV_COLOR:
5573#endif // defined(GL_TEXTURE_ENV_COLOR)
5574            _needed = 4;
5575            break;
5576        default:
5577            _needed = 1;
5578            break;
5579    }
5580    if (_remaining < _needed) {
5581        _exception = 1;
5582        _exceptionType = "java/lang/IllegalArgumentException";
5583        _exceptionMessage = "length - offset < needed";
5584        goto exit;
5585    }
5586    params_base = (GLint *)
5587        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
5588    params = params_base + offset;
5589
5590    glGetTexEnviv(
5591        (GLenum)env,
5592        (GLenum)pname,
5593        (GLint *)params
5594    );
5595
5596exit:
5597    if (params_base) {
5598        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
5599            _exception ? JNI_ABORT: 0);
5600    }
5601    if (_exception) {
5602        jniThrowException(_env, _exceptionType, _exceptionMessage);
5603    }
5604}
5605
5606/* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */
5607static void
5608android_glGetTexEnviv__IILjava_nio_IntBuffer_2
5609  (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
5610    jint _exception = 0;
5611    const char * _exceptionType = NULL;
5612    const char * _exceptionMessage = NULL;
5613    jarray _array = (jarray) 0;
5614    jint _bufferOffset = (jint) 0;
5615    jint _remaining;
5616    GLint *params = (GLint *) 0;
5617
5618    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
5619    int _needed;
5620    switch (pname) {
5621#if defined(GL_TEXTURE_ENV_MODE)
5622        case GL_TEXTURE_ENV_MODE:
5623#endif // defined(GL_TEXTURE_ENV_MODE)
5624#if defined(GL_COMBINE_RGB)
5625        case GL_COMBINE_RGB:
5626#endif // defined(GL_COMBINE_RGB)
5627#if defined(GL_COMBINE_ALPHA)
5628        case GL_COMBINE_ALPHA:
5629#endif // defined(GL_COMBINE_ALPHA)
5630            _needed = 1;
5631            break;
5632#if defined(GL_TEXTURE_ENV_COLOR)
5633        case GL_TEXTURE_ENV_COLOR:
5634#endif // defined(GL_TEXTURE_ENV_COLOR)
5635            _needed = 4;
5636            break;
5637        default:
5638            _needed = 1;
5639            break;
5640    }
5641    if (_remaining < _needed) {