android_opengl_GLES20.cpp revision 76f6a86de25e1bf74717e047e55fd44b089673f3
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 <GLES2/gl2.h>
25#include <GLES2/gl2ext.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_2_0
276    // GLES 2.x pnames
277    switch (pname) {
278        case GL_ALIASED_LINE_WIDTH_RANGE:
279        case GL_ALIASED_POINT_SIZE_RANGE:
280            needed = 2;
281            break;
282
283        case GL_BLEND_COLOR:
284        case GL_COLOR_CLEAR_VALUE:
285        case GL_COLOR_WRITEMASK:
286        case GL_SCISSOR_BOX:
287        case GL_VIEWPORT:
288            needed = 4;
289            break;
290
291        case GL_COMPRESSED_TEXTURE_FORMATS:
292            glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
293            break;
294
295        case GL_SHADER_BINARY_FORMATS:
296            glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed);
297            break;
298    }
299#endif
300
301#ifdef GL_VERSION_ES_CM_1_1
302    // GLES 1.x pnames
303    switch (pname) {
304        case GL_ALIASED_LINE_WIDTH_RANGE:
305        case GL_ALIASED_POINT_SIZE_RANGE:
306        case GL_DEPTH_RANGE:
307        case GL_SMOOTH_LINE_WIDTH_RANGE:
308        case GL_SMOOTH_POINT_SIZE_RANGE:
309            needed = 2;
310            break;
311
312        case GL_CURRENT_NORMAL:
313        case GL_POINT_DISTANCE_ATTENUATION:
314            needed = 3;
315            break;
316
317        case GL_COLOR_CLEAR_VALUE:
318        case GL_COLOR_WRITEMASK:
319        case GL_CURRENT_COLOR:
320        case GL_CURRENT_TEXTURE_COORDS:
321        case GL_FOG_COLOR:
322        case GL_LIGHT_MODEL_AMBIENT:
323        case GL_SCISSOR_BOX:
324        case GL_VIEWPORT:
325            needed = 4;
326            break;
327
328        case GL_MODELVIEW_MATRIX:
329        case GL_PROJECTION_MATRIX:
330        case GL_TEXTURE_MATRIX:
331            needed = 16;
332            break;
333
334        case GL_COMPRESSED_TEXTURE_FORMATS:
335            glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
336            break;
337    }
338#endif
339    return needed;
340}
341
342template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
343          typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
344static void
345get
346  (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
347    jint _exception = 0;
348    const char * _exceptionType;
349    const char * _exceptionMessage;
350    CTYPE *params_base = (CTYPE *) 0;
351    jint _remaining;
352    CTYPE *params = (CTYPE *) 0;
353    int _needed = 0;
354
355    if (!params_ref) {
356        _exception = 1;
357        _exceptionType = "java/lang/IllegalArgumentException";
358        _exceptionMessage = "params == null";
359        goto exit;
360    }
361    if (offset < 0) {
362        _exception = 1;
363        _exceptionType = "java/lang/IllegalArgumentException";
364        _exceptionMessage = "offset < 0";
365        goto exit;
366    }
367    _remaining = _env->GetArrayLength(params_ref) - offset;
368    _needed = getNeededCount(pname);
369    // if we didn't find this pname, we just assume the user passed
370    // an array of the right size -- this might happen with extensions
371    // or if we forget an enum here.
372    if (_remaining < _needed) {
373        _exception = 1;
374        _exceptionType = "java/lang/IllegalArgumentException";
375        _exceptionMessage = "length - offset < needed";
376        goto exit;
377    }
378    params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
379        _env, params_ref, (jboolean *)0);
380    params = params_base + offset;
381
382    GET(
383        (GLenum)pname,
384        (CTYPE *)params
385    );
386
387exit:
388    if (params_base) {
389        releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
390            _env, params_ref, params_base, !_exception);
391    }
392    if (_exception) {
393        jniThrowException(_env, _exceptionType, _exceptionMessage);
394    }
395}
396
397
398template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
399          typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
400static void
401getarray
402  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
403    jint _exception = 0;
404    const char * _exceptionType;
405    const char * _exceptionMessage;
406    JTYPEARRAY _array = (JTYPEARRAY) 0;
407    jint _bufferOffset = (jint) 0;
408    jint _remaining;
409    CTYPE *params = (CTYPE *) 0;
410    int _needed = 0;
411
412    params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
413    _remaining /= sizeof(CTYPE);    // convert from bytes to item count
414    _needed = getNeededCount(pname);
415    // if we didn't find this pname, we just assume the user passed
416    // an array of the right size -- this might happen with extensions
417    // or if we forget an enum here.
418    if (_needed>0 && _remaining < _needed) {
419        _exception = 1;
420        _exceptionType = "java/lang/IllegalArgumentException";
421        _exceptionMessage = "remaining() < needed";
422        goto exit;
423    }
424    if (params == NULL) {
425        char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
426            _env, _array, (jboolean *) 0);
427        params = (CTYPE *) (_paramsBase + _bufferOffset);
428    }
429    GET(
430        (GLenum)pname,
431        (CTYPE *)params
432    );
433
434exit:
435    if (_array) {
436        releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
437            _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
438    }
439    if (_exception) {
440        jniThrowException(_env, _exceptionType, _exceptionMessage);
441    }
442}
443
444// --------------------------------------------------------------------------
445/* void glActiveTexture ( GLenum texture ) */
446static void
447android_glActiveTexture__I
448  (JNIEnv *_env, jobject _this, jint texture) {
449    glActiveTexture(
450        (GLenum)texture
451    );
452}
453
454/* void glAttachShader ( GLuint program, GLuint shader ) */
455static void
456android_glAttachShader__II
457  (JNIEnv *_env, jobject _this, jint program, jint shader) {
458    glAttachShader(
459        (GLuint)program,
460        (GLuint)shader
461    );
462}
463
464/* void glBindAttribLocation ( GLuint program, GLuint index, const char *name ) */
465static void
466android_glBindAttribLocation__IILjava_lang_String_2
467  (JNIEnv *_env, jobject _this, jint program, jint index, jstring name) {
468    jint _exception = 0;
469    const char * _exceptionType = NULL;
470    const char * _exceptionMessage = NULL;
471    const char* _nativename = 0;
472
473    if (!name) {
474        _exception = 1;
475        _exceptionType = "java/lang/IllegalArgumentException";
476        _exceptionMessage = "name == null";
477        goto exit;
478    }
479    _nativename = _env->GetStringUTFChars(name, 0);
480
481    glBindAttribLocation(
482        (GLuint)program,
483        (GLuint)index,
484        (char *)_nativename
485    );
486
487exit:
488    if (_nativename) {
489        _env->ReleaseStringUTFChars(name, _nativename);
490    }
491
492    if (_exception) {
493        jniThrowException(_env, _exceptionType, _exceptionMessage);
494    }
495}
496
497/* void glBindBuffer ( GLenum target, GLuint buffer ) */
498static void
499android_glBindBuffer__II
500  (JNIEnv *_env, jobject _this, jint target, jint buffer) {
501    glBindBuffer(
502        (GLenum)target,
503        (GLuint)buffer
504    );
505}
506
507/* void glBindFramebuffer ( GLenum target, GLuint framebuffer ) */
508static void
509android_glBindFramebuffer__II
510  (JNIEnv *_env, jobject _this, jint target, jint framebuffer) {
511    glBindFramebuffer(
512        (GLenum)target,
513        (GLuint)framebuffer
514    );
515}
516
517/* void glBindRenderbuffer ( GLenum target, GLuint renderbuffer ) */
518static void
519android_glBindRenderbuffer__II
520  (JNIEnv *_env, jobject _this, jint target, jint renderbuffer) {
521    glBindRenderbuffer(
522        (GLenum)target,
523        (GLuint)renderbuffer
524    );
525}
526
527/* void glBindTexture ( GLenum target, GLuint texture ) */
528static void
529android_glBindTexture__II
530  (JNIEnv *_env, jobject _this, jint target, jint texture) {
531    glBindTexture(
532        (GLenum)target,
533        (GLuint)texture
534    );
535}
536
537/* void glBlendColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
538static void
539android_glBlendColor__FFFF
540  (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
541    glBlendColor(
542        (GLclampf)red,
543        (GLclampf)green,
544        (GLclampf)blue,
545        (GLclampf)alpha
546    );
547}
548
549/* void glBlendEquation ( GLenum mode ) */
550static void
551android_glBlendEquation__I
552  (JNIEnv *_env, jobject _this, jint mode) {
553    glBlendEquation(
554        (GLenum)mode
555    );
556}
557
558/* void glBlendEquationSeparate ( GLenum modeRGB, GLenum modeAlpha ) */
559static void
560android_glBlendEquationSeparate__II
561  (JNIEnv *_env, jobject _this, jint modeRGB, jint modeAlpha) {
562    glBlendEquationSeparate(
563        (GLenum)modeRGB,
564        (GLenum)modeAlpha
565    );
566}
567
568/* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */
569static void
570android_glBlendFunc__II
571  (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) {
572    glBlendFunc(
573        (GLenum)sfactor,
574        (GLenum)dfactor
575    );
576}
577
578/* void glBlendFuncSeparate ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) */
579static void
580android_glBlendFuncSeparate__IIII
581  (JNIEnv *_env, jobject _this, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) {
582    glBlendFuncSeparate(
583        (GLenum)srcRGB,
584        (GLenum)dstRGB,
585        (GLenum)srcAlpha,
586        (GLenum)dstAlpha
587    );
588}
589
590/* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */
591static void
592android_glBufferData__IILjava_nio_Buffer_2I
593  (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) {
594    jint _exception = 0;
595    const char * _exceptionType = NULL;
596    const char * _exceptionMessage = NULL;
597    jarray _array = (jarray) 0;
598    jint _bufferOffset = (jint) 0;
599    jint _remaining;
600    GLvoid *data = (GLvoid *) 0;
601
602    if (data_buf) {
603        data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
604        if (_remaining < size) {
605            _exception = 1;
606            _exceptionType = "java/lang/IllegalArgumentException";
607            _exceptionMessage = "remaining() < size < needed";
608            goto exit;
609        }
610    }
611    if (data_buf && data == NULL) {
612        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
613        data = (GLvoid *) (_dataBase + _bufferOffset);
614    }
615    glBufferData(
616        (GLenum)target,
617        (GLsizeiptr)size,
618        (GLvoid *)data,
619        (GLenum)usage
620    );
621
622exit:
623    if (_array) {
624        releasePointer(_env, _array, data, JNI_FALSE);
625    }
626    if (_exception) {
627        jniThrowException(_env, _exceptionType, _exceptionMessage);
628    }
629}
630
631/* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */
632static void
633android_glBufferSubData__IIILjava_nio_Buffer_2
634  (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) {
635    jint _exception = 0;
636    const char * _exceptionType = NULL;
637    const char * _exceptionMessage = NULL;
638    jarray _array = (jarray) 0;
639    jint _bufferOffset = (jint) 0;
640    jint _remaining;
641    GLvoid *data = (GLvoid *) 0;
642
643    data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
644    if (_remaining < size) {
645        _exception = 1;
646        _exceptionType = "java/lang/IllegalArgumentException";
647        _exceptionMessage = "remaining() < size < needed";
648        goto exit;
649    }
650    if (data == NULL) {
651        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
652        data = (GLvoid *) (_dataBase + _bufferOffset);
653    }
654    glBufferSubData(
655        (GLenum)target,
656        (GLintptr)offset,
657        (GLsizeiptr)size,
658        (GLvoid *)data
659    );
660
661exit:
662    if (_array) {
663        releasePointer(_env, _array, data, JNI_FALSE);
664    }
665    if (_exception) {
666        jniThrowException(_env, _exceptionType, _exceptionMessage);
667    }
668}
669
670/* GLenum glCheckFramebufferStatus ( GLenum target ) */
671static jint
672android_glCheckFramebufferStatus__I
673  (JNIEnv *_env, jobject _this, jint target) {
674    GLenum _returnValue;
675    _returnValue = glCheckFramebufferStatus(
676        (GLenum)target
677    );
678    return (jint)_returnValue;
679}
680
681/* void glClear ( GLbitfield mask ) */
682static void
683android_glClear__I
684  (JNIEnv *_env, jobject _this, jint mask) {
685    glClear(
686        (GLbitfield)mask
687    );
688}
689
690/* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
691static void
692android_glClearColor__FFFF
693  (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
694    glClearColor(
695        (GLclampf)red,
696        (GLclampf)green,
697        (GLclampf)blue,
698        (GLclampf)alpha
699    );
700}
701
702/* void glClearDepthf ( GLclampf depth ) */
703static void
704android_glClearDepthf__F
705  (JNIEnv *_env, jobject _this, jfloat depth) {
706    glClearDepthf(
707        (GLclampf)depth
708    );
709}
710
711/* void glClearStencil ( GLint s ) */
712static void
713android_glClearStencil__I
714  (JNIEnv *_env, jobject _this, jint s) {
715    glClearStencil(
716        (GLint)s
717    );
718}
719
720/* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */
721static void
722android_glColorMask__ZZZZ
723  (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) {
724    glColorMask(
725        (GLboolean)red,
726        (GLboolean)green,
727        (GLboolean)blue,
728        (GLboolean)alpha
729    );
730}
731
732/* void glCompileShader ( GLuint shader ) */
733static void
734android_glCompileShader__I
735  (JNIEnv *_env, jobject _this, jint shader) {
736    glCompileShader(
737        (GLuint)shader
738    );
739}
740
741/* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */
742static void
743android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2
744  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) {
745    jarray _array = (jarray) 0;
746    jint _bufferOffset = (jint) 0;
747    jint _remaining;
748    GLvoid *data = (GLvoid *) 0;
749
750    data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
751    if (data == NULL) {
752        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
753        data = (GLvoid *) (_dataBase + _bufferOffset);
754    }
755    glCompressedTexImage2D(
756        (GLenum)target,
757        (GLint)level,
758        (GLenum)internalformat,
759        (GLsizei)width,
760        (GLsizei)height,
761        (GLint)border,
762        (GLsizei)imageSize,
763        (GLvoid *)data
764    );
765    if (_array) {
766        releasePointer(_env, _array, data, JNI_FALSE);
767    }
768}
769
770/* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */
771static void
772android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
773  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) {
774    jarray _array = (jarray) 0;
775    jint _bufferOffset = (jint) 0;
776    jint _remaining;
777    GLvoid *data = (GLvoid *) 0;
778
779    data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
780    if (data == NULL) {
781        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
782        data = (GLvoid *) (_dataBase + _bufferOffset);
783    }
784    glCompressedTexSubImage2D(
785        (GLenum)target,
786        (GLint)level,
787        (GLint)xoffset,
788        (GLint)yoffset,
789        (GLsizei)width,
790        (GLsizei)height,
791        (GLenum)format,
792        (GLsizei)imageSize,
793        (GLvoid *)data
794    );
795    if (_array) {
796        releasePointer(_env, _array, data, JNI_FALSE);
797    }
798}
799
800/* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */
801static void
802android_glCopyTexImage2D__IIIIIIII
803  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) {
804    glCopyTexImage2D(
805        (GLenum)target,
806        (GLint)level,
807        (GLenum)internalformat,
808        (GLint)x,
809        (GLint)y,
810        (GLsizei)width,
811        (GLsizei)height,
812        (GLint)border
813    );
814}
815
816/* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */
817static void
818android_glCopyTexSubImage2D__IIIIIIII
819  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) {
820    glCopyTexSubImage2D(
821        (GLenum)target,
822        (GLint)level,
823        (GLint)xoffset,
824        (GLint)yoffset,
825        (GLint)x,
826        (GLint)y,
827        (GLsizei)width,
828        (GLsizei)height
829    );
830}
831
832/* GLuint glCreateProgram ( void ) */
833static jint
834android_glCreateProgram__
835  (JNIEnv *_env, jobject _this) {
836    GLuint _returnValue;
837    _returnValue = glCreateProgram();
838    return (jint)_returnValue;
839}
840
841/* GLuint glCreateShader ( GLenum type ) */
842static jint
843android_glCreateShader__I
844  (JNIEnv *_env, jobject _this, jint type) {
845    GLuint _returnValue;
846    _returnValue = glCreateShader(
847        (GLenum)type
848    );
849    return (jint)_returnValue;
850}
851
852/* void glCullFace ( GLenum mode ) */
853static void
854android_glCullFace__I
855  (JNIEnv *_env, jobject _this, jint mode) {
856    glCullFace(
857        (GLenum)mode
858    );
859}
860
861/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
862static void
863android_glDeleteBuffers__I_3II
864  (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
865    jint _exception = 0;
866    const char * _exceptionType = NULL;
867    const char * _exceptionMessage = NULL;
868    GLuint *buffers_base = (GLuint *) 0;
869    jint _remaining;
870    GLuint *buffers = (GLuint *) 0;
871
872    if (!buffers_ref) {
873        _exception = 1;
874        _exceptionType = "java/lang/IllegalArgumentException";
875        _exceptionMessage = "buffers == null";
876        goto exit;
877    }
878    if (offset < 0) {
879        _exception = 1;
880        _exceptionType = "java/lang/IllegalArgumentException";
881        _exceptionMessage = "offset < 0";
882        goto exit;
883    }
884    _remaining = _env->GetArrayLength(buffers_ref) - offset;
885    if (_remaining < n) {
886        _exception = 1;
887        _exceptionType = "java/lang/IllegalArgumentException";
888        _exceptionMessage = "length - offset < n < needed";
889        goto exit;
890    }
891    buffers_base = (GLuint *)
892        _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
893    buffers = buffers_base + offset;
894
895    glDeleteBuffers(
896        (GLsizei)n,
897        (GLuint *)buffers
898    );
899
900exit:
901    if (buffers_base) {
902        _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
903            JNI_ABORT);
904    }
905    if (_exception) {
906        jniThrowException(_env, _exceptionType, _exceptionMessage);
907    }
908}
909
910/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
911static void
912android_glDeleteBuffers__ILjava_nio_IntBuffer_2
913  (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
914    jint _exception = 0;
915    const char * _exceptionType = NULL;
916    const char * _exceptionMessage = NULL;
917    jintArray _array = (jintArray) 0;
918    jint _bufferOffset = (jint) 0;
919    jint _remaining;
920    GLuint *buffers = (GLuint *) 0;
921
922    buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
923    if (_remaining < n) {
924        _exception = 1;
925        _exceptionType = "java/lang/IllegalArgumentException";
926        _exceptionMessage = "remaining() < n < needed";
927        goto exit;
928    }
929    if (buffers == NULL) {
930        char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
931        buffers = (GLuint *) (_buffersBase + _bufferOffset);
932    }
933    glDeleteBuffers(
934        (GLsizei)n,
935        (GLuint *)buffers
936    );
937
938exit:
939    if (_array) {
940        _env->ReleaseIntArrayElements(_array, (jint*)buffers, JNI_ABORT);
941    }
942    if (_exception) {
943        jniThrowException(_env, _exceptionType, _exceptionMessage);
944    }
945}
946
947/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */
948static void
949android_glDeleteFramebuffers__I_3II
950  (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
951    jint _exception = 0;
952    const char * _exceptionType = NULL;
953    const char * _exceptionMessage = NULL;
954    GLuint *framebuffers_base = (GLuint *) 0;
955    jint _remaining;
956    GLuint *framebuffers = (GLuint *) 0;
957
958    if (!framebuffers_ref) {
959        _exception = 1;
960        _exceptionType = "java/lang/IllegalArgumentException";
961        _exceptionMessage = "framebuffers == null";
962        goto exit;
963    }
964    if (offset < 0) {
965        _exception = 1;
966        _exceptionType = "java/lang/IllegalArgumentException";
967        _exceptionMessage = "offset < 0";
968        goto exit;
969    }
970    _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
971    if (_remaining < n) {
972        _exception = 1;
973        _exceptionType = "java/lang/IllegalArgumentException";
974        _exceptionMessage = "length - offset < n < needed";
975        goto exit;
976    }
977    framebuffers_base = (GLuint *)
978        _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0);
979    framebuffers = framebuffers_base + offset;
980
981    glDeleteFramebuffers(
982        (GLsizei)n,
983        (GLuint *)framebuffers
984    );
985
986exit:
987    if (framebuffers_base) {
988        _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base,
989            JNI_ABORT);
990    }
991    if (_exception) {
992        jniThrowException(_env, _exceptionType, _exceptionMessage);
993    }
994}
995
996/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */
997static void
998android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2
999  (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
1000    jint _exception = 0;
1001    const char * _exceptionType = NULL;
1002    const char * _exceptionMessage = NULL;
1003    jintArray _array = (jintArray) 0;
1004    jint _bufferOffset = (jint) 0;
1005    jint _remaining;
1006    GLuint *framebuffers = (GLuint *) 0;
1007
1008    framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1009    if (_remaining < n) {
1010        _exception = 1;
1011        _exceptionType = "java/lang/IllegalArgumentException";
1012        _exceptionMessage = "remaining() < n < needed";
1013        goto exit;
1014    }
1015    if (framebuffers == NULL) {
1016        char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1017        framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
1018    }
1019    glDeleteFramebuffers(
1020        (GLsizei)n,
1021        (GLuint *)framebuffers
1022    );
1023
1024exit:
1025    if (_array) {
1026        _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, JNI_ABORT);
1027    }
1028    if (_exception) {
1029        jniThrowException(_env, _exceptionType, _exceptionMessage);
1030    }
1031}
1032
1033/* void glDeleteProgram ( GLuint program ) */
1034static void
1035android_glDeleteProgram__I
1036  (JNIEnv *_env, jobject _this, jint program) {
1037    glDeleteProgram(
1038        (GLuint)program
1039    );
1040}
1041
1042/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */
1043static void
1044android_glDeleteRenderbuffers__I_3II
1045  (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
1046    jint _exception = 0;
1047    const char * _exceptionType = NULL;
1048    const char * _exceptionMessage = NULL;
1049    GLuint *renderbuffers_base = (GLuint *) 0;
1050    jint _remaining;
1051    GLuint *renderbuffers = (GLuint *) 0;
1052
1053    if (!renderbuffers_ref) {
1054        _exception = 1;
1055        _exceptionType = "java/lang/IllegalArgumentException";
1056        _exceptionMessage = "renderbuffers == null";
1057        goto exit;
1058    }
1059    if (offset < 0) {
1060        _exception = 1;
1061        _exceptionType = "java/lang/IllegalArgumentException";
1062        _exceptionMessage = "offset < 0";
1063        goto exit;
1064    }
1065    _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
1066    if (_remaining < n) {
1067        _exception = 1;
1068        _exceptionType = "java/lang/IllegalArgumentException";
1069        _exceptionMessage = "length - offset < n < needed";
1070        goto exit;
1071    }
1072    renderbuffers_base = (GLuint *)
1073        _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0);
1074    renderbuffers = renderbuffers_base + offset;
1075
1076    glDeleteRenderbuffers(
1077        (GLsizei)n,
1078        (GLuint *)renderbuffers
1079    );
1080
1081exit:
1082    if (renderbuffers_base) {
1083        _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base,
1084            JNI_ABORT);
1085    }
1086    if (_exception) {
1087        jniThrowException(_env, _exceptionType, _exceptionMessage);
1088    }
1089}
1090
1091/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */
1092static void
1093android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2
1094  (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
1095    jint _exception = 0;
1096    const char * _exceptionType = NULL;
1097    const char * _exceptionMessage = NULL;
1098    jintArray _array = (jintArray) 0;
1099    jint _bufferOffset = (jint) 0;
1100    jint _remaining;
1101    GLuint *renderbuffers = (GLuint *) 0;
1102
1103    renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1104    if (_remaining < n) {
1105        _exception = 1;
1106        _exceptionType = "java/lang/IllegalArgumentException";
1107        _exceptionMessage = "remaining() < n < needed";
1108        goto exit;
1109    }
1110    if (renderbuffers == NULL) {
1111        char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1112        renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
1113    }
1114    glDeleteRenderbuffers(
1115        (GLsizei)n,
1116        (GLuint *)renderbuffers
1117    );
1118
1119exit:
1120    if (_array) {
1121        _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, JNI_ABORT);
1122    }
1123    if (_exception) {
1124        jniThrowException(_env, _exceptionType, _exceptionMessage);
1125    }
1126}
1127
1128/* void glDeleteShader ( GLuint shader ) */
1129static void
1130android_glDeleteShader__I
1131  (JNIEnv *_env, jobject _this, jint shader) {
1132    glDeleteShader(
1133        (GLuint)shader
1134    );
1135}
1136
1137/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
1138static void
1139android_glDeleteTextures__I_3II
1140  (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
1141    jint _exception = 0;
1142    const char * _exceptionType = NULL;
1143    const char * _exceptionMessage = NULL;
1144    GLuint *textures_base = (GLuint *) 0;
1145    jint _remaining;
1146    GLuint *textures = (GLuint *) 0;
1147
1148    if (!textures_ref) {
1149        _exception = 1;
1150        _exceptionType = "java/lang/IllegalArgumentException";
1151        _exceptionMessage = "textures == null";
1152        goto exit;
1153    }
1154    if (offset < 0) {
1155        _exception = 1;
1156        _exceptionType = "java/lang/IllegalArgumentException";
1157        _exceptionMessage = "offset < 0";
1158        goto exit;
1159    }
1160    _remaining = _env->GetArrayLength(textures_ref) - offset;
1161    if (_remaining < n) {
1162        _exception = 1;
1163        _exceptionType = "java/lang/IllegalArgumentException";
1164        _exceptionMessage = "length - offset < n < needed";
1165        goto exit;
1166    }
1167    textures_base = (GLuint *)
1168        _env->GetIntArrayElements(textures_ref, (jboolean *)0);
1169    textures = textures_base + offset;
1170
1171    glDeleteTextures(
1172        (GLsizei)n,
1173        (GLuint *)textures
1174    );
1175
1176exit:
1177    if (textures_base) {
1178        _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base,
1179            JNI_ABORT);
1180    }
1181    if (_exception) {
1182        jniThrowException(_env, _exceptionType, _exceptionMessage);
1183    }
1184}
1185
1186/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
1187static void
1188android_glDeleteTextures__ILjava_nio_IntBuffer_2
1189  (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
1190    jint _exception = 0;
1191    const char * _exceptionType = NULL;
1192    const char * _exceptionMessage = NULL;
1193    jintArray _array = (jintArray) 0;
1194    jint _bufferOffset = (jint) 0;
1195    jint _remaining;
1196    GLuint *textures = (GLuint *) 0;
1197
1198    textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1199    if (_remaining < n) {
1200        _exception = 1;
1201        _exceptionType = "java/lang/IllegalArgumentException";
1202        _exceptionMessage = "remaining() < n < needed";
1203        goto exit;
1204    }
1205    if (textures == NULL) {
1206        char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1207        textures = (GLuint *) (_texturesBase + _bufferOffset);
1208    }
1209    glDeleteTextures(
1210        (GLsizei)n,
1211        (GLuint *)textures
1212    );
1213
1214exit:
1215    if (_array) {
1216        _env->ReleaseIntArrayElements(_array, (jint*)textures, JNI_ABORT);
1217    }
1218    if (_exception) {
1219        jniThrowException(_env, _exceptionType, _exceptionMessage);
1220    }
1221}
1222
1223/* void glDepthFunc ( GLenum func ) */
1224static void
1225android_glDepthFunc__I
1226  (JNIEnv *_env, jobject _this, jint func) {
1227    glDepthFunc(
1228        (GLenum)func
1229    );
1230}
1231
1232/* void glDepthMask ( GLboolean flag ) */
1233static void
1234android_glDepthMask__Z
1235  (JNIEnv *_env, jobject _this, jboolean flag) {
1236    glDepthMask(
1237        (GLboolean)flag
1238    );
1239}
1240
1241/* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */
1242static void
1243android_glDepthRangef__FF
1244  (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) {
1245    glDepthRangef(
1246        (GLclampf)zNear,
1247        (GLclampf)zFar
1248    );
1249}
1250
1251/* void glDetachShader ( GLuint program, GLuint shader ) */
1252static void
1253android_glDetachShader__II
1254  (JNIEnv *_env, jobject _this, jint program, jint shader) {
1255    glDetachShader(
1256        (GLuint)program,
1257        (GLuint)shader
1258    );
1259}
1260
1261/* void glDisable ( GLenum cap ) */
1262static void
1263android_glDisable__I
1264  (JNIEnv *_env, jobject _this, jint cap) {
1265    glDisable(
1266        (GLenum)cap
1267    );
1268}
1269
1270/* void glDisableVertexAttribArray ( GLuint index ) */
1271static void
1272android_glDisableVertexAttribArray__I
1273  (JNIEnv *_env, jobject _this, jint index) {
1274    glDisableVertexAttribArray(
1275        (GLuint)index
1276    );
1277}
1278
1279/* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */
1280static void
1281android_glDrawArrays__III
1282  (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) {
1283    glDrawArrays(
1284        (GLenum)mode,
1285        (GLint)first,
1286        (GLsizei)count
1287    );
1288}
1289
1290/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */
1291static void
1292android_glDrawElements__IIII
1293  (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) {
1294    jint _exception = 0;
1295    const char * _exceptionType = NULL;
1296    const char * _exceptionMessage = NULL;
1297    glDrawElements(
1298        (GLenum)mode,
1299        (GLsizei)count,
1300        (GLenum)type,
1301        reinterpret_cast<GLvoid *>(offset)
1302    );
1303    if (_exception) {
1304        jniThrowException(_env, _exceptionType, _exceptionMessage);
1305    }
1306}
1307
1308/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */
1309static void
1310android_glDrawElements__IIILjava_nio_Buffer_2
1311  (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) {
1312    jint _exception = 0;
1313    const char * _exceptionType = NULL;
1314    const char * _exceptionMessage = NULL;
1315    jarray _array = (jarray) 0;
1316    jint _bufferOffset = (jint) 0;
1317    jint _remaining;
1318    GLvoid *indices = (GLvoid *) 0;
1319
1320    indices = (GLvoid *)getPointer(_env, indices_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1321    if (_remaining < count) {
1322        _exception = 1;
1323        _exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
1324        _exceptionMessage = "remaining() < count < needed";
1325        goto exit;
1326    }
1327    if (indices == NULL) {
1328        char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1329        indices = (GLvoid *) (_indicesBase + _bufferOffset);
1330    }
1331    glDrawElements(
1332        (GLenum)mode,
1333        (GLsizei)count,
1334        (GLenum)type,
1335        (GLvoid *)indices
1336    );
1337
1338exit:
1339    if (_array) {
1340        releasePointer(_env, _array, indices, JNI_FALSE);
1341    }
1342    if (_exception) {
1343        jniThrowException(_env, _exceptionType, _exceptionMessage);
1344    }
1345}
1346
1347/* void glEnable ( GLenum cap ) */
1348static void
1349android_glEnable__I
1350  (JNIEnv *_env, jobject _this, jint cap) {
1351    glEnable(
1352        (GLenum)cap
1353    );
1354}
1355
1356/* void glEnableVertexAttribArray ( GLuint index ) */
1357static void
1358android_glEnableVertexAttribArray__I
1359  (JNIEnv *_env, jobject _this, jint index) {
1360    glEnableVertexAttribArray(
1361        (GLuint)index
1362    );
1363}
1364
1365/* void glFinish ( void ) */
1366static void
1367android_glFinish__
1368  (JNIEnv *_env, jobject _this) {
1369    glFinish();
1370}
1371
1372/* void glFlush ( void ) */
1373static void
1374android_glFlush__
1375  (JNIEnv *_env, jobject _this) {
1376    glFlush();
1377}
1378
1379/* void glFramebufferRenderbuffer ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) */
1380static void
1381android_glFramebufferRenderbuffer__IIII
1382  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint renderbuffertarget, jint renderbuffer) {
1383    glFramebufferRenderbuffer(
1384        (GLenum)target,
1385        (GLenum)attachment,
1386        (GLenum)renderbuffertarget,
1387        (GLuint)renderbuffer
1388    );
1389}
1390
1391/* void glFramebufferTexture2D ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) */
1392static void
1393android_glFramebufferTexture2D__IIIII
1394  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint textarget, jint texture, jint level) {
1395    glFramebufferTexture2D(
1396        (GLenum)target,
1397        (GLenum)attachment,
1398        (GLenum)textarget,
1399        (GLuint)texture,
1400        (GLint)level
1401    );
1402}
1403
1404/* void glFrontFace ( GLenum mode ) */
1405static void
1406android_glFrontFace__I
1407  (JNIEnv *_env, jobject _this, jint mode) {
1408    glFrontFace(
1409        (GLenum)mode
1410    );
1411}
1412
1413/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
1414static void
1415android_glGenBuffers__I_3II
1416  (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
1417    jint _exception = 0;
1418    const char * _exceptionType = NULL;
1419    const char * _exceptionMessage = NULL;
1420    GLuint *buffers_base = (GLuint *) 0;
1421    jint _remaining;
1422    GLuint *buffers = (GLuint *) 0;
1423
1424    if (!buffers_ref) {
1425        _exception = 1;
1426        _exceptionType = "java/lang/IllegalArgumentException";
1427        _exceptionMessage = "buffers == null";
1428        goto exit;
1429    }
1430    if (offset < 0) {
1431        _exception = 1;
1432        _exceptionType = "java/lang/IllegalArgumentException";
1433        _exceptionMessage = "offset < 0";
1434        goto exit;
1435    }
1436    _remaining = _env->GetArrayLength(buffers_ref) - offset;
1437    if (_remaining < n) {
1438        _exception = 1;
1439        _exceptionType = "java/lang/IllegalArgumentException";
1440        _exceptionMessage = "length - offset < n < needed";
1441        goto exit;
1442    }
1443    buffers_base = (GLuint *)
1444        _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
1445    buffers = buffers_base + offset;
1446
1447    glGenBuffers(
1448        (GLsizei)n,
1449        (GLuint *)buffers
1450    );
1451
1452exit:
1453    if (buffers_base) {
1454        _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
1455            _exception ? JNI_ABORT: 0);
1456    }
1457    if (_exception) {
1458        jniThrowException(_env, _exceptionType, _exceptionMessage);
1459    }
1460}
1461
1462/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
1463static void
1464android_glGenBuffers__ILjava_nio_IntBuffer_2
1465  (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
1466    jint _exception = 0;
1467    const char * _exceptionType = NULL;
1468    const char * _exceptionMessage = NULL;
1469    jintArray _array = (jintArray) 0;
1470    jint _bufferOffset = (jint) 0;
1471    jint _remaining;
1472    GLuint *buffers = (GLuint *) 0;
1473
1474    buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1475    if (_remaining < n) {
1476        _exception = 1;
1477        _exceptionType = "java/lang/IllegalArgumentException";
1478        _exceptionMessage = "remaining() < n < needed";
1479        goto exit;
1480    }
1481    if (buffers == NULL) {
1482        char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1483        buffers = (GLuint *) (_buffersBase + _bufferOffset);
1484    }
1485    glGenBuffers(
1486        (GLsizei)n,
1487        (GLuint *)buffers
1488    );
1489
1490exit:
1491    if (_array) {
1492        _env->ReleaseIntArrayElements(_array, (jint*)buffers, _exception ? JNI_ABORT : 0);
1493    }
1494    if (_exception) {
1495        jniThrowException(_env, _exceptionType, _exceptionMessage);
1496    }
1497}
1498
1499/* void glGenerateMipmap ( GLenum target ) */
1500static void
1501android_glGenerateMipmap__I
1502  (JNIEnv *_env, jobject _this, jint target) {
1503    glGenerateMipmap(
1504        (GLenum)target
1505    );
1506}
1507
1508/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */
1509static void
1510android_glGenFramebuffers__I_3II
1511  (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
1512    jint _exception = 0;
1513    const char * _exceptionType = NULL;
1514    const char * _exceptionMessage = NULL;
1515    GLuint *framebuffers_base = (GLuint *) 0;
1516    jint _remaining;
1517    GLuint *framebuffers = (GLuint *) 0;
1518
1519    if (!framebuffers_ref) {
1520        _exception = 1;
1521        _exceptionType = "java/lang/IllegalArgumentException";
1522        _exceptionMessage = "framebuffers == null";
1523        goto exit;
1524    }
1525    if (offset < 0) {
1526        _exception = 1;
1527        _exceptionType = "java/lang/IllegalArgumentException";
1528        _exceptionMessage = "offset < 0";
1529        goto exit;
1530    }
1531    _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
1532    if (_remaining < n) {
1533        _exception = 1;
1534        _exceptionType = "java/lang/IllegalArgumentException";
1535        _exceptionMessage = "length - offset < n < needed";
1536        goto exit;
1537    }
1538    framebuffers_base = (GLuint *)
1539        _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0);
1540    framebuffers = framebuffers_base + offset;
1541
1542    glGenFramebuffers(
1543        (GLsizei)n,
1544        (GLuint *)framebuffers
1545    );
1546
1547exit:
1548    if (framebuffers_base) {
1549        _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base,
1550            _exception ? JNI_ABORT: 0);
1551    }
1552    if (_exception) {
1553        jniThrowException(_env, _exceptionType, _exceptionMessage);
1554    }
1555}
1556
1557/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */
1558static void
1559android_glGenFramebuffers__ILjava_nio_IntBuffer_2
1560  (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
1561    jint _exception = 0;
1562    const char * _exceptionType = NULL;
1563    const char * _exceptionMessage = NULL;
1564    jintArray _array = (jintArray) 0;
1565    jint _bufferOffset = (jint) 0;
1566    jint _remaining;
1567    GLuint *framebuffers = (GLuint *) 0;
1568
1569    framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1570    if (_remaining < n) {
1571        _exception = 1;
1572        _exceptionType = "java/lang/IllegalArgumentException";
1573        _exceptionMessage = "remaining() < n < needed";
1574        goto exit;
1575    }
1576    if (framebuffers == NULL) {
1577        char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1578        framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
1579    }
1580    glGenFramebuffers(
1581        (GLsizei)n,
1582        (GLuint *)framebuffers
1583    );
1584
1585exit:
1586    if (_array) {
1587        _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, _exception ? JNI_ABORT : 0);
1588    }
1589    if (_exception) {
1590        jniThrowException(_env, _exceptionType, _exceptionMessage);
1591    }
1592}
1593
1594/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */
1595static void
1596android_glGenRenderbuffers__I_3II
1597  (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
1598    jint _exception = 0;
1599    const char * _exceptionType = NULL;
1600    const char * _exceptionMessage = NULL;
1601    GLuint *renderbuffers_base = (GLuint *) 0;
1602    jint _remaining;
1603    GLuint *renderbuffers = (GLuint *) 0;
1604
1605    if (!renderbuffers_ref) {
1606        _exception = 1;
1607        _exceptionType = "java/lang/IllegalArgumentException";
1608        _exceptionMessage = "renderbuffers == null";
1609        goto exit;
1610    }
1611    if (offset < 0) {
1612        _exception = 1;
1613        _exceptionType = "java/lang/IllegalArgumentException";
1614        _exceptionMessage = "offset < 0";
1615        goto exit;
1616    }
1617    _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
1618    if (_remaining < n) {
1619        _exception = 1;
1620        _exceptionType = "java/lang/IllegalArgumentException";
1621        _exceptionMessage = "length - offset < n < needed";
1622        goto exit;
1623    }
1624    renderbuffers_base = (GLuint *)
1625        _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0);
1626    renderbuffers = renderbuffers_base + offset;
1627
1628    glGenRenderbuffers(
1629        (GLsizei)n,
1630        (GLuint *)renderbuffers
1631    );
1632
1633exit:
1634    if (renderbuffers_base) {
1635        _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base,
1636            _exception ? JNI_ABORT: 0);
1637    }
1638    if (_exception) {
1639        jniThrowException(_env, _exceptionType, _exceptionMessage);
1640    }
1641}
1642
1643/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */
1644static void
1645android_glGenRenderbuffers__ILjava_nio_IntBuffer_2
1646  (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
1647    jint _exception = 0;
1648    const char * _exceptionType = NULL;
1649    const char * _exceptionMessage = NULL;
1650    jintArray _array = (jintArray) 0;
1651    jint _bufferOffset = (jint) 0;
1652    jint _remaining;
1653    GLuint *renderbuffers = (GLuint *) 0;
1654
1655    renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1656    if (_remaining < n) {
1657        _exception = 1;
1658        _exceptionType = "java/lang/IllegalArgumentException";
1659        _exceptionMessage = "remaining() < n < needed";
1660        goto exit;
1661    }
1662    if (renderbuffers == NULL) {
1663        char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1664        renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
1665    }
1666    glGenRenderbuffers(
1667        (GLsizei)n,
1668        (GLuint *)renderbuffers
1669    );
1670
1671exit:
1672    if (_array) {
1673        _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, _exception ? JNI_ABORT : 0);
1674    }
1675    if (_exception) {
1676        jniThrowException(_env, _exceptionType, _exceptionMessage);
1677    }
1678}
1679
1680/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1681static void
1682android_glGenTextures__I_3II
1683  (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
1684    jint _exception = 0;
1685    const char * _exceptionType = NULL;
1686    const char * _exceptionMessage = NULL;
1687    GLuint *textures_base = (GLuint *) 0;
1688    jint _remaining;
1689    GLuint *textures = (GLuint *) 0;
1690
1691    if (!textures_ref) {
1692        _exception = 1;
1693        _exceptionType = "java/lang/IllegalArgumentException";
1694        _exceptionMessage = "textures == null";
1695        goto exit;
1696    }
1697    if (offset < 0) {
1698        _exception = 1;
1699        _exceptionType = "java/lang/IllegalArgumentException";
1700        _exceptionMessage = "offset < 0";
1701        goto exit;
1702    }
1703    _remaining = _env->GetArrayLength(textures_ref) - offset;
1704    if (_remaining < n) {
1705        _exception = 1;
1706        _exceptionType = "java/lang/IllegalArgumentException";
1707        _exceptionMessage = "length - offset < n < needed";
1708        goto exit;
1709    }
1710    textures_base = (GLuint *)
1711        _env->GetIntArrayElements(textures_ref, (jboolean *)0);
1712    textures = textures_base + offset;
1713
1714    glGenTextures(
1715        (GLsizei)n,
1716        (GLuint *)textures
1717    );
1718
1719exit:
1720    if (textures_base) {
1721        _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base,
1722            _exception ? JNI_ABORT: 0);
1723    }
1724    if (_exception) {
1725        jniThrowException(_env, _exceptionType, _exceptionMessage);
1726    }
1727}
1728
1729/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1730static void
1731android_glGenTextures__ILjava_nio_IntBuffer_2
1732  (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
1733    jint _exception = 0;
1734    const char * _exceptionType = NULL;
1735    const char * _exceptionMessage = NULL;
1736    jintArray _array = (jintArray) 0;
1737    jint _bufferOffset = (jint) 0;
1738    jint _remaining;
1739    GLuint *textures = (GLuint *) 0;
1740
1741    textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1742    if (_remaining < n) {
1743        _exception = 1;
1744        _exceptionType = "java/lang/IllegalArgumentException";
1745        _exceptionMessage = "remaining() < n < needed";
1746        goto exit;
1747    }
1748    if (textures == NULL) {
1749        char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1750        textures = (GLuint *) (_texturesBase + _bufferOffset);
1751    }
1752    glGenTextures(
1753        (GLsizei)n,
1754        (GLuint *)textures
1755    );
1756
1757exit:
1758    if (_array) {
1759        _env->ReleaseIntArrayElements(_array, (jint*)textures, _exception ? JNI_ABORT : 0);
1760    }
1761    if (_exception) {
1762        jniThrowException(_env, _exceptionType, _exceptionMessage);
1763    }
1764}
1765
1766/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1767static void
1768android_glGetActiveAttrib__III_3II_3II_3II_3BI
1769  (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jintArray length_ref, jint lengthOffset, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset, jbyteArray name_ref, jint nameOffset) {
1770    jint _exception = 0;
1771    const char * _exceptionType;
1772    const char * _exceptionMessage;
1773    GLsizei *length_base = (GLsizei *) 0;
1774    jint _lengthRemaining;
1775    GLsizei *length = (GLsizei *) 0;
1776    GLint *size_base = (GLint *) 0;
1777    jint _sizeRemaining;
1778    GLint *size = (GLint *) 0;
1779    GLenum *type_base = (GLenum *) 0;
1780    jint _typeRemaining;
1781    GLenum *type = (GLenum *) 0;
1782    char *name_base = (char *) 0;
1783    jint _nameRemaining;
1784    char *name = (char *) 0;
1785
1786    if (!length_ref) {
1787        _exception = 1;
1788        _exceptionType = "java/lang/IllegalArgumentException";
1789        _exceptionMessage = "length == null";
1790        goto exit;
1791    }
1792    if (lengthOffset < 0) {
1793        _exception = 1;
1794        _exceptionType = "java/lang/IllegalArgumentException";
1795        _exceptionMessage = "lengthOffset < 0";
1796        goto exit;
1797    }
1798    _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
1799    length_base = (GLsizei *)
1800        _env->GetIntArrayElements(length_ref, (jboolean *)0);
1801    length = length_base + lengthOffset;
1802
1803    if (!size_ref) {
1804        _exception = 1;
1805        _exceptionType = "java/lang/IllegalArgumentException";
1806        _exceptionMessage = "size == null";
1807        goto exit;
1808    }
1809    if (sizeOffset < 0) {
1810        _exception = 1;
1811        _exceptionType = "java/lang/IllegalArgumentException";
1812        _exceptionMessage = "sizeOffset < 0";
1813        goto exit;
1814    }
1815    _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
1816    size_base = (GLint *)
1817        _env->GetIntArrayElements(size_ref, (jboolean *)0);
1818    size = size_base + sizeOffset;
1819
1820    if (!type_ref) {
1821        _exception = 1;
1822        _exceptionType = "java/lang/IllegalArgumentException";
1823        _exceptionMessage = "type == null";
1824        goto exit;
1825    }
1826    if (typeOffset < 0) {
1827        _exception = 1;
1828        _exceptionType = "java/lang/IllegalArgumentException";
1829        _exceptionMessage = "typeOffset < 0";
1830        goto exit;
1831    }
1832    _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
1833    type_base = (GLenum *)
1834        _env->GetIntArrayElements(type_ref, (jboolean *)0);
1835    type = type_base + typeOffset;
1836
1837    if (!name_ref) {
1838        _exception = 1;
1839        _exceptionType = "java/lang/IllegalArgumentException";
1840        _exceptionMessage = "name == null";
1841        goto exit;
1842    }
1843    if (nameOffset < 0) {
1844        _exception = 1;
1845        _exceptionType = "java/lang/IllegalArgumentException";
1846        _exceptionMessage = "nameOffset < 0";
1847        goto exit;
1848    }
1849    _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
1850    name_base = (char *)
1851        _env->GetByteArrayElements(name_ref, (jboolean *)0);
1852    name = name_base + nameOffset;
1853
1854    glGetActiveAttrib(
1855        (GLuint)program,
1856        (GLuint)index,
1857        (GLsizei)bufsize,
1858        (GLsizei *)length,
1859        (GLint *)size,
1860        (GLenum *)type,
1861        (char *)name
1862    );
1863
1864exit:
1865    if (name_base) {
1866        _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
1867            _exception ? JNI_ABORT: 0);
1868    }
1869    if (type_base) {
1870        _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
1871            _exception ? JNI_ABORT: 0);
1872    }
1873    if (size_base) {
1874        _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
1875            _exception ? JNI_ABORT: 0);
1876    }
1877    if (length_base) {
1878        _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
1879            _exception ? JNI_ABORT: 0);
1880    }
1881    if (_exception) {
1882        jniThrowException(_env, _exceptionType, _exceptionMessage);
1883    }
1884}
1885
1886/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1887static void
1888android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
1889  (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
1890    jintArray _lengthArray = (jintArray) 0;
1891    jint _lengthBufferOffset = (jint) 0;
1892    jintArray _sizeArray = (jintArray) 0;
1893    jint _sizeBufferOffset = (jint) 0;
1894    jintArray _typeArray = (jintArray) 0;
1895    jint _typeBufferOffset = (jint) 0;
1896    jint _lengthRemaining;
1897    GLsizei *length = (GLsizei *) 0;
1898    jint _sizeRemaining;
1899    GLint *size = (GLint *) 0;
1900    jint _typeRemaining;
1901    GLenum *type = (GLenum *) 0;
1902
1903    length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
1904    size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
1905    type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
1906    if (length == NULL) {
1907        char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
1908        length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
1909    }
1910    if (size == NULL) {
1911        char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
1912        size = (GLint *) (_sizeBase + _sizeBufferOffset);
1913    }
1914    if (type == NULL) {
1915        char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
1916        type = (GLenum *) (_typeBase + _typeBufferOffset);
1917    }
1918    glGetActiveAttrib(
1919        (GLuint)program,
1920        (GLuint)index,
1921        (GLsizei)bufsize,
1922        (GLsizei *)length,
1923        (GLint *)size,
1924        (GLenum *)type,
1925        reinterpret_cast<char *>(name)
1926    );
1927    if (_typeArray) {
1928        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
1929    }
1930    if (_sizeArray) {
1931        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
1932    }
1933    if (_lengthArray) {
1934        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
1935    }
1936}
1937
1938/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1939static jstring
1940android_glGetActiveAttrib1
1941  (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
1942    jint _exception = 0;
1943    const char * _exceptionType;
1944    const char * _exceptionMessage;
1945    GLint *size_base = (GLint *) 0;
1946    jint _sizeRemaining;
1947    GLint *size = (GLint *) 0;
1948    GLenum *type_base = (GLenum *) 0;
1949    jint _typeRemaining;
1950    GLenum *type = (GLenum *) 0;
1951
1952    jstring result = 0;
1953
1954    GLint len = 0;
1955    glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
1956    if (!len) {
1957        return _env->NewStringUTF("");
1958    }
1959    char* buf = (char*) malloc(len);
1960
1961    if (buf == NULL) {
1962        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
1963        return NULL;
1964    }
1965    if (!size_ref) {
1966        _exception = 1;
1967        _exceptionType = "java/lang/IllegalArgumentException";
1968        _exceptionMessage = "size == null";
1969        goto exit;
1970    }
1971    if (sizeOffset < 0) {
1972        _exception = 1;
1973        _exceptionType = "java/lang/IllegalArgumentException";
1974        _exceptionMessage = "sizeOffset < 0";
1975        goto exit;
1976    }
1977    _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
1978    size_base = (GLint *)
1979        _env->GetIntArrayElements(size_ref, (jboolean *)0);
1980    size = size_base + sizeOffset;
1981
1982    if (!type_ref) {
1983        _exception = 1;
1984        _exceptionType = "java/lang/IllegalArgumentException";
1985        _exceptionMessage = "type == null";
1986        goto exit;
1987    }
1988    if (typeOffset < 0) {
1989        _exception = 1;
1990        _exceptionType = "java/lang/IllegalArgumentException";
1991        _exceptionMessage = "typeOffset < 0";
1992        goto exit;
1993    }
1994    _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
1995    type_base = (GLenum *)
1996        _env->GetIntArrayElements(type_ref, (jboolean *)0);
1997    type = type_base + typeOffset;
1998
1999    glGetActiveAttrib(
2000        (GLuint)program,
2001        (GLuint)index,
2002        (GLsizei)len,
2003        NULL,
2004        (GLint *)size,
2005        (GLenum *)type,
2006        (char *)buf
2007    );
2008exit:
2009    if (type_base) {
2010        _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
2011            _exception ? JNI_ABORT: 0);
2012    }
2013    if (size_base) {
2014        _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
2015            _exception ? JNI_ABORT: 0);
2016    }
2017    if (_exception != 1) {
2018        result = _env->NewStringUTF(buf);
2019    }
2020    if (buf) {
2021        free(buf);
2022    }
2023    if (_exception) {
2024        jniThrowException(_env, _exceptionType, _exceptionMessage);
2025    }
2026    if (result == 0) {
2027        result = _env->NewStringUTF("");
2028    }
2029
2030    return result;
2031}
2032
2033/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2034static jstring
2035android_glGetActiveAttrib2
2036  (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
2037    jintArray _sizeArray = (jintArray) 0;
2038    jint _sizeBufferOffset = (jint) 0;
2039    jintArray _typeArray = (jintArray) 0;
2040    jint _typeBufferOffset = (jint) 0;
2041    jint _lengthRemaining;
2042    GLsizei *length = (GLsizei *) 0;
2043    jint _sizeRemaining;
2044    GLint *size = (GLint *) 0;
2045    jint _typeRemaining;
2046    GLenum *type = (GLenum *) 0;
2047
2048    jstring result = 0;
2049
2050    GLint len = 0;
2051    glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
2052    if (!len) {
2053        return _env->NewStringUTF("");
2054    }
2055    char* buf = (char*) malloc(len);
2056
2057    if (buf == NULL) {
2058        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2059        return NULL;
2060    }
2061
2062    size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
2063    type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
2064    if (size == NULL) {
2065        char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
2066        size = (GLint *) (_sizeBase + _sizeBufferOffset);
2067    }
2068    if (type == NULL) {
2069        char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
2070        type = (GLenum *) (_typeBase + _typeBufferOffset);
2071    }
2072    glGetActiveAttrib(
2073        (GLuint)program,
2074        (GLuint)index,
2075        (GLsizei)len,
2076        NULL,
2077        (GLint *)size,
2078        (GLenum *)type,
2079        (char *)buf
2080    );
2081
2082    if (_typeArray) {
2083        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
2084    }
2085    if (_sizeArray) {
2086        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
2087    }
2088    result = _env->NewStringUTF(buf);
2089    if (buf) {
2090        free(buf);
2091    }
2092    return result;
2093}
2094/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2095static void
2096android_glGetActiveUniform__III_3II_3II_3II_3BI
2097  (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jintArray length_ref, jint lengthOffset, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset, jbyteArray name_ref, jint nameOffset) {
2098    jint _exception = 0;
2099    const char * _exceptionType;
2100    const char * _exceptionMessage;
2101    GLsizei *length_base = (GLsizei *) 0;
2102    jint _lengthRemaining;
2103    GLsizei *length = (GLsizei *) 0;
2104    GLint *size_base = (GLint *) 0;
2105    jint _sizeRemaining;
2106    GLint *size = (GLint *) 0;
2107    GLenum *type_base = (GLenum *) 0;
2108    jint _typeRemaining;
2109    GLenum *type = (GLenum *) 0;
2110    char *name_base = (char *) 0;
2111    jint _nameRemaining;
2112    char *name = (char *) 0;
2113
2114    if (!length_ref) {
2115        _exception = 1;
2116        _exceptionType = "java/lang/IllegalArgumentException";
2117        _exceptionMessage = "length == null";
2118        goto exit;
2119    }
2120    if (lengthOffset < 0) {
2121        _exception = 1;
2122        _exceptionType = "java/lang/IllegalArgumentException";
2123        _exceptionMessage = "lengthOffset < 0";
2124        goto exit;
2125    }
2126    _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
2127    length_base = (GLsizei *)
2128        _env->GetIntArrayElements(length_ref, (jboolean *)0);
2129    length = length_base + lengthOffset;
2130
2131    if (!size_ref) {
2132        _exception = 1;
2133        _exceptionType = "java/lang/IllegalArgumentException";
2134        _exceptionMessage = "size == null";
2135        goto exit;
2136    }
2137    if (sizeOffset < 0) {
2138        _exception = 1;
2139        _exceptionType = "java/lang/IllegalArgumentException";
2140        _exceptionMessage = "sizeOffset < 0";
2141        goto exit;
2142    }
2143    _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2144    size_base = (GLint *)
2145        _env->GetIntArrayElements(size_ref, (jboolean *)0);
2146    size = size_base + sizeOffset;
2147
2148    if (!type_ref) {
2149        _exception = 1;
2150        _exceptionType = "java/lang/IllegalArgumentException";
2151        _exceptionMessage = "type == null";
2152        goto exit;
2153    }
2154    if (typeOffset < 0) {
2155        _exception = 1;
2156        _exceptionType = "java/lang/IllegalArgumentException";
2157        _exceptionMessage = "typeOffset < 0";
2158        goto exit;
2159    }
2160    _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2161    type_base = (GLenum *)
2162        _env->GetIntArrayElements(type_ref, (jboolean *)0);
2163    type = type_base + typeOffset;
2164
2165    if (!name_ref) {
2166        _exception = 1;
2167        _exceptionType = "java/lang/IllegalArgumentException";
2168        _exceptionMessage = "name == null";
2169        goto exit;
2170    }
2171    if (nameOffset < 0) {
2172        _exception = 1;
2173        _exceptionType = "java/lang/IllegalArgumentException";
2174        _exceptionMessage = "nameOffset < 0";
2175        goto exit;
2176    }
2177    _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
2178    name_base = (char *)
2179        _env->GetByteArrayElements(name_ref, (jboolean *)0);
2180    name = name_base + nameOffset;
2181
2182    glGetActiveUniform(
2183        (GLuint)program,
2184        (GLuint)index,
2185        (GLsizei)bufsize,
2186        (GLsizei *)length,
2187        (GLint *)size,
2188        (GLenum *)type,
2189        (char *)name
2190    );
2191
2192exit:
2193    if (name_base) {
2194        _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
2195            _exception ? JNI_ABORT: 0);
2196    }
2197    if (type_base) {
2198        _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
2199            _exception ? JNI_ABORT: 0);
2200    }
2201    if (size_base) {
2202        _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
2203            _exception ? JNI_ABORT: 0);
2204    }
2205    if (length_base) {
2206        _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
2207            _exception ? JNI_ABORT: 0);
2208    }
2209    if (_exception) {
2210        jniThrowException(_env, _exceptionType, _exceptionMessage);
2211    }
2212}
2213
2214/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2215static void
2216android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
2217  (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
2218    jintArray _lengthArray = (jintArray) 0;
2219    jint _lengthBufferOffset = (jint) 0;
2220    jintArray _sizeArray = (jintArray) 0;
2221    jint _sizeBufferOffset = (jint) 0;
2222    jintArray _typeArray = (jintArray) 0;
2223    jint _typeBufferOffset = (jint) 0;
2224    jint _lengthRemaining;
2225    GLsizei *length = (GLsizei *) 0;
2226    jint _sizeRemaining;
2227    GLint *size = (GLint *) 0;
2228    jint _typeRemaining;
2229    GLenum *type = (GLenum *) 0;
2230
2231    length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
2232    size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
2233    type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
2234    if (length == NULL) {
2235        char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
2236        length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
2237    }
2238    if (size == NULL) {
2239        char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
2240        size = (GLint *) (_sizeBase + _sizeBufferOffset);
2241    }
2242    if (type == NULL) {
2243        char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
2244        type = (GLenum *) (_typeBase + _typeBufferOffset);
2245    }
2246    glGetActiveUniform(
2247        (GLuint)program,
2248        (GLuint)index,
2249        (GLsizei)bufsize,
2250        (GLsizei *)length,
2251        (GLint *)size,
2252        (GLenum *)type,
2253        reinterpret_cast<char *>(name)
2254    );
2255    if (_typeArray) {
2256        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
2257    }
2258    if (_sizeArray) {
2259        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
2260    }
2261    if (_lengthArray) {
2262        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
2263    }
2264}
2265
2266/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2267static jstring
2268android_glGetActiveUniform1
2269  (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
2270    jint _exception = 0;
2271    const char * _exceptionType;
2272    const char * _exceptionMessage;
2273
2274    GLint *size_base = (GLint *) 0;
2275    jint _sizeRemaining;
2276    GLint *size = (GLint *) 0;
2277
2278    GLenum *type_base = (GLenum *) 0;
2279    jint _typeRemaining;
2280    GLenum *type = (GLenum *) 0;
2281
2282    jstring result = 0;
2283
2284    GLint len = 0;
2285    glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
2286    if (!len) {
2287        return _env->NewStringUTF("");
2288    }
2289    char* buf = (char*) malloc(len);
2290
2291    if (buf == NULL) {
2292        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2293        return NULL;
2294    }
2295
2296    if (!size_ref) {
2297        _exception = 1;
2298        _exceptionType = "java/lang/IllegalArgumentException";
2299        _exceptionMessage = "size == null";
2300        goto exit;
2301    }
2302    if (sizeOffset < 0) {
2303        _exception = 1;
2304        _exceptionType = "java/lang/IllegalArgumentException";
2305        _exceptionMessage = "sizeOffset < 0";
2306        goto exit;
2307    }
2308    _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2309    size_base = (GLint *)
2310        _env->GetIntArrayElements(size_ref, (jboolean *)0);
2311    size = size_base + sizeOffset;
2312
2313    if (!type_ref) {
2314        _exception = 1;
2315        _exceptionType = "java/lang/IllegalArgumentException";
2316        _exceptionMessage = "type == null";
2317        goto exit;
2318    }
2319    if (typeOffset < 0) {
2320        _exception = 1;
2321        _exceptionType = "java/lang/IllegalArgumentException";
2322        _exceptionMessage = "typeOffset < 0";
2323        goto exit;
2324    }
2325    _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2326    type_base = (GLenum *)
2327        _env->GetIntArrayElements(type_ref, (jboolean *)0);
2328    type = type_base + typeOffset;
2329
2330    glGetActiveUniform(
2331        (GLuint)program,
2332        (GLuint)index,
2333        (GLsizei)len,
2334        NULL,
2335        (GLint *)size,
2336        (GLenum *)type,
2337        (char *)buf
2338    );
2339
2340exit:
2341    if (type_base) {
2342        _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
2343            _exception ? JNI_ABORT: 0);
2344    }
2345    if (size_base) {
2346        _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
2347            _exception ? JNI_ABORT: 0);
2348    }
2349    if (_exception != 1) {
2350        result = _env->NewStringUTF(buf);
2351    }
2352    if (buf) {
2353        free(buf);
2354    }
2355    if (_exception) {
2356        jniThrowException(_env, _exceptionType, _exceptionMessage);
2357    }
2358    if (result == 0) {
2359        result = _env->NewStringUTF("");
2360    }
2361    return result;
2362}
2363
2364/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2365static jstring
2366android_glGetActiveUniform2
2367  (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
2368    jintArray _sizeArray = (jintArray) 0;
2369    jint _sizeBufferOffset = (jint) 0;
2370    jintArray _typeArray = (jintArray) 0;
2371    jint _typeBufferOffset = (jint) 0;
2372    jint _sizeRemaining;
2373    GLint *size = (GLint *) 0;
2374    jint _typeRemaining;
2375    GLenum *type = (GLenum *) 0;
2376
2377    jstring result = 0;
2378    GLint len = 0;
2379    glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
2380    if (!len) {
2381        return _env->NewStringUTF("");
2382    }
2383    char* buf = (char*) malloc(len);
2384
2385    if (buf == NULL) {
2386        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2387        return NULL;
2388    }
2389
2390    size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
2391    type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
2392
2393    if (size == NULL) {
2394        char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
2395        size = (GLint *) (_sizeBase + _sizeBufferOffset);
2396    }
2397    if (type == NULL) {
2398        char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
2399        type = (GLenum *) (_typeBase + _typeBufferOffset);
2400    }
2401    glGetActiveUniform(
2402        (GLuint)program,
2403        (GLuint)index,
2404        len,
2405        NULL,
2406        (GLint *)size,
2407        (GLenum *)type,
2408        (char *)buf
2409    );
2410
2411    if (_typeArray) {
2412        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
2413    }
2414    if (_sizeArray) {
2415        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
2416    }
2417    result = _env->NewStringUTF(buf);
2418    if (buf) {
2419        free(buf);
2420    }
2421    return result;
2422}
2423/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */
2424static void
2425android_glGetAttachedShaders__II_3II_3II
2426  (JNIEnv *_env, jobject _this, jint program, jint maxcount, jintArray count_ref, jint countOffset, jintArray shaders_ref, jint shadersOffset) {
2427    jint _exception = 0;
2428    const char * _exceptionType = NULL;
2429    const char * _exceptionMessage = NULL;
2430    GLsizei *count_base = (GLsizei *) 0;
2431    jint _countRemaining;
2432    GLsizei *count = (GLsizei *) 0;
2433    GLuint *shaders_base = (GLuint *) 0;
2434    jint _shadersRemaining;
2435    GLuint *shaders = (GLuint *) 0;
2436
2437    if (!count_ref) {
2438        _exception = 1;
2439        _exceptionType = "java/lang/IllegalArgumentException";
2440        _exceptionMessage = "count == null";
2441        goto exit;
2442    }
2443    if (countOffset < 0) {
2444        _exception = 1;
2445        _exceptionType = "java/lang/IllegalArgumentException";
2446        _exceptionMessage = "countOffset < 0";
2447        goto exit;
2448    }
2449    _countRemaining = _env->GetArrayLength(count_ref) - countOffset;
2450    if (_countRemaining < 1) {
2451        _exception = 1;
2452        _exceptionType = "java/lang/IllegalArgumentException";
2453        _exceptionMessage = "length - countOffset < 1 < needed";
2454        goto exit;
2455    }
2456    count_base = (GLsizei *)
2457        _env->GetIntArrayElements(count_ref, (jboolean *)0);
2458    count = count_base + countOffset;
2459
2460    if (!shaders_ref) {
2461        _exception = 1;
2462        _exceptionType = "java/lang/IllegalArgumentException";
2463        _exceptionMessage = "shaders == null";
2464        goto exit;
2465    }
2466    if (shadersOffset < 0) {
2467        _exception = 1;
2468        _exceptionType = "java/lang/IllegalArgumentException";
2469        _exceptionMessage = "shadersOffset < 0";
2470        goto exit;
2471    }
2472    _shadersRemaining = _env->GetArrayLength(shaders_ref) - shadersOffset;
2473    if (_shadersRemaining < maxcount) {
2474        _exception = 1;
2475        _exceptionType = "java/lang/IllegalArgumentException";
2476        _exceptionMessage = "length - shadersOffset < maxcount < needed";
2477        goto exit;
2478    }
2479    shaders_base = (GLuint *)
2480        _env->GetIntArrayElements(shaders_ref, (jboolean *)0);
2481    shaders = shaders_base + shadersOffset;
2482
2483    glGetAttachedShaders(
2484        (GLuint)program,
2485        (GLsizei)maxcount,
2486        (GLsizei *)count,
2487        (GLuint *)shaders
2488    );
2489
2490exit:
2491    if (shaders_base) {
2492        _env->ReleaseIntArrayElements(shaders_ref, (jint*)shaders_base,
2493            _exception ? JNI_ABORT: 0);
2494    }
2495    if (count_base) {
2496        _env->ReleaseIntArrayElements(count_ref, (jint*)count_base,
2497            _exception ? JNI_ABORT: 0);
2498    }
2499    if (_exception) {
2500        jniThrowException(_env, _exceptionType, _exceptionMessage);
2501    }
2502}
2503
2504/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */
2505static void
2506android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
2507  (JNIEnv *_env, jobject _this, jint program, jint maxcount, jobject count_buf, jobject shaders_buf) {
2508    jint _exception = 0;
2509    const char * _exceptionType = NULL;
2510    const char * _exceptionMessage = NULL;
2511    jintArray _countArray = (jintArray) 0;
2512    jint _countBufferOffset = (jint) 0;
2513    jintArray _shadersArray = (jintArray) 0;
2514    jint _shadersBufferOffset = (jint) 0;
2515    jint _countRemaining;
2516    GLsizei *count = (GLsizei *) 0;
2517    jint _shadersRemaining;
2518    GLuint *shaders = (GLuint *) 0;
2519
2520    if (count_buf) {
2521        count = (GLsizei *)getPointer(_env, count_buf, (jarray*)&_countArray, &_countRemaining, &_countBufferOffset);
2522        if (_countRemaining < 1) {
2523            _exception = 1;
2524            _exceptionType = "java/lang/IllegalArgumentException";
2525            _exceptionMessage = "remaining() < 1 < needed";
2526            goto exit;
2527        }
2528    }
2529    if (shaders_buf) {
2530        shaders = (GLuint *)getPointer(_env, shaders_buf, (jarray*)&_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
2531        if (_shadersRemaining < maxcount) {
2532            _exception = 1;
2533            _exceptionType = "java/lang/IllegalArgumentException";
2534            _exceptionMessage = "remaining() < maxcount < needed";
2535            goto exit;
2536        }
2537    }
2538    if (count_buf && count == NULL) {
2539        char * _countBase = (char *)_env->GetIntArrayElements(_countArray, (jboolean *) 0);
2540        count = (GLsizei *) (_countBase + _countBufferOffset);
2541    }
2542    if (shaders_buf && shaders == NULL) {
2543        char * _shadersBase = (char *)_env->GetIntArrayElements(_shadersArray, (jboolean *) 0);
2544        shaders = (GLuint *) (_shadersBase + _shadersBufferOffset);
2545    }
2546    glGetAttachedShaders(
2547        (GLuint)program,
2548        (GLsizei)maxcount,
2549        (GLsizei *)count,
2550        (GLuint *)shaders
2551    );
2552
2553exit:
2554    if (_shadersArray) {
2555        _env->ReleaseIntArrayElements(_shadersArray, (jint*)shaders, _exception ? JNI_ABORT : 0);
2556    }
2557    if (_countArray) {
2558        _env->ReleaseIntArrayElements(_countArray, (jint*)count, _exception ? JNI_ABORT : 0);
2559    }
2560    if (_exception) {
2561        jniThrowException(_env, _exceptionType, _exceptionMessage);
2562    }
2563}
2564
2565/* GLint glGetAttribLocation ( GLuint program, const char *name ) */
2566static jint
2567android_glGetAttribLocation__ILjava_lang_String_2
2568  (JNIEnv *_env, jobject _this, jint program, jstring name) {
2569    jint _exception = 0;
2570    const char * _exceptionType = NULL;
2571    const char * _exceptionMessage = NULL;
2572    GLint _returnValue = 0;
2573    const char* _nativename = 0;
2574
2575    if (!name) {
2576        _exception = 1;
2577        _exceptionType = "java/lang/IllegalArgumentException";
2578        _exceptionMessage = "name == null";
2579        goto exit;
2580    }
2581    _nativename = _env->GetStringUTFChars(name, 0);
2582
2583    _returnValue = glGetAttribLocation(
2584        (GLuint)program,
2585        (char *)_nativename
2586    );
2587
2588exit:
2589    if (_nativename) {
2590        _env->ReleaseStringUTFChars(name, _nativename);
2591    }
2592
2593    if (_exception) {
2594        jniThrowException(_env, _exceptionType, _exceptionMessage);
2595    }
2596    return (jint)_returnValue;
2597}
2598
2599/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
2600static void
2601android_glGetBooleanv__I_3ZI
2602  (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
2603    get<jbooleanArray, BooleanArrayGetter, jboolean*, BooleanArrayReleaser, GLboolean, glGetBooleanv>(
2604        _env, _this, pname, params_ref, offset);
2605}
2606
2607/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
2608static void
2609android_glGetBooleanv__ILjava_nio_IntBuffer_2
2610  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
2611    getarray<GLboolean, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetBooleanv>(
2612        _env, _this, pname, params_buf);
2613}
2614/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2615static void
2616android_glGetBufferParameteriv__II_3II
2617  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2618    jint _exception = 0;
2619    const char * _exceptionType = NULL;
2620    const char * _exceptionMessage = NULL;
2621    GLint *params_base = (GLint *) 0;
2622    jint _remaining;
2623    GLint *params = (GLint *) 0;
2624
2625    if (!params_ref) {
2626        _exception = 1;
2627        _exceptionType = "java/lang/IllegalArgumentException";
2628        _exceptionMessage = "params == null";
2629        goto exit;
2630    }
2631    if (offset < 0) {
2632        _exception = 1;
2633        _exceptionType = "java/lang/IllegalArgumentException";
2634        _exceptionMessage = "offset < 0";
2635        goto exit;
2636    }
2637    _remaining = _env->GetArrayLength(params_ref) - offset;
2638    if (_remaining < 1) {
2639        _exception = 1;
2640        _exceptionType = "java/lang/IllegalArgumentException";
2641        _exceptionMessage = "length - offset < 1 < needed";
2642        goto exit;
2643    }
2644    params_base = (GLint *)
2645        _env->GetIntArrayElements(params_ref, (jboolean *)0);
2646    params = params_base + offset;
2647
2648    glGetBufferParameteriv(
2649        (GLenum)target,
2650        (GLenum)pname,
2651        (GLint *)params
2652    );
2653
2654exit:
2655    if (params_base) {
2656        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
2657            _exception ? JNI_ABORT: 0);
2658    }
2659    if (_exception) {
2660        jniThrowException(_env, _exceptionType, _exceptionMessage);
2661    }
2662}
2663
2664/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2665static void
2666android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
2667  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2668    jint _exception = 0;
2669    const char * _exceptionType = NULL;
2670    const char * _exceptionMessage = NULL;
2671    jintArray _array = (jintArray) 0;
2672    jint _bufferOffset = (jint) 0;
2673    jint _remaining;
2674    GLint *params = (GLint *) 0;
2675
2676    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2677    if (_remaining < 1) {
2678        _exception = 1;
2679        _exceptionType = "java/lang/IllegalArgumentException";
2680        _exceptionMessage = "remaining() < 1 < needed";
2681        goto exit;
2682    }
2683    if (params == NULL) {
2684        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
2685        params = (GLint *) (_paramsBase + _bufferOffset);
2686    }
2687    glGetBufferParameteriv(
2688        (GLenum)target,
2689        (GLenum)pname,
2690        (GLint *)params
2691    );
2692
2693exit:
2694    if (_array) {
2695        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
2696    }
2697    if (_exception) {
2698        jniThrowException(_env, _exceptionType, _exceptionMessage);
2699    }
2700}
2701
2702/* GLenum glGetError ( void ) */
2703static jint
2704android_glGetError__
2705  (JNIEnv *_env, jobject _this) {
2706    GLenum _returnValue;
2707    _returnValue = glGetError();
2708    return (jint)_returnValue;
2709}
2710
2711/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
2712static void
2713android_glGetFloatv__I_3FI
2714  (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
2715    get<jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, GLfloat, glGetFloatv>(
2716        _env, _this, pname, params_ref, offset);
2717}
2718
2719/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
2720static void
2721android_glGetFloatv__ILjava_nio_FloatBuffer_2
2722  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
2723    getarray<GLfloat, jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, glGetFloatv>(
2724        _env, _this, pname, params_buf);
2725}
2726/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
2727static void
2728android_glGetFramebufferAttachmentParameteriv__III_3II
2729  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jintArray params_ref, jint offset) {
2730    jint _exception = 0;
2731    const char * _exceptionType = NULL;
2732    const char * _exceptionMessage = NULL;
2733    GLint *params_base = (GLint *) 0;
2734    jint _remaining;
2735    GLint *params = (GLint *) 0;
2736
2737    if (!params_ref) {
2738        _exception = 1;
2739        _exceptionType = "java/lang/IllegalArgumentException";
2740        _exceptionMessage = "params == null";
2741        goto exit;
2742    }
2743    if (offset < 0) {
2744        _exception = 1;
2745        _exceptionType = "java/lang/IllegalArgumentException";
2746        _exceptionMessage = "offset < 0";
2747        goto exit;
2748    }
2749    _remaining = _env->GetArrayLength(params_ref) - offset;
2750    params_base = (GLint *)
2751        _env->GetIntArrayElements(params_ref, (jboolean *)0);
2752    params = params_base + offset;
2753
2754    glGetFramebufferAttachmentParameteriv(
2755        (GLenum)target,
2756        (GLenum)attachment,
2757        (GLenum)pname,
2758        (GLint *)params
2759    );
2760
2761exit:
2762    if (params_base) {
2763        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
2764            _exception ? JNI_ABORT: 0);
2765    }
2766    if (_exception) {
2767        jniThrowException(_env, _exceptionType, _exceptionMessage);
2768    }
2769}
2770
2771/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
2772static void
2773android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2
2774  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) {
2775    jintArray _array = (jintArray) 0;
2776    jint _bufferOffset = (jint) 0;
2777    jint _remaining;
2778    GLint *params = (GLint *) 0;
2779
2780    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2781    if (params == NULL) {
2782        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
2783        params = (GLint *) (_paramsBase + _bufferOffset);
2784    }
2785    glGetFramebufferAttachmentParameteriv(
2786        (GLenum)target,
2787        (GLenum)attachment,
2788        (GLenum)pname,
2789        (GLint *)params
2790    );
2791    if (_array) {
2792        _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
2793    }
2794}
2795
2796/* void glGetIntegerv ( GLenum pname, GLint *params ) */
2797static void
2798android_glGetIntegerv__I_3II
2799  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
2800    get<jintArray, IntArrayGetter, jint*, IntArrayReleaser, GLint, glGetIntegerv>(
2801        _env, _this, pname, params_ref, offset);
2802}
2803
2804/* void glGetIntegerv ( GLenum pname, GLint *params ) */
2805static void
2806android_glGetIntegerv__ILjava_nio_IntBuffer_2
2807  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
2808    getarray<GLint, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetIntegerv>(
2809        _env, _this, pname, params_buf);
2810}
2811/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2812static void
2813android_glGetProgramiv__II_3II
2814  (JNIEnv *_env, jobject _this, jint program, jint pname, jintArray params_ref, jint offset) {
2815    jint _exception = 0;
2816    const char * _exceptionType = NULL;
2817    const char * _exceptionMessage = NULL;
2818    GLint *params_base = (GLint *) 0;
2819    jint _remaining;
2820    GLint *params = (GLint *) 0;
2821
2822    if (!params_ref) {
2823        _exception = 1;
2824        _exceptionType = "java/lang/IllegalArgumentException";
2825        _exceptionMessage = "params == null";
2826        goto exit;
2827    }
2828    if (offset < 0) {
2829        _exception = 1;
2830        _exceptionType = "java/lang/IllegalArgumentException";
2831        _exceptionMessage = "offset < 0";
2832        goto exit;
2833    }
2834    _remaining = _env->GetArrayLength(params_ref) - offset;
2835    if (_remaining < 1) {
2836        _exception = 1;
2837        _exceptionType = "java/lang/IllegalArgumentException";
2838        _exceptionMessage = "length - offset < 1 < needed";
2839        goto exit;
2840    }
2841    params_base = (GLint *)
2842        _env->GetIntArrayElements(params_ref, (jboolean *)0);
2843    params = params_base + offset;
2844
2845    glGetProgramiv(
2846        (GLuint)program,
2847        (GLenum)pname,
2848        (GLint *)params
2849    );
2850
2851exit:
2852    if (params_base) {
2853        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
2854            _exception ? JNI_ABORT: 0);
2855    }
2856    if (_exception) {
2857        jniThrowException(_env, _exceptionType, _exceptionMessage);
2858    }
2859}
2860
2861/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2862static void
2863android_glGetProgramiv__IILjava_nio_IntBuffer_2
2864  (JNIEnv *_env, jobject _this, jint program, jint pname, jobject params_buf) {
2865    jint _exception = 0;
2866    const char * _exceptionType = NULL;
2867    const char * _exceptionMessage = NULL;
2868    jintArray _array = (jintArray) 0;
2869    jint _bufferOffset = (jint) 0;
2870    jint _remaining;
2871    GLint *params = (GLint *) 0;
2872
2873    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2874    if (_remaining < 1) {
2875        _exception = 1;
2876        _exceptionType = "java/lang/IllegalArgumentException";
2877        _exceptionMessage = "remaining() < 1 < needed";
2878        goto exit;
2879    }
2880    if (params == NULL) {
2881        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
2882        params = (GLint *) (_paramsBase + _bufferOffset);
2883    }
2884    glGetProgramiv(
2885        (GLuint)program,
2886        (GLenum)pname,
2887        (GLint *)params
2888    );
2889
2890exit:
2891    if (_array) {
2892        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
2893    }
2894    if (_exception) {
2895        jniThrowException(_env, _exceptionType, _exceptionMessage);
2896    }
2897}
2898
2899#include <stdlib.h>
2900
2901/* void glGetProgramInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
2902static jstring android_glGetProgramInfoLog(JNIEnv *_env, jobject, jint shader) {
2903    GLint infoLen = 0;
2904    glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
2905    if (!infoLen) {
2906        return _env->NewStringUTF("");
2907    }
2908    char* buf = (char*) malloc(infoLen);
2909    if (buf == NULL) {
2910        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2911        return NULL;
2912    }
2913    glGetProgramInfoLog(shader, infoLen, NULL, buf);
2914    jstring result = _env->NewStringUTF(buf);
2915    free(buf);
2916    return result;
2917}
2918/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2919static void
2920android_glGetRenderbufferParameteriv__II_3II
2921  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2922    jint _exception = 0;
2923    const char * _exceptionType = NULL;
2924    const char * _exceptionMessage = NULL;
2925    GLint *params_base = (GLint *) 0;
2926    jint _remaining;
2927    GLint *params = (GLint *) 0;
2928
2929    if (!params_ref) {
2930        _exception = 1;
2931        _exceptionType = "java/lang/IllegalArgumentException";
2932        _exceptionMessage = "params == null";
2933        goto exit;
2934    }
2935    if (offset < 0) {
2936        _exception = 1;
2937        _exceptionType = "java/lang/IllegalArgumentException";
2938        _exceptionMessage = "offset < 0";
2939        goto exit;
2940    }
2941    _remaining = _env->GetArrayLength(params_ref) - offset;
2942    if (_remaining < 1) {
2943        _exception = 1;
2944        _exceptionType = "java/lang/IllegalArgumentException";
2945        _exceptionMessage = "length - offset < 1 < needed";
2946        goto exit;
2947    }
2948    params_base = (GLint *)
2949        _env->GetIntArrayElements(params_ref, (jboolean *)0);
2950    params = params_base + offset;
2951
2952    glGetRenderbufferParameteriv(
2953        (GLenum)target,
2954        (GLenum)pname,
2955        (GLint *)params
2956    );
2957
2958exit:
2959    if (params_base) {
2960        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
2961            _exception ? JNI_ABORT: 0);
2962    }
2963    if (_exception) {
2964        jniThrowException(_env, _exceptionType, _exceptionMessage);
2965    }
2966}
2967
2968/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2969static void
2970android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2
2971  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2972    jint _exception = 0;
2973    const char * _exceptionType = NULL;
2974    const char * _exceptionMessage = NULL;
2975    jintArray _array = (jintArray) 0;
2976    jint _bufferOffset = (jint) 0;
2977    jint _remaining;
2978    GLint *params = (GLint *) 0;
2979
2980    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2981    if (_remaining < 1) {
2982        _exception = 1;
2983        _exceptionType = "java/lang/IllegalArgumentException";
2984        _exceptionMessage = "remaining() < 1 < needed";
2985        goto exit;
2986    }
2987    if (params == NULL) {
2988        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
2989        params = (GLint *) (_paramsBase + _bufferOffset);
2990    }
2991    glGetRenderbufferParameteriv(
2992        (GLenum)target,
2993        (GLenum)pname,
2994        (GLint *)params
2995    );
2996
2997exit:
2998    if (_array) {
2999        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
3000    }
3001    if (_exception) {
3002        jniThrowException(_env, _exceptionType, _exceptionMessage);
3003    }
3004}
3005
3006/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
3007static void
3008android_glGetShaderiv__II_3II
3009  (JNIEnv *_env, jobject _this, jint shader, jint pname, jintArray params_ref, jint offset) {
3010    jint _exception = 0;
3011    const char * _exceptionType = NULL;
3012    const char * _exceptionMessage = NULL;
3013    GLint *params_base = (GLint *) 0;
3014    jint _remaining;
3015    GLint *params = (GLint *) 0;
3016
3017    if (!params_ref) {
3018        _exception = 1;
3019        _exceptionType = "java/lang/IllegalArgumentException";
3020        _exceptionMessage = "params == null";
3021        goto exit;
3022    }
3023    if (offset < 0) {
3024        _exception = 1;
3025        _exceptionType = "java/lang/IllegalArgumentException";
3026        _exceptionMessage = "offset < 0";
3027        goto exit;
3028    }
3029    _remaining = _env->GetArrayLength(params_ref) - offset;
3030    if (_remaining < 1) {
3031        _exception = 1;
3032        _exceptionType = "java/lang/IllegalArgumentException";
3033        _exceptionMessage = "length - offset < 1 < needed";
3034        goto exit;
3035    }
3036    params_base = (GLint *)
3037        _env->GetIntArrayElements(params_ref, (jboolean *)0);
3038    params = params_base + offset;
3039
3040    glGetShaderiv(
3041        (GLuint)shader,
3042        (GLenum)pname,
3043        (GLint *)params
3044    );
3045
3046exit:
3047    if (params_base) {
3048        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
3049            _exception ? JNI_ABORT: 0);
3050    }
3051    if (_exception) {
3052        jniThrowException(_env, _exceptionType, _exceptionMessage);
3053    }
3054}
3055
3056/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
3057static void
3058android_glGetShaderiv__IILjava_nio_IntBuffer_2
3059  (JNIEnv *_env, jobject _this, jint shader, jint pname, jobject params_buf) {
3060    jint _exception = 0;
3061    const char * _exceptionType = NULL;
3062    const char * _exceptionMessage = NULL;
3063    jintArray _array = (jintArray) 0;
3064    jint _bufferOffset = (jint) 0;
3065    jint _remaining;
3066    GLint *params = (GLint *) 0;
3067
3068    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3069    if (_remaining < 1) {
3070        _exception = 1;
3071        _exceptionType = "java/lang/IllegalArgumentException";
3072        _exceptionMessage = "remaining() < 1 < needed";
3073        goto exit;
3074    }
3075    if (params == NULL) {
3076        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
3077        params = (GLint *) (_paramsBase + _bufferOffset);
3078    }
3079    glGetShaderiv(
3080        (GLuint)shader,
3081        (GLenum)pname,
3082        (GLint *)params
3083    );
3084
3085exit:
3086    if (_array) {
3087        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
3088    }
3089    if (_exception) {
3090        jniThrowException(_env, _exceptionType, _exceptionMessage);
3091    }
3092}
3093
3094#include <stdlib.h>
3095
3096/* void glGetShaderInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
3097static jstring android_glGetShaderInfoLog(JNIEnv *_env, jobject, jint shader) {
3098    GLint infoLen = 0;
3099    glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
3100    if (!infoLen) {
3101        return _env->NewStringUTF("");
3102    }
3103    char* buf = (char*) malloc(infoLen);
3104    if (buf == NULL) {
3105        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
3106        return NULL;
3107    }
3108    glGetShaderInfoLog(shader, infoLen, NULL, buf);
3109    jstring result = _env->NewStringUTF(buf);
3110    free(buf);
3111    return result;
3112}
3113/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
3114static void
3115android_glGetShaderPrecisionFormat__II_3II_3II
3116  (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jintArray range_ref, jint rangeOffset, jintArray precision_ref, jint precisionOffset) {
3117    jint _exception = 0;
3118    const char * _exceptionType = NULL;
3119    const char * _exceptionMessage = NULL;
3120    GLint *range_base = (GLint *) 0;
3121    jint _rangeRemaining;
3122    GLint *range = (GLint *) 0;
3123    GLint *precision_base = (GLint *) 0;
3124    jint _precisionRemaining;
3125    GLint *precision = (GLint *) 0;
3126
3127    if (!range_ref) {
3128        _exception = 1;
3129        _exceptionType = "java/lang/IllegalArgumentException";
3130        _exceptionMessage = "range == null";
3131        goto exit;
3132    }
3133    if (rangeOffset < 0) {
3134        _exception = 1;
3135        _exceptionType = "java/lang/IllegalArgumentException";
3136        _exceptionMessage = "rangeOffset < 0";
3137        goto exit;
3138    }
3139    _rangeRemaining = _env->GetArrayLength(range_ref) - rangeOffset;
3140    if (_rangeRemaining < 1) {
3141        _exception = 1;
3142        _exceptionType = "java/lang/IllegalArgumentException";
3143        _exceptionMessage = "length - rangeOffset < 1 < needed";
3144        goto exit;
3145    }
3146    range_base = (GLint *)
3147        _env->GetIntArrayElements(range_ref, (jboolean *)0);
3148    range = range_base + rangeOffset;
3149
3150    if (!precision_ref) {
3151        _exception = 1;
3152        _exceptionType = "java/lang/IllegalArgumentException";
3153        _exceptionMessage = "precision == null";
3154        goto exit;
3155    }
3156    if (precisionOffset < 0) {
3157        _exception = 1;
3158        _exceptionType = "java/lang/IllegalArgumentException";
3159        _exceptionMessage = "precisionOffset < 0";
3160        goto exit;
3161    }
3162    _precisionRemaining = _env->GetArrayLength(precision_ref) - precisionOffset;
3163    if (_precisionRemaining < 1) {
3164        _exception = 1;
3165        _exceptionType = "java/lang/IllegalArgumentException";
3166        _exceptionMessage = "length - precisionOffset < 1 < needed";
3167        goto exit;
3168    }
3169    precision_base = (GLint *)
3170        _env->GetIntArrayElements(precision_ref, (jboolean *)0);
3171    precision = precision_base + precisionOffset;
3172
3173    glGetShaderPrecisionFormat(
3174        (GLenum)shadertype,
3175        (GLenum)precisiontype,
3176        (GLint *)range,
3177        (GLint *)precision
3178    );
3179
3180exit:
3181    if (precision_base) {
3182        _env->ReleaseIntArrayElements(precision_ref, (jint*)precision_base,
3183            _exception ? JNI_ABORT: 0);
3184    }
3185    if (range_base) {
3186        _env->ReleaseIntArrayElements(range_ref, (jint*)range_base,
3187            _exception ? JNI_ABORT: 0);
3188    }
3189    if (_exception) {
3190        jniThrowException(_env, _exceptionType, _exceptionMessage);
3191    }
3192}
3193
3194/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
3195static void
3196android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
3197  (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jobject range_buf, jobject precision_buf) {
3198    jint _exception = 0;
3199    const char * _exceptionType = NULL;
3200    const char * _exceptionMessage = NULL;
3201    jintArray _rangeArray = (jintArray) 0;
3202    jint _rangeBufferOffset = (jint) 0;
3203    jintArray _precisionArray = (jintArray) 0;
3204    jint _precisionBufferOffset = (jint) 0;
3205    jint _rangeRemaining;
3206    GLint *range = (GLint *) 0;
3207    jint _precisionRemaining;
3208    GLint *precision = (GLint *) 0;
3209
3210    range = (GLint *)getPointer(_env, range_buf, (jarray*)&_rangeArray, &_rangeRemaining, &_rangeBufferOffset);
3211    if (_rangeRemaining < 1) {
3212        _exception = 1;
3213        _exceptionType = "java/lang/IllegalArgumentException";
3214        _exceptionMessage = "remaining() < 1 < needed";
3215        goto exit;
3216    }
3217    precision = (GLint *)getPointer(_env, precision_buf, (jarray*)&_precisionArray, &_precisionRemaining, &_precisionBufferOffset);
3218    if (_precisionRemaining < 1) {
3219        _exception = 1;
3220        _exceptionType = "java/lang/IllegalArgumentException";
3221        _exceptionMessage = "remaining() < 1 < needed";
3222        goto exit;
3223    }
3224    if (range == NULL) {
3225        char * _rangeBase = (char *)_env->GetIntArrayElements(_rangeArray, (jboolean *) 0);
3226        range = (GLint *) (_rangeBase + _rangeBufferOffset);
3227    }
3228    if (precision == NULL) {
3229        char * _precisionBase = (char *)_env->GetIntArrayElements(_precisionArray, (jboolean *) 0);
3230        precision = (GLint *) (_precisionBase + _precisionBufferOffset);
3231    }
3232    glGetShaderPrecisionFormat(
3233        (GLenum)shadertype,
3234        (GLenum)precisiontype,
3235        (GLint *)range,
3236        (GLint *)precision
3237    );
3238
3239exit:
3240    if (_precisionArray) {
3241        _env->ReleaseIntArrayElements(_precisionArray, (jint*)precision, _exception ? JNI_ABORT : 0);
3242    }
3243    if (_rangeArray) {
3244        _env->ReleaseIntArrayElements(_rangeArray, (jint*)range, _exception ? JNI_ABORT : 0);
3245    }
3246    if (_exception) {
3247        jniThrowException(_env, _exceptionType, _exceptionMessage);
3248    }
3249}
3250
3251/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3252static void
3253android_glGetShaderSource__II_3II_3BI
3254  (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jintArray length_ref, jint lengthOffset, jbyteArray source_ref, jint sourceOffset) {
3255    jint _exception = 0;
3256    const char * _exceptionType;
3257    const char * _exceptionMessage;
3258    GLsizei *length_base = (GLsizei *) 0;
3259    jint _lengthRemaining;
3260    GLsizei *length = (GLsizei *) 0;
3261    char *source_base = (char *) 0;
3262    jint _sourceRemaining;
3263    char *source = (char *) 0;
3264
3265    if (!length_ref) {
3266        _exception = 1;
3267        _exceptionType = "java/lang/IllegalArgumentException";
3268        _exceptionMessage = "length == null";
3269        goto exit;
3270    }
3271    if (lengthOffset < 0) {
3272        _exception = 1;
3273        _exceptionType = "java/lang/IllegalArgumentException";
3274        _exceptionMessage = "lengthOffset < 0";
3275        goto exit;
3276    }
3277    _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
3278    length_base = (GLsizei *)
3279        _env->GetIntArrayElements(length_ref, (jboolean *)0);
3280    length = length_base + lengthOffset;
3281
3282    if (!source_ref) {
3283        _exception = 1;
3284        _exceptionType = "java/lang/IllegalArgumentException";
3285        _exceptionMessage = "source == null";
3286        goto exit;
3287    }
3288    if (sourceOffset < 0) {
3289        _exception = 1;
3290        _exceptionType = "java/lang/IllegalArgumentException";
3291        _exceptionMessage = "sourceOffset < 0";
3292        goto exit;
3293    }
3294    _sourceRemaining = _env->GetArrayLength(source_ref) - sourceOffset;
3295    source_base = (char *)
3296        _env->GetByteArrayElements(source_ref, (jboolean *)0);
3297    source = source_base + sourceOffset;
3298
3299    glGetShaderSource(
3300        (GLuint)shader,
3301        (GLsizei)bufsize,
3302        (GLsizei *)length,
3303        (char *)source
3304    );
3305
3306exit:
3307    if (source_base) {
3308        _env->ReleaseByteArrayElements(source_ref, (jbyte*)source_base,
3309            _exception ? JNI_ABORT: 0);
3310    }
3311    if (length_base) {
3312        _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
3313            _exception ? JNI_ABORT: 0);
3314    }
3315    if (_exception) {
3316        jniThrowException(_env, _exceptionType, _exceptionMessage);
3317    }
3318}
3319
3320/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3321static void
3322android_glGetShaderSource__IILjava_nio_IntBuffer_2B
3323  (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jobject length_buf, jbyte source) {
3324    jintArray _array = (jintArray) 0;
3325    jint _bufferOffset = (jint) 0;
3326    jint _remaining;
3327    GLsizei *length = (GLsizei *) 0;
3328
3329    length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3330    if (length == NULL) {
3331        char * _lengthBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
3332        length = (GLsizei *) (_lengthBase + _bufferOffset);
3333    }
3334    glGetShaderSource(
3335        (GLuint)shader,
3336        (GLsizei)bufsize,
3337        (GLsizei *)length,
3338        reinterpret_cast<char *>(source)
3339    );
3340    if (_array) {
3341        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _array, (jint*)length, JNI_TRUE);
3342    }
3343}
3344
3345/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3346static jstring android_glGetShaderSource(JNIEnv *_env, jobject, jint shader) {
3347    GLint shaderLen = 0;
3348    glGetShaderiv((GLuint)shader, GL_SHADER_SOURCE_LENGTH, &shaderLen);
3349    if (!shaderLen) {
3350        return _env->NewStringUTF("");
3351    }
3352    char* buf = (char*) malloc(shaderLen);
3353    if (buf == NULL) {
3354        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
3355        return NULL;
3356    }
3357    glGetShaderSource(shader, shaderLen, NULL, buf);
3358    jstring result = _env->NewStringUTF(buf);
3359    free(buf);
3360    return result;
3361}
3362/* const GLubyte * glGetString ( GLenum name ) */
3363static jstring android_glGetString(JNIEnv* _env, jobject, jint name) {
3364    const char* chars = (const char*) glGetString((GLenum) name);
3365    return _env->NewStringUTF(chars);
3366}
3367/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
3368static void
3369android_glGetTexParameterfv__II_3FI
3370  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
3371    jint _exception = 0;
3372    const char * _exceptionType = NULL;
3373    const char * _exceptionMessage = NULL;
3374    GLfloat *params_base = (GLfloat *) 0;
3375    jint _remaining;
3376    GLfloat *params = (GLfloat *) 0;
3377
3378    if (!params_ref) {
3379        _exception = 1;
3380        _exceptionType = "java/lang/IllegalArgumentException";
3381        _exceptionMessage = "params == null";
3382        goto exit;
3383    }
3384    if (offset < 0) {
3385        _exception = 1;
3386        _exceptionType = "java/lang/IllegalArgumentException";
3387        _exceptionMessage = "offset < 0";
3388        goto exit;
3389    }
3390    _remaining = _env->GetArrayLength(params_ref) - offset;
3391    if (_remaining < 1) {
3392        _exception = 1;
3393        _exceptionType = "java/lang/IllegalArgumentException";
3394        _exceptionMessage = "length - offset < 1 < needed";
3395        goto exit;
3396    }
3397    params_base = (GLfloat *)
3398        _env->GetFloatArrayElements(params_ref, (jboolean *)0);
3399    params = params_base + offset;
3400
3401    glGetTexParameterfv(
3402        (GLenum)target,
3403        (GLenum)pname,
3404        (GLfloat *)params
3405    );
3406
3407exit:
3408    if (params_base) {
3409        _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
3410            _exception ? JNI_ABORT: 0);
3411    }
3412    if (_exception) {
3413        jniThrowException(_env, _exceptionType, _exceptionMessage);
3414    }
3415}
3416
3417/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
3418static void
3419android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2
3420  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3421    jint _exception = 0;
3422    const char * _exceptionType = NULL;
3423    const char * _exceptionMessage = NULL;
3424    jfloatArray _array = (jfloatArray) 0;
3425    jint _bufferOffset = (jint) 0;
3426    jint _remaining;
3427    GLfloat *params = (GLfloat *) 0;
3428
3429    params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3430    if (_remaining < 1) {
3431        _exception = 1;
3432        _exceptionType = "java/lang/IllegalArgumentException";
3433        _exceptionMessage = "remaining() < 1 < needed";
3434        goto exit;
3435    }
3436    if (params == NULL) {
3437        char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
3438        params = (GLfloat *) (_paramsBase + _bufferOffset);
3439    }
3440    glGetTexParameterfv(
3441        (GLenum)target,
3442        (GLenum)pname,
3443        (GLfloat *)params
3444    );
3445
3446exit:
3447    if (_array) {
3448        _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
3449    }
3450    if (_exception) {
3451        jniThrowException(_env, _exceptionType, _exceptionMessage);
3452    }
3453}
3454
3455/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3456static void
3457android_glGetTexParameteriv__II_3II
3458  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
3459    jint _exception = 0;
3460    const char * _exceptionType = NULL;
3461    const char * _exceptionMessage = NULL;
3462    GLint *params_base = (GLint *) 0;
3463    jint _remaining;
3464    GLint *params = (GLint *) 0;
3465
3466    if (!params_ref) {
3467        _exception = 1;
3468        _exceptionType = "java/lang/IllegalArgumentException";
3469        _exceptionMessage = "params == null";
3470        goto exit;
3471    }
3472    if (offset < 0) {
3473        _exception = 1;
3474        _exceptionType = "java/lang/IllegalArgumentException";
3475        _exceptionMessage = "offset < 0";
3476        goto exit;
3477    }
3478    _remaining = _env->GetArrayLength(params_ref) - offset;
3479    if (_remaining < 1) {
3480        _exception = 1;
3481        _exceptionType = "java/lang/IllegalArgumentException";
3482        _exceptionMessage = "length - offset < 1 < needed";
3483        goto exit;
3484    }
3485    params_base = (GLint *)
3486        _env->GetIntArrayElements(params_ref, (jboolean *)0);
3487    params = params_base + offset;
3488
3489    glGetTexParameteriv(
3490        (GLenum)target,
3491        (GLenum)pname,
3492        (GLint *)params
3493    );
3494
3495exit:
3496    if (params_base) {
3497        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
3498            _exception ? JNI_ABORT: 0);
3499    }
3500    if (_exception) {
3501        jniThrowException(_env, _exceptionType, _exceptionMessage);
3502    }
3503}
3504
3505/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3506static void
3507android_glGetTexParameteriv__IILjava_nio_IntBuffer_2
3508  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3509    jint _exception = 0;
3510    const char * _exceptionType = NULL;
3511    const char * _exceptionMessage = NULL;
3512    jintArray _array = (jintArray) 0;
3513    jint _bufferOffset = (jint) 0;
3514    jint _remaining;
3515    GLint *params = (GLint *) 0;
3516
3517    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3518    if (_remaining < 1) {
3519        _exception = 1;
3520        _exceptionType = "java/lang/IllegalArgumentException";
3521        _exceptionMessage = "remaining() < 1 < needed";
3522        goto exit;
3523    }
3524    if (params == NULL) {
3525        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
3526        params = (GLint *) (_paramsBase + _bufferOffset);
3527    }
3528    glGetTexParameteriv(
3529        (GLenum)target,
3530        (GLenum)pname,
3531        (GLint *)params
3532    );
3533
3534exit:
3535    if (_array) {
3536        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
3537    }
3538    if (_exception) {
3539        jniThrowException(_env, _exceptionType, _exceptionMessage);
3540    }
3541}
3542
3543/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3544static void
3545android_glGetUniformfv__II_3FI
3546  (JNIEnv *_env, jobject _this, jint program, jint location, jfloatArray params_ref, jint offset) {
3547    jint _exception = 0;
3548    const char * _exceptionType = NULL;
3549    const char * _exceptionMessage = NULL;
3550    GLfloat *params_base = (GLfloat *) 0;
3551    jint _remaining;
3552    GLfloat *params = (GLfloat *) 0;
3553
3554    if (!params_ref) {
3555        _exception = 1;
3556        _exceptionType = "java/lang/IllegalArgumentException";
3557        _exceptionMessage = "params == null";
3558        goto exit;
3559    }
3560    if (offset < 0) {
3561        _exception = 1;
3562        _exceptionType = "java/lang/IllegalArgumentException";
3563        _exceptionMessage = "offset < 0";
3564        goto exit;
3565    }
3566    _remaining = _env->GetArrayLength(params_ref) - offset;
3567    if (_remaining < 1) {
3568        _exception = 1;
3569        _exceptionType = "java/lang/IllegalArgumentException";
3570        _exceptionMessage = "length - offset < 1 < needed";
3571        goto exit;
3572    }
3573    params_base = (GLfloat *)
3574        _env->GetFloatArrayElements(params_ref, (jboolean *)0);
3575    params = params_base + offset;
3576
3577    glGetUniformfv(
3578        (GLuint)program,
3579        (GLint)location,
3580        (GLfloat *)params
3581    );
3582
3583exit:
3584    if (params_base) {
3585        _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
3586            _exception ? JNI_ABORT: 0);
3587    }
3588    if (_exception) {
3589        jniThrowException(_env, _exceptionType, _exceptionMessage);
3590    }
3591}
3592
3593/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3594static void
3595android_glGetUniformfv__IILjava_nio_FloatBuffer_2
3596  (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
3597    jint _exception = 0;
3598    const char * _exceptionType = NULL;
3599    const char * _exceptionMessage = NULL;
3600    jfloatArray _array = (jfloatArray) 0;
3601    jint _bufferOffset = (jint) 0;
3602    jint _remaining;
3603    GLfloat *params = (GLfloat *) 0;
3604
3605    params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3606    if (_remaining < 1) {
3607        _exception = 1;
3608        _exceptionType = "java/lang/IllegalArgumentException";
3609        _exceptionMessage = "remaining() < 1 < needed";
3610        goto exit;
3611    }
3612    if (params == NULL) {
3613        char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
3614        params = (GLfloat *) (_paramsBase + _bufferOffset);
3615    }
3616    glGetUniformfv(
3617        (GLuint)program,
3618        (GLint)location,
3619        (GLfloat *)params
3620    );
3621
3622exit:
3623    if (_array) {
3624        _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
3625    }
3626    if (_exception) {
3627        jniThrowException(_env, _exceptionType, _exceptionMessage);
3628    }
3629}
3630
3631/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3632static void
3633android_glGetUniformiv__II_3II
3634  (JNIEnv *_env, jobject _this, jint program, jint location, jintArray params_ref, jint offset) {
3635    jint _exception = 0;
3636    const char * _exceptionType = NULL;
3637    const char * _exceptionMessage = NULL;
3638    GLint *params_base = (GLint *) 0;
3639    jint _remaining;
3640    GLint *params = (GLint *) 0;
3641
3642    if (!params_ref) {
3643        _exception = 1;
3644        _exceptionType = "java/lang/IllegalArgumentException";
3645        _exceptionMessage = "params == null";
3646        goto exit;
3647    }
3648    if (offset < 0) {
3649        _exception = 1;
3650        _exceptionType = "java/lang/IllegalArgumentException";
3651        _exceptionMessage = "offset < 0";
3652        goto exit;
3653    }
3654    _remaining = _env->GetArrayLength(params_ref) - offset;
3655    if (_remaining < 1) {
3656        _exception = 1;
3657        _exceptionType = "java/lang/IllegalArgumentException";
3658        _exceptionMessage = "length - offset < 1 < needed";
3659        goto exit;
3660    }
3661    params_base = (GLint *)
3662        _env->GetIntArrayElements(params_ref, (jboolean *)0);
3663    params = params_base + offset;
3664
3665    glGetUniformiv(
3666        (GLuint)program,
3667        (GLint)location,
3668        (GLint *)params
3669    );
3670
3671exit:
3672    if (params_base) {
3673        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
3674            _exception ? JNI_ABORT: 0);
3675    }
3676    if (_exception) {
3677        jniThrowException(_env, _exceptionType, _exceptionMessage);
3678    }
3679}
3680
3681/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3682static void
3683android_glGetUniformiv__IILjava_nio_IntBuffer_2
3684  (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
3685    jint _exception = 0;
3686    const char * _exceptionType = NULL;
3687    const char * _exceptionMessage = NULL;
3688    jintArray _array = (jintArray) 0;
3689    jint _bufferOffset = (jint) 0;
3690    jint _remaining;
3691    GLint *params = (GLint *) 0;
3692
3693    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3694    if (_remaining < 1) {
3695        _exception = 1;
3696        _exceptionType = "java/lang/IllegalArgumentException";
3697        _exceptionMessage = "remaining() < 1 < needed";
3698        goto exit;
3699    }
3700    if (params == NULL) {
3701        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
3702        params = (GLint *) (_paramsBase + _bufferOffset);
3703    }
3704    glGetUniformiv(
3705        (GLuint)program,
3706        (GLint)location,
3707        (GLint *)params
3708    );
3709
3710exit:
3711    if (_array) {
3712        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
3713    }
3714    if (_exception) {
3715        jniThrowException(_env, _exceptionType, _exceptionMessage);
3716    }
3717}
3718
3719/* GLint glGetUniformLocation ( GLuint program, const char *name ) */
3720static jint
3721android_glGetUniformLocation__ILjava_lang_String_2
3722  (JNIEnv *_env, jobject _this, jint program, jstring name) {
3723    jint _exception = 0;
3724    const char * _exceptionType = NULL;
3725    const char * _exceptionMessage = NULL;
3726    GLint _returnValue = 0;
3727    const char* _nativename = 0;
3728
3729    if (!name) {
3730        _exception = 1;
3731        _exceptionType = "java/lang/IllegalArgumentException";
3732        _exceptionMessage = "name == null";
3733        goto exit;
3734    }
3735    _nativename = _env->GetStringUTFChars(name, 0);
3736
3737    _returnValue = glGetUniformLocation(
3738        (GLuint)program,
3739        (char *)_nativename
3740    );
3741
3742exit:
3743    if (_nativename) {
3744        _env->ReleaseStringUTFChars(name, _nativename);
3745    }
3746
3747    if (_exception) {
3748        jniThrowException(_env, _exceptionType, _exceptionMessage);
3749    }
3750    return (jint)_returnValue;
3751}
3752
3753/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3754static void
3755android_glGetVertexAttribfv__II_3FI
3756  (JNIEnv *_env, jobject _this, jint index, jint pname, jfloatArray params_ref, jint offset) {
3757    jint _exception = 0;
3758    const char * _exceptionType = NULL;
3759    const char * _exceptionMessage = NULL;
3760    GLfloat *params_base = (GLfloat *) 0;
3761    jint _remaining;
3762    GLfloat *params = (GLfloat *) 0;
3763
3764    if (!params_ref) {
3765        _exception = 1;
3766        _exceptionType = "java/lang/IllegalArgumentException";
3767        _exceptionMessage = "params == null";
3768        goto exit;
3769    }
3770    if (offset < 0) {
3771        _exception = 1;
3772        _exceptionType = "java/lang/IllegalArgumentException";
3773        _exceptionMessage = "offset < 0";
3774        goto exit;
3775    }
3776    _remaining = _env->GetArrayLength(params_ref) - offset;
3777    int _needed;
3778    switch (pname) {
3779#if defined(GL_CURRENT_VERTEX_ATTRIB)
3780        case GL_CURRENT_VERTEX_ATTRIB:
3781#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3782            _needed = 4;
3783            break;
3784        default:
3785            _needed = 1;
3786            break;
3787    }
3788    if (_remaining < _needed) {
3789        _exception = 1;
3790        _exceptionType = "java/lang/IllegalArgumentException";
3791        _exceptionMessage = "length - offset < needed";
3792        goto exit;
3793    }
3794    params_base = (GLfloat *)
3795        _env->GetFloatArrayElements(params_ref, (jboolean *)0);
3796    params = params_base + offset;
3797
3798    glGetVertexAttribfv(
3799        (GLuint)index,
3800        (GLenum)pname,
3801        (GLfloat *)params
3802    );
3803
3804exit:
3805    if (params_base) {
3806        _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
3807            _exception ? JNI_ABORT: 0);
3808    }
3809    if (_exception) {
3810        jniThrowException(_env, _exceptionType, _exceptionMessage);
3811    }
3812}
3813
3814/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3815static void
3816android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2
3817  (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
3818    jint _exception = 0;
3819    const char * _exceptionType = NULL;
3820    const char * _exceptionMessage = NULL;
3821    jfloatArray _array = (jfloatArray) 0;
3822    jint _bufferOffset = (jint) 0;
3823    jint _remaining;
3824    GLfloat *params = (GLfloat *) 0;
3825
3826    params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3827    int _needed;
3828    switch (pname) {
3829#if defined(GL_CURRENT_VERTEX_ATTRIB)
3830        case GL_CURRENT_VERTEX_ATTRIB:
3831#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3832            _needed = 4;
3833            break;
3834        default:
3835            _needed = 1;
3836            break;
3837    }
3838    if (_remaining < _needed) {
3839        _exception = 1;
3840        _exceptionType = "java/lang/IllegalArgumentException";
3841        _exceptionMessage = "remaining() < needed";
3842        goto exit;
3843    }
3844    if (params == NULL) {
3845        char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
3846        params = (GLfloat *) (_paramsBase + _bufferOffset);
3847    }
3848    glGetVertexAttribfv(
3849        (GLuint)index,
3850        (GLenum)pname,
3851        (GLfloat *)params
3852    );
3853
3854exit:
3855    if (_array) {
3856        _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
3857    }
3858    if (_exception) {
3859        jniThrowException(_env, _exceptionType, _exceptionMessage);
3860    }
3861}
3862
3863/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
3864static void
3865android_glGetVertexAttribiv__II_3II
3866  (JNIEnv *_env, jobject _this, jint index, jint pname, jintArray params_ref, jint offset) {
3867    jint _exception = 0;
3868    const char * _exceptionType = NULL;
3869    const char * _exceptionMessage = NULL;
3870    GLint *params_base = (GLint *) 0;
3871    jint _remaining;
3872    GLint *params = (GLint *) 0;
3873
3874    if (!params_ref) {
3875        _exception = 1;
3876        _exceptionType = "java/lang/IllegalArgumentException";
3877        _exceptionMessage = "params == null";
3878        goto exit;
3879    }
3880    if (offset < 0) {
3881        _exception = 1;
3882        _exceptionType = "java/lang/IllegalArgumentException";
3883        _exceptionMessage = "offset < 0";
3884        goto exit;
3885    }
3886    _remaining = _env->GetArrayLength(params_ref) - offset;
3887    int _needed;
3888    switch (pname) {
3889#if defined(GL_CURRENT_VERTEX_ATTRIB)
3890        case GL_CURRENT_VERTEX_ATTRIB:
3891#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3892            _needed = 4;
3893            break;
3894        default:
3895            _needed = 1;
3896            break;
3897    }
3898    if (_remaining < _needed) {
3899        _exception = 1;
3900        _exceptionType = "java/lang/IllegalArgumentException";
3901        _exceptionMessage = "length - offset < needed";
3902        goto exit;
3903    }
3904    params_base = (GLint *)
3905        _env->GetIntArrayElements(params_ref, (jboolean *)0);
3906    params = params_base + offset;
3907
3908    glGetVertexAttribiv(
3909        (GLuint)index,
3910        (GLenum)pname,
3911        (GLint *)params
3912    );
3913
3914exit:
3915    if (params_base) {
3916        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
3917            _exception ? JNI_ABORT: 0);
3918    }
3919    if (_exception) {
3920        jniThrowException(_env, _exceptionType, _exceptionMessage);
3921    }
3922}
3923
3924/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
3925static void
3926android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2
3927  (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
3928    jint _exception = 0;
3929    const char * _exceptionType = NULL;
3930    const char * _exceptionMessage = NULL;
3931    jintArray _array = (jintArray) 0;
3932    jint _bufferOffset = (jint) 0;
3933    jint _remaining;
3934    GLint *params = (GLint *) 0;
3935
3936    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3937    int _needed;
3938    switch (pname) {
3939#if defined(GL_CURRENT_VERTEX_ATTRIB)
3940        case GL_CURRENT_VERTEX_ATTRIB:
3941#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3942            _needed = 4;
3943            break;
3944        default:
3945            _needed = 1;
3946            break;
3947    }
3948    if (_remaining < _needed) {
3949        _exception = 1;
3950        _exceptionType = "java/lang/IllegalArgumentException";
3951        _exceptionMessage = "remaining() < needed";
3952        goto exit;
3953    }
3954    if (params == NULL) {
3955        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
3956        params = (GLint *) (_paramsBase + _bufferOffset);
3957    }
3958    glGetVertexAttribiv(
3959        (GLuint)index,
3960        (GLenum)pname,
3961        (GLint *)params
3962    );
3963
3964exit:
3965    if (_array) {
3966        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
3967    }
3968    if (_exception) {
3969        jniThrowException(_env, _exceptionType, _exceptionMessage);
3970    }
3971}
3972
3973/* void glHint ( GLenum target, GLenum mode ) */
3974static void
3975android_glHint__II
3976  (JNIEnv *_env, jobject _this, jint target, jint mode) {
3977    glHint(
3978        (GLenum)target,
3979        (GLenum)mode
3980    );
3981}
3982
3983/* GLboolean glIsBuffer ( GLuint buffer ) */
3984static jboolean
3985android_glIsBuffer__I
3986  (JNIEnv *_env, jobject _this, jint buffer) {
3987    GLboolean _returnValue;
3988    _returnValue = glIsBuffer(
3989        (GLuint)buffer
3990    );
3991    return (jboolean)_returnValue;
3992}
3993
3994/* GLboolean glIsEnabled ( GLenum cap ) */
3995static jboolean
3996android_glIsEnabled__I
3997  (JNIEnv *_env, jobject _this, jint cap) {
3998    GLboolean _returnValue;
3999    _returnValue = glIsEnabled(
4000        (GLenum)cap
4001    );
4002    return (jboolean)_returnValue;
4003}
4004
4005/* GLboolean glIsFramebuffer ( GLuint framebuffer ) */
4006static jboolean
4007android_glIsFramebuffer__I
4008  (JNIEnv *_env, jobject _this, jint framebuffer) {
4009    GLboolean _returnValue;
4010    _returnValue = glIsFramebuffer(
4011        (GLuint)framebuffer
4012    );
4013    return (jboolean)_returnValue;
4014}
4015
4016/* GLboolean glIsProgram ( GLuint program ) */
4017static jboolean
4018android_glIsProgram__I
4019  (JNIEnv *_env, jobject _this, jint program) {
4020    GLboolean _returnValue;
4021    _returnValue = glIsProgram(
4022        (GLuint)program
4023    );
4024    return (jboolean)_returnValue;
4025}
4026
4027/* GLboolean glIsRenderbuffer ( GLuint renderbuffer ) */
4028static jboolean
4029android_glIsRenderbuffer__I
4030  (JNIEnv *_env, jobject _this, jint renderbuffer) {
4031    GLboolean _returnValue;
4032    _returnValue = glIsRenderbuffer(
4033        (GLuint)renderbuffer
4034    );
4035    return (jboolean)_returnValue;
4036}
4037
4038/* GLboolean glIsShader ( GLuint shader ) */
4039static jboolean
4040android_glIsShader__I
4041  (JNIEnv *_env, jobject _this, jint shader) {
4042    GLboolean _returnValue;
4043    _returnValue = glIsShader(
4044        (GLuint)shader
4045    );
4046    return (jboolean)_returnValue;
4047}
4048
4049/* GLboolean glIsTexture ( GLuint texture ) */
4050static jboolean
4051android_glIsTexture__I
4052  (JNIEnv *_env, jobject _this, jint texture) {
4053    GLboolean _returnValue;
4054    _returnValue = glIsTexture(
4055        (GLuint)texture
4056    );
4057    return (jboolean)_returnValue;
4058}
4059
4060/* void glLineWidth ( GLfloat width ) */
4061static void
4062android_glLineWidth__F
4063  (JNIEnv *_env, jobject _this, jfloat width) {
4064    glLineWidth(
4065        (GLfloat)width
4066    );
4067}
4068
4069/* void glLinkProgram ( GLuint program ) */
4070static void
4071android_glLinkProgram__I
4072  (JNIEnv *_env, jobject _this, jint program) {
4073    glLinkProgram(
4074        (GLuint)program
4075    );
4076}
4077
4078/* void glPixelStorei ( GLenum pname, GLint param ) */
4079static void
4080android_glPixelStorei__II
4081  (JNIEnv *_env, jobject _this, jint pname, jint param) {
4082    glPixelStorei(
4083        (GLenum)pname,
4084        (GLint)param
4085    );
4086}
4087
4088/* void glPolygonOffset ( GLfloat factor, GLfloat units ) */
4089static void
4090android_glPolygonOffset__FF
4091  (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) {
4092    glPolygonOffset(
4093        (GLfloat)factor,
4094        (GLfloat)units
4095    );
4096}
4097
4098/* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */
4099static void
4100android_glReadPixels__IIIIIILjava_nio_Buffer_2
4101  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) {
4102    jarray _array = (jarray) 0;
4103    jint _bufferOffset = (jint) 0;
4104    jint _remaining;
4105    GLvoid *pixels = (GLvoid *) 0;
4106
4107    pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
4108    if (pixels == NULL) {
4109        char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4110        pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
4111    }
4112    glReadPixels(
4113        (GLint)x,
4114        (GLint)y,
4115        (GLsizei)width,
4116        (GLsizei)height,
4117        (GLenum)format,
4118        (GLenum)type,
4119        (GLvoid *)pixels
4120    );
4121    if (_array) {
4122        releasePointer(_env, _array, pixels, JNI_TRUE);
4123    }
4124}
4125
4126/* void glReleaseShaderCompiler ( void ) */
4127static void
4128android_glReleaseShaderCompiler__
4129  (JNIEnv *_env, jobject _this) {
4130    glReleaseShaderCompiler();
4131}
4132
4133/* void glRenderbufferStorage ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) */
4134static void
4135android_glRenderbufferStorage__IIII
4136  (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint width, jint height) {
4137    glRenderbufferStorage(
4138        (GLenum)target,
4139        (GLenum)internalformat,
4140        (GLsizei)width,
4141        (GLsizei)height
4142    );
4143}
4144
4145/* void glSampleCoverage ( GLclampf value, GLboolean invert ) */
4146static void
4147android_glSampleCoverage__FZ
4148  (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) {
4149    glSampleCoverage(
4150        (GLclampf)value,
4151        (GLboolean)invert
4152    );
4153}
4154
4155/* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */
4156static void
4157android_glScissor__IIII
4158  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
4159    glScissor(
4160        (GLint)x,
4161        (GLint)y,
4162        (GLsizei)width,
4163        (GLsizei)height
4164    );
4165}
4166
4167/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
4168static void
4169android_glShaderBinary__I_3IIILjava_nio_Buffer_2I
4170  (JNIEnv *_env, jobject _this, jint n, jintArray shaders_ref, jint offset, jint binaryformat, jobject binary_buf, jint length) {
4171    jint _exception = 0;
4172    const char * _exceptionType = NULL;
4173    const char * _exceptionMessage = NULL;
4174    jarray _array = (jarray) 0;
4175    jint _bufferOffset = (jint) 0;
4176    GLuint *shaders_base = (GLuint *) 0;
4177    jint _shadersRemaining;
4178    GLuint *shaders = (GLuint *) 0;
4179    jint _binaryRemaining;
4180    GLvoid *binary = (GLvoid *) 0;
4181
4182    if (!shaders_ref) {
4183        _exception = 1;
4184        _exceptionType = "java/lang/IllegalArgumentException";
4185        _exceptionMessage = "shaders == null";
4186        goto exit;
4187    }
4188    if (offset < 0) {
4189        _exception = 1;
4190        _exceptionType = "java/lang/IllegalArgumentException";
4191        _exceptionMessage = "offset < 0";
4192        goto exit;
4193    }
4194    _shadersRemaining = _env->GetArrayLength(shaders_ref) - offset;
4195    shaders_base = (GLuint *)
4196        _env->GetIntArrayElements(shaders_ref, (jboolean *)0);
4197    shaders = shaders_base + offset;
4198
4199    binary = (GLvoid *)getPointer(_env, binary_buf, (jarray*)&_array, &_binaryRemaining, &_bufferOffset);
4200    if (_binaryRemaining < length) {
4201        _exception = 1;
4202        _exceptionType = "java/lang/IllegalArgumentException";
4203        _exceptionMessage = "remaining() < length < needed";
4204        goto exit;
4205    }
4206    if (binary == NULL) {
4207        char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4208        binary = (GLvoid *) (_binaryBase + _bufferOffset);
4209    }
4210    glShaderBinary(
4211        (GLsizei)n,
4212        (GLuint *)shaders,
4213        (GLenum)binaryformat,
4214        (GLvoid *)binary,
4215        (GLsizei)length
4216    );
4217
4218exit:
4219    if (_array) {
4220        releasePointer(_env, _array, binary, JNI_FALSE);
4221    }
4222    if (shaders_base) {
4223        _env->ReleaseIntArrayElements(shaders_ref, (jint*)shaders_base,
4224            JNI_ABORT);
4225    }
4226    if (_exception) {
4227        jniThrowException(_env, _exceptionType, _exceptionMessage);
4228    }
4229}
4230
4231/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
4232static void
4233android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I
4234  (JNIEnv *_env, jobject _this, jint n, jobject shaders_buf, jint binaryformat, jobject binary_buf, jint length) {
4235    jint _exception = 0;
4236    const char * _exceptionType = NULL;
4237    const char * _exceptionMessage = NULL;
4238    jintArray _shadersArray = (jintArray) 0;
4239    jint _shadersBufferOffset = (jint) 0;
4240    jintArray _binaryArray = (jintArray) 0;
4241    jint _binaryBufferOffset = (jint) 0;
4242    jint _shadersRemaining;
4243    GLuint *shaders = (GLuint *) 0;
4244    jint _binaryRemaining;
4245    GLvoid *binary = (GLvoid *) 0;
4246
4247    shaders = (GLuint *)getPointer(_env, shaders_buf, (jarray*)&_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
4248    binary = (GLvoid *)getPointer(_env, binary_buf, (jarray*)&_binaryArray, &_binaryRemaining, &_binaryBufferOffset);
4249    if (_binaryRemaining < length) {
4250        _exception = 1;
4251        _exceptionType = "java/lang/IllegalArgumentException";
4252        _exceptionMessage = "remaining() < length < needed";
4253        goto exit;
4254    }
4255    if (shaders == NULL) {
4256        char * _shadersBase = (char *)_env->GetIntArrayElements(_shadersArray, (jboolean *) 0);
4257        shaders = (GLuint *) (_shadersBase + _shadersBufferOffset);
4258    }
4259    if (binary == NULL) {
4260        char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_binaryArray, (jboolean *) 0);
4261        binary = (GLvoid *) (_binaryBase + _binaryBufferOffset);
4262    }
4263    glShaderBinary(
4264        (GLsizei)n,
4265        (GLuint *)shaders,
4266        (GLenum)binaryformat,
4267        (GLvoid *)binary,
4268        (GLsizei)length
4269    );
4270
4271exit:
4272    if (_binaryArray) {
4273        releasePointer(_env, _binaryArray, binary, JNI_FALSE);
4274    }
4275    if (_shadersArray) {
4276        _env->ReleaseIntArrayElements(_shadersArray, (jint*)shaders, JNI_ABORT);
4277    }
4278    if (_exception) {
4279        jniThrowException(_env, _exceptionType, _exceptionMessage);
4280    }
4281}
4282
4283
4284/* void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint * length ) */
4285static
4286void
4287android_glShaderSource
4288    (JNIEnv *_env, jobject _this, jint shader, jstring string) {
4289
4290    if (!string) {
4291        jniThrowException(_env, "java/lang/IllegalArgumentException", "string == null");
4292        return;
4293    }
4294
4295    const char* nativeString = _env->GetStringUTFChars(string, 0);
4296    const char* strings[] = {nativeString};
4297    glShaderSource(shader, 1, strings, 0);
4298    _env->ReleaseStringUTFChars(string, nativeString);
4299}
4300/* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */
4301static void
4302android_glStencilFunc__III
4303  (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) {
4304    glStencilFunc(
4305        (GLenum)func,
4306        (GLint)ref,
4307        (GLuint)mask
4308    );
4309}
4310
4311/* void glStencilFuncSeparate ( GLenum face, GLenum func, GLint ref, GLuint mask ) */
4312static void
4313android_glStencilFuncSeparate__IIII
4314  (JNIEnv *_env, jobject _this, jint face, jint func, jint ref, jint mask) {
4315    glStencilFuncSeparate(
4316        (GLenum)face,
4317        (GLenum)func,
4318        (GLint)ref,
4319        (GLuint)mask
4320    );
4321}
4322
4323/* void glStencilMask ( GLuint mask ) */
4324static void
4325android_glStencilMask__I
4326  (JNIEnv *_env, jobject _this, jint mask) {
4327    glStencilMask(
4328        (GLuint)mask
4329    );
4330}
4331
4332/* void glStencilMaskSeparate ( GLenum face, GLuint mask ) */
4333static void
4334android_glStencilMaskSeparate__II
4335  (JNIEnv *_env, jobject _this, jint face, jint mask) {
4336    glStencilMaskSeparate(
4337        (GLenum)face,
4338        (GLuint)mask
4339    );
4340}
4341
4342/* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */
4343static void
4344android_glStencilOp__III
4345  (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) {
4346    glStencilOp(
4347        (GLenum)fail,
4348        (GLenum)zfail,
4349        (GLenum)zpass
4350    );
4351}
4352
4353/* void glStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) */
4354static void
4355android_glStencilOpSeparate__IIII
4356  (JNIEnv *_env, jobject _this, jint face, jint fail, jint zfail, jint zpass) {
4357    glStencilOpSeparate(
4358        (GLenum)face,
4359        (GLenum)fail,
4360        (GLenum)zfail,
4361        (GLenum)zpass
4362    );
4363}
4364
4365/* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */
4366static void
4367android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2
4368  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) {
4369    jarray _array = (jarray) 0;
4370    jint _bufferOffset = (jint) 0;
4371    jint _remaining;
4372    GLvoid *pixels = (GLvoid *) 0;
4373
4374    if (pixels_buf) {
4375        pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
4376    }
4377    if (pixels_buf && pixels == NULL) {
4378        char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4379        pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
4380    }
4381    glTexImage2D(
4382        (GLenum)target,
4383        (GLint)level,
4384        (GLint)internalformat,
4385        (GLsizei)width,
4386        (GLsizei)height,
4387        (GLint)border,
4388        (GLenum)format,
4389        (GLenum)type,
4390        (GLvoid *)pixels
4391    );
4392    if (_array) {
4393        releasePointer(_env, _array, pixels, JNI_FALSE);
4394    }
4395}
4396
4397/* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */
4398static void
4399android_glTexParameterf__IIF
4400  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
4401    glTexParameterf(
4402        (GLenum)target,
4403        (GLenum)pname,
4404        (GLfloat)param
4405    );
4406}
4407
4408/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
4409static void
4410android_glTexParameterfv__II_3FI
4411  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
4412    jint _exception = 0;
4413    const char * _exceptionType = NULL;
4414    const char * _exceptionMessage = NULL;
4415    GLfloat *params_base = (GLfloat *) 0;
4416    jint _remaining;
4417    GLfloat *params = (GLfloat *) 0;
4418
4419    if (!params_ref) {
4420        _exception = 1;
4421        _exceptionType = "java/lang/IllegalArgumentException";
4422        _exceptionMessage = "params == null";
4423        goto exit;
4424    }
4425    if (offset < 0) {
4426        _exception = 1;
4427        _exceptionType = "java/lang/IllegalArgumentException";
4428        _exceptionMessage = "offset < 0";
4429        goto exit;
4430    }
4431    _remaining = _env->GetArrayLength(params_ref) - offset;
4432    if (_remaining < 1) {
4433        _exception = 1;
4434        _exceptionType = "java/lang/IllegalArgumentException";
4435        _exceptionMessage = "length - offset < 1 < needed";
4436        goto exit;
4437    }
4438    params_base = (GLfloat *)
4439        _env->GetFloatArrayElements(params_ref, (jboolean *)0);
4440    params = params_base + offset;
4441
4442    glTexParameterfv(
4443        (GLenum)target,
4444        (GLenum)pname,
4445        (GLfloat *)params
4446    );
4447
4448exit:
4449    if (params_base) {
4450        _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
4451            JNI_ABORT);
4452    }
4453    if (_exception) {
4454        jniThrowException(_env, _exceptionType, _exceptionMessage);
4455    }
4456}
4457
4458/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
4459static void
4460android_glTexParameterfv__IILjava_nio_FloatBuffer_2
4461  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
4462    jint _exception = 0;
4463    const char * _exceptionType = NULL;
4464    const char * _exceptionMessage = NULL;
4465    jfloatArray _array = (jfloatArray) 0;
4466    jint _bufferOffset = (jint) 0;
4467    jint _remaining;
4468    GLfloat *params = (GLfloat *) 0;
4469
4470    params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
4471    if (_remaining < 1) {
4472        _exception = 1;
4473        _exceptionType = "java/lang/IllegalArgumentException";
4474        _exceptionMessage = "remaining() < 1 < needed";
4475        goto exit;
4476    }
4477    if (params == NULL) {
4478        char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
4479        params = (GLfloat *) (_paramsBase + _bufferOffset);
4480    }
4481    glTexParameterfv(
4482        (GLenum)target,
4483        (GLenum)pname,
4484        (GLfloat *)params
4485    );
4486
4487exit:
4488    if (_array) {
4489        _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
4490    }
4491    if (_exception) {
4492        jniThrowException(_env, _exceptionType, _exceptionMessage);
4493    }
4494}
4495
4496/* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */
4497static void
4498android_glTexParameteri__III
4499  (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
4500    glTexParameteri(
4501        (GLenum)target,
4502        (GLenum)pname,
4503        (GLint)param
4504    );
4505}
4506
4507/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
4508static void
4509android_glTexParameteriv__II_3II
4510  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
4511    jint _exception = 0;
4512    const char * _exceptionType = NULL;
4513    const char * _exceptionMessage = NULL;
4514    GLint *params_base = (GLint *) 0;
4515    jint _remaining;
4516    GLint *params = (GLint *) 0;
4517
4518    if (!params_ref) {
4519        _exception = 1;
4520        _exceptionType = "java/lang/IllegalArgumentException";
4521        _exceptionMessage = "params == null";
4522        goto exit;
4523    }
4524    if (offset < 0) {
4525        _exception = 1;
4526        _exceptionType = "java/lang/IllegalArgumentException";
4527        _exceptionMessage = "offset < 0";
4528        goto exit;
4529    }
4530    _remaining = _env->GetArrayLength(params_ref) - offset;
4531    if (_remaining < 1) {
4532        _exception = 1;
4533        _exceptionType = "java/lang/IllegalArgumentException";
4534        _exceptionMessage = "length - offset < 1 < needed";
4535        goto exit;
4536    }
4537    params_base = (GLint *)
4538        _env->GetIntArrayElements(params_ref, (jboolean *)0);
4539    params = params_base + offset;
4540
4541    glTexParameteriv(
4542        (GLenum)target,
4543        (GLenum)pname,
4544        (GLint *)params
4545    );
4546
4547exit:
4548    if (params_base) {
4549        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
4550            JNI_ABORT);
4551    }
4552    if (_exception) {
4553        jniThrowException(_env, _exceptionType, _exceptionMessage);
4554    }
4555}
4556
4557/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
4558static void
4559android_glTexParameteriv__IILjava_nio_IntBuffer_2
4560  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
4561    jint _exception = 0;
4562    const char * _exceptionType = NULL;
4563    const char * _exceptionMessage = NULL;
4564    jintArray _array = (jintArray) 0;
4565    jint _bufferOffset = (jint) 0;
4566    jint _remaining;
4567    GLint *params = (GLint *) 0;
4568
4569    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
4570    if (_remaining < 1) {
4571        _exception = 1;
4572        _exceptionType = "java/lang/IllegalArgumentException";
4573        _exceptionMessage = "remaining() < 1 < needed";
4574        goto exit;
4575    }
4576    if (params == NULL) {
4577        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
4578        params = (GLint *) (_paramsBase + _bufferOffset);
4579    }
4580    glTexParameteriv(
4581        (GLenum)target,
4582        (GLenum)pname,
4583        (GLint *)params
4584    );
4585
4586exit:
4587    if (_array) {
4588        _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
4589    }
4590    if (_exception) {
4591        jniThrowException(_env, _exceptionType, _exceptionMessage);
4592    }
4593}
4594
4595/* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */
4596static void
4597android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
4598  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) {
4599    jarray _array = (jarray) 0;
4600    jint _bufferOffset = (jint) 0;
4601    jint _remaining;
4602    GLvoid *pixels = (GLvoid *) 0;
4603
4604    if (pixels_buf) {
4605        pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
4606    }
4607    if (pixels_buf && pixels == NULL) {
4608        char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4609        pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
4610    }
4611    glTexSubImage2D(
4612        (GLenum)target,
4613        (GLint)level,
4614        (GLint)xoffset,
4615        (GLint)yoffset,
4616        (GLsizei)width,
4617        (GLsizei)height,
4618        (GLenum)format,
4619        (GLenum)type,
4620        (GLvoid *)pixels
4621    );
4622    if (_array) {
4623        releasePointer(_env, _array, pixels, JNI_FALSE);
4624    }
4625}
4626
4627/* void glUniform1f ( GLint location, GLfloat x ) */
4628static void
4629android_glUniform1f__IF
4630  (JNIEnv *_env, jobject _this, jint location, jfloat x) {
4631    glUniform1f(
4632        (GLint)location,
4633        (GLfloat)x
4634    );
4635}
4636
4637/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
4638static void
4639android_glUniform1fv__II_3FI
4640  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
4641    jint _exception = 0;
4642    const char * _exceptionType = NULL;
4643    const char * _exceptionMessage = NULL;
4644    GLfloat *v_base = (GLfloat *) 0;
4645    jint _remaining;
4646    GLfloat *v = (GLfloat *) 0;
4647
4648    if (!v_ref) {
4649        _exception = 1;
4650        _exceptionType = "java/lang/IllegalArgumentException";
4651        _exceptionMessage = "v == null";
4652        goto exit;
4653    }
4654    if (offset < 0) {
4655        _exception = 1;
4656        _exceptionType = "java/lang/IllegalArgumentException";
4657        _exceptionMessage = "offset < 0";
4658        goto exit;
4659    }
4660    _remaining = _env->GetArrayLength(v_ref) - offset;
4661    if (_remaining < count) {
4662        _exception = 1;
4663        _exceptionType = "java/lang/IllegalArgumentException";
4664        _exceptionMessage = "length - offset < count < needed";
4665        goto exit;
4666    }
4667    v_base = (GLfloat *)
4668        _env->GetFloatArrayElements(v_ref, (jboolean *)0);
4669    v = v_base + offset;
4670
4671    glUniform1fv(
4672        (GLint)location,
4673        (GLsizei)count,
4674        (GLfloat *)v
4675    );
4676
4677exit:
4678    if (v_base) {
4679        _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
4680            JNI_ABORT);
4681    }
4682    if (_exception) {
4683        jniThrowException(_env, _exceptionType, _exceptionMessage);
4684    }
4685}
4686
4687/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
4688static void
4689android_glUniform1fv__IILjava_nio_FloatBuffer_2
4690  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
4691    jint _exception = 0;
4692    const char * _exceptionType = NULL;
4693    const char * _exceptionMessage = NULL;
4694    jfloatArray _array = (jfloatArray) 0;
4695    jint _bufferOffset = (jint) 0;
4696    jint _remaining;
4697    GLfloat *v = (GLfloat *) 0;
4698
4699    v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
4700    if (_remaining < count) {
4701        _exception = 1;
4702        _exceptionType = "java/lang/IllegalArgumentException";
4703        _exceptionMessage = "remaining() < count < needed";
4704        goto exit;
4705    }
4706    if (v == NULL) {
4707        char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
4708        v = (GLfloat *) (_vBase + _bufferOffset);
4709    }
4710    glUniform1fv(
4711        (GLint)location,
4712        (GLsizei)count,
4713        (GLfloat *)v
4714    );
4715
4716exit:
4717    if (_array) {
4718        _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
4719    }
4720    if (_exception) {
4721        jniThrowException(_env, _exceptionType, _exceptionMessage);
4722    }
4723}
4724
4725/* void glUniform1i ( GLint location, GLint x ) */
4726static void
4727android_glUniform1i__II
4728  (JNIEnv *_env, jobject _this, jint location, jint x) {
4729    glUniform1i(
4730        (GLint)location,
4731        (GLint)x
4732    );
4733}
4734
4735/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
4736static void
4737android_glUniform1iv__II_3II
4738  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
4739    jint _exception = 0;
4740    const char * _exceptionType = NULL;
4741    const char * _exceptionMessage = NULL;
4742    GLint *v_base = (GLint *) 0;
4743    jint _remaining;
4744    GLint *v = (GLint *) 0;
4745
4746    if (!v_ref) {
4747        _exception = 1;
4748        _exceptionType = "java/lang/IllegalArgumentException";
4749        _exceptionMessage = "v == null";
4750        goto exit;
4751    }
4752    if (offset < 0) {
4753        _exception = 1;
4754        _exceptionType = "java/lang/IllegalArgumentException";
4755        _exceptionMessage = "offset < 0";
4756        goto exit;
4757    }
4758    _remaining = _env->GetArrayLength(v_ref) - offset;
4759    if (_remaining < count) {
4760        _exception = 1;
4761        _exceptionType = "java/lang/IllegalArgumentException";
4762        _exceptionMessage = "length - offset < count < needed";
4763        goto exit;
4764    }
4765    v_base = (GLint *)
4766        _env->GetIntArrayElements(v_ref, (jboolean *)0);
4767    v = v_base + offset;
4768
4769    glUniform1iv(
4770        (GLint)location,
4771        (GLsizei)count,
4772        (GLint *)v
4773    );
4774
4775exit:
4776    if (v_base) {
4777        _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
4778            JNI_ABORT);
4779    }
4780    if (_exception) {
4781        jniThrowException(_env, _exceptionType, _exceptionMessage);
4782    }
4783}
4784
4785/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
4786static void
4787android_glUniform1iv__IILjava_nio_IntBuffer_2
4788  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
4789    jint _exception = 0;
4790    const char * _exceptionType = NULL;
4791    const char * _exceptionMessage = NULL;
4792    jintArray _array = (jintArray) 0;
4793    jint _bufferOffset = (jint) 0;
4794    jint _remaining;
4795    GLint *v = (GLint *) 0;
4796
4797    v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
4798    if (_remaining < count) {
4799        _exception = 1;
4800        _exceptionType = "java/lang/IllegalArgumentException";
4801        _exceptionMessage = "remaining() < count < needed";
4802        goto exit;
4803    }
4804    if (v == NULL) {
4805        char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
4806        v = (GLint *) (_vBase + _bufferOffset);
4807    }
4808    glUniform1iv(
4809        (GLint)location,
4810        (GLsizei)count,
4811        (GLint *)v
4812    );
4813
4814exit:
4815    if (_array) {
4816        _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
4817    }
4818    if (_exception) {
4819        jniThrowException(_env, _exceptionType, _exceptionMessage);
4820    }
4821}
4822
4823/* void glUniform2f ( GLint location, GLfloat x, GLfloat y ) */
4824static void
4825android_glUniform2f__IFF
4826  (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y) {
4827    glUniform2f(
4828        (GLint)location,
4829        (GLfloat)x,
4830        (GLfloat)y
4831    );
4832}
4833
4834/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
4835static void
4836android_glUniform2fv__II_3FI
4837  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
4838    jint _exception = 0;
4839    const char * _exceptionType = NULL;
4840    const char * _exceptionMessage = NULL;
4841    GLfloat *v_base = (GLfloat *) 0;
4842    jint _remaining;
4843    GLfloat *v = (GLfloat *) 0;
4844
4845    if (!v_ref) {
4846        _exception = 1;
4847        _exceptionType = "java/lang/IllegalArgumentException";
4848        _exceptionMessage = "v == null";
4849        goto exit;
4850    }
4851    if (offset < 0) {
4852        _exception = 1;
4853        _exceptionType = "java/lang/IllegalArgumentException";
4854        _exceptionMessage = "offset < 0";
4855        goto exit;
4856    }
4857    _remaining = _env->GetArrayLength(v_ref) - offset;
4858    if (_remaining < count*2) {
4859        _exception = 1;
4860        _exceptionType = "java/lang/IllegalArgumentException";
4861        _exceptionMessage = "length - offset < count*2 < needed";
4862        goto exit;
4863    }
4864    v_base = (GLfloat *)
4865        _env->GetFloatArrayElements(v_ref, (jboolean *)0);
4866    v = v_base + offset;
4867
4868    glUniform2fv(
4869        (GLint)location,
4870        (GLsizei)count,
4871        (GLfloat *)v
4872    );
4873
4874exit:
4875    if (v_base) {
4876        _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
4877            JNI_ABORT);
4878    }
4879    if (_exception) {
4880        jniThrowException(_env, _exceptionType, _exceptionMessage);
4881    }
4882}
4883
4884/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
4885static void
4886android_glUniform2fv__IILjava_nio_FloatBuffer_2
4887  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
4888    jint _exception = 0;
4889    const char * _exceptionType = NULL;
4890    const char * _exceptionMessage = NULL;
4891    jfloatArray _array = (jfloatArray) 0;
4892    jint _bufferOffset = (jint) 0;
4893    jint _remaining;
4894    GLfloat *v = (GLfloat *) 0;
4895
4896    v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
4897    if (_remaining < count*2) {
4898        _exception = 1;
4899        _exceptionType = "java/lang/IllegalArgumentException";
4900        _exceptionMessage = "remaining() < count*2 < needed";
4901        goto exit;
4902    }
4903    if (v == NULL) {
4904        char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
4905        v = (GLfloat *) (_vBase + _bufferOffset);
4906    }
4907    glUniform2fv(
4908        (GLint)location,
4909        (GLsizei)count,
4910        (GLfloat *)v
4911    );
4912
4913exit:
4914    if (_array) {
4915        _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
4916    }
4917    if (_exception) {
4918        jniThrowException(_env, _exceptionType, _exceptionMessage);
4919    }
4920}
4921
4922/* void glUniform2i ( GLint location, GLint x, GLint y ) */
4923static void
4924android_glUniform2i__III
4925  (JNIEnv *_env, jobject _this, jint location, jint x, jint y) {
4926    glUniform2i(
4927        (GLint)location,
4928        (GLint)x,
4929        (GLint)y
4930    );
4931}
4932
4933/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
4934static void
4935android_glUniform2iv__II_3II
4936  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
4937    jint _exception = 0;
4938    const char * _exceptionType = NULL;
4939    const char * _exceptionMessage = NULL;
4940    GLint *v_base = (GLint *) 0;
4941    jint _remaining;
4942    GLint *v = (GLint *) 0;
4943
4944    if (!v_ref) {
4945        _exception = 1;
4946        _exceptionType = "java/lang/IllegalArgumentException";
4947        _exceptionMessage = "v == null";
4948        goto exit;
4949    }
4950    if (offset < 0) {
4951        _exception = 1;
4952        _exceptionType = "java/lang/IllegalArgumentException";
4953        _exceptionMessage = "offset < 0";
4954        goto exit;
4955    }
4956    _remaining = _env->GetArrayLength(v_ref) - offset;
4957    if (_remaining < count*2) {
4958        _exception = 1;
4959        _exceptionType = "java/lang/IllegalArgumentException";
4960        _exceptionMessage = "length - offset < count*2 < needed";
4961        goto exit;
4962    }
4963    v_base = (GLint *)
4964        _env->GetIntArrayElements(v_ref, (jboolean *)0);
4965    v = v_base + offset;
4966
4967    glUniform2iv(
4968        (GLint)location,
4969        (GLsizei)count,
4970        (GLint *)v
4971    );
4972
4973exit:
4974    if (v_base) {
4975        _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
4976            JNI_ABORT);
4977    }
4978    if (_exception) {
4979        jniThrowException(_env, _exceptionType, _exceptionMessage);
4980    }
4981}
4982
4983/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
4984static void
4985android_glUniform2iv__IILjava_nio_IntBuffer_2
4986  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
4987    jint _exception = 0;
4988    const char * _exceptionType = NULL;
4989    const char * _exceptionMessage = NULL;
4990    jintArray _array = (jintArray) 0;
4991    jint _bufferOffset = (jint) 0;
4992    jint _remaining;
4993    GLint *v = (GLint *) 0;
4994
4995    v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
4996    if (_remaining < count*2) {
4997        _exception = 1;
4998        _exceptionType = "java/lang/IllegalArgumentException";
4999        _exceptionMessage = "remaining() < count*2 < needed";
5000        goto exit;
5001    }
5002    if (v == NULL) {
5003        char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
5004        v = (GLint *) (_vBase + _bufferOffset);
5005    }
5006    glUniform2iv(
5007        (GLint)location,
5008        (GLsizei)count,
5009        (GLint *)v
5010    );
5011
5012exit:
5013    if (_array) {
5014        _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
5015    }
5016    if (_exception) {
5017        jniThrowException(_env, _exceptionType, _exceptionMessage);
5018    }
5019}
5020
5021/* void glUniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z ) */
5022static void
5023android_glUniform3f__IFFF
5024  (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z) {
5025    glUniform3f(
5026        (GLint)location,
5027        (GLfloat)x,
5028        (GLfloat)y,
5029        (GLfloat)z
5030    );
5031}
5032
5033/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
5034static void
5035android_glUniform3fv__II_3FI
5036  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
5037    jint _exception = 0;
5038    const char * _exceptionType = NULL;
5039    const char * _exceptionMessage = NULL;
5040    GLfloat *v_base = (GLfloat *) 0;
5041    jint _remaining;
5042    GLfloat *v = (GLfloat *) 0;
5043
5044    if (!v_ref) {
5045        _exception = 1;
5046        _exceptionType = "java/lang/IllegalArgumentException";
5047        _exceptionMessage = "v == null";
5048        goto exit;
5049    }
5050    if (offset < 0) {
5051        _exception = 1;
5052        _exceptionType = "java/lang/IllegalArgumentException";
5053        _exceptionMessage = "offset < 0";
5054        goto exit;
5055    }
5056    _remaining = _env->GetArrayLength(v_ref) - offset;
5057    if (_remaining < count*3) {
5058        _exception = 1;
5059        _exceptionType = "java/lang/IllegalArgumentException";
5060        _exceptionMessage = "length - offset < count*3 < needed";
5061        goto exit;
5062    }
5063    v_base = (GLfloat *)
5064        _env->GetFloatArrayElements(v_ref, (jboolean *)0);
5065    v = v_base + offset;
5066
5067    glUniform3fv(
5068        (GLint)location,
5069        (GLsizei)count,
5070        (GLfloat *)v
5071    );
5072
5073exit:
5074    if (v_base) {
5075        _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
5076            JNI_ABORT);
5077    }
5078    if (_exception) {
5079        jniThrowException(_env, _exceptionType, _exceptionMessage);
5080    }
5081}
5082
5083/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
5084static void
5085android_glUniform3fv__IILjava_nio_FloatBuffer_2
5086  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
5087    jint _exception = 0;
5088    const char * _exceptionType = NULL;
5089    const char * _exceptionMessage = NULL;
5090    jfloatArray _array = (jfloatArray) 0;
5091    jint _bufferOffset = (jint) 0;
5092    jint _remaining;
5093    GLfloat *v = (GLfloat *) 0;
5094
5095    v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
5096    if (_remaining < count*3) {
5097        _exception = 1;
5098        _exceptionType = "java/lang/IllegalArgumentException";
5099        _exceptionMessage = "remaining() < count*3 < needed";
5100        goto exit;
5101    }
5102    if (v == NULL) {
5103        char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
5104        v = (GLfloat *) (_vBase + _bufferOffset);
5105    }
5106    glUniform3fv(
5107        (GLint)location,
5108        (GLsizei)count,
5109        (GLfloat *)v
5110    );
5111
5112exit:
5113    if (_array) {
5114        _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
5115    }
5116    if (_exception) {
5117        jniThrowException(_env, _exceptionType, _exceptionMessage);
5118    }
5119}
5120
5121/* void glUniform3i ( GLint location, GLint x, GLint y, GLint z ) */
5122static void
5123android_glUniform3i__IIII
5124  (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z) {
5125    glUniform3i(
5126        (GLint)location,
5127        (GLint)x,
5128        (GLint)y,
5129        (GLint)z
5130    );
5131}
5132
5133/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
5134static void
5135android_glUniform3iv__II_3II
5136  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
5137    jint _exception = 0;
5138    const char * _exceptionType = NULL;
5139    const char * _exceptionMessage = NULL;
5140    GLint *v_base = (GLint *) 0;
5141    jint _remaining;
5142    GLint *v = (GLint *) 0;
5143
5144    if (!v_ref) {
5145        _exception = 1;
5146        _exceptionType = "java/lang/IllegalArgumentException";
5147        _exceptionMessage = "v == null";
5148        goto exit;
5149    }
5150    if (offset < 0) {
5151        _exception = 1;
5152        _exceptionType = "java/lang/IllegalArgumentException";
5153        _exceptionMessage = "offset < 0";
5154        goto exit;
5155    }
5156    _remaining = _env->GetArrayLength(v_ref) - offset;
5157    if (_remaining < count*3) {
5158        _exception = 1;
5159        _exceptionType = "java/lang/IllegalArgumentException";
5160        _exceptionMessage = "length - offset < count*3 < needed";
5161        goto exit;
5162    }
5163    v_base = (GLint *)
5164        _env->GetIntArrayElements(v_ref, (jboolean *)0);
5165    v = v_base + offset;
5166
5167    glUniform3iv(
5168        (GLint)location,
5169        (GLsizei)count,
5170        (GLint *)v
5171    );
5172
5173exit:
5174    if (v_base) {
5175        _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
5176            JNI_ABORT);
5177    }
5178    if (_exception) {
5179        jniThrowException(_env, _exceptionType, _exceptionMessage);
5180    }
5181}
5182
5183/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
5184static void
5185android_glUniform3iv__IILjava_nio_IntBuffer_2
5186  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
5187    jint _exception = 0;
5188    const char * _exceptionType = NULL;
5189    const char * _exceptionMessage = NULL;
5190    jintArray _array = (jintArray) 0;
5191    jint _bufferOffset = (jint) 0;
5192    jint _remaining;
5193    GLint *v = (GLint *) 0;
5194
5195    v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
5196    if (_remaining < count*3) {
5197        _exception = 1;
5198        _exceptionType = "java/lang/IllegalArgumentException";
5199        _exceptionMessage = "remaining() < count*3 < needed";
5200        goto exit;
5201    }
5202    if (v == NULL) {
5203        char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
5204        v = (GLint *) (_vBase + _bufferOffset);
5205    }
5206    glUniform3iv(
5207        (GLint)location,
5208        (GLsizei)count,
5209        (GLint *)v
5210    );
5211
5212exit:
5213    if (_array) {
5214        _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
5215    }
5216    if (_exception) {
5217        jniThrowException(_env, _exceptionType, _exceptionMessage);
5218    }
5219}
5220
5221/* void glUniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
5222static void
5223android_glUniform4f__IFFFF
5224  (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z, jfloat w) {
5225    glUniform4f(
5226        (GLint)location,
5227        (GLfloat)x,
5228        (GLfloat)y,
5229        (GLfloat)z,
5230        (GLfloat)w
5231    );
5232}
5233
5234/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
5235static void
5236android_glUniform4fv__II_3FI
5237  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
5238    jint _exception = 0;
5239    const char * _exceptionType = NULL;
5240    const char * _exceptionMessage = NULL;
5241    GLfloat *v_base = (GLfloat *) 0;
5242    jint _remaining;
5243    GLfloat *v = (GLfloat *) 0;
5244
5245    if (!v_ref) {
5246        _exception = 1;
5247        _exceptionType = "java/lang/IllegalArgumentException";
5248        _exceptionMessage = "v == null";
5249        goto exit;
5250    }
5251    if (offset < 0) {
5252        _exception = 1;
5253        _exceptionType = "java/lang/IllegalArgumentException";
5254        _exceptionMessage = "offset < 0";
5255        goto exit;
5256    }
5257    _remaining = _env->GetArrayLength(v_ref) - offset;
5258    if (_remaining < count*4) {
5259        _exception = 1;
5260        _exceptionType = "java/lang/IllegalArgumentException";
5261        _exceptionMessage = "length - offset < count*4 < needed";
5262        goto exit;
5263    }
5264    v_base = (GLfloat *)
5265        _env->GetFloatArrayElements(v_ref, (jboolean *)0);
5266    v = v_base + offset;
5267
5268    glUniform4fv(
5269        (GLint)location,
5270        (GLsizei)count,
5271        (GLfloat *)v
5272    );
5273
5274exit:
5275    if (v_base) {
5276        _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
5277            JNI_ABORT);
5278    }
5279    if (_exception) {
5280        jniThrowException(_env, _exceptionType, _exceptionMessage);
5281    }
5282}
5283
5284/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
5285static void
5286android_glUniform4fv__IILjava_nio_FloatBuffer_2
5287  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
5288    jint _exception = 0;
5289    const char * _exceptionType = NULL;
5290    const char * _exceptionMessage = NULL;
5291    jfloatArray _array = (jfloatArray) 0;
5292    jint _bufferOffset = (jint) 0;
5293    jint _remaining;
5294    GLfloat *v = (GLfloat *) 0;
5295
5296    v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
5297    if (_remaining < count*4) {
5298        _exception = 1;
5299        _exceptionType = "java/lang/IllegalArgumentException";
5300        _exceptionMessage = "remaining() < count*4 < needed";
5301        goto exit;
5302    }
5303    if (v == NULL) {
5304        char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
5305        v = (GLfloat *) (_vBase + _bufferOffset);
5306    }
5307    glUniform4fv(
5308        (GLint)location,
5309        (GLsizei)count,
5310        (GLfloat *)v
5311    );
5312
5313exit:
5314    if (_array) {
5315        _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
5316    }
5317    if (_exception) {
5318        jniThrowException(_env, _exceptionType, _exceptionMessage);
5319    }
5320}
5321
5322/* void glUniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w ) */
5323static void
5324android_glUniform4i__IIIII
5325  (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z, jint w) {
5326    glUniform4i(
5327        (GLint)location,
5328        (GLint)x,
5329        (GLint)y,
5330        (GLint)z,
5331        (GLint)w
5332    );
5333}
5334
5335/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
5336static void
5337android_glUniform4iv__II_3II
5338  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
5339    jint _exception = 0;
5340    const char * _exceptionType = NULL;
5341    const char * _exceptionMessage = NULL;
5342    GLint *v_base = (GLint *) 0;
5343    jint _remaining;
5344    GLint *v = (GLint *) 0;
5345
5346    if (!v_ref) {
5347        _exception = 1;
5348        _exceptionType = "java/lang/IllegalArgumentException";
5349        _exceptionMessage = "v == null";
5350        goto exit;
5351    }
5352    if (offset < 0) {
5353        _exception = 1;
5354        _exceptionType = "java/lang/IllegalArgumentException";
5355        _exceptionMessage = "offset < 0";
5356        goto exit;
5357    }
5358    _remaining = _env->GetArrayLength(v_ref) - offset;
5359    if (_remaining < count*4) {
5360        _exception = 1;
5361        _exceptionType = "java/lang/IllegalArgumentException";
5362        _exceptionMessage = "length - offset < count*4 < needed";
5363        goto exit;
5364    }
5365    v_base = (GLint *)
5366        _env->GetIntArrayElements(v_ref, (jboolean *)0);
5367    v = v_base + offset;
5368
5369    glUniform4iv(
5370        (GLint)location,
5371        (GLsizei)count,
5372        (GLint *)v
5373    );
5374
5375exit:
5376    if (v_base) {
5377        _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
5378            JNI_ABORT);
5379    }
5380    if (_exception) {
5381        jniThrowException(_env, _exceptionType, _exceptionMessage);
5382    }
5383}
5384
5385/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
5386static void
5387android_glUniform4iv__IILjava_nio_IntBuffer_2
5388  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
5389    jint _exception = 0;
5390    const char * _exceptionType = NULL;
5391    const char * _exceptionMessage = NULL;
5392    jintArray _array = (jintArray) 0;
5393    jint _bufferOffset = (jint) 0;
5394    jint _remaining;
5395    GLint *v = (GLint *) 0;
5396
5397    v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
5398    if (_remaining < count*4) {
5399        _exception = 1;
5400        _exceptionType = "java/lang/IllegalArgumentException";
5401        _exceptionMessage = "remaining() < count*4 < needed";
5402        goto exit;
5403    }
5404    if (v == NULL) {
5405        char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
5406        v = (GLint *) (_vBase + _bufferOffset);
5407    }
5408    glUniform4iv(
5409        (GLint)location,
5410        (GLsizei)count,
5411        (GLint *)v
5412    );
5413
5414exit:
5415    if (_array) {
5416        _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
5417    }
5418    if (_exception) {
5419        jniThrowException(_env, _exceptionType, _exceptionMessage);
5420    }
5421}
5422
5423/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5424static void
5425android_glUniformMatrix2fv__IIZ_3FI
5426  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
5427    jint _exception = 0;
5428    const char * _exceptionType = NULL;
5429    const char * _exceptionMessage = NULL;
5430    GLfloat *value_base = (GLfloat *) 0;
5431    jint _remaining;
5432    GLfloat *value = (GLfloat *) 0;
5433
5434    if (!value_ref) {
5435        _exception = 1;
5436        _exceptionType = "java/lang/IllegalArgumentException";
5437        _exceptionMessage = "value == null";
5438        goto exit;
5439    }
5440    if (offset < 0) {
5441        _exception = 1;
5442        _exceptionType = "java/lang/IllegalArgumentException";
5443        _exceptionMessage = "offset < 0";
5444        goto exit;
5445    }
5446    _remaining = _env->GetArrayLength(value_ref) - offset;
5447    if (_remaining < count*4) {
5448        _exception = 1;
5449        _exceptionType = "java/lang/IllegalArgumentException";
5450        _exceptionMessage = "length - offset < count*4 < needed";
5451        goto exit;
5452    }
5453    value_base = (GLfloat *)
5454        _env->GetFloatArrayElements(value_ref, (jboolean *)0);
5455    value = value_base + offset;
5456
5457    glUniformMatrix2fv(
5458        (GLint)location,
5459        (GLsizei)count,
5460        (GLboolean)transpose,
5461        (GLfloat *)value
5462    );
5463
5464exit:
5465    if (value_base) {
5466        _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
5467            JNI_ABORT);
5468    }
5469    if (_exception) {
5470        jniThrowException(_env, _exceptionType, _exceptionMessage);
5471    }
5472}
5473
5474/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5475static void
5476android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2
5477  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
5478    jint _exception = 0;
5479    const char * _exceptionType = NULL;
5480    const char * _exceptionMessage = NULL;
5481    jfloatArray _array = (jfloatArray) 0;
5482    jint _bufferOffset = (jint) 0;
5483    jint _remaining;
5484    GLfloat *value = (GLfloat *) 0;
5485
5486    value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
5487    if (_remaining < count*4) {
5488        _exception = 1;
5489        _exceptionType = "java/lang/IllegalArgumentException";
5490        _exceptionMessage = "remaining() < count*4 < needed";
5491        goto exit;
5492    }
5493    if (value == NULL) {
5494        char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
5495        value = (GLfloat *) (_valueBase + _bufferOffset);
5496    }
5497    glUniformMatrix2fv(
5498        (GLint)location,
5499        (GLsizei)count,
5500        (GLboolean)transpose,
5501        (GLfloat *)value
5502    );
5503
5504exit:
5505    if (_array) {
5506        _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
5507    }
5508    if (_exception) {
5509        jniThrowException(_env, _exceptionType, _exceptionMessage);
5510    }
5511}
5512
5513/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5514static void
5515android_glUniformMatrix3fv__IIZ_3FI
5516  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
5517    jint _exception = 0;
5518    const char * _exceptionType = NULL;
5519    const char * _exceptionMessage = NULL;
5520    GLfloat *value_base = (GLfloat *) 0;
5521    jint _remaining;
5522    GLfloat *value = (GLfloat *) 0;
5523
5524    if (!value_ref) {
5525        _exception = 1;
5526        _exceptionType = "java/lang/IllegalArgumentException";
5527        _exceptionMessage = "value == null";
5528        goto exit;
5529    }
5530    if (offset < 0) {
5531        _exception = 1;
5532        _exceptionType = "java/lang/IllegalArgumentException";
5533        _exceptionMessage = "offset < 0";
5534        goto exit;
5535    }
5536    _remaining = _env->GetArrayLength(value_ref) - offset;
5537    if (_remaining < count*9) {
5538        _exception = 1;
5539        _exceptionType = "java/lang/IllegalArgumentException";
5540        _exceptionMessage = "length - offset < count*9 < needed";
5541        goto exit;
5542    }
5543    value_base = (GLfloat *)
5544        _env->GetFloatArrayElements(value_ref, (jboolean *)0);
5545    value = value_base + offset;
5546
5547    glUniformMatrix3fv(
5548        (GLint)location,
5549        (GLsizei)count,
5550        (GLboolean)transpose,
5551        (GLfloat *)value
5552    );
5553
5554exit:
5555    if (value_base) {
5556        _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
5557            JNI_ABORT);
5558    }
5559    if (_exception) {
5560        jniThrowException(_env, _exceptionType, _exceptionMessage);
5561    }
5562}
5563
5564/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5565static void
5566android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2
5567  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
5568    jint _exception = 0;
5569    const char * _exceptionType = NULL;
5570    const char * _exceptionMessage = NULL;
5571    jfloatArray _array = (jfloatArray) 0;
5572    jint _bufferOffset = (jint) 0;
5573    jint _remaining;
5574    GLfloat *value = (GLfloat *) 0;
5575
5576    value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
5577    if (_remaining < count*9) {
5578        _exception = 1;
5579        _exceptionType = "java/lang/IllegalArgumentException";
5580        _exceptionMessage = "remaining() < count*9 < needed";
5581        goto exit;
5582    }
5583    if (value == NULL) {
5584        char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
5585        value = (GLfloat *) (_valueBase + _bufferOffset);
5586    }
5587    glUniformMatrix3fv(
5588        (GLint)location,
5589        (GLsizei)count,
5590        (GLboolean)transpose,
5591        (GLfloat *)value
5592    );
5593
5594exit:
5595    if (_array) {
5596        _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
5597    }
5598    if (_exception) {
5599        jniThrowException(_env, _exceptionType, _exceptionMessage);
5600    }
5601}
5602
5603/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5604static void
5605android_glUniformMatrix4fv__IIZ_3FI
5606  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
5607    jint _exception = 0;
5608    const char * _exceptionType = NULL;
5609    const char * _exceptionMessage = NULL;
5610    GLfloat *value_base = (GLfloat *) 0;
5611    jint _remaining;
5612    GLfloat *value = (GLfloat *) 0;
5613
5614    if (!value_ref) {
5615        _exception = 1;
5616        _exceptionType = "java/lang/IllegalArgumentException";
5617        _exceptionMessage = "value == null";
5618        goto exit;
5619    }
5620    if (offset < 0) {
5621        _exception = 1;
5622        _exceptionType = "java/lang/IllegalArgumentException";
5623        _exceptionMessage = "offset < 0";
5624        goto exit;
5625    }
5626    _remaining = _env->GetArrayLength(value_ref) - offset;
5627    if (_remaining < count*16) {
5628        _exception = 1;
5629        _exceptionType = "java/lang/IllegalArgumentException";
5630        _exceptionMessage = "length - offset < count*16 < needed";
5631        goto exit;
5632    }
5633    value_base = (GLfloat *)
5634        _env->GetFloatArrayElements(value_ref, (jboolean *)0);
5635    value = value_base + offset;
5636
5637    glUniformMatrix4fv(
5638        (GLint)location,
5639        (GLsizei)count,
5640        (GLboolean)transpose,
5641        (GLfloat *)value
5642    );
5643
5644exit:
5645    if (value_base) {
5646        _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
5647            JNI_ABORT);
5648    }
5649    if (_exception) {
5650        jniThrowException(_env, _exceptionType, _exceptionMessage);
5651    }
5652}
5653
5654/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5655static void
5656android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2
5657  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
5658    jint _exception = 0;
5659    const char * _exceptionType = NULL;
5660    const char * _exceptionMessage = NULL;
5661    jfloatArray _array = (jfloatArray) 0;
5662    jint _bufferOffset = (jint) 0;
5663    jint _remaining;
5664    GLfloat *value = (GLfloat *) 0;
5665
5666    value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
5667    if (_remaining < count*16) {
5668        _exception = 1;
5669        _exceptionType = "java/lang/IllegalArgumentException";
5670        _exceptionMessage = "remaining() < count*16 < needed";
5671        goto exit;
5672    }
5673    if (value == NULL) {
5674        char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
5675        value = (GLfloat *) (_valueBase + _bufferOffset);
5676    }
5677    glUniformMatrix4fv(
5678        (GLint)location,
5679        (GLsizei)count,
5680        (GLboolean)transpose,
5681        (GLfloat *)value
5682    );
5683
5684exit:
5685    if (_array) {
5686        _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
5687    }
5688    if (_exception) {
5689        jniThrowException(_env, _exceptionType, _exceptionMessage);
5690    }
5691}
5692
5693/* void glUseProgram ( GLuint program ) */
5694static void
5695android_glUseProgram__I
5696  (JNIEnv *_env, jobject _this, jint program) {
5697    glUseProgram(
5698        (GLuint)program
5699    );
5700}
5701
5702/* void glValidateProgram ( GLuint program ) */
5703static void
5704android_glValidateProgram__I
5705  (JNIEnv *_env, jobject _this, jint program) {
5706    glValidateProgram(
5707        (GLuint)program
5708    );
5709}
5710
5711/* void glVertexAttrib1f ( GLuint indx, GLfloat x ) */
5712static void
5713android_glVertexAttrib1f__IF
5714  (JNIEnv *_env, jobject _this, jint indx, jfloat x) {
5715    glVertexAttrib1f(
5716        (GLuint)indx,
5717        (GLfloat)x
5718    );
5719}
5720
5721/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
5722static void
5723android_glVertexAttrib1fv__I_3FI
5724  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
5725    jint _exception = 0;
5726    const char * _exceptionType = NULL;
5727    const char * _exceptionMessage = NULL;
5728    GLfloat *values_base = (GLfloat *) 0;
5729    jint _remaining;
5730    GLfloat *values = (GLfloat *) 0;
5731
5732    if (!values_ref) {
5733        _exception = 1;
5734        _exceptionType = "java/lang/IllegalArgumentException";
5735        _exceptionMessage = "values == null";
5736        goto exit;
5737    }
5738    if (offset < 0) {
5739        _exception = 1;
5740        _exceptionType = "java/lang/IllegalArgumentException";
5741        _exceptionMessage = "offset < 0";
5742        goto exit;
5743    }
5744    _remaining = _env->GetArrayLength(values_ref) - offset;
5745    if (_remaining < 1) {
5746        _exception = 1;
5747        _exceptionType = "java/lang/IllegalArgumentException";
5748        _exceptionMessage = "length - offset < 1 < needed";
5749        goto exit;
5750    }
5751    values_base = (GLfloat *)
5752        _env->GetFloatArrayElements(values_ref, (jboolean *)0);
5753    values = values_base + offset;
5754
5755    glVertexAttrib1fv(
5756        (GLuint)indx,
5757        (GLfloat *)values
5758    );
5759
5760exit:
5761    if (values_base) {
5762        _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
5763            JNI_ABORT);
5764    }
5765    if (_exception) {
5766        jniThrowException(_env, _exceptionType, _exceptionMessage);
5767    }
5768}
5769
5770/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
5771static void
5772android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2
5773  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
5774    jint _exception = 0;
5775    const char * _exceptionType = NULL;
5776    const char * _exceptionMessage = NULL;
5777    jfloatArray _array = (jfloatArray) 0;
5778    jint _bufferOffset = (jint) 0;
5779    jint _remaining;
5780    GLfloat *values = (GLfloat *) 0;
5781
5782    values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
5783    if (_remaining < 1) {
5784        _exception = 1;
5785        _exceptionType = "java/lang/IllegalArgumentException";
5786        _exceptionMessage = "remaining() < 1 < needed";
5787        goto exit;
5788    }
5789    if (values == NULL) {
5790        char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
5791        values = (GLfloat *) (_valuesBase + _bufferOffset);
5792    }
5793    glVertexAttrib1fv(
5794        (GLuint)indx,
5795        (GLfloat *)values
5796    );
5797
5798exit:
5799    if (_array) {
5800        _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
5801    }
5802    if (_exception) {
5803        jniThrowException(_env, _exceptionType, _exceptionMessage);
5804    }
5805}
5806
5807/* void glVertexAttrib2f ( GLuint indx, GLfloat x, GLfloat y ) */
5808static void
5809android_glVertexAttrib2f__IFF
5810  (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y) {
5811    glVertexAttrib2f(
5812        (GLuint)indx,
5813        (GLfloat)x,
5814        (GLfloat)y
5815    );
5816}
5817
5818/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
5819static void
5820android_glVertexAttrib2fv__I_3FI
5821  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
5822    jint _exception = 0;
5823    const char * _exceptionType = NULL;
5824    const char * _exceptionMessage = NULL;
5825    GLfloat *values_base = (GLfloat *) 0;
5826    jint _remaining;
5827    GLfloat *values = (GLfloat *) 0;
5828
5829    if (!values_ref) {
5830        _exception = 1;
5831        _exceptionType = "java/lang/IllegalArgumentException";
5832        _exceptionMessage = "values == null";
5833        goto exit;
5834    }
5835    if (offset < 0) {
5836        _exception = 1;
5837        _exceptionType = "java/lang/IllegalArgumentException";
5838        _exceptionMessage = "offset < 0";
5839        goto exit;
5840    }
5841    _remaining = _env->GetArrayLength(values_ref) - offset;
5842    if (_remaining < 2) {
5843        _exception = 1;
5844        _exceptionType = "java/lang/IllegalArgumentException";
5845        _exceptionMessage = "length - offset < 2 < needed";
5846        goto exit;
5847    }
5848    values_base = (GLfloat *)
5849        _env->GetFloatArrayElements(values_ref, (jboolean *)0);
5850    values = values_base + offset;
5851
5852    glVertexAttrib2fv(
5853        (GLuint)indx,
5854        (GLfloat *)values
5855    );
5856
5857exit:
5858    if (values_base) {
5859        _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
5860            JNI_ABORT);
5861    }
5862    if (_exception) {
5863        jniThrowException(_env, _exceptionType, _exceptionMessage);
5864    }
5865}
5866
5867/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
5868static void
5869android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2
5870  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
5871    jint _exception = 0;
5872    const char * _exceptionType = NULL;
5873    const char * _exceptionMessage = NULL;
5874    jfloatArray _array = (jfloatArray) 0;
5875    jint _bufferOffset = (jint) 0;
5876    jint _remaining;
5877    GLfloat *values = (GLfloat *) 0;
5878
5879    values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
5880    if (_remaining < 2) {
5881        _exception = 1;
5882        _exceptionType = "java/lang/IllegalArgumentException";
5883        _exceptionMessage = "remaining() < 2 < needed";
5884        goto exit;
5885    }
5886    if (values == NULL) {
5887        char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
5888        values = (GLfloat *) (_valuesBase + _bufferOffset);
5889    }
5890    glVertexAttrib2fv(
5891        (GLuint)indx,
5892        (GLfloat *)values
5893    );
5894
5895exit:
5896    if (_array) {
5897        _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
5898    }
5899    if (_exception) {
5900        jniThrowException(_env, _exceptionType, _exceptionMessage);
5901    }
5902}
5903
5904/* void glVertexAttrib3f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z ) */
5905static void
5906android_glVertexAttrib3f__IFFF
5907  (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z) {
5908    glVertexAttrib3f(
5909        (GLuint)indx,
5910        (GLfloat)x,
5911        (GLfloat)y,
5912        (GLfloat)z
5913    );
5914}
5915
5916/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
5917static void
5918android_glVertexAttrib3fv__I_3FI
5919  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
5920    jint _exception = 0;
5921    const char * _exceptionType = NULL;
5922    const char * _exceptionMessage = NULL;
5923    GLfloat *values_base = (GLfloat *) 0;
5924    jint _remaining;
5925    GLfloat *values = (GLfloat *) 0;
5926
5927    if (!values_ref) {
5928        _exception = 1;
5929        _exceptionType = "java/lang/IllegalArgumentException";
5930        _exceptionMessage = "values == null";
5931        goto exit;
5932    }
5933    if (offset < 0) {
5934        _exception = 1;
5935        _exceptionType = "java/lang/IllegalArgumentException";
5936        _exceptionMessage = "offset < 0";
5937        goto exit;
5938    }
5939    _remaining = _env->GetArrayLength(values_ref) - offset;
5940    if (_remaining < 3) {
5941        _exception = 1;
5942        _exceptionType = "java/lang/IllegalArgumentException";
5943        _exceptionMessage = "length - offset < 3 < needed";
5944        goto exit;
5945    }
5946    values_base = (GLfloat *)
5947        _env->GetFloatArrayElements(values_ref, (jboolean *)0);
5948    values = values_base + offset;
5949
5950    glVertexAttrib3fv(
5951        (GLuint)indx,
5952        (GLfloat *)values
5953    );
5954
5955exit:
5956    if (values_base) {
5957        _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
5958            JNI_ABORT);
5959    }
5960    if (_exception) {
5961        jniThrowException(_env, _exceptionType, _exceptionMessage);
5962    }
5963}
5964
5965/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
5966static void
5967android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2
5968  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
5969    jint _exception = 0;
5970    const char * _exceptionType = NULL;
5971    const char * _exceptionMessage = NULL;
5972    jfloatArray _array = (jfloatArray) 0;
5973    jint _bufferOffset = (jint) 0;
5974    jint _remaining;
5975    GLfloat *values = (GLfloat *) 0;
5976
5977    values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
5978    if (_remaining < 3) {
5979        _exception = 1;
5980        _exceptionType = "java/lang/IllegalArgumentException";
5981        _exceptionMessage = "remaining() < 3 < needed";
5982        goto exit;
5983    }
5984    if (values == NULL) {
5985        char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
5986        values = (GLfloat *) (_valuesBase + _bufferOffset);
5987    }
5988    glVertexAttrib3fv(
5989        (GLuint)indx,
5990        (GLfloat *)values
5991    );
5992
5993exit:
5994    if (_array) {
5995        _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
5996    }
5997    if (_exception) {
5998        jniThrowException(_env, _exceptionType, _exceptionMessage);
5999    }
6000}
6001
6002/* void glVertexAttrib4f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
6003static void
6004android_glVertexAttrib4f__IFFFF
6005  (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z, jfloat w) {
6006    glVertexAttrib4f(
6007        (GLuint)indx,
6008        (GLfloat)x,
6009        (GLfloat)y,
6010        (GLfloat)z,
6011        (GLfloat)w
6012    );
6013}
6014
6015/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
6016static void
6017android_glVertexAttrib4fv__I_3FI
6018  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
6019    jint _exception = 0;
6020    const char * _exceptionType = NULL;
6021    const char * _exceptionMessage = NULL;
6022    GLfloat *values_base = (GLfloat *) 0;
6023    jint _remaining;
6024    GLfloat *values = (GLfloat *) 0;
6025
6026    if (!values_ref) {
6027        _exception = 1;
6028        _exceptionType = "java/lang/IllegalArgumentException";
6029        _exceptionMessage = "values == null";
6030        goto exit;
6031    }
6032    if (offset < 0) {
6033        _exception = 1;
6034        _exceptionType = "java/lang/IllegalArgumentException";
6035        _exceptionMessage = "offset < 0";
6036        goto exit;
6037    }
6038    _remaining = _env->GetArrayLength(values_ref) - offset;
6039    if (_remaining < 4) {
6040        _exception = 1;
6041        _exceptionType = "java/lang/IllegalArgumentException";
6042        _exceptionMessage = "length - offset < 4 < needed";
6043        goto exit;
6044    }
6045    values_base = (GLfloat *)
6046        _env->GetFloatArrayElements(values_ref, (jboolean *)0);
6047    values = values_base + offset;
6048
6049    glVertexAttrib4fv(
6050        (GLuint)indx,
6051        (GLfloat *)values
6052    );
6053
6054exit:
6055    if (values_base) {
6056        _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
6057            JNI_ABORT);
6058    }
6059    if (_exception) {
6060        jniThrowException(_env, _exceptionType, _exceptionMessage);
6061    }
6062}
6063
6064/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
6065static void
6066android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2
6067  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
6068    jint _exception = 0;
6069    const char * _exceptionType = NULL;
6070    const char * _exceptionMessage = NULL;
6071    jfloatArray _array = (jfloatArray) 0;
6072    jint _bufferOffset = (jint) 0;
6073    jint _remaining;
6074    GLfloat *values = (GLfloat *) 0;
6075
6076    values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
6077    if (_remaining < 4) {
6078        _exception = 1;
6079        _exceptionType = "java/lang/IllegalArgumentException";
6080        _exceptionMessage = "remaining() < 4 < needed";
6081        goto exit;
6082    }
6083    if (values == NULL) {
6084        char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
6085        values = (GLfloat *) (_valuesBase + _bufferOffset);
6086    }
6087    glVertexAttrib4fv(
6088        (GLuint)indx,
6089        (GLfloat *)values
6090    );
6091
6092exit:
6093    if (_array) {
6094        _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
6095    }
6096    if (_exception) {
6097        jniThrowException(_env, _exceptionType, _exceptionMessage);
6098    }
6099}
6100
6101/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint offset ) */
6102static void
6103android_glVertexAttribPointer__IIIZII
6104  (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jint offset) {
6105    glVertexAttribPointer(
6106        (GLuint)indx,
6107        (GLint)size,
6108        (GLenum)type,
6109        (GLboolean)normalized,
6110        (GLsizei)stride,
6111        reinterpret_cast<GLvoid *>(offset)
6112    );
6113}
6114
6115/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr ) */
6116static void
6117android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I
6118  (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jobject ptr_buf, jint remaining) {
6119    jarray _array = (jarray) 0;
6120    jint _bufferOffset = (jint) 0;
6121    jint _remaining;
6122    GLvoid *ptr = (GLvoid *) 0;
6123
6124    if (ptr_buf) {
6125        ptr = (GLvoid *) getDirectBufferPointer(_env, ptr_buf);
6126        if ( ! ptr ) {
6127            return;
6128        }
6129    }
6130    glVertexAttribPointerBounds(
6131        (GLuint)indx,
6132        (GLint)size,
6133        (GLenum)type,
6134        (GLboolean)normalized,
6135        (GLsizei)stride,
6136        (GLvoid *)ptr,
6137        (GLsizei)remaining
6138    );
6139}
6140
6141/* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */
6142static void
6143android_glViewport__IIII
6144  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
6145    glViewport(
6146        (GLint)x,
6147        (GLint)y,
6148        (GLsizei)width,
6149        (GLsizei)height
6150    );
6151}
6152
6153static const char *classPathName = "android/opengl/GLES20";
6154
6155static const JNINativeMethod methods[] = {
6156{"_nativeClassInit", "()V", (void*)nativeClassInit },
6157{"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I },
6158{"glAttachShader", "(II)V", (void *) android_glAttachShader__II },
6159{"glBindAttribLocation", "(IILjava/lang/String;)V", (void *) android_glBindAttribLocation__IILjava_lang_String_2 },
6160{"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II },
6161{"glBindFramebuffer", "(II)V", (void *) android_glBindFramebuffer__II },
6162{"glBindRenderbuffer", "(II)V", (void *) android_glBindRenderbuffer__II },
6163{"glBindTexture", "(II)V", (void *) android_glBindTexture__II },
6164{"glBlendColor", "(FFFF)V", (void *) android_glBlendColor__FFFF },
6165{"glBlendEquation", "(I)V", (void *) android_glBlendEquation__I },
6166{"glBlendEquationSeparate", "(II)V", (void *) android_glBlendEquationSeparate__II },
6167{"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II },
6168{"glBlendFuncSeparate", "(IIII)V", (void *) android_glBlendFuncSeparate__IIII },
6169{"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I },
6170{"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 },
6171{"glCheckFramebufferStatus", "(I)I", (void *) android_glCheckFramebufferStatus__I },
6172{"glClear", "(I)V", (void *) android_glClear__I },
6173{"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF },
6174{"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F },
6175{"glClearStencil", "(I)V", (void *) android_glClearStencil__I },
6176{"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ },
6177{"glCompileShader", "(I)V", (void *) android_glCompileShader__I },
6178{"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 },
6179{"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
6180{"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII },
6181{"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII },
6182{"glCreateProgram", "()I", (void *) android_glCreateProgram__ },
6183{"glCreateShader", "(I)I", (void *) android_glCreateShader__I },
6184{"glCullFace", "(I)V", (void *) android_glCullFace__I },
6185{"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II },
6186{"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 },
6187{"glDeleteFramebuffers", "(I[II)V", (void *) android_glDeleteFramebuffers__I_3II },
6188{"glDeleteFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2 },
6189{"glDeleteProgram", "(I)V", (void *) android_glDeleteProgram__I },
6190{"glDeleteRenderbuffers", "(I[II)V", (void *) android_glDeleteRenderbuffers__I_3II },
6191{"glDeleteRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2 },
6192{"glDeleteShader", "(I)V", (void *) android_glDeleteShader__I },
6193{"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II },
6194{"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 },
6195{"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I },
6196{"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z },
6197{"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF },
6198{"glDetachShader", "(II)V", (void *) android_glDetachShader__II },
6199{"glDisable", "(I)V", (void *) android_glDisable__I },
6200{"glDisableVertexAttribArray", "(I)V", (void *) android_glDisableVertexAttribArray__I },
6201{"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III },
6202{"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII },
6203{"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 },
6204{"glEnable", "(I)V", (void *) android_glEnable__I },
6205{"glEnableVertexAttribArray", "(I)V", (void *) android_glEnableVertexAttribArray__I },
6206{"glFinish", "()V", (void *) android_glFinish__ },
6207{"glFlush", "()V", (void *) android_glFlush__ },
6208{"glFramebufferRenderbuffer", "(IIII)V", (void *) android_glFramebufferRenderbuffer__IIII },
6209{"glFramebufferTexture2D", "(IIIII)V", (void *) android_glFramebufferTexture2D__IIIII },
6210{"glFrontFace", "(I)V", (void *) android_glFrontFace__I },
6211{"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II },
6212{"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 },
6213{"glGenerateMipmap", "(I)V", (void *) android_glGenerateMipmap__I },
6214{"glGenFramebuffers", "(I[II)V", (void *) android_glGenFramebuffers__I_3II },
6215{"glGenFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenFramebuffers__ILjava_nio_IntBuffer_2 },
6216{"glGenRenderbuffers", "(I[II)V", (void *) android_glGenRenderbuffers__I_3II },
6217{"glGenRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenRenderbuffers__ILjava_nio_IntBuffer_2 },
6218{"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II },
6219{"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 },
6220{"glGetActiveAttrib", "(III[II[II[II[BI)V", (void *) android_glGetActiveAttrib__III_3II_3II_3II_3BI },
6221{"glGetActiveAttrib", "(IIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;B)V", (void *) android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B },
6222{"glGetActiveAttrib", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveAttrib1 },
6223{"glGetActiveAttrib", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveAttrib2 },
6224{"glGetActiveUniform", "(III[II[II[II[BI)V", (void *) android_glGetActiveUniform__III_3II_3II_3II_3BI },
6225{"glGetActiveUniform", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveUniform1 },
6226{"glGetActiveUniform", "(IIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;B)V", (void *) android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B },
6227{"glGetActiveUniform", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveUniform2 },
6228{"glGetAttachedShaders", "(II[II[II)V", (void *) android_glGetAttachedShaders__II_3II_3II },
6229{"glGetAttachedShaders", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
6230{"glGetAttribLocation", "(ILjava/lang/String;)I", (void *) android_glGetAttribLocation__ILjava_lang_String_2 },
6231{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI },
6232{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 },
6233{"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II },
6234{"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 },
6235{"glGetError", "()I", (void *) android_glGetError__ },
6236{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI },
6237{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 },
6238{"glGetFramebufferAttachmentParameteriv", "(III[II)V", (void *) android_glGetFramebufferAttachmentParameteriv__III_3II },
6239{"glGetFramebufferAttachmentParameteriv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2 },
6240{"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II },
6241{"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 },
6242{"glGetProgramiv", "(II[II)V", (void *) android_glGetProgramiv__II_3II },
6243{"glGetProgramiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetProgramiv__IILjava_nio_IntBuffer_2 },
6244{"glGetProgramInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetProgramInfoLog },
6245{"glGetRenderbufferParameteriv", "(II[II)V", (void *) android_glGetRenderbufferParameteriv__II_3II },
6246{"glGetRenderbufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2 },
6247{"glGetShaderiv", "(II[II)V", (void *) android_glGetShaderiv__II_3II },
6248{"glGetShaderiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetShaderiv__IILjava_nio_IntBuffer_2 },
6249{"glGetShaderInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetShaderInfoLog },
6250{"glGetShaderPrecisionFormat", "(II[II[II)V", (void *) android_glGetShaderPrecisionFormat__II_3II_3II },
6251{"glGetShaderPrecisionFormat", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
6252{"glGetShaderSource", "(II[II[BI)V", (void *) android_glGetShaderSource__II_3II_3BI },
6253{"glGetShaderSource", "(IILjava/nio/IntBuffer;B)V", (void *) android_glGetShaderSource__IILjava_nio_IntBuffer_2B },
6254{"glGetShaderSource", "(I)Ljava/lang/String;", (void *) android_glGetShaderSource },
6255{"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString },
6256{"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI },
6257{"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 },
6258{"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II },
6259{"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 },
6260{"glGetUniformfv", "(II[FI)V", (void *) android_glGetUniformfv__II_3FI },
6261{"glGetUniformfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetUniformfv__IILjava_nio_FloatBuffer_2 },
6262{"glGetUniformiv", "(II[II)V", (void *) android_glGetUniformiv__II_3II },
6263{"glGetUniformiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetUniformiv__IILjava_nio_IntBuffer_2 },
6264{"glGetUniformLocation", "(ILjava/lang/String;)I", (void *) android_glGetUniformLocation__ILjava_lang_String_2 },
6265{"glGetVertexAttribfv", "(II[FI)V", (void *) android_glGetVertexAttribfv__II_3FI },
6266{"glGetVertexAttribfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2 },
6267{"glGetVertexAttribiv", "(II[II)V", (void *) android_glGetVertexAttribiv__II_3II },
6268{"glGetVertexAttribiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2 },
6269{"glHint", "(II)V", (void *) android_glHint__II },
6270{"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I },
6271{"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I },
6272{"glIsFramebuffer", "(I)Z", (void *) android_glIsFramebuffer__I },
6273{"glIsProgram", "(I)Z", (void *) android_glIsProgram__I },
6274{"glIsRenderbuffer", "(I)Z", (void *) android_glIsRenderbuffer__I },
6275{"glIsShader", "(I)Z", (void *) android_glIsShader__I },
6276{"glIsTexture", "(I)Z", (void *) android_glIsTexture__I },
6277{"glLineWidth", "(F)V", (void *) android_glLineWidth__F },
6278{"glLinkProgram", "(I)V", (void *) android_glLinkProgram__I },
6279{"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II },
6280{"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF },
6281{"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 },
6282{"glReleaseShaderCompiler", "()V", (void *) android_glReleaseShaderCompiler__ },
6283{"glRenderbufferStorage", "(IIII)V", (void *) android_glRenderbufferStorage__IIII },
6284{"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ },
6285{"glScissor", "(IIII)V", (void *) android_glScissor__IIII },
6286{"glShaderBinary", "(I[IIILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__I_3IIILjava_nio_Buffer_2I },
6287{"glShaderBinary", "(ILjava/nio/IntBuffer;ILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I },
6288{"glShaderSource", "(ILjava/lang/String;)V", (void *) android_glShaderSource },
6289{"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III },
6290{"glStencilFuncSeparate", "(IIII)V", (void *) android_glStencilFuncSeparate__IIII },
6291{"glStencilMask", "(I)V", (void *) android_glStencilMask__I },
6292{"glStencilMaskSeparate", "(II)V", (void *) android_glStencilMaskSeparate__II },
6293{"glStencilOp", "(III)V", (void *) android_glStencilOp__III },
6294{"glStencilOpSeparate", "(IIII)V", (void *) android_glStencilOpSeparate__IIII },
6295{"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 },
6296{"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF },
6297{"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI },
6298{"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 },
6299{"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III },
6300{"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II },
6301{"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 },
6302{"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
6303{"glUniform1f", "(IF)V", (void *) android_glUniform1f__IF },
6304{"glUniform1fv", "(II[FI)V", (void *) android_glUniform1fv__II_3FI },
6305{"glUniform1fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform1fv__IILjava_nio_FloatBuffer_2 },
6306{"glUniform1i", "(II)V", (void *) android_glUniform1i__II },
6307{"glUniform1iv", "(II[II)V", (void *) android_glUniform1iv__II_3II },
6308{"glUniform1iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform1iv__IILjava_nio_IntBuffer_2 },
6309{"glUniform2f", "(IFF)V", (void *) android_glUniform2f__IFF },
6310{"glUniform2fv", "(II[FI)V", (void *) android_glUniform2fv__II_3FI },
6311{"glUniform2fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform2fv__IILjava_nio_FloatBuffer_2 },
6312{"glUniform2i", "(III)V", (void *) android_glUniform2i__III },
6313{"glUniform2iv", "(II[II)V", (void *) android_glUniform2iv__II_3II },
6314{"glUniform2iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform2iv__IILjava_nio_IntBuffer_2 },
6315{"glUniform3f", "(IFFF)V", (void *) android_glUniform3f__IFFF },
6316{"glUniform3fv", "(II[FI)V", (void *) android_glUniform3fv__II_3FI },
6317{"glUniform3fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform3fv__IILjava_nio_FloatBuffer_2 },
6318{"glUniform3i", "(IIII)V", (void *) android_glUniform3i__IIII },
6319{"glUniform3iv", "(II[II)V", (void *) android_glUniform3iv__II_3II },
6320{"glUniform3iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform3iv__IILjava_nio_IntBuffer_2 },
6321{"glUniform4f", "(IFFFF)V", (void *) android_glUniform4f__IFFFF },
6322{"glUniform4fv", "(II[FI)V", (void *) android_glUniform4fv__II_3FI },
6323{"glUniform4fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform4fv__IILjava_nio_FloatBuffer_2 },
6324{"glUniform4i", "(IIIII)V", (void *) android_glUniform4i__IIIII },
6325{"glUniform4iv", "(II[II)V", (void *) android_glUniform4iv__II_3II },
6326{"glUniform4iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform4iv__IILjava_nio_IntBuffer_2 },
6327{"glUniformMatrix2fv", "(IIZ[FI)V", (void *) android_glUniformMatrix2fv__IIZ_3FI },
6328{"glUniformMatrix2fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2 },
6329{"glUniformMatrix3fv", "(IIZ[FI)V", (void *) android_glUniformMatrix3fv__IIZ_3FI },
6330{"glUniformMatrix3fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2 },
6331{"glUniformMatrix4fv", "(IIZ[FI)V", (void *) android_glUniformMatrix4fv__IIZ_3FI },
6332{"glUniformMatrix4fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2 },
6333{"glUseProgram", "(I)V", (void *) android_glUseProgram__I },
6334{"glValidateProgram", "(I)V", (void *) android_glValidateProgram__I },
6335{"glVertexAttrib1f", "(IF)V", (void *) android_glVertexAttrib1f__IF },
6336{"glVertexAttrib1fv", "(I[FI)V", (void *) android_glVertexAttrib1fv__I_3FI },
6337{"glVertexAttrib1fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2 },
6338{"glVertexAttrib2f", "(IFF)V", (void *) android_glVertexAttrib2f__IFF },
6339{"glVertexAttrib2fv", "(I[FI)V", (void *) android_glVertexAttrib2fv__I_3FI },
6340{"glVertexAttrib2fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2 },
6341{"glVertexAttrib3f", "(IFFF)V", (void *) android_glVertexAttrib3f__IFFF },
6342{"glVertexAttrib3fv", "(I[FI)V", (void *) android_glVertexAttrib3fv__I_3FI },
6343{"glVertexAttrib3fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2 },
6344{"glVertexAttrib4f", "(IFFFF)V", (void *) android_glVertexAttrib4f__IFFFF },
6345{"glVertexAttrib4fv", "(I[FI)V", (void *) android_glVertexAttrib4fv__I_3FI },
6346{"glVertexAttrib4fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2 },
6347{"glVertexAttribPointer", "(IIIZII)V", (void *) android_glVertexAttribPointer__IIIZII },
6348{"glVertexAttribPointerBounds", "(IIIZILjava/nio/Buffer;I)V", (void *) android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I },
6349{"glViewport", "(IIII)V", (void *) android_glViewport__IIII },
6350};
6351
6352int register_android_opengl_jni_GLES20(JNIEnv *_env)
6353{
6354    int err;
6355    err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
6356    return err;
6357}
6358