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