1 /*
2 **
3 ** Copyright 2009, The Android Open Source Project
4 **
5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at
8 **
9 **     http://www.apache.org/licenses/LICENSE-2.0
10 **
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
16 */
17 
18 // This source file is automatically generated
19 
20 #pragma GCC diagnostic ignored "-Wunused-variable"
21 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
22 #pragma GCC diagnostic ignored "-Wunused-function"
23 
24 #include <GLES/gl.h>
25 #include <GLES/glext.h>
26 
27 #include <jni.h>
28 #include <nativehelper/JNIPlatformHelp.h>
29 #include <android_runtime/AndroidRuntime.h>
30 #include <utils/misc.h>
31 #include <assert.h>
32 
33 
34 /* special calls implemented in Android's GLES wrapper used to more
35  * efficiently bound-check passed arrays */
36 extern "C" {
37 #ifdef GL_VERSION_ES_CM_1_1
38 GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
39         const GLvoid *ptr, GLsizei count);
40 GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
41         const GLvoid *pointer, GLsizei count);
42 GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
43         GLsizei stride, const GLvoid *pointer, GLsizei count);
44 GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
45         GLsizei stride, const GLvoid *pointer, GLsizei count);
46 GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
47         GLsizei stride, const GLvoid *pointer, GLsizei count);
48 GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
49         GLsizei stride, const GLvoid *pointer, GLsizei count);
50 GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
51         GLsizei stride, const GLvoid *pointer, GLsizei count);
52 #endif
53 #ifdef GL_ES_VERSION_2_0
glVertexAttribPointerBounds(GLuint indx,GLint size,GLenum type,GLboolean normalized,GLsizei stride,const GLvoid * pointer,GLsizei count)54 static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type,
55         GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) {
56     glVertexAttribPointer(indx, size, type, normalized, stride, pointer);
57 }
58 #endif
59 #ifdef GL_ES_VERSION_3_0
glVertexAttribIPointerBounds(GLuint indx,GLint size,GLenum type,GLsizei stride,const GLvoid * pointer,GLsizei count)60 static void glVertexAttribIPointerBounds(GLuint indx, GLint size, GLenum type,
61         GLsizei stride, const GLvoid *pointer, GLsizei count) {
62     glVertexAttribIPointer(indx, size, type, stride, pointer);
63 }
64 #endif
65 }
66 
67 static void
nativeClassInit(JNIEnv * _env,jclass glImplClass)68 nativeClassInit(JNIEnv *_env, jclass glImplClass)
69 {
70 }
71 
72 static void *
getPointer(JNIEnv * _env,jobject buffer,jarray * array,jint * remaining,jint * offset)73 getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
74 {
75     jint position;
76     jint limit;
77     jint elementSizeShift;
78     jlong pointer;
79 
80     pointer = jniGetNioBufferFields(_env, buffer, &position, &limit, &elementSizeShift);
81     *remaining = (limit - position) << elementSizeShift;
82     if (pointer != 0L) {
83         *array = nullptr;
84         pointer += position << elementSizeShift;
85         return reinterpret_cast<void*>(pointer);
86     }
87 
88     *array = jniGetNioBufferBaseArray(_env, buffer);
89     *offset = jniGetNioBufferBaseArrayOffset(_env, buffer);
90     return nullptr;
91 }
92 
93 class ByteArrayGetter {
94 public:
Get(JNIEnv * _env,jbyteArray array,jboolean * is_copy)95     static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
96         return _env->GetByteArrayElements(array, is_copy);
97     }
98 };
99 class BooleanArrayGetter {
100 public:
Get(JNIEnv * _env,jbooleanArray array,jboolean * is_copy)101     static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
102         return _env->GetBooleanArrayElements(array, is_copy);
103     }
104 };
105 class CharArrayGetter {
106 public:
Get(JNIEnv * _env,jcharArray array,jboolean * is_copy)107     static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
108         return _env->GetCharArrayElements(array, is_copy);
109     }
110 };
111 class ShortArrayGetter {
112 public:
Get(JNIEnv * _env,jshortArray array,jboolean * is_copy)113     static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
114         return _env->GetShortArrayElements(array, is_copy);
115     }
116 };
117 class IntArrayGetter {
118 public:
Get(JNIEnv * _env,jintArray array,jboolean * is_copy)119     static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
120         return _env->GetIntArrayElements(array, is_copy);
121     }
122 };
123 class LongArrayGetter {
124 public:
Get(JNIEnv * _env,jlongArray array,jboolean * is_copy)125     static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
126         return _env->GetLongArrayElements(array, is_copy);
127     }
128 };
129 class FloatArrayGetter {
130 public:
Get(JNIEnv * _env,jfloatArray array,jboolean * is_copy)131     static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
132         return _env->GetFloatArrayElements(array, is_copy);
133     }
134 };
135 class DoubleArrayGetter {
136 public:
Get(JNIEnv * _env,jdoubleArray array,jboolean * is_copy)137     static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
138         return _env->GetDoubleArrayElements(array, is_copy);
139     }
140 };
141 
142 template<typename JTYPEARRAY, typename ARRAYGETTER>
143 static void*
getArrayPointer(JNIEnv * _env,JTYPEARRAY array,jboolean * is_copy)144 getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
145     return ARRAYGETTER::Get(_env, array, is_copy);
146 }
147 
148 class ByteArrayReleaser {
149 public:
Release(JNIEnv * _env,jbyteArray array,jbyte * data,jboolean commit)150     static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
151         _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
152     }
153 };
154 class BooleanArrayReleaser {
155 public:
Release(JNIEnv * _env,jbooleanArray array,jboolean * data,jboolean commit)156     static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
157         _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
158     }
159 };
160 class CharArrayReleaser {
161 public:
Release(JNIEnv * _env,jcharArray array,jchar * data,jboolean commit)162     static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
163         _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
164     }
165 };
166 class ShortArrayReleaser {
167 public:
Release(JNIEnv * _env,jshortArray array,jshort * data,jboolean commit)168     static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
169         _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
170     }
171 };
172 class IntArrayReleaser {
173 public:
Release(JNIEnv * _env,jintArray array,jint * data,jboolean commit)174     static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
175         _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
176     }
177 };
178 class LongArrayReleaser {
179 public:
Release(JNIEnv * _env,jlongArray array,jlong * data,jboolean commit)180     static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
181         _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
182     }
183 };
184 class FloatArrayReleaser {
185 public:
Release(JNIEnv * _env,jfloatArray array,jfloat * data,jboolean commit)186     static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
187         _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
188     }
189 };
190 class DoubleArrayReleaser {
191 public:
Release(JNIEnv * _env,jdoubleArray array,jdouble * data,jboolean commit)192     static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
193         _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
194     }
195 };
196 
197 template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
198 static void
releaseArrayPointer(JNIEnv * _env,JTYPEARRAY array,NTYPEARRAY data,jboolean commit)199 releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
200     ARRAYRELEASER::Release(_env, array, data, commit);
201 }
202 
203 static void
releasePointer(JNIEnv * _env,jarray array,void * data,jboolean commit)204 releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
205 {
206     _env->ReleasePrimitiveArrayCritical(array, data,
207                        commit ? 0 : JNI_ABORT);
208 }
209 
210 static void *
getDirectBufferPointer(JNIEnv * _env,jobject buffer)211 getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
212     jint position;
213     jint limit;
214     jint elementSizeShift;
215     jlong pointer;
216     pointer = jniGetNioBufferFields(_env, buffer, &position, &limit, &elementSizeShift);
217     if (pointer == 0) {
218         jniThrowException(_env, "java/lang/IllegalArgumentException",
219                           "Must use a native order direct Buffer");
220         return nullptr;
221     }
222     pointer += position << elementSizeShift;
223     return reinterpret_cast<void*>(pointer);
224 }
225 
226 // --------------------------------------------------------------------------
227 
228 /*
229  * returns the number of values glGet returns for a given pname.
230  *
231  * The code below is written such that pnames requiring only one values
232  * are the default (and are not explicitely tested for). This makes the
233  * checking code much shorter/readable/efficient.
234  *
235  * This means that unknown pnames (e.g.: extensions) will default to 1. If
236  * that unknown pname needs more than 1 value, then the validation check
237  * is incomplete and the app may crash if it passed the wrong number params.
238  */
getNeededCount(GLint pname)239 static int getNeededCount(GLint pname) {
240     int needed = 1;
241 #ifdef GL_ES_VERSION_3_0
242     // GLES 3.x pnames
243     switch (pname) {
244         case GL_MAX_VIEWPORT_DIMS:
245             needed = 2;
246             break;
247 
248         case GL_PROGRAM_BINARY_FORMATS:
249             glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &needed);
250             break;
251     }
252 #endif
253 
254 #ifdef GL_ES_VERSION_2_0
255     // GLES 2.x pnames
256     switch (pname) {
257         case GL_ALIASED_LINE_WIDTH_RANGE:
258         case GL_ALIASED_POINT_SIZE_RANGE:
259             needed = 2;
260             break;
261 
262         case GL_BLEND_COLOR:
263         case GL_COLOR_CLEAR_VALUE:
264         case GL_COLOR_WRITEMASK:
265         case GL_SCISSOR_BOX:
266         case GL_VIEWPORT:
267             needed = 4;
268             break;
269 
270         case GL_COMPRESSED_TEXTURE_FORMATS:
271             glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
272             break;
273 
274         case GL_SHADER_BINARY_FORMATS:
275             glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed);
276             break;
277     }
278 #endif
279 
280 #ifdef GL_VERSION_ES_CM_1_1
281     // GLES 1.x pnames
282     switch (pname) {
283         case GL_ALIASED_LINE_WIDTH_RANGE:
284         case GL_ALIASED_POINT_SIZE_RANGE:
285         case GL_DEPTH_RANGE:
286         case GL_SMOOTH_LINE_WIDTH_RANGE:
287         case GL_SMOOTH_POINT_SIZE_RANGE:
288             needed = 2;
289             break;
290 
291         case GL_CURRENT_NORMAL:
292         case GL_POINT_DISTANCE_ATTENUATION:
293             needed = 3;
294             break;
295 
296         case GL_COLOR_CLEAR_VALUE:
297         case GL_COLOR_WRITEMASK:
298         case GL_CURRENT_COLOR:
299         case GL_CURRENT_TEXTURE_COORDS:
300         case GL_FOG_COLOR:
301         case GL_LIGHT_MODEL_AMBIENT:
302         case GL_SCISSOR_BOX:
303         case GL_VIEWPORT:
304             needed = 4;
305             break;
306 
307         case GL_MODELVIEW_MATRIX:
308         case GL_PROJECTION_MATRIX:
309         case GL_TEXTURE_MATRIX:
310             needed = 16;
311             break;
312 
313         case GL_COMPRESSED_TEXTURE_FORMATS:
314             glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
315             break;
316     }
317 #endif
318     return needed;
319 }
320 
321 template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
322           typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
323 static void
get(JNIEnv * _env,jobject _this,jint pname,JTYPEARRAY params_ref,jint offset)324 get
325   (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
326     jint _exception = 0;
327     const char * _exceptionType;
328     const char * _exceptionMessage;
329     CTYPE *params_base = (CTYPE *) 0;
330     jint _remaining;
331     CTYPE *params = (CTYPE *) 0;
332     int _needed = 0;
333 
334     if (!params_ref) {
335         _exception = 1;
336         _exceptionType = "java/lang/IllegalArgumentException";
337         _exceptionMessage = "params == null";
338         goto exit;
339     }
340     if (offset < 0) {
341         _exception = 1;
342         _exceptionType = "java/lang/IllegalArgumentException";
343         _exceptionMessage = "offset < 0";
344         goto exit;
345     }
346     _remaining = _env->GetArrayLength(params_ref) - offset;
347     _needed = getNeededCount(pname);
348     // if we didn't find this pname, we just assume the user passed
349     // an array of the right size -- this might happen with extensions
350     // or if we forget an enum here.
351     if (_remaining < _needed) {
352         _exception = 1;
353         _exceptionType = "java/lang/IllegalArgumentException";
354         _exceptionMessage = "length - offset < needed";
355         goto exit;
356     }
357     params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
358         _env, params_ref, (jboolean *)0);
359     params = params_base + offset;
360 
361     GET(
362         (GLenum)pname,
363         (CTYPE *)params
364     );
365 
366 exit:
367     if (params_base) {
368         releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
369             _env, params_ref, params_base, !_exception);
370     }
371     if (_exception) {
372         jniThrowException(_env, _exceptionType, _exceptionMessage);
373     }
374 }
375 
376 
377 template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
378           typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
379 static void
getarray(JNIEnv * _env,jobject _this,jint pname,jobject params_buf)380 getarray
381   (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
382     jint _exception = 0;
383     const char * _exceptionType;
384     const char * _exceptionMessage;
385     JTYPEARRAY _array = (JTYPEARRAY) 0;
386     jint _bufferOffset = (jint) 0;
387     jint _remaining;
388     CTYPE *params = (CTYPE *) 0;
389     int _needed = 0;
390 
391     params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
392     _remaining /= sizeof(CTYPE);    // convert from bytes to item count
393     _needed = getNeededCount(pname);
394     // if we didn't find this pname, we just assume the user passed
395     // an array of the right size -- this might happen with extensions
396     // or if we forget an enum here.
397     if (_needed>0 && _remaining < _needed) {
398         _exception = 1;
399         _exceptionType = "java/lang/IllegalArgumentException";
400         _exceptionMessage = "remaining() < needed";
401         goto exit;
402     }
403     if (params == NULL) {
404         char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
405             _env, _array, (jboolean *) 0);
406         params = (CTYPE *) (_paramsBase + _bufferOffset);
407     }
408     GET(
409         (GLenum)pname,
410         (CTYPE *)params
411     );
412 
413 exit:
414     if (_array) {
415         releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
416             _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
417     }
418     if (_exception) {
419         jniThrowException(_env, _exceptionType, _exceptionMessage);
420     }
421 }
422 
423 // --------------------------------------------------------------------------
424 /* void glBindBuffer ( GLenum target, GLuint buffer ) */
425 static void
android_glBindBuffer__II(JNIEnv * _env,jobject _this,jint target,jint buffer)426 android_glBindBuffer__II
427   (JNIEnv *_env, jobject _this, jint target, jint buffer) {
428     glBindBuffer(
429         (GLenum)target,
430         (GLuint)buffer
431     );
432 }
433 
434 /* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */
435 static void
android_glBufferData__IILjava_nio_Buffer_2I(JNIEnv * _env,jobject _this,jint target,jint size,jobject data_buf,jint usage)436 android_glBufferData__IILjava_nio_Buffer_2I
437   (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) {
438     jint _exception = 0;
439     const char * _exceptionType = NULL;
440     const char * _exceptionMessage = NULL;
441     jarray _array = (jarray) 0;
442     jint _bufferOffset = (jint) 0;
443     jint _remaining;
444     GLvoid *data = (GLvoid *) 0;
445 
446     if (data_buf) {
447         data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
448         if (_remaining < size) {
449             _exception = 1;
450             _exceptionType = "java/lang/IllegalArgumentException";
451             _exceptionMessage = "remaining() < size < needed";
452             goto exit;
453         }
454     }
455     if (data_buf && data == NULL) {
456         char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
457         data = (GLvoid *) (_dataBase + _bufferOffset);
458     }
459     glBufferData(
460         (GLenum)target,
461         (GLsizeiptr)size,
462         (GLvoid *)data,
463         (GLenum)usage
464     );
465 
466 exit:
467     if (_array) {
468         releasePointer(_env, _array, (void *)((char *)data - _bufferOffset), JNI_FALSE);
469     }
470     if (_exception) {
471         jniThrowException(_env, _exceptionType, _exceptionMessage);
472     }
473 }
474 
475 /* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */
476 static void
android_glBufferSubData__IIILjava_nio_Buffer_2(JNIEnv * _env,jobject _this,jint target,jint offset,jint size,jobject data_buf)477 android_glBufferSubData__IIILjava_nio_Buffer_2
478   (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) {
479     jint _exception = 0;
480     const char * _exceptionType = NULL;
481     const char * _exceptionMessage = NULL;
482     jarray _array = (jarray) 0;
483     jint _bufferOffset = (jint) 0;
484     jint _remaining;
485     GLvoid *data = (GLvoid *) 0;
486 
487     if (!data_buf) {
488         _exception = 1;
489         _exceptionType = "java/lang/IllegalArgumentException";
490         _exceptionMessage = "data == null";
491         goto exit;
492     }
493     data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
494     if (_remaining < size) {
495         _exception = 1;
496         _exceptionType = "java/lang/IllegalArgumentException";
497         _exceptionMessage = "remaining() < size < needed";
498         goto exit;
499     }
500     if (data == NULL) {
501         char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
502         data = (GLvoid *) (_dataBase + _bufferOffset);
503     }
504     glBufferSubData(
505         (GLenum)target,
506         (GLintptr)offset,
507         (GLsizeiptr)size,
508         (GLvoid *)data
509     );
510 
511 exit:
512     if (_array) {
513         releasePointer(_env, _array, (void *)((char *)data - _bufferOffset), JNI_FALSE);
514     }
515     if (_exception) {
516         jniThrowException(_env, _exceptionType, _exceptionMessage);
517     }
518 }
519 
520 /* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */
521 static void
android_glClipPlanef__I_3FI(JNIEnv * _env,jobject _this,jint plane,jfloatArray equation_ref,jint offset)522 android_glClipPlanef__I_3FI
523   (JNIEnv *_env, jobject _this, jint plane, jfloatArray equation_ref, jint offset) {
524     jint _exception = 0;
525     const char * _exceptionType = NULL;
526     const char * _exceptionMessage = NULL;
527     GLfloat *equation_base = (GLfloat *) 0;
528     jint _remaining;
529     GLfloat *equation = (GLfloat *) 0;
530 
531     if (!equation_ref) {
532         _exception = 1;
533         _exceptionType = "java/lang/IllegalArgumentException";
534         _exceptionMessage = "equation == null";
535         goto exit;
536     }
537     if (offset < 0) {
538         _exception = 1;
539         _exceptionType = "java/lang/IllegalArgumentException";
540         _exceptionMessage = "offset < 0";
541         goto exit;
542     }
543     _remaining = _env->GetArrayLength(equation_ref) - offset;
544     equation_base = (GLfloat *)
545         _env->GetFloatArrayElements(equation_ref, (jboolean *)0);
546     equation = equation_base + offset;
547 
548     glClipPlanef(
549         (GLenum)plane,
550         (GLfloat *)equation
551     );
552 
553 exit:
554     if (equation_base) {
555         _env->ReleaseFloatArrayElements(equation_ref, (jfloat*)equation_base,
556             JNI_ABORT);
557     }
558     if (_exception) {
559         jniThrowException(_env, _exceptionType, _exceptionMessage);
560     }
561 }
562 
563 /* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */
564 static void
android_glClipPlanef__ILjava_nio_FloatBuffer_2(JNIEnv * _env,jobject _this,jint plane,jobject equation_buf)565 android_glClipPlanef__ILjava_nio_FloatBuffer_2
566   (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
567     jint _exception = 0;
568     const char * _exceptionType = NULL;
569     const char * _exceptionMessage = NULL;
570     jfloatArray _array = (jfloatArray) 0;
571     jint _bufferOffset = (jint) 0;
572     jint _remaining;
573     GLfloat *equation = (GLfloat *) 0;
574 
575     if (!equation_buf) {
576         _exception = 1;
577         _exceptionType = "java/lang/IllegalArgumentException";
578         _exceptionMessage = "equation == null";
579         goto exit;
580     }
581     equation = (GLfloat *)getPointer(_env, equation_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
582     if (equation == NULL) {
583         char * _equationBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
584         equation = (GLfloat *) (_equationBase + _bufferOffset);
585     }
586     glClipPlanef(
587         (GLenum)plane,
588         (GLfloat *)equation
589     );
590 
591 exit:
592     if (_array) {
593         _env->ReleaseFloatArrayElements(_array, (jfloat*)equation, JNI_ABORT);
594     }
595     if (_exception) {
596         jniThrowException(_env, _exceptionType, _exceptionMessage);
597     }
598 }
599 
600 /* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */
601 static void
android_glClipPlanex__I_3II(JNIEnv * _env,jobject _this,jint plane,jintArray equation_ref,jint offset)602 android_glClipPlanex__I_3II
603   (JNIEnv *_env, jobject _this, jint plane, jintArray equation_ref, jint offset) {
604     jint _exception = 0;
605     const char * _exceptionType = NULL;
606     const char * _exceptionMessage = NULL;
607     GLfixed *equation_base = (GLfixed *) 0;
608     jint _remaining;
609     GLfixed *equation = (GLfixed *) 0;
610 
611     if (!equation_ref) {
612         _exception = 1;
613         _exceptionType = "java/lang/IllegalArgumentException";
614         _exceptionMessage = "equation == null";
615         goto exit;
616     }
617     if (offset < 0) {
618         _exception = 1;
619         _exceptionType = "java/lang/IllegalArgumentException";
620         _exceptionMessage = "offset < 0";
621         goto exit;
622     }
623     _remaining = _env->GetArrayLength(equation_ref) - offset;
624     equation_base = (GLfixed *)
625         _env->GetIntArrayElements(equation_ref, (jboolean *)0);
626     equation = equation_base + offset;
627 
628     glClipPlanex(
629         (GLenum)plane,
630         (GLfixed *)equation
631     );
632 
633 exit:
634     if (equation_base) {
635         _env->ReleaseIntArrayElements(equation_ref, (jint*)equation_base,
636             JNI_ABORT);
637     }
638     if (_exception) {
639         jniThrowException(_env, _exceptionType, _exceptionMessage);
640     }
641 }
642 
643 /* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */
644 static void
android_glClipPlanex__ILjava_nio_IntBuffer_2(JNIEnv * _env,jobject _this,jint plane,jobject equation_buf)645 android_glClipPlanex__ILjava_nio_IntBuffer_2
646   (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
647     jint _exception = 0;
648     const char * _exceptionType = NULL;
649     const char * _exceptionMessage = NULL;
650     jintArray _array = (jintArray) 0;
651     jint _bufferOffset = (jint) 0;
652     jint _remaining;
653     GLfixed *equation = (GLfixed *) 0;
654 
655     if (!equation_buf) {
656         _exception = 1;
657         _exceptionType = "java/lang/IllegalArgumentException";
658         _exceptionMessage = "equation == null";
659         goto exit;
660     }
661     equation = (GLfixed *)getPointer(_env, equation_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
662     if (equation == NULL) {
663         char * _equationBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
664         equation = (GLfixed *) (_equationBase + _bufferOffset);
665     }
666     glClipPlanex(
667         (GLenum)plane,
668         (GLfixed *)equation
669     );
670 
671 exit:
672     if (_array) {
673         _env->ReleaseIntArrayElements(_array, (jint*)equation, JNI_ABORT);
674     }
675     if (_exception) {
676         jniThrowException(_env, _exceptionType, _exceptionMessage);
677     }
678 }
679 
680 /* void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) */
681 static void
android_glColor4ub__BBBB(JNIEnv * _env,jobject _this,jbyte red,jbyte green,jbyte blue,jbyte alpha)682 android_glColor4ub__BBBB
683   (JNIEnv *_env, jobject _this, jbyte red, jbyte green, jbyte blue, jbyte alpha) {
684     glColor4ub(
685         (GLubyte)red,
686         (GLubyte)green,
687         (GLubyte)blue,
688         (GLubyte)alpha
689     );
690 }
691 
692 /* void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
693 static void
android_glColorPointer__IIII(JNIEnv * _env,jobject _this,jint size,jint type,jint stride,jint offset)694 android_glColorPointer__IIII
695   (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
696     glColorPointer(
697         (GLint)size,
698         (GLenum)type,
699         (GLsizei)stride,
700         reinterpret_cast<GLvoid *>(offset)
701     );
702 }
703 
704 /* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
705 static void
android_glDeleteBuffers__I_3II(JNIEnv * _env,jobject _this,jint n,jintArray buffers_ref,jint offset)706 android_glDeleteBuffers__I_3II
707   (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
708     jint _exception = 0;
709     const char * _exceptionType = NULL;
710     const char * _exceptionMessage = NULL;
711     GLuint *buffers_base = (GLuint *) 0;
712     jint _remaining;
713     GLuint *buffers = (GLuint *) 0;
714 
715     if (!buffers_ref) {
716         _exception = 1;
717         _exceptionType = "java/lang/IllegalArgumentException";
718         _exceptionMessage = "buffers == null";
719         goto exit;
720     }
721     if (offset < 0) {
722         _exception = 1;
723         _exceptionType = "java/lang/IllegalArgumentException";
724         _exceptionMessage = "offset < 0";
725         goto exit;
726     }
727     _remaining = _env->GetArrayLength(buffers_ref) - offset;
728     if (_remaining < n) {
729         _exception = 1;
730         _exceptionType = "java/lang/IllegalArgumentException";
731         _exceptionMessage = "length - offset < n < needed";
732         goto exit;
733     }
734     buffers_base = (GLuint *)
735         _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
736     buffers = buffers_base + offset;
737 
738     glDeleteBuffers(
739         (GLsizei)n,
740         (GLuint *)buffers
741     );
742 
743 exit:
744     if (buffers_base) {
745         _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
746             JNI_ABORT);
747     }
748     if (_exception) {
749         jniThrowException(_env, _exceptionType, _exceptionMessage);
750     }
751 }
752 
753 /* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
754 static void
android_glDeleteBuffers__ILjava_nio_IntBuffer_2(JNIEnv * _env,jobject _this,jint n,jobject buffers_buf)755 android_glDeleteBuffers__ILjava_nio_IntBuffer_2
756   (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
757     jint _exception = 0;
758     const char * _exceptionType = NULL;
759     const char * _exceptionMessage = NULL;
760     jintArray _array = (jintArray) 0;
761     jint _bufferOffset = (jint) 0;
762     jint _remaining;
763     GLuint *buffers = (GLuint *) 0;
764 
765     if (!buffers_buf) {
766         _exception = 1;
767         _exceptionType = "java/lang/IllegalArgumentException";
768         _exceptionMessage = "buffers == null";
769         goto exit;
770     }
771     buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
772     if (_remaining < n) {
773         _exception = 1;
774         _exceptionType = "java/lang/IllegalArgumentException";
775         _exceptionMessage = "remaining() < n < needed";
776         goto exit;
777     }
778     if (buffers == NULL) {
779         char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
780         buffers = (GLuint *) (_buffersBase + _bufferOffset);
781     }
782     glDeleteBuffers(
783         (GLsizei)n,
784         (GLuint *)buffers
785     );
786 
787 exit:
788     if (_array) {
789         _env->ReleaseIntArrayElements(_array, (jint*)buffers, JNI_ABORT);
790     }
791     if (_exception) {
792         jniThrowException(_env, _exceptionType, _exceptionMessage);
793     }
794 }
795 
796 /* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */
797 static void
android_glDrawElements__IIII(JNIEnv * _env,jobject _this,jint mode,jint count,jint type,jint offset)798 android_glDrawElements__IIII
799   (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) {
800     jint _exception = 0;
801     const char * _exceptionType = NULL;
802     const char * _exceptionMessage = NULL;
803     glDrawElements(
804         (GLenum)mode,
805         (GLsizei)count,
806         (GLenum)type,
807         reinterpret_cast<GLvoid *>(offset)
808     );
809     if (_exception) {
810         jniThrowException(_env, _exceptionType, _exceptionMessage);
811     }
812 }
813 
814 /* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
815 static void
android_glGenBuffers__I_3II(JNIEnv * _env,jobject _this,jint n,jintArray buffers_ref,jint offset)816 android_glGenBuffers__I_3II
817   (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
818     jint _exception = 0;
819     const char * _exceptionType = NULL;
820     const char * _exceptionMessage = NULL;
821     GLuint *buffers_base = (GLuint *) 0;
822     jint _remaining;
823     GLuint *buffers = (GLuint *) 0;
824 
825     if (!buffers_ref) {
826         _exception = 1;
827         _exceptionType = "java/lang/IllegalArgumentException";
828         _exceptionMessage = "buffers == null";
829         goto exit;
830     }
831     if (offset < 0) {
832         _exception = 1;
833         _exceptionType = "java/lang/IllegalArgumentException";
834         _exceptionMessage = "offset < 0";
835         goto exit;
836     }
837     _remaining = _env->GetArrayLength(buffers_ref) - offset;
838     if (_remaining < n) {
839         _exception = 1;
840         _exceptionType = "java/lang/IllegalArgumentException";
841         _exceptionMessage = "length - offset < n < needed";
842         goto exit;
843     }
844     buffers_base = (GLuint *)
845         _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
846     buffers = buffers_base + offset;
847 
848     glGenBuffers(
849         (GLsizei)n,
850         (GLuint *)buffers
851     );
852 
853 exit:
854     if (buffers_base) {
855         _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
856             _exception ? JNI_ABORT: 0);
857     }
858     if (_exception) {
859         jniThrowException(_env, _exceptionType, _exceptionMessage);
860     }
861 }
862 
863 /* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
864 static void
android_glGenBuffers__ILjava_nio_IntBuffer_2(JNIEnv * _env,jobject _this,jint n,jobject buffers_buf)865 android_glGenBuffers__ILjava_nio_IntBuffer_2
866   (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
867     jint _exception = 0;
868     const char * _exceptionType = NULL;
869     const char * _exceptionMessage = NULL;
870     jintArray _array = (jintArray) 0;
871     jint _bufferOffset = (jint) 0;
872     jint _remaining;
873     GLuint *buffers = (GLuint *) 0;
874 
875     if (!buffers_buf) {
876         _exception = 1;
877         _exceptionType = "java/lang/IllegalArgumentException";
878         _exceptionMessage = "buffers == null";
879         goto exit;
880     }
881     buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
882     if (_remaining < n) {
883         _exception = 1;
884         _exceptionType = "java/lang/IllegalArgumentException";
885         _exceptionMessage = "remaining() < n < needed";
886         goto exit;
887     }
888     if (buffers == NULL) {
889         char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
890         buffers = (GLuint *) (_buffersBase + _bufferOffset);
891     }
892     glGenBuffers(
893         (GLsizei)n,
894         (GLuint *)buffers
895     );
896 
897 exit:
898     if (_array) {
899         _env->ReleaseIntArrayElements(_array, (jint*)buffers, _exception ? JNI_ABORT : 0);
900     }
901     if (_exception) {
902         jniThrowException(_env, _exceptionType, _exceptionMessage);
903     }
904 }
905 
906 /* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
907 static void
android_glGetBooleanv__I_3ZI(JNIEnv * _env,jobject _this,jint pname,jbooleanArray params_ref,jint offset)908 android_glGetBooleanv__I_3ZI
909   (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
910     get<jbooleanArray, BooleanArrayGetter, jboolean*, BooleanArrayReleaser, GLboolean, glGetBooleanv>(
911         _env, _this, pname, params_ref, offset);
912 }
913 
914 /* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
915 static void
android_glGetBooleanv__ILjava_nio_IntBuffer_2(JNIEnv * _env,jobject _this,jint pname,jobject params_buf)916 android_glGetBooleanv__ILjava_nio_IntBuffer_2
917   (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
918     getarray<GLboolean, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetBooleanv>(
919         _env, _this, pname, params_buf);
920 }
921 /* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
922 static void
android_glGetBufferParameteriv__II_3II(JNIEnv * _env,jobject _this,jint target,jint pname,jintArray params_ref,jint offset)923 android_glGetBufferParameteriv__II_3II
924   (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
925     jint _exception = 0;
926     const char * _exceptionType = NULL;
927     const char * _exceptionMessage = NULL;
928     GLint *params_base = (GLint *) 0;
929     jint _remaining;
930     GLint *params = (GLint *) 0;
931 
932     if (!params_ref) {
933         _exception = 1;
934         _exceptionType = "java/lang/IllegalArgumentException";
935         _exceptionMessage = "params == null";
936         goto exit;
937     }
938     if (offset < 0) {
939         _exception = 1;
940         _exceptionType = "java/lang/IllegalArgumentException";
941         _exceptionMessage = "offset < 0";
942         goto exit;
943     }
944     _remaining = _env->GetArrayLength(params_ref) - offset;
945     if (_remaining < 1) {
946         _exception = 1;
947         _exceptionType = "java/lang/IllegalArgumentException";
948         _exceptionMessage = "length - offset < 1 < needed";
949         goto exit;
950     }
951     params_base = (GLint *)
952         _env->GetIntArrayElements(params_ref, (jboolean *)0);
953     params = params_base + offset;
954 
955     glGetBufferParameteriv(
956         (GLenum)target,
957         (GLenum)pname,
958         (GLint *)params
959     );
960 
961 exit:
962     if (params_base) {
963         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
964             _exception ? JNI_ABORT: 0);
965     }
966     if (_exception) {
967         jniThrowException(_env, _exceptionType, _exceptionMessage);
968     }
969 }
970 
971 /* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
972 static void
android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2(JNIEnv * _env,jobject _this,jint target,jint pname,jobject params_buf)973 android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
974   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
975     jint _exception = 0;
976     const char * _exceptionType = NULL;
977     const char * _exceptionMessage = NULL;
978     jintArray _array = (jintArray) 0;
979     jint _bufferOffset = (jint) 0;
980     jint _remaining;
981     GLint *params = (GLint *) 0;
982 
983     if (!params_buf) {
984         _exception = 1;
985         _exceptionType = "java/lang/IllegalArgumentException";
986         _exceptionMessage = "params == null";
987         goto exit;
988     }
989     params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
990     if (_remaining < 1) {
991         _exception = 1;
992         _exceptionType = "java/lang/IllegalArgumentException";
993         _exceptionMessage = "remaining() < 1 < needed";
994         goto exit;
995     }
996     if (params == NULL) {
997         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
998         params = (GLint *) (_paramsBase + _bufferOffset);
999     }
1000     glGetBufferParameteriv(
1001         (GLenum)target,
1002         (GLenum)pname,
1003         (GLint *)params
1004     );
1005 
1006 exit:
1007     if (_array) {
1008         _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
1009     }
1010     if (_exception) {
1011         jniThrowException(_env, _exceptionType, _exceptionMessage);
1012     }
1013 }
1014 
1015 /* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */
1016 static void
android_glGetClipPlanef__I_3FI(JNIEnv * _env,jobject _this,jint pname,jfloatArray eqn_ref,jint offset)1017 android_glGetClipPlanef__I_3FI
1018   (JNIEnv *_env, jobject _this, jint pname, jfloatArray eqn_ref, jint offset) {
1019     jint _exception = 0;
1020     const char * _exceptionType = NULL;
1021     const char * _exceptionMessage = NULL;
1022     GLfloat *eqn_base = (GLfloat *) 0;
1023     jint _remaining;
1024     GLfloat *eqn = (GLfloat *) 0;
1025 
1026     if (!eqn_ref) {
1027         _exception = 1;
1028         _exceptionType = "java/lang/IllegalArgumentException";
1029         _exceptionMessage = "eqn == null";
1030         goto exit;
1031     }
1032     if (offset < 0) {
1033         _exception = 1;
1034         _exceptionType = "java/lang/IllegalArgumentException";
1035         _exceptionMessage = "offset < 0";
1036         goto exit;
1037     }
1038     _remaining = _env->GetArrayLength(eqn_ref) - offset;
1039     if (_remaining < 4) {
1040         _exception = 1;
1041         _exceptionType = "java/lang/IllegalArgumentException";
1042         _exceptionMessage = "length - offset < 4 < needed";
1043         goto exit;
1044     }
1045     eqn_base = (GLfloat *)
1046         _env->GetFloatArrayElements(eqn_ref, (jboolean *)0);
1047     eqn = eqn_base + offset;
1048 
1049     glGetClipPlanef(
1050         (GLenum)pname,
1051         (GLfloat *)eqn
1052     );
1053 
1054 exit:
1055     if (eqn_base) {
1056         _env->ReleaseFloatArrayElements(eqn_ref, (jfloat*)eqn_base,
1057             _exception ? JNI_ABORT: 0);
1058     }
1059     if (_exception) {
1060         jniThrowException(_env, _exceptionType, _exceptionMessage);
1061     }
1062 }
1063 
1064 /* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */
1065 static void
android_glGetClipPlanef__ILjava_nio_FloatBuffer_2(JNIEnv * _env,jobject _this,jint pname,jobject eqn_buf)1066 android_glGetClipPlanef__ILjava_nio_FloatBuffer_2
1067   (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
1068     jint _exception = 0;
1069     const char * _exceptionType = NULL;
1070     const char * _exceptionMessage = NULL;
1071     jfloatArray _array = (jfloatArray) 0;
1072     jint _bufferOffset = (jint) 0;
1073     jint _remaining;
1074     GLfloat *eqn = (GLfloat *) 0;
1075 
1076     if (!eqn_buf) {
1077         _exception = 1;
1078         _exceptionType = "java/lang/IllegalArgumentException";
1079         _exceptionMessage = "eqn == null";
1080         goto exit;
1081     }
1082     eqn = (GLfloat *)getPointer(_env, eqn_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1083     if (_remaining < 4) {
1084         _exception = 1;
1085         _exceptionType = "java/lang/IllegalArgumentException";
1086         _exceptionMessage = "remaining() < 4 < needed";
1087         goto exit;
1088     }
1089     if (eqn == NULL) {
1090         char * _eqnBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
1091         eqn = (GLfloat *) (_eqnBase + _bufferOffset);
1092     }
1093     glGetClipPlanef(
1094         (GLenum)pname,
1095         (GLfloat *)eqn
1096     );
1097 
1098 exit:
1099     if (_array) {
1100         _env->ReleaseFloatArrayElements(_array, (jfloat*)eqn, _exception ? JNI_ABORT : 0);
1101     }
1102     if (_exception) {
1103         jniThrowException(_env, _exceptionType, _exceptionMessage);
1104     }
1105 }
1106 
1107 /* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */
1108 static void
android_glGetClipPlanex__I_3II(JNIEnv * _env,jobject _this,jint pname,jintArray eqn_ref,jint offset)1109 android_glGetClipPlanex__I_3II
1110   (JNIEnv *_env, jobject _this, jint pname, jintArray eqn_ref, jint offset) {
1111     jint _exception = 0;
1112     const char * _exceptionType = NULL;
1113     const char * _exceptionMessage = NULL;
1114     GLfixed *eqn_base = (GLfixed *) 0;
1115     jint _remaining;
1116     GLfixed *eqn = (GLfixed *) 0;
1117 
1118     if (!eqn_ref) {
1119         _exception = 1;
1120         _exceptionType = "java/lang/IllegalArgumentException";
1121         _exceptionMessage = "eqn == null";
1122         goto exit;
1123     }
1124     if (offset < 0) {
1125         _exception = 1;
1126         _exceptionType = "java/lang/IllegalArgumentException";
1127         _exceptionMessage = "offset < 0";
1128         goto exit;
1129     }
1130     _remaining = _env->GetArrayLength(eqn_ref) - offset;
1131     if (_remaining < 4) {
1132         _exception = 1;
1133         _exceptionType = "java/lang/IllegalArgumentException";
1134         _exceptionMessage = "length - offset < 4 < needed";
1135         goto exit;
1136     }
1137     eqn_base = (GLfixed *)
1138         _env->GetIntArrayElements(eqn_ref, (jboolean *)0);
1139     eqn = eqn_base + offset;
1140 
1141     glGetClipPlanex(
1142         (GLenum)pname,
1143         (GLfixed *)eqn
1144     );
1145 
1146 exit:
1147     if (eqn_base) {
1148         _env->ReleaseIntArrayElements(eqn_ref, (jint*)eqn_base,
1149             _exception ? JNI_ABORT: 0);
1150     }
1151     if (_exception) {
1152         jniThrowException(_env, _exceptionType, _exceptionMessage);
1153     }
1154 }
1155 
1156 /* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */
1157 static void
android_glGetClipPlanex__ILjava_nio_IntBuffer_2(JNIEnv * _env,jobject _this,jint pname,jobject eqn_buf)1158 android_glGetClipPlanex__ILjava_nio_IntBuffer_2
1159   (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
1160     jint _exception = 0;
1161     const char * _exceptionType = NULL;
1162     const char * _exceptionMessage = NULL;
1163     jintArray _array = (jintArray) 0;
1164     jint _bufferOffset = (jint) 0;
1165     jint _remaining;
1166     GLfixed *eqn = (GLfixed *) 0;
1167 
1168     if (!eqn_buf) {
1169         _exception = 1;
1170         _exceptionType = "java/lang/IllegalArgumentException";
1171         _exceptionMessage = "eqn == null";
1172         goto exit;
1173     }
1174     eqn = (GLfixed *)getPointer(_env, eqn_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1175     if (_remaining < 4) {
1176         _exception = 1;
1177         _exceptionType = "java/lang/IllegalArgumentException";
1178         _exceptionMessage = "remaining() < 4 < needed";
1179         goto exit;
1180     }
1181     if (eqn == NULL) {
1182         char * _eqnBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1183         eqn = (GLfixed *) (_eqnBase + _bufferOffset);
1184     }
1185     glGetClipPlanex(
1186         (GLenum)pname,
1187         (GLfixed *)eqn
1188     );
1189 
1190 exit:
1191     if (_array) {
1192         _env->ReleaseIntArrayElements(_array, (jint*)eqn, _exception ? JNI_ABORT : 0);
1193     }
1194     if (_exception) {
1195         jniThrowException(_env, _exceptionType, _exceptionMessage);
1196     }
1197 }
1198 
1199 /* void glGetFixedv ( GLenum pname, GLfixed *params ) */
1200 static void
android_glGetFixedv__I_3II(JNIEnv * _env,jobject _this,jint pname,jintArray params_ref,jint offset)1201 android_glGetFixedv__I_3II
1202   (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
1203     jint _exception = 0;
1204     const char * _exceptionType = NULL;
1205     const char * _exceptionMessage = NULL;
1206     GLfixed *params_base = (GLfixed *) 0;
1207     jint _remaining;
1208     GLfixed *params = (GLfixed *) 0;
1209 
1210     if (!params_ref) {
1211         _exception = 1;
1212         _exceptionType = "java/lang/IllegalArgumentException";
1213         _exceptionMessage = "params == null";
1214         goto exit;
1215     }
1216     if (offset < 0) {
1217         _exception = 1;
1218         _exceptionType = "java/lang/IllegalArgumentException";
1219         _exceptionMessage = "offset < 0";
1220         goto exit;
1221     }
1222     _remaining = _env->GetArrayLength(params_ref) - offset;
1223     params_base = (GLfixed *)
1224         _env->GetIntArrayElements(params_ref, (jboolean *)0);
1225     params = params_base + offset;
1226 
1227     glGetFixedv(
1228         (GLenum)pname,
1229         (GLfixed *)params
1230     );
1231 
1232 exit:
1233     if (params_base) {
1234         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
1235             _exception ? JNI_ABORT: 0);
1236     }
1237     if (_exception) {
1238         jniThrowException(_env, _exceptionType, _exceptionMessage);
1239     }
1240 }
1241 
1242 /* void glGetFixedv ( GLenum pname, GLfixed *params ) */
1243 static void
android_glGetFixedv__ILjava_nio_IntBuffer_2(JNIEnv * _env,jobject _this,jint pname,jobject params_buf)1244 android_glGetFixedv__ILjava_nio_IntBuffer_2
1245   (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
1246     jint _exception = 0;
1247     const char * _exceptionType = NULL;
1248     const char * _exceptionMessage = NULL;
1249     jintArray _array = (jintArray) 0;
1250     jint _bufferOffset = (jint) 0;
1251     jint _remaining;
1252     GLfixed *params = (GLfixed *) 0;
1253 
1254     if (!params_buf) {
1255         _exception = 1;
1256         _exceptionType = "java/lang/IllegalArgumentException";
1257         _exceptionMessage = "params == null";
1258         goto exit;
1259     }
1260     params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1261     if (params == NULL) {
1262         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1263         params = (GLfixed *) (_paramsBase + _bufferOffset);
1264     }
1265     glGetFixedv(
1266         (GLenum)pname,
1267         (GLfixed *)params
1268     );
1269 
1270 exit:
1271     if (_array) {
1272         _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
1273     }
1274     if (_exception) {
1275         jniThrowException(_env, _exceptionType, _exceptionMessage);
1276     }
1277 }
1278 
1279 /* void glGetFloatv ( GLenum pname, GLfloat *params ) */
1280 static void
android_glGetFloatv__I_3FI(JNIEnv * _env,jobject _this,jint pname,jfloatArray params_ref,jint offset)1281 android_glGetFloatv__I_3FI
1282   (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
1283     get<jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, GLfloat, glGetFloatv>(
1284         _env, _this, pname, params_ref, offset);
1285 }
1286 
1287 /* void glGetFloatv ( GLenum pname, GLfloat *params ) */
1288 static void
android_glGetFloatv__ILjava_nio_FloatBuffer_2(JNIEnv * _env,jobject _this,jint pname,jobject params_buf)1289 android_glGetFloatv__ILjava_nio_FloatBuffer_2
1290   (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
1291     getarray<GLfloat, jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, glGetFloatv>(
1292         _env, _this, pname, params_buf);
1293 }
1294 /* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */
1295 static void
android_glGetLightfv__II_3FI(JNIEnv * _env,jobject _this,jint light,jint pname,jfloatArray params_ref,jint offset)1296 android_glGetLightfv__II_3FI
1297   (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) {
1298     jint _exception = 0;
1299     const char * _exceptionType = NULL;
1300     const char * _exceptionMessage = NULL;
1301     GLfloat *params_base = (GLfloat *) 0;
1302     jint _remaining;
1303     GLfloat *params = (GLfloat *) 0;
1304 
1305     if (!params_ref) {
1306         _exception = 1;
1307         _exceptionType = "java/lang/IllegalArgumentException";
1308         _exceptionMessage = "params == null";
1309         goto exit;
1310     }
1311     if (offset < 0) {
1312         _exception = 1;
1313         _exceptionType = "java/lang/IllegalArgumentException";
1314         _exceptionMessage = "offset < 0";
1315         goto exit;
1316     }
1317     _remaining = _env->GetArrayLength(params_ref) - offset;
1318     int _needed;
1319     switch (pname) {
1320 #if defined(GL_SPOT_DIRECTION)
1321         case GL_SPOT_DIRECTION:
1322 #endif // defined(GL_SPOT_DIRECTION)
1323             _needed = 3;
1324             break;
1325 #if defined(GL_AMBIENT)
1326         case GL_AMBIENT:
1327 #endif // defined(GL_AMBIENT)
1328 #if defined(GL_DIFFUSE)
1329         case GL_DIFFUSE:
1330 #endif // defined(GL_DIFFUSE)
1331 #if defined(GL_SPECULAR)
1332         case GL_SPECULAR:
1333 #endif // defined(GL_SPECULAR)
1334 #if defined(GL_EMISSION)
1335         case GL_EMISSION:
1336 #endif // defined(GL_EMISSION)
1337             _needed = 4;
1338             break;
1339         default:
1340             _needed = 1;
1341             break;
1342     }
1343     if (_remaining < _needed) {
1344         _exception = 1;
1345         _exceptionType = "java/lang/IllegalArgumentException";
1346         _exceptionMessage = "length - offset < needed";
1347         goto exit;
1348     }
1349     params_base = (GLfloat *)
1350         _env->GetFloatArrayElements(params_ref, (jboolean *)0);
1351     params = params_base + offset;
1352 
1353     glGetLightfv(
1354         (GLenum)light,
1355         (GLenum)pname,
1356         (GLfloat *)params
1357     );
1358 
1359 exit:
1360     if (params_base) {
1361         _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
1362             _exception ? JNI_ABORT: 0);
1363     }
1364     if (_exception) {
1365         jniThrowException(_env, _exceptionType, _exceptionMessage);
1366     }
1367 }
1368 
1369 /* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */
1370 static void
android_glGetLightfv__IILjava_nio_FloatBuffer_2(JNIEnv * _env,jobject _this,jint light,jint pname,jobject params_buf)1371 android_glGetLightfv__IILjava_nio_FloatBuffer_2
1372   (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
1373     jint _exception = 0;
1374     const char * _exceptionType = NULL;
1375     const char * _exceptionMessage = NULL;
1376     jfloatArray _array = (jfloatArray) 0;
1377     jint _bufferOffset = (jint) 0;
1378     jint _remaining;
1379     GLfloat *params = (GLfloat *) 0;
1380 
1381     if (!params_buf) {
1382         _exception = 1;
1383         _exceptionType = "java/lang/IllegalArgumentException";
1384         _exceptionMessage = "params == null";
1385         goto exit;
1386     }
1387     params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1388     int _needed;
1389     switch (pname) {
1390 #if defined(GL_SPOT_DIRECTION)
1391         case GL_SPOT_DIRECTION:
1392 #endif // defined(GL_SPOT_DIRECTION)
1393             _needed = 3;
1394             break;
1395 #if defined(GL_AMBIENT)
1396         case GL_AMBIENT:
1397 #endif // defined(GL_AMBIENT)
1398 #if defined(GL_DIFFUSE)
1399         case GL_DIFFUSE:
1400 #endif // defined(GL_DIFFUSE)
1401 #if defined(GL_SPECULAR)
1402         case GL_SPECULAR:
1403 #endif // defined(GL_SPECULAR)
1404 #if defined(GL_EMISSION)
1405         case GL_EMISSION:
1406 #endif // defined(GL_EMISSION)
1407             _needed = 4;
1408             break;
1409         default:
1410             _needed = 1;
1411             break;
1412     }
1413     if (_remaining < _needed) {
1414         _exception = 1;
1415         _exceptionType = "java/lang/IllegalArgumentException";
1416         _exceptionMessage = "remaining() < needed";
1417         goto exit;
1418     }
1419     if (params == NULL) {
1420         char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
1421         params = (GLfloat *) (_paramsBase + _bufferOffset);
1422     }
1423     glGetLightfv(
1424         (GLenum)light,
1425         (GLenum)pname,
1426         (GLfloat *)params
1427     );
1428 
1429 exit:
1430     if (_array) {
1431         _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
1432     }
1433     if (_exception) {
1434         jniThrowException(_env, _exceptionType, _exceptionMessage);
1435     }
1436 }
1437 
1438 /* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */
1439 static void
android_glGetLightxv__II_3II(JNIEnv * _env,jobject _this,jint light,jint pname,jintArray params_ref,jint offset)1440 android_glGetLightxv__II_3II
1441   (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) {
1442     jint _exception = 0;
1443     const char * _exceptionType = NULL;
1444     const char * _exceptionMessage = NULL;
1445     GLfixed *params_base = (GLfixed *) 0;
1446     jint _remaining;
1447     GLfixed *params = (GLfixed *) 0;
1448 
1449     if (!params_ref) {
1450         _exception = 1;
1451         _exceptionType = "java/lang/IllegalArgumentException";
1452         _exceptionMessage = "params == null";
1453         goto exit;
1454     }
1455     if (offset < 0) {
1456         _exception = 1;
1457         _exceptionType = "java/lang/IllegalArgumentException";
1458         _exceptionMessage = "offset < 0";
1459         goto exit;
1460     }
1461     _remaining = _env->GetArrayLength(params_ref) - offset;
1462     int _needed;
1463     switch (pname) {
1464 #if defined(GL_SPOT_DIRECTION)
1465         case GL_SPOT_DIRECTION:
1466 #endif // defined(GL_SPOT_DIRECTION)
1467             _needed = 3;
1468             break;
1469 #if defined(GL_AMBIENT)
1470         case GL_AMBIENT:
1471 #endif // defined(GL_AMBIENT)
1472 #if defined(GL_DIFFUSE)
1473         case GL_DIFFUSE:
1474 #endif // defined(GL_DIFFUSE)
1475 #if defined(GL_SPECULAR)
1476         case GL_SPECULAR:
1477 #endif // defined(GL_SPECULAR)
1478 #if defined(GL_EMISSION)
1479         case GL_EMISSION:
1480 #endif // defined(GL_EMISSION)
1481             _needed = 4;
1482             break;
1483         default:
1484             _needed = 1;
1485             break;
1486     }
1487     if (_remaining < _needed) {
1488         _exception = 1;
1489         _exceptionType = "java/lang/IllegalArgumentException";
1490         _exceptionMessage = "length - offset < needed";
1491         goto exit;
1492     }
1493     params_base = (GLfixed *)
1494         _env->GetIntArrayElements(params_ref, (jboolean *)0);
1495     params = params_base + offset;
1496 
1497     glGetLightxv(
1498         (GLenum)light,
1499         (GLenum)pname,
1500         (GLfixed *)params
1501     );
1502 
1503 exit:
1504     if (params_base) {
1505         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
1506             _exception ? JNI_ABORT: 0);
1507     }
1508     if (_exception) {
1509         jniThrowException(_env, _exceptionType, _exceptionMessage);
1510     }
1511 }
1512 
1513 /* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */
1514 static void
android_glGetLightxv__IILjava_nio_IntBuffer_2(JNIEnv * _env,jobject _this,jint light,jint pname,jobject params_buf)1515 android_glGetLightxv__IILjava_nio_IntBuffer_2
1516   (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
1517     jint _exception = 0;
1518     const char * _exceptionType = NULL;
1519     const char * _exceptionMessage = NULL;
1520     jintArray _array = (jintArray) 0;
1521     jint _bufferOffset = (jint) 0;
1522     jint _remaining;
1523     GLfixed *params = (GLfixed *) 0;
1524 
1525     if (!params_buf) {
1526         _exception = 1;
1527         _exceptionType = "java/lang/IllegalArgumentException";
1528         _exceptionMessage = "params == null";
1529         goto exit;
1530     }
1531     params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1532     int _needed;
1533     switch (pname) {
1534 #if defined(GL_SPOT_DIRECTION)
1535         case GL_SPOT_DIRECTION:
1536 #endif // defined(GL_SPOT_DIRECTION)
1537             _needed = 3;
1538             break;
1539 #if defined(GL_AMBIENT)
1540         case GL_AMBIENT:
1541 #endif // defined(GL_AMBIENT)
1542 #if defined(GL_DIFFUSE)
1543         case GL_DIFFUSE:
1544 #endif // defined(GL_DIFFUSE)
1545 #if defined(GL_SPECULAR)
1546         case GL_SPECULAR:
1547 #endif // defined(GL_SPECULAR)
1548 #if defined(GL_EMISSION)
1549         case GL_EMISSION:
1550 #endif // defined(GL_EMISSION)
1551             _needed = 4;
1552             break;
1553         default:
1554             _needed = 1;
1555             break;
1556     }
1557     if (_remaining < _needed) {
1558         _exception = 1;
1559         _exceptionType = "java/lang/IllegalArgumentException";
1560         _exceptionMessage = "remaining() < needed";
1561         goto exit;
1562     }
1563     if (params == NULL) {
1564         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1565         params = (GLfixed *) (_paramsBase + _bufferOffset);
1566     }
1567     glGetLightxv(
1568         (GLenum)light,
1569         (GLenum)pname,
1570         (GLfixed *)params
1571     );
1572 
1573 exit:
1574     if (_array) {
1575         _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
1576     }
1577     if (_exception) {
1578         jniThrowException(_env, _exceptionType, _exceptionMessage);
1579     }
1580 }
1581 
1582 /* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */
1583 static void
android_glGetMaterialfv__II_3FI(JNIEnv * _env,jobject _this,jint face,jint pname,jfloatArray params_ref,jint offset)1584 android_glGetMaterialfv__II_3FI
1585   (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) {
1586     jint _exception = 0;
1587     const char * _exceptionType = NULL;
1588     const char * _exceptionMessage = NULL;
1589     GLfloat *params_base = (GLfloat *) 0;
1590     jint _remaining;
1591     GLfloat *params = (GLfloat *) 0;
1592 
1593     if (!params_ref) {
1594         _exception = 1;
1595         _exceptionType = "java/lang/IllegalArgumentException";
1596         _exceptionMessage = "params == null";
1597         goto exit;
1598     }
1599     if (offset < 0) {
1600         _exception = 1;
1601         _exceptionType = "java/lang/IllegalArgumentException";
1602         _exceptionMessage = "offset < 0";
1603         goto exit;
1604     }
1605     _remaining = _env->GetArrayLength(params_ref) - offset;
1606     int _needed;
1607     switch (pname) {
1608 #if defined(GL_AMBIENT)
1609         case GL_AMBIENT:
1610 #endif // defined(GL_AMBIENT)
1611 #if defined(GL_DIFFUSE)
1612         case GL_DIFFUSE:
1613 #endif // defined(GL_DIFFUSE)
1614 #if defined(GL_SPECULAR)
1615         case GL_SPECULAR:
1616 #endif // defined(GL_SPECULAR)
1617 #if defined(GL_EMISSION)
1618         case GL_EMISSION:
1619 #endif // defined(GL_EMISSION)
1620 #if defined(GL_AMBIENT_AND_DIFFUSE)
1621         case GL_AMBIENT_AND_DIFFUSE:
1622 #endif // defined(GL_AMBIENT_AND_DIFFUSE)
1623             _needed = 4;
1624             break;
1625         default:
1626             _needed = 1;
1627             break;
1628     }
1629     if (_remaining < _needed) {
1630         _exception = 1;
1631         _exceptionType = "java/lang/IllegalArgumentException";
1632         _exceptionMessage = "length - offset < needed";
1633         goto exit;
1634     }
1635     params_base = (GLfloat *)
1636         _env->GetFloatArrayElements(params_ref, (jboolean *)0);
1637     params = params_base + offset;
1638 
1639     glGetMaterialfv(
1640         (GLenum)face,
1641         (GLenum)pname,
1642         (GLfloat *)params
1643     );
1644 
1645 exit:
1646     if (params_base) {
1647         _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
1648             _exception ? JNI_ABORT: 0);
1649     }
1650     if (_exception) {
1651         jniThrowException(_env, _exceptionType, _exceptionMessage);
1652     }
1653 }
1654 
1655 /* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */
1656 static void
android_glGetMaterialfv__IILjava_nio_FloatBuffer_2(JNIEnv * _env,jobject _this,jint face,jint pname,jobject params_buf)1657 android_glGetMaterialfv__IILjava_nio_FloatBuffer_2
1658   (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
1659     jint _exception = 0;
1660     const char * _exceptionType = NULL;
1661     const char * _exceptionMessage = NULL;
1662     jfloatArray _array = (jfloatArray) 0;
1663     jint _bufferOffset = (jint) 0;
1664     jint _remaining;
1665     GLfloat *params = (GLfloat *) 0;
1666 
1667     if (!params_buf) {
1668         _exception = 1;
1669         _exceptionType = "java/lang/IllegalArgumentException";
1670         _exceptionMessage = "params == null";
1671         goto exit;
1672     }
1673     params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1674     int _needed;
1675     switch (pname) {
1676 #if defined(GL_AMBIENT)
1677         case GL_AMBIENT:
1678 #endif // defined(GL_AMBIENT)
1679 #if defined(GL_DIFFUSE)
1680         case GL_DIFFUSE:
1681 #endif // defined(GL_DIFFUSE)
1682 #if defined(GL_SPECULAR)
1683         case GL_SPECULAR:
1684 #endif // defined(GL_SPECULAR)
1685 #if defined(GL_EMISSION)
1686         case GL_EMISSION:
1687 #endif // defined(GL_EMISSION)
1688 #if defined(GL_AMBIENT_AND_DIFFUSE)
1689         case GL_AMBIENT_AND_DIFFUSE:
1690 #endif // defined(GL_AMBIENT_AND_DIFFUSE)
1691             _needed = 4;
1692             break;
1693         default:
1694             _needed = 1;
1695             break;
1696     }
1697     if (_remaining < _needed) {
1698         _exception = 1;
1699         _exceptionType = "java/lang/IllegalArgumentException";
1700         _exceptionMessage = "remaining() < needed";
1701         goto exit;
1702     }
1703     if (params == NULL) {
1704         char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
1705         params = (GLfloat *) (_paramsBase + _bufferOffset);
1706     }
1707     glGetMaterialfv(
1708         (GLenum)face,
1709         (GLenum)pname,
1710         (GLfloat *)params
1711     );
1712 
1713 exit:
1714     if (_array) {
1715         _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
1716     }
1717     if (_exception) {
1718         jniThrowException(_env, _exceptionType, _exceptionMessage);
1719     }
1720 }
1721 
1722 /* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */
1723 static void
android_glGetMaterialxv__II_3II(JNIEnv * _env,jobject _this,jint face,jint pname,jintArray params_ref,jint offset)1724 android_glGetMaterialxv__II_3II
1725   (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) {
1726     jint _exception = 0;
1727     const char * _exceptionType = NULL;
1728     const char * _exceptionMessage = NULL;
1729     GLfixed *params_base = (GLfixed *) 0;
1730     jint _remaining;
1731     GLfixed *params = (GLfixed *) 0;
1732 
1733     if (!params_ref) {
1734         _exception = 1;
1735         _exceptionType = "java/lang/IllegalArgumentException";
1736         _exceptionMessage = "params == null";
1737         goto exit;
1738     }
1739     if (offset < 0) {
1740         _exception = 1;
1741         _exceptionType = "java/lang/IllegalArgumentException";
1742         _exceptionMessage = "offset < 0";
1743         goto exit;
1744     }
1745     _remaining = _env->GetArrayLength(params_ref) - offset;
1746     int _needed;
1747     switch (pname) {
1748 #if defined(GL_AMBIENT)
1749         case GL_AMBIENT:
1750 #endif // defined(GL_AMBIENT)
1751 #if defined(GL_DIFFUSE)
1752         case GL_DIFFUSE:
1753 #endif // defined(GL_DIFFUSE)
1754 #if defined(GL_SPECULAR)
1755         case GL_SPECULAR:
1756 #endif // defined(GL_SPECULAR)
1757 #if defined(GL_EMISSION)
1758         case GL_EMISSION:
1759 #endif // defined(GL_EMISSION)
1760 #if defined(GL_AMBIENT_AND_DIFFUSE)
1761         case GL_AMBIENT_AND_DIFFUSE:
1762 #endif // defined(GL_AMBIENT_AND_DIFFUSE)
1763             _needed = 4;
1764             break;
1765         default:
1766             _needed = 1;
1767             break;
1768     }
1769     if (_remaining < _needed) {
1770         _exception = 1;
1771         _exceptionType = "java/lang/IllegalArgumentException";
1772         _exceptionMessage = "length - offset < needed";
1773         goto exit;
1774     }
1775     params_base = (GLfixed *)
1776         _env->GetIntArrayElements(params_ref, (jboolean *)0);
1777     params = params_base + offset;
1778 
1779     glGetMaterialxv(
1780         (GLenum)face,
1781         (GLenum)pname,
1782         (GLfixed *)params
1783     );
1784 
1785 exit:
1786     if (params_base) {
1787         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
1788             _exception ? JNI_ABORT: 0);
1789     }
1790     if (_exception) {
1791         jniThrowException(_env, _exceptionType, _exceptionMessage);
1792     }
1793 }
1794 
1795 /* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */
1796 static void
android_glGetMaterialxv__IILjava_nio_IntBuffer_2(JNIEnv * _env,jobject _this,jint face,jint pname,jobject params_buf)1797 android_glGetMaterialxv__IILjava_nio_IntBuffer_2
1798   (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
1799     jint _exception = 0;
1800     const char * _exceptionType = NULL;
1801     const char * _exceptionMessage = NULL;
1802     jintArray _array = (jintArray) 0;
1803     jint _bufferOffset = (jint) 0;
1804     jint _remaining;
1805     GLfixed *params = (GLfixed *) 0;
1806 
1807     if (!params_buf) {
1808         _exception = 1;
1809         _exceptionType = "java/lang/IllegalArgumentException";
1810         _exceptionMessage = "params == null";
1811         goto exit;
1812     }
1813     params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1814     int _needed;
1815     switch (pname) {
1816 #if defined(GL_AMBIENT)
1817         case GL_AMBIENT:
1818 #endif // defined(GL_AMBIENT)
1819 #if defined(GL_DIFFUSE)
1820         case GL_DIFFUSE:
1821 #endif // defined(GL_DIFFUSE)
1822 #if defined(GL_SPECULAR)
1823         case GL_SPECULAR:
1824 #endif // defined(GL_SPECULAR)
1825 #if defined(GL_EMISSION)
1826         case GL_EMISSION:
1827 #endif // defined(GL_EMISSION)
1828 #if defined(GL_AMBIENT_AND_DIFFUSE)
1829         case GL_AMBIENT_AND_DIFFUSE:
1830 #endif // defined(GL_AMBIENT_AND_DIFFUSE)
1831             _needed = 4;
1832             break;
1833         default:
1834             _needed = 1;
1835             break;
1836     }
1837     if (_remaining < _needed) {
1838         _exception = 1;
1839         _exceptionType = "java/lang/IllegalArgumentException";
1840         _exceptionMessage = "remaining() < needed";
1841         goto exit;
1842     }
1843     if (params == NULL) {
1844         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1845         params = (GLfixed *) (_paramsBase + _bufferOffset);
1846     }
1847     glGetMaterialxv(
1848         (GLenum)face,
1849         (GLenum)pname,
1850         (GLfixed *)params
1851     );
1852 
1853 exit:
1854     if (_array) {
1855         _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
1856     }
1857     if (_exception) {
1858         jniThrowException(_env, _exceptionType, _exceptionMessage);
1859     }
1860 }
1861 
1862 /* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */
1863 static void
android_glGetTexEnvfv__II_3FI(JNIEnv * _env,jobject _this,jint env,jint pname,jfloatArray params_ref,jint offset)1864 android_glGetTexEnvfv__II_3FI
1865   (JNIEnv *_env, jobject _this, jint env, jint pname, jfloatArray params_ref, jint offset) {
1866     jint _exception = 0;
1867     const char * _exceptionType = NULL;
1868     const char * _exceptionMessage = NULL;
1869     GLfloat *params_base = (GLfloat *) 0;
1870     jint _remaining;
1871     GLfloat *params = (GLfloat *) 0;
1872 
1873     if (!params_ref) {
1874         _exception = 1;
1875         _exceptionType = "java/lang/IllegalArgumentException";
1876         _exceptionMessage = "params == null";
1877         goto exit;
1878     }
1879     if (offset < 0) {
1880         _exception = 1;
1881         _exceptionType = "java/lang/IllegalArgumentException";
1882         _exceptionMessage = "offset < 0";
1883         goto exit;
1884     }
1885     _remaining = _env->GetArrayLength(params_ref) - offset;
1886     int _needed;
1887     switch (pname) {
1888 #if defined(GL_TEXTURE_ENV_COLOR)
1889         case GL_TEXTURE_ENV_COLOR:
1890 #endif // defined(GL_TEXTURE_ENV_COLOR)
1891             _needed = 4;
1892             break;
1893         default:
1894             _needed = 1;
1895             break;
1896     }
1897     if (_remaining < _needed) {
1898         _exception = 1;
1899         _exceptionType = "java/lang/IllegalArgumentException";
1900         _exceptionMessage = "length - offset < needed";
1901         goto exit;
1902     }
1903     params_base = (GLfloat *)
1904         _env->GetFloatArrayElements(params_ref, (jboolean *)0);
1905     params = params_base + offset;
1906 
1907     glGetTexEnvfv(
1908         (GLenum)env,
1909         (GLenum)pname,
1910         (GLfloat *)params
1911     );
1912 
1913 exit:
1914     if (params_base) {
1915         _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
1916             _exception ? JNI_ABORT: 0);
1917     }
1918     if (_exception) {
1919         jniThrowException(_env, _exceptionType, _exceptionMessage);
1920     }
1921 }
1922 
1923 /* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */
1924 static void
android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2(JNIEnv * _env,jobject _this,jint env,jint pname,jobject params_buf)1925 android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2
1926   (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
1927     jint _exception = 0;
1928     const char * _exceptionType = NULL;
1929     const char * _exceptionMessage = NULL;
1930     jfloatArray _array = (jfloatArray) 0;
1931     jint _bufferOffset = (jint) 0;
1932     jint _remaining;
1933     GLfloat *params = (GLfloat *) 0;
1934 
1935     if (!params_buf) {
1936         _exception = 1;
1937         _exceptionType = "java/lang/IllegalArgumentException";
1938         _exceptionMessage = "params == null";
1939         goto exit;
1940     }
1941     params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1942     int _needed;
1943     switch (pname) {
1944 #if defined(GL_TEXTURE_ENV_COLOR)
1945         case GL_TEXTURE_ENV_COLOR:
1946 #endif // defined(GL_TEXTURE_ENV_COLOR)
1947             _needed = 4;
1948             break;
1949         default:
1950             _needed = 1;
1951             break;
1952     }
1953     if (_remaining < _needed) {
1954         _exception = 1;
1955         _exceptionType = "java/lang/IllegalArgumentException";
1956         _exceptionMessage = "remaining() < needed";
1957         goto exit;
1958     }
1959     if (params == NULL) {
1960         char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
1961         params = (GLfloat *) (_paramsBase + _bufferOffset);
1962     }
1963     glGetTexEnvfv(
1964         (GLenum)env,
1965         (GLenum)pname,
1966         (GLfloat *)params
1967     );
1968 
1969 exit:
1970     if (_array) {
1971         _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
1972     }
1973     if (_exception) {
1974         jniThrowException(_env, _exceptionType, _exceptionMessage);
1975     }
1976 }
1977 
1978 /* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */
1979 static void
android_glGetTexEnviv__II_3II(JNIEnv * _env,jobject _this,jint env,jint pname,jintArray params_ref,jint offset)1980 android_glGetTexEnviv__II_3II
1981   (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) {
1982     jint _exception = 0;
1983     const char * _exceptionType = NULL;
1984     const char * _exceptionMessage = NULL;
1985     GLint *params_base = (GLint *) 0;
1986     jint _remaining;
1987     GLint *params = (GLint *) 0;
1988 
1989     if (!params_ref) {
1990         _exception = 1;
1991         _exceptionType = "java/lang/IllegalArgumentException";
1992         _exceptionMessage = "params == null";
1993         goto exit;
1994     }
1995     if (offset < 0) {
1996         _exception = 1;
1997         _exceptionType = "java/lang/IllegalArgumentException";
1998         _exceptionMessage = "offset < 0";
1999         goto exit;
2000     }
2001     _remaining = _env->GetArrayLength(params_ref) - offset;
2002     int _needed;
2003     switch (pname) {
2004 #if defined(GL_TEXTURE_ENV_COLOR)
2005         case GL_TEXTURE_ENV_COLOR:
2006 #endif // defined(GL_TEXTURE_ENV_COLOR)
2007             _needed = 4;
2008             break;
2009         default:
2010             _needed = 1;
2011             break;
2012     }
2013     if (_remaining < _needed) {
2014         _exception = 1;
2015         _exceptionType = "java/lang/IllegalArgumentException";
2016         _exceptionMessage = "length - offset < needed";
2017         goto exit;
2018     }
2019     params_base = (GLint *)
2020         _env->GetIntArrayElements(params_ref, (jboolean *)0);
2021     params = params_base + offset;
2022 
2023     glGetTexEnviv(
2024         (GLenum)env,
2025         (GLenum)pname,
2026         (GLint *)params
2027     );
2028 
2029 exit:
2030     if (params_base) {
2031         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
2032             _exception ? JNI_ABORT: 0);
2033     }
2034     if (_exception) {
2035         jniThrowException(_env, _exceptionType, _exceptionMessage);
2036     }
2037 }
2038 
2039 /* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */
2040 static void
android_glGetTexEnviv__IILjava_nio_IntBuffer_2(JNIEnv * _env,jobject _this,jint env,jint pname,jobject params_buf)2041 android_glGetTexEnviv__IILjava_nio_IntBuffer_2
2042   (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
2043     jint _exception = 0;
2044     const char * _exceptionType = NULL;
2045     const char * _exceptionMessage = NULL;
2046     jintArray _array = (jintArray) 0;
2047     jint _bufferOffset = (jint) 0;
2048     jint _remaining;
2049     GLint *params = (GLint *) 0;
2050 
2051     if (!params_buf) {
2052         _exception = 1;
2053         _exceptionType = "java/lang/IllegalArgumentException";
2054         _exceptionMessage = "params == null";
2055         goto exit;
2056     }
2057     params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2058     int _needed;
2059     switch (pname) {
2060 #if defined(GL_TEXTURE_ENV_COLOR)
2061         case GL_TEXTURE_ENV_COLOR:
2062 #endif // defined(GL_TEXTURE_ENV_COLOR)
2063             _needed = 4;
2064             break;
2065         default:
2066             _needed = 1;
2067             break;
2068     }
2069     if (_remaining < _needed) {
2070         _exception = 1;
2071         _exceptionType = "java/lang/IllegalArgumentException";
2072         _exceptionMessage = "remaining() < needed";
2073         goto exit;
2074     }
2075     if (params == NULL) {
2076         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
2077         params = (GLint *) (_paramsBase + _bufferOffset);
2078     }
2079     glGetTexEnviv(
2080         (GLenum)env,
2081         (GLenum)pname,
2082         (GLint *)params
2083     );
2084 
2085 exit:
2086     if (_array) {
2087         _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
2088     }
2089     if (_exception) {
2090         jniThrowException(_env, _exceptionType, _exceptionMessage);
2091     }
2092 }
2093 
2094 /* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */
2095 static void
android_glGetTexEnvxv__II_3II(JNIEnv * _env,jobject _this,jint env,jint pname,jintArray params_ref,jint offset)2096 android_glGetTexEnvxv__II_3II
2097   (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) {
2098     jint _exception = 0;
2099     const char * _exceptionType = NULL;
2100     const char * _exceptionMessage = NULL;
2101     GLfixed *params_base = (GLfixed *) 0;
2102     jint _remaining;
2103     GLfixed *params = (GLfixed *) 0;
2104 
2105     if (!params_ref) {
2106         _exception = 1;
2107         _exceptionType = "java/lang/IllegalArgumentException";
2108         _exceptionMessage = "params == null";
2109         goto exit;
2110     }
2111     if (offset < 0) {
2112         _exception = 1;
2113         _exceptionType = "java/lang/IllegalArgumentException";
2114         _exceptionMessage = "offset < 0";
2115         goto exit;
2116     }
2117     _remaining = _env->GetArrayLength(params_ref) - offset;
2118     int _needed;
2119     switch (pname) {
2120 #if defined(GL_TEXTURE_ENV_COLOR)
2121         case GL_TEXTURE_ENV_COLOR:
2122 #endif // defined(GL_TEXTURE_ENV_COLOR)
2123             _needed = 4;
2124             break;
2125         default:
2126             _needed = 1;
2127             break;
2128     }
2129     if (_remaining < _needed) {
2130         _exception = 1;
2131         _exceptionType = "java/lang/IllegalArgumentException";
2132         _exceptionMessage = "length - offset < needed";
2133         goto exit;
2134     }
2135     params_base = (GLfixed *)
2136         _env->GetIntArrayElements(params_ref, (jboolean *)0);
2137     params = params_base + offset;
2138 
2139     glGetTexEnvxv(
2140         (GLenum)env,
2141         (GLenum)pname,
2142         (GLfixed *)params
2143     );
2144 
2145 exit:
2146     if (params_base) {
2147         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
2148             _exception ? JNI_ABORT: 0);
2149     }
2150     if (_exception) {
2151         jniThrowException(_env, _exceptionType, _exceptionMessage);
2152     }
2153 }
2154 
2155 /* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */
2156 static void
android_glGetTexEnvxv__IILjava_nio_IntBuffer_2(JNIEnv * _env,jobject _this,jint env,jint pname,jobject params_buf)2157 android_glGetTexEnvxv__IILjava_nio_IntBuffer_2
2158   (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
2159     jint _exception = 0;
2160     const char * _exceptionType = NULL;
2161     const char * _exceptionMessage = NULL;
2162     jintArray _array = (jintArray) 0;
2163     jint _bufferOffset = (jint) 0;
2164     jint _remaining;
2165     GLfixed *params = (GLfixed *) 0;
2166 
2167     if (!params_buf) {
2168         _exception = 1;
2169         _exceptionType = "java/lang/IllegalArgumentException";
2170         _exceptionMessage = "params == null";
2171         goto exit;
2172     }
2173     params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2174     int _needed;
2175     switch (pname) {
2176 #if defined(GL_TEXTURE_ENV_COLOR)
2177         case GL_TEXTURE_ENV_COLOR:
2178 #endif // defined(GL_TEXTURE_ENV_COLOR)
2179             _needed = 4;
2180             break;
2181         default:
2182             _needed = 1;
2183             break;
2184     }
2185     if (_remaining < _needed) {
2186         _exception = 1;
2187         _exceptionType = "java/lang/IllegalArgumentException";
2188         _exceptionMessage = "remaining() < needed";
2189         goto exit;
2190     }
2191     if (params == NULL) {
2192         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
2193         params = (GLfixed *) (_paramsBase + _bufferOffset);
2194     }
2195     glGetTexEnvxv(
2196         (GLenum)env,
2197         (GLenum)pname,
2198         (GLfixed *)params
2199     );
2200 
2201 exit:
2202     if (_array) {
2203         _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
2204     }
2205     if (_exception) {
2206         jniThrowException(_env, _exceptionType, _exceptionMessage);
2207     }
2208 }
2209 
2210 /* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
2211 static void
android_glGetTexParameterfv__II_3FI(JNIEnv * _env,jobject _this,jint target,jint pname,jfloatArray params_ref,jint offset)2212 android_glGetTexParameterfv__II_3FI
2213   (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
2214     jint _exception = 0;
2215     const char * _exceptionType = NULL;
2216     const char * _exceptionMessage = NULL;
2217     GLfloat *params_base = (GLfloat *) 0;
2218     jint _remaining;
2219     GLfloat *params = (GLfloat *) 0;
2220 
2221     if (!params_ref) {
2222         _exception = 1;
2223         _exceptionType = "java/lang/IllegalArgumentException";
2224         _exceptionMessage = "params == null";
2225         goto exit;
2226     }
2227     if (offset < 0) {
2228         _exception = 1;
2229         _exceptionType = "java/lang/IllegalArgumentException";
2230         _exceptionMessage = "offset < 0";
2231         goto exit;
2232     }
2233     _remaining = _env->GetArrayLength(params_ref) - offset;
2234     if (_remaining < 1) {
2235         _exception = 1;
2236         _exceptionType = "java/lang/IllegalArgumentException";
2237         _exceptionMessage = "length - offset < 1 < needed";
2238         goto exit;
2239     }
2240     params_base = (GLfloat *)
2241         _env->GetFloatArrayElements(params_ref, (jboolean *)0);
2242     params = params_base + offset;
2243 
2244     glGetTexParameterfv(
2245         (GLenum)target,
2246         (GLenum)pname,
2247         (GLfloat *)params
2248     );
2249 
2250 exit:
2251     if (params_base) {
2252         _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
2253             _exception ? JNI_ABORT: 0);
2254     }
2255     if (_exception) {
2256         jniThrowException(_env, _exceptionType, _exceptionMessage);
2257     }
2258 }
2259 
2260 /* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
2261 static void
android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2(JNIEnv * _env,jobject _this,jint target,jint pname,jobject params_buf)2262 android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2
2263   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2264     jint _exception = 0;
2265     const char * _exceptionType = NULL;
2266     const char * _exceptionMessage = NULL;
2267     jfloatArray _array = (jfloatArray) 0;
2268     jint _bufferOffset = (jint) 0;
2269     jint _remaining;
2270     GLfloat *params = (GLfloat *) 0;
2271 
2272     if (!params_buf) {
2273         _exception = 1;
2274         _exceptionType = "java/lang/IllegalArgumentException";
2275         _exceptionMessage = "params == null";
2276         goto exit;
2277     }
2278     params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2279     if (_remaining < 1) {
2280         _exception = 1;
2281         _exceptionType = "java/lang/IllegalArgumentException";
2282         _exceptionMessage = "remaining() < 1 < needed";
2283         goto exit;
2284     }
2285     if (params == NULL) {
2286         char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
2287         params = (GLfloat *) (_paramsBase + _bufferOffset);
2288     }
2289     glGetTexParameterfv(
2290         (GLenum)target,
2291         (GLenum)pname,
2292         (GLfloat *)params
2293     );
2294 
2295 exit:
2296     if (_array) {
2297         _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
2298     }
2299     if (_exception) {
2300         jniThrowException(_env, _exceptionType, _exceptionMessage);
2301     }
2302 }
2303 
2304 /* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2305 static void
android_glGetTexParameteriv__II_3II(JNIEnv * _env,jobject _this,jint target,jint pname,jintArray params_ref,jint offset)2306 android_glGetTexParameteriv__II_3II
2307   (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2308     jint _exception = 0;
2309     const char * _exceptionType = NULL;
2310     const char * _exceptionMessage = NULL;
2311     GLint *params_base = (GLint *) 0;
2312     jint _remaining;
2313     GLint *params = (GLint *) 0;
2314 
2315     if (!params_ref) {
2316         _exception = 1;
2317         _exceptionType = "java/lang/IllegalArgumentException";
2318         _exceptionMessage = "params == null";
2319         goto exit;
2320     }
2321     if (offset < 0) {
2322         _exception = 1;
2323         _exceptionType = "java/lang/IllegalArgumentException";
2324         _exceptionMessage = "offset < 0";
2325         goto exit;
2326     }
2327     _remaining = _env->GetArrayLength(params_ref) - offset;
2328     if (_remaining < 1) {
2329         _exception = 1;
2330         _exceptionType = "java/lang/IllegalArgumentException";
2331         _exceptionMessage = "length - offset < 1 < needed";
2332         goto exit;
2333     }
2334     params_base = (GLint *)
2335         _env->GetIntArrayElements(params_ref, (jboolean *)0);
2336     params = params_base + offset;
2337 
2338     glGetTexParameteriv(
2339         (GLenum)target,
2340         (GLenum)pname,
2341         (GLint *)params
2342     );
2343 
2344 exit:
2345     if (params_base) {
2346         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
2347             _exception ? JNI_ABORT: 0);
2348     }
2349     if (_exception) {
2350         jniThrowException(_env, _exceptionType, _exceptionMessage);
2351     }
2352 }
2353 
2354 /* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2355 static void
android_glGetTexParameteriv__IILjava_nio_IntBuffer_2(JNIEnv * _env,jobject _this,jint target,jint pname,jobject params_buf)2356 android_glGetTexParameteriv__IILjava_nio_IntBuffer_2
2357   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2358     jint _exception = 0;
2359     const char * _exceptionType = NULL;
2360     const char * _exceptionMessage = NULL;
2361     jintArray _array = (jintArray) 0;
2362     jint _bufferOffset = (jint) 0;
2363     jint _remaining;
2364     GLint *params = (GLint *) 0;
2365 
2366     if (!params_buf) {
2367         _exception = 1;
2368         _exceptionType = "java/lang/IllegalArgumentException";
2369         _exceptionMessage = "params == null";
2370         goto exit;
2371     }
2372     params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2373     if (_remaining < 1) {
2374         _exception = 1;
2375         _exceptionType = "java/lang/IllegalArgumentException";
2376         _exceptionMessage = "remaining() < 1 < needed";
2377         goto exit;
2378     }
2379     if (params == NULL) {
2380         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
2381         params = (GLint *) (_paramsBase + _bufferOffset);
2382     }
2383     glGetTexParameteriv(
2384         (GLenum)target,
2385         (GLenum)pname,
2386         (GLint *)params
2387     );
2388 
2389 exit:
2390     if (_array) {
2391         _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
2392     }
2393     if (_exception) {
2394         jniThrowException(_env, _exceptionType, _exceptionMessage);
2395     }
2396 }
2397 
2398 /* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */
2399 static void
android_glGetTexParameterxv__II_3II(JNIEnv * _env,jobject _this,jint target,jint pname,jintArray params_ref,jint offset)2400 android_glGetTexParameterxv__II_3II
2401   (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2402     jint _exception = 0;
2403     const char * _exceptionType = NULL;
2404     const char * _exceptionMessage = NULL;
2405     GLfixed *params_base = (GLfixed *) 0;
2406     jint _remaining;
2407     GLfixed *params = (GLfixed *) 0;
2408 
2409     if (!params_ref) {
2410         _exception = 1;
2411         _exceptionType = "java/lang/IllegalArgumentException";
2412         _exceptionMessage = "params == null";
2413         goto exit;
2414     }
2415     if (offset < 0) {
2416         _exception = 1;
2417         _exceptionType = "java/lang/IllegalArgumentException";
2418         _exceptionMessage = "offset < 0";
2419         goto exit;
2420     }
2421     _remaining = _env->GetArrayLength(params_ref) - offset;
2422     if (_remaining < 1) {
2423         _exception = 1;
2424         _exceptionType = "java/lang/IllegalArgumentException";
2425         _exceptionMessage = "length - offset < 1 < needed";
2426         goto exit;
2427     }
2428     params_base = (GLfixed *)
2429         _env->GetIntArrayElements(params_ref, (jboolean *)0);
2430     params = params_base + offset;
2431 
2432     glGetTexParameterxv(
2433         (GLenum)target,
2434         (GLenum)pname,
2435         (GLfixed *)params
2436     );
2437 
2438 exit:
2439     if (params_base) {
2440         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
2441             _exception ? JNI_ABORT: 0);
2442     }
2443     if (_exception) {
2444         jniThrowException(_env, _exceptionType, _exceptionMessage);
2445     }
2446 }
2447 
2448 /* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */
2449 static void
android_glGetTexParameterxv__IILjava_nio_IntBuffer_2(JNIEnv * _env,jobject _this,jint target,jint pname,jobject params_buf)2450 android_glGetTexParameterxv__IILjava_nio_IntBuffer_2
2451   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2452     jint _exception = 0;
2453     const char * _exceptionType = NULL;
2454     const char * _exceptionMessage = NULL;
2455     jintArray _array = (jintArray) 0;
2456     jint _bufferOffset = (jint) 0;
2457     jint _remaining;
2458     GLfixed *params = (GLfixed *) 0;
2459 
2460     if (!params_buf) {
2461         _exception = 1;
2462         _exceptionType = "java/lang/IllegalArgumentException";
2463         _exceptionMessage = "params == null";
2464         goto exit;
2465     }
2466     params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2467     if (_remaining < 1) {
2468         _exception = 1;
2469         _exceptionType = "java/lang/IllegalArgumentException";
2470         _exceptionMessage = "remaining() < 1 < needed";
2471         goto exit;
2472     }
2473     if (params == NULL) {
2474         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
2475         params = (GLfixed *) (_paramsBase + _bufferOffset);
2476     }
2477     glGetTexParameterxv(
2478         (GLenum)target,
2479         (GLenum)pname,
2480         (GLfixed *)params
2481     );
2482 
2483 exit:
2484     if (_array) {
2485         _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
2486     }
2487     if (_exception) {
2488         jniThrowException(_env, _exceptionType, _exceptionMessage);
2489     }
2490 }
2491 
2492 /* GLboolean glIsBuffer ( GLuint buffer ) */
2493 static jboolean
android_glIsBuffer__I(JNIEnv * _env,jobject _this,jint buffer)2494 android_glIsBuffer__I
2495   (JNIEnv *_env, jobject _this, jint buffer) {
2496     GLboolean _returnValue;
2497     _returnValue = glIsBuffer(
2498         (GLuint)buffer
2499     );
2500     return (jboolean)_returnValue;
2501 }
2502 
2503 /* GLboolean glIsEnabled ( GLenum cap ) */
2504 static jboolean
android_glIsEnabled__I(JNIEnv * _env,jobject _this,jint cap)2505 android_glIsEnabled__I
2506   (JNIEnv *_env, jobject _this, jint cap) {
2507     GLboolean _returnValue;
2508     _returnValue = glIsEnabled(
2509         (GLenum)cap
2510     );
2511     return (jboolean)_returnValue;
2512 }
2513 
2514 /* GLboolean glIsTexture ( GLuint texture ) */
2515 static jboolean
android_glIsTexture__I(JNIEnv * _env,jobject _this,jint texture)2516 android_glIsTexture__I
2517   (JNIEnv *_env, jobject _this, jint texture) {
2518     GLboolean _returnValue;
2519     _returnValue = glIsTexture(
2520         (GLuint)texture
2521     );
2522     return (jboolean)_returnValue;
2523 }
2524 
2525 /* void glNormalPointer ( GLenum type, GLsizei stride, GLint offset ) */
2526 static void
android_glNormalPointer__III(JNIEnv * _env,jobject _this,jint type,jint stride,jint offset)2527 android_glNormalPointer__III
2528   (JNIEnv *_env, jobject _this, jint type, jint stride, jint offset) {
2529     glNormalPointer(
2530         (GLenum)type,
2531         (GLsizei)stride,
2532         reinterpret_cast<GLvoid *>(offset)
2533     );
2534 }
2535 
2536 /* void glPointParameterf ( GLenum pname, GLfloat param ) */
2537 static void
android_glPointParameterf__IF(JNIEnv * _env,jobject _this,jint pname,jfloat param)2538 android_glPointParameterf__IF
2539   (JNIEnv *_env, jobject _this, jint pname, jfloat param) {
2540     glPointParameterf(
2541         (GLenum)pname,
2542         (GLfloat)param
2543     );
2544 }
2545 
2546 /* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */
2547 static void
android_glPointParameterfv__I_3FI(JNIEnv * _env,jobject _this,jint pname,jfloatArray params_ref,jint offset)2548 android_glPointParameterfv__I_3FI
2549   (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
2550     jint _exception = 0;
2551     const char * _exceptionType = NULL;
2552     const char * _exceptionMessage = NULL;
2553     GLfloat *params_base = (GLfloat *) 0;
2554     jint _remaining;
2555     GLfloat *params = (GLfloat *) 0;
2556 
2557     if (!params_ref) {
2558         _exception = 1;
2559         _exceptionType = "java/lang/IllegalArgumentException";
2560         _exceptionMessage = "params == null";
2561         goto exit;
2562     }
2563     if (offset < 0) {
2564         _exception = 1;
2565         _exceptionType = "java/lang/IllegalArgumentException";
2566         _exceptionMessage = "offset < 0";
2567         goto exit;
2568     }
2569     _remaining = _env->GetArrayLength(params_ref) - offset;
2570     if (_remaining < 1) {
2571         _exception = 1;
2572         _exceptionType = "java/lang/IllegalArgumentException";
2573         _exceptionMessage = "length - offset < 1 < needed";
2574         goto exit;
2575     }
2576     params_base = (GLfloat *)
2577         _env->GetFloatArrayElements(params_ref, (jboolean *)0);
2578     params = params_base + offset;
2579 
2580     glPointParameterfv(
2581         (GLenum)pname,
2582         (GLfloat *)params
2583     );
2584 
2585 exit:
2586     if (params_base) {
2587         _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
2588             JNI_ABORT);
2589     }
2590     if (_exception) {
2591         jniThrowException(_env, _exceptionType, _exceptionMessage);
2592     }
2593 }
2594 
2595 /* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */
2596 static void
android_glPointParameterfv__ILjava_nio_FloatBuffer_2(JNIEnv * _env,jobject _this,jint pname,jobject params_buf)2597 android_glPointParameterfv__ILjava_nio_FloatBuffer_2
2598   (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
2599     jint _exception = 0;
2600     const char * _exceptionType = NULL;
2601     const char * _exceptionMessage = NULL;
2602     jfloatArray _array = (jfloatArray) 0;
2603     jint _bufferOffset = (jint) 0;
2604     jint _remaining;
2605     GLfloat *params = (GLfloat *) 0;
2606 
2607     if (!params_buf) {
2608         _exception = 1;
2609         _exceptionType = "java/lang/IllegalArgumentException";
2610         _exceptionMessage = "params == null";
2611         goto exit;
2612     }
2613     params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2614     if (_remaining < 1) {
2615         _exception = 1;
2616         _exceptionType = "java/lang/IllegalArgumentException";
2617         _exceptionMessage = "remaining() < 1 < needed";
2618         goto exit;
2619     }
2620     if (params == NULL) {
2621         char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
2622         params = (GLfloat *) (_paramsBase + _bufferOffset);
2623     }
2624     glPointParameterfv(
2625         (GLenum)pname,
2626         (GLfloat *)params
2627     );
2628 
2629 exit:
2630     if (_array) {
2631         _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
2632     }
2633     if (_exception) {
2634         jniThrowException(_env, _exceptionType, _exceptionMessage);
2635     }
2636 }
2637 
2638 /* void glPointParameterx ( GLenum pname, GLfixed param ) */
2639 static void
android_glPointParameterx__II(JNIEnv * _env,jobject _this,jint pname,jint param)2640 android_glPointParameterx__II
2641   (JNIEnv *_env, jobject _this, jint pname, jint param) {
2642     glPointParameterx(
2643         (GLenum)pname,
2644         (GLfixed)param
2645     );
2646 }
2647 
2648 /* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */
2649 static void
android_glPointParameterxv__I_3II(JNIEnv * _env,jobject _this,jint pname,jintArray params_ref,jint offset)2650 android_glPointParameterxv__I_3II
2651   (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
2652     jint _exception = 0;
2653     const char * _exceptionType = NULL;
2654     const char * _exceptionMessage = NULL;
2655     GLfixed *params_base = (GLfixed *) 0;
2656     jint _remaining;
2657     GLfixed *params = (GLfixed *) 0;
2658 
2659     if (!params_ref) {
2660         _exception = 1;
2661         _exceptionType = "java/lang/IllegalArgumentException";
2662         _exceptionMessage = "params == null";
2663         goto exit;
2664     }
2665     if (offset < 0) {
2666         _exception = 1;
2667         _exceptionType = "java/lang/IllegalArgumentException";
2668         _exceptionMessage = "offset < 0";
2669         goto exit;
2670     }
2671     _remaining = _env->GetArrayLength(params_ref) - offset;
2672     if (_remaining < 1) {
2673         _exception = 1;
2674         _exceptionType = "java/lang/IllegalArgumentException";
2675         _exceptionMessage = "length - offset < 1 < needed";
2676         goto exit;
2677     }
2678     params_base = (GLfixed *)
2679         _env->GetIntArrayElements(params_ref, (jboolean *)0);
2680     params = params_base + offset;
2681 
2682     glPointParameterxv(
2683         (GLenum)pname,
2684         (GLfixed *)params
2685     );
2686 
2687 exit:
2688     if (params_base) {
2689         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
2690             JNI_ABORT);
2691     }
2692     if (_exception) {
2693         jniThrowException(_env, _exceptionType, _exceptionMessage);
2694     }
2695 }
2696 
2697 /* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */
2698 static void
android_glPointParameterxv__ILjava_nio_IntBuffer_2(JNIEnv * _env,jobject _this,jint pname,jobject params_buf)2699 android_glPointParameterxv__ILjava_nio_IntBuffer_2
2700   (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
2701     jint _exception = 0;
2702     const char * _exceptionType = NULL;
2703     const char * _exceptionMessage = NULL;
2704     jintArray _array = (jintArray) 0;
2705     jint _bufferOffset = (jint) 0;
2706     jint _remaining;
2707     GLfixed *params = (GLfixed *) 0;
2708 
2709     if (!params_buf) {
2710         _exception = 1;
2711         _exceptionType = "java/lang/IllegalArgumentException";
2712         _exceptionMessage = "params == null";
2713         goto exit;
2714     }
2715     params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2716     if (_remaining < 1) {
2717         _exception = 1;
2718         _exceptionType = "java/lang/IllegalArgumentException";
2719         _exceptionMessage = "remaining() < 1 < needed";
2720         goto exit;
2721     }
2722     if (params == NULL) {
2723         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
2724         params = (GLfixed *) (_paramsBase + _bufferOffset);
2725     }
2726     glPointParameterxv(
2727         (GLenum)pname,
2728         (GLfixed *)params
2729     );
2730 
2731 exit:
2732     if (_array) {
2733         _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
2734     }
2735     if (_exception) {
2736         jniThrowException(_env, _exceptionType, _exceptionMessage);
2737     }
2738 }
2739 
2740 /* void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) */
2741 static void
android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I(JNIEnv * _env,jobject _this,jint type,jint stride,jobject pointer_buf,jint remaining)2742 android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I
2743   (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) {
2744     jint _exception = 0;
2745     const char * _exceptionType = NULL;
2746     const char * _exceptionMessage = NULL;
2747     jarray _array = (jarray) 0;
2748     jint _bufferOffset = (jint) 0;
2749     jint _remaining;
2750     GLvoid *pointer = (GLvoid *) 0;
2751 
2752     if (pointer_buf) {
2753         pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
2754         if ( ! pointer ) {
2755             return;
2756         }
2757     }
2758     glPointSizePointerOESBounds(
2759         (GLenum)type,
2760         (GLsizei)stride,
2761         (GLvoid *)pointer,
2762         (GLsizei)remaining
2763     );
2764     if (_exception) {
2765         jniThrowException(_env, _exceptionType, _exceptionMessage);
2766     }
2767 }
2768 
2769 /* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
2770 static void
android_glTexCoordPointer__IIII(JNIEnv * _env,jobject _this,jint size,jint type,jint stride,jint offset)2771 android_glTexCoordPointer__IIII
2772   (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
2773     glTexCoordPointer(
2774         (GLint)size,
2775         (GLenum)type,
2776         (GLsizei)stride,
2777         reinterpret_cast<GLvoid *>(offset)
2778     );
2779 }
2780 
2781 /* void glTexEnvi ( GLenum target, GLenum pname, GLint param ) */
2782 static void
android_glTexEnvi__III(JNIEnv * _env,jobject _this,jint target,jint pname,jint param)2783 android_glTexEnvi__III
2784   (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
2785     glTexEnvi(
2786         (GLenum)target,
2787         (GLenum)pname,
2788         (GLint)param
2789     );
2790 }
2791 
2792 /* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */
2793 static void
android_glTexEnviv__II_3II(JNIEnv * _env,jobject _this,jint target,jint pname,jintArray params_ref,jint offset)2794 android_glTexEnviv__II_3II
2795   (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2796     jint _exception = 0;
2797     const char * _exceptionType = NULL;
2798     const char * _exceptionMessage = NULL;
2799     GLint *params_base = (GLint *) 0;
2800     jint _remaining;
2801     GLint *params = (GLint *) 0;
2802 
2803     if (!params_ref) {
2804         _exception = 1;
2805         _exceptionType = "java/lang/IllegalArgumentException";
2806         _exceptionMessage = "params == null";
2807         goto exit;
2808     }
2809     if (offset < 0) {
2810         _exception = 1;
2811         _exceptionType = "java/lang/IllegalArgumentException";
2812         _exceptionMessage = "offset < 0";
2813         goto exit;
2814     }
2815     _remaining = _env->GetArrayLength(params_ref) - offset;
2816     int _needed;
2817     switch (pname) {
2818 #if defined(GL_TEXTURE_ENV_COLOR)
2819         case GL_TEXTURE_ENV_COLOR:
2820 #endif // defined(GL_TEXTURE_ENV_COLOR)
2821             _needed = 4;
2822             break;
2823         default:
2824             _needed = 1;
2825             break;
2826     }
2827     if (_remaining < _needed) {
2828         _exception = 1;
2829         _exceptionType = "java/lang/IllegalArgumentException";
2830         _exceptionMessage = "length - offset < needed";
2831         goto exit;
2832     }
2833     params_base = (GLint *)
2834         _env->GetIntArrayElements(params_ref, (jboolean *)0);
2835     params = params_base + offset;
2836 
2837     glTexEnviv(
2838         (GLenum)target,
2839         (GLenum)pname,
2840         (GLint *)params
2841     );
2842 
2843 exit:
2844     if (params_base) {
2845         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
2846             JNI_ABORT);
2847     }
2848     if (_exception) {
2849         jniThrowException(_env, _exceptionType, _exceptionMessage);
2850     }
2851 }
2852 
2853 /* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */
2854 static void
android_glTexEnviv__IILjava_nio_IntBuffer_2(JNIEnv * _env,jobject _this,jint target,jint pname,jobject params_buf)2855 android_glTexEnviv__IILjava_nio_IntBuffer_2
2856   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2857     jint _exception = 0;
2858     const char * _exceptionType = NULL;
2859     const char * _exceptionMessage = NULL;
2860     jintArray _array = (jintArray) 0;
2861     jint _bufferOffset = (jint) 0;
2862     jint _remaining;
2863     GLint *params = (GLint *) 0;
2864 
2865     if (!params_buf) {
2866         _exception = 1;
2867         _exceptionType = "java/lang/IllegalArgumentException";
2868         _exceptionMessage = "params == null";
2869         goto exit;
2870     }
2871     params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2872     int _needed;
2873     switch (pname) {
2874 #if defined(GL_TEXTURE_ENV_COLOR)
2875         case GL_TEXTURE_ENV_COLOR:
2876 #endif // defined(GL_TEXTURE_ENV_COLOR)
2877             _needed = 4;
2878             break;
2879         default:
2880             _needed = 1;
2881             break;
2882     }
2883     if (_remaining < _needed) {
2884         _exception = 1;
2885         _exceptionType = "java/lang/IllegalArgumentException";
2886         _exceptionMessage = "remaining() < needed";
2887         goto exit;
2888     }
2889     if (params == NULL) {
2890         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
2891         params = (GLint *) (_paramsBase + _bufferOffset);
2892     }
2893     glTexEnviv(
2894         (GLenum)target,
2895         (GLenum)pname,
2896         (GLint *)params
2897     );
2898 
2899 exit:
2900     if (_array) {
2901         _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
2902     }
2903     if (_exception) {
2904         jniThrowException(_env, _exceptionType, _exceptionMessage);
2905     }
2906 }
2907 
2908 /* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
2909 static void
android_glTexParameterfv__II_3FI(JNIEnv * _env,jobject _this,jint target,jint pname,jfloatArray params_ref,jint offset)2910 android_glTexParameterfv__II_3FI
2911   (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
2912     jint _exception = 0;
2913     const char * _exceptionType = NULL;
2914     const char * _exceptionMessage = NULL;
2915     GLfloat *params_base = (GLfloat *) 0;
2916     jint _remaining;
2917     GLfloat *params = (GLfloat *) 0;
2918 
2919     if (!params_ref) {
2920         _exception = 1;
2921         _exceptionType = "java/lang/IllegalArgumentException";
2922         _exceptionMessage = "params == null";
2923         goto exit;
2924     }
2925     if (offset < 0) {
2926         _exception = 1;
2927         _exceptionType = "java/lang/IllegalArgumentException";
2928         _exceptionMessage = "offset < 0";
2929         goto exit;
2930     }
2931     _remaining = _env->GetArrayLength(params_ref) - offset;
2932     if (_remaining < 1) {
2933         _exception = 1;
2934         _exceptionType = "java/lang/IllegalArgumentException";
2935         _exceptionMessage = "length - offset < 1 < needed";
2936         goto exit;
2937     }
2938     params_base = (GLfloat *)
2939         _env->GetFloatArrayElements(params_ref, (jboolean *)0);
2940     params = params_base + offset;
2941 
2942     glTexParameterfv(
2943         (GLenum)target,
2944         (GLenum)pname,
2945         (GLfloat *)params
2946     );
2947 
2948 exit:
2949     if (params_base) {
2950         _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
2951             JNI_ABORT);
2952     }
2953     if (_exception) {
2954         jniThrowException(_env, _exceptionType, _exceptionMessage);
2955     }
2956 }
2957 
2958 /* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
2959 static void
android_glTexParameterfv__IILjava_nio_FloatBuffer_2(JNIEnv * _env,jobject _this,jint target,jint pname,jobject params_buf)2960 android_glTexParameterfv__IILjava_nio_FloatBuffer_2
2961   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2962     jint _exception = 0;
2963     const char * _exceptionType = NULL;
2964     const char * _exceptionMessage = NULL;
2965     jfloatArray _array = (jfloatArray) 0;
2966     jint _bufferOffset = (jint) 0;
2967     jint _remaining;
2968     GLfloat *params = (GLfloat *) 0;
2969 
2970     if (!params_buf) {
2971         _exception = 1;
2972         _exceptionType = "java/lang/IllegalArgumentException";
2973         _exceptionMessage = "params == null";
2974         goto exit;
2975     }
2976     params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2977     if (_remaining < 1) {
2978         _exception = 1;
2979         _exceptionType = "java/lang/IllegalArgumentException";
2980         _exceptionMessage = "remaining() < 1 < needed";
2981         goto exit;
2982     }
2983     if (params == NULL) {
2984         char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
2985         params = (GLfloat *) (_paramsBase + _bufferOffset);
2986     }
2987     glTexParameterfv(
2988         (GLenum)target,
2989         (GLenum)pname,
2990         (GLfloat *)params
2991     );
2992 
2993 exit:
2994     if (_array) {
2995         _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
2996     }
2997     if (_exception) {
2998         jniThrowException(_env, _exceptionType, _exceptionMessage);
2999     }
3000 }
3001 
3002 /* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */
3003 static void
android_glTexParameteri__III(JNIEnv * _env,jobject _this,jint target,jint pname,jint param)3004 android_glTexParameteri__III
3005   (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
3006     glTexParameteri(
3007         (GLenum)target,
3008         (GLenum)pname,
3009         (GLint)param
3010     );
3011 }
3012 
3013 /* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
3014 static void
android_glTexParameteriv__II_3II(JNIEnv * _env,jobject _this,jint target,jint pname,jintArray params_ref,jint offset)3015 android_glTexParameteriv__II_3II
3016   (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
3017     jint _exception = 0;
3018     const char * _exceptionType = NULL;
3019     const char * _exceptionMessage = NULL;
3020     GLint *params_base = (GLint *) 0;
3021     jint _remaining;
3022     GLint *params = (GLint *) 0;
3023 
3024     if (!params_ref) {
3025         _exception = 1;
3026         _exceptionType = "java/lang/IllegalArgumentException";
3027         _exceptionMessage = "params == null";
3028         goto exit;
3029     }
3030     if (offset < 0) {
3031         _exception = 1;
3032         _exceptionType = "java/lang/IllegalArgumentException";
3033         _exceptionMessage = "offset < 0";
3034         goto exit;
3035     }
3036     _remaining = _env->GetArrayLength(params_ref) - offset;
3037     if (_remaining < 1) {
3038         _exception = 1;
3039         _exceptionType = "java/lang/IllegalArgumentException";
3040         _exceptionMessage = "length - offset < 1 < needed";
3041         goto exit;
3042     }
3043     params_base = (GLint *)
3044         _env->GetIntArrayElements(params_ref, (jboolean *)0);
3045     params = params_base + offset;
3046 
3047     glTexParameteriv(
3048         (GLenum)target,
3049         (GLenum)pname,
3050         (GLint *)params
3051     );
3052 
3053 exit:
3054     if (params_base) {
3055         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
3056             JNI_ABORT);
3057     }
3058     if (_exception) {
3059         jniThrowException(_env, _exceptionType, _exceptionMessage);
3060     }
3061 }
3062 
3063 /* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
3064 static void
android_glTexParameteriv__IILjava_nio_IntBuffer_2(JNIEnv * _env,jobject _this,jint target,jint pname,jobject params_buf)3065 android_glTexParameteriv__IILjava_nio_IntBuffer_2
3066   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3067     jint _exception = 0;
3068     const char * _exceptionType = NULL;
3069     const char * _exceptionMessage = NULL;
3070     jintArray _array = (jintArray) 0;
3071     jint _bufferOffset = (jint) 0;
3072     jint _remaining;
3073     GLint *params = (GLint *) 0;
3074 
3075     if (!params_buf) {
3076         _exception = 1;
3077         _exceptionType = "java/lang/IllegalArgumentException";
3078         _exceptionMessage = "params == null";
3079         goto exit;
3080     }
3081     params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3082     if (_remaining < 1) {
3083         _exception = 1;
3084         _exceptionType = "java/lang/IllegalArgumentException";
3085         _exceptionMessage = "remaining() < 1 < needed";
3086         goto exit;
3087     }
3088     if (params == NULL) {
3089         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
3090         params = (GLint *) (_paramsBase + _bufferOffset);
3091     }
3092     glTexParameteriv(
3093         (GLenum)target,
3094         (GLenum)pname,
3095         (GLint *)params
3096     );
3097 
3098 exit:
3099     if (_array) {
3100         _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
3101     }
3102     if (_exception) {
3103         jniThrowException(_env, _exceptionType, _exceptionMessage);
3104     }
3105 }
3106 
3107 /* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */
3108 static void
android_glTexParameterxv__II_3II(JNIEnv * _env,jobject _this,jint target,jint pname,jintArray params_ref,jint offset)3109 android_glTexParameterxv__II_3II
3110   (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
3111     jint _exception = 0;
3112     const char * _exceptionType = NULL;
3113     const char * _exceptionMessage = NULL;
3114     GLfixed *params_base = (GLfixed *) 0;
3115     jint _remaining;
3116     GLfixed *params = (GLfixed *) 0;
3117 
3118     if (!params_ref) {
3119         _exception = 1;
3120         _exceptionType = "java/lang/IllegalArgumentException";
3121         _exceptionMessage = "params == null";
3122         goto exit;
3123     }
3124     if (offset < 0) {
3125         _exception = 1;
3126         _exceptionType = "java/lang/IllegalArgumentException";
3127         _exceptionMessage = "offset < 0";
3128         goto exit;
3129     }
3130     _remaining = _env->GetArrayLength(params_ref) - offset;
3131     if (_remaining < 1) {
3132         _exception = 1;
3133         _exceptionType = "java/lang/IllegalArgumentException";
3134         _exceptionMessage = "length - offset < 1 < needed";
3135         goto exit;
3136     }
3137     params_base = (GLfixed *)
3138         _env->GetIntArrayElements(params_ref, (jboolean *)0);
3139     params = params_base + offset;
3140 
3141     glTexParameterxv(
3142         (GLenum)target,
3143         (GLenum)pname,
3144         (GLfixed *)params
3145     );
3146 
3147 exit:
3148     if (params_base) {
3149         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
3150             JNI_ABORT);
3151     }
3152     if (_exception) {
3153         jniThrowException(_env, _exceptionType, _exceptionMessage);
3154     }
3155 }
3156 
3157 /* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */
3158 static void
android_glTexParameterxv__IILjava_nio_IntBuffer_2(JNIEnv * _env,jobject _this,jint target,jint pname,jobject params_buf)3159 android_glTexParameterxv__IILjava_nio_IntBuffer_2
3160   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3161     jint _exception = 0;
3162     const char * _exceptionType = NULL;
3163     const char * _exceptionMessage = NULL;
3164     jintArray _array = (jintArray) 0;
3165     jint _bufferOffset = (jint) 0;
3166     jint _remaining;
3167     GLfixed *params = (GLfixed *) 0;
3168 
3169     if (!params_buf) {
3170         _exception = 1;
3171         _exceptionType = "java/lang/IllegalArgumentException";
3172         _exceptionMessage = "params == null";
3173         goto exit;
3174     }
3175     params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3176     if (_remaining < 1) {
3177         _exception = 1;
3178         _exceptionType = "java/lang/IllegalArgumentException";
3179         _exceptionMessage = "remaining() < 1 < needed";
3180         goto exit;
3181     }
3182     if (params == NULL) {
3183         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
3184         params = (GLfixed *) (_paramsBase + _bufferOffset);
3185     }
3186     glTexParameterxv(
3187         (GLenum)target,
3188         (GLenum)pname,
3189         (GLfixed *)params
3190     );
3191 
3192 exit:
3193     if (_array) {
3194         _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
3195     }
3196     if (_exception) {
3197         jniThrowException(_env, _exceptionType, _exceptionMessage);
3198     }
3199 }
3200 
3201 /* void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
3202 static void
android_glVertexPointer__IIII(JNIEnv * _env,jobject _this,jint size,jint type,jint stride,jint offset)3203 android_glVertexPointer__IIII
3204   (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
3205     glVertexPointer(
3206         (GLint)size,
3207         (GLenum)type,
3208         (GLsizei)stride,
3209         reinterpret_cast<GLvoid *>(offset)
3210     );
3211 }
3212 
3213 static const char *classPathName = "android/opengl/GLES11";
3214 
3215 static const JNINativeMethod methods[] = {
3216 {"_nativeClassInit", "()V", (void*)nativeClassInit },
3217 {"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II },
3218 {"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I },
3219 {"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 },
3220 {"glClipPlanef", "(I[FI)V", (void *) android_glClipPlanef__I_3FI },
3221 {"glClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glClipPlanef__ILjava_nio_FloatBuffer_2 },
3222 {"glClipPlanex", "(I[II)V", (void *) android_glClipPlanex__I_3II },
3223 {"glClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glClipPlanex__ILjava_nio_IntBuffer_2 },
3224 {"glColor4ub", "(BBBB)V", (void *) android_glColor4ub__BBBB },
3225 {"glColorPointer", "(IIII)V", (void *) android_glColorPointer__IIII },
3226 {"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II },
3227 {"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 },
3228 {"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII },
3229 {"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II },
3230 {"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 },
3231 {"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI },
3232 {"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 },
3233 {"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II },
3234 {"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 },
3235 {"glGetClipPlanef", "(I[FI)V", (void *) android_glGetClipPlanef__I_3FI },
3236 {"glGetClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetClipPlanef__ILjava_nio_FloatBuffer_2 },
3237 {"glGetClipPlanex", "(I[II)V", (void *) android_glGetClipPlanex__I_3II },
3238 {"glGetClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetClipPlanex__ILjava_nio_IntBuffer_2 },
3239 {"glGetFixedv", "(I[II)V", (void *) android_glGetFixedv__I_3II },
3240 {"glGetFixedv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetFixedv__ILjava_nio_IntBuffer_2 },
3241 {"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI },
3242 {"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 },
3243 {"glGetLightfv", "(II[FI)V", (void *) android_glGetLightfv__II_3FI },
3244 {"glGetLightfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetLightfv__IILjava_nio_FloatBuffer_2 },
3245 {"glGetLightxv", "(II[II)V", (void *) android_glGetLightxv__II_3II },
3246 {"glGetLightxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetLightxv__IILjava_nio_IntBuffer_2 },
3247 {"glGetMaterialfv", "(II[FI)V", (void *) android_glGetMaterialfv__II_3FI },
3248 {"glGetMaterialfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetMaterialfv__IILjava_nio_FloatBuffer_2 },
3249 {"glGetMaterialxv", "(II[II)V", (void *) android_glGetMaterialxv__II_3II },
3250 {"glGetMaterialxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetMaterialxv__IILjava_nio_IntBuffer_2 },
3251 {"glGetTexEnvfv", "(II[FI)V", (void *) android_glGetTexEnvfv__II_3FI },
3252 {"glGetTexEnvfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2 },
3253 {"glGetTexEnviv", "(II[II)V", (void *) android_glGetTexEnviv__II_3II },
3254 {"glGetTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnviv__IILjava_nio_IntBuffer_2 },
3255 {"glGetTexEnvxv", "(II[II)V", (void *) android_glGetTexEnvxv__II_3II },
3256 {"glGetTexEnvxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnvxv__IILjava_nio_IntBuffer_2 },
3257 {"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI },
3258 {"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 },
3259 {"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II },
3260 {"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 },
3261 {"glGetTexParameterxv", "(II[II)V", (void *) android_glGetTexParameterxv__II_3II },
3262 {"glGetTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameterxv__IILjava_nio_IntBuffer_2 },
3263 {"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I },
3264 {"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I },
3265 {"glIsTexture", "(I)Z", (void *) android_glIsTexture__I },
3266 {"glNormalPointer", "(III)V", (void *) android_glNormalPointer__III },
3267 {"glPointParameterf", "(IF)V", (void *) android_glPointParameterf__IF },
3268 {"glPointParameterfv", "(I[FI)V", (void *) android_glPointParameterfv__I_3FI },
3269 {"glPointParameterfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glPointParameterfv__ILjava_nio_FloatBuffer_2 },
3270 {"glPointParameterx", "(II)V", (void *) android_glPointParameterx__II },
3271 {"glPointParameterxv", "(I[II)V", (void *) android_glPointParameterxv__I_3II },
3272 {"glPointParameterxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glPointParameterxv__ILjava_nio_IntBuffer_2 },
3273 {"glPointSizePointerOESBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I },
3274 {"glTexCoordPointer", "(IIII)V", (void *) android_glTexCoordPointer__IIII },
3275 {"glTexEnvi", "(III)V", (void *) android_glTexEnvi__III },
3276 {"glTexEnviv", "(II[II)V", (void *) android_glTexEnviv__II_3II },
3277 {"glTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexEnviv__IILjava_nio_IntBuffer_2 },
3278 {"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI },
3279 {"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 },
3280 {"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III },
3281 {"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II },
3282 {"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 },
3283 {"glTexParameterxv", "(II[II)V", (void *) android_glTexParameterxv__II_3II },
3284 {"glTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameterxv__IILjava_nio_IntBuffer_2 },
3285 {"glVertexPointer", "(IIII)V", (void *) android_glVertexPointer__IIII },
3286 };
3287 
register_android_opengl_jni_GLES11(JNIEnv * _env)3288 int register_android_opengl_jni_GLES11(JNIEnv *_env)
3289 {
3290     int err;
3291     err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
3292     return err;
3293 }
3294