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