OSDN Git Service

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