android_opengl_GLES20.cpp revision 560814f6b11abe83ff0c4ed18cac015c276b3181
1/*
2**
3** Copyright 2009, The Android Open Source Project
4**
5** Licensed under the Apache License, Version 2.0 (the "License");
6** you may not use this file except in compliance with the License.
7** You may obtain a copy of the License at
8**
9**     http://www.apache.org/licenses/LICENSE-2.0
10**
11** Unless required by applicable law or agreed to in writing, software
12** distributed under the License is distributed on an "AS IS" BASIS,
13** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14** See the License for the specific language governing permissions and
15** limitations under the License.
16*/
17
18// This source file is automatically generated
19
20#include <android_runtime/AndroidRuntime.h>
21#include <utils/misc.h>
22
23#include <assert.h>
24#include <GLES2/gl2.h>
25#include <GLES2/gl2ext.h>
26
27static int initialized = 0;
28
29static jclass nioAccessClass;
30static jclass bufferClass;
31static jclass OOMEClass;
32static jclass UOEClass;
33static jclass IAEClass;
34static jclass AIOOBEClass;
35static jmethodID getBasePointerID;
36static jmethodID getBaseArrayID;
37static jmethodID getBaseArrayOffsetID;
38static jfieldID positionID;
39static jfieldID limitID;
40static jfieldID elementSizeShiftID;
41
42/* Cache method IDs each time the class is loaded. */
43
44static void
45nativeClassInitBuffer(JNIEnv *_env)
46{
47    jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
48    nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
49
50    jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
51    bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
52
53    getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
54            "getBasePointer", "(Ljava/nio/Buffer;)J");
55    getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
56            "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
57    getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
58            "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
59
60    positionID = _env->GetFieldID(bufferClass, "position", "I");
61    limitID = _env->GetFieldID(bufferClass, "limit", "I");
62    elementSizeShiftID =
63        _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
64}
65
66
67static void
68nativeClassInit(JNIEnv *_env, jclass glImplClass)
69{
70    nativeClassInitBuffer(_env);
71
72    jclass IAEClassLocal =
73        _env->FindClass("java/lang/IllegalArgumentException");
74    jclass OOMEClassLocal =
75         _env->FindClass("java/lang/OutOfMemoryError");
76    jclass UOEClassLocal =
77         _env->FindClass("java/lang/UnsupportedOperationException");
78    jclass AIOOBEClassLocal =
79         _env->FindClass("java/lang/ArrayIndexOutOfBoundsException");
80
81    IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal);
82    OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal);
83    UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal);
84    AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal);
85}
86
87static void *
88getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
89{
90    jint position;
91    jint limit;
92    jint elementSizeShift;
93    jlong pointer;
94    jint offset;
95    void *data;
96
97    position = _env->GetIntField(buffer, positionID);
98    limit = _env->GetIntField(buffer, limitID);
99    elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
100    *remaining = (limit - position) << elementSizeShift;
101    pointer = _env->CallStaticLongMethod(nioAccessClass,
102            getBasePointerID, buffer);
103    if (pointer != 0L) {
104        *array = NULL;
105        return (void *) (jint) pointer;
106    }
107
108    *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
109            getBaseArrayID, buffer);
110    offset = _env->CallStaticIntMethod(nioAccessClass,
111            getBaseArrayOffsetID, buffer);
112    data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0);
113
114    return (void *) ((char *) data + offset);
115}
116
117
118static void
119releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
120{
121    _env->ReleasePrimitiveArrayCritical(array, data,
122					   commit ? 0 : JNI_ABORT);
123}
124
125static void *
126getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
127    char* buf = (char*) _env->GetDirectBufferAddress(buffer);
128    if (buf) {
129        jint position = _env->GetIntField(buffer, positionID);
130        jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
131        buf += position << elementSizeShift;
132    } else {
133        _env->ThrowNew(IAEClass, "Must use a native order direct Buffer");
134    }
135    return (void*) buf;
136}
137
138static int
139getNumCompressedTextureFormats() {
140    int numCompressedTextureFormats = 0;
141    glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats);
142    return numCompressedTextureFormats;
143}
144
145static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type,
146        GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) {
147    glVertexAttribPointer(indx, size, type, normalized, stride, pointer);
148}
149
150// --------------------------------------------------------------------------
151
152/* void glActiveTexture ( GLenum texture ) */
153static void
154android_glActiveTexture__I
155  (JNIEnv *_env, jobject _this, jint texture) {
156    glActiveTexture(
157        (GLenum)texture
158    );
159}
160
161/* void glAttachShader ( GLuint program, GLuint shader ) */
162static void
163android_glAttachShader__II
164  (JNIEnv *_env, jobject _this, jint program, jint shader) {
165    glAttachShader(
166        (GLuint)program,
167        (GLuint)shader
168    );
169}
170
171/* void glBindAttribLocation ( GLuint program, GLuint index, const char *name ) */
172static void
173android_glBindAttribLocation__IILjava_lang_String_2
174  (JNIEnv *_env, jobject _this, jint program, jint index, jstring name) {
175    const char* _nativename = 0;
176
177    if (!name) {
178        _env->ThrowNew(IAEClass, "name == null");
179        goto exit;
180    }
181    _nativename = _env->GetStringUTFChars(name, 0);
182
183    glBindAttribLocation(
184        (GLuint)program,
185        (GLuint)index,
186        (char *)_nativename
187    );
188
189exit:
190    if (_nativename) {
191        _env->ReleaseStringUTFChars(name, _nativename);
192    }
193
194}
195
196/* void glBindBuffer ( GLenum target, GLuint buffer ) */
197static void
198android_glBindBuffer__II
199  (JNIEnv *_env, jobject _this, jint target, jint buffer) {
200    glBindBuffer(
201        (GLenum)target,
202        (GLuint)buffer
203    );
204}
205
206/* void glBindFramebuffer ( GLenum target, GLuint framebuffer ) */
207static void
208android_glBindFramebuffer__II
209  (JNIEnv *_env, jobject _this, jint target, jint framebuffer) {
210    glBindFramebuffer(
211        (GLenum)target,
212        (GLuint)framebuffer
213    );
214}
215
216/* void glBindRenderbuffer ( GLenum target, GLuint renderbuffer ) */
217static void
218android_glBindRenderbuffer__II
219  (JNIEnv *_env, jobject _this, jint target, jint renderbuffer) {
220    glBindRenderbuffer(
221        (GLenum)target,
222        (GLuint)renderbuffer
223    );
224}
225
226/* void glBindTexture ( GLenum target, GLuint texture ) */
227static void
228android_glBindTexture__II
229  (JNIEnv *_env, jobject _this, jint target, jint texture) {
230    glBindTexture(
231        (GLenum)target,
232        (GLuint)texture
233    );
234}
235
236/* void glBlendColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
237static void
238android_glBlendColor__FFFF
239  (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
240    glBlendColor(
241        (GLclampf)red,
242        (GLclampf)green,
243        (GLclampf)blue,
244        (GLclampf)alpha
245    );
246}
247
248/* void glBlendEquation ( GLenum mode ) */
249static void
250android_glBlendEquation__I
251  (JNIEnv *_env, jobject _this, jint mode) {
252    _env->ThrowNew(UOEClass,
253        "glBlendEquation");
254}
255
256/* void glBlendEquationSeparate ( GLenum modeRGB, GLenum modeAlpha ) */
257static void
258android_glBlendEquationSeparate__II
259  (JNIEnv *_env, jobject _this, jint modeRGB, jint modeAlpha) {
260    _env->ThrowNew(UOEClass,
261        "glBlendEquationSeparate");
262}
263
264/* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */
265static void
266android_glBlendFunc__II
267  (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) {
268    glBlendFunc(
269        (GLenum)sfactor,
270        (GLenum)dfactor
271    );
272}
273
274/* void glBlendFuncSeparate ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) */
275static void
276android_glBlendFuncSeparate__IIII
277  (JNIEnv *_env, jobject _this, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) {
278    _env->ThrowNew(UOEClass,
279        "glBlendFuncSeparate");
280}
281
282/* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */
283static void
284android_glBufferData__IILjava_nio_Buffer_2I
285  (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) {
286    jarray _array = (jarray) 0;
287    jint _remaining;
288    GLvoid *data = (GLvoid *) 0;
289
290    if (data_buf) {
291        data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining);
292        if (_remaining < size) {
293            _env->ThrowNew(IAEClass, "remaining() < size");
294            goto exit;
295        }
296    }
297    glBufferData(
298        (GLenum)target,
299        (GLsizeiptr)size,
300        (GLvoid *)data,
301        (GLenum)usage
302    );
303
304exit:
305    if (_array) {
306        releasePointer(_env, _array, data, JNI_FALSE);
307    }
308}
309
310/* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */
311static void
312android_glBufferSubData__IIILjava_nio_Buffer_2
313  (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) {
314    jarray _array = (jarray) 0;
315    jint _remaining;
316    GLvoid *data = (GLvoid *) 0;
317
318    data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining);
319    if (_remaining < size) {
320        _env->ThrowNew(IAEClass, "remaining() < size");
321        goto exit;
322    }
323    glBufferSubData(
324        (GLenum)target,
325        (GLintptr)offset,
326        (GLsizeiptr)size,
327        (GLvoid *)data
328    );
329
330exit:
331    if (_array) {
332        releasePointer(_env, _array, data, JNI_FALSE);
333    }
334}
335
336/* GLenum glCheckFramebufferStatus ( GLenum target ) */
337static jint
338android_glCheckFramebufferStatus__I
339  (JNIEnv *_env, jobject _this, jint target) {
340    GLenum _returnValue;
341    _returnValue = glCheckFramebufferStatus(
342        (GLenum)target
343    );
344    return _returnValue;
345}
346
347/* void glClear ( GLbitfield mask ) */
348static void
349android_glClear__I
350  (JNIEnv *_env, jobject _this, jint mask) {
351    glClear(
352        (GLbitfield)mask
353    );
354}
355
356/* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
357static void
358android_glClearColor__FFFF
359  (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
360    glClearColor(
361        (GLclampf)red,
362        (GLclampf)green,
363        (GLclampf)blue,
364        (GLclampf)alpha
365    );
366}
367
368/* void glClearDepthf ( GLclampf depth ) */
369static void
370android_glClearDepthf__F
371  (JNIEnv *_env, jobject _this, jfloat depth) {
372    glClearDepthf(
373        (GLclampf)depth
374    );
375}
376
377/* void glClearStencil ( GLint s ) */
378static void
379android_glClearStencil__I
380  (JNIEnv *_env, jobject _this, jint s) {
381    glClearStencil(
382        (GLint)s
383    );
384}
385
386/* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */
387static void
388android_glColorMask__ZZZZ
389  (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) {
390    glColorMask(
391        (GLboolean)red,
392        (GLboolean)green,
393        (GLboolean)blue,
394        (GLboolean)alpha
395    );
396}
397
398/* void glCompileShader ( GLuint shader ) */
399static void
400android_glCompileShader__I
401  (JNIEnv *_env, jobject _this, jint shader) {
402    glCompileShader(
403        (GLuint)shader
404    );
405}
406
407/* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */
408static void
409android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2
410  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) {
411    jarray _array = (jarray) 0;
412    jint _remaining;
413    GLvoid *data = (GLvoid *) 0;
414
415    data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining);
416    glCompressedTexImage2D(
417        (GLenum)target,
418        (GLint)level,
419        (GLenum)internalformat,
420        (GLsizei)width,
421        (GLsizei)height,
422        (GLint)border,
423        (GLsizei)imageSize,
424        (GLvoid *)data
425    );
426    if (_array) {
427        releasePointer(_env, _array, data, JNI_FALSE);
428    }
429}
430
431/* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */
432static void
433android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
434  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) {
435    jarray _array = (jarray) 0;
436    jint _remaining;
437    GLvoid *data = (GLvoid *) 0;
438
439    data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining);
440    glCompressedTexSubImage2D(
441        (GLenum)target,
442        (GLint)level,
443        (GLint)xoffset,
444        (GLint)yoffset,
445        (GLsizei)width,
446        (GLsizei)height,
447        (GLenum)format,
448        (GLsizei)imageSize,
449        (GLvoid *)data
450    );
451    if (_array) {
452        releasePointer(_env, _array, data, JNI_FALSE);
453    }
454}
455
456/* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */
457static void
458android_glCopyTexImage2D__IIIIIIII
459  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) {
460    glCopyTexImage2D(
461        (GLenum)target,
462        (GLint)level,
463        (GLenum)internalformat,
464        (GLint)x,
465        (GLint)y,
466        (GLsizei)width,
467        (GLsizei)height,
468        (GLint)border
469    );
470}
471
472/* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */
473static void
474android_glCopyTexSubImage2D__IIIIIIII
475  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) {
476    glCopyTexSubImage2D(
477        (GLenum)target,
478        (GLint)level,
479        (GLint)xoffset,
480        (GLint)yoffset,
481        (GLint)x,
482        (GLint)y,
483        (GLsizei)width,
484        (GLsizei)height
485    );
486}
487
488/* GLuint glCreateProgram ( void ) */
489static jint
490android_glCreateProgram__
491  (JNIEnv *_env, jobject _this) {
492    GLuint _returnValue;
493    _returnValue = glCreateProgram();
494    return _returnValue;
495}
496
497/* GLuint glCreateShader ( GLenum type ) */
498static jint
499android_glCreateShader__I
500  (JNIEnv *_env, jobject _this, jint type) {
501    GLuint _returnValue;
502    _returnValue = glCreateShader(
503        (GLenum)type
504    );
505    return _returnValue;
506}
507
508/* void glCullFace ( GLenum mode ) */
509static void
510android_glCullFace__I
511  (JNIEnv *_env, jobject _this, jint mode) {
512    glCullFace(
513        (GLenum)mode
514    );
515}
516
517/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
518static void
519android_glDeleteBuffers__I_3II
520  (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
521    GLuint *buffers_base = (GLuint *) 0;
522    jint _remaining;
523    GLuint *buffers = (GLuint *) 0;
524
525    if (!buffers_ref) {
526        _env->ThrowNew(IAEClass, "buffers == null");
527        goto exit;
528    }
529    if (offset < 0) {
530        _env->ThrowNew(IAEClass, "offset < 0");
531        goto exit;
532    }
533    _remaining = _env->GetArrayLength(buffers_ref) - offset;
534    if (_remaining < n) {
535        _env->ThrowNew(IAEClass, "length - offset < n");
536        goto exit;
537    }
538    buffers_base = (GLuint *)
539        _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
540    buffers = buffers_base + offset;
541
542    glDeleteBuffers(
543        (GLsizei)n,
544        (GLuint *)buffers
545    );
546
547exit:
548    if (buffers_base) {
549        _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
550            JNI_ABORT);
551    }
552}
553
554/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
555static void
556android_glDeleteBuffers__ILjava_nio_IntBuffer_2
557  (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
558    jarray _array = (jarray) 0;
559    jint _remaining;
560    GLuint *buffers = (GLuint *) 0;
561
562    buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining);
563    if (_remaining < n) {
564        _env->ThrowNew(IAEClass, "remaining() < n");
565        goto exit;
566    }
567    glDeleteBuffers(
568        (GLsizei)n,
569        (GLuint *)buffers
570    );
571
572exit:
573    if (_array) {
574        releasePointer(_env, _array, buffers, JNI_FALSE);
575    }
576}
577
578/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */
579static void
580android_glDeleteFramebuffers__I_3II
581  (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
582    GLuint *framebuffers_base = (GLuint *) 0;
583    jint _remaining;
584    GLuint *framebuffers = (GLuint *) 0;
585
586    if (!framebuffers_ref) {
587        _env->ThrowNew(IAEClass, "framebuffers == null");
588        goto exit;
589    }
590    if (offset < 0) {
591        _env->ThrowNew(IAEClass, "offset < 0");
592        goto exit;
593    }
594    _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
595    framebuffers_base = (GLuint *)
596        _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0);
597    framebuffers = framebuffers_base + offset;
598
599    glDeleteFramebuffers(
600        (GLsizei)n,
601        (GLuint *)framebuffers
602    );
603
604exit:
605    if (framebuffers_base) {
606        _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base,
607            JNI_ABORT);
608    }
609}
610
611/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */
612static void
613android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2
614  (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
615    jarray _array = (jarray) 0;
616    jint _remaining;
617    GLuint *framebuffers = (GLuint *) 0;
618
619    framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining);
620    glDeleteFramebuffers(
621        (GLsizei)n,
622        (GLuint *)framebuffers
623    );
624    if (_array) {
625        releasePointer(_env, _array, framebuffers, JNI_FALSE);
626    }
627}
628
629/* void glDeleteProgram ( GLuint program ) */
630static void
631android_glDeleteProgram__I
632  (JNIEnv *_env, jobject _this, jint program) {
633    glDeleteProgram(
634        (GLuint)program
635    );
636}
637
638/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */
639static void
640android_glDeleteRenderbuffers__I_3II
641  (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
642    GLuint *renderbuffers_base = (GLuint *) 0;
643    jint _remaining;
644    GLuint *renderbuffers = (GLuint *) 0;
645
646    if (!renderbuffers_ref) {
647        _env->ThrowNew(IAEClass, "renderbuffers == null");
648        goto exit;
649    }
650    if (offset < 0) {
651        _env->ThrowNew(IAEClass, "offset < 0");
652        goto exit;
653    }
654    _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
655    renderbuffers_base = (GLuint *)
656        _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0);
657    renderbuffers = renderbuffers_base + offset;
658
659    glDeleteRenderbuffers(
660        (GLsizei)n,
661        (GLuint *)renderbuffers
662    );
663
664exit:
665    if (renderbuffers_base) {
666        _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base,
667            JNI_ABORT);
668    }
669}
670
671/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */
672static void
673android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2
674  (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
675    jarray _array = (jarray) 0;
676    jint _remaining;
677    GLuint *renderbuffers = (GLuint *) 0;
678
679    renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining);
680    glDeleteRenderbuffers(
681        (GLsizei)n,
682        (GLuint *)renderbuffers
683    );
684    if (_array) {
685        releasePointer(_env, _array, renderbuffers, JNI_FALSE);
686    }
687}
688
689/* void glDeleteShader ( GLuint shader ) */
690static void
691android_glDeleteShader__I
692  (JNIEnv *_env, jobject _this, jint shader) {
693    glDeleteShader(
694        (GLuint)shader
695    );
696}
697
698/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
699static void
700android_glDeleteTextures__I_3II
701  (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
702    GLuint *textures_base = (GLuint *) 0;
703    jint _remaining;
704    GLuint *textures = (GLuint *) 0;
705
706    if (!textures_ref) {
707        _env->ThrowNew(IAEClass, "textures == null");
708        goto exit;
709    }
710    if (offset < 0) {
711        _env->ThrowNew(IAEClass, "offset < 0");
712        goto exit;
713    }
714    _remaining = _env->GetArrayLength(textures_ref) - offset;
715    if (_remaining < n) {
716        _env->ThrowNew(IAEClass, "length - offset < n");
717        goto exit;
718    }
719    textures_base = (GLuint *)
720        _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
721    textures = textures_base + offset;
722
723    glDeleteTextures(
724        (GLsizei)n,
725        (GLuint *)textures
726    );
727
728exit:
729    if (textures_base) {
730        _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
731            JNI_ABORT);
732    }
733}
734
735/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
736static void
737android_glDeleteTextures__ILjava_nio_IntBuffer_2
738  (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
739    jarray _array = (jarray) 0;
740    jint _remaining;
741    GLuint *textures = (GLuint *) 0;
742
743    textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining);
744    if (_remaining < n) {
745        _env->ThrowNew(IAEClass, "remaining() < n");
746        goto exit;
747    }
748    glDeleteTextures(
749        (GLsizei)n,
750        (GLuint *)textures
751    );
752
753exit:
754    if (_array) {
755        releasePointer(_env, _array, textures, JNI_FALSE);
756    }
757}
758
759/* void glDepthFunc ( GLenum func ) */
760static void
761android_glDepthFunc__I
762  (JNIEnv *_env, jobject _this, jint func) {
763    glDepthFunc(
764        (GLenum)func
765    );
766}
767
768/* void glDepthMask ( GLboolean flag ) */
769static void
770android_glDepthMask__Z
771  (JNIEnv *_env, jobject _this, jboolean flag) {
772    glDepthMask(
773        (GLboolean)flag
774    );
775}
776
777/* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */
778static void
779android_glDepthRangef__FF
780  (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) {
781    glDepthRangef(
782        (GLclampf)zNear,
783        (GLclampf)zFar
784    );
785}
786
787/* void glDetachShader ( GLuint program, GLuint shader ) */
788static void
789android_glDetachShader__II
790  (JNIEnv *_env, jobject _this, jint program, jint shader) {
791    glDetachShader(
792        (GLuint)program,
793        (GLuint)shader
794    );
795}
796
797/* void glDisable ( GLenum cap ) */
798static void
799android_glDisable__I
800  (JNIEnv *_env, jobject _this, jint cap) {
801    glDisable(
802        (GLenum)cap
803    );
804}
805
806/* void glDisableVertexAttribArray ( GLuint index ) */
807static void
808android_glDisableVertexAttribArray__I
809  (JNIEnv *_env, jobject _this, jint index) {
810    glDisableVertexAttribArray(
811        (GLuint)index
812    );
813}
814
815/* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */
816static void
817android_glDrawArrays__III
818  (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) {
819    glDrawArrays(
820        (GLenum)mode,
821        (GLint)first,
822        (GLsizei)count
823    );
824}
825
826/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */
827static void
828android_glDrawElements__IIILjava_nio_Buffer_2
829  (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) {
830    jarray _array = (jarray) 0;
831    jint _remaining;
832    GLvoid *indices = (GLvoid *) 0;
833
834    indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining);
835    if (_remaining < count) {
836        _env->ThrowNew(AIOOBEClass, "remaining() < count");
837        goto exit;
838    }
839    glDrawElements(
840        (GLenum)mode,
841        (GLsizei)count,
842        (GLenum)type,
843        (GLvoid *)indices
844    );
845
846exit:
847    if (_array) {
848        releasePointer(_env, _array, indices, JNI_FALSE);
849    }
850}
851
852/* void glEnable ( GLenum cap ) */
853static void
854android_glEnable__I
855  (JNIEnv *_env, jobject _this, jint cap) {
856    glEnable(
857        (GLenum)cap
858    );
859}
860
861/* void glEnableVertexAttribArray ( GLuint index ) */
862static void
863android_glEnableVertexAttribArray__I
864  (JNIEnv *_env, jobject _this, jint index) {
865    glEnableVertexAttribArray(
866        (GLuint)index
867    );
868}
869
870/* void glFinish ( void ) */
871static void
872android_glFinish__
873  (JNIEnv *_env, jobject _this) {
874    glFinish();
875}
876
877/* void glFlush ( void ) */
878static void
879android_glFlush__
880  (JNIEnv *_env, jobject _this) {
881    glFlush();
882}
883
884/* void glFramebufferRenderbuffer ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) */
885static void
886android_glFramebufferRenderbuffer__IIII
887  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint renderbuffertarget, jint renderbuffer) {
888    glFramebufferRenderbuffer(
889        (GLenum)target,
890        (GLenum)attachment,
891        (GLenum)renderbuffertarget,
892        (GLuint)renderbuffer
893    );
894}
895
896/* void glFramebufferTexture2D ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) */
897static void
898android_glFramebufferTexture2D__IIIII
899  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint textarget, jint texture, jint level) {
900    glFramebufferTexture2D(
901        (GLenum)target,
902        (GLenum)attachment,
903        (GLenum)textarget,
904        (GLuint)texture,
905        (GLint)level
906    );
907}
908
909/* void glFrontFace ( GLenum mode ) */
910static void
911android_glFrontFace__I
912  (JNIEnv *_env, jobject _this, jint mode) {
913    glFrontFace(
914        (GLenum)mode
915    );
916}
917
918/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
919static void
920android_glGenBuffers__I_3II
921  (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
922    jint _exception = 0;
923    GLuint *buffers_base = (GLuint *) 0;
924    jint _remaining;
925    GLuint *buffers = (GLuint *) 0;
926
927    if (!buffers_ref) {
928        _exception = 1;
929        _env->ThrowNew(IAEClass, "buffers == null");
930        goto exit;
931    }
932    if (offset < 0) {
933        _exception = 1;
934        _env->ThrowNew(IAEClass, "offset < 0");
935        goto exit;
936    }
937    _remaining = _env->GetArrayLength(buffers_ref) - offset;
938    if (_remaining < n) {
939        _exception = 1;
940        _env->ThrowNew(IAEClass, "length - offset < n");
941        goto exit;
942    }
943    buffers_base = (GLuint *)
944        _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
945    buffers = buffers_base + offset;
946
947    glGenBuffers(
948        (GLsizei)n,
949        (GLuint *)buffers
950    );
951
952exit:
953    if (buffers_base) {
954        _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
955            _exception ? JNI_ABORT: 0);
956    }
957}
958
959/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
960static void
961android_glGenBuffers__ILjava_nio_IntBuffer_2
962  (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
963    jint _exception = 0;
964    jarray _array = (jarray) 0;
965    jint _remaining;
966    GLuint *buffers = (GLuint *) 0;
967
968    buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining);
969    if (_remaining < n) {
970        _exception = 1;
971        _env->ThrowNew(IAEClass, "remaining() < n");
972        goto exit;
973    }
974    glGenBuffers(
975        (GLsizei)n,
976        (GLuint *)buffers
977    );
978
979exit:
980    if (_array) {
981        releasePointer(_env, _array, buffers, _exception ? JNI_FALSE : JNI_TRUE);
982    }
983}
984
985/* void glGenerateMipmap ( GLenum target ) */
986static void
987android_glGenerateMipmap__I
988  (JNIEnv *_env, jobject _this, jint target) {
989    glGenerateMipmap(
990        (GLenum)target
991    );
992}
993
994/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */
995static void
996android_glGenFramebuffers__I_3II
997  (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
998    jint _exception = 0;
999    GLuint *framebuffers_base = (GLuint *) 0;
1000    jint _remaining;
1001    GLuint *framebuffers = (GLuint *) 0;
1002
1003    if (!framebuffers_ref) {
1004        _exception = 1;
1005        _env->ThrowNew(IAEClass, "framebuffers == null");
1006        goto exit;
1007    }
1008    if (offset < 0) {
1009        _exception = 1;
1010        _env->ThrowNew(IAEClass, "offset < 0");
1011        goto exit;
1012    }
1013    _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
1014    framebuffers_base = (GLuint *)
1015        _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0);
1016    framebuffers = framebuffers_base + offset;
1017
1018    glGenFramebuffers(
1019        (GLsizei)n,
1020        (GLuint *)framebuffers
1021    );
1022
1023exit:
1024    if (framebuffers_base) {
1025        _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base,
1026            _exception ? JNI_ABORT: 0);
1027    }
1028}
1029
1030/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */
1031static void
1032android_glGenFramebuffers__ILjava_nio_IntBuffer_2
1033  (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
1034    jint _exception = 0;
1035    jarray _array = (jarray) 0;
1036    jint _remaining;
1037    GLuint *framebuffers = (GLuint *) 0;
1038
1039    framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining);
1040    glGenFramebuffers(
1041        (GLsizei)n,
1042        (GLuint *)framebuffers
1043    );
1044    if (_array) {
1045        releasePointer(_env, _array, framebuffers, _exception ? JNI_FALSE : JNI_TRUE);
1046    }
1047}
1048
1049/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */
1050static void
1051android_glGenRenderbuffers__I_3II
1052  (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
1053    jint _exception = 0;
1054    GLuint *renderbuffers_base = (GLuint *) 0;
1055    jint _remaining;
1056    GLuint *renderbuffers = (GLuint *) 0;
1057
1058    if (!renderbuffers_ref) {
1059        _exception = 1;
1060        _env->ThrowNew(IAEClass, "renderbuffers == null");
1061        goto exit;
1062    }
1063    if (offset < 0) {
1064        _exception = 1;
1065        _env->ThrowNew(IAEClass, "offset < 0");
1066        goto exit;
1067    }
1068    _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
1069    renderbuffers_base = (GLuint *)
1070        _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0);
1071    renderbuffers = renderbuffers_base + offset;
1072
1073    glGenRenderbuffers(
1074        (GLsizei)n,
1075        (GLuint *)renderbuffers
1076    );
1077
1078exit:
1079    if (renderbuffers_base) {
1080        _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base,
1081            _exception ? JNI_ABORT: 0);
1082    }
1083}
1084
1085/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */
1086static void
1087android_glGenRenderbuffers__ILjava_nio_IntBuffer_2
1088  (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
1089    jint _exception = 0;
1090    jarray _array = (jarray) 0;
1091    jint _remaining;
1092    GLuint *renderbuffers = (GLuint *) 0;
1093
1094    renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining);
1095    glGenRenderbuffers(
1096        (GLsizei)n,
1097        (GLuint *)renderbuffers
1098    );
1099    if (_array) {
1100        releasePointer(_env, _array, renderbuffers, _exception ? JNI_FALSE : JNI_TRUE);
1101    }
1102}
1103
1104/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1105static void
1106android_glGenTextures__I_3II
1107  (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
1108    jint _exception = 0;
1109    GLuint *textures_base = (GLuint *) 0;
1110    jint _remaining;
1111    GLuint *textures = (GLuint *) 0;
1112
1113    if (!textures_ref) {
1114        _exception = 1;
1115        _env->ThrowNew(IAEClass, "textures == null");
1116        goto exit;
1117    }
1118    if (offset < 0) {
1119        _exception = 1;
1120        _env->ThrowNew(IAEClass, "offset < 0");
1121        goto exit;
1122    }
1123    _remaining = _env->GetArrayLength(textures_ref) - offset;
1124    if (_remaining < n) {
1125        _exception = 1;
1126        _env->ThrowNew(IAEClass, "length - offset < n");
1127        goto exit;
1128    }
1129    textures_base = (GLuint *)
1130        _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
1131    textures = textures_base + offset;
1132
1133    glGenTextures(
1134        (GLsizei)n,
1135        (GLuint *)textures
1136    );
1137
1138exit:
1139    if (textures_base) {
1140        _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
1141            _exception ? JNI_ABORT: 0);
1142    }
1143}
1144
1145/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1146static void
1147android_glGenTextures__ILjava_nio_IntBuffer_2
1148  (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
1149    jint _exception = 0;
1150    jarray _array = (jarray) 0;
1151    jint _remaining;
1152    GLuint *textures = (GLuint *) 0;
1153
1154    textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining);
1155    if (_remaining < n) {
1156        _exception = 1;
1157        _env->ThrowNew(IAEClass, "remaining() < n");
1158        goto exit;
1159    }
1160    glGenTextures(
1161        (GLsizei)n,
1162        (GLuint *)textures
1163    );
1164
1165exit:
1166    if (_array) {
1167        releasePointer(_env, _array, textures, _exception ? JNI_FALSE : JNI_TRUE);
1168    }
1169}
1170
1171/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1172static void
1173android_glGetActiveAttrib__III_3II_3II_3II_3BI
1174  (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) {
1175    jint _exception = 0;
1176    GLsizei *length_base = (GLsizei *) 0;
1177    jint _lengthRemaining;
1178    GLsizei *length = (GLsizei *) 0;
1179    GLint *size_base = (GLint *) 0;
1180    jint _sizeRemaining;
1181    GLint *size = (GLint *) 0;
1182    GLenum *type_base = (GLenum *) 0;
1183    jint _typeRemaining;
1184    GLenum *type = (GLenum *) 0;
1185    char *name_base = (char *) 0;
1186    jint _nameRemaining;
1187    char *name = (char *) 0;
1188
1189    if (!length_ref) {
1190        _exception = 1;
1191        _env->ThrowNew(IAEClass, "length == null");
1192        goto exit;
1193    }
1194    if (lengthOffset < 0) {
1195        _exception = 1;
1196        _env->ThrowNew(IAEClass, "lengthOffset < 0");
1197        goto exit;
1198    }
1199    _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
1200    length_base = (GLsizei *)
1201        _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
1202    length = length_base + lengthOffset;
1203
1204    if (!size_ref) {
1205        _exception = 1;
1206        _env->ThrowNew(IAEClass, "size == null");
1207        goto exit;
1208    }
1209    if (sizeOffset < 0) {
1210        _exception = 1;
1211        _env->ThrowNew(IAEClass, "sizeOffset < 0");
1212        goto exit;
1213    }
1214    _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
1215    size_base = (GLint *)
1216        _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
1217    size = size_base + sizeOffset;
1218
1219    if (!type_ref) {
1220        _exception = 1;
1221        _env->ThrowNew(IAEClass, "type == null");
1222        goto exit;
1223    }
1224    if (typeOffset < 0) {
1225        _exception = 1;
1226        _env->ThrowNew(IAEClass, "typeOffset < 0");
1227        goto exit;
1228    }
1229    _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
1230    type_base = (GLenum *)
1231        _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
1232    type = type_base + typeOffset;
1233
1234    if (!name_ref) {
1235        _exception = 1;
1236        _env->ThrowNew(IAEClass, "name == null");
1237        goto exit;
1238    }
1239    if (nameOffset < 0) {
1240        _exception = 1;
1241        _env->ThrowNew(IAEClass, "nameOffset < 0");
1242        goto exit;
1243    }
1244    _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
1245    name_base = (char *)
1246        _env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0);
1247    name = name_base + nameOffset;
1248
1249    glGetActiveAttrib(
1250        (GLuint)program,
1251        (GLuint)index,
1252        (GLsizei)bufsize,
1253        (GLsizei *)length,
1254        (GLint *)size,
1255        (GLenum *)type,
1256        (char *)name
1257    );
1258
1259exit:
1260    if (name_base) {
1261        _env->ReleasePrimitiveArrayCritical(name_ref, name_base,
1262            _exception ? JNI_ABORT: 0);
1263    }
1264    if (type_base) {
1265        _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
1266            _exception ? JNI_ABORT: 0);
1267    }
1268    if (size_base) {
1269        _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
1270            _exception ? JNI_ABORT: 0);
1271    }
1272    if (length_base) {
1273        _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
1274            _exception ? JNI_ABORT: 0);
1275    }
1276}
1277
1278/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1279static void
1280android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
1281  (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
1282    jint _exception = 0;
1283    jarray _lengthArray = (jarray) 0;
1284    jarray _sizeArray = (jarray) 0;
1285    jarray _typeArray = (jarray) 0;
1286    jint _lengthRemaining;
1287    GLsizei *length = (GLsizei *) 0;
1288    jint _sizeRemaining;
1289    GLint *size = (GLint *) 0;
1290    jint _typeRemaining;
1291    GLenum *type = (GLenum *) 0;
1292
1293    length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining);
1294    size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining);
1295    type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining);
1296    glGetActiveAttrib(
1297        (GLuint)program,
1298        (GLuint)index,
1299        (GLsizei)bufsize,
1300        (GLsizei *)length,
1301        (GLint *)size,
1302        (GLenum *)type,
1303        (char *)name
1304    );
1305    if (_lengthArray) {
1306        releasePointer(_env, _lengthArray, type, _exception ? JNI_FALSE : JNI_TRUE);
1307    }
1308    if (_sizeArray) {
1309        releasePointer(_env, _sizeArray, size, _exception ? JNI_FALSE : JNI_TRUE);
1310    }
1311    if (_typeArray) {
1312        releasePointer(_env, _typeArray, length, _exception ? JNI_FALSE : JNI_TRUE);
1313    }
1314}
1315
1316/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1317static void
1318android_glGetActiveUniform__III_3II_3II_3II_3BI
1319  (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) {
1320    jint _exception = 0;
1321    GLsizei *length_base = (GLsizei *) 0;
1322    jint _lengthRemaining;
1323    GLsizei *length = (GLsizei *) 0;
1324    GLint *size_base = (GLint *) 0;
1325    jint _sizeRemaining;
1326    GLint *size = (GLint *) 0;
1327    GLenum *type_base = (GLenum *) 0;
1328    jint _typeRemaining;
1329    GLenum *type = (GLenum *) 0;
1330    char *name_base = (char *) 0;
1331    jint _nameRemaining;
1332    char *name = (char *) 0;
1333
1334    if (!length_ref) {
1335        _exception = 1;
1336        _env->ThrowNew(IAEClass, "length == null");
1337        goto exit;
1338    }
1339    if (lengthOffset < 0) {
1340        _exception = 1;
1341        _env->ThrowNew(IAEClass, "lengthOffset < 0");
1342        goto exit;
1343    }
1344    _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
1345    length_base = (GLsizei *)
1346        _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
1347    length = length_base + lengthOffset;
1348
1349    if (!size_ref) {
1350        _exception = 1;
1351        _env->ThrowNew(IAEClass, "size == null");
1352        goto exit;
1353    }
1354    if (sizeOffset < 0) {
1355        _exception = 1;
1356        _env->ThrowNew(IAEClass, "sizeOffset < 0");
1357        goto exit;
1358    }
1359    _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
1360    size_base = (GLint *)
1361        _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
1362    size = size_base + sizeOffset;
1363
1364    if (!type_ref) {
1365        _exception = 1;
1366        _env->ThrowNew(IAEClass, "type == null");
1367        goto exit;
1368    }
1369    if (typeOffset < 0) {
1370        _exception = 1;
1371        _env->ThrowNew(IAEClass, "typeOffset < 0");
1372        goto exit;
1373    }
1374    _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
1375    type_base = (GLenum *)
1376        _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
1377    type = type_base + typeOffset;
1378
1379    if (!name_ref) {
1380        _exception = 1;
1381        _env->ThrowNew(IAEClass, "name == null");
1382        goto exit;
1383    }
1384    if (nameOffset < 0) {
1385        _exception = 1;
1386        _env->ThrowNew(IAEClass, "nameOffset < 0");
1387        goto exit;
1388    }
1389    _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
1390    name_base = (char *)
1391        _env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0);
1392    name = name_base + nameOffset;
1393
1394    glGetActiveUniform(
1395        (GLuint)program,
1396        (GLuint)index,
1397        (GLsizei)bufsize,
1398        (GLsizei *)length,
1399        (GLint *)size,
1400        (GLenum *)type,
1401        (char *)name
1402    );
1403
1404exit:
1405    if (name_base) {
1406        _env->ReleasePrimitiveArrayCritical(name_ref, name_base,
1407            _exception ? JNI_ABORT: 0);
1408    }
1409    if (type_base) {
1410        _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
1411            _exception ? JNI_ABORT: 0);
1412    }
1413    if (size_base) {
1414        _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
1415            _exception ? JNI_ABORT: 0);
1416    }
1417    if (length_base) {
1418        _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
1419            _exception ? JNI_ABORT: 0);
1420    }
1421}
1422
1423/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1424static void
1425android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
1426  (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
1427    jint _exception = 0;
1428    jarray _lengthArray = (jarray) 0;
1429    jarray _sizeArray = (jarray) 0;
1430    jarray _typeArray = (jarray) 0;
1431    jint _lengthRemaining;
1432    GLsizei *length = (GLsizei *) 0;
1433    jint _sizeRemaining;
1434    GLint *size = (GLint *) 0;
1435    jint _typeRemaining;
1436    GLenum *type = (GLenum *) 0;
1437
1438    length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining);
1439    size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining);
1440    type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining);
1441    glGetActiveUniform(
1442        (GLuint)program,
1443        (GLuint)index,
1444        (GLsizei)bufsize,
1445        (GLsizei *)length,
1446        (GLint *)size,
1447        (GLenum *)type,
1448        (char *)name
1449    );
1450    if (_lengthArray) {
1451        releasePointer(_env, _lengthArray, type, _exception ? JNI_FALSE : JNI_TRUE);
1452    }
1453    if (_sizeArray) {
1454        releasePointer(_env, _sizeArray, size, _exception ? JNI_FALSE : JNI_TRUE);
1455    }
1456    if (_typeArray) {
1457        releasePointer(_env, _typeArray, length, _exception ? JNI_FALSE : JNI_TRUE);
1458    }
1459}
1460
1461/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */
1462static void
1463android_glGetAttachedShaders__II_3II_3II
1464  (JNIEnv *_env, jobject _this, jint program, jint maxcount, jintArray count_ref, jint countOffset, jintArray shaders_ref, jint shadersOffset) {
1465    jint _exception = 0;
1466    GLsizei *count_base = (GLsizei *) 0;
1467    jint _countRemaining;
1468    GLsizei *count = (GLsizei *) 0;
1469    GLuint *shaders_base = (GLuint *) 0;
1470    jint _shadersRemaining;
1471    GLuint *shaders = (GLuint *) 0;
1472
1473    if (!count_ref) {
1474        _exception = 1;
1475        _env->ThrowNew(IAEClass, "count == null");
1476        goto exit;
1477    }
1478    if (countOffset < 0) {
1479        _exception = 1;
1480        _env->ThrowNew(IAEClass, "countOffset < 0");
1481        goto exit;
1482    }
1483    _countRemaining = _env->GetArrayLength(count_ref) - countOffset;
1484    count_base = (GLsizei *)
1485        _env->GetPrimitiveArrayCritical(count_ref, (jboolean *)0);
1486    count = count_base + countOffset;
1487
1488    if (!shaders_ref) {
1489        _exception = 1;
1490        _env->ThrowNew(IAEClass, "shaders == null");
1491        goto exit;
1492    }
1493    if (shadersOffset < 0) {
1494        _exception = 1;
1495        _env->ThrowNew(IAEClass, "shadersOffset < 0");
1496        goto exit;
1497    }
1498    _shadersRemaining = _env->GetArrayLength(shaders_ref) - shadersOffset;
1499    shaders_base = (GLuint *)
1500        _env->GetPrimitiveArrayCritical(shaders_ref, (jboolean *)0);
1501    shaders = shaders_base + shadersOffset;
1502
1503    glGetAttachedShaders(
1504        (GLuint)program,
1505        (GLsizei)maxcount,
1506        (GLsizei *)count,
1507        (GLuint *)shaders
1508    );
1509
1510exit:
1511    if (shaders_base) {
1512        _env->ReleasePrimitiveArrayCritical(shaders_ref, shaders_base,
1513            _exception ? JNI_ABORT: 0);
1514    }
1515    if (count_base) {
1516        _env->ReleasePrimitiveArrayCritical(count_ref, count_base,
1517            _exception ? JNI_ABORT: 0);
1518    }
1519}
1520
1521/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */
1522static void
1523android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
1524  (JNIEnv *_env, jobject _this, jint program, jint maxcount, jobject count_buf, jobject shaders_buf) {
1525    jint _exception = 0;
1526    jarray _countArray = (jarray) 0;
1527    jarray _shadersArray = (jarray) 0;
1528    jint _countRemaining;
1529    GLsizei *count = (GLsizei *) 0;
1530    jint _shadersRemaining;
1531    GLuint *shaders = (GLuint *) 0;
1532
1533    count = (GLsizei *)getPointer(_env, count_buf, &_countArray, &_countRemaining);
1534    shaders = (GLuint *)getPointer(_env, shaders_buf, &_shadersArray, &_shadersRemaining);
1535    glGetAttachedShaders(
1536        (GLuint)program,
1537        (GLsizei)maxcount,
1538        (GLsizei *)count,
1539        (GLuint *)shaders
1540    );
1541    if (_countArray) {
1542        releasePointer(_env, _countArray, shaders, _exception ? JNI_FALSE : JNI_TRUE);
1543    }
1544    if (_shadersArray) {
1545        releasePointer(_env, _shadersArray, count, _exception ? JNI_FALSE : JNI_TRUE);
1546    }
1547}
1548
1549/* int glGetAttribLocation ( GLuint program, const char *name ) */
1550static jint
1551android_glGetAttribLocation__ILjava_lang_String_2
1552  (JNIEnv *_env, jobject _this, jint program, jstring name) {
1553    int _returnValue = 0;
1554    const char* _nativename = 0;
1555
1556    if (!name) {
1557        _env->ThrowNew(IAEClass, "name == null");
1558        goto exit;
1559    }
1560    _nativename = _env->GetStringUTFChars(name, 0);
1561
1562    _returnValue = glGetAttribLocation(
1563        (GLuint)program,
1564        (char *)_nativename
1565    );
1566
1567exit:
1568    if (_nativename) {
1569        _env->ReleaseStringUTFChars(name, _nativename);
1570    }
1571
1572    return _returnValue;
1573}
1574
1575/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
1576static void
1577android_glGetBooleanv__I_3ZI
1578  (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
1579    jint _exception = 0;
1580    GLboolean *params_base = (GLboolean *) 0;
1581    jint _remaining;
1582    GLboolean *params = (GLboolean *) 0;
1583
1584    if (!params_ref) {
1585        _exception = 1;
1586        _env->ThrowNew(IAEClass, "params == null");
1587        goto exit;
1588    }
1589    if (offset < 0) {
1590        _exception = 1;
1591        _env->ThrowNew(IAEClass, "offset < 0");
1592        goto exit;
1593    }
1594    _remaining = _env->GetArrayLength(params_ref) - offset;
1595    params_base = (GLboolean *)
1596        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1597    params = params_base + offset;
1598
1599    glGetBooleanv(
1600        (GLenum)pname,
1601        (GLboolean *)params
1602    );
1603
1604exit:
1605    if (params_base) {
1606        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1607            _exception ? JNI_ABORT: 0);
1608    }
1609}
1610
1611/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
1612static void
1613android_glGetBooleanv__ILjava_nio_IntBuffer_2
1614  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
1615    jint _exception = 0;
1616    jarray _array = (jarray) 0;
1617    jint _remaining;
1618    GLboolean *params = (GLboolean *) 0;
1619
1620    params = (GLboolean *)getPointer(_env, params_buf, &_array, &_remaining);
1621    glGetBooleanv(
1622        (GLenum)pname,
1623        (GLboolean *)params
1624    );
1625    if (_array) {
1626        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1627    }
1628}
1629
1630/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
1631static void
1632android_glGetBufferParameteriv__II_3II
1633  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
1634    _env->ThrowNew(UOEClass,
1635        "glGetBufferParameteriv");
1636}
1637
1638/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
1639static void
1640android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
1641  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
1642    _env->ThrowNew(UOEClass,
1643        "glGetBufferParameteriv");
1644}
1645
1646/* GLenum glGetError ( void ) */
1647static jint
1648android_glGetError__
1649  (JNIEnv *_env, jobject _this) {
1650    GLenum _returnValue;
1651    _returnValue = glGetError();
1652    return _returnValue;
1653}
1654
1655/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
1656static void
1657android_glGetFloatv__I_3FI
1658  (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
1659    jint _exception = 0;
1660    GLfloat *params_base = (GLfloat *) 0;
1661    jint _remaining;
1662    GLfloat *params = (GLfloat *) 0;
1663
1664    if (!params_ref) {
1665        _exception = 1;
1666        _env->ThrowNew(IAEClass, "params == null");
1667        goto exit;
1668    }
1669    if (offset < 0) {
1670        _exception = 1;
1671        _env->ThrowNew(IAEClass, "offset < 0");
1672        goto exit;
1673    }
1674    _remaining = _env->GetArrayLength(params_ref) - offset;
1675    params_base = (GLfloat *)
1676        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1677    params = params_base + offset;
1678
1679    glGetFloatv(
1680        (GLenum)pname,
1681        (GLfloat *)params
1682    );
1683
1684exit:
1685    if (params_base) {
1686        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1687            _exception ? JNI_ABORT: 0);
1688    }
1689}
1690
1691/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
1692static void
1693android_glGetFloatv__ILjava_nio_FloatBuffer_2
1694  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
1695    jint _exception = 0;
1696    jarray _array = (jarray) 0;
1697    jint _remaining;
1698    GLfloat *params = (GLfloat *) 0;
1699
1700    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
1701    glGetFloatv(
1702        (GLenum)pname,
1703        (GLfloat *)params
1704    );
1705    if (_array) {
1706        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1707    }
1708}
1709
1710/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
1711static void
1712android_glGetFramebufferAttachmentParameteriv__III_3II
1713  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jintArray params_ref, jint offset) {
1714    jint _exception = 0;
1715    GLint *params_base = (GLint *) 0;
1716    jint _remaining;
1717    GLint *params = (GLint *) 0;
1718
1719    if (!params_ref) {
1720        _exception = 1;
1721        _env->ThrowNew(IAEClass, "params == null");
1722        goto exit;
1723    }
1724    if (offset < 0) {
1725        _exception = 1;
1726        _env->ThrowNew(IAEClass, "offset < 0");
1727        goto exit;
1728    }
1729    _remaining = _env->GetArrayLength(params_ref) - offset;
1730    params_base = (GLint *)
1731        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1732    params = params_base + offset;
1733
1734    glGetFramebufferAttachmentParameteriv(
1735        (GLenum)target,
1736        (GLenum)attachment,
1737        (GLenum)pname,
1738        (GLint *)params
1739    );
1740
1741exit:
1742    if (params_base) {
1743        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1744            _exception ? JNI_ABORT: 0);
1745    }
1746}
1747
1748/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
1749static void
1750android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2
1751  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) {
1752    jint _exception = 0;
1753    jarray _array = (jarray) 0;
1754    jint _remaining;
1755    GLint *params = (GLint *) 0;
1756
1757    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
1758    glGetFramebufferAttachmentParameteriv(
1759        (GLenum)target,
1760        (GLenum)attachment,
1761        (GLenum)pname,
1762        (GLint *)params
1763    );
1764    if (_array) {
1765        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1766    }
1767}
1768
1769/* void glGetIntegerv ( GLenum pname, GLint *params ) */
1770static void
1771android_glGetIntegerv__I_3II
1772  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
1773    jint _exception = 0;
1774    GLint *params_base = (GLint *) 0;
1775    jint _remaining;
1776    GLint *params = (GLint *) 0;
1777
1778    if (!params_ref) {
1779        _exception = 1;
1780        _env->ThrowNew(IAEClass, "params == null");
1781        goto exit;
1782    }
1783    if (offset < 0) {
1784        _exception = 1;
1785        _env->ThrowNew(IAEClass, "offset < 0");
1786        goto exit;
1787    }
1788    _remaining = _env->GetArrayLength(params_ref) - offset;
1789    int _needed;
1790    switch (pname) {
1791#if defined(GL_ALPHA_BITS)
1792        case GL_ALPHA_BITS:
1793#endif // defined(GL_ALPHA_BITS)
1794#if defined(GL_ALPHA_TEST_FUNC)
1795        case GL_ALPHA_TEST_FUNC:
1796#endif // defined(GL_ALPHA_TEST_FUNC)
1797#if defined(GL_ALPHA_TEST_REF)
1798        case GL_ALPHA_TEST_REF:
1799#endif // defined(GL_ALPHA_TEST_REF)
1800#if defined(GL_BLEND_DST)
1801        case GL_BLEND_DST:
1802#endif // defined(GL_BLEND_DST)
1803#if defined(GL_BLUE_BITS)
1804        case GL_BLUE_BITS:
1805#endif // defined(GL_BLUE_BITS)
1806#if defined(GL_COLOR_ARRAY_BUFFER_BINDING)
1807        case GL_COLOR_ARRAY_BUFFER_BINDING:
1808#endif // defined(GL_COLOR_ARRAY_BUFFER_BINDING)
1809#if defined(GL_COLOR_ARRAY_SIZE)
1810        case GL_COLOR_ARRAY_SIZE:
1811#endif // defined(GL_COLOR_ARRAY_SIZE)
1812#if defined(GL_COLOR_ARRAY_STRIDE)
1813        case GL_COLOR_ARRAY_STRIDE:
1814#endif // defined(GL_COLOR_ARRAY_STRIDE)
1815#if defined(GL_COLOR_ARRAY_TYPE)
1816        case GL_COLOR_ARRAY_TYPE:
1817#endif // defined(GL_COLOR_ARRAY_TYPE)
1818#if defined(GL_CULL_FACE)
1819        case GL_CULL_FACE:
1820#endif // defined(GL_CULL_FACE)
1821#if defined(GL_DEPTH_BITS)
1822        case GL_DEPTH_BITS:
1823#endif // defined(GL_DEPTH_BITS)
1824#if defined(GL_DEPTH_CLEAR_VALUE)
1825        case GL_DEPTH_CLEAR_VALUE:
1826#endif // defined(GL_DEPTH_CLEAR_VALUE)
1827#if defined(GL_DEPTH_FUNC)
1828        case GL_DEPTH_FUNC:
1829#endif // defined(GL_DEPTH_FUNC)
1830#if defined(GL_DEPTH_WRITEMASK)
1831        case GL_DEPTH_WRITEMASK:
1832#endif // defined(GL_DEPTH_WRITEMASK)
1833#if defined(GL_FOG_DENSITY)
1834        case GL_FOG_DENSITY:
1835#endif // defined(GL_FOG_DENSITY)
1836#if defined(GL_FOG_END)
1837        case GL_FOG_END:
1838#endif // defined(GL_FOG_END)
1839#if defined(GL_FOG_MODE)
1840        case GL_FOG_MODE:
1841#endif // defined(GL_FOG_MODE)
1842#if defined(GL_FOG_START)
1843        case GL_FOG_START:
1844#endif // defined(GL_FOG_START)
1845#if defined(GL_FRONT_FACE)
1846        case GL_FRONT_FACE:
1847#endif // defined(GL_FRONT_FACE)
1848#if defined(GL_GREEN_BITS)
1849        case GL_GREEN_BITS:
1850#endif // defined(GL_GREEN_BITS)
1851#if defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)
1852        case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
1853#endif // defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)
1854#if defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)
1855        case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
1856#endif // defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)
1857#if defined(GL_LIGHT_MODEL_COLOR_CONTROL)
1858        case GL_LIGHT_MODEL_COLOR_CONTROL:
1859#endif // defined(GL_LIGHT_MODEL_COLOR_CONTROL)
1860#if defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
1861        case GL_LIGHT_MODEL_LOCAL_VIEWER:
1862#endif // defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
1863#if defined(GL_LIGHT_MODEL_TWO_SIDE)
1864        case GL_LIGHT_MODEL_TWO_SIDE:
1865#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
1866#if defined(GL_LINE_SMOOTH_HINT)
1867        case GL_LINE_SMOOTH_HINT:
1868#endif // defined(GL_LINE_SMOOTH_HINT)
1869#if defined(GL_LINE_WIDTH)
1870        case GL_LINE_WIDTH:
1871#endif // defined(GL_LINE_WIDTH)
1872#if defined(GL_LOGIC_OP_MODE)
1873        case GL_LOGIC_OP_MODE:
1874#endif // defined(GL_LOGIC_OP_MODE)
1875#if defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES)
1876        case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES:
1877#endif // defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES)
1878#if defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES)
1879        case GL_MATRIX_INDEX_ARRAY_SIZE_OES:
1880#endif // defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES)
1881#if defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES)
1882        case GL_MATRIX_INDEX_ARRAY_STRIDE_OES:
1883#endif // defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES)
1884#if defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES)
1885        case GL_MATRIX_INDEX_ARRAY_TYPE_OES:
1886#endif // defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES)
1887#if defined(GL_MATRIX_MODE)
1888        case GL_MATRIX_MODE:
1889#endif // defined(GL_MATRIX_MODE)
1890#if defined(GL_MAX_CLIP_PLANES)
1891        case GL_MAX_CLIP_PLANES:
1892#endif // defined(GL_MAX_CLIP_PLANES)
1893#if defined(GL_MAX_ELEMENTS_INDICES)
1894        case GL_MAX_ELEMENTS_INDICES:
1895#endif // defined(GL_MAX_ELEMENTS_INDICES)
1896#if defined(GL_MAX_ELEMENTS_VERTICES)
1897        case GL_MAX_ELEMENTS_VERTICES:
1898#endif // defined(GL_MAX_ELEMENTS_VERTICES)
1899#if defined(GL_MAX_LIGHTS)
1900        case GL_MAX_LIGHTS:
1901#endif // defined(GL_MAX_LIGHTS)
1902#if defined(GL_MAX_MODELVIEW_STACK_DEPTH)
1903        case GL_MAX_MODELVIEW_STACK_DEPTH:
1904#endif // defined(GL_MAX_MODELVIEW_STACK_DEPTH)
1905#if defined(GL_MAX_PALETTE_MATRICES_OES)
1906        case GL_MAX_PALETTE_MATRICES_OES:
1907#endif // defined(GL_MAX_PALETTE_MATRICES_OES)
1908#if defined(GL_MAX_PROJECTION_STACK_DEPTH)
1909        case GL_MAX_PROJECTION_STACK_DEPTH:
1910#endif // defined(GL_MAX_PROJECTION_STACK_DEPTH)
1911#if defined(GL_MAX_TEXTURE_SIZE)
1912        case GL_MAX_TEXTURE_SIZE:
1913#endif // defined(GL_MAX_TEXTURE_SIZE)
1914#if defined(GL_MAX_TEXTURE_STACK_DEPTH)
1915        case GL_MAX_TEXTURE_STACK_DEPTH:
1916#endif // defined(GL_MAX_TEXTURE_STACK_DEPTH)
1917#if defined(GL_MAX_TEXTURE_UNITS)
1918        case GL_MAX_TEXTURE_UNITS:
1919#endif // defined(GL_MAX_TEXTURE_UNITS)
1920#if defined(GL_MAX_VERTEX_UNITS_OES)
1921        case GL_MAX_VERTEX_UNITS_OES:
1922#endif // defined(GL_MAX_VERTEX_UNITS_OES)
1923#if defined(GL_MODELVIEW_STACK_DEPTH)
1924        case GL_MODELVIEW_STACK_DEPTH:
1925#endif // defined(GL_MODELVIEW_STACK_DEPTH)
1926#if defined(GL_NORMAL_ARRAY_BUFFER_BINDING)
1927        case GL_NORMAL_ARRAY_BUFFER_BINDING:
1928#endif // defined(GL_NORMAL_ARRAY_BUFFER_BINDING)
1929#if defined(GL_NORMAL_ARRAY_STRIDE)
1930        case GL_NORMAL_ARRAY_STRIDE:
1931#endif // defined(GL_NORMAL_ARRAY_STRIDE)
1932#if defined(GL_NORMAL_ARRAY_TYPE)
1933        case GL_NORMAL_ARRAY_TYPE:
1934#endif // defined(GL_NORMAL_ARRAY_TYPE)
1935#if defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
1936        case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
1937#endif // defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
1938#if defined(GL_PACK_ALIGNMENT)
1939        case GL_PACK_ALIGNMENT:
1940#endif // defined(GL_PACK_ALIGNMENT)
1941#if defined(GL_PERSPECTIVE_CORRECTION_HINT)
1942        case GL_PERSPECTIVE_CORRECTION_HINT:
1943#endif // defined(GL_PERSPECTIVE_CORRECTION_HINT)
1944#if defined(GL_POINT_SIZE)
1945        case GL_POINT_SIZE:
1946#endif // defined(GL_POINT_SIZE)
1947#if defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES)
1948        case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
1949#endif // defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES)
1950#if defined(GL_POINT_SIZE_ARRAY_STRIDE_OES)
1951        case GL_POINT_SIZE_ARRAY_STRIDE_OES:
1952#endif // defined(GL_POINT_SIZE_ARRAY_STRIDE_OES)
1953#if defined(GL_POINT_SIZE_ARRAY_TYPE_OES)
1954        case GL_POINT_SIZE_ARRAY_TYPE_OES:
1955#endif // defined(GL_POINT_SIZE_ARRAY_TYPE_OES)
1956#if defined(GL_POINT_SMOOTH_HINT)
1957        case GL_POINT_SMOOTH_HINT:
1958#endif // defined(GL_POINT_SMOOTH_HINT)
1959#if defined(GL_POLYGON_OFFSET_FACTOR)
1960        case GL_POLYGON_OFFSET_FACTOR:
1961#endif // defined(GL_POLYGON_OFFSET_FACTOR)
1962#if defined(GL_POLYGON_OFFSET_UNITS)
1963        case GL_POLYGON_OFFSET_UNITS:
1964#endif // defined(GL_POLYGON_OFFSET_UNITS)
1965#if defined(GL_PROJECTION_STACK_DEPTH)
1966        case GL_PROJECTION_STACK_DEPTH:
1967#endif // defined(GL_PROJECTION_STACK_DEPTH)
1968#if defined(GL_RED_BITS)
1969        case GL_RED_BITS:
1970#endif // defined(GL_RED_BITS)
1971#if defined(GL_SHADE_MODEL)
1972        case GL_SHADE_MODEL:
1973#endif // defined(GL_SHADE_MODEL)
1974#if defined(GL_STENCIL_BITS)
1975        case GL_STENCIL_BITS:
1976#endif // defined(GL_STENCIL_BITS)
1977#if defined(GL_STENCIL_CLEAR_VALUE)
1978        case GL_STENCIL_CLEAR_VALUE:
1979#endif // defined(GL_STENCIL_CLEAR_VALUE)
1980#if defined(GL_STENCIL_FAIL)
1981        case GL_STENCIL_FAIL:
1982#endif // defined(GL_STENCIL_FAIL)
1983#if defined(GL_STENCIL_FUNC)
1984        case GL_STENCIL_FUNC:
1985#endif // defined(GL_STENCIL_FUNC)
1986#if defined(GL_STENCIL_PASS_DEPTH_FAIL)
1987        case GL_STENCIL_PASS_DEPTH_FAIL:
1988#endif // defined(GL_STENCIL_PASS_DEPTH_FAIL)
1989#if defined(GL_STENCIL_PASS_DEPTH_PASS)
1990        case GL_STENCIL_PASS_DEPTH_PASS:
1991#endif // defined(GL_STENCIL_PASS_DEPTH_PASS)
1992#if defined(GL_STENCIL_REF)
1993        case GL_STENCIL_REF:
1994#endif // defined(GL_STENCIL_REF)
1995#if defined(GL_STENCIL_VALUE_MASK)
1996        case GL_STENCIL_VALUE_MASK:
1997#endif // defined(GL_STENCIL_VALUE_MASK)
1998#if defined(GL_STENCIL_WRITEMASK)
1999        case GL_STENCIL_WRITEMASK:
2000#endif // defined(GL_STENCIL_WRITEMASK)
2001#if defined(GL_SUBPIXEL_BITS)
2002        case GL_SUBPIXEL_BITS:
2003#endif // defined(GL_SUBPIXEL_BITS)
2004#if defined(GL_TEXTURE_BINDING_2D)
2005        case GL_TEXTURE_BINDING_2D:
2006#endif // defined(GL_TEXTURE_BINDING_2D)
2007#if defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)
2008        case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
2009#endif // defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)
2010#if defined(GL_TEXTURE_COORD_ARRAY_SIZE)
2011        case GL_TEXTURE_COORD_ARRAY_SIZE:
2012#endif // defined(GL_TEXTURE_COORD_ARRAY_SIZE)
2013#if defined(GL_TEXTURE_COORD_ARRAY_STRIDE)
2014        case GL_TEXTURE_COORD_ARRAY_STRIDE:
2015#endif // defined(GL_TEXTURE_COORD_ARRAY_STRIDE)
2016#if defined(GL_TEXTURE_COORD_ARRAY_TYPE)
2017        case GL_TEXTURE_COORD_ARRAY_TYPE:
2018#endif // defined(GL_TEXTURE_COORD_ARRAY_TYPE)
2019#if defined(GL_TEXTURE_STACK_DEPTH)
2020        case GL_TEXTURE_STACK_DEPTH:
2021#endif // defined(GL_TEXTURE_STACK_DEPTH)
2022#if defined(GL_UNPACK_ALIGNMENT)
2023        case GL_UNPACK_ALIGNMENT:
2024#endif // defined(GL_UNPACK_ALIGNMENT)
2025#if defined(GL_VERTEX_ARRAY_BUFFER_BINDING)
2026        case GL_VERTEX_ARRAY_BUFFER_BINDING:
2027#endif // defined(GL_VERTEX_ARRAY_BUFFER_BINDING)
2028#if defined(GL_VERTEX_ARRAY_SIZE)
2029        case GL_VERTEX_ARRAY_SIZE:
2030#endif // defined(GL_VERTEX_ARRAY_SIZE)
2031#if defined(GL_VERTEX_ARRAY_STRIDE)
2032        case GL_VERTEX_ARRAY_STRIDE:
2033#endif // defined(GL_VERTEX_ARRAY_STRIDE)
2034#if defined(GL_VERTEX_ARRAY_TYPE)
2035        case GL_VERTEX_ARRAY_TYPE:
2036#endif // defined(GL_VERTEX_ARRAY_TYPE)
2037#if defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES)
2038        case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES:
2039#endif // defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES)
2040#if defined(GL_WEIGHT_ARRAY_SIZE_OES)
2041        case GL_WEIGHT_ARRAY_SIZE_OES:
2042#endif // defined(GL_WEIGHT_ARRAY_SIZE_OES)
2043#if defined(GL_WEIGHT_ARRAY_STRIDE_OES)
2044        case GL_WEIGHT_ARRAY_STRIDE_OES:
2045#endif // defined(GL_WEIGHT_ARRAY_STRIDE_OES)
2046#if defined(GL_WEIGHT_ARRAY_TYPE_OES)
2047        case GL_WEIGHT_ARRAY_TYPE_OES:
2048#endif // defined(GL_WEIGHT_ARRAY_TYPE_OES)
2049            _needed = 1;
2050            break;
2051#if defined(GL_ALIASED_POINT_SIZE_RANGE)
2052        case GL_ALIASED_POINT_SIZE_RANGE:
2053#endif // defined(GL_ALIASED_POINT_SIZE_RANGE)
2054#if defined(GL_ALIASED_LINE_WIDTH_RANGE)
2055        case GL_ALIASED_LINE_WIDTH_RANGE:
2056#endif // defined(GL_ALIASED_LINE_WIDTH_RANGE)
2057#if defined(GL_DEPTH_RANGE)
2058        case GL_DEPTH_RANGE:
2059#endif // defined(GL_DEPTH_RANGE)
2060#if defined(GL_MAX_VIEWPORT_DIMS)
2061        case GL_MAX_VIEWPORT_DIMS:
2062#endif // defined(GL_MAX_VIEWPORT_DIMS)
2063#if defined(GL_SMOOTH_LINE_WIDTH_RANGE)
2064        case GL_SMOOTH_LINE_WIDTH_RANGE:
2065#endif // defined(GL_SMOOTH_LINE_WIDTH_RANGE)
2066#if defined(GL_SMOOTH_POINT_SIZE_RANGE)
2067        case GL_SMOOTH_POINT_SIZE_RANGE:
2068#endif // defined(GL_SMOOTH_POINT_SIZE_RANGE)
2069            _needed = 2;
2070            break;
2071#if defined(GL_COLOR_CLEAR_VALUE)
2072        case GL_COLOR_CLEAR_VALUE:
2073#endif // defined(GL_COLOR_CLEAR_VALUE)
2074#if defined(GL_COLOR_WRITEMASK)
2075        case GL_COLOR_WRITEMASK:
2076#endif // defined(GL_COLOR_WRITEMASK)
2077#if defined(GL_FOG_COLOR)
2078        case GL_FOG_COLOR:
2079#endif // defined(GL_FOG_COLOR)
2080#if defined(GL_LIGHT_MODEL_AMBIENT)
2081        case GL_LIGHT_MODEL_AMBIENT:
2082#endif // defined(GL_LIGHT_MODEL_AMBIENT)
2083#if defined(GL_SCISSOR_BOX)
2084        case GL_SCISSOR_BOX:
2085#endif // defined(GL_SCISSOR_BOX)
2086#if defined(GL_VIEWPORT)
2087        case GL_VIEWPORT:
2088#endif // defined(GL_VIEWPORT)
2089            _needed = 4;
2090            break;
2091#if defined(GL_MODELVIEW_MATRIX)
2092        case GL_MODELVIEW_MATRIX:
2093#endif // defined(GL_MODELVIEW_MATRIX)
2094#if defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES)
2095        case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES:
2096#endif // defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES)
2097#if defined(GL_PROJECTION_MATRIX)
2098        case GL_PROJECTION_MATRIX:
2099#endif // defined(GL_PROJECTION_MATRIX)
2100#if defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES)
2101        case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES:
2102#endif // defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES)
2103#if defined(GL_TEXTURE_MATRIX)
2104        case GL_TEXTURE_MATRIX:
2105#endif // defined(GL_TEXTURE_MATRIX)
2106#if defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES)
2107        case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES:
2108#endif // defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES)
2109            _needed = 16;
2110            break;
2111#if defined(GL_COMPRESSED_TEXTURE_FORMATS)
2112        case GL_COMPRESSED_TEXTURE_FORMATS:
2113#endif // defined(GL_COMPRESSED_TEXTURE_FORMATS)
2114            _needed = getNumCompressedTextureFormats();
2115            break;
2116        default:
2117            _needed = 0;
2118            break;
2119    }
2120    if (_remaining < _needed) {
2121        _exception = 1;
2122        _env->ThrowNew(IAEClass, "length - offset < needed");
2123        goto exit;
2124    }
2125    params_base = (GLint *)
2126        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2127    params = params_base + offset;
2128
2129    glGetIntegerv(
2130        (GLenum)pname,
2131        (GLint *)params
2132    );
2133
2134exit:
2135    if (params_base) {
2136        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2137            _exception ? JNI_ABORT: 0);
2138    }
2139}
2140
2141/* void glGetIntegerv ( GLenum pname, GLint *params ) */
2142static void
2143android_glGetIntegerv__ILjava_nio_IntBuffer_2
2144  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
2145    jint _exception = 0;
2146    jarray _array = (jarray) 0;
2147    jint _remaining;
2148    GLint *params = (GLint *) 0;
2149
2150    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
2151    int _needed;
2152    switch (pname) {
2153#if defined(GL_ALPHA_BITS)
2154        case GL_ALPHA_BITS:
2155#endif // defined(GL_ALPHA_BITS)
2156#if defined(GL_ALPHA_TEST_FUNC)
2157        case GL_ALPHA_TEST_FUNC:
2158#endif // defined(GL_ALPHA_TEST_FUNC)
2159#if defined(GL_ALPHA_TEST_REF)
2160        case GL_ALPHA_TEST_REF:
2161#endif // defined(GL_ALPHA_TEST_REF)
2162#if defined(GL_BLEND_DST)
2163        case GL_BLEND_DST:
2164#endif // defined(GL_BLEND_DST)
2165#if defined(GL_BLUE_BITS)
2166        case GL_BLUE_BITS:
2167#endif // defined(GL_BLUE_BITS)
2168#if defined(GL_COLOR_ARRAY_BUFFER_BINDING)
2169        case GL_COLOR_ARRAY_BUFFER_BINDING:
2170#endif // defined(GL_COLOR_ARRAY_BUFFER_BINDING)
2171#if defined(GL_COLOR_ARRAY_SIZE)
2172        case GL_COLOR_ARRAY_SIZE:
2173#endif // defined(GL_COLOR_ARRAY_SIZE)
2174#if defined(GL_COLOR_ARRAY_STRIDE)
2175        case GL_COLOR_ARRAY_STRIDE:
2176#endif // defined(GL_COLOR_ARRAY_STRIDE)
2177#if defined(GL_COLOR_ARRAY_TYPE)
2178        case GL_COLOR_ARRAY_TYPE:
2179#endif // defined(GL_COLOR_ARRAY_TYPE)
2180#if defined(GL_CULL_FACE)
2181        case GL_CULL_FACE:
2182#endif // defined(GL_CULL_FACE)
2183#if defined(GL_DEPTH_BITS)
2184        case GL_DEPTH_BITS:
2185#endif // defined(GL_DEPTH_BITS)
2186#if defined(GL_DEPTH_CLEAR_VALUE)
2187        case GL_DEPTH_CLEAR_VALUE:
2188#endif // defined(GL_DEPTH_CLEAR_VALUE)
2189#if defined(GL_DEPTH_FUNC)
2190        case GL_DEPTH_FUNC:
2191#endif // defined(GL_DEPTH_FUNC)
2192#if defined(GL_DEPTH_WRITEMASK)
2193        case GL_DEPTH_WRITEMASK:
2194#endif // defined(GL_DEPTH_WRITEMASK)
2195#if defined(GL_FOG_DENSITY)
2196        case GL_FOG_DENSITY:
2197#endif // defined(GL_FOG_DENSITY)
2198#if defined(GL_FOG_END)
2199        case GL_FOG_END:
2200#endif // defined(GL_FOG_END)
2201#if defined(GL_FOG_MODE)
2202        case GL_FOG_MODE:
2203#endif // defined(GL_FOG_MODE)
2204#if defined(GL_FOG_START)
2205        case GL_FOG_START:
2206#endif // defined(GL_FOG_START)
2207#if defined(GL_FRONT_FACE)
2208        case GL_FRONT_FACE:
2209#endif // defined(GL_FRONT_FACE)
2210#if defined(GL_GREEN_BITS)
2211        case GL_GREEN_BITS:
2212#endif // defined(GL_GREEN_BITS)
2213#if defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)
2214        case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
2215#endif // defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)
2216#if defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)
2217        case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
2218#endif // defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)
2219#if defined(GL_LIGHT_MODEL_COLOR_CONTROL)
2220        case GL_LIGHT_MODEL_COLOR_CONTROL:
2221#endif // defined(GL_LIGHT_MODEL_COLOR_CONTROL)
2222#if defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
2223        case GL_LIGHT_MODEL_LOCAL_VIEWER:
2224#endif // defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
2225#if defined(GL_LIGHT_MODEL_TWO_SIDE)
2226        case GL_LIGHT_MODEL_TWO_SIDE:
2227#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
2228#if defined(GL_LINE_SMOOTH_HINT)
2229        case GL_LINE_SMOOTH_HINT:
2230#endif // defined(GL_LINE_SMOOTH_HINT)
2231#if defined(GL_LINE_WIDTH)
2232        case GL_LINE_WIDTH:
2233#endif // defined(GL_LINE_WIDTH)
2234#if defined(GL_LOGIC_OP_MODE)
2235        case GL_LOGIC_OP_MODE:
2236#endif // defined(GL_LOGIC_OP_MODE)
2237#if defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES)
2238        case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES:
2239#endif // defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES)
2240#if defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES)
2241        case GL_MATRIX_INDEX_ARRAY_SIZE_OES:
2242#endif // defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES)
2243#if defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES)
2244        case GL_MATRIX_INDEX_ARRAY_STRIDE_OES:
2245#endif // defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES)
2246#if defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES)
2247        case GL_MATRIX_INDEX_ARRAY_TYPE_OES:
2248#endif // defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES)
2249#if defined(GL_MATRIX_MODE)
2250        case GL_MATRIX_MODE:
2251#endif // defined(GL_MATRIX_MODE)
2252#if defined(GL_MAX_CLIP_PLANES)
2253        case GL_MAX_CLIP_PLANES:
2254#endif // defined(GL_MAX_CLIP_PLANES)
2255#if defined(GL_MAX_ELEMENTS_INDICES)
2256        case GL_MAX_ELEMENTS_INDICES:
2257#endif // defined(GL_MAX_ELEMENTS_INDICES)
2258#if defined(GL_MAX_ELEMENTS_VERTICES)
2259        case GL_MAX_ELEMENTS_VERTICES:
2260#endif // defined(GL_MAX_ELEMENTS_VERTICES)
2261#if defined(GL_MAX_LIGHTS)
2262        case GL_MAX_LIGHTS:
2263#endif // defined(GL_MAX_LIGHTS)
2264#if defined(GL_MAX_MODELVIEW_STACK_DEPTH)
2265        case GL_MAX_MODELVIEW_STACK_DEPTH:
2266#endif // defined(GL_MAX_MODELVIEW_STACK_DEPTH)
2267#if defined(GL_MAX_PALETTE_MATRICES_OES)
2268        case GL_MAX_PALETTE_MATRICES_OES:
2269#endif // defined(GL_MAX_PALETTE_MATRICES_OES)
2270#if defined(GL_MAX_PROJECTION_STACK_DEPTH)
2271        case GL_MAX_PROJECTION_STACK_DEPTH:
2272#endif // defined(GL_MAX_PROJECTION_STACK_DEPTH)
2273#if defined(GL_MAX_TEXTURE_SIZE)
2274        case GL_MAX_TEXTURE_SIZE:
2275#endif // defined(GL_MAX_TEXTURE_SIZE)
2276#if defined(GL_MAX_TEXTURE_STACK_DEPTH)
2277        case GL_MAX_TEXTURE_STACK_DEPTH:
2278#endif // defined(GL_MAX_TEXTURE_STACK_DEPTH)
2279#if defined(GL_MAX_TEXTURE_UNITS)
2280        case GL_MAX_TEXTURE_UNITS:
2281#endif // defined(GL_MAX_TEXTURE_UNITS)
2282#if defined(GL_MAX_VERTEX_UNITS_OES)
2283        case GL_MAX_VERTEX_UNITS_OES:
2284#endif // defined(GL_MAX_VERTEX_UNITS_OES)
2285#if defined(GL_MODELVIEW_STACK_DEPTH)
2286        case GL_MODELVIEW_STACK_DEPTH:
2287#endif // defined(GL_MODELVIEW_STACK_DEPTH)
2288#if defined(GL_NORMAL_ARRAY_BUFFER_BINDING)
2289        case GL_NORMAL_ARRAY_BUFFER_BINDING:
2290#endif // defined(GL_NORMAL_ARRAY_BUFFER_BINDING)
2291#if defined(GL_NORMAL_ARRAY_STRIDE)
2292        case GL_NORMAL_ARRAY_STRIDE:
2293#endif // defined(GL_NORMAL_ARRAY_STRIDE)
2294#if defined(GL_NORMAL_ARRAY_TYPE)
2295        case GL_NORMAL_ARRAY_TYPE:
2296#endif // defined(GL_NORMAL_ARRAY_TYPE)
2297#if defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
2298        case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
2299#endif // defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
2300#if defined(GL_PACK_ALIGNMENT)
2301        case GL_PACK_ALIGNMENT:
2302#endif // defined(GL_PACK_ALIGNMENT)
2303#if defined(GL_PERSPECTIVE_CORRECTION_HINT)
2304        case GL_PERSPECTIVE_CORRECTION_HINT:
2305#endif // defined(GL_PERSPECTIVE_CORRECTION_HINT)
2306#if defined(GL_POINT_SIZE)
2307        case GL_POINT_SIZE:
2308#endif // defined(GL_POINT_SIZE)
2309#if defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES)
2310        case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
2311#endif // defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES)
2312#if defined(GL_POINT_SIZE_ARRAY_STRIDE_OES)
2313        case GL_POINT_SIZE_ARRAY_STRIDE_OES:
2314#endif // defined(GL_POINT_SIZE_ARRAY_STRIDE_OES)
2315#if defined(GL_POINT_SIZE_ARRAY_TYPE_OES)
2316        case GL_POINT_SIZE_ARRAY_TYPE_OES:
2317#endif // defined(GL_POINT_SIZE_ARRAY_TYPE_OES)
2318#if defined(GL_POINT_SMOOTH_HINT)
2319        case GL_POINT_SMOOTH_HINT:
2320#endif // defined(GL_POINT_SMOOTH_HINT)
2321#if defined(GL_POLYGON_OFFSET_FACTOR)
2322        case GL_POLYGON_OFFSET_FACTOR:
2323#endif // defined(GL_POLYGON_OFFSET_FACTOR)
2324#if defined(GL_POLYGON_OFFSET_UNITS)
2325        case GL_POLYGON_OFFSET_UNITS:
2326#endif // defined(GL_POLYGON_OFFSET_UNITS)
2327#if defined(GL_PROJECTION_STACK_DEPTH)
2328        case GL_PROJECTION_STACK_DEPTH:
2329#endif // defined(GL_PROJECTION_STACK_DEPTH)
2330#if defined(GL_RED_BITS)
2331        case GL_RED_BITS:
2332#endif // defined(GL_RED_BITS)
2333#if defined(GL_SHADE_MODEL)
2334        case GL_SHADE_MODEL:
2335#endif // defined(GL_SHADE_MODEL)
2336#if defined(GL_STENCIL_BITS)
2337        case GL_STENCIL_BITS:
2338#endif // defined(GL_STENCIL_BITS)
2339#if defined(GL_STENCIL_CLEAR_VALUE)
2340        case GL_STENCIL_CLEAR_VALUE:
2341#endif // defined(GL_STENCIL_CLEAR_VALUE)
2342#if defined(GL_STENCIL_FAIL)
2343        case GL_STENCIL_FAIL:
2344#endif // defined(GL_STENCIL_FAIL)
2345#if defined(GL_STENCIL_FUNC)
2346        case GL_STENCIL_FUNC:
2347#endif // defined(GL_STENCIL_FUNC)
2348#if defined(GL_STENCIL_PASS_DEPTH_FAIL)
2349        case GL_STENCIL_PASS_DEPTH_FAIL:
2350#endif // defined(GL_STENCIL_PASS_DEPTH_FAIL)
2351#if defined(GL_STENCIL_PASS_DEPTH_PASS)
2352        case GL_STENCIL_PASS_DEPTH_PASS:
2353#endif // defined(GL_STENCIL_PASS_DEPTH_PASS)
2354#if defined(GL_STENCIL_REF)
2355        case GL_STENCIL_REF:
2356#endif // defined(GL_STENCIL_REF)
2357#if defined(GL_STENCIL_VALUE_MASK)
2358        case GL_STENCIL_VALUE_MASK:
2359#endif // defined(GL_STENCIL_VALUE_MASK)
2360#if defined(GL_STENCIL_WRITEMASK)
2361        case GL_STENCIL_WRITEMASK:
2362#endif // defined(GL_STENCIL_WRITEMASK)
2363#if defined(GL_SUBPIXEL_BITS)
2364        case GL_SUBPIXEL_BITS:
2365#endif // defined(GL_SUBPIXEL_BITS)
2366#if defined(GL_TEXTURE_BINDING_2D)
2367        case GL_TEXTURE_BINDING_2D:
2368#endif // defined(GL_TEXTURE_BINDING_2D)
2369#if defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)
2370        case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
2371#endif // defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)
2372#if defined(GL_TEXTURE_COORD_ARRAY_SIZE)
2373        case GL_TEXTURE_COORD_ARRAY_SIZE:
2374#endif // defined(GL_TEXTURE_COORD_ARRAY_SIZE)
2375#if defined(GL_TEXTURE_COORD_ARRAY_STRIDE)
2376        case GL_TEXTURE_COORD_ARRAY_STRIDE:
2377#endif // defined(GL_TEXTURE_COORD_ARRAY_STRIDE)
2378#if defined(GL_TEXTURE_COORD_ARRAY_TYPE)
2379        case GL_TEXTURE_COORD_ARRAY_TYPE:
2380#endif // defined(GL_TEXTURE_COORD_ARRAY_TYPE)
2381#if defined(GL_TEXTURE_STACK_DEPTH)
2382        case GL_TEXTURE_STACK_DEPTH:
2383#endif // defined(GL_TEXTURE_STACK_DEPTH)
2384#if defined(GL_UNPACK_ALIGNMENT)
2385        case GL_UNPACK_ALIGNMENT:
2386#endif // defined(GL_UNPACK_ALIGNMENT)
2387#if defined(GL_VERTEX_ARRAY_BUFFER_BINDING)
2388        case GL_VERTEX_ARRAY_BUFFER_BINDING:
2389#endif // defined(GL_VERTEX_ARRAY_BUFFER_BINDING)
2390#if defined(GL_VERTEX_ARRAY_SIZE)
2391        case GL_VERTEX_ARRAY_SIZE:
2392#endif // defined(GL_VERTEX_ARRAY_SIZE)
2393#if defined(GL_VERTEX_ARRAY_STRIDE)
2394        case GL_VERTEX_ARRAY_STRIDE:
2395#endif // defined(GL_VERTEX_ARRAY_STRIDE)
2396#if defined(GL_VERTEX_ARRAY_TYPE)
2397        case GL_VERTEX_ARRAY_TYPE:
2398#endif // defined(GL_VERTEX_ARRAY_TYPE)
2399#if defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES)
2400        case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES:
2401#endif // defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES)
2402#if defined(GL_WEIGHT_ARRAY_SIZE_OES)
2403        case GL_WEIGHT_ARRAY_SIZE_OES:
2404#endif // defined(GL_WEIGHT_ARRAY_SIZE_OES)
2405#if defined(GL_WEIGHT_ARRAY_STRIDE_OES)
2406        case GL_WEIGHT_ARRAY_STRIDE_OES:
2407#endif // defined(GL_WEIGHT_ARRAY_STRIDE_OES)
2408#if defined(GL_WEIGHT_ARRAY_TYPE_OES)
2409        case GL_WEIGHT_ARRAY_TYPE_OES:
2410#endif // defined(GL_WEIGHT_ARRAY_TYPE_OES)
2411            _needed = 1;
2412            break;
2413#if defined(GL_ALIASED_POINT_SIZE_RANGE)
2414        case GL_ALIASED_POINT_SIZE_RANGE:
2415#endif // defined(GL_ALIASED_POINT_SIZE_RANGE)
2416#if defined(GL_ALIASED_LINE_WIDTH_RANGE)
2417        case GL_ALIASED_LINE_WIDTH_RANGE:
2418#endif // defined(GL_ALIASED_LINE_WIDTH_RANGE)
2419#if defined(GL_DEPTH_RANGE)
2420        case GL_DEPTH_RANGE:
2421#endif // defined(GL_DEPTH_RANGE)
2422#if defined(GL_MAX_VIEWPORT_DIMS)
2423        case GL_MAX_VIEWPORT_DIMS:
2424#endif // defined(GL_MAX_VIEWPORT_DIMS)
2425#if defined(GL_SMOOTH_LINE_WIDTH_RANGE)
2426        case GL_SMOOTH_LINE_WIDTH_RANGE:
2427#endif // defined(GL_SMOOTH_LINE_WIDTH_RANGE)
2428#if defined(GL_SMOOTH_POINT_SIZE_RANGE)
2429        case GL_SMOOTH_POINT_SIZE_RANGE:
2430#endif // defined(GL_SMOOTH_POINT_SIZE_RANGE)
2431            _needed = 2;
2432            break;
2433#if defined(GL_COLOR_CLEAR_VALUE)
2434        case GL_COLOR_CLEAR_VALUE:
2435#endif // defined(GL_COLOR_CLEAR_VALUE)
2436#if defined(GL_COLOR_WRITEMASK)
2437        case GL_COLOR_WRITEMASK:
2438#endif // defined(GL_COLOR_WRITEMASK)
2439#if defined(GL_FOG_COLOR)
2440        case GL_FOG_COLOR:
2441#endif // defined(GL_FOG_COLOR)
2442#if defined(GL_LIGHT_MODEL_AMBIENT)
2443        case GL_LIGHT_MODEL_AMBIENT:
2444#endif // defined(GL_LIGHT_MODEL_AMBIENT)
2445#if defined(GL_SCISSOR_BOX)
2446        case GL_SCISSOR_BOX:
2447#endif // defined(GL_SCISSOR_BOX)
2448#if defined(GL_VIEWPORT)
2449        case GL_VIEWPORT:
2450#endif // defined(GL_VIEWPORT)
2451            _needed = 4;
2452            break;
2453#if defined(GL_MODELVIEW_MATRIX)
2454        case GL_MODELVIEW_MATRIX:
2455#endif // defined(GL_MODELVIEW_MATRIX)
2456#if defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES)
2457        case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES:
2458#endif // defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES)
2459#if defined(GL_PROJECTION_MATRIX)
2460        case GL_PROJECTION_MATRIX:
2461#endif // defined(GL_PROJECTION_MATRIX)
2462#if defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES)
2463        case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES:
2464#endif // defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES)
2465#if defined(GL_TEXTURE_MATRIX)
2466        case GL_TEXTURE_MATRIX:
2467#endif // defined(GL_TEXTURE_MATRIX)
2468#if defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES)
2469        case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES:
2470#endif // defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES)
2471            _needed = 16;
2472            break;
2473#if defined(GL_COMPRESSED_TEXTURE_FORMATS)
2474        case GL_COMPRESSED_TEXTURE_FORMATS:
2475#endif // defined(GL_COMPRESSED_TEXTURE_FORMATS)
2476            _needed = getNumCompressedTextureFormats();
2477            break;
2478        default:
2479            _needed = 0;
2480            break;
2481    }
2482    if (_remaining < _needed) {
2483        _exception = 1;
2484        _env->ThrowNew(IAEClass, "remaining() < needed");
2485        goto exit;
2486    }
2487    glGetIntegerv(
2488        (GLenum)pname,
2489        (GLint *)params
2490    );
2491
2492exit:
2493    if (_array) {
2494        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2495    }
2496}
2497
2498/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2499static void
2500android_glGetProgramiv__II_3II
2501  (JNIEnv *_env, jobject _this, jint program, jint pname, jintArray params_ref, jint offset) {
2502    jint _exception = 0;
2503    GLint *params_base = (GLint *) 0;
2504    jint _remaining;
2505    GLint *params = (GLint *) 0;
2506
2507    if (!params_ref) {
2508        _exception = 1;
2509        _env->ThrowNew(IAEClass, "params == null");
2510        goto exit;
2511    }
2512    if (offset < 0) {
2513        _exception = 1;
2514        _env->ThrowNew(IAEClass, "offset < 0");
2515        goto exit;
2516    }
2517    _remaining = _env->GetArrayLength(params_ref) - offset;
2518    params_base = (GLint *)
2519        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2520    params = params_base + offset;
2521
2522    glGetProgramiv(
2523        (GLuint)program,
2524        (GLenum)pname,
2525        (GLint *)params
2526    );
2527
2528exit:
2529    if (params_base) {
2530        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2531            _exception ? JNI_ABORT: 0);
2532    }
2533}
2534
2535/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2536static void
2537android_glGetProgramiv__IILjava_nio_IntBuffer_2
2538  (JNIEnv *_env, jobject _this, jint program, jint pname, jobject params_buf) {
2539    jint _exception = 0;
2540    jarray _array = (jarray) 0;
2541    jint _remaining;
2542    GLint *params = (GLint *) 0;
2543
2544    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
2545    glGetProgramiv(
2546        (GLuint)program,
2547        (GLenum)pname,
2548        (GLint *)params
2549    );
2550    if (_array) {
2551        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2552    }
2553}
2554
2555#include <string.h>
2556
2557/* void glGetProgramInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
2558static
2559jstring
2560android_glGetProgramInfoLog (JNIEnv *_env, jobject _this, jint shader) {
2561    GLint infoLen = 0;
2562    jstring _result = 0;
2563    char* buf = 0;
2564    glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
2565    if (infoLen) {
2566        char* buf = (char*) malloc(infoLen);
2567        if (buf == 0) {
2568            _env->ThrowNew(IAEClass, "out of memory");
2569            goto exit;
2570        }
2571        glGetProgramInfoLog(shader, infoLen, NULL, buf);
2572        _result = _env->NewStringUTF(buf);
2573    } else {
2574        _result = _env->NewStringUTF("");
2575    }
2576exit:
2577    if (buf) {
2578            free(buf);
2579    }
2580    return _result;
2581}
2582/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2583static void
2584android_glGetRenderbufferParameteriv__II_3II
2585  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2586    jint _exception = 0;
2587    GLint *params_base = (GLint *) 0;
2588    jint _remaining;
2589    GLint *params = (GLint *) 0;
2590
2591    if (!params_ref) {
2592        _exception = 1;
2593        _env->ThrowNew(IAEClass, "params == null");
2594        goto exit;
2595    }
2596    if (offset < 0) {
2597        _exception = 1;
2598        _env->ThrowNew(IAEClass, "offset < 0");
2599        goto exit;
2600    }
2601    _remaining = _env->GetArrayLength(params_ref) - offset;
2602    params_base = (GLint *)
2603        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2604    params = params_base + offset;
2605
2606    glGetRenderbufferParameteriv(
2607        (GLenum)target,
2608        (GLenum)pname,
2609        (GLint *)params
2610    );
2611
2612exit:
2613    if (params_base) {
2614        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2615            _exception ? JNI_ABORT: 0);
2616    }
2617}
2618
2619/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2620static void
2621android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2
2622  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2623    jint _exception = 0;
2624    jarray _array = (jarray) 0;
2625    jint _remaining;
2626    GLint *params = (GLint *) 0;
2627
2628    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
2629    glGetRenderbufferParameteriv(
2630        (GLenum)target,
2631        (GLenum)pname,
2632        (GLint *)params
2633    );
2634    if (_array) {
2635        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2636    }
2637}
2638
2639/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
2640static void
2641android_glGetShaderiv__II_3II
2642  (JNIEnv *_env, jobject _this, jint shader, jint pname, jintArray params_ref, jint offset) {
2643    jint _exception = 0;
2644    GLint *params_base = (GLint *) 0;
2645    jint _remaining;
2646    GLint *params = (GLint *) 0;
2647
2648    if (!params_ref) {
2649        _exception = 1;
2650        _env->ThrowNew(IAEClass, "params == null");
2651        goto exit;
2652    }
2653    if (offset < 0) {
2654        _exception = 1;
2655        _env->ThrowNew(IAEClass, "offset < 0");
2656        goto exit;
2657    }
2658    _remaining = _env->GetArrayLength(params_ref) - offset;
2659    params_base = (GLint *)
2660        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2661    params = params_base + offset;
2662
2663    glGetShaderiv(
2664        (GLuint)shader,
2665        (GLenum)pname,
2666        (GLint *)params
2667    );
2668
2669exit:
2670    if (params_base) {
2671        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2672            _exception ? JNI_ABORT: 0);
2673    }
2674}
2675
2676/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
2677static void
2678android_glGetShaderiv__IILjava_nio_IntBuffer_2
2679  (JNIEnv *_env, jobject _this, jint shader, jint pname, jobject params_buf) {
2680    jint _exception = 0;
2681    jarray _array = (jarray) 0;
2682    jint _remaining;
2683    GLint *params = (GLint *) 0;
2684
2685    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
2686    glGetShaderiv(
2687        (GLuint)shader,
2688        (GLenum)pname,
2689        (GLint *)params
2690    );
2691    if (_array) {
2692        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2693    }
2694}
2695
2696#include <string.h>
2697
2698/* void glGetShaderInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
2699static
2700jstring
2701android_glGetShaderInfoLog (JNIEnv *_env, jobject _this, jint shader) {
2702    GLint infoLen = 0;
2703    jstring _result = 0;
2704    char* buf = 0;
2705    glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
2706    if (infoLen) {
2707        char* buf = (char*) malloc(infoLen);
2708        if (buf == 0) {
2709            _env->ThrowNew(IAEClass, "out of memory");
2710            goto exit;
2711        }
2712        glGetShaderInfoLog(shader, infoLen, NULL, buf);
2713        _result = _env->NewStringUTF(buf);
2714    } else {
2715        _result = _env->NewStringUTF("");
2716    }
2717exit:
2718    if (buf) {
2719            free(buf);
2720    }
2721    return _result;
2722}
2723/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
2724static void
2725android_glGetShaderPrecisionFormat__II_3II_3II
2726  (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jintArray range_ref, jint rangeOffset, jintArray precision_ref, jint precisionOffset) {
2727    jint _exception = 0;
2728    GLint *range_base = (GLint *) 0;
2729    jint _rangeRemaining;
2730    GLint *range = (GLint *) 0;
2731    GLint *precision_base = (GLint *) 0;
2732    jint _precisionRemaining;
2733    GLint *precision = (GLint *) 0;
2734
2735    if (!range_ref) {
2736        _exception = 1;
2737        _env->ThrowNew(IAEClass, "range == null");
2738        goto exit;
2739    }
2740    if (rangeOffset < 0) {
2741        _exception = 1;
2742        _env->ThrowNew(IAEClass, "rangeOffset < 0");
2743        goto exit;
2744    }
2745    _rangeRemaining = _env->GetArrayLength(range_ref) - rangeOffset;
2746    range_base = (GLint *)
2747        _env->GetPrimitiveArrayCritical(range_ref, (jboolean *)0);
2748    range = range_base + rangeOffset;
2749
2750    if (!precision_ref) {
2751        _exception = 1;
2752        _env->ThrowNew(IAEClass, "precision == null");
2753        goto exit;
2754    }
2755    if (precisionOffset < 0) {
2756        _exception = 1;
2757        _env->ThrowNew(IAEClass, "precisionOffset < 0");
2758        goto exit;
2759    }
2760    _precisionRemaining = _env->GetArrayLength(precision_ref) - precisionOffset;
2761    precision_base = (GLint *)
2762        _env->GetPrimitiveArrayCritical(precision_ref, (jboolean *)0);
2763    precision = precision_base + precisionOffset;
2764
2765    glGetShaderPrecisionFormat(
2766        (GLenum)shadertype,
2767        (GLenum)precisiontype,
2768        (GLint *)range,
2769        (GLint *)precision
2770    );
2771
2772exit:
2773    if (precision_base) {
2774        _env->ReleasePrimitiveArrayCritical(precision_ref, precision_base,
2775            _exception ? JNI_ABORT: 0);
2776    }
2777    if (range_base) {
2778        _env->ReleasePrimitiveArrayCritical(range_ref, range_base,
2779            _exception ? JNI_ABORT: 0);
2780    }
2781}
2782
2783/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
2784static void
2785android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
2786  (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jobject range_buf, jobject precision_buf) {
2787    jint _exception = 0;
2788    jarray _rangeArray = (jarray) 0;
2789    jarray _precisionArray = (jarray) 0;
2790    jint _rangeRemaining;
2791    GLint *range = (GLint *) 0;
2792    jint _precisionRemaining;
2793    GLint *precision = (GLint *) 0;
2794
2795    range = (GLint *)getPointer(_env, range_buf, &_rangeArray, &_rangeRemaining);
2796    precision = (GLint *)getPointer(_env, precision_buf, &_precisionArray, &_precisionRemaining);
2797    glGetShaderPrecisionFormat(
2798        (GLenum)shadertype,
2799        (GLenum)precisiontype,
2800        (GLint *)range,
2801        (GLint *)precision
2802    );
2803    if (_rangeArray) {
2804        releasePointer(_env, _rangeArray, precision, _exception ? JNI_FALSE : JNI_TRUE);
2805    }
2806    if (_precisionArray) {
2807        releasePointer(_env, _precisionArray, range, _exception ? JNI_FALSE : JNI_TRUE);
2808    }
2809}
2810
2811/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
2812static void
2813android_glGetShaderSource__II_3II_3BI
2814  (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jintArray length_ref, jint lengthOffset, jbyteArray source_ref, jint sourceOffset) {
2815    jint _exception = 0;
2816    GLsizei *length_base = (GLsizei *) 0;
2817    jint _lengthRemaining;
2818    GLsizei *length = (GLsizei *) 0;
2819    char *source_base = (char *) 0;
2820    jint _sourceRemaining;
2821    char *source = (char *) 0;
2822
2823    if (!length_ref) {
2824        _exception = 1;
2825        _env->ThrowNew(IAEClass, "length == null");
2826        goto exit;
2827    }
2828    if (lengthOffset < 0) {
2829        _exception = 1;
2830        _env->ThrowNew(IAEClass, "lengthOffset < 0");
2831        goto exit;
2832    }
2833    _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
2834    length_base = (GLsizei *)
2835        _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
2836    length = length_base + lengthOffset;
2837
2838    if (!source_ref) {
2839        _exception = 1;
2840        _env->ThrowNew(IAEClass, "source == null");
2841        goto exit;
2842    }
2843    if (sourceOffset < 0) {
2844        _exception = 1;
2845        _env->ThrowNew(IAEClass, "sourceOffset < 0");
2846        goto exit;
2847    }
2848    _sourceRemaining = _env->GetArrayLength(source_ref) - sourceOffset;
2849    source_base = (char *)
2850        _env->GetPrimitiveArrayCritical(source_ref, (jboolean *)0);
2851    source = source_base + sourceOffset;
2852
2853    glGetShaderSource(
2854        (GLuint)shader,
2855        (GLsizei)bufsize,
2856        (GLsizei *)length,
2857        (char *)source
2858    );
2859
2860exit:
2861    if (source_base) {
2862        _env->ReleasePrimitiveArrayCritical(source_ref, source_base,
2863            _exception ? JNI_ABORT: 0);
2864    }
2865    if (length_base) {
2866        _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
2867            _exception ? JNI_ABORT: 0);
2868    }
2869}
2870
2871/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
2872static void
2873android_glGetShaderSource__IILjava_nio_IntBuffer_2B
2874  (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jobject length_buf, jbyte source) {
2875    jint _exception = 0;
2876    jarray _array = (jarray) 0;
2877    jint _remaining;
2878    GLsizei *length = (GLsizei *) 0;
2879
2880    length = (GLsizei *)getPointer(_env, length_buf, &_array, &_remaining);
2881    glGetShaderSource(
2882        (GLuint)shader,
2883        (GLsizei)bufsize,
2884        (GLsizei *)length,
2885        (char *)source
2886    );
2887    if (_array) {
2888        releasePointer(_env, _array, length, _exception ? JNI_FALSE : JNI_TRUE);
2889    }
2890}
2891
2892#include <string.h>
2893
2894/* const GLubyte * glGetString ( GLenum name ) */
2895static
2896jstring
2897android_glGetString
2898  (JNIEnv *_env, jobject _this, jint name) {
2899    const char * chars = (const char *)glGetString((GLenum)name);
2900    jstring output = _env->NewStringUTF(chars);
2901    return output;
2902}
2903/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
2904static void
2905android_glGetTexParameterfv__II_3FI
2906  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
2907    jint _exception = 0;
2908    GLfloat *params_base = (GLfloat *) 0;
2909    jint _remaining;
2910    GLfloat *params = (GLfloat *) 0;
2911
2912    if (!params_ref) {
2913        _exception = 1;
2914        _env->ThrowNew(IAEClass, "params == null");
2915        goto exit;
2916    }
2917    if (offset < 0) {
2918        _exception = 1;
2919        _env->ThrowNew(IAEClass, "offset < 0");
2920        goto exit;
2921    }
2922    _remaining = _env->GetArrayLength(params_ref) - offset;
2923    if (_remaining < 1) {
2924        _exception = 1;
2925        _env->ThrowNew(IAEClass, "length - offset < 1");
2926        goto exit;
2927    }
2928    params_base = (GLfloat *)
2929        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2930    params = params_base + offset;
2931
2932    glGetTexParameterfv(
2933        (GLenum)target,
2934        (GLenum)pname,
2935        (GLfloat *)params
2936    );
2937
2938exit:
2939    if (params_base) {
2940        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2941            _exception ? JNI_ABORT: 0);
2942    }
2943}
2944
2945/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
2946static void
2947android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2
2948  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2949    jint _exception = 0;
2950    jarray _array = (jarray) 0;
2951    jint _remaining;
2952    GLfloat *params = (GLfloat *) 0;
2953
2954    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
2955    if (_remaining < 1) {
2956        _exception = 1;
2957        _env->ThrowNew(IAEClass, "remaining() < 1");
2958        goto exit;
2959    }
2960    glGetTexParameterfv(
2961        (GLenum)target,
2962        (GLenum)pname,
2963        (GLfloat *)params
2964    );
2965
2966exit:
2967    if (_array) {
2968        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2969    }
2970}
2971
2972/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2973static void
2974android_glGetTexParameteriv__II_3II
2975  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2976    jint _exception = 0;
2977    GLint *params_base = (GLint *) 0;
2978    jint _remaining;
2979    GLint *params = (GLint *) 0;
2980
2981    if (!params_ref) {
2982        _exception = 1;
2983        _env->ThrowNew(IAEClass, "params == null");
2984        goto exit;
2985    }
2986    if (offset < 0) {
2987        _exception = 1;
2988        _env->ThrowNew(IAEClass, "offset < 0");
2989        goto exit;
2990    }
2991    _remaining = _env->GetArrayLength(params_ref) - offset;
2992    if (_remaining < 1) {
2993        _exception = 1;
2994        _env->ThrowNew(IAEClass, "length - offset < 1");
2995        goto exit;
2996    }
2997    params_base = (GLint *)
2998        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2999    params = params_base + offset;
3000
3001    glGetTexParameteriv(
3002        (GLenum)target,
3003        (GLenum)pname,
3004        (GLint *)params
3005    );
3006
3007exit:
3008    if (params_base) {
3009        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3010            _exception ? JNI_ABORT: 0);
3011    }
3012}
3013
3014/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3015static void
3016android_glGetTexParameteriv__IILjava_nio_IntBuffer_2
3017  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3018    jint _exception = 0;
3019    jarray _array = (jarray) 0;
3020    jint _remaining;
3021    GLint *params = (GLint *) 0;
3022
3023    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
3024    if (_remaining < 1) {
3025        _exception = 1;
3026        _env->ThrowNew(IAEClass, "remaining() < 1");
3027        goto exit;
3028    }
3029    glGetTexParameteriv(
3030        (GLenum)target,
3031        (GLenum)pname,
3032        (GLint *)params
3033    );
3034
3035exit:
3036    if (_array) {
3037        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3038    }
3039}
3040
3041/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3042static void
3043android_glGetUniformfv__II_3FI
3044  (JNIEnv *_env, jobject _this, jint program, jint location, jfloatArray params_ref, jint offset) {
3045    jint _exception = 0;
3046    GLfloat *params_base = (GLfloat *) 0;
3047    jint _remaining;
3048    GLfloat *params = (GLfloat *) 0;
3049
3050    if (!params_ref) {
3051        _exception = 1;
3052        _env->ThrowNew(IAEClass, "params == null");
3053        goto exit;
3054    }
3055    if (offset < 0) {
3056        _exception = 1;
3057        _env->ThrowNew(IAEClass, "offset < 0");
3058        goto exit;
3059    }
3060    _remaining = _env->GetArrayLength(params_ref) - offset;
3061    params_base = (GLfloat *)
3062        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3063    params = params_base + offset;
3064
3065    glGetUniformfv(
3066        (GLuint)program,
3067        (GLint)location,
3068        (GLfloat *)params
3069    );
3070
3071exit:
3072    if (params_base) {
3073        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3074            _exception ? JNI_ABORT: 0);
3075    }
3076}
3077
3078/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3079static void
3080android_glGetUniformfv__IILjava_nio_FloatBuffer_2
3081  (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
3082    jint _exception = 0;
3083    jarray _array = (jarray) 0;
3084    jint _remaining;
3085    GLfloat *params = (GLfloat *) 0;
3086
3087    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
3088    glGetUniformfv(
3089        (GLuint)program,
3090        (GLint)location,
3091        (GLfloat *)params
3092    );
3093    if (_array) {
3094        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3095    }
3096}
3097
3098/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3099static void
3100android_glGetUniformiv__II_3II
3101  (JNIEnv *_env, jobject _this, jint program, jint location, jintArray params_ref, jint offset) {
3102    jint _exception = 0;
3103    GLint *params_base = (GLint *) 0;
3104    jint _remaining;
3105    GLint *params = (GLint *) 0;
3106
3107    if (!params_ref) {
3108        _exception = 1;
3109        _env->ThrowNew(IAEClass, "params == null");
3110        goto exit;
3111    }
3112    if (offset < 0) {
3113        _exception = 1;
3114        _env->ThrowNew(IAEClass, "offset < 0");
3115        goto exit;
3116    }
3117    _remaining = _env->GetArrayLength(params_ref) - offset;
3118    params_base = (GLint *)
3119        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3120    params = params_base + offset;
3121
3122    glGetUniformiv(
3123        (GLuint)program,
3124        (GLint)location,
3125        (GLint *)params
3126    );
3127
3128exit:
3129    if (params_base) {
3130        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3131            _exception ? JNI_ABORT: 0);
3132    }
3133}
3134
3135/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3136static void
3137android_glGetUniformiv__IILjava_nio_IntBuffer_2
3138  (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
3139    jint _exception = 0;
3140    jarray _array = (jarray) 0;
3141    jint _remaining;
3142    GLint *params = (GLint *) 0;
3143
3144    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
3145    glGetUniformiv(
3146        (GLuint)program,
3147        (GLint)location,
3148        (GLint *)params
3149    );
3150    if (_array) {
3151        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3152    }
3153}
3154
3155/* int glGetUniformLocation ( GLuint program, const char *name ) */
3156static jint
3157android_glGetUniformLocation__ILjava_lang_String_2
3158  (JNIEnv *_env, jobject _this, jint program, jstring name) {
3159    int _returnValue = 0;
3160    const char* _nativename = 0;
3161
3162    if (!name) {
3163        _env->ThrowNew(IAEClass, "name == null");
3164        goto exit;
3165    }
3166    _nativename = _env->GetStringUTFChars(name, 0);
3167
3168    _returnValue = glGetUniformLocation(
3169        (GLuint)program,
3170        (char *)_nativename
3171    );
3172
3173exit:
3174    if (_nativename) {
3175        _env->ReleaseStringUTFChars(name, _nativename);
3176    }
3177
3178    return _returnValue;
3179}
3180
3181/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3182static void
3183android_glGetVertexAttribfv__II_3FI
3184  (JNIEnv *_env, jobject _this, jint index, jint pname, jfloatArray params_ref, jint offset) {
3185    jint _exception = 0;
3186    GLfloat *params_base = (GLfloat *) 0;
3187    jint _remaining;
3188    GLfloat *params = (GLfloat *) 0;
3189
3190    if (!params_ref) {
3191        _exception = 1;
3192        _env->ThrowNew(IAEClass, "params == null");
3193        goto exit;
3194    }
3195    if (offset < 0) {
3196        _exception = 1;
3197        _env->ThrowNew(IAEClass, "offset < 0");
3198        goto exit;
3199    }
3200    _remaining = _env->GetArrayLength(params_ref) - offset;
3201    params_base = (GLfloat *)
3202        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3203    params = params_base + offset;
3204
3205    glGetVertexAttribfv(
3206        (GLuint)index,
3207        (GLenum)pname,
3208        (GLfloat *)params
3209    );
3210
3211exit:
3212    if (params_base) {
3213        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3214            _exception ? JNI_ABORT: 0);
3215    }
3216}
3217
3218/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3219static void
3220android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2
3221  (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
3222    jint _exception = 0;
3223    jarray _array = (jarray) 0;
3224    jint _remaining;
3225    GLfloat *params = (GLfloat *) 0;
3226
3227    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
3228    glGetVertexAttribfv(
3229        (GLuint)index,
3230        (GLenum)pname,
3231        (GLfloat *)params
3232    );
3233    if (_array) {
3234        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3235    }
3236}
3237
3238/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
3239static void
3240android_glGetVertexAttribiv__II_3II
3241  (JNIEnv *_env, jobject _this, jint index, jint pname, jintArray params_ref, jint offset) {
3242    jint _exception = 0;
3243    GLint *params_base = (GLint *) 0;
3244    jint _remaining;
3245    GLint *params = (GLint *) 0;
3246
3247    if (!params_ref) {
3248        _exception = 1;
3249        _env->ThrowNew(IAEClass, "params == null");
3250        goto exit;
3251    }
3252    if (offset < 0) {
3253        _exception = 1;
3254        _env->ThrowNew(IAEClass, "offset < 0");
3255        goto exit;
3256    }
3257    _remaining = _env->GetArrayLength(params_ref) - offset;
3258    params_base = (GLint *)
3259        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3260    params = params_base + offset;
3261
3262    glGetVertexAttribiv(
3263        (GLuint)index,
3264        (GLenum)pname,
3265        (GLint *)params
3266    );
3267
3268exit:
3269    if (params_base) {
3270        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3271            _exception ? JNI_ABORT: 0);
3272    }
3273}
3274
3275/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
3276static void
3277android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2
3278  (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
3279    jint _exception = 0;
3280    jarray _array = (jarray) 0;
3281    jint _remaining;
3282    GLint *params = (GLint *) 0;
3283
3284    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
3285    glGetVertexAttribiv(
3286        (GLuint)index,
3287        (GLenum)pname,
3288        (GLint *)params
3289    );
3290    if (_array) {
3291        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3292    }
3293}
3294
3295/* void glHint ( GLenum target, GLenum mode ) */
3296static void
3297android_glHint__II
3298  (JNIEnv *_env, jobject _this, jint target, jint mode) {
3299    glHint(
3300        (GLenum)target,
3301        (GLenum)mode
3302    );
3303}
3304
3305/* GLboolean glIsBuffer ( GLuint buffer ) */
3306static jboolean
3307android_glIsBuffer__I
3308  (JNIEnv *_env, jobject _this, jint buffer) {
3309    GLboolean _returnValue;
3310    _returnValue = glIsBuffer(
3311        (GLuint)buffer
3312    );
3313    return _returnValue;
3314}
3315
3316/* GLboolean glIsEnabled ( GLenum cap ) */
3317static jboolean
3318android_glIsEnabled__I
3319  (JNIEnv *_env, jobject _this, jint cap) {
3320    GLboolean _returnValue;
3321    _returnValue = glIsEnabled(
3322        (GLenum)cap
3323    );
3324    return _returnValue;
3325}
3326
3327/* GLboolean glIsFramebuffer ( GLuint framebuffer ) */
3328static jboolean
3329android_glIsFramebuffer__I
3330  (JNIEnv *_env, jobject _this, jint framebuffer) {
3331    GLboolean _returnValue;
3332    _returnValue = glIsFramebuffer(
3333        (GLuint)framebuffer
3334    );
3335    return _returnValue;
3336}
3337
3338/* GLboolean glIsProgram ( GLuint program ) */
3339static jboolean
3340android_glIsProgram__I
3341  (JNIEnv *_env, jobject _this, jint program) {
3342    GLboolean _returnValue;
3343    _returnValue = glIsProgram(
3344        (GLuint)program
3345    );
3346    return _returnValue;
3347}
3348
3349/* GLboolean glIsRenderbuffer ( GLuint renderbuffer ) */
3350static jboolean
3351android_glIsRenderbuffer__I
3352  (JNIEnv *_env, jobject _this, jint renderbuffer) {
3353    GLboolean _returnValue;
3354    _returnValue = glIsRenderbuffer(
3355        (GLuint)renderbuffer
3356    );
3357    return _returnValue;
3358}
3359
3360/* GLboolean glIsShader ( GLuint shader ) */
3361static jboolean
3362android_glIsShader__I
3363  (JNIEnv *_env, jobject _this, jint shader) {
3364    GLboolean _returnValue;
3365    _returnValue = glIsShader(
3366        (GLuint)shader
3367    );
3368    return _returnValue;
3369}
3370
3371/* GLboolean glIsTexture ( GLuint texture ) */
3372static jboolean
3373android_glIsTexture__I
3374  (JNIEnv *_env, jobject _this, jint texture) {
3375    GLboolean _returnValue;
3376    _returnValue = glIsTexture(
3377        (GLuint)texture
3378    );
3379    return _returnValue;
3380}
3381
3382/* void glLineWidth ( GLfloat width ) */
3383static void
3384android_glLineWidth__F
3385  (JNIEnv *_env, jobject _this, jfloat width) {
3386    glLineWidth(
3387        (GLfloat)width
3388    );
3389}
3390
3391/* void glLinkProgram ( GLuint program ) */
3392static void
3393android_glLinkProgram__I
3394  (JNIEnv *_env, jobject _this, jint program) {
3395    glLinkProgram(
3396        (GLuint)program
3397    );
3398}
3399
3400/* void glPixelStorei ( GLenum pname, GLint param ) */
3401static void
3402android_glPixelStorei__II
3403  (JNIEnv *_env, jobject _this, jint pname, jint param) {
3404    glPixelStorei(
3405        (GLenum)pname,
3406        (GLint)param
3407    );
3408}
3409
3410/* void glPolygonOffset ( GLfloat factor, GLfloat units ) */
3411static void
3412android_glPolygonOffset__FF
3413  (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) {
3414    glPolygonOffset(
3415        (GLfloat)factor,
3416        (GLfloat)units
3417    );
3418}
3419
3420/* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */
3421static void
3422android_glReadPixels__IIIIIILjava_nio_Buffer_2
3423  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) {
3424    jint _exception = 0;
3425    jarray _array = (jarray) 0;
3426    jint _remaining;
3427    GLvoid *pixels = (GLvoid *) 0;
3428
3429    pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining);
3430    glReadPixels(
3431        (GLint)x,
3432        (GLint)y,
3433        (GLsizei)width,
3434        (GLsizei)height,
3435        (GLenum)format,
3436        (GLenum)type,
3437        (GLvoid *)pixels
3438    );
3439    if (_array) {
3440        releasePointer(_env, _array, pixels, _exception ? JNI_FALSE : JNI_TRUE);
3441    }
3442}
3443
3444/* void glReleaseShaderCompiler ( void ) */
3445static void
3446android_glReleaseShaderCompiler__
3447  (JNIEnv *_env, jobject _this) {
3448    glReleaseShaderCompiler();
3449}
3450
3451/* void glRenderbufferStorage ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) */
3452static void
3453android_glRenderbufferStorage__IIII
3454  (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint width, jint height) {
3455    glRenderbufferStorage(
3456        (GLenum)target,
3457        (GLenum)internalformat,
3458        (GLsizei)width,
3459        (GLsizei)height
3460    );
3461}
3462
3463/* void glSampleCoverage ( GLclampf value, GLboolean invert ) */
3464static void
3465android_glSampleCoverage__FZ
3466  (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) {
3467    glSampleCoverage(
3468        (GLclampf)value,
3469        (GLboolean)invert
3470    );
3471}
3472
3473/* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */
3474static void
3475android_glScissor__IIII
3476  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
3477    glScissor(
3478        (GLint)x,
3479        (GLint)y,
3480        (GLsizei)width,
3481        (GLsizei)height
3482    );
3483}
3484
3485/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
3486static void
3487android_glShaderBinary__I_3IIILjava_nio_Buffer_2I
3488  (JNIEnv *_env, jobject _this, jint n, jintArray shaders_ref, jint offset, jint binaryformat, jobject binary_buf, jint length) {
3489    jarray _array = (jarray) 0;
3490    GLuint *shaders_base = (GLuint *) 0;
3491    jint _shadersRemaining;
3492    GLuint *shaders = (GLuint *) 0;
3493    jint _binaryRemaining;
3494    GLvoid *binary = (GLvoid *) 0;
3495
3496    if (!shaders_ref) {
3497        _env->ThrowNew(IAEClass, "shaders == null");
3498        goto exit;
3499    }
3500    if (offset < 0) {
3501        _env->ThrowNew(IAEClass, "offset < 0");
3502        goto exit;
3503    }
3504    _shadersRemaining = _env->GetArrayLength(shaders_ref) - offset;
3505    shaders_base = (GLuint *)
3506        _env->GetPrimitiveArrayCritical(shaders_ref, (jboolean *)0);
3507    shaders = shaders_base + offset;
3508
3509    binary = (GLvoid *)getPointer(_env, binary_buf, &_array, &_binaryRemaining);
3510    glShaderBinary(
3511        (GLsizei)n,
3512        (GLuint *)shaders,
3513        (GLenum)binaryformat,
3514        (GLvoid *)binary,
3515        (GLsizei)length
3516    );
3517
3518exit:
3519    if (_array) {
3520        releasePointer(_env, _array, binary, JNI_FALSE);
3521    }
3522    if (shaders_base) {
3523        _env->ReleasePrimitiveArrayCritical(shaders_ref, shaders_base,
3524            JNI_ABORT);
3525    }
3526}
3527
3528/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
3529static void
3530android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I
3531  (JNIEnv *_env, jobject _this, jint n, jobject shaders_buf, jint binaryformat, jobject binary_buf, jint length) {
3532    jarray _shadersArray = (jarray) 0;
3533    jarray _binaryArray = (jarray) 0;
3534    jint _shadersRemaining;
3535    GLuint *shaders = (GLuint *) 0;
3536    jint _binaryRemaining;
3537    GLvoid *binary = (GLvoid *) 0;
3538
3539    shaders = (GLuint *)getPointer(_env, shaders_buf, &_shadersArray, &_shadersRemaining);
3540    binary = (GLvoid *)getPointer(_env, binary_buf, &_binaryArray, &_binaryRemaining);
3541    glShaderBinary(
3542        (GLsizei)n,
3543        (GLuint *)shaders,
3544        (GLenum)binaryformat,
3545        (GLvoid *)binary,
3546        (GLsizei)length
3547    );
3548    if (_shadersArray) {
3549        releasePointer(_env, _shadersArray, binary, JNI_FALSE);
3550    }
3551    if (_binaryArray) {
3552        releasePointer(_env, _binaryArray, shaders, JNI_FALSE);
3553    }
3554}
3555
3556
3557/* void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint * length ) */
3558static
3559void
3560android_glShaderSource
3561    (JNIEnv *_env, jobject _this, jint shader, jstring string) {
3562
3563    if (!string) {
3564        _env->ThrowNew(IAEClass, "string == null");
3565        return;
3566    }
3567
3568    const char* nativeString = _env->GetStringUTFChars(string, 0);
3569    const char* strings[] = {nativeString};
3570    glShaderSource(shader, 1, strings, 0);
3571    _env->ReleaseStringUTFChars(string, nativeString);
3572}
3573/* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */
3574static void
3575android_glStencilFunc__III
3576  (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) {
3577    glStencilFunc(
3578        (GLenum)func,
3579        (GLint)ref,
3580        (GLuint)mask
3581    );
3582}
3583
3584/* void glStencilFuncSeparate ( GLenum face, GLenum func, GLint ref, GLuint mask ) */
3585static void
3586android_glStencilFuncSeparate__IIII
3587  (JNIEnv *_env, jobject _this, jint face, jint func, jint ref, jint mask) {
3588    glStencilFuncSeparate(
3589        (GLenum)face,
3590        (GLenum)func,
3591        (GLint)ref,
3592        (GLuint)mask
3593    );
3594}
3595
3596/* void glStencilMask ( GLuint mask ) */
3597static void
3598android_glStencilMask__I
3599  (JNIEnv *_env, jobject _this, jint mask) {
3600    glStencilMask(
3601        (GLuint)mask
3602    );
3603}
3604
3605/* void glStencilMaskSeparate ( GLenum face, GLuint mask ) */
3606static void
3607android_glStencilMaskSeparate__II
3608  (JNIEnv *_env, jobject _this, jint face, jint mask) {
3609    glStencilMaskSeparate(
3610        (GLenum)face,
3611        (GLuint)mask
3612    );
3613}
3614
3615/* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */
3616static void
3617android_glStencilOp__III
3618  (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) {
3619    glStencilOp(
3620        (GLenum)fail,
3621        (GLenum)zfail,
3622        (GLenum)zpass
3623    );
3624}
3625
3626/* void glStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) */
3627static void
3628android_glStencilOpSeparate__IIII
3629  (JNIEnv *_env, jobject _this, jint face, jint fail, jint zfail, jint zpass) {
3630    glStencilOpSeparate(
3631        (GLenum)face,
3632        (GLenum)fail,
3633        (GLenum)zfail,
3634        (GLenum)zpass
3635    );
3636}
3637
3638/* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */
3639static void
3640android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2
3641  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) {
3642    jarray _array = (jarray) 0;
3643    jint _remaining;
3644    GLvoid *pixels = (GLvoid *) 0;
3645
3646    if (pixels_buf) {
3647        pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining);
3648    }
3649    glTexImage2D(
3650        (GLenum)target,
3651        (GLint)level,
3652        (GLint)internalformat,
3653        (GLsizei)width,
3654        (GLsizei)height,
3655        (GLint)border,
3656        (GLenum)format,
3657        (GLenum)type,
3658        (GLvoid *)pixels
3659    );
3660    if (_array) {
3661        releasePointer(_env, _array, pixels, JNI_FALSE);
3662    }
3663}
3664
3665/* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */
3666static void
3667android_glTexParameterf__IIF
3668  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
3669    glTexParameterf(
3670        (GLenum)target,
3671        (GLenum)pname,
3672        (GLfloat)param
3673    );
3674}
3675
3676/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
3677static void
3678android_glTexParameterfv__II_3FI
3679  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
3680    GLfloat *params_base = (GLfloat *) 0;
3681    jint _remaining;
3682    GLfloat *params = (GLfloat *) 0;
3683
3684    if (!params_ref) {
3685        _env->ThrowNew(IAEClass, "params == null");
3686        goto exit;
3687    }
3688    if (offset < 0) {
3689        _env->ThrowNew(IAEClass, "offset < 0");
3690        goto exit;
3691    }
3692    _remaining = _env->GetArrayLength(params_ref) - offset;
3693    if (_remaining < 1) {
3694        _env->ThrowNew(IAEClass, "length - offset < 1");
3695        goto exit;
3696    }
3697    params_base = (GLfloat *)
3698        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3699    params = params_base + offset;
3700
3701    glTexParameterfv(
3702        (GLenum)target,
3703        (GLenum)pname,
3704        (GLfloat *)params
3705    );
3706
3707exit:
3708    if (params_base) {
3709        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3710            JNI_ABORT);
3711    }
3712}
3713
3714/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
3715static void
3716android_glTexParameterfv__IILjava_nio_FloatBuffer_2
3717  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3718    jarray _array = (jarray) 0;
3719    jint _remaining;
3720    GLfloat *params = (GLfloat *) 0;
3721
3722    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
3723    if (_remaining < 1) {
3724        _env->ThrowNew(IAEClass, "remaining() < 1");
3725        goto exit;
3726    }
3727    glTexParameterfv(
3728        (GLenum)target,
3729        (GLenum)pname,
3730        (GLfloat *)params
3731    );
3732
3733exit:
3734    if (_array) {
3735        releasePointer(_env, _array, params, JNI_FALSE);
3736    }
3737}
3738
3739/* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */
3740static void
3741android_glTexParameteri__III
3742  (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
3743    glTexParameteri(
3744        (GLenum)target,
3745        (GLenum)pname,
3746        (GLint)param
3747    );
3748}
3749
3750/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
3751static void
3752android_glTexParameteriv__II_3II
3753  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
3754    GLint *params_base = (GLint *) 0;
3755    jint _remaining;
3756    GLint *params = (GLint *) 0;
3757
3758    if (!params_ref) {
3759        _env->ThrowNew(IAEClass, "params == null");
3760        goto exit;
3761    }
3762    if (offset < 0) {
3763        _env->ThrowNew(IAEClass, "offset < 0");
3764        goto exit;
3765    }
3766    _remaining = _env->GetArrayLength(params_ref) - offset;
3767    if (_remaining < 1) {
3768        _env->ThrowNew(IAEClass, "length - offset < 1");
3769        goto exit;
3770    }
3771    params_base = (GLint *)
3772        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3773    params = params_base + offset;
3774
3775    glTexParameteriv(
3776        (GLenum)target,
3777        (GLenum)pname,
3778        (GLint *)params
3779    );
3780
3781exit:
3782    if (params_base) {
3783        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3784            JNI_ABORT);
3785    }
3786}
3787
3788/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
3789static void
3790android_glTexParameteriv__IILjava_nio_IntBuffer_2
3791  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3792    jarray _array = (jarray) 0;
3793    jint _remaining;
3794    GLint *params = (GLint *) 0;
3795
3796    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
3797    if (_remaining < 1) {
3798        _env->ThrowNew(IAEClass, "remaining() < 1");
3799        goto exit;
3800    }
3801    glTexParameteriv(
3802        (GLenum)target,
3803        (GLenum)pname,
3804        (GLint *)params
3805    );
3806
3807exit:
3808    if (_array) {
3809        releasePointer(_env, _array, params, JNI_FALSE);
3810    }
3811}
3812
3813/* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */
3814static void
3815android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
3816  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) {
3817    jarray _array = (jarray) 0;
3818    jint _remaining;
3819    GLvoid *pixels = (GLvoid *) 0;
3820
3821    if (pixels_buf) {
3822        pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining);
3823    }
3824    glTexSubImage2D(
3825        (GLenum)target,
3826        (GLint)level,
3827        (GLint)xoffset,
3828        (GLint)yoffset,
3829        (GLsizei)width,
3830        (GLsizei)height,
3831        (GLenum)format,
3832        (GLenum)type,
3833        (GLvoid *)pixels
3834    );
3835    if (_array) {
3836        releasePointer(_env, _array, pixels, JNI_FALSE);
3837    }
3838}
3839
3840/* void glUniform1f ( GLint location, GLfloat x ) */
3841static void
3842android_glUniform1f__IF
3843  (JNIEnv *_env, jobject _this, jint location, jfloat x) {
3844    glUniform1f(
3845        (GLint)location,
3846        (GLfloat)x
3847    );
3848}
3849
3850/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
3851static void
3852android_glUniform1fv__II_3FI
3853  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
3854    GLfloat *v_base = (GLfloat *) 0;
3855    jint _remaining;
3856    GLfloat *v = (GLfloat *) 0;
3857
3858    if (!v_ref) {
3859        _env->ThrowNew(IAEClass, "v == null");
3860        goto exit;
3861    }
3862    if (offset < 0) {
3863        _env->ThrowNew(IAEClass, "offset < 0");
3864        goto exit;
3865    }
3866    _remaining = _env->GetArrayLength(v_ref) - offset;
3867    v_base = (GLfloat *)
3868        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
3869    v = v_base + offset;
3870
3871    glUniform1fv(
3872        (GLint)location,
3873        (GLsizei)count,
3874        (GLfloat *)v
3875    );
3876
3877exit:
3878    if (v_base) {
3879        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
3880            JNI_ABORT);
3881    }
3882}
3883
3884/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
3885static void
3886android_glUniform1fv__IILjava_nio_FloatBuffer_2
3887  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
3888    jarray _array = (jarray) 0;
3889    jint _remaining;
3890    GLfloat *v = (GLfloat *) 0;
3891
3892    v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining);
3893    glUniform1fv(
3894        (GLint)location,
3895        (GLsizei)count,
3896        (GLfloat *)v
3897    );
3898    if (_array) {
3899        releasePointer(_env, _array, v, JNI_FALSE);
3900    }
3901}
3902
3903/* void glUniform1i ( GLint location, GLint x ) */
3904static void
3905android_glUniform1i__II
3906  (JNIEnv *_env, jobject _this, jint location, jint x) {
3907    glUniform1i(
3908        (GLint)location,
3909        (GLint)x
3910    );
3911}
3912
3913/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
3914static void
3915android_glUniform1iv__II_3II
3916  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
3917    GLint *v_base = (GLint *) 0;
3918    jint _remaining;
3919    GLint *v = (GLint *) 0;
3920
3921    if (!v_ref) {
3922        _env->ThrowNew(IAEClass, "v == null");
3923        goto exit;
3924    }
3925    if (offset < 0) {
3926        _env->ThrowNew(IAEClass, "offset < 0");
3927        goto exit;
3928    }
3929    _remaining = _env->GetArrayLength(v_ref) - offset;
3930    v_base = (GLint *)
3931        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
3932    v = v_base + offset;
3933
3934    glUniform1iv(
3935        (GLint)location,
3936        (GLsizei)count,
3937        (GLint *)v
3938    );
3939
3940exit:
3941    if (v_base) {
3942        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
3943            JNI_ABORT);
3944    }
3945}
3946
3947/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
3948static void
3949android_glUniform1iv__IILjava_nio_IntBuffer_2
3950  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
3951    jarray _array = (jarray) 0;
3952    jint _remaining;
3953    GLint *v = (GLint *) 0;
3954
3955    v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining);
3956    glUniform1iv(
3957        (GLint)location,
3958        (GLsizei)count,
3959        (GLint *)v
3960    );
3961    if (_array) {
3962        releasePointer(_env, _array, v, JNI_FALSE);
3963    }
3964}
3965
3966/* void glUniform2f ( GLint location, GLfloat x, GLfloat y ) */
3967static void
3968android_glUniform2f__IFF
3969  (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y) {
3970    glUniform2f(
3971        (GLint)location,
3972        (GLfloat)x,
3973        (GLfloat)y
3974    );
3975}
3976
3977/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
3978static void
3979android_glUniform2fv__II_3FI
3980  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
3981    GLfloat *v_base = (GLfloat *) 0;
3982    jint _remaining;
3983    GLfloat *v = (GLfloat *) 0;
3984
3985    if (!v_ref) {
3986        _env->ThrowNew(IAEClass, "v == null");
3987        goto exit;
3988    }
3989    if (offset < 0) {
3990        _env->ThrowNew(IAEClass, "offset < 0");
3991        goto exit;
3992    }
3993    _remaining = _env->GetArrayLength(v_ref) - offset;
3994    v_base = (GLfloat *)
3995        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
3996    v = v_base + offset;
3997
3998    glUniform2fv(
3999        (GLint)location,
4000        (GLsizei)count,
4001        (GLfloat *)v
4002    );
4003
4004exit:
4005    if (v_base) {
4006        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4007            JNI_ABORT);
4008    }
4009}
4010
4011/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
4012static void
4013android_glUniform2fv__IILjava_nio_FloatBuffer_2
4014  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
4015    jarray _array = (jarray) 0;
4016    jint _remaining;
4017    GLfloat *v = (GLfloat *) 0;
4018
4019    v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining);
4020    glUniform2fv(
4021        (GLint)location,
4022        (GLsizei)count,
4023        (GLfloat *)v
4024    );
4025    if (_array) {
4026        releasePointer(_env, _array, v, JNI_FALSE);
4027    }
4028}
4029
4030/* void glUniform2i ( GLint location, GLint x, GLint y ) */
4031static void
4032android_glUniform2i__III
4033  (JNIEnv *_env, jobject _this, jint location, jint x, jint y) {
4034    glUniform2i(
4035        (GLint)location,
4036        (GLint)x,
4037        (GLint)y
4038    );
4039}
4040
4041/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
4042static void
4043android_glUniform2iv__II_3II
4044  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
4045    GLint *v_base = (GLint *) 0;
4046    jint _remaining;
4047    GLint *v = (GLint *) 0;
4048
4049    if (!v_ref) {
4050        _env->ThrowNew(IAEClass, "v == null");
4051        goto exit;
4052    }
4053    if (offset < 0) {
4054        _env->ThrowNew(IAEClass, "offset < 0");
4055        goto exit;
4056    }
4057    _remaining = _env->GetArrayLength(v_ref) - offset;
4058    v_base = (GLint *)
4059        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4060    v = v_base + offset;
4061
4062    glUniform2iv(
4063        (GLint)location,
4064        (GLsizei)count,
4065        (GLint *)v
4066    );
4067
4068exit:
4069    if (v_base) {
4070        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4071            JNI_ABORT);
4072    }
4073}
4074
4075/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
4076static void
4077android_glUniform2iv__IILjava_nio_IntBuffer_2
4078  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
4079    jarray _array = (jarray) 0;
4080    jint _remaining;
4081    GLint *v = (GLint *) 0;
4082
4083    v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining);
4084    glUniform2iv(
4085        (GLint)location,
4086        (GLsizei)count,
4087        (GLint *)v
4088    );
4089    if (_array) {
4090        releasePointer(_env, _array, v, JNI_FALSE);
4091    }
4092}
4093
4094/* void glUniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z ) */
4095static void
4096android_glUniform3f__IFFF
4097  (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z) {
4098    glUniform3f(
4099        (GLint)location,
4100        (GLfloat)x,
4101        (GLfloat)y,
4102        (GLfloat)z
4103    );
4104}
4105
4106/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
4107static void
4108android_glUniform3fv__II_3FI
4109  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
4110    GLfloat *v_base = (GLfloat *) 0;
4111    jint _remaining;
4112    GLfloat *v = (GLfloat *) 0;
4113
4114    if (!v_ref) {
4115        _env->ThrowNew(IAEClass, "v == null");
4116        goto exit;
4117    }
4118    if (offset < 0) {
4119        _env->ThrowNew(IAEClass, "offset < 0");
4120        goto exit;
4121    }
4122    _remaining = _env->GetArrayLength(v_ref) - offset;
4123    v_base = (GLfloat *)
4124        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4125    v = v_base + offset;
4126
4127    glUniform3fv(
4128        (GLint)location,
4129        (GLsizei)count,
4130        (GLfloat *)v
4131    );
4132
4133exit:
4134    if (v_base) {
4135        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4136            JNI_ABORT);
4137    }
4138}
4139
4140/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
4141static void
4142android_glUniform3fv__IILjava_nio_FloatBuffer_2
4143  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
4144    jarray _array = (jarray) 0;
4145    jint _remaining;
4146    GLfloat *v = (GLfloat *) 0;
4147
4148    v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining);
4149    glUniform3fv(
4150        (GLint)location,
4151        (GLsizei)count,
4152        (GLfloat *)v
4153    );
4154    if (_array) {
4155        releasePointer(_env, _array, v, JNI_FALSE);
4156    }
4157}
4158
4159/* void glUniform3i ( GLint location, GLint x, GLint y, GLint z ) */
4160static void
4161android_glUniform3i__IIII
4162  (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z) {
4163    glUniform3i(
4164        (GLint)location,
4165        (GLint)x,
4166        (GLint)y,
4167        (GLint)z
4168    );
4169}
4170
4171/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
4172static void
4173android_glUniform3iv__II_3II
4174  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
4175    GLint *v_base = (GLint *) 0;
4176    jint _remaining;
4177    GLint *v = (GLint *) 0;
4178
4179    if (!v_ref) {
4180        _env->ThrowNew(IAEClass, "v == null");
4181        goto exit;
4182    }
4183    if (offset < 0) {
4184        _env->ThrowNew(IAEClass, "offset < 0");
4185        goto exit;
4186    }
4187    _remaining = _env->GetArrayLength(v_ref) - offset;
4188    v_base = (GLint *)
4189        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4190    v = v_base + offset;
4191
4192    glUniform3iv(
4193        (GLint)location,
4194        (GLsizei)count,
4195        (GLint *)v
4196    );
4197
4198exit:
4199    if (v_base) {
4200        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4201            JNI_ABORT);
4202    }
4203}
4204
4205/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
4206static void
4207android_glUniform3iv__IILjava_nio_IntBuffer_2
4208  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
4209    jarray _array = (jarray) 0;
4210    jint _remaining;
4211    GLint *v = (GLint *) 0;
4212
4213    v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining);
4214    glUniform3iv(
4215        (GLint)location,
4216        (GLsizei)count,
4217        (GLint *)v
4218    );
4219    if (_array) {
4220        releasePointer(_env, _array, v, JNI_FALSE);
4221    }
4222}
4223
4224/* void glUniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
4225static void
4226android_glUniform4f__IFFFF
4227  (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z, jfloat w) {
4228    glUniform4f(
4229        (GLint)location,
4230        (GLfloat)x,
4231        (GLfloat)y,
4232        (GLfloat)z,
4233        (GLfloat)w
4234    );
4235}
4236
4237/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
4238static void
4239android_glUniform4fv__II_3FI
4240  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
4241    GLfloat *v_base = (GLfloat *) 0;
4242    jint _remaining;
4243    GLfloat *v = (GLfloat *) 0;
4244
4245    if (!v_ref) {
4246        _env->ThrowNew(IAEClass, "v == null");
4247        goto exit;
4248    }
4249    if (offset < 0) {
4250        _env->ThrowNew(IAEClass, "offset < 0");
4251        goto exit;
4252    }
4253    _remaining = _env->GetArrayLength(v_ref) - offset;
4254    v_base = (GLfloat *)
4255        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4256    v = v_base + offset;
4257
4258    glUniform4fv(
4259        (GLint)location,
4260        (GLsizei)count,
4261        (GLfloat *)v
4262    );
4263
4264exit:
4265    if (v_base) {
4266        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4267            JNI_ABORT);
4268    }
4269}
4270
4271/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
4272static void
4273android_glUniform4fv__IILjava_nio_FloatBuffer_2
4274  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
4275    jarray _array = (jarray) 0;
4276    jint _remaining;
4277    GLfloat *v = (GLfloat *) 0;
4278
4279    v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining);
4280    glUniform4fv(
4281        (GLint)location,
4282        (GLsizei)count,
4283        (GLfloat *)v
4284    );
4285    if (_array) {
4286        releasePointer(_env, _array, v, JNI_FALSE);
4287    }
4288}
4289
4290/* void glUniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w ) */
4291static void
4292android_glUniform4i__IIIII
4293  (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z, jint w) {
4294    glUniform4i(
4295        (GLint)location,
4296        (GLint)x,
4297        (GLint)y,
4298        (GLint)z,
4299        (GLint)w
4300    );
4301}
4302
4303/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
4304static void
4305android_glUniform4iv__II_3II
4306  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
4307    GLint *v_base = (GLint *) 0;
4308    jint _remaining;
4309    GLint *v = (GLint *) 0;
4310
4311    if (!v_ref) {
4312        _env->ThrowNew(IAEClass, "v == null");
4313        goto exit;
4314    }
4315    if (offset < 0) {
4316        _env->ThrowNew(IAEClass, "offset < 0");
4317        goto exit;
4318    }
4319    _remaining = _env->GetArrayLength(v_ref) - offset;
4320    v_base = (GLint *)
4321        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4322    v = v_base + offset;
4323
4324    glUniform4iv(
4325        (GLint)location,
4326        (GLsizei)count,
4327        (GLint *)v
4328    );
4329
4330exit:
4331    if (v_base) {
4332        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4333            JNI_ABORT);
4334    }
4335}
4336
4337/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
4338static void
4339android_glUniform4iv__IILjava_nio_IntBuffer_2
4340  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
4341    jarray _array = (jarray) 0;
4342    jint _remaining;
4343    GLint *v = (GLint *) 0;
4344
4345    v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining);
4346    glUniform4iv(
4347        (GLint)location,
4348        (GLsizei)count,
4349        (GLint *)v
4350    );
4351    if (_array) {
4352        releasePointer(_env, _array, v, JNI_FALSE);
4353    }
4354}
4355
4356/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
4357static void
4358android_glUniformMatrix2fv__IIZ_3FI
4359  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
4360    GLfloat *value_base = (GLfloat *) 0;
4361    jint _remaining;
4362    GLfloat *value = (GLfloat *) 0;
4363
4364    if (!value_ref) {
4365        _env->ThrowNew(IAEClass, "value == null");
4366        goto exit;
4367    }
4368    if (offset < 0) {
4369        _env->ThrowNew(IAEClass, "offset < 0");
4370        goto exit;
4371    }
4372    _remaining = _env->GetArrayLength(value_ref) - offset;
4373    value_base = (GLfloat *)
4374        _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
4375    value = value_base + offset;
4376
4377    glUniformMatrix2fv(
4378        (GLint)location,
4379        (GLsizei)count,
4380        (GLboolean)transpose,
4381        (GLfloat *)value
4382    );
4383
4384exit:
4385    if (value_base) {
4386        _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
4387            JNI_ABORT);
4388    }
4389}
4390
4391/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
4392static void
4393android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2
4394  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
4395    jarray _array = (jarray) 0;
4396    jint _remaining;
4397    GLfloat *value = (GLfloat *) 0;
4398
4399    value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining);
4400    glUniformMatrix2fv(
4401        (GLint)location,
4402        (GLsizei)count,
4403        (GLboolean)transpose,
4404        (GLfloat *)value
4405    );
4406    if (_array) {
4407        releasePointer(_env, _array, value, JNI_FALSE);
4408    }
4409}
4410
4411/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
4412static void
4413android_glUniformMatrix3fv__IIZ_3FI
4414  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
4415    GLfloat *value_base = (GLfloat *) 0;
4416    jint _remaining;
4417    GLfloat *value = (GLfloat *) 0;
4418
4419    if (!value_ref) {
4420        _env->ThrowNew(IAEClass, "value == null");
4421        goto exit;
4422    }
4423    if (offset < 0) {
4424        _env->ThrowNew(IAEClass, "offset < 0");
4425        goto exit;
4426    }
4427    _remaining = _env->GetArrayLength(value_ref) - offset;
4428    value_base = (GLfloat *)
4429        _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
4430    value = value_base + offset;
4431
4432    glUniformMatrix3fv(
4433        (GLint)location,
4434        (GLsizei)count,
4435        (GLboolean)transpose,
4436        (GLfloat *)value
4437    );
4438
4439exit:
4440    if (value_base) {
4441        _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
4442            JNI_ABORT);
4443    }
4444}
4445
4446/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
4447static void
4448android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2
4449  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
4450    jarray _array = (jarray) 0;
4451    jint _remaining;
4452    GLfloat *value = (GLfloat *) 0;
4453
4454    value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining);
4455    glUniformMatrix3fv(
4456        (GLint)location,
4457        (GLsizei)count,
4458        (GLboolean)transpose,
4459        (GLfloat *)value
4460    );
4461    if (_array) {
4462        releasePointer(_env, _array, value, JNI_FALSE);
4463    }
4464}
4465
4466/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
4467static void
4468android_glUniformMatrix4fv__IIZ_3FI
4469  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
4470    GLfloat *value_base = (GLfloat *) 0;
4471    jint _remaining;
4472    GLfloat *value = (GLfloat *) 0;
4473
4474    if (!value_ref) {
4475        _env->ThrowNew(IAEClass, "value == null");
4476        goto exit;
4477    }
4478    if (offset < 0) {
4479        _env->ThrowNew(IAEClass, "offset < 0");
4480        goto exit;
4481    }
4482    _remaining = _env->GetArrayLength(value_ref) - offset;
4483    value_base = (GLfloat *)
4484        _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
4485    value = value_base + offset;
4486
4487    glUniformMatrix4fv(
4488        (GLint)location,
4489        (GLsizei)count,
4490        (GLboolean)transpose,
4491        (GLfloat *)value
4492    );
4493
4494exit:
4495    if (value_base) {
4496        _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
4497            JNI_ABORT);
4498    }
4499}
4500
4501/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
4502static void
4503android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2
4504  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
4505    jarray _array = (jarray) 0;
4506    jint _remaining;
4507    GLfloat *value = (GLfloat *) 0;
4508
4509    value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining);
4510    glUniformMatrix4fv(
4511        (GLint)location,
4512        (GLsizei)count,
4513        (GLboolean)transpose,
4514        (GLfloat *)value
4515    );
4516    if (_array) {
4517        releasePointer(_env, _array, value, JNI_FALSE);
4518    }
4519}
4520
4521/* void glUseProgram ( GLuint program ) */
4522static void
4523android_glUseProgram__I
4524  (JNIEnv *_env, jobject _this, jint program) {
4525    glUseProgram(
4526        (GLuint)program
4527    );
4528}
4529
4530/* void glValidateProgram ( GLuint program ) */
4531static void
4532android_glValidateProgram__I
4533  (JNIEnv *_env, jobject _this, jint program) {
4534    glValidateProgram(
4535        (GLuint)program
4536    );
4537}
4538
4539/* void glVertexAttrib1f ( GLuint indx, GLfloat x ) */
4540static void
4541android_glVertexAttrib1f__IF
4542  (JNIEnv *_env, jobject _this, jint indx, jfloat x) {
4543    glVertexAttrib1f(
4544        (GLuint)indx,
4545        (GLfloat)x
4546    );
4547}
4548
4549/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
4550static void
4551android_glVertexAttrib1fv__I_3FI
4552  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
4553    GLfloat *values_base = (GLfloat *) 0;
4554    jint _remaining;
4555    GLfloat *values = (GLfloat *) 0;
4556
4557    if (!values_ref) {
4558        _env->ThrowNew(IAEClass, "values == null");
4559        goto exit;
4560    }
4561    if (offset < 0) {
4562        _env->ThrowNew(IAEClass, "offset < 0");
4563        goto exit;
4564    }
4565    _remaining = _env->GetArrayLength(values_ref) - offset;
4566    values_base = (GLfloat *)
4567        _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
4568    values = values_base + offset;
4569
4570    glVertexAttrib1fv(
4571        (GLuint)indx,
4572        (GLfloat *)values
4573    );
4574
4575exit:
4576    if (values_base) {
4577        _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
4578            JNI_ABORT);
4579    }
4580}
4581
4582/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
4583static void
4584android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2
4585  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
4586    jarray _array = (jarray) 0;
4587    jint _remaining;
4588    GLfloat *values = (GLfloat *) 0;
4589
4590    values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining);
4591    glVertexAttrib1fv(
4592        (GLuint)indx,
4593        (GLfloat *)values
4594    );
4595    if (_array) {
4596        releasePointer(_env, _array, values, JNI_FALSE);
4597    }
4598}
4599
4600/* void glVertexAttrib2f ( GLuint indx, GLfloat x, GLfloat y ) */
4601static void
4602android_glVertexAttrib2f__IFF
4603  (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y) {
4604    glVertexAttrib2f(
4605        (GLuint)indx,
4606        (GLfloat)x,
4607        (GLfloat)y
4608    );
4609}
4610
4611/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
4612static void
4613android_glVertexAttrib2fv__I_3FI
4614  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
4615    GLfloat *values_base = (GLfloat *) 0;
4616    jint _remaining;
4617    GLfloat *values = (GLfloat *) 0;
4618
4619    if (!values_ref) {
4620        _env->ThrowNew(IAEClass, "values == null");
4621        goto exit;
4622    }
4623    if (offset < 0) {
4624        _env->ThrowNew(IAEClass, "offset < 0");
4625        goto exit;
4626    }
4627    _remaining = _env->GetArrayLength(values_ref) - offset;
4628    values_base = (GLfloat *)
4629        _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
4630    values = values_base + offset;
4631
4632    glVertexAttrib2fv(
4633        (GLuint)indx,
4634        (GLfloat *)values
4635    );
4636
4637exit:
4638    if (values_base) {
4639        _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
4640            JNI_ABORT);
4641    }
4642}
4643
4644/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
4645static void
4646android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2
4647  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
4648    jarray _array = (jarray) 0;
4649    jint _remaining;
4650    GLfloat *values = (GLfloat *) 0;
4651
4652    values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining);
4653    glVertexAttrib2fv(
4654        (GLuint)indx,
4655        (GLfloat *)values
4656    );
4657    if (_array) {
4658        releasePointer(_env, _array, values, JNI_FALSE);
4659    }
4660}
4661
4662/* void glVertexAttrib3f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z ) */
4663static void
4664android_glVertexAttrib3f__IFFF
4665  (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z) {
4666    glVertexAttrib3f(
4667        (GLuint)indx,
4668        (GLfloat)x,
4669        (GLfloat)y,
4670        (GLfloat)z
4671    );
4672}
4673
4674/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
4675static void
4676android_glVertexAttrib3fv__I_3FI
4677  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
4678    GLfloat *values_base = (GLfloat *) 0;
4679    jint _remaining;
4680    GLfloat *values = (GLfloat *) 0;
4681
4682    if (!values_ref) {
4683        _env->ThrowNew(IAEClass, "values == null");
4684        goto exit;
4685    }
4686    if (offset < 0) {
4687        _env->ThrowNew(IAEClass, "offset < 0");
4688        goto exit;
4689    }
4690    _remaining = _env->GetArrayLength(values_ref) - offset;
4691    values_base = (GLfloat *)
4692        _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
4693    values = values_base + offset;
4694
4695    glVertexAttrib3fv(
4696        (GLuint)indx,
4697        (GLfloat *)values
4698    );
4699
4700exit:
4701    if (values_base) {
4702        _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
4703            JNI_ABORT);
4704    }
4705}
4706
4707/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
4708static void
4709android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2
4710  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
4711    jarray _array = (jarray) 0;
4712    jint _remaining;
4713    GLfloat *values = (GLfloat *) 0;
4714
4715    values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining);
4716    glVertexAttrib3fv(
4717        (GLuint)indx,
4718        (GLfloat *)values
4719    );
4720    if (_array) {
4721        releasePointer(_env, _array, values, JNI_FALSE);
4722    }
4723}
4724
4725/* void glVertexAttrib4f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
4726static void
4727android_glVertexAttrib4f__IFFFF
4728  (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z, jfloat w) {
4729    glVertexAttrib4f(
4730        (GLuint)indx,
4731        (GLfloat)x,
4732        (GLfloat)y,
4733        (GLfloat)z,
4734        (GLfloat)w
4735    );
4736}
4737
4738/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
4739static void
4740android_glVertexAttrib4fv__I_3FI
4741  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
4742    GLfloat *values_base = (GLfloat *) 0;
4743    jint _remaining;
4744    GLfloat *values = (GLfloat *) 0;
4745
4746    if (!values_ref) {
4747        _env->ThrowNew(IAEClass, "values == null");
4748        goto exit;
4749    }
4750    if (offset < 0) {
4751        _env->ThrowNew(IAEClass, "offset < 0");
4752        goto exit;
4753    }
4754    _remaining = _env->GetArrayLength(values_ref) - offset;
4755    values_base = (GLfloat *)
4756        _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
4757    values = values_base + offset;
4758
4759    glVertexAttrib4fv(
4760        (GLuint)indx,
4761        (GLfloat *)values
4762    );
4763
4764exit:
4765    if (values_base) {
4766        _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
4767            JNI_ABORT);
4768    }
4769}
4770
4771/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
4772static void
4773android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2
4774  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
4775    jarray _array = (jarray) 0;
4776    jint _remaining;
4777    GLfloat *values = (GLfloat *) 0;
4778
4779    values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining);
4780    glVertexAttrib4fv(
4781        (GLuint)indx,
4782        (GLfloat *)values
4783    );
4784    if (_array) {
4785        releasePointer(_env, _array, values, JNI_FALSE);
4786    }
4787}
4788
4789/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr ) */
4790static void
4791android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I
4792  (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jobject ptr_buf, jint remaining) {
4793    jarray _array = (jarray) 0;
4794    jint _remaining;
4795    GLvoid *ptr = (GLvoid *) 0;
4796
4797    if (ptr_buf) {
4798        ptr = (GLvoid *) getDirectBufferPointer(_env, ptr_buf);
4799        if ( ! ptr ) {
4800            return;
4801        }
4802    }
4803    glVertexAttribPointerBounds(
4804        (GLuint)indx,
4805        (GLint)size,
4806        (GLenum)type,
4807        (GLboolean)normalized,
4808        (GLsizei)stride,
4809        (GLvoid *)ptr,
4810        (GLsizei)remaining
4811    );
4812}
4813
4814/* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */
4815static void
4816android_glViewport__IIII
4817  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
4818    glViewport(
4819        (GLint)x,
4820        (GLint)y,
4821        (GLsizei)width,
4822        (GLsizei)height
4823    );
4824}
4825
4826static const char *classPathName = "android/opengl/GLES20";
4827
4828static JNINativeMethod methods[] = {
4829{"_nativeClassInit", "()V", (void*)nativeClassInit },
4830{"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I },
4831{"glAttachShader", "(II)V", (void *) android_glAttachShader__II },
4832{"glBindAttribLocation", "(IILjava/lang/String;)V", (void *) android_glBindAttribLocation__IILjava_lang_String_2 },
4833{"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II },
4834{"glBindFramebuffer", "(II)V", (void *) android_glBindFramebuffer__II },
4835{"glBindRenderbuffer", "(II)V", (void *) android_glBindRenderbuffer__II },
4836{"glBindTexture", "(II)V", (void *) android_glBindTexture__II },
4837{"glBlendColor", "(FFFF)V", (void *) android_glBlendColor__FFFF },
4838{"glBlendEquation", "(I)V", (void *) android_glBlendEquation__I },
4839{"glBlendEquationSeparate", "(II)V", (void *) android_glBlendEquationSeparate__II },
4840{"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II },
4841{"glBlendFuncSeparate", "(IIII)V", (void *) android_glBlendFuncSeparate__IIII },
4842{"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I },
4843{"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 },
4844{"glCheckFramebufferStatus", "(I)I", (void *) android_glCheckFramebufferStatus__I },
4845{"glClear", "(I)V", (void *) android_glClear__I },
4846{"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF },
4847{"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F },
4848{"glClearStencil", "(I)V", (void *) android_glClearStencil__I },
4849{"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ },
4850{"glCompileShader", "(I)V", (void *) android_glCompileShader__I },
4851{"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 },
4852{"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
4853{"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII },
4854{"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII },
4855{"glCreateProgram", "()I", (void *) android_glCreateProgram__ },
4856{"glCreateShader", "(I)I", (void *) android_glCreateShader__I },
4857{"glCullFace", "(I)V", (void *) android_glCullFace__I },
4858{"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II },
4859{"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 },
4860{"glDeleteFramebuffers", "(I[II)V", (void *) android_glDeleteFramebuffers__I_3II },
4861{"glDeleteFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2 },
4862{"glDeleteProgram", "(I)V", (void *) android_glDeleteProgram__I },
4863{"glDeleteRenderbuffers", "(I[II)V", (void *) android_glDeleteRenderbuffers__I_3II },
4864{"glDeleteRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2 },
4865{"glDeleteShader", "(I)V", (void *) android_glDeleteShader__I },
4866{"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II },
4867{"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 },
4868{"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I },
4869{"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z },
4870{"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF },
4871{"glDetachShader", "(II)V", (void *) android_glDetachShader__II },
4872{"glDisable", "(I)V", (void *) android_glDisable__I },
4873{"glDisableVertexAttribArray", "(I)V", (void *) android_glDisableVertexAttribArray__I },
4874{"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III },
4875{"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 },
4876{"glEnable", "(I)V", (void *) android_glEnable__I },
4877{"glEnableVertexAttribArray", "(I)V", (void *) android_glEnableVertexAttribArray__I },
4878{"glFinish", "()V", (void *) android_glFinish__ },
4879{"glFlush", "()V", (void *) android_glFlush__ },
4880{"glFramebufferRenderbuffer", "(IIII)V", (void *) android_glFramebufferRenderbuffer__IIII },
4881{"glFramebufferTexture2D", "(IIIII)V", (void *) android_glFramebufferTexture2D__IIIII },
4882{"glFrontFace", "(I)V", (void *) android_glFrontFace__I },
4883{"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II },
4884{"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 },
4885{"glGenerateMipmap", "(I)V", (void *) android_glGenerateMipmap__I },
4886{"glGenFramebuffers", "(I[II)V", (void *) android_glGenFramebuffers__I_3II },
4887{"glGenFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenFramebuffers__ILjava_nio_IntBuffer_2 },
4888{"glGenRenderbuffers", "(I[II)V", (void *) android_glGenRenderbuffers__I_3II },
4889{"glGenRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenRenderbuffers__ILjava_nio_IntBuffer_2 },
4890{"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II },
4891{"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 },
4892{"glGetActiveAttrib", "(III[II[II[II[BI)V", (void *) android_glGetActiveAttrib__III_3II_3II_3II_3BI },
4893{"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 },
4894{"glGetActiveUniform", "(III[II[II[II[BI)V", (void *) android_glGetActiveUniform__III_3II_3II_3II_3BI },
4895{"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 },
4896{"glGetAttachedShaders", "(II[II[II)V", (void *) android_glGetAttachedShaders__II_3II_3II },
4897{"glGetAttachedShaders", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
4898{"glGetAttribLocation", "(ILjava/lang/String;)I", (void *) android_glGetAttribLocation__ILjava_lang_String_2 },
4899{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI },
4900{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 },
4901{"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II },
4902{"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 },
4903{"glGetError", "()I", (void *) android_glGetError__ },
4904{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI },
4905{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 },
4906{"glGetFramebufferAttachmentParameteriv", "(III[II)V", (void *) android_glGetFramebufferAttachmentParameteriv__III_3II },
4907{"glGetFramebufferAttachmentParameteriv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2 },
4908{"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II },
4909{"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 },
4910{"glGetProgramiv", "(II[II)V", (void *) android_glGetProgramiv__II_3II },
4911{"glGetProgramiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetProgramiv__IILjava_nio_IntBuffer_2 },
4912{"glGetProgramInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetProgramInfoLog },
4913{"glGetRenderbufferParameteriv", "(II[II)V", (void *) android_glGetRenderbufferParameteriv__II_3II },
4914{"glGetRenderbufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2 },
4915{"glGetShaderiv", "(II[II)V", (void *) android_glGetShaderiv__II_3II },
4916{"glGetShaderiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetShaderiv__IILjava_nio_IntBuffer_2 },
4917{"glGetShaderInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetShaderInfoLog },
4918{"glGetShaderPrecisionFormat", "(II[II[II)V", (void *) android_glGetShaderPrecisionFormat__II_3II_3II },
4919{"glGetShaderPrecisionFormat", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
4920{"glGetShaderSource", "(II[II[BI)V", (void *) android_glGetShaderSource__II_3II_3BI },
4921{"glGetShaderSource", "(IILjava/nio/IntBuffer;B)V", (void *) android_glGetShaderSource__IILjava_nio_IntBuffer_2B },
4922{"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString },
4923{"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI },
4924{"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 },
4925{"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II },
4926{"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 },
4927{"glGetUniformfv", "(II[FI)V", (void *) android_glGetUniformfv__II_3FI },
4928{"glGetUniformfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetUniformfv__IILjava_nio_FloatBuffer_2 },
4929{"glGetUniformiv", "(II[II)V", (void *) android_glGetUniformiv__II_3II },
4930{"glGetUniformiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetUniformiv__IILjava_nio_IntBuffer_2 },
4931{"glGetUniformLocation", "(ILjava/lang/String;)I", (void *) android_glGetUniformLocation__ILjava_lang_String_2 },
4932{"glGetVertexAttribfv", "(II[FI)V", (void *) android_glGetVertexAttribfv__II_3FI },
4933{"glGetVertexAttribfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2 },
4934{"glGetVertexAttribiv", "(II[II)V", (void *) android_glGetVertexAttribiv__II_3II },
4935{"glGetVertexAttribiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2 },
4936{"glHint", "(II)V", (void *) android_glHint__II },
4937{"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I },
4938{"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I },
4939{"glIsFramebuffer", "(I)Z", (void *) android_glIsFramebuffer__I },
4940{"glIsProgram", "(I)Z", (void *) android_glIsProgram__I },
4941{"glIsRenderbuffer", "(I)Z", (void *) android_glIsRenderbuffer__I },
4942{"glIsShader", "(I)Z", (void *) android_glIsShader__I },
4943{"glIsTexture", "(I)Z", (void *) android_glIsTexture__I },
4944{"glLineWidth", "(F)V", (void *) android_glLineWidth__F },
4945{"glLinkProgram", "(I)V", (void *) android_glLinkProgram__I },
4946{"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II },
4947{"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF },
4948{"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 },
4949{"glReleaseShaderCompiler", "()V", (void *) android_glReleaseShaderCompiler__ },
4950{"glRenderbufferStorage", "(IIII)V", (void *) android_glRenderbufferStorage__IIII },
4951{"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ },
4952{"glScissor", "(IIII)V", (void *) android_glScissor__IIII },
4953{"glShaderBinary", "(I[IIILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__I_3IIILjava_nio_Buffer_2I },
4954{"glShaderBinary", "(ILjava/nio/IntBuffer;ILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I },
4955{"glShaderSource", "(ILjava/lang/String;)V", (void *) android_glShaderSource },
4956{"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III },
4957{"glStencilFuncSeparate", "(IIII)V", (void *) android_glStencilFuncSeparate__IIII },
4958{"glStencilMask", "(I)V", (void *) android_glStencilMask__I },
4959{"glStencilMaskSeparate", "(II)V", (void *) android_glStencilMaskSeparate__II },
4960{"glStencilOp", "(III)V", (void *) android_glStencilOp__III },
4961{"glStencilOpSeparate", "(IIII)V", (void *) android_glStencilOpSeparate__IIII },
4962{"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 },
4963{"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF },
4964{"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI },
4965{"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 },
4966{"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III },
4967{"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II },
4968{"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 },
4969{"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
4970{"glUniform1f", "(IF)V", (void *) android_glUniform1f__IF },
4971{"glUniform1fv", "(II[FI)V", (void *) android_glUniform1fv__II_3FI },
4972{"glUniform1fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform1fv__IILjava_nio_FloatBuffer_2 },
4973{"glUniform1i", "(II)V", (void *) android_glUniform1i__II },
4974{"glUniform1iv", "(II[II)V", (void *) android_glUniform1iv__II_3II },
4975{"glUniform1iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform1iv__IILjava_nio_IntBuffer_2 },
4976{"glUniform2f", "(IFF)V", (void *) android_glUniform2f__IFF },
4977{"glUniform2fv", "(II[FI)V", (void *) android_glUniform2fv__II_3FI },
4978{"glUniform2fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform2fv__IILjava_nio_FloatBuffer_2 },
4979{"glUniform2i", "(III)V", (void *) android_glUniform2i__III },
4980{"glUniform2iv", "(II[II)V", (void *) android_glUniform2iv__II_3II },
4981{"glUniform2iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform2iv__IILjava_nio_IntBuffer_2 },
4982{"glUniform3f", "(IFFF)V", (void *) android_glUniform3f__IFFF },
4983{"glUniform3fv", "(II[FI)V", (void *) android_glUniform3fv__II_3FI },
4984{"glUniform3fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform3fv__IILjava_nio_FloatBuffer_2 },
4985{"glUniform3i", "(IIII)V", (void *) android_glUniform3i__IIII },
4986{"glUniform3iv", "(II[II)V", (void *) android_glUniform3iv__II_3II },
4987{"glUniform3iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform3iv__IILjava_nio_IntBuffer_2 },
4988{"glUniform4f", "(IFFFF)V", (void *) android_glUniform4f__IFFFF },
4989{"glUniform4fv", "(II[FI)V", (void *) android_glUniform4fv__II_3FI },
4990{"glUniform4fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform4fv__IILjava_nio_FloatBuffer_2 },
4991{"glUniform4i", "(IIIII)V", (void *) android_glUniform4i__IIIII },
4992{"glUniform4iv", "(II[II)V", (void *) android_glUniform4iv__II_3II },
4993{"glUniform4iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform4iv__IILjava_nio_IntBuffer_2 },
4994{"glUniformMatrix2fv", "(IIZ[FI)V", (void *) android_glUniformMatrix2fv__IIZ_3FI },
4995{"glUniformMatrix2fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2 },
4996{"glUniformMatrix3fv", "(IIZ[FI)V", (void *) android_glUniformMatrix3fv__IIZ_3FI },
4997{"glUniformMatrix3fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2 },
4998{"glUniformMatrix4fv", "(IIZ[FI)V", (void *) android_glUniformMatrix4fv__IIZ_3FI },
4999{"glUniformMatrix4fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2 },
5000{"glUseProgram", "(I)V", (void *) android_glUseProgram__I },
5001{"glValidateProgram", "(I)V", (void *) android_glValidateProgram__I },
5002{"glVertexAttrib1f", "(IF)V", (void *) android_glVertexAttrib1f__IF },
5003{"glVertexAttrib1fv", "(I[FI)V", (void *) android_glVertexAttrib1fv__I_3FI },
5004{"glVertexAttrib1fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2 },
5005{"glVertexAttrib2f", "(IFF)V", (void *) android_glVertexAttrib2f__IFF },
5006{"glVertexAttrib2fv", "(I[FI)V", (void *) android_glVertexAttrib2fv__I_3FI },
5007{"glVertexAttrib2fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2 },
5008{"glVertexAttrib3f", "(IFFF)V", (void *) android_glVertexAttrib3f__IFFF },
5009{"glVertexAttrib3fv", "(I[FI)V", (void *) android_glVertexAttrib3fv__I_3FI },
5010{"glVertexAttrib3fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2 },
5011{"glVertexAttrib4f", "(IFFFF)V", (void *) android_glVertexAttrib4f__IFFFF },
5012{"glVertexAttrib4fv", "(I[FI)V", (void *) android_glVertexAttrib4fv__I_3FI },
5013{"glVertexAttrib4fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2 },
5014{"glVertexAttribPointerBounds", "(IIIZILjava/nio/Buffer;I)V", (void *) android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I },
5015{"glViewport", "(IIII)V", (void *) android_glViewport__IIII },
5016};
5017
5018int register_android_opengl_jni_GLES20(JNIEnv *_env)
5019{
5020    int err;
5021    err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
5022    return err;
5023}
5024