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