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