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