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