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