android_opengl_GLES20.cpp revision 428d3fcbe3596b18549cdada9fc68a29f159a946
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    _needed = getNeededCount(pname);
298    // if we didn't find this pname, we just assume the user passed
299    // an array of the right size -- this might happen with extensions
300    // or if we forget an enum here.
301    if (_needed>0 && _remaining < _needed) {
302        _exception = 1;
303        _exceptionType = "java/lang/IllegalArgumentException";
304        _exceptionMessage = "remaining() < needed";
305        goto exit;
306    }
307    if (params == NULL) {
308        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
309        params = (CTYPE *) (_paramsBase + _bufferOffset);
310    }
311    GET(
312        (GLenum)pname,
313        (CTYPE *)params
314    );
315
316exit:
317    if (_array) {
318        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
319    }
320    if (_exception) {
321        jniThrowException(_env, _exceptionType, _exceptionMessage);
322    }
323}
324
325// --------------------------------------------------------------------------
326/* void glActiveTexture ( GLenum texture ) */
327static void
328android_glActiveTexture__I
329  (JNIEnv *_env, jobject _this, jint texture) {
330    glActiveTexture(
331        (GLenum)texture
332    );
333}
334
335/* void glAttachShader ( GLuint program, GLuint shader ) */
336static void
337android_glAttachShader__II
338  (JNIEnv *_env, jobject _this, jint program, jint shader) {
339    glAttachShader(
340        (GLuint)program,
341        (GLuint)shader
342    );
343}
344
345/* void glBindAttribLocation ( GLuint program, GLuint index, const char *name ) */
346static void
347android_glBindAttribLocation__IILjava_lang_String_2
348  (JNIEnv *_env, jobject _this, jint program, jint index, jstring name) {
349    jint _exception = 0;
350    const char * _exceptionType = NULL;
351    const char * _exceptionMessage = NULL;
352    const char* _nativename = 0;
353
354    if (!name) {
355        _exception = 1;
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        _exception = 1;
2458        _exceptionType = "java/lang/IllegalArgumentException";
2459        _exceptionMessage = "name == null";
2460        goto exit;
2461    }
2462    _nativename = _env->GetStringUTFChars(name, 0);
2463
2464    _returnValue = glGetAttribLocation(
2465        (GLuint)program,
2466        (char *)_nativename
2467    );
2468
2469exit:
2470    if (_nativename) {
2471        _env->ReleaseStringUTFChars(name, _nativename);
2472    }
2473
2474    if (_exception) {
2475        jniThrowException(_env, _exceptionType, _exceptionMessage);
2476    }
2477    return (jint)_returnValue;
2478}
2479
2480/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
2481static void
2482android_glGetBooleanv__I_3ZI
2483  (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
2484    get<jbooleanArray, GLboolean, glGetBooleanv>(_env, _this, pname, params_ref, offset);
2485}
2486
2487/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
2488static void
2489android_glGetBooleanv__ILjava_nio_IntBuffer_2
2490  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
2491    getarray<GLboolean, glGetBooleanv>(_env, _this, pname, params_buf);
2492}
2493/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2494static void
2495android_glGetBufferParameteriv__II_3II
2496  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2497    jint _exception = 0;
2498    const char * _exceptionType = NULL;
2499    const char * _exceptionMessage = NULL;
2500    GLint *params_base = (GLint *) 0;
2501    jint _remaining;
2502    GLint *params = (GLint *) 0;
2503
2504    if (!params_ref) {
2505        _exception = 1;
2506        _exceptionType = "java/lang/IllegalArgumentException";
2507        _exceptionMessage = "params == null";
2508        goto exit;
2509    }
2510    if (offset < 0) {
2511        _exception = 1;
2512        _exceptionType = "java/lang/IllegalArgumentException";
2513        _exceptionMessage = "offset < 0";
2514        goto exit;
2515    }
2516    _remaining = _env->GetArrayLength(params_ref) - offset;
2517    if (_remaining < 1) {
2518        _exception = 1;
2519        _exceptionType = "java/lang/IllegalArgumentException";
2520        _exceptionMessage = "length - offset < 1 < needed";
2521        goto exit;
2522    }
2523    params_base = (GLint *)
2524        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2525    params = params_base + offset;
2526
2527    glGetBufferParameteriv(
2528        (GLenum)target,
2529        (GLenum)pname,
2530        (GLint *)params
2531    );
2532
2533exit:
2534    if (params_base) {
2535        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2536            _exception ? JNI_ABORT: 0);
2537    }
2538    if (_exception) {
2539        jniThrowException(_env, _exceptionType, _exceptionMessage);
2540    }
2541}
2542
2543/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2544static void
2545android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
2546  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2547    jint _exception = 0;
2548    const char * _exceptionType = NULL;
2549    const char * _exceptionMessage = NULL;
2550    jarray _array = (jarray) 0;
2551    jint _bufferOffset = (jint) 0;
2552    jint _remaining;
2553    GLint *params = (GLint *) 0;
2554
2555    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
2556    if (_remaining < 1) {
2557        _exception = 1;
2558        _exceptionType = "java/lang/IllegalArgumentException";
2559        _exceptionMessage = "remaining() < 1 < needed";
2560        goto exit;
2561    }
2562    if (params == NULL) {
2563        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2564        params = (GLint *) (_paramsBase + _bufferOffset);
2565    }
2566    glGetBufferParameteriv(
2567        (GLenum)target,
2568        (GLenum)pname,
2569        (GLint *)params
2570    );
2571
2572exit:
2573    if (_array) {
2574        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2575    }
2576    if (_exception) {
2577        jniThrowException(_env, _exceptionType, _exceptionMessage);
2578    }
2579}
2580
2581/* GLenum glGetError ( void ) */
2582static jint
2583android_glGetError__
2584  (JNIEnv *_env, jobject _this) {
2585    GLenum _returnValue;
2586    _returnValue = glGetError();
2587    return (jint)_returnValue;
2588}
2589
2590/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
2591static void
2592android_glGetFloatv__I_3FI
2593  (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
2594    get<jfloatArray, GLfloat, glGetFloatv>(_env, _this, pname, params_ref, offset);
2595}
2596
2597/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
2598static void
2599android_glGetFloatv__ILjava_nio_FloatBuffer_2
2600  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
2601    getarray<GLfloat, glGetFloatv>(_env, _this, pname, params_buf);
2602}
2603/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
2604static void
2605android_glGetFramebufferAttachmentParameteriv__III_3II
2606  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jintArray params_ref, jint offset) {
2607    jint _exception = 0;
2608    const char * _exceptionType = NULL;
2609    const char * _exceptionMessage = NULL;
2610    GLint *params_base = (GLint *) 0;
2611    jint _remaining;
2612    GLint *params = (GLint *) 0;
2613
2614    if (!params_ref) {
2615        _exception = 1;
2616        _exceptionType = "java/lang/IllegalArgumentException";
2617        _exceptionMessage = "params == null";
2618        goto exit;
2619    }
2620    if (offset < 0) {
2621        _exception = 1;
2622        _exceptionType = "java/lang/IllegalArgumentException";
2623        _exceptionMessage = "offset < 0";
2624        goto exit;
2625    }
2626    _remaining = _env->GetArrayLength(params_ref) - offset;
2627    params_base = (GLint *)
2628        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2629    params = params_base + offset;
2630
2631    glGetFramebufferAttachmentParameteriv(
2632        (GLenum)target,
2633        (GLenum)attachment,
2634        (GLenum)pname,
2635        (GLint *)params
2636    );
2637
2638exit:
2639    if (params_base) {
2640        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2641            _exception ? JNI_ABORT: 0);
2642    }
2643    if (_exception) {
2644        jniThrowException(_env, _exceptionType, _exceptionMessage);
2645    }
2646}
2647
2648/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
2649static void
2650android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2
2651  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) {
2652    jarray _array = (jarray) 0;
2653    jint _bufferOffset = (jint) 0;
2654    jint _remaining;
2655    GLint *params = (GLint *) 0;
2656
2657    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
2658    if (params == NULL) {
2659        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2660        params = (GLint *) (_paramsBase + _bufferOffset);
2661    }
2662    glGetFramebufferAttachmentParameteriv(
2663        (GLenum)target,
2664        (GLenum)attachment,
2665        (GLenum)pname,
2666        (GLint *)params
2667    );
2668    if (_array) {
2669        releasePointer(_env, _array, params, JNI_TRUE);
2670    }
2671}
2672
2673/* void glGetIntegerv ( GLenum pname, GLint *params ) */
2674static void
2675android_glGetIntegerv__I_3II
2676  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
2677    get<jintArray, GLint, glGetIntegerv>(_env, _this, pname, params_ref, offset);
2678}
2679
2680/* void glGetIntegerv ( GLenum pname, GLint *params ) */
2681static void
2682android_glGetIntegerv__ILjava_nio_IntBuffer_2
2683  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
2684    getarray<GLint, glGetIntegerv>(_env, _this, pname, params_buf);
2685}
2686
2687/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2688static void
2689android_glGetProgramiv__II_3II
2690  (JNIEnv *_env, jobject _this, jint program, jint pname, jintArray params_ref, jint offset) {
2691    jint _exception = 0;
2692    const char * _exceptionType = NULL;
2693    const char * _exceptionMessage = NULL;
2694    GLint *params_base = (GLint *) 0;
2695    jint _remaining;
2696    GLint *params = (GLint *) 0;
2697
2698    if (!params_ref) {
2699        _exception = 1;
2700        _exceptionType = "java/lang/IllegalArgumentException";
2701        _exceptionMessage = "params == null";
2702        goto exit;
2703    }
2704    if (offset < 0) {
2705        _exception = 1;
2706        _exceptionType = "java/lang/IllegalArgumentException";
2707        _exceptionMessage = "offset < 0";
2708        goto exit;
2709    }
2710    _remaining = _env->GetArrayLength(params_ref) - offset;
2711    if (_remaining < 1) {
2712        _exception = 1;
2713        _exceptionType = "java/lang/IllegalArgumentException";
2714        _exceptionMessage = "length - offset < 1 < needed";
2715        goto exit;
2716    }
2717    params_base = (GLint *)
2718        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2719    params = params_base + offset;
2720
2721    glGetProgramiv(
2722        (GLuint)program,
2723        (GLenum)pname,
2724        (GLint *)params
2725    );
2726
2727exit:
2728    if (params_base) {
2729        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2730            _exception ? JNI_ABORT: 0);
2731    }
2732    if (_exception) {
2733        jniThrowException(_env, _exceptionType, _exceptionMessage);
2734    }
2735}
2736
2737/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2738static void
2739android_glGetProgramiv__IILjava_nio_IntBuffer_2
2740  (JNIEnv *_env, jobject _this, jint program, jint pname, jobject params_buf) {
2741    jint _exception = 0;
2742    const char * _exceptionType = NULL;
2743    const char * _exceptionMessage = NULL;
2744    jarray _array = (jarray) 0;
2745    jint _bufferOffset = (jint) 0;
2746    jint _remaining;
2747    GLint *params = (GLint *) 0;
2748
2749    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
2750    if (_remaining < 1) {
2751        _exception = 1;
2752        _exceptionType = "java/lang/IllegalArgumentException";
2753        _exceptionMessage = "remaining() < 1 < needed";
2754        goto exit;
2755    }
2756    if (params == NULL) {
2757        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2758        params = (GLint *) (_paramsBase + _bufferOffset);
2759    }
2760    glGetProgramiv(
2761        (GLuint)program,
2762        (GLenum)pname,
2763        (GLint *)params
2764    );
2765
2766exit:
2767    if (_array) {
2768        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2769    }
2770    if (_exception) {
2771        jniThrowException(_env, _exceptionType, _exceptionMessage);
2772    }
2773}
2774
2775#include <stdlib.h>
2776
2777/* void glGetProgramInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
2778static jstring android_glGetProgramInfoLog(JNIEnv *_env, jobject, jint shader) {
2779    GLint infoLen = 0;
2780    glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
2781    if (!infoLen) {
2782        return _env->NewStringUTF("");
2783    }
2784    char* buf = (char*) malloc(infoLen);
2785    if (buf == NULL) {
2786        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2787        return NULL;
2788    }
2789    glGetProgramInfoLog(shader, infoLen, NULL, buf);
2790    jstring result = _env->NewStringUTF(buf);
2791    free(buf);
2792    return result;
2793}
2794/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2795static void
2796android_glGetRenderbufferParameteriv__II_3II
2797  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2798    jint _exception = 0;
2799    const char * _exceptionType = NULL;
2800    const char * _exceptionMessage = NULL;
2801    GLint *params_base = (GLint *) 0;
2802    jint _remaining;
2803    GLint *params = (GLint *) 0;
2804
2805    if (!params_ref) {
2806        _exception = 1;
2807        _exceptionType = "java/lang/IllegalArgumentException";
2808        _exceptionMessage = "params == null";
2809        goto exit;
2810    }
2811    if (offset < 0) {
2812        _exception = 1;
2813        _exceptionType = "java/lang/IllegalArgumentException";
2814        _exceptionMessage = "offset < 0";
2815        goto exit;
2816    }
2817    _remaining = _env->GetArrayLength(params_ref) - offset;
2818    if (_remaining < 1) {
2819        _exception = 1;
2820        _exceptionType = "java/lang/IllegalArgumentException";
2821        _exceptionMessage = "length - offset < 1 < needed";
2822        goto exit;
2823    }
2824    params_base = (GLint *)
2825        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2826    params = params_base + offset;
2827
2828    glGetRenderbufferParameteriv(
2829        (GLenum)target,
2830        (GLenum)pname,
2831        (GLint *)params
2832    );
2833
2834exit:
2835    if (params_base) {
2836        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2837            _exception ? JNI_ABORT: 0);
2838    }
2839    if (_exception) {
2840        jniThrowException(_env, _exceptionType, _exceptionMessage);
2841    }
2842}
2843
2844/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2845static void
2846android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2
2847  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2848    jint _exception = 0;
2849    const char * _exceptionType = NULL;
2850    const char * _exceptionMessage = NULL;
2851    jarray _array = (jarray) 0;
2852    jint _bufferOffset = (jint) 0;
2853    jint _remaining;
2854    GLint *params = (GLint *) 0;
2855
2856    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
2857    if (_remaining < 1) {
2858        _exception = 1;
2859        _exceptionType = "java/lang/IllegalArgumentException";
2860        _exceptionMessage = "remaining() < 1 < needed";
2861        goto exit;
2862    }
2863    if (params == NULL) {
2864        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2865        params = (GLint *) (_paramsBase + _bufferOffset);
2866    }
2867    glGetRenderbufferParameteriv(
2868        (GLenum)target,
2869        (GLenum)pname,
2870        (GLint *)params
2871    );
2872
2873exit:
2874    if (_array) {
2875        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2876    }
2877    if (_exception) {
2878        jniThrowException(_env, _exceptionType, _exceptionMessage);
2879    }
2880}
2881
2882/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
2883static void
2884android_glGetShaderiv__II_3II
2885  (JNIEnv *_env, jobject _this, jint shader, jint pname, jintArray params_ref, jint offset) {
2886    jint _exception = 0;
2887    const char * _exceptionType = NULL;
2888    const char * _exceptionMessage = NULL;
2889    GLint *params_base = (GLint *) 0;
2890    jint _remaining;
2891    GLint *params = (GLint *) 0;
2892
2893    if (!params_ref) {
2894        _exception = 1;
2895        _exceptionType = "java/lang/IllegalArgumentException";
2896        _exceptionMessage = "params == null";
2897        goto exit;
2898    }
2899    if (offset < 0) {
2900        _exception = 1;
2901        _exceptionType = "java/lang/IllegalArgumentException";
2902        _exceptionMessage = "offset < 0";
2903        goto exit;
2904    }
2905    _remaining = _env->GetArrayLength(params_ref) - offset;
2906    if (_remaining < 1) {
2907        _exception = 1;
2908        _exceptionType = "java/lang/IllegalArgumentException";
2909        _exceptionMessage = "length - offset < 1 < needed";
2910        goto exit;
2911    }
2912    params_base = (GLint *)
2913        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2914    params = params_base + offset;
2915
2916    glGetShaderiv(
2917        (GLuint)shader,
2918        (GLenum)pname,
2919        (GLint *)params
2920    );
2921
2922exit:
2923    if (params_base) {
2924        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2925            _exception ? JNI_ABORT: 0);
2926    }
2927    if (_exception) {
2928        jniThrowException(_env, _exceptionType, _exceptionMessage);
2929    }
2930}
2931
2932/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
2933static void
2934android_glGetShaderiv__IILjava_nio_IntBuffer_2
2935  (JNIEnv *_env, jobject _this, jint shader, jint pname, jobject params_buf) {
2936    jint _exception = 0;
2937    const char * _exceptionType = NULL;
2938    const char * _exceptionMessage = NULL;
2939    jarray _array = (jarray) 0;
2940    jint _bufferOffset = (jint) 0;
2941    jint _remaining;
2942    GLint *params = (GLint *) 0;
2943
2944    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
2945    if (_remaining < 1) {
2946        _exception = 1;
2947        _exceptionType = "java/lang/IllegalArgumentException";
2948        _exceptionMessage = "remaining() < 1 < needed";
2949        goto exit;
2950    }
2951    if (params == NULL) {
2952        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2953        params = (GLint *) (_paramsBase + _bufferOffset);
2954    }
2955    glGetShaderiv(
2956        (GLuint)shader,
2957        (GLenum)pname,
2958        (GLint *)params
2959    );
2960
2961exit:
2962    if (_array) {
2963        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2964    }
2965    if (_exception) {
2966        jniThrowException(_env, _exceptionType, _exceptionMessage);
2967    }
2968}
2969
2970#include <stdlib.h>
2971
2972/* void glGetShaderInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
2973static jstring android_glGetShaderInfoLog(JNIEnv *_env, jobject, jint shader) {
2974    GLint infoLen = 0;
2975    glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
2976    if (!infoLen) {
2977        return _env->NewStringUTF("");
2978    }
2979    char* buf = (char*) malloc(infoLen);
2980    if (buf == NULL) {
2981        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2982        return NULL;
2983    }
2984    glGetShaderInfoLog(shader, infoLen, NULL, buf);
2985    jstring result = _env->NewStringUTF(buf);
2986    free(buf);
2987    return result;
2988}
2989/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
2990static void
2991android_glGetShaderPrecisionFormat__II_3II_3II
2992  (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jintArray range_ref, jint rangeOffset, jintArray precision_ref, jint precisionOffset) {
2993    jint _exception = 0;
2994    const char * _exceptionType = NULL;
2995    const char * _exceptionMessage = NULL;
2996    GLint *range_base = (GLint *) 0;
2997    jint _rangeRemaining;
2998    GLint *range = (GLint *) 0;
2999    GLint *precision_base = (GLint *) 0;
3000    jint _precisionRemaining;
3001    GLint *precision = (GLint *) 0;
3002
3003    if (!range_ref) {
3004        _exception = 1;
3005        _exceptionType = "java/lang/IllegalArgumentException";
3006        _exceptionMessage = "range == null";
3007        goto exit;
3008    }
3009    if (rangeOffset < 0) {
3010        _exception = 1;
3011        _exceptionType = "java/lang/IllegalArgumentException";
3012        _exceptionMessage = "rangeOffset < 0";
3013        goto exit;
3014    }
3015    _rangeRemaining = _env->GetArrayLength(range_ref) - rangeOffset;
3016    if (_rangeRemaining < 1) {
3017        _exception = 1;
3018        _exceptionType = "java/lang/IllegalArgumentException";
3019        _exceptionMessage = "length - rangeOffset < 1 < needed";
3020        goto exit;
3021    }
3022    range_base = (GLint *)
3023        _env->GetPrimitiveArrayCritical(range_ref, (jboolean *)0);
3024    range = range_base + rangeOffset;
3025
3026    if (!precision_ref) {
3027        _exception = 1;
3028        _exceptionType = "java/lang/IllegalArgumentException";
3029        _exceptionMessage = "precision == null";
3030        goto exit;
3031    }
3032    if (precisionOffset < 0) {
3033        _exception = 1;
3034        _exceptionType = "java/lang/IllegalArgumentException";
3035        _exceptionMessage = "precisionOffset < 0";
3036        goto exit;
3037    }
3038    _precisionRemaining = _env->GetArrayLength(precision_ref) - precisionOffset;
3039    if (_precisionRemaining < 1) {
3040        _exception = 1;
3041        _exceptionType = "java/lang/IllegalArgumentException";
3042        _exceptionMessage = "length - precisionOffset < 1 < needed";
3043        goto exit;
3044    }
3045    precision_base = (GLint *)
3046        _env->GetPrimitiveArrayCritical(precision_ref, (jboolean *)0);
3047    precision = precision_base + precisionOffset;
3048
3049    glGetShaderPrecisionFormat(
3050        (GLenum)shadertype,
3051        (GLenum)precisiontype,
3052        (GLint *)range,
3053        (GLint *)precision
3054    );
3055
3056exit:
3057    if (precision_base) {
3058        _env->ReleasePrimitiveArrayCritical(precision_ref, precision_base,
3059            _exception ? JNI_ABORT: 0);
3060    }
3061    if (range_base) {
3062        _env->ReleasePrimitiveArrayCritical(range_ref, range_base,
3063            _exception ? JNI_ABORT: 0);
3064    }
3065    if (_exception) {
3066        jniThrowException(_env, _exceptionType, _exceptionMessage);
3067    }
3068}
3069
3070/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
3071static void
3072android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
3073  (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jobject range_buf, jobject precision_buf) {
3074    jint _exception = 0;
3075    const char * _exceptionType = NULL;
3076    const char * _exceptionMessage = NULL;
3077    jarray _rangeArray = (jarray) 0;
3078    jint _rangeBufferOffset = (jint) 0;
3079    jarray _precisionArray = (jarray) 0;
3080    jint _precisionBufferOffset = (jint) 0;
3081    jint _rangeRemaining;
3082    GLint *range = (GLint *) 0;
3083    jint _precisionRemaining;
3084    GLint *precision = (GLint *) 0;
3085
3086    range = (GLint *)getPointer(_env, range_buf, &_rangeArray, &_rangeRemaining, &_rangeBufferOffset);
3087    if (_rangeRemaining < 1) {
3088        _exception = 1;
3089        _exceptionType = "java/lang/IllegalArgumentException";
3090        _exceptionMessage = "remaining() < 1 < needed";
3091        goto exit;
3092    }
3093    precision = (GLint *)getPointer(_env, precision_buf, &_precisionArray, &_precisionRemaining, &_precisionBufferOffset);
3094    if (_precisionRemaining < 1) {
3095        _exception = 1;
3096        _exceptionType = "java/lang/IllegalArgumentException";
3097        _exceptionMessage = "remaining() < 1 < needed";
3098        goto exit;
3099    }
3100    if (range == NULL) {
3101        char * _rangeBase = (char *)_env->GetPrimitiveArrayCritical(_rangeArray, (jboolean *) 0);
3102        range = (GLint *) (_rangeBase + _rangeBufferOffset);
3103    }
3104    if (precision == NULL) {
3105        char * _precisionBase = (char *)_env->GetPrimitiveArrayCritical(_precisionArray, (jboolean *) 0);
3106        precision = (GLint *) (_precisionBase + _precisionBufferOffset);
3107    }
3108    glGetShaderPrecisionFormat(
3109        (GLenum)shadertype,
3110        (GLenum)precisiontype,
3111        (GLint *)range,
3112        (GLint *)precision
3113    );
3114
3115exit:
3116    if (_precisionArray) {
3117        releasePointer(_env, _precisionArray, precision, _exception ? JNI_FALSE : JNI_TRUE);
3118    }
3119    if (_rangeArray) {
3120        releasePointer(_env, _rangeArray, range, _exception ? JNI_FALSE : JNI_TRUE);
3121    }
3122    if (_exception) {
3123        jniThrowException(_env, _exceptionType, _exceptionMessage);
3124    }
3125}
3126
3127/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3128static void
3129android_glGetShaderSource__II_3II_3BI
3130  (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jintArray length_ref, jint lengthOffset, jbyteArray source_ref, jint sourceOffset) {
3131    jint _exception = 0;
3132    const char * _exceptionType;
3133    const char * _exceptionMessage;
3134    GLsizei *length_base = (GLsizei *) 0;
3135    jint _lengthRemaining;
3136    GLsizei *length = (GLsizei *) 0;
3137    char *source_base = (char *) 0;
3138    jint _sourceRemaining;
3139    char *source = (char *) 0;
3140
3141    if (!length_ref) {
3142        _exception = 1;
3143        _exceptionType = "java/lang/IllegalArgumentException";
3144        _exceptionMessage = "length == null";
3145        goto exit;
3146    }
3147    if (lengthOffset < 0) {
3148        _exception = 1;
3149        _exceptionType = "java/lang/IllegalArgumentException";
3150        _exceptionMessage = "lengthOffset < 0";
3151        goto exit;
3152    }
3153    _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
3154    length_base = (GLsizei *)
3155        _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
3156    length = length_base + lengthOffset;
3157
3158    if (!source_ref) {
3159        _exception = 1;
3160        _exceptionType = "java/lang/IllegalArgumentException";
3161        _exceptionMessage = "source == null";
3162        goto exit;
3163    }
3164    if (sourceOffset < 0) {
3165        _exception = 1;
3166        _exceptionType = "java/lang/IllegalArgumentException";
3167        _exceptionMessage = "sourceOffset < 0";
3168        goto exit;
3169    }
3170    _sourceRemaining = _env->GetArrayLength(source_ref) - sourceOffset;
3171    source_base = (char *)
3172        _env->GetPrimitiveArrayCritical(source_ref, (jboolean *)0);
3173    source = source_base + sourceOffset;
3174
3175    glGetShaderSource(
3176        (GLuint)shader,
3177        (GLsizei)bufsize,
3178        (GLsizei *)length,
3179        (char *)source
3180    );
3181
3182exit:
3183    if (source_base) {
3184        _env->ReleasePrimitiveArrayCritical(source_ref, source_base,
3185            _exception ? JNI_ABORT: 0);
3186    }
3187    if (length_base) {
3188        _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
3189            _exception ? JNI_ABORT: 0);
3190    }
3191    if (_exception) {
3192        jniThrowException(_env, _exceptionType, _exceptionMessage);
3193    }
3194}
3195
3196/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3197static void
3198android_glGetShaderSource__IILjava_nio_IntBuffer_2B
3199  (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jobject length_buf, jbyte source) {
3200    jarray _array = (jarray) 0;
3201    jint _bufferOffset = (jint) 0;
3202    jint _remaining;
3203    GLsizei *length = (GLsizei *) 0;
3204
3205    length = (GLsizei *)getPointer(_env, length_buf, &_array, &_remaining, &_bufferOffset);
3206    if (length == NULL) {
3207        char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3208        length = (GLsizei *) (_lengthBase + _bufferOffset);
3209    }
3210    glGetShaderSource(
3211        (GLuint)shader,
3212        (GLsizei)bufsize,
3213        (GLsizei *)length,
3214        (char *)source
3215    );
3216    if (_array) {
3217        releasePointer(_env, _array, length, JNI_TRUE);
3218    }
3219}
3220
3221/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3222static jstring android_glGetShaderSource(JNIEnv *_env, jobject, jint shader) {
3223    GLint shaderLen = 0;
3224    glGetShaderiv((GLuint)shader, GL_SHADER_SOURCE_LENGTH, &shaderLen);
3225    if (!shaderLen) {
3226        return _env->NewStringUTF("");
3227    }
3228    char* buf = (char*) malloc(shaderLen);
3229    if (buf == NULL) {
3230        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
3231        return NULL;
3232    }
3233    glGetShaderSource(shader, shaderLen, NULL, buf);
3234    jstring result = _env->NewStringUTF(buf);
3235    free(buf);
3236    return result;
3237}
3238/* const GLubyte * glGetString ( GLenum name ) */
3239static jstring android_glGetString(JNIEnv* _env, jobject, jint name) {
3240    const char* chars = (const char*) glGetString((GLenum) name);
3241    return _env->NewStringUTF(chars);
3242}
3243/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
3244static void
3245android_glGetTexParameterfv__II_3FI
3246  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
3247    jint _exception = 0;
3248    const char * _exceptionType = NULL;
3249    const char * _exceptionMessage = NULL;
3250    GLfloat *params_base = (GLfloat *) 0;
3251    jint _remaining;
3252    GLfloat *params = (GLfloat *) 0;
3253
3254    if (!params_ref) {
3255        _exception = 1;
3256        _exceptionType = "java/lang/IllegalArgumentException";
3257        _exceptionMessage = "params == null";
3258        goto exit;
3259    }
3260    if (offset < 0) {
3261        _exception = 1;
3262        _exceptionType = "java/lang/IllegalArgumentException";
3263        _exceptionMessage = "offset < 0";
3264        goto exit;
3265    }
3266    _remaining = _env->GetArrayLength(params_ref) - offset;
3267    if (_remaining < 1) {
3268        _exception = 1;
3269        _exceptionType = "java/lang/IllegalArgumentException";
3270        _exceptionMessage = "length - offset < 1 < needed";
3271        goto exit;
3272    }
3273    params_base = (GLfloat *)
3274        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3275    params = params_base + offset;
3276
3277    glGetTexParameterfv(
3278        (GLenum)target,
3279        (GLenum)pname,
3280        (GLfloat *)params
3281    );
3282
3283exit:
3284    if (params_base) {
3285        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3286            _exception ? JNI_ABORT: 0);
3287    }
3288    if (_exception) {
3289        jniThrowException(_env, _exceptionType, _exceptionMessage);
3290    }
3291}
3292
3293/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
3294static void
3295android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2
3296  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3297    jint _exception = 0;
3298    const char * _exceptionType = NULL;
3299    const char * _exceptionMessage = NULL;
3300    jarray _array = (jarray) 0;
3301    jint _bufferOffset = (jint) 0;
3302    jint _remaining;
3303    GLfloat *params = (GLfloat *) 0;
3304
3305    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
3306    if (_remaining < 1) {
3307        _exception = 1;
3308        _exceptionType = "java/lang/IllegalArgumentException";
3309        _exceptionMessage = "remaining() < 1 < needed";
3310        goto exit;
3311    }
3312    if (params == NULL) {
3313        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3314        params = (GLfloat *) (_paramsBase + _bufferOffset);
3315    }
3316    glGetTexParameterfv(
3317        (GLenum)target,
3318        (GLenum)pname,
3319        (GLfloat *)params
3320    );
3321
3322exit:
3323    if (_array) {
3324        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3325    }
3326    if (_exception) {
3327        jniThrowException(_env, _exceptionType, _exceptionMessage);
3328    }
3329}
3330
3331/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3332static void
3333android_glGetTexParameteriv__II_3II
3334  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
3335    jint _exception = 0;
3336    const char * _exceptionType = NULL;
3337    const char * _exceptionMessage = NULL;
3338    GLint *params_base = (GLint *) 0;
3339    jint _remaining;
3340    GLint *params = (GLint *) 0;
3341
3342    if (!params_ref) {
3343        _exception = 1;
3344        _exceptionType = "java/lang/IllegalArgumentException";
3345        _exceptionMessage = "params == null";
3346        goto exit;
3347    }
3348    if (offset < 0) {
3349        _exception = 1;
3350        _exceptionType = "java/lang/IllegalArgumentException";
3351        _exceptionMessage = "offset < 0";
3352        goto exit;
3353    }
3354    _remaining = _env->GetArrayLength(params_ref) - offset;
3355    if (_remaining < 1) {
3356        _exception = 1;
3357        _exceptionType = "java/lang/IllegalArgumentException";
3358        _exceptionMessage = "length - offset < 1 < needed";
3359        goto exit;
3360    }
3361    params_base = (GLint *)
3362        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3363    params = params_base + offset;
3364
3365    glGetTexParameteriv(
3366        (GLenum)target,
3367        (GLenum)pname,
3368        (GLint *)params
3369    );
3370
3371exit:
3372    if (params_base) {
3373        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3374            _exception ? JNI_ABORT: 0);
3375    }
3376    if (_exception) {
3377        jniThrowException(_env, _exceptionType, _exceptionMessage);
3378    }
3379}
3380
3381/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3382static void
3383android_glGetTexParameteriv__IILjava_nio_IntBuffer_2
3384  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3385    jint _exception = 0;
3386    const char * _exceptionType = NULL;
3387    const char * _exceptionMessage = NULL;
3388    jarray _array = (jarray) 0;
3389    jint _bufferOffset = (jint) 0;
3390    jint _remaining;
3391    GLint *params = (GLint *) 0;
3392
3393    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
3394    if (_remaining < 1) {
3395        _exception = 1;
3396        _exceptionType = "java/lang/IllegalArgumentException";
3397        _exceptionMessage = "remaining() < 1 < needed";
3398        goto exit;
3399    }
3400    if (params == NULL) {
3401        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3402        params = (GLint *) (_paramsBase + _bufferOffset);
3403    }
3404    glGetTexParameteriv(
3405        (GLenum)target,
3406        (GLenum)pname,
3407        (GLint *)params
3408    );
3409
3410exit:
3411    if (_array) {
3412        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3413    }
3414    if (_exception) {
3415        jniThrowException(_env, _exceptionType, _exceptionMessage);
3416    }
3417}
3418
3419/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3420static void
3421android_glGetUniformfv__II_3FI
3422  (JNIEnv *_env, jobject _this, jint program, jint location, jfloatArray params_ref, jint offset) {
3423    jint _exception = 0;
3424    const char * _exceptionType = NULL;
3425    const char * _exceptionMessage = NULL;
3426    GLfloat *params_base = (GLfloat *) 0;
3427    jint _remaining;
3428    GLfloat *params = (GLfloat *) 0;
3429
3430    if (!params_ref) {
3431        _exception = 1;
3432        _exceptionType = "java/lang/IllegalArgumentException";
3433        _exceptionMessage = "params == null";
3434        goto exit;
3435    }
3436    if (offset < 0) {
3437        _exception = 1;
3438        _exceptionType = "java/lang/IllegalArgumentException";
3439        _exceptionMessage = "offset < 0";
3440        goto exit;
3441    }
3442    _remaining = _env->GetArrayLength(params_ref) - offset;
3443    if (_remaining < 1) {
3444        _exception = 1;
3445        _exceptionType = "java/lang/IllegalArgumentException";
3446        _exceptionMessage = "length - offset < 1 < needed";
3447        goto exit;
3448    }
3449    params_base = (GLfloat *)
3450        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3451    params = params_base + offset;
3452
3453    glGetUniformfv(
3454        (GLuint)program,
3455        (GLint)location,
3456        (GLfloat *)params
3457    );
3458
3459exit:
3460    if (params_base) {
3461        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3462            _exception ? JNI_ABORT: 0);
3463    }
3464    if (_exception) {
3465        jniThrowException(_env, _exceptionType, _exceptionMessage);
3466    }
3467}
3468
3469/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3470static void
3471android_glGetUniformfv__IILjava_nio_FloatBuffer_2
3472  (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
3473    jint _exception = 0;
3474    const char * _exceptionType = NULL;
3475    const char * _exceptionMessage = NULL;
3476    jarray _array = (jarray) 0;
3477    jint _bufferOffset = (jint) 0;
3478    jint _remaining;
3479    GLfloat *params = (GLfloat *) 0;
3480
3481    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
3482    if (_remaining < 1) {
3483        _exception = 1;
3484        _exceptionType = "java/lang/IllegalArgumentException";
3485        _exceptionMessage = "remaining() < 1 < needed";
3486        goto exit;
3487    }
3488    if (params == NULL) {
3489        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3490        params = (GLfloat *) (_paramsBase + _bufferOffset);
3491    }
3492    glGetUniformfv(
3493        (GLuint)program,
3494        (GLint)location,
3495        (GLfloat *)params
3496    );
3497
3498exit:
3499    if (_array) {
3500        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3501    }
3502    if (_exception) {
3503        jniThrowException(_env, _exceptionType, _exceptionMessage);
3504    }
3505}
3506
3507/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3508static void
3509android_glGetUniformiv__II_3II
3510  (JNIEnv *_env, jobject _this, jint program, jint location, jintArray params_ref, jint offset) {
3511    jint _exception = 0;
3512    const char * _exceptionType = NULL;
3513    const char * _exceptionMessage = NULL;
3514    GLint *params_base = (GLint *) 0;
3515    jint _remaining;
3516    GLint *params = (GLint *) 0;
3517
3518    if (!params_ref) {
3519        _exception = 1;
3520        _exceptionType = "java/lang/IllegalArgumentException";
3521        _exceptionMessage = "params == null";
3522        goto exit;
3523    }
3524    if (offset < 0) {
3525        _exception = 1;
3526        _exceptionType = "java/lang/IllegalArgumentException";
3527        _exceptionMessage = "offset < 0";
3528        goto exit;
3529    }
3530    _remaining = _env->GetArrayLength(params_ref) - offset;
3531    if (_remaining < 1) {
3532        _exception = 1;
3533        _exceptionType = "java/lang/IllegalArgumentException";
3534        _exceptionMessage = "length - offset < 1 < needed";
3535        goto exit;
3536    }
3537    params_base = (GLint *)
3538        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3539    params = params_base + offset;
3540
3541    glGetUniformiv(
3542        (GLuint)program,
3543        (GLint)location,
3544        (GLint *)params
3545    );
3546
3547exit:
3548    if (params_base) {
3549        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3550            _exception ? JNI_ABORT: 0);
3551    }
3552    if (_exception) {
3553        jniThrowException(_env, _exceptionType, _exceptionMessage);
3554    }
3555}
3556
3557/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3558static void
3559android_glGetUniformiv__IILjava_nio_IntBuffer_2
3560  (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
3561    jint _exception = 0;
3562    const char * _exceptionType = NULL;
3563    const char * _exceptionMessage = NULL;
3564    jarray _array = (jarray) 0;
3565    jint _bufferOffset = (jint) 0;
3566    jint _remaining;
3567    GLint *params = (GLint *) 0;
3568
3569    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
3570    if (_remaining < 1) {
3571        _exception = 1;
3572        _exceptionType = "java/lang/IllegalArgumentException";
3573        _exceptionMessage = "remaining() < 1 < needed";
3574        goto exit;
3575    }
3576    if (params == NULL) {
3577        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3578        params = (GLint *) (_paramsBase + _bufferOffset);
3579    }
3580    glGetUniformiv(
3581        (GLuint)program,
3582        (GLint)location,
3583        (GLint *)params
3584    );
3585
3586exit:
3587    if (_array) {
3588        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3589    }
3590    if (_exception) {
3591        jniThrowException(_env, _exceptionType, _exceptionMessage);
3592    }
3593}
3594
3595/* GLint glGetUniformLocation ( GLuint program, const char *name ) */
3596static jint
3597android_glGetUniformLocation__ILjava_lang_String_2
3598  (JNIEnv *_env, jobject _this, jint program, jstring name) {
3599    jint _exception = 0;
3600    const char * _exceptionType = NULL;
3601    const char * _exceptionMessage = NULL;
3602    GLint _returnValue = 0;
3603    const char* _nativename = 0;
3604
3605    if (!name) {
3606        _exception = 1;
3607        _exceptionType = "java/lang/IllegalArgumentException";
3608        _exceptionMessage = "name == null";
3609        goto exit;
3610    }
3611    _nativename = _env->GetStringUTFChars(name, 0);
3612
3613    _returnValue = glGetUniformLocation(
3614        (GLuint)program,
3615        (char *)_nativename
3616    );
3617
3618exit:
3619    if (_nativename) {
3620        _env->ReleaseStringUTFChars(name, _nativename);
3621    }
3622
3623    if (_exception) {
3624        jniThrowException(_env, _exceptionType, _exceptionMessage);
3625    }
3626    return (jint)_returnValue;
3627}
3628
3629/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3630static void
3631android_glGetVertexAttribfv__II_3FI
3632  (JNIEnv *_env, jobject _this, jint index, jint pname, jfloatArray params_ref, jint offset) {
3633    jint _exception = 0;
3634    const char * _exceptionType = NULL;
3635    const char * _exceptionMessage = NULL;
3636    GLfloat *params_base = (GLfloat *) 0;
3637    jint _remaining;
3638    GLfloat *params = (GLfloat *) 0;
3639
3640    if (!params_ref) {
3641        _exception = 1;
3642        _exceptionType = "java/lang/IllegalArgumentException";
3643        _exceptionMessage = "params == null";
3644        goto exit;
3645    }
3646    if (offset < 0) {
3647        _exception = 1;
3648        _exceptionType = "java/lang/IllegalArgumentException";
3649        _exceptionMessage = "offset < 0";
3650        goto exit;
3651    }
3652    _remaining = _env->GetArrayLength(params_ref) - offset;
3653    int _needed;
3654    switch (pname) {
3655#if defined(GL_CURRENT_VERTEX_ATTRIB)
3656        case GL_CURRENT_VERTEX_ATTRIB:
3657#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3658            _needed = 4;
3659            break;
3660        default:
3661            _needed = 1;
3662            break;
3663    }
3664    if (_remaining < _needed) {
3665        _exception = 1;
3666        _exceptionType = "java/lang/IllegalArgumentException";
3667        _exceptionMessage = "length - offset < needed";
3668        goto exit;
3669    }
3670    params_base = (GLfloat *)
3671        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3672    params = params_base + offset;
3673
3674    glGetVertexAttribfv(
3675        (GLuint)index,
3676        (GLenum)pname,
3677        (GLfloat *)params
3678    );
3679
3680exit:
3681    if (params_base) {
3682        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3683            _exception ? JNI_ABORT: 0);
3684    }
3685    if (_exception) {
3686        jniThrowException(_env, _exceptionType, _exceptionMessage);
3687    }
3688}
3689
3690/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3691static void
3692android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2
3693  (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
3694    jint _exception = 0;
3695    const char * _exceptionType = NULL;
3696    const char * _exceptionMessage = NULL;
3697    jarray _array = (jarray) 0;
3698    jint _bufferOffset = (jint) 0;
3699    jint _remaining;
3700    GLfloat *params = (GLfloat *) 0;
3701
3702    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
3703    int _needed;
3704    switch (pname) {
3705#if defined(GL_CURRENT_VERTEX_ATTRIB)
3706        case GL_CURRENT_VERTEX_ATTRIB:
3707#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3708            _needed = 4;
3709            break;
3710        default:
3711            _needed = 1;
3712            break;
3713    }
3714    if (_remaining < _needed) {
3715        _exception = 1;
3716        _exceptionType = "java/lang/IllegalArgumentException";
3717        _exceptionMessage = "remaining() < needed";
3718        goto exit;
3719    }
3720    if (params == NULL) {
3721        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3722        params = (GLfloat *) (_paramsBase + _bufferOffset);
3723    }
3724    glGetVertexAttribfv(
3725        (GLuint)index,
3726        (GLenum)pname,
3727        (GLfloat *)params
3728    );
3729
3730exit:
3731    if (_array) {
3732        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3733    }
3734    if (_exception) {
3735        jniThrowException(_env, _exceptionType, _exceptionMessage);
3736    }
3737}
3738
3739/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
3740static void
3741android_glGetVertexAttribiv__II_3II
3742  (JNIEnv *_env, jobject _this, jint index, jint pname, jintArray params_ref, jint offset) {
3743    jint _exception = 0;
3744    const char * _exceptionType = NULL;
3745    const char * _exceptionMessage = NULL;
3746    GLint *params_base = (GLint *) 0;
3747    jint _remaining;
3748    GLint *params = (GLint *) 0;
3749
3750    if (!params_ref) {
3751        _exception = 1;
3752        _exceptionType = "java/lang/IllegalArgumentException";
3753        _exceptionMessage = "params == null";
3754        goto exit;
3755    }
3756    if (offset < 0) {
3757        _exception = 1;
3758        _exceptionType = "java/lang/IllegalArgumentException";
3759        _exceptionMessage = "offset < 0";
3760        goto exit;
3761    }
3762    _remaining = _env->GetArrayLength(params_ref) - offset;
3763    int _needed;
3764    switch (pname) {
3765#if defined(GL_CURRENT_VERTEX_ATTRIB)
3766        case GL_CURRENT_VERTEX_ATTRIB:
3767#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3768            _needed = 4;
3769            break;
3770        default:
3771            _needed = 1;
3772            break;
3773    }
3774    if (_remaining < _needed) {
3775        _exception = 1;
3776        _exceptionType = "java/lang/IllegalArgumentException";
3777        _exceptionMessage = "length - offset < needed";
3778        goto exit;
3779    }
3780    params_base = (GLint *)
3781        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3782    params = params_base + offset;
3783
3784    glGetVertexAttribiv(
3785        (GLuint)index,
3786        (GLenum)pname,
3787        (GLint *)params
3788    );
3789
3790exit:
3791    if (params_base) {
3792        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3793            _exception ? JNI_ABORT: 0);
3794    }
3795    if (_exception) {
3796        jniThrowException(_env, _exceptionType, _exceptionMessage);
3797    }
3798}
3799
3800/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
3801static void
3802android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2
3803  (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
3804    jint _exception = 0;
3805    const char * _exceptionType = NULL;
3806    const char * _exceptionMessage = NULL;
3807    jarray _array = (jarray) 0;
3808    jint _bufferOffset = (jint) 0;
3809    jint _remaining;
3810    GLint *params = (GLint *) 0;
3811
3812    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
3813    int _needed;
3814    switch (pname) {
3815#if defined(GL_CURRENT_VERTEX_ATTRIB)
3816        case GL_CURRENT_VERTEX_ATTRIB:
3817#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3818            _needed = 4;
3819            break;
3820        default:
3821            _needed = 1;
3822            break;
3823    }
3824    if (_remaining < _needed) {
3825        _exception = 1;
3826        _exceptionType = "java/lang/IllegalArgumentException";
3827        _exceptionMessage = "remaining() < needed";
3828        goto exit;
3829    }
3830    if (params == NULL) {
3831        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3832        params = (GLint *) (_paramsBase + _bufferOffset);
3833    }
3834    glGetVertexAttribiv(
3835        (GLuint)index,
3836        (GLenum)pname,
3837        (GLint *)params
3838    );
3839
3840exit:
3841    if (_array) {
3842        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3843    }
3844    if (_exception) {
3845        jniThrowException(_env, _exceptionType, _exceptionMessage);
3846    }
3847}
3848
3849/* void glHint ( GLenum target, GLenum mode ) */
3850static void
3851android_glHint__II
3852  (JNIEnv *_env, jobject _this, jint target, jint mode) {
3853    glHint(
3854        (GLenum)target,
3855        (GLenum)mode
3856    );
3857}
3858
3859/* GLboolean glIsBuffer ( GLuint buffer ) */
3860static jboolean
3861android_glIsBuffer__I
3862  (JNIEnv *_env, jobject _this, jint buffer) {
3863    GLboolean _returnValue;
3864    _returnValue = glIsBuffer(
3865        (GLuint)buffer
3866    );
3867    return (jboolean)_returnValue;
3868}
3869
3870/* GLboolean glIsEnabled ( GLenum cap ) */
3871static jboolean
3872android_glIsEnabled__I
3873  (JNIEnv *_env, jobject _this, jint cap) {
3874    GLboolean _returnValue;
3875    _returnValue = glIsEnabled(
3876        (GLenum)cap
3877    );
3878    return (jboolean)_returnValue;
3879}
3880
3881/* GLboolean glIsFramebuffer ( GLuint framebuffer ) */
3882static jboolean
3883android_glIsFramebuffer__I
3884  (JNIEnv *_env, jobject _this, jint framebuffer) {
3885    GLboolean _returnValue;
3886    _returnValue = glIsFramebuffer(
3887        (GLuint)framebuffer
3888    );
3889    return (jboolean)_returnValue;
3890}
3891
3892/* GLboolean glIsProgram ( GLuint program ) */
3893static jboolean
3894android_glIsProgram__I
3895  (JNIEnv *_env, jobject _this, jint program) {
3896    GLboolean _returnValue;
3897    _returnValue = glIsProgram(
3898        (GLuint)program
3899    );
3900    return (jboolean)_returnValue;
3901}
3902
3903/* GLboolean glIsRenderbuffer ( GLuint renderbuffer ) */
3904static jboolean
3905android_glIsRenderbuffer__I
3906  (JNIEnv *_env, jobject _this, jint renderbuffer) {
3907    GLboolean _returnValue;
3908    _returnValue = glIsRenderbuffer(
3909        (GLuint)renderbuffer
3910    );
3911    return (jboolean)_returnValue;
3912}
3913
3914/* GLboolean glIsShader ( GLuint shader ) */
3915static jboolean
3916android_glIsShader__I
3917  (JNIEnv *_env, jobject _this, jint shader) {
3918    GLboolean _returnValue;
3919    _returnValue = glIsShader(
3920        (GLuint)shader
3921    );
3922    return (jboolean)_returnValue;
3923}
3924
3925/* GLboolean glIsTexture ( GLuint texture ) */
3926static jboolean
3927android_glIsTexture__I
3928  (JNIEnv *_env, jobject _this, jint texture) {
3929    GLboolean _returnValue;
3930    _returnValue = glIsTexture(
3931        (GLuint)texture
3932    );
3933    return (jboolean)_returnValue;
3934}
3935
3936/* void glLineWidth ( GLfloat width ) */
3937static void
3938android_glLineWidth__F
3939  (JNIEnv *_env, jobject _this, jfloat width) {
3940    glLineWidth(
3941        (GLfloat)width
3942    );
3943}
3944
3945/* void glLinkProgram ( GLuint program ) */
3946static void
3947android_glLinkProgram__I
3948  (JNIEnv *_env, jobject _this, jint program) {
3949    glLinkProgram(
3950        (GLuint)program
3951    );
3952}
3953
3954/* void glPixelStorei ( GLenum pname, GLint param ) */
3955static void
3956android_glPixelStorei__II
3957  (JNIEnv *_env, jobject _this, jint pname, jint param) {
3958    glPixelStorei(
3959        (GLenum)pname,
3960        (GLint)param
3961    );
3962}
3963
3964/* void glPolygonOffset ( GLfloat factor, GLfloat units ) */
3965static void
3966android_glPolygonOffset__FF
3967  (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) {
3968    glPolygonOffset(
3969        (GLfloat)factor,
3970        (GLfloat)units
3971    );
3972}
3973
3974/* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */
3975static void
3976android_glReadPixels__IIIIIILjava_nio_Buffer_2
3977  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) {
3978    jarray _array = (jarray) 0;
3979    jint _bufferOffset = (jint) 0;
3980    jint _remaining;
3981    GLvoid *pixels = (GLvoid *) 0;
3982
3983    pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
3984    if (pixels == NULL) {
3985        char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3986        pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
3987    }
3988    glReadPixels(
3989        (GLint)x,
3990        (GLint)y,
3991        (GLsizei)width,
3992        (GLsizei)height,
3993        (GLenum)format,
3994        (GLenum)type,
3995        (GLvoid *)pixels
3996    );
3997    if (_array) {
3998        releasePointer(_env, _array, pixels, JNI_TRUE);
3999    }
4000}
4001
4002/* void glReleaseShaderCompiler ( void ) */
4003static void
4004android_glReleaseShaderCompiler__
4005  (JNIEnv *_env, jobject _this) {
4006    glReleaseShaderCompiler();
4007}
4008
4009/* void glRenderbufferStorage ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) */
4010static void
4011android_glRenderbufferStorage__IIII
4012  (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint width, jint height) {
4013    glRenderbufferStorage(
4014        (GLenum)target,
4015        (GLenum)internalformat,
4016        (GLsizei)width,
4017        (GLsizei)height
4018    );
4019}
4020
4021/* void glSampleCoverage ( GLclampf value, GLboolean invert ) */
4022static void
4023android_glSampleCoverage__FZ
4024  (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) {
4025    glSampleCoverage(
4026        (GLclampf)value,
4027        (GLboolean)invert
4028    );
4029}
4030
4031/* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */
4032static void
4033android_glScissor__IIII
4034  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
4035    glScissor(
4036        (GLint)x,
4037        (GLint)y,
4038        (GLsizei)width,
4039        (GLsizei)height
4040    );
4041}
4042
4043/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
4044static void
4045android_glShaderBinary__I_3IIILjava_nio_Buffer_2I
4046  (JNIEnv *_env, jobject _this, jint n, jintArray shaders_ref, jint offset, jint binaryformat, jobject binary_buf, jint length) {
4047    jint _exception = 0;
4048    const char * _exceptionType = NULL;
4049    const char * _exceptionMessage = NULL;
4050    jarray _array = (jarray) 0;
4051    jint _bufferOffset = (jint) 0;
4052    GLuint *shaders_base = (GLuint *) 0;
4053    jint _shadersRemaining;
4054    GLuint *shaders = (GLuint *) 0;
4055    jint _binaryRemaining;
4056    GLvoid *binary = (GLvoid *) 0;
4057
4058    if (!shaders_ref) {
4059        _exception = 1;
4060        _exceptionType = "java/lang/IllegalArgumentException";
4061        _exceptionMessage = "shaders == null";
4062        goto exit;
4063    }
4064    if (offset < 0) {
4065        _exception = 1;
4066        _exceptionType = "java/lang/IllegalArgumentException";
4067        _exceptionMessage = "offset < 0";
4068        goto exit;
4069    }
4070    _shadersRemaining = _env->GetArrayLength(shaders_ref) - offset;
4071    shaders_base = (GLuint *)
4072        _env->GetPrimitiveArrayCritical(shaders_ref, (jboolean *)0);
4073    shaders = shaders_base + offset;
4074
4075    binary = (GLvoid *)getPointer(_env, binary_buf, &_array, &_binaryRemaining, &_bufferOffset);
4076    if (_binaryRemaining < length) {
4077        _exception = 1;
4078        _exceptionType = "java/lang/IllegalArgumentException";
4079        _exceptionMessage = "remaining() < length < needed";
4080        goto exit;
4081    }
4082    if (binary == NULL) {
4083        char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4084        binary = (GLvoid *) (_binaryBase + _bufferOffset);
4085    }
4086    glShaderBinary(
4087        (GLsizei)n,
4088        (GLuint *)shaders,
4089        (GLenum)binaryformat,
4090        (GLvoid *)binary,
4091        (GLsizei)length
4092    );
4093
4094exit:
4095    if (_array) {
4096        releasePointer(_env, _array, binary, JNI_FALSE);
4097    }
4098    if (shaders_base) {
4099        _env->ReleasePrimitiveArrayCritical(shaders_ref, shaders_base,
4100            JNI_ABORT);
4101    }
4102    if (_exception) {
4103        jniThrowException(_env, _exceptionType, _exceptionMessage);
4104    }
4105}
4106
4107/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
4108static void
4109android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I
4110  (JNIEnv *_env, jobject _this, jint n, jobject shaders_buf, jint binaryformat, jobject binary_buf, jint length) {
4111    jint _exception = 0;
4112    const char * _exceptionType = NULL;
4113    const char * _exceptionMessage = NULL;
4114    jarray _shadersArray = (jarray) 0;
4115    jint _shadersBufferOffset = (jint) 0;
4116    jarray _binaryArray = (jarray) 0;
4117    jint _binaryBufferOffset = (jint) 0;
4118    jint _shadersRemaining;
4119    GLuint *shaders = (GLuint *) 0;
4120    jint _binaryRemaining;
4121    GLvoid *binary = (GLvoid *) 0;
4122
4123    shaders = (GLuint *)getPointer(_env, shaders_buf, &_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
4124    binary = (GLvoid *)getPointer(_env, binary_buf, &_binaryArray, &_binaryRemaining, &_binaryBufferOffset);
4125    if (_binaryRemaining < length) {
4126        _exception = 1;
4127        _exceptionType = "java/lang/IllegalArgumentException";
4128        _exceptionMessage = "remaining() < length < needed";
4129        goto exit;
4130    }
4131    if (shaders == NULL) {
4132        char * _shadersBase = (char *)_env->GetPrimitiveArrayCritical(_shadersArray, (jboolean *) 0);
4133        shaders = (GLuint *) (_shadersBase + _shadersBufferOffset);
4134    }
4135    if (binary == NULL) {
4136        char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_binaryArray, (jboolean *) 0);
4137        binary = (GLvoid *) (_binaryBase + _binaryBufferOffset);
4138    }
4139    glShaderBinary(
4140        (GLsizei)n,
4141        (GLuint *)shaders,
4142        (GLenum)binaryformat,
4143        (GLvoid *)binary,
4144        (GLsizei)length
4145    );
4146
4147exit:
4148    if (_binaryArray) {
4149        releasePointer(_env, _binaryArray, binary, JNI_FALSE);
4150    }
4151    if (_shadersArray) {
4152        releasePointer(_env, _shadersArray, shaders, JNI_FALSE);
4153    }
4154    if (_exception) {
4155        jniThrowException(_env, _exceptionType, _exceptionMessage);
4156    }
4157}
4158
4159
4160/* void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint * length ) */
4161static
4162void
4163android_glShaderSource
4164    (JNIEnv *_env, jobject _this, jint shader, jstring string) {
4165
4166    if (!string) {
4167        jniThrowException(_env, "java/lang/IllegalArgumentException", "string == null");
4168        return;
4169    }
4170
4171    const char* nativeString = _env->GetStringUTFChars(string, 0);
4172    const char* strings[] = {nativeString};
4173    glShaderSource(shader, 1, strings, 0);
4174    _env->ReleaseStringUTFChars(string, nativeString);
4175}
4176/* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */
4177static void
4178android_glStencilFunc__III
4179  (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) {
4180    glStencilFunc(
4181        (GLenum)func,
4182        (GLint)ref,
4183        (GLuint)mask
4184    );
4185}
4186
4187/* void glStencilFuncSeparate ( GLenum face, GLenum func, GLint ref, GLuint mask ) */
4188static void
4189android_glStencilFuncSeparate__IIII
4190  (JNIEnv *_env, jobject _this, jint face, jint func, jint ref, jint mask) {
4191    glStencilFuncSeparate(
4192        (GLenum)face,
4193        (GLenum)func,
4194        (GLint)ref,
4195        (GLuint)mask
4196    );
4197}
4198
4199/* void glStencilMask ( GLuint mask ) */
4200static void
4201android_glStencilMask__I
4202  (JNIEnv *_env, jobject _this, jint mask) {
4203    glStencilMask(
4204        (GLuint)mask
4205    );
4206}
4207
4208/* void glStencilMaskSeparate ( GLenum face, GLuint mask ) */
4209static void
4210android_glStencilMaskSeparate__II
4211  (JNIEnv *_env, jobject _this, jint face, jint mask) {
4212    glStencilMaskSeparate(
4213        (GLenum)face,
4214        (GLuint)mask
4215    );
4216}
4217
4218/* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */
4219static void
4220android_glStencilOp__III
4221  (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) {
4222    glStencilOp(
4223        (GLenum)fail,
4224        (GLenum)zfail,
4225        (GLenum)zpass
4226    );
4227}
4228
4229/* void glStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) */
4230static void
4231android_glStencilOpSeparate__IIII
4232  (JNIEnv *_env, jobject _this, jint face, jint fail, jint zfail, jint zpass) {
4233    glStencilOpSeparate(
4234        (GLenum)face,
4235        (GLenum)fail,
4236        (GLenum)zfail,
4237        (GLenum)zpass
4238    );
4239}
4240
4241/* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */
4242static void
4243android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2
4244  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) {
4245    jarray _array = (jarray) 0;
4246    jint _bufferOffset = (jint) 0;
4247    jint _remaining;
4248    GLvoid *pixels = (GLvoid *) 0;
4249
4250    if (pixels_buf) {
4251        pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
4252    }
4253    if (pixels_buf && pixels == NULL) {
4254        char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4255        pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
4256    }
4257    glTexImage2D(
4258        (GLenum)target,
4259        (GLint)level,
4260        (GLint)internalformat,
4261        (GLsizei)width,
4262        (GLsizei)height,
4263        (GLint)border,
4264        (GLenum)format,
4265        (GLenum)type,
4266        (GLvoid *)pixels
4267    );
4268    if (_array) {
4269        releasePointer(_env, _array, pixels, JNI_FALSE);
4270    }
4271}
4272
4273/* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */
4274static void
4275android_glTexParameterf__IIF
4276  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
4277    glTexParameterf(
4278        (GLenum)target,
4279        (GLenum)pname,
4280        (GLfloat)param
4281    );
4282}
4283
4284/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
4285static void
4286android_glTexParameterfv__II_3FI
4287  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
4288    jint _exception = 0;
4289    const char * _exceptionType = NULL;
4290    const char * _exceptionMessage = NULL;
4291    GLfloat *params_base = (GLfloat *) 0;
4292    jint _remaining;
4293    GLfloat *params = (GLfloat *) 0;
4294
4295    if (!params_ref) {
4296        _exception = 1;
4297        _exceptionType = "java/lang/IllegalArgumentException";
4298        _exceptionMessage = "params == null";
4299        goto exit;
4300    }
4301    if (offset < 0) {
4302        _exception = 1;
4303        _exceptionType = "java/lang/IllegalArgumentException";
4304        _exceptionMessage = "offset < 0";
4305        goto exit;
4306    }
4307    _remaining = _env->GetArrayLength(params_ref) - offset;
4308    if (_remaining < 1) {
4309        _exception = 1;
4310        _exceptionType = "java/lang/IllegalArgumentException";
4311        _exceptionMessage = "length - offset < 1 < needed";
4312        goto exit;
4313    }
4314    params_base = (GLfloat *)
4315        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
4316    params = params_base + offset;
4317
4318    glTexParameterfv(
4319        (GLenum)target,
4320        (GLenum)pname,
4321        (GLfloat *)params
4322    );
4323
4324exit:
4325    if (params_base) {
4326        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
4327            JNI_ABORT);
4328    }
4329    if (_exception) {
4330        jniThrowException(_env, _exceptionType, _exceptionMessage);
4331    }
4332}
4333
4334/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
4335static void
4336android_glTexParameterfv__IILjava_nio_FloatBuffer_2
4337  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
4338    jint _exception = 0;
4339    const char * _exceptionType = NULL;
4340    const char * _exceptionMessage = NULL;
4341    jarray _array = (jarray) 0;
4342    jint _bufferOffset = (jint) 0;
4343    jint _remaining;
4344    GLfloat *params = (GLfloat *) 0;
4345
4346    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
4347    if (_remaining < 1) {
4348        _exception = 1;
4349        _exceptionType = "java/lang/IllegalArgumentException";
4350        _exceptionMessage = "remaining() < 1 < needed";
4351        goto exit;
4352    }
4353    if (params == NULL) {
4354        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4355        params = (GLfloat *) (_paramsBase + _bufferOffset);
4356    }
4357    glTexParameterfv(
4358        (GLenum)target,
4359        (GLenum)pname,
4360        (GLfloat *)params
4361    );
4362
4363exit:
4364    if (_array) {
4365        releasePointer(_env, _array, params, JNI_FALSE);
4366    }
4367    if (_exception) {
4368        jniThrowException(_env, _exceptionType, _exceptionMessage);
4369    }
4370}
4371
4372/* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */
4373static void
4374android_glTexParameteri__III
4375  (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
4376    glTexParameteri(
4377        (GLenum)target,
4378        (GLenum)pname,
4379        (GLint)param
4380    );
4381}
4382
4383/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
4384static void
4385android_glTexParameteriv__II_3II
4386  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
4387    jint _exception = 0;
4388    const char * _exceptionType = NULL;
4389    const char * _exceptionMessage = NULL;
4390    GLint *params_base = (GLint *) 0;
4391    jint _remaining;
4392    GLint *params = (GLint *) 0;
4393
4394    if (!params_ref) {
4395        _exception = 1;
4396        _exceptionType = "java/lang/IllegalArgumentException";
4397        _exceptionMessage = "params == null";
4398        goto exit;
4399    }
4400    if (offset < 0) {
4401        _exception = 1;
4402        _exceptionType = "java/lang/IllegalArgumentException";
4403        _exceptionMessage = "offset < 0";
4404        goto exit;
4405    }
4406    _remaining = _env->GetArrayLength(params_ref) - offset;
4407    if (_remaining < 1) {
4408        _exception = 1;
4409        _exceptionType = "java/lang/IllegalArgumentException";
4410        _exceptionMessage = "length - offset < 1 < needed";
4411        goto exit;
4412    }
4413    params_base = (GLint *)
4414        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
4415    params = params_base + offset;
4416
4417    glTexParameteriv(
4418        (GLenum)target,
4419        (GLenum)pname,
4420        (GLint *)params
4421    );
4422
4423exit:
4424    if (params_base) {
4425        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
4426            JNI_ABORT);
4427    }
4428    if (_exception) {
4429        jniThrowException(_env, _exceptionType, _exceptionMessage);
4430    }
4431}
4432
4433/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
4434static void
4435android_glTexParameteriv__IILjava_nio_IntBuffer_2
4436  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
4437    jint _exception = 0;
4438    const char * _exceptionType = NULL;
4439    const char * _exceptionMessage = NULL;
4440    jarray _array = (jarray) 0;
4441    jint _bufferOffset = (jint) 0;
4442    jint _remaining;
4443    GLint *params = (GLint *) 0;
4444
4445    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
4446    if (_remaining < 1) {
4447        _exception = 1;
4448        _exceptionType = "java/lang/IllegalArgumentException";
4449        _exceptionMessage = "remaining() < 1 < needed";
4450        goto exit;
4451    }
4452    if (params == NULL) {
4453        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4454        params = (GLint *) (_paramsBase + _bufferOffset);
4455    }
4456    glTexParameteriv(
4457        (GLenum)target,
4458        (GLenum)pname,
4459        (GLint *)params
4460    );
4461
4462exit:
4463    if (_array) {
4464        releasePointer(_env, _array, params, JNI_FALSE);
4465    }
4466    if (_exception) {
4467        jniThrowException(_env, _exceptionType, _exceptionMessage);
4468    }
4469}
4470
4471/* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */
4472static void
4473android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
4474  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) {
4475    jarray _array = (jarray) 0;
4476    jint _bufferOffset = (jint) 0;
4477    jint _remaining;
4478    GLvoid *pixels = (GLvoid *) 0;
4479
4480    if (pixels_buf) {
4481        pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
4482    }
4483    if (pixels_buf && pixels == NULL) {
4484        char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4485        pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
4486    }
4487    glTexSubImage2D(
4488        (GLenum)target,
4489        (GLint)level,
4490        (GLint)xoffset,
4491        (GLint)yoffset,
4492        (GLsizei)width,
4493        (GLsizei)height,
4494        (GLenum)format,
4495        (GLenum)type,
4496        (GLvoid *)pixels
4497    );
4498    if (_array) {
4499        releasePointer(_env, _array, pixels, JNI_FALSE);
4500    }
4501}
4502
4503/* void glUniform1f ( GLint location, GLfloat x ) */
4504static void
4505android_glUniform1f__IF
4506  (JNIEnv *_env, jobject _this, jint location, jfloat x) {
4507    glUniform1f(
4508        (GLint)location,
4509        (GLfloat)x
4510    );
4511}
4512
4513/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
4514static void
4515android_glUniform1fv__II_3FI
4516  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
4517    jint _exception = 0;
4518    const char * _exceptionType = NULL;
4519    const char * _exceptionMessage = NULL;
4520    GLfloat *v_base = (GLfloat *) 0;
4521    jint _remaining;
4522    GLfloat *v = (GLfloat *) 0;
4523
4524    if (!v_ref) {
4525        _exception = 1;
4526        _exceptionType = "java/lang/IllegalArgumentException";
4527        _exceptionMessage = "v == null";
4528        goto exit;
4529    }
4530    if (offset < 0) {
4531        _exception = 1;
4532        _exceptionType = "java/lang/IllegalArgumentException";
4533        _exceptionMessage = "offset < 0";
4534        goto exit;
4535    }
4536    _remaining = _env->GetArrayLength(v_ref) - offset;
4537    if (_remaining < count) {
4538        _exception = 1;
4539        _exceptionType = "java/lang/IllegalArgumentException";
4540        _exceptionMessage = "length - offset < count < needed";
4541        goto exit;
4542    }
4543    v_base = (GLfloat *)
4544        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4545    v = v_base + offset;
4546
4547    glUniform1fv(
4548        (GLint)location,
4549        (GLsizei)count,
4550        (GLfloat *)v
4551    );
4552
4553exit:
4554    if (v_base) {
4555        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4556            JNI_ABORT);
4557    }
4558    if (_exception) {
4559        jniThrowException(_env, _exceptionType, _exceptionMessage);
4560    }
4561}
4562
4563/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
4564static void
4565android_glUniform1fv__IILjava_nio_FloatBuffer_2
4566  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
4567    jint _exception = 0;
4568    const char * _exceptionType = NULL;
4569    const char * _exceptionMessage = NULL;
4570    jarray _array = (jarray) 0;
4571    jint _bufferOffset = (jint) 0;
4572    jint _remaining;
4573    GLfloat *v = (GLfloat *) 0;
4574
4575    v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
4576    if (_remaining < count) {
4577        _exception = 1;
4578        _exceptionType = "java/lang/IllegalArgumentException";
4579        _exceptionMessage = "remaining() < count < needed";
4580        goto exit;
4581    }
4582    if (v == NULL) {
4583        char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4584        v = (GLfloat *) (_vBase + _bufferOffset);
4585    }
4586    glUniform1fv(
4587        (GLint)location,
4588        (GLsizei)count,
4589        (GLfloat *)v
4590    );
4591
4592exit:
4593    if (_array) {
4594        releasePointer(_env, _array, v, JNI_FALSE);
4595    }
4596    if (_exception) {
4597        jniThrowException(_env, _exceptionType, _exceptionMessage);
4598    }
4599}
4600
4601/* void glUniform1i ( GLint location, GLint x ) */
4602static void
4603android_glUniform1i__II
4604  (JNIEnv *_env, jobject _this, jint location, jint x) {
4605    glUniform1i(
4606        (GLint)location,
4607        (GLint)x
4608    );
4609}
4610
4611/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
4612static void
4613android_glUniform1iv__II_3II
4614  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
4615    jint _exception = 0;
4616    const char * _exceptionType = NULL;
4617    const char * _exceptionMessage = NULL;
4618    GLint *v_base = (GLint *) 0;
4619    jint _remaining;
4620    GLint *v = (GLint *) 0;
4621
4622    if (!v_ref) {
4623        _exception = 1;
4624        _exceptionType = "java/lang/IllegalArgumentException";
4625        _exceptionMessage = "v == null";
4626        goto exit;
4627    }
4628    if (offset < 0) {
4629        _exception = 1;
4630        _exceptionType = "java/lang/IllegalArgumentException";
4631        _exceptionMessage = "offset < 0";
4632        goto exit;
4633    }
4634    _remaining = _env->GetArrayLength(v_ref) - offset;
4635    if (_remaining < count) {
4636        _exception = 1;
4637        _exceptionType = "java/lang/IllegalArgumentException";
4638        _exceptionMessage = "length - offset < count < needed";
4639        goto exit;
4640    }
4641    v_base = (GLint *)
4642        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4643    v = v_base + offset;
4644
4645    glUniform1iv(
4646        (GLint)location,
4647        (GLsizei)count,
4648        (GLint *)v
4649    );
4650
4651exit:
4652    if (v_base) {
4653        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4654            JNI_ABORT);
4655    }
4656    if (_exception) {
4657        jniThrowException(_env, _exceptionType, _exceptionMessage);
4658    }
4659}
4660
4661/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
4662static void
4663android_glUniform1iv__IILjava_nio_IntBuffer_2
4664  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
4665    jint _exception = 0;
4666    const char * _exceptionType = NULL;
4667    const char * _exceptionMessage = NULL;
4668    jarray _array = (jarray) 0;
4669    jint _bufferOffset = (jint) 0;
4670    jint _remaining;
4671    GLint *v = (GLint *) 0;
4672
4673    v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
4674    if (_remaining < count) {
4675        _exception = 1;
4676        _exceptionType = "java/lang/IllegalArgumentException";
4677        _exceptionMessage = "remaining() < count < needed";
4678        goto exit;
4679    }
4680    if (v == NULL) {
4681        char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4682        v = (GLint *) (_vBase + _bufferOffset);
4683    }
4684    glUniform1iv(
4685        (GLint)location,
4686        (GLsizei)count,
4687        (GLint *)v
4688    );
4689
4690exit:
4691    if (_array) {
4692        releasePointer(_env, _array, v, JNI_FALSE);
4693    }
4694    if (_exception) {
4695        jniThrowException(_env, _exceptionType, _exceptionMessage);
4696    }
4697}
4698
4699/* void glUniform2f ( GLint location, GLfloat x, GLfloat y ) */
4700static void
4701android_glUniform2f__IFF
4702  (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y) {
4703    glUniform2f(
4704        (GLint)location,
4705        (GLfloat)x,
4706        (GLfloat)y
4707    );
4708}
4709
4710/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
4711static void
4712android_glUniform2fv__II_3FI
4713  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
4714    jint _exception = 0;
4715    const char * _exceptionType = NULL;
4716    const char * _exceptionMessage = NULL;
4717    GLfloat *v_base = (GLfloat *) 0;
4718    jint _remaining;
4719    GLfloat *v = (GLfloat *) 0;
4720
4721    if (!v_ref) {
4722        _exception = 1;
4723        _exceptionType = "java/lang/IllegalArgumentException";
4724        _exceptionMessage = "v == null";
4725        goto exit;
4726    }
4727    if (offset < 0) {
4728        _exception = 1;
4729        _exceptionType = "java/lang/IllegalArgumentException";
4730        _exceptionMessage = "offset < 0";
4731        goto exit;
4732    }
4733    _remaining = _env->GetArrayLength(v_ref) - offset;
4734    if (_remaining < count*2) {
4735        _exception = 1;
4736        _exceptionType = "java/lang/IllegalArgumentException";
4737        _exceptionMessage = "length - offset < count*2 < needed";
4738        goto exit;
4739    }
4740    v_base = (GLfloat *)
4741        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4742    v = v_base + offset;
4743
4744    glUniform2fv(
4745        (GLint)location,
4746        (GLsizei)count,
4747        (GLfloat *)v
4748    );
4749
4750exit:
4751    if (v_base) {
4752        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4753            JNI_ABORT);
4754    }
4755    if (_exception) {
4756        jniThrowException(_env, _exceptionType, _exceptionMessage);
4757    }
4758}
4759
4760/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
4761static void
4762android_glUniform2fv__IILjava_nio_FloatBuffer_2
4763  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
4764    jint _exception = 0;
4765    const char * _exceptionType = NULL;
4766    const char * _exceptionMessage = NULL;
4767    jarray _array = (jarray) 0;
4768    jint _bufferOffset = (jint) 0;
4769    jint _remaining;
4770    GLfloat *v = (GLfloat *) 0;
4771
4772    v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
4773    if (_remaining < count*2) {
4774        _exception = 1;
4775        _exceptionType = "java/lang/IllegalArgumentException";
4776        _exceptionMessage = "remaining() < count*2 < needed";
4777        goto exit;
4778    }
4779    if (v == NULL) {
4780        char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4781        v = (GLfloat *) (_vBase + _bufferOffset);
4782    }
4783    glUniform2fv(
4784        (GLint)location,
4785        (GLsizei)count,
4786        (GLfloat *)v
4787    );
4788
4789exit:
4790    if (_array) {
4791        releasePointer(_env, _array, v, JNI_FALSE);
4792    }
4793    if (_exception) {
4794        jniThrowException(_env, _exceptionType, _exceptionMessage);
4795    }
4796}
4797
4798/* void glUniform2i ( GLint location, GLint x, GLint y ) */
4799static void
4800android_glUniform2i__III
4801  (JNIEnv *_env, jobject _this, jint location, jint x, jint y) {
4802    glUniform2i(
4803        (GLint)location,
4804        (GLint)x,
4805        (GLint)y
4806    );
4807}
4808
4809/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
4810static void
4811android_glUniform2iv__II_3II
4812  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
4813    jint _exception = 0;
4814    const char * _exceptionType = NULL;
4815    const char * _exceptionMessage = NULL;
4816    GLint *v_base = (GLint *) 0;
4817    jint _remaining;
4818    GLint *v = (GLint *) 0;
4819
4820    if (!v_ref) {
4821        _exception = 1;
4822        _exceptionType = "java/lang/IllegalArgumentException";
4823        _exceptionMessage = "v == null";
4824        goto exit;
4825    }
4826    if (offset < 0) {
4827        _exception = 1;
4828        _exceptionType = "java/lang/IllegalArgumentException";
4829        _exceptionMessage = "offset < 0";
4830        goto exit;
4831    }
4832    _remaining = _env->GetArrayLength(v_ref) - offset;
4833    if (_remaining < count*2) {
4834        _exception = 1;
4835        _exceptionType = "java/lang/IllegalArgumentException";
4836        _exceptionMessage = "length - offset < count*2 < needed";
4837        goto exit;
4838    }
4839    v_base = (GLint *)
4840        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4841    v = v_base + offset;
4842
4843    glUniform2iv(
4844        (GLint)location,
4845        (GLsizei)count,
4846        (GLint *)v
4847    );
4848
4849exit:
4850    if (v_base) {
4851        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4852            JNI_ABORT);
4853    }
4854    if (_exception) {
4855        jniThrowException(_env, _exceptionType, _exceptionMessage);
4856    }
4857}
4858
4859/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
4860static void
4861android_glUniform2iv__IILjava_nio_IntBuffer_2
4862  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
4863    jint _exception = 0;
4864    const char * _exceptionType = NULL;
4865    const char * _exceptionMessage = NULL;
4866    jarray _array = (jarray) 0;
4867    jint _bufferOffset = (jint) 0;
4868    jint _remaining;
4869    GLint *v = (GLint *) 0;
4870
4871    v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
4872    if (_remaining < count*2) {
4873        _exception = 1;
4874        _exceptionType = "java/lang/IllegalArgumentException";
4875        _exceptionMessage = "remaining() < count*2 < needed";
4876        goto exit;
4877    }
4878    if (v == NULL) {
4879        char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4880        v = (GLint *) (_vBase + _bufferOffset);
4881    }
4882    glUniform2iv(
4883        (GLint)location,
4884        (GLsizei)count,
4885        (GLint *)v
4886    );
4887
4888exit:
4889    if (_array) {
4890        releasePointer(_env, _array, v, JNI_FALSE);
4891    }
4892    if (_exception) {
4893        jniThrowException(_env, _exceptionType, _exceptionMessage);
4894    }
4895}
4896
4897/* void glUniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z ) */
4898static void
4899android_glUniform3f__IFFF
4900  (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z) {
4901    glUniform3f(
4902        (GLint)location,
4903        (GLfloat)x,
4904        (GLfloat)y,
4905        (GLfloat)z
4906    );
4907}
4908
4909/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
4910static void
4911android_glUniform3fv__II_3FI
4912  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
4913    jint _exception = 0;
4914    const char * _exceptionType = NULL;
4915    const char * _exceptionMessage = NULL;
4916    GLfloat *v_base = (GLfloat *) 0;
4917    jint _remaining;
4918    GLfloat *v = (GLfloat *) 0;
4919
4920    if (!v_ref) {
4921        _exception = 1;
4922        _exceptionType = "java/lang/IllegalArgumentException";
4923        _exceptionMessage = "v == null";
4924        goto exit;
4925    }
4926    if (offset < 0) {
4927        _exception = 1;
4928        _exceptionType = "java/lang/IllegalArgumentException";
4929        _exceptionMessage = "offset < 0";
4930        goto exit;
4931    }
4932    _remaining = _env->GetArrayLength(v_ref) - offset;
4933    if (_remaining < count*3) {
4934        _exception = 1;
4935        _exceptionType = "java/lang/IllegalArgumentException";
4936        _exceptionMessage = "length - offset < count*3 < needed";
4937        goto exit;
4938    }
4939    v_base = (GLfloat *)
4940        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4941    v = v_base + offset;
4942
4943    glUniform3fv(
4944        (GLint)location,
4945        (GLsizei)count,
4946        (GLfloat *)v
4947    );
4948
4949exit:
4950    if (v_base) {
4951        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4952            JNI_ABORT);
4953    }
4954    if (_exception) {
4955        jniThrowException(_env, _exceptionType, _exceptionMessage);
4956    }
4957}
4958
4959/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
4960static void
4961android_glUniform3fv__IILjava_nio_FloatBuffer_2
4962  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
4963    jint _exception = 0;
4964    const char * _exceptionType = NULL;
4965    const char * _exceptionMessage = NULL;
4966    jarray _array = (jarray) 0;
4967    jint _bufferOffset = (jint) 0;
4968    jint _remaining;
4969    GLfloat *v = (GLfloat *) 0;
4970
4971    v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
4972    if (_remaining < count*3) {
4973        _exception = 1;
4974        _exceptionType = "java/lang/IllegalArgumentException";
4975        _exceptionMessage = "remaining() < count*3 < needed";
4976        goto exit;
4977    }
4978    if (v == NULL) {
4979        char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4980        v = (GLfloat *) (_vBase + _bufferOffset);
4981    }
4982    glUniform3fv(
4983        (GLint)location,
4984        (GLsizei)count,
4985        (GLfloat *)v
4986    );
4987
4988exit:
4989    if (_array) {
4990        releasePointer(_env, _array, v, JNI_FALSE);
4991    }
4992    if (_exception) {
4993        jniThrowException(_env, _exceptionType, _exceptionMessage);
4994    }
4995}
4996
4997/* void glUniform3i ( GLint location, GLint x, GLint y, GLint z ) */
4998static void
4999android_glUniform3i__IIII
5000  (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z) {
5001    glUniform3i(
5002        (GLint)location,
5003        (GLint)x,
5004        (GLint)y,
5005        (GLint)z
5006    );
5007}
5008
5009/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
5010static void
5011android_glUniform3iv__II_3II
5012  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
5013    jint _exception = 0;
5014    const char * _exceptionType = NULL;
5015    const char * _exceptionMessage = NULL;
5016    GLint *v_base = (GLint *) 0;
5017    jint _remaining;
5018    GLint *v = (GLint *) 0;
5019
5020    if (!v_ref) {
5021        _exception = 1;
5022        _exceptionType = "java/lang/IllegalArgumentException";
5023        _exceptionMessage = "v == null";
5024        goto exit;
5025    }
5026    if (offset < 0) {
5027        _exception = 1;
5028        _exceptionType = "java/lang/IllegalArgumentException";
5029        _exceptionMessage = "offset < 0";
5030        goto exit;
5031    }
5032    _remaining = _env->GetArrayLength(v_ref) - offset;
5033    if (_remaining < count*3) {
5034        _exception = 1;
5035        _exceptionType = "java/lang/IllegalArgumentException";
5036        _exceptionMessage = "length - offset < count*3 < needed";
5037        goto exit;
5038    }
5039    v_base = (GLint *)
5040        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
5041    v = v_base + offset;
5042
5043    glUniform3iv(
5044        (GLint)location,
5045        (GLsizei)count,
5046        (GLint *)v
5047    );
5048
5049exit:
5050    if (v_base) {
5051        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
5052            JNI_ABORT);
5053    }
5054    if (_exception) {
5055        jniThrowException(_env, _exceptionType, _exceptionMessage);
5056    }
5057}
5058
5059/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
5060static void
5061android_glUniform3iv__IILjava_nio_IntBuffer_2
5062  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
5063    jint _exception = 0;
5064    const char * _exceptionType = NULL;
5065    const char * _exceptionMessage = NULL;
5066    jarray _array = (jarray) 0;
5067    jint _bufferOffset = (jint) 0;
5068    jint _remaining;
5069    GLint *v = (GLint *) 0;
5070
5071    v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
5072    if (_remaining < count*3) {
5073        _exception = 1;
5074        _exceptionType = "java/lang/IllegalArgumentException";
5075        _exceptionMessage = "remaining() < count*3 < needed";
5076        goto exit;
5077    }
5078    if (v == NULL) {
5079        char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5080        v = (GLint *) (_vBase + _bufferOffset);
5081    }
5082    glUniform3iv(
5083        (GLint)location,
5084        (GLsizei)count,
5085        (GLint *)v
5086    );
5087
5088exit:
5089    if (_array) {
5090        releasePointer(_env, _array, v, JNI_FALSE);
5091    }
5092    if (_exception) {
5093        jniThrowException(_env, _exceptionType, _exceptionMessage);
5094    }
5095}
5096
5097/* void glUniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
5098static void
5099android_glUniform4f__IFFFF
5100  (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z, jfloat w) {
5101    glUniform4f(
5102        (GLint)location,
5103        (GLfloat)x,
5104        (GLfloat)y,
5105        (GLfloat)z,
5106        (GLfloat)w
5107    );
5108}
5109
5110/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
5111static void
5112android_glUniform4fv__II_3FI
5113  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
5114    jint _exception = 0;
5115    const char * _exceptionType = NULL;
5116    const char * _exceptionMessage = NULL;
5117    GLfloat *v_base = (GLfloat *) 0;
5118    jint _remaining;
5119    GLfloat *v = (GLfloat *) 0;
5120
5121    if (!v_ref) {
5122        _exception = 1;
5123        _exceptionType = "java/lang/IllegalArgumentException";
5124        _exceptionMessage = "v == null";
5125        goto exit;
5126    }
5127    if (offset < 0) {
5128        _exception = 1;
5129        _exceptionType = "java/lang/IllegalArgumentException";
5130        _exceptionMessage = "offset < 0";
5131        goto exit;
5132    }
5133    _remaining = _env->GetArrayLength(v_ref) - offset;
5134    if (_remaining < count*4) {
5135        _exception = 1;
5136        _exceptionType = "java/lang/IllegalArgumentException";
5137        _exceptionMessage = "length - offset < count*4 < needed";
5138        goto exit;
5139    }
5140    v_base = (GLfloat *)
5141        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
5142    v = v_base + offset;
5143
5144    glUniform4fv(
5145        (GLint)location,
5146        (GLsizei)count,
5147        (GLfloat *)v
5148    );
5149
5150exit:
5151    if (v_base) {
5152        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
5153            JNI_ABORT);
5154    }
5155    if (_exception) {
5156        jniThrowException(_env, _exceptionType, _exceptionMessage);
5157    }
5158}
5159
5160/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
5161static void
5162android_glUniform4fv__IILjava_nio_FloatBuffer_2
5163  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
5164    jint _exception = 0;
5165    const char * _exceptionType = NULL;
5166    const char * _exceptionMessage = NULL;
5167    jarray _array = (jarray) 0;
5168    jint _bufferOffset = (jint) 0;
5169    jint _remaining;
5170    GLfloat *v = (GLfloat *) 0;
5171
5172    v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
5173    if (_remaining < count*4) {
5174        _exception = 1;
5175        _exceptionType = "java/lang/IllegalArgumentException";
5176        _exceptionMessage = "remaining() < count*4 < needed";
5177        goto exit;
5178    }
5179    if (v == NULL) {
5180        char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5181        v = (GLfloat *) (_vBase + _bufferOffset);
5182    }
5183    glUniform4fv(
5184        (GLint)location,
5185        (GLsizei)count,
5186        (GLfloat *)v
5187    );
5188
5189exit:
5190    if (_array) {
5191        releasePointer(_env, _array, v, JNI_FALSE);
5192    }
5193    if (_exception) {
5194        jniThrowException(_env, _exceptionType, _exceptionMessage);
5195    }
5196}
5197
5198/* void glUniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w ) */
5199static void
5200android_glUniform4i__IIIII
5201  (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z, jint w) {
5202    glUniform4i(
5203        (GLint)location,
5204        (GLint)x,
5205        (GLint)y,
5206        (GLint)z,
5207        (GLint)w
5208    );
5209}
5210
5211/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
5212static void
5213android_glUniform4iv__II_3II
5214  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
5215    jint _exception = 0;
5216    const char * _exceptionType = NULL;
5217    const char * _exceptionMessage = NULL;
5218    GLint *v_base = (GLint *) 0;
5219    jint _remaining;
5220    GLint *v = (GLint *) 0;
5221
5222    if (!v_ref) {
5223        _exception = 1;
5224        _exceptionType = "java/lang/IllegalArgumentException";
5225        _exceptionMessage = "v == null";
5226        goto exit;
5227    }
5228    if (offset < 0) {
5229        _exception = 1;
5230        _exceptionType = "java/lang/IllegalArgumentException";
5231        _exceptionMessage = "offset < 0";
5232        goto exit;
5233    }
5234    _remaining = _env->GetArrayLength(v_ref) - offset;
5235    if (_remaining < count*4) {
5236        _exception = 1;
5237        _exceptionType = "java/lang/IllegalArgumentException";
5238        _exceptionMessage = "length - offset < count*4 < needed";
5239        goto exit;
5240    }
5241    v_base = (GLint *)
5242        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
5243    v = v_base + offset;
5244
5245    glUniform4iv(
5246        (GLint)location,
5247        (GLsizei)count,
5248        (GLint *)v
5249    );
5250
5251exit:
5252    if (v_base) {
5253        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
5254            JNI_ABORT);
5255    }
5256    if (_exception) {
5257        jniThrowException(_env, _exceptionType, _exceptionMessage);
5258    }
5259}
5260
5261/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
5262static void
5263android_glUniform4iv__IILjava_nio_IntBuffer_2
5264  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
5265    jint _exception = 0;
5266    const char * _exceptionType = NULL;
5267    const char * _exceptionMessage = NULL;
5268    jarray _array = (jarray) 0;
5269    jint _bufferOffset = (jint) 0;
5270    jint _remaining;
5271    GLint *v = (GLint *) 0;
5272
5273    v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
5274    if (_remaining < count*4) {
5275        _exception = 1;
5276        _exceptionType = "java/lang/IllegalArgumentException";
5277        _exceptionMessage = "remaining() < count*4 < needed";
5278        goto exit;
5279    }
5280    if (v == NULL) {
5281        char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5282        v = (GLint *) (_vBase + _bufferOffset);
5283    }
5284    glUniform4iv(
5285        (GLint)location,
5286        (GLsizei)count,
5287        (GLint *)v
5288    );
5289
5290exit:
5291    if (_array) {
5292        releasePointer(_env, _array, v, JNI_FALSE);
5293    }
5294    if (_exception) {
5295        jniThrowException(_env, _exceptionType, _exceptionMessage);
5296    }
5297}
5298
5299/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5300static void
5301android_glUniformMatrix2fv__IIZ_3FI
5302  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
5303    jint _exception = 0;
5304    const char * _exceptionType = NULL;
5305    const char * _exceptionMessage = NULL;
5306    GLfloat *value_base = (GLfloat *) 0;
5307    jint _remaining;
5308    GLfloat *value = (GLfloat *) 0;
5309
5310    if (!value_ref) {
5311        _exception = 1;
5312        _exceptionType = "java/lang/IllegalArgumentException";
5313        _exceptionMessage = "value == null";
5314        goto exit;
5315    }
5316    if (offset < 0) {
5317        _exception = 1;
5318        _exceptionType = "java/lang/IllegalArgumentException";
5319        _exceptionMessage = "offset < 0";
5320        goto exit;
5321    }
5322    _remaining = _env->GetArrayLength(value_ref) - offset;
5323    if (_remaining < count*4) {
5324        _exception = 1;
5325        _exceptionType = "java/lang/IllegalArgumentException";
5326        _exceptionMessage = "length - offset < count*4 < needed";
5327        goto exit;
5328    }
5329    value_base = (GLfloat *)
5330        _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
5331    value = value_base + offset;
5332
5333    glUniformMatrix2fv(
5334        (GLint)location,
5335        (GLsizei)count,
5336        (GLboolean)transpose,
5337        (GLfloat *)value
5338    );
5339
5340exit:
5341    if (value_base) {
5342        _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
5343            JNI_ABORT);
5344    }
5345    if (_exception) {
5346        jniThrowException(_env, _exceptionType, _exceptionMessage);
5347    }
5348}
5349
5350/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5351static void
5352android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2
5353  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
5354    jint _exception = 0;
5355    const char * _exceptionType = NULL;
5356    const char * _exceptionMessage = NULL;
5357    jarray _array = (jarray) 0;
5358    jint _bufferOffset = (jint) 0;
5359    jint _remaining;
5360    GLfloat *value = (GLfloat *) 0;
5361
5362    value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
5363    if (_remaining < count*4) {
5364        _exception = 1;
5365        _exceptionType = "java/lang/IllegalArgumentException";
5366        _exceptionMessage = "remaining() < count*4 < needed";
5367        goto exit;
5368    }
5369    if (value == NULL) {
5370        char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5371        value = (GLfloat *) (_valueBase + _bufferOffset);
5372    }
5373    glUniformMatrix2fv(
5374        (GLint)location,
5375        (GLsizei)count,
5376        (GLboolean)transpose,
5377        (GLfloat *)value
5378    );
5379
5380exit:
5381    if (_array) {
5382        releasePointer(_env, _array, value, JNI_FALSE);
5383    }
5384    if (_exception) {
5385        jniThrowException(_env, _exceptionType, _exceptionMessage);
5386    }
5387}
5388
5389/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5390static void
5391android_glUniformMatrix3fv__IIZ_3FI
5392  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
5393    jint _exception = 0;
5394    const char * _exceptionType = NULL;
5395    const char * _exceptionMessage = NULL;
5396    GLfloat *value_base = (GLfloat *) 0;
5397    jint _remaining;
5398    GLfloat *value = (GLfloat *) 0;
5399
5400    if (!value_ref) {
5401        _exception = 1;
5402        _exceptionType = "java/lang/IllegalArgumentException";
5403        _exceptionMessage = "value == null";
5404        goto exit;
5405    }
5406    if (offset < 0) {
5407        _exception = 1;
5408        _exceptionType = "java/lang/IllegalArgumentException";
5409        _exceptionMessage = "offset < 0";
5410        goto exit;
5411    }
5412    _remaining = _env->GetArrayLength(value_ref) - offset;
5413    if (_remaining < count*9) {
5414        _exception = 1;
5415        _exceptionType = "java/lang/IllegalArgumentException";
5416        _exceptionMessage = "length - offset < count*9 < needed";
5417        goto exit;
5418    }
5419    value_base = (GLfloat *)
5420        _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
5421    value = value_base + offset;
5422
5423    glUniformMatrix3fv(
5424        (GLint)location,
5425        (GLsizei)count,
5426        (GLboolean)transpose,
5427        (GLfloat *)value
5428    );
5429
5430exit:
5431    if (value_base) {
5432        _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
5433            JNI_ABORT);
5434    }
5435    if (_exception) {
5436        jniThrowException(_env, _exceptionType, _exceptionMessage);
5437    }
5438}
5439
5440/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5441static void
5442android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2
5443  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
5444    jint _exception = 0;
5445    const char * _exceptionType = NULL;
5446    const char * _exceptionMessage = NULL;
5447    jarray _array = (jarray) 0;
5448    jint _bufferOffset = (jint) 0;
5449    jint _remaining;
5450    GLfloat *value = (GLfloat *) 0;
5451
5452    value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
5453    if (_remaining < count*9) {
5454        _exception = 1;
5455        _exceptionType = "java/lang/IllegalArgumentException";
5456        _exceptionMessage = "remaining() < count*9 < needed";
5457        goto exit;
5458    }
5459    if (value == NULL) {
5460        char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5461        value = (GLfloat *) (_valueBase + _bufferOffset);
5462    }
5463    glUniformMatrix3fv(
5464        (GLint)location,
5465        (GLsizei)count,
5466        (GLboolean)transpose,
5467        (GLfloat *)value
5468    );
5469
5470exit:
5471    if (_array) {
5472        releasePointer(_env, _array, value, JNI_FALSE);
5473    }
5474    if (_exception) {
5475        jniThrowException(_env, _exceptionType, _exceptionMessage);
5476    }
5477}
5478
5479/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5480static void
5481android_glUniformMatrix4fv__IIZ_3FI
5482  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
5483    jint _exception = 0;
5484    const char * _exceptionType = NULL;
5485    const char * _exceptionMessage = NULL;
5486    GLfloat *value_base = (GLfloat *) 0;
5487    jint _remaining;
5488    GLfloat *value = (GLfloat *) 0;
5489
5490    if (!value_ref) {
5491        _exception = 1;
5492        _exceptionType = "java/lang/IllegalArgumentException";
5493        _exceptionMessage = "value == null";
5494        goto exit;
5495    }
5496    if (offset < 0) {
5497        _exception = 1;
5498        _exceptionType = "java/lang/IllegalArgumentException";
5499        _exceptionMessage = "offset < 0";
5500        goto exit;
5501    }
5502    _remaining = _env->GetArrayLength(value_ref) - offset;
5503    if (_remaining < count*16) {
5504        _exception = 1;
5505        _exceptionType = "java/lang/IllegalArgumentException";
5506        _exceptionMessage = "length - offset < count*16 < needed";
5507        goto exit;
5508    }
5509    value_base = (GLfloat *)
5510        _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
5511    value = value_base + offset;
5512
5513    glUniformMatrix4fv(
5514        (GLint)location,
5515        (GLsizei)count,
5516        (GLboolean)transpose,
5517        (GLfloat *)value
5518    );
5519
5520exit:
5521    if (value_base) {
5522        _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
5523            JNI_ABORT);
5524    }
5525    if (_exception) {
5526        jniThrowException(_env, _exceptionType, _exceptionMessage);
5527    }
5528}
5529
5530/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5531static void
5532android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2
5533  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
5534    jint _exception = 0;
5535    const char * _exceptionType = NULL;
5536    const char * _exceptionMessage = NULL;
5537    jarray _array = (jarray) 0;
5538    jint _bufferOffset = (jint) 0;
5539    jint _remaining;
5540    GLfloat *value = (GLfloat *) 0;
5541
5542    value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
5543    if (_remaining < count*16) {
5544        _exception = 1;
5545        _exceptionType = "java/lang/IllegalArgumentException";
5546        _exceptionMessage = "remaining() < count*16 < needed";
5547        goto exit;
5548    }
5549    if (value == NULL) {
5550        char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5551        value = (GLfloat *) (_valueBase + _bufferOffset);
5552    }
5553    glUniformMatrix4fv(
5554        (GLint)location,
5555        (GLsizei)count,
5556        (GLboolean)transpose,
5557        (GLfloat *)value
5558    );
5559
5560exit:
5561    if (_array) {
5562        releasePointer(_env, _array, value, JNI_FALSE);
5563    }
5564    if (_exception) {
5565        jniThrowException(_env, _exceptionType, _exceptionMessage);
5566    }
5567}
5568
5569/* void glUseProgram ( GLuint program ) */
5570static void
5571android_glUseProgram__I
5572  (JNIEnv *_env, jobject _this, jint program) {
5573    glUseProgram(
5574        (GLuint)program
5575    );
5576}
5577
5578/* void glValidateProgram ( GLuint program ) */
5579static void
5580android_glValidateProgram__I
5581  (JNIEnv *_env, jobject _this, jint program) {
5582    glValidateProgram(
5583        (GLuint)program
5584    );
5585}
5586
5587/* void glVertexAttrib1f ( GLuint indx, GLfloat x ) */
5588static void
5589android_glVertexAttrib1f__IF
5590  (JNIEnv *_env, jobject _this, jint indx, jfloat x) {
5591    glVertexAttrib1f(
5592        (GLuint)indx,
5593        (GLfloat)x
5594    );
5595}
5596
5597/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
5598static void
5599android_glVertexAttrib1fv__I_3FI
5600  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
5601    jint _exception = 0;
5602    const char * _exceptionType = NULL;
5603    const char * _exceptionMessage = NULL;
5604    GLfloat *values_base = (GLfloat *) 0;
5605    jint _remaining;
5606    GLfloat *values = (GLfloat *) 0;
5607
5608    if (!values_ref) {
5609        _exception = 1;
5610        _exceptionType = "java/lang/IllegalArgumentException";
5611        _exceptionMessage = "values == null";
5612        goto exit;
5613    }
5614    if (offset < 0) {
5615        _exception = 1;
5616        _exceptionType = "java/lang/IllegalArgumentException";
5617        _exceptionMessage = "offset < 0";
5618        goto exit;
5619    }
5620    _remaining = _env->GetArrayLength(values_ref) - offset;
5621    if (_remaining < 1) {
5622        _exception = 1;
5623        _exceptionType = "java/lang/IllegalArgumentException";
5624        _exceptionMessage = "length - offset < 1 < needed";
5625        goto exit;
5626    }
5627    values_base = (GLfloat *)
5628        _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
5629    values = values_base + offset;
5630
5631    glVertexAttrib1fv(
5632        (GLuint)indx,
5633        (GLfloat *)values
5634    );
5635
5636exit:
5637    if (values_base) {
5638        _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
5639            JNI_ABORT);
5640    }
5641    if (_exception) {
5642        jniThrowException(_env, _exceptionType, _exceptionMessage);
5643    }
5644}
5645
5646/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
5647static void
5648android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2
5649  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
5650    jint _exception = 0;
5651    const char * _exceptionType = NULL;
5652    const char * _exceptionMessage = NULL;
5653    jarray _array = (jarray) 0;
5654    jint _bufferOffset = (jint) 0;
5655    jint _remaining;
5656    GLfloat *values = (GLfloat *) 0;
5657
5658    values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset);
5659    if (_remaining < 1) {
5660        _exception = 1;
5661        _exceptionType = "java/lang/IllegalArgumentException";
5662        _exceptionMessage = "remaining() < 1 < needed";
5663        goto exit;
5664    }
5665    if (values == NULL) {
5666        char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5667        values = (GLfloat *) (_valuesBase + _bufferOffset);
5668    }
5669    glVertexAttrib1fv(
5670        (GLuint)indx,
5671        (GLfloat *)values
5672    );
5673
5674exit:
5675    if (_array) {
5676        releasePointer(_env, _array, values, JNI_FALSE);
5677    }
5678    if (_exception) {
5679        jniThrowException(_env, _exceptionType, _exceptionMessage);
5680    }
5681}
5682
5683/* void glVertexAttrib2f ( GLuint indx, GLfloat x, GLfloat y ) */
5684static void
5685android_glVertexAttrib2f__IFF
5686  (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y) {
5687    glVertexAttrib2f(
5688        (GLuint)indx,
5689        (GLfloat)x,
5690        (GLfloat)y
5691    );
5692}
5693
5694/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
5695static void
5696android_glVertexAttrib2fv__I_3FI
5697  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
5698    jint _exception = 0;
5699    const char * _exceptionType = NULL;
5700    const char * _exceptionMessage = NULL;
5701    GLfloat *values_base = (GLfloat *) 0;
5702    jint _remaining;
5703    GLfloat *values = (GLfloat *) 0;
5704
5705    if (!values_ref) {
5706        _exception = 1;
5707        _exceptionType = "java/lang/IllegalArgumentException";
5708        _exceptionMessage = "values == null";
5709        goto exit;
5710    }
5711    if (offset < 0) {
5712        _exception = 1;
5713        _exceptionType = "java/lang/IllegalArgumentException";
5714        _exceptionMessage = "offset < 0";
5715        goto exit;
5716    }
5717    _remaining = _env->GetArrayLength(values_ref) - offset;
5718    if (_remaining < 2) {
5719        _exception = 1;
5720        _exceptionType = "java/lang/IllegalArgumentException";
5721        _exceptionMessage = "length - offset < 2 < needed";
5722        goto exit;
5723    }
5724    values_base = (GLfloat *)
5725        _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
5726    values = values_base + offset;
5727
5728    glVertexAttrib2fv(
5729        (GLuint)indx,
5730        (GLfloat *)values
5731    );
5732
5733exit:
5734    if (values_base) {
5735        _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
5736            JNI_ABORT);
5737    }
5738    if (_exception) {
5739        jniThrowException(_env, _exceptionType, _exceptionMessage);
5740    }
5741}
5742
5743/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
5744static void
5745android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2
5746  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
5747    jint _exception = 0;
5748    const char * _exceptionType = NULL;
5749    const char * _exceptionMessage = NULL;
5750    jarray _array = (jarray) 0;
5751    jint _bufferOffset = (jint) 0;
5752    jint _remaining;
5753    GLfloat *values = (GLfloat *) 0;
5754
5755    values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset);
5756    if (_remaining < 2) {
5757        _exception = 1;
5758        _exceptionType = "java/lang/IllegalArgumentException";
5759        _exceptionMessage = "remaining() < 2 < needed";
5760        goto exit;
5761    }
5762    if (values == NULL) {
5763        char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5764        values = (GLfloat *) (_valuesBase + _bufferOffset);
5765    }
5766    glVertexAttrib2fv(
5767        (GLuint)indx,
5768        (GLfloat *)values
5769    );
5770
5771exit:
5772    if (_array) {
5773        releasePointer(_env, _array, values, JNI_FALSE);
5774    }
5775    if (_exception) {
5776        jniThrowException(_env, _exceptionType, _exceptionMessage);
5777    }
5778}
5779
5780/* void glVertexAttrib3f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z ) */
5781static void
5782android_glVertexAttrib3f__IFFF
5783  (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z) {
5784    glVertexAttrib3f(
5785        (GLuint)indx,
5786        (GLfloat)x,
5787        (GLfloat)y,
5788        (GLfloat)z
5789    );
5790}
5791
5792/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
5793static void
5794android_glVertexAttrib3fv__I_3FI
5795  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
5796    jint _exception = 0;
5797    const char * _exceptionType = NULL;
5798    const char * _exceptionMessage = NULL;
5799    GLfloat *values_base = (GLfloat *) 0;
5800    jint _remaining;
5801    GLfloat *values = (GLfloat *) 0;
5802
5803    if (!values_ref) {
5804        _exception = 1;
5805        _exceptionType = "java/lang/IllegalArgumentException";
5806        _exceptionMessage = "values == null";
5807        goto exit;
5808    }
5809    if (offset < 0) {
5810        _exception = 1;
5811        _exceptionType = "java/lang/IllegalArgumentException";
5812        _exceptionMessage = "offset < 0";
5813        goto exit;
5814    }
5815    _remaining = _env->GetArrayLength(values_ref) - offset;
5816    if (_remaining < 3) {
5817        _exception = 1;
5818        _exceptionType = "java/lang/IllegalArgumentException";
5819        _exceptionMessage = "length - offset < 3 < needed";
5820        goto exit;
5821    }
5822    values_base = (GLfloat *)
5823        _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
5824    values = values_base + offset;
5825
5826    glVertexAttrib3fv(
5827        (GLuint)indx,
5828        (GLfloat *)values
5829    );
5830
5831exit:
5832    if (values_base) {
5833        _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
5834            JNI_ABORT);
5835    }
5836    if (_exception) {
5837        jniThrowException(_env, _exceptionType, _exceptionMessage);
5838    }
5839}
5840
5841/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
5842static void
5843android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2
5844  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
5845    jint _exception = 0;
5846    const char * _exceptionType = NULL;
5847    const char * _exceptionMessage = NULL;
5848    jarray _array = (jarray) 0;
5849    jint _bufferOffset = (jint) 0;
5850    jint _remaining;
5851    GLfloat *values = (GLfloat *) 0;
5852
5853    values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset);
5854    if (_remaining < 3) {
5855        _exception = 1;
5856        _exceptionType = "java/lang/IllegalArgumentException";
5857        _exceptionMessage = "remaining() < 3 < needed";
5858        goto exit;
5859    }
5860    if (values == NULL) {
5861        char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5862        values = (GLfloat *) (_valuesBase + _bufferOffset);
5863    }
5864    glVertexAttrib3fv(
5865        (GLuint)indx,
5866        (GLfloat *)values
5867    );
5868
5869exit:
5870    if (_array) {
5871        releasePointer(_env, _array, values, JNI_FALSE);
5872    }
5873    if (_exception) {
5874        jniThrowException(_env, _exceptionType, _exceptionMessage);
5875    }
5876}
5877
5878/* void glVertexAttrib4f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
5879static void
5880android_glVertexAttrib4f__IFFFF
5881  (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z, jfloat w) {
5882    glVertexAttrib4f(
5883        (GLuint)indx,
5884        (GLfloat)x,
5885        (GLfloat)y,
5886        (GLfloat)z,
5887        (GLfloat)w
5888    );
5889}
5890
5891/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
5892static void
5893android_glVertexAttrib4fv__I_3FI
5894  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
5895    jint _exception = 0;
5896    const char * _exceptionType = NULL;
5897    const char * _exceptionMessage = NULL;
5898    GLfloat *values_base = (GLfloat *) 0;
5899    jint _remaining;
5900    GLfloat *values = (GLfloat *) 0;
5901
5902    if (!values_ref) {
5903        _exception = 1;
5904        _exceptionType = "java/lang/IllegalArgumentException";
5905        _exceptionMessage = "values == null";
5906        goto exit;
5907    }
5908    if (offset < 0) {
5909        _exception = 1;
5910        _exceptionType = "java/lang/IllegalArgumentException";
5911        _exceptionMessage = "offset < 0";
5912        goto exit;
5913    }
5914    _remaining = _env->GetArrayLength(values_ref) - offset;
5915    if (_remaining < 4) {
5916        _exception = 1;
5917        _exceptionType = "java/lang/IllegalArgumentException";
5918        _exceptionMessage = "length - offset < 4 < needed";
5919        goto exit;
5920    }
5921    values_base = (GLfloat *)
5922        _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
5923    values = values_base + offset;
5924
5925    glVertexAttrib4fv(
5926        (GLuint)indx,
5927        (GLfloat *)values
5928    );
5929
5930exit:
5931    if (values_base) {
5932        _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
5933            JNI_ABORT);
5934    }
5935    if (_exception) {
5936        jniThrowException(_env, _exceptionType, _exceptionMessage);
5937    }
5938}
5939
5940/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
5941static void
5942android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2
5943  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
5944    jint _exception = 0;
5945    const char * _exceptionType = NULL;
5946    const char * _exceptionMessage = NULL;
5947    jarray _array = (jarray) 0;
5948    jint _bufferOffset = (jint) 0;
5949    jint _remaining;
5950    GLfloat *values = (GLfloat *) 0;
5951
5952    values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset);
5953    if (_remaining < 4) {
5954        _exception = 1;
5955        _exceptionType = "java/lang/IllegalArgumentException";
5956        _exceptionMessage = "remaining() < 4 < needed";
5957        goto exit;
5958    }
5959    if (values == NULL) {
5960        char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5961        values = (GLfloat *) (_valuesBase + _bufferOffset);
5962    }
5963    glVertexAttrib4fv(
5964        (GLuint)indx,
5965        (GLfloat *)values
5966    );
5967
5968exit:
5969    if (_array) {
5970        releasePointer(_env, _array, values, JNI_FALSE);
5971    }
5972    if (_exception) {
5973        jniThrowException(_env, _exceptionType, _exceptionMessage);
5974    }
5975}
5976
5977/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint offset ) */
5978static void
5979android_glVertexAttribPointer__IIIZII
5980  (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jint offset) {
5981    glVertexAttribPointer(
5982        (GLuint)indx,
5983        (GLint)size,
5984        (GLenum)type,
5985        (GLboolean)normalized,
5986        (GLsizei)stride,
5987        (GLvoid *)offset
5988    );
5989}
5990
5991/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr ) */
5992static void
5993android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I
5994  (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jobject ptr_buf, jint remaining) {
5995    jarray _array = (jarray) 0;
5996    jint _bufferOffset = (jint) 0;
5997    jint _remaining;
5998    GLvoid *ptr = (GLvoid *) 0;
5999
6000    if (ptr_buf) {
6001        ptr = (GLvoid *) getDirectBufferPointer(_env, ptr_buf);
6002        if ( ! ptr ) {
6003            return;
6004        }
6005    }
6006    glVertexAttribPointerBounds(
6007        (GLuint)indx,
6008        (GLint)size,
6009        (GLenum)type,
6010        (GLboolean)normalized,
6011        (GLsizei)stride,
6012        (GLvoid *)ptr,
6013        (GLsizei)remaining
6014    );
6015}
6016
6017/* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */
6018static void
6019android_glViewport__IIII
6020  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
6021    glViewport(
6022        (GLint)x,
6023        (GLint)y,
6024        (GLsizei)width,
6025        (GLsizei)height
6026    );
6027}
6028
6029static const char *classPathName = "android/opengl/GLES20";
6030
6031static JNINativeMethod methods[] = {
6032{"_nativeClassInit", "()V", (void*)nativeClassInit },
6033{"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I },
6034{"glAttachShader", "(II)V", (void *) android_glAttachShader__II },
6035{"glBindAttribLocation", "(IILjava/lang/String;)V", (void *) android_glBindAttribLocation__IILjava_lang_String_2 },
6036{"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II },
6037{"glBindFramebuffer", "(II)V", (void *) android_glBindFramebuffer__II },
6038{"glBindRenderbuffer", "(II)V", (void *) android_glBindRenderbuffer__II },
6039{"glBindTexture", "(II)V", (void *) android_glBindTexture__II },
6040{"glBlendColor", "(FFFF)V", (void *) android_glBlendColor__FFFF },
6041{"glBlendEquation", "(I)V", (void *) android_glBlendEquation__I },
6042{"glBlendEquationSeparate", "(II)V", (void *) android_glBlendEquationSeparate__II },
6043{"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II },
6044{"glBlendFuncSeparate", "(IIII)V", (void *) android_glBlendFuncSeparate__IIII },
6045{"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I },
6046{"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 },
6047{"glCheckFramebufferStatus", "(I)I", (void *) android_glCheckFramebufferStatus__I },
6048{"glClear", "(I)V", (void *) android_glClear__I },
6049{"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF },
6050{"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F },
6051{"glClearStencil", "(I)V", (void *) android_glClearStencil__I },
6052{"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ },
6053{"glCompileShader", "(I)V", (void *) android_glCompileShader__I },
6054{"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 },
6055{"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
6056{"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII },
6057{"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII },
6058{"glCreateProgram", "()I", (void *) android_glCreateProgram__ },
6059{"glCreateShader", "(I)I", (void *) android_glCreateShader__I },
6060{"glCullFace", "(I)V", (void *) android_glCullFace__I },
6061{"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II },
6062{"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 },
6063{"glDeleteFramebuffers", "(I[II)V", (void *) android_glDeleteFramebuffers__I_3II },
6064{"glDeleteFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2 },
6065{"glDeleteProgram", "(I)V", (void *) android_glDeleteProgram__I },
6066{"glDeleteRenderbuffers", "(I[II)V", (void *) android_glDeleteRenderbuffers__I_3II },
6067{"glDeleteRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2 },
6068{"glDeleteShader", "(I)V", (void *) android_glDeleteShader__I },
6069{"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II },
6070{"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 },
6071{"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I },
6072{"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z },
6073{"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF },
6074{"glDetachShader", "(II)V", (void *) android_glDetachShader__II },
6075{"glDisable", "(I)V", (void *) android_glDisable__I },
6076{"glDisableVertexAttribArray", "(I)V", (void *) android_glDisableVertexAttribArray__I },
6077{"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III },
6078{"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII },
6079{"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 },
6080{"glEnable", "(I)V", (void *) android_glEnable__I },
6081{"glEnableVertexAttribArray", "(I)V", (void *) android_glEnableVertexAttribArray__I },
6082{"glFinish", "()V", (void *) android_glFinish__ },
6083{"glFlush", "()V", (void *) android_glFlush__ },
6084{"glFramebufferRenderbuffer", "(IIII)V", (void *) android_glFramebufferRenderbuffer__IIII },
6085{"glFramebufferTexture2D", "(IIIII)V", (void *) android_glFramebufferTexture2D__IIIII },
6086{"glFrontFace", "(I)V", (void *) android_glFrontFace__I },
6087{"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II },
6088{"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 },
6089{"glGenerateMipmap", "(I)V", (void *) android_glGenerateMipmap__I },
6090{"glGenFramebuffers", "(I[II)V", (void *) android_glGenFramebuffers__I_3II },
6091{"glGenFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenFramebuffers__ILjava_nio_IntBuffer_2 },
6092{"glGenRenderbuffers", "(I[II)V", (void *) android_glGenRenderbuffers__I_3II },
6093{"glGenRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenRenderbuffers__ILjava_nio_IntBuffer_2 },
6094{"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II },
6095{"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 },
6096{"glGetActiveAttrib", "(III[II[II[II[BI)V", (void *) android_glGetActiveAttrib__III_3II_3II_3II_3BI },
6097{"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 },
6098{"glGetActiveAttrib", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveAttrib1 },
6099{"glGetActiveAttrib", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveAttrib2 },
6100{"glGetActiveUniform", "(III[II[II[II[BI)V", (void *) android_glGetActiveUniform__III_3II_3II_3II_3BI },
6101{"glGetActiveUniform", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveUniform1 },
6102{"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 },
6103{"glGetActiveUniform", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveUniform2 },
6104{"glGetAttachedShaders", "(II[II[II)V", (void *) android_glGetAttachedShaders__II_3II_3II },
6105{"glGetAttachedShaders", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
6106{"glGetAttribLocation", "(ILjava/lang/String;)I", (void *) android_glGetAttribLocation__ILjava_lang_String_2 },
6107{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI },
6108{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 },
6109{"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II },
6110{"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 },
6111{"glGetError", "()I", (void *) android_glGetError__ },
6112{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI },
6113{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 },
6114{"glGetFramebufferAttachmentParameteriv", "(III[II)V", (void *) android_glGetFramebufferAttachmentParameteriv__III_3II },
6115{"glGetFramebufferAttachmentParameteriv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2 },
6116{"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II },
6117{"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 },
6118{"glGetProgramiv", "(II[II)V", (void *) android_glGetProgramiv__II_3II },
6119{"glGetProgramiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetProgramiv__IILjava_nio_IntBuffer_2 },
6120{"glGetProgramInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetProgramInfoLog },
6121{"glGetRenderbufferParameteriv", "(II[II)V", (void *) android_glGetRenderbufferParameteriv__II_3II },
6122{"glGetRenderbufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2 },
6123{"glGetShaderiv", "(II[II)V", (void *) android_glGetShaderiv__II_3II },
6124{"glGetShaderiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetShaderiv__IILjava_nio_IntBuffer_2 },
6125{"glGetShaderInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetShaderInfoLog },
6126{"glGetShaderPrecisionFormat", "(II[II[II)V", (void *) android_glGetShaderPrecisionFormat__II_3II_3II },
6127{"glGetShaderPrecisionFormat", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
6128{"glGetShaderSource", "(II[II[BI)V", (void *) android_glGetShaderSource__II_3II_3BI },
6129{"glGetShaderSource", "(IILjava/nio/IntBuffer;B)V", (void *) android_glGetShaderSource__IILjava_nio_IntBuffer_2B },
6130{"glGetShaderSource", "(I)Ljava/lang/String;", (void *) android_glGetShaderSource },
6131{"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString },
6132{"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI },
6133{"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 },
6134{"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II },
6135{"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 },
6136{"glGetUniformfv", "(II[FI)V", (void *) android_glGetUniformfv__II_3FI },
6137{"glGetUniformfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetUniformfv__IILjava_nio_FloatBuffer_2 },
6138{"glGetUniformiv", "(II[II)V", (void *) android_glGetUniformiv__II_3II },
6139{"glGetUniformiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetUniformiv__IILjava_nio_IntBuffer_2 },
6140{"glGetUniformLocation", "(ILjava/lang/String;)I", (void *) android_glGetUniformLocation__ILjava_lang_String_2 },
6141{"glGetVertexAttribfv", "(II[FI)V", (void *) android_glGetVertexAttribfv__II_3FI },
6142{"glGetVertexAttribfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2 },
6143{"glGetVertexAttribiv", "(II[II)V", (void *) android_glGetVertexAttribiv__II_3II },
6144{"glGetVertexAttribiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2 },
6145{"glHint", "(II)V", (void *) android_glHint__II },
6146{"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I },
6147{"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I },
6148{"glIsFramebuffer", "(I)Z", (void *) android_glIsFramebuffer__I },
6149{"glIsProgram", "(I)Z", (void *) android_glIsProgram__I },
6150{"glIsRenderbuffer", "(I)Z", (void *) android_glIsRenderbuffer__I },
6151{"glIsShader", "(I)Z", (void *) android_glIsShader__I },
6152{"glIsTexture", "(I)Z", (void *) android_glIsTexture__I },
6153{"glLineWidth", "(F)V", (void *) android_glLineWidth__F },
6154{"glLinkProgram", "(I)V", (void *) android_glLinkProgram__I },
6155{"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II },
6156{"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF },
6157{"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 },
6158{"glReleaseShaderCompiler", "()V", (void *) android_glReleaseShaderCompiler__ },
6159{"glRenderbufferStorage", "(IIII)V", (void *) android_glRenderbufferStorage__IIII },
6160{"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ },
6161{"glScissor", "(IIII)V", (void *) android_glScissor__IIII },
6162{"glShaderBinary", "(I[IIILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__I_3IIILjava_nio_Buffer_2I },
6163{"glShaderBinary", "(ILjava/nio/IntBuffer;ILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I },
6164{"glShaderSource", "(ILjava/lang/String;)V", (void *) android_glShaderSource },
6165{"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III },
6166{"glStencilFuncSeparate", "(IIII)V", (void *) android_glStencilFuncSeparate__IIII },
6167{"glStencilMask", "(I)V", (void *) android_glStencilMask__I },
6168{"glStencilMaskSeparate", "(II)V", (void *) android_glStencilMaskSeparate__II },
6169{"glStencilOp", "(III)V", (void *) android_glStencilOp__III },
6170{"glStencilOpSeparate", "(IIII)V", (void *) android_glStencilOpSeparate__IIII },
6171{"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 },
6172{"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF },
6173{"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI },
6174{"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 },
6175{"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III },
6176{"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II },
6177{"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 },
6178{"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
6179{"glUniform1f", "(IF)V", (void *) android_glUniform1f__IF },
6180{"glUniform1fv", "(II[FI)V", (void *) android_glUniform1fv__II_3FI },
6181{"glUniform1fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform1fv__IILjava_nio_FloatBuffer_2 },
6182{"glUniform1i", "(II)V", (void *) android_glUniform1i__II },
6183{"glUniform1iv", "(II[II)V", (void *) android_glUniform1iv__II_3II },
6184{"glUniform1iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform1iv__IILjava_nio_IntBuffer_2 },
6185{"glUniform2f", "(IFF)V", (void *) android_glUniform2f__IFF },
6186{"glUniform2fv", "(II[FI)V", (void *) android_glUniform2fv__II_3FI },
6187{"glUniform2fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform2fv__IILjava_nio_FloatBuffer_2 },
6188{"glUniform2i", "(III)V", (void *) android_glUniform2i__III },
6189{"glUniform2iv", "(II[II)V", (void *) android_glUniform2iv__II_3II },
6190{"glUniform2iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform2iv__IILjava_nio_IntBuffer_2 },
6191{"glUniform3f", "(IFFF)V", (void *) android_glUniform3f__IFFF },
6192{"glUniform3fv", "(II[FI)V", (void *) android_glUniform3fv__II_3FI },
6193{"glUniform3fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform3fv__IILjava_nio_FloatBuffer_2 },
6194{"glUniform3i", "(IIII)V", (void *) android_glUniform3i__IIII },
6195{"glUniform3iv", "(II[II)V", (void *) android_glUniform3iv__II_3II },
6196{"glUniform3iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform3iv__IILjava_nio_IntBuffer_2 },
6197{"glUniform4f", "(IFFFF)V", (void *) android_glUniform4f__IFFFF },
6198{"glUniform4fv", "(II[FI)V", (void *) android_glUniform4fv__II_3FI },
6199{"glUniform4fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform4fv__IILjava_nio_FloatBuffer_2 },
6200{"glUniform4i", "(IIIII)V", (void *) android_glUniform4i__IIIII },
6201{"glUniform4iv", "(II[II)V", (void *) android_glUniform4iv__II_3II },
6202{"glUniform4iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform4iv__IILjava_nio_IntBuffer_2 },
6203{"glUniformMatrix2fv", "(IIZ[FI)V", (void *) android_glUniformMatrix2fv__IIZ_3FI },
6204{"glUniformMatrix2fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2 },
6205{"glUniformMatrix3fv", "(IIZ[FI)V", (void *) android_glUniformMatrix3fv__IIZ_3FI },
6206{"glUniformMatrix3fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2 },
6207{"glUniformMatrix4fv", "(IIZ[FI)V", (void *) android_glUniformMatrix4fv__IIZ_3FI },
6208{"glUniformMatrix4fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2 },
6209{"glUseProgram", "(I)V", (void *) android_glUseProgram__I },
6210{"glValidateProgram", "(I)V", (void *) android_glValidateProgram__I },
6211{"glVertexAttrib1f", "(IF)V", (void *) android_glVertexAttrib1f__IF },
6212{"glVertexAttrib1fv", "(I[FI)V", (void *) android_glVertexAttrib1fv__I_3FI },
6213{"glVertexAttrib1fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2 },
6214{"glVertexAttrib2f", "(IFF)V", (void *) android_glVertexAttrib2f__IFF },
6215{"glVertexAttrib2fv", "(I[FI)V", (void *) android_glVertexAttrib2fv__I_3FI },
6216{"glVertexAttrib2fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2 },
6217{"glVertexAttrib3f", "(IFFF)V", (void *) android_glVertexAttrib3f__IFFF },
6218{"glVertexAttrib3fv", "(I[FI)V", (void *) android_glVertexAttrib3fv__I_3FI },
6219{"glVertexAttrib3fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2 },
6220{"glVertexAttrib4f", "(IFFFF)V", (void *) android_glVertexAttrib4f__IFFFF },
6221{"glVertexAttrib4fv", "(I[FI)V", (void *) android_glVertexAttrib4fv__I_3FI },
6222{"glVertexAttrib4fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2 },
6223{"glVertexAttribPointer", "(IIIZII)V", (void *) android_glVertexAttribPointer__IIIZII },
6224{"glVertexAttribPointerBounds", "(IIIZILjava/nio/Buffer;I)V", (void *) android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I },
6225{"glViewport", "(IIII)V", (void *) android_glViewport__IIII },
6226};
6227
6228int register_android_opengl_jni_GLES20(JNIEnv *_env)
6229{
6230    int err;
6231    err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
6232    return err;
6233}
6234