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