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