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