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