android_opengl_GLES10.cpp revision 2545b32ced69100fe70685b95315c6adf411083b
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 glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
33        const GLvoid *ptr, GLsizei count);
34GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
35        const GLvoid *pointer, GLsizei count);
36GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
37        GLsizei stride, const GLvoid *pointer, GLsizei count);
38GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
39        GLsizei stride, const GLvoid *pointer, GLsizei count);
40}
41
42static int initialized = 0;
43
44static jclass nioAccessClass;
45static jclass bufferClass;
46static jmethodID getBasePointerID;
47static jmethodID getBaseArrayID;
48static jmethodID getBaseArrayOffsetID;
49static jfieldID positionID;
50static jfieldID limitID;
51static jfieldID elementSizeShiftID;
52
53/* Cache method IDs each time the class is loaded. */
54
55static void
56nativeClassInit(JNIEnv *_env, jclass glImplClass)
57{
58    jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
59    nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
60
61    jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
62    bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
63
64    getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
65            "getBasePointer", "(Ljava/nio/Buffer;)J");
66    getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
67            "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
68    getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
69            "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
70
71    positionID = _env->GetFieldID(bufferClass, "position", "I");
72    limitID = _env->GetFieldID(bufferClass, "limit", "I");
73    elementSizeShiftID =
74        _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
75}
76
77static void *
78getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
79{
80    jint position;
81    jint limit;
82    jint elementSizeShift;
83    jlong pointer;
84    jint offset;
85    void *data;
86
87    position = _env->GetIntField(buffer, positionID);
88    limit = _env->GetIntField(buffer, limitID);
89    elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
90    *remaining = (limit - position) << elementSizeShift;
91    pointer = _env->CallStaticLongMethod(nioAccessClass,
92            getBasePointerID, buffer);
93    if (pointer != 0L) {
94        *array = NULL;
95        return (void *) (jint) pointer;
96    }
97
98    *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
99            getBaseArrayID, buffer);
100    offset = _env->CallStaticIntMethod(nioAccessClass,
101            getBaseArrayOffsetID, buffer);
102    data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0);
103
104    return (void *) ((char *) data + offset);
105}
106
107static void
108releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
109{
110    _env->ReleasePrimitiveArrayCritical(array, data,
111					   commit ? 0 : JNI_ABORT);
112}
113
114static void *
115getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
116    char* buf = (char*) _env->GetDirectBufferAddress(buffer);
117    if (buf) {
118        jint position = _env->GetIntField(buffer, positionID);
119        jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
120        buf += position << elementSizeShift;
121    } else {
122        jniThrowException(_env, "java/lang/IllegalArgumentException",
123                          "Must use a native order direct Buffer");
124    }
125    return (void*) buf;
126}
127
128static int
129getNumCompressedTextureFormats() {
130    int numCompressedTextureFormats = 0;
131    glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats);
132    return numCompressedTextureFormats;
133}
134
135// --------------------------------------------------------------------------
136/* void glActiveTexture ( GLenum texture ) */
137static void
138android_glActiveTexture__I
139  (JNIEnv *_env, jobject _this, jint texture) {
140    glActiveTexture(
141        (GLenum)texture
142    );
143}
144
145/* void glAlphaFunc ( GLenum func, GLclampf ref ) */
146static void
147android_glAlphaFunc__IF
148  (JNIEnv *_env, jobject _this, jint func, jfloat ref) {
149    glAlphaFunc(
150        (GLenum)func,
151        (GLclampf)ref
152    );
153}
154
155/* void glAlphaFuncx ( GLenum func, GLclampx ref ) */
156static void
157android_glAlphaFuncx__II
158  (JNIEnv *_env, jobject _this, jint func, jint ref) {
159    glAlphaFuncx(
160        (GLenum)func,
161        (GLclampx)ref
162    );
163}
164
165/* void glBindTexture ( GLenum target, GLuint texture ) */
166static void
167android_glBindTexture__II
168  (JNIEnv *_env, jobject _this, jint target, jint texture) {
169    glBindTexture(
170        (GLenum)target,
171        (GLuint)texture
172    );
173}
174
175/* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */
176static void
177android_glBlendFunc__II
178  (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) {
179    glBlendFunc(
180        (GLenum)sfactor,
181        (GLenum)dfactor
182    );
183}
184
185/* void glClear ( GLbitfield mask ) */
186static void
187android_glClear__I
188  (JNIEnv *_env, jobject _this, jint mask) {
189    glClear(
190        (GLbitfield)mask
191    );
192}
193
194/* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
195static void
196android_glClearColor__FFFF
197  (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
198    glClearColor(
199        (GLclampf)red,
200        (GLclampf)green,
201        (GLclampf)blue,
202        (GLclampf)alpha
203    );
204}
205
206/* void glClearColorx ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha ) */
207static void
208android_glClearColorx__IIII
209  (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) {
210    glClearColorx(
211        (GLclampx)red,
212        (GLclampx)green,
213        (GLclampx)blue,
214        (GLclampx)alpha
215    );
216}
217
218/* void glClearDepthf ( GLclampf depth ) */
219static void
220android_glClearDepthf__F
221  (JNIEnv *_env, jobject _this, jfloat depth) {
222    glClearDepthf(
223        (GLclampf)depth
224    );
225}
226
227/* void glClearDepthx ( GLclampx depth ) */
228static void
229android_glClearDepthx__I
230  (JNIEnv *_env, jobject _this, jint depth) {
231    glClearDepthx(
232        (GLclampx)depth
233    );
234}
235
236/* void glClearStencil ( GLint s ) */
237static void
238android_glClearStencil__I
239  (JNIEnv *_env, jobject _this, jint s) {
240    glClearStencil(
241        (GLint)s
242    );
243}
244
245/* void glClientActiveTexture ( GLenum texture ) */
246static void
247android_glClientActiveTexture__I
248  (JNIEnv *_env, jobject _this, jint texture) {
249    glClientActiveTexture(
250        (GLenum)texture
251    );
252}
253
254/* void glColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) */
255static void
256android_glColor4f__FFFF
257  (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
258    glColor4f(
259        (GLfloat)red,
260        (GLfloat)green,
261        (GLfloat)blue,
262        (GLfloat)alpha
263    );
264}
265
266/* void glColor4x ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha ) */
267static void
268android_glColor4x__IIII
269  (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) {
270    glColor4x(
271        (GLfixed)red,
272        (GLfixed)green,
273        (GLfixed)blue,
274        (GLfixed)alpha
275    );
276}
277
278/* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */
279static void
280android_glColorMask__ZZZZ
281  (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) {
282    glColorMask(
283        (GLboolean)red,
284        (GLboolean)green,
285        (GLboolean)blue,
286        (GLboolean)alpha
287    );
288}
289
290/* void glColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
291static void
292android_glColorPointerBounds__IIILjava_nio_Buffer_2I
293  (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
294    jarray _array = (jarray) 0;
295    jint _remaining;
296    GLvoid *pointer = (GLvoid *) 0;
297
298    if (pointer_buf) {
299        pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
300        if ( ! pointer ) {
301            return;
302        }
303    }
304    glColorPointerBounds(
305        (GLint)size,
306        (GLenum)type,
307        (GLsizei)stride,
308        (GLvoid *)pointer,
309        (GLsizei)remaining
310    );
311}
312
313/* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */
314static void
315android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2
316  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) {
317    jarray _array = (jarray) 0;
318    jint _remaining;
319    GLvoid *data = (GLvoid *) 0;
320
321    data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining);
322    glCompressedTexImage2D(
323        (GLenum)target,
324        (GLint)level,
325        (GLenum)internalformat,
326        (GLsizei)width,
327        (GLsizei)height,
328        (GLint)border,
329        (GLsizei)imageSize,
330        (GLvoid *)data
331    );
332    if (_array) {
333        releasePointer(_env, _array, data, JNI_FALSE);
334    }
335}
336
337/* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */
338static void
339android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
340  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) {
341    jarray _array = (jarray) 0;
342    jint _remaining;
343    GLvoid *data = (GLvoid *) 0;
344
345    data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining);
346    glCompressedTexSubImage2D(
347        (GLenum)target,
348        (GLint)level,
349        (GLint)xoffset,
350        (GLint)yoffset,
351        (GLsizei)width,
352        (GLsizei)height,
353        (GLenum)format,
354        (GLsizei)imageSize,
355        (GLvoid *)data
356    );
357    if (_array) {
358        releasePointer(_env, _array, data, JNI_FALSE);
359    }
360}
361
362/* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */
363static void
364android_glCopyTexImage2D__IIIIIIII
365  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) {
366    glCopyTexImage2D(
367        (GLenum)target,
368        (GLint)level,
369        (GLenum)internalformat,
370        (GLint)x,
371        (GLint)y,
372        (GLsizei)width,
373        (GLsizei)height,
374        (GLint)border
375    );
376}
377
378/* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */
379static void
380android_glCopyTexSubImage2D__IIIIIIII
381  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) {
382    glCopyTexSubImage2D(
383        (GLenum)target,
384        (GLint)level,
385        (GLint)xoffset,
386        (GLint)yoffset,
387        (GLint)x,
388        (GLint)y,
389        (GLsizei)width,
390        (GLsizei)height
391    );
392}
393
394/* void glCullFace ( GLenum mode ) */
395static void
396android_glCullFace__I
397  (JNIEnv *_env, jobject _this, jint mode) {
398    glCullFace(
399        (GLenum)mode
400    );
401}
402
403/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
404static void
405android_glDeleteTextures__I_3II
406  (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
407    jint _exception = 0;
408    const char * _exceptionType;
409    const char * _exceptionMessage;
410    GLuint *textures_base = (GLuint *) 0;
411    jint _remaining;
412    GLuint *textures = (GLuint *) 0;
413
414    if (!textures_ref) {
415        _exception = 1;
416        _exceptionType = "java/lang/IllegalArgumentException";
417        _exceptionMessage = "textures == null";
418        goto exit;
419    }
420    if (offset < 0) {
421        _exception = 1;
422        _exceptionType = "java/lang/IllegalArgumentException";
423        _exceptionMessage = "offset < 0";
424        goto exit;
425    }
426    _remaining = _env->GetArrayLength(textures_ref) - offset;
427    if (_remaining < n) {
428        _exception = 1;
429        _exceptionType = "java/lang/IllegalArgumentException";
430        _exceptionMessage = "length - offset < n < needed";
431        goto exit;
432    }
433    textures_base = (GLuint *)
434        _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
435    textures = textures_base + offset;
436
437    glDeleteTextures(
438        (GLsizei)n,
439        (GLuint *)textures
440    );
441
442exit:
443    if (textures_base) {
444        _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
445            JNI_ABORT);
446    }
447    if (_exception) {
448        jniThrowException(_env, _exceptionType, _exceptionMessage);
449    }
450}
451
452/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
453static void
454android_glDeleteTextures__ILjava_nio_IntBuffer_2
455  (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
456    jint _exception = 0;
457    const char * _exceptionType;
458    const char * _exceptionMessage;
459    jarray _array = (jarray) 0;
460    jint _remaining;
461    GLuint *textures = (GLuint *) 0;
462
463    textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining);
464    if (_remaining < n) {
465        _exception = 1;
466        _exceptionType = "java/lang/IllegalArgumentException";
467        _exceptionMessage = "remaining() < n < needed";
468        goto exit;
469    }
470    glDeleteTextures(
471        (GLsizei)n,
472        (GLuint *)textures
473    );
474
475exit:
476    if (_array) {
477        releasePointer(_env, _array, textures, JNI_FALSE);
478    }
479    if (_exception) {
480        jniThrowException(_env, _exceptionType, _exceptionMessage);
481    }
482}
483
484/* void glDepthFunc ( GLenum func ) */
485static void
486android_glDepthFunc__I
487  (JNIEnv *_env, jobject _this, jint func) {
488    glDepthFunc(
489        (GLenum)func
490    );
491}
492
493/* void glDepthMask ( GLboolean flag ) */
494static void
495android_glDepthMask__Z
496  (JNIEnv *_env, jobject _this, jboolean flag) {
497    glDepthMask(
498        (GLboolean)flag
499    );
500}
501
502/* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */
503static void
504android_glDepthRangef__FF
505  (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) {
506    glDepthRangef(
507        (GLclampf)zNear,
508        (GLclampf)zFar
509    );
510}
511
512/* void glDepthRangex ( GLclampx zNear, GLclampx zFar ) */
513static void
514android_glDepthRangex__II
515  (JNIEnv *_env, jobject _this, jint zNear, jint zFar) {
516    glDepthRangex(
517        (GLclampx)zNear,
518        (GLclampx)zFar
519    );
520}
521
522/* void glDisable ( GLenum cap ) */
523static void
524android_glDisable__I
525  (JNIEnv *_env, jobject _this, jint cap) {
526    glDisable(
527        (GLenum)cap
528    );
529}
530
531/* void glDisableClientState ( GLenum array ) */
532static void
533android_glDisableClientState__I
534  (JNIEnv *_env, jobject _this, jint array) {
535    glDisableClientState(
536        (GLenum)array
537    );
538}
539
540/* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */
541static void
542android_glDrawArrays__III
543  (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) {
544    glDrawArrays(
545        (GLenum)mode,
546        (GLint)first,
547        (GLsizei)count
548    );
549}
550
551/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */
552static void
553android_glDrawElements__IIILjava_nio_Buffer_2
554  (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) {
555    jint _exception = 0;
556    const char * _exceptionType;
557    const char * _exceptionMessage;
558    jarray _array = (jarray) 0;
559    jint _remaining;
560    GLvoid *indices = (GLvoid *) 0;
561
562    indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining);
563    if (_remaining < count) {
564        _exception = 1;
565        _exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
566        _exceptionMessage = "remaining() < count < needed";
567        goto exit;
568    }
569    glDrawElements(
570        (GLenum)mode,
571        (GLsizei)count,
572        (GLenum)type,
573        (GLvoid *)indices
574    );
575
576exit:
577    if (_array) {
578        releasePointer(_env, _array, indices, JNI_FALSE);
579    }
580    if (_exception) {
581        jniThrowException(_env, _exceptionType, _exceptionMessage);
582    }
583}
584
585/* void glEnable ( GLenum cap ) */
586static void
587android_glEnable__I
588  (JNIEnv *_env, jobject _this, jint cap) {
589    glEnable(
590        (GLenum)cap
591    );
592}
593
594/* void glEnableClientState ( GLenum array ) */
595static void
596android_glEnableClientState__I
597  (JNIEnv *_env, jobject _this, jint array) {
598    glEnableClientState(
599        (GLenum)array
600    );
601}
602
603/* void glFinish ( void ) */
604static void
605android_glFinish__
606  (JNIEnv *_env, jobject _this) {
607    glFinish();
608}
609
610/* void glFlush ( void ) */
611static void
612android_glFlush__
613  (JNIEnv *_env, jobject _this) {
614    glFlush();
615}
616
617/* void glFogf ( GLenum pname, GLfloat param ) */
618static void
619android_glFogf__IF
620  (JNIEnv *_env, jobject _this, jint pname, jfloat param) {
621    glFogf(
622        (GLenum)pname,
623        (GLfloat)param
624    );
625}
626
627/* void glFogfv ( GLenum pname, const GLfloat *params ) */
628static void
629android_glFogfv__I_3FI
630  (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
631    jint _exception = 0;
632    const char * _exceptionType;
633    const char * _exceptionMessage;
634    GLfloat *params_base = (GLfloat *) 0;
635    jint _remaining;
636    GLfloat *params = (GLfloat *) 0;
637
638    if (!params_ref) {
639        _exception = 1;
640        _exceptionType = "java/lang/IllegalArgumentException";
641        _exceptionMessage = "params == null";
642        goto exit;
643    }
644    if (offset < 0) {
645        _exception = 1;
646        _exceptionType = "java/lang/IllegalArgumentException";
647        _exceptionMessage = "offset < 0";
648        goto exit;
649    }
650    _remaining = _env->GetArrayLength(params_ref) - offset;
651    int _needed;
652    switch (pname) {
653#if defined(GL_FOG_MODE)
654        case GL_FOG_MODE:
655#endif // defined(GL_FOG_MODE)
656#if defined(GL_FOG_DENSITY)
657        case GL_FOG_DENSITY:
658#endif // defined(GL_FOG_DENSITY)
659#if defined(GL_FOG_START)
660        case GL_FOG_START:
661#endif // defined(GL_FOG_START)
662#if defined(GL_FOG_END)
663        case GL_FOG_END:
664#endif // defined(GL_FOG_END)
665            _needed = 1;
666            break;
667#if defined(GL_FOG_COLOR)
668        case GL_FOG_COLOR:
669#endif // defined(GL_FOG_COLOR)
670            _needed = 4;
671            break;
672        default:
673            _needed = 0;
674            break;
675    }
676    if (_remaining < _needed) {
677        _exception = 1;
678        _exceptionType = "java/lang/IllegalArgumentException";
679        _exceptionMessage = "length - offset < needed";
680        goto exit;
681    }
682    params_base = (GLfloat *)
683        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
684    params = params_base + offset;
685
686    glFogfv(
687        (GLenum)pname,
688        (GLfloat *)params
689    );
690
691exit:
692    if (params_base) {
693        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
694            JNI_ABORT);
695    }
696    if (_exception) {
697        jniThrowException(_env, _exceptionType, _exceptionMessage);
698    }
699}
700
701/* void glFogfv ( GLenum pname, const GLfloat *params ) */
702static void
703android_glFogfv__ILjava_nio_FloatBuffer_2
704  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
705    jint _exception = 0;
706    const char * _exceptionType;
707    const char * _exceptionMessage;
708    jarray _array = (jarray) 0;
709    jint _remaining;
710    GLfloat *params = (GLfloat *) 0;
711
712    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
713    int _needed;
714    switch (pname) {
715#if defined(GL_FOG_MODE)
716        case GL_FOG_MODE:
717#endif // defined(GL_FOG_MODE)
718#if defined(GL_FOG_DENSITY)
719        case GL_FOG_DENSITY:
720#endif // defined(GL_FOG_DENSITY)
721#if defined(GL_FOG_START)
722        case GL_FOG_START:
723#endif // defined(GL_FOG_START)
724#if defined(GL_FOG_END)
725        case GL_FOG_END:
726#endif // defined(GL_FOG_END)
727            _needed = 1;
728            break;
729#if defined(GL_FOG_COLOR)
730        case GL_FOG_COLOR:
731#endif // defined(GL_FOG_COLOR)
732            _needed = 4;
733            break;
734        default:
735            _needed = 0;
736            break;
737    }
738    if (_remaining < _needed) {
739        _exception = 1;
740        _exceptionType = "java/lang/IllegalArgumentException";
741        _exceptionMessage = "remaining() < needed";
742        goto exit;
743    }
744    glFogfv(
745        (GLenum)pname,
746        (GLfloat *)params
747    );
748
749exit:
750    if (_array) {
751        releasePointer(_env, _array, params, JNI_FALSE);
752    }
753    if (_exception) {
754        jniThrowException(_env, _exceptionType, _exceptionMessage);
755    }
756}
757
758/* void glFogx ( GLenum pname, GLfixed param ) */
759static void
760android_glFogx__II
761  (JNIEnv *_env, jobject _this, jint pname, jint param) {
762    glFogx(
763        (GLenum)pname,
764        (GLfixed)param
765    );
766}
767
768/* void glFogxv ( GLenum pname, const GLfixed *params ) */
769static void
770android_glFogxv__I_3II
771  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
772    jint _exception = 0;
773    const char * _exceptionType;
774    const char * _exceptionMessage;
775    GLfixed *params_base = (GLfixed *) 0;
776    jint _remaining;
777    GLfixed *params = (GLfixed *) 0;
778
779    if (!params_ref) {
780        _exception = 1;
781        _exceptionType = "java/lang/IllegalArgumentException";
782        _exceptionMessage = "params == null";
783        goto exit;
784    }
785    if (offset < 0) {
786        _exception = 1;
787        _exceptionType = "java/lang/IllegalArgumentException";
788        _exceptionMessage = "offset < 0";
789        goto exit;
790    }
791    _remaining = _env->GetArrayLength(params_ref) - offset;
792    int _needed;
793    switch (pname) {
794#if defined(GL_FOG_MODE)
795        case GL_FOG_MODE:
796#endif // defined(GL_FOG_MODE)
797#if defined(GL_FOG_DENSITY)
798        case GL_FOG_DENSITY:
799#endif // defined(GL_FOG_DENSITY)
800#if defined(GL_FOG_START)
801        case GL_FOG_START:
802#endif // defined(GL_FOG_START)
803#if defined(GL_FOG_END)
804        case GL_FOG_END:
805#endif // defined(GL_FOG_END)
806            _needed = 1;
807            break;
808#if defined(GL_FOG_COLOR)
809        case GL_FOG_COLOR:
810#endif // defined(GL_FOG_COLOR)
811            _needed = 4;
812            break;
813        default:
814            _needed = 0;
815            break;
816    }
817    if (_remaining < _needed) {
818        _exception = 1;
819        _exceptionType = "java/lang/IllegalArgumentException";
820        _exceptionMessage = "length - offset < needed";
821        goto exit;
822    }
823    params_base = (GLfixed *)
824        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
825    params = params_base + offset;
826
827    glFogxv(
828        (GLenum)pname,
829        (GLfixed *)params
830    );
831
832exit:
833    if (params_base) {
834        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
835            JNI_ABORT);
836    }
837    if (_exception) {
838        jniThrowException(_env, _exceptionType, _exceptionMessage);
839    }
840}
841
842/* void glFogxv ( GLenum pname, const GLfixed *params ) */
843static void
844android_glFogxv__ILjava_nio_IntBuffer_2
845  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
846    jint _exception = 0;
847    const char * _exceptionType;
848    const char * _exceptionMessage;
849    jarray _array = (jarray) 0;
850    jint _remaining;
851    GLfixed *params = (GLfixed *) 0;
852
853    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
854    int _needed;
855    switch (pname) {
856#if defined(GL_FOG_MODE)
857        case GL_FOG_MODE:
858#endif // defined(GL_FOG_MODE)
859#if defined(GL_FOG_DENSITY)
860        case GL_FOG_DENSITY:
861#endif // defined(GL_FOG_DENSITY)
862#if defined(GL_FOG_START)
863        case GL_FOG_START:
864#endif // defined(GL_FOG_START)
865#if defined(GL_FOG_END)
866        case GL_FOG_END:
867#endif // defined(GL_FOG_END)
868            _needed = 1;
869            break;
870#if defined(GL_FOG_COLOR)
871        case GL_FOG_COLOR:
872#endif // defined(GL_FOG_COLOR)
873            _needed = 4;
874            break;
875        default:
876            _needed = 0;
877            break;
878    }
879    if (_remaining < _needed) {
880        _exception = 1;
881        _exceptionType = "java/lang/IllegalArgumentException";
882        _exceptionMessage = "remaining() < needed";
883        goto exit;
884    }
885    glFogxv(
886        (GLenum)pname,
887        (GLfixed *)params
888    );
889
890exit:
891    if (_array) {
892        releasePointer(_env, _array, params, JNI_FALSE);
893    }
894    if (_exception) {
895        jniThrowException(_env, _exceptionType, _exceptionMessage);
896    }
897}
898
899/* void glFrontFace ( GLenum mode ) */
900static void
901android_glFrontFace__I
902  (JNIEnv *_env, jobject _this, jint mode) {
903    glFrontFace(
904        (GLenum)mode
905    );
906}
907
908/* void glFrustumf ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */
909static void
910android_glFrustumf__FFFFFF
911  (JNIEnv *_env, jobject _this, jfloat left, jfloat right, jfloat bottom, jfloat top, jfloat zNear, jfloat zFar) {
912    glFrustumf(
913        (GLfloat)left,
914        (GLfloat)right,
915        (GLfloat)bottom,
916        (GLfloat)top,
917        (GLfloat)zNear,
918        (GLfloat)zFar
919    );
920}
921
922/* void glFrustumx ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) */
923static void
924android_glFrustumx__IIIIII
925  (JNIEnv *_env, jobject _this, jint left, jint right, jint bottom, jint top, jint zNear, jint zFar) {
926    glFrustumx(
927        (GLfixed)left,
928        (GLfixed)right,
929        (GLfixed)bottom,
930        (GLfixed)top,
931        (GLfixed)zNear,
932        (GLfixed)zFar
933    );
934}
935
936/* void glGenTextures ( GLsizei n, GLuint *textures ) */
937static void
938android_glGenTextures__I_3II
939  (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
940    jint _exception = 0;
941    const char * _exceptionType;
942    const char * _exceptionMessage;
943    GLuint *textures_base = (GLuint *) 0;
944    jint _remaining;
945    GLuint *textures = (GLuint *) 0;
946
947    if (!textures_ref) {
948        _exception = 1;
949        _exceptionType = "java/lang/IllegalArgumentException";
950        _exceptionMessage = "textures == null";
951        goto exit;
952    }
953    if (offset < 0) {
954        _exception = 1;
955        _exceptionType = "java/lang/IllegalArgumentException";
956        _exceptionMessage = "offset < 0";
957        goto exit;
958    }
959    _remaining = _env->GetArrayLength(textures_ref) - offset;
960    if (_remaining < n) {
961        _exception = 1;
962        _exceptionType = "java/lang/IllegalArgumentException";
963        _exceptionMessage = "length - offset < n < needed";
964        goto exit;
965    }
966    textures_base = (GLuint *)
967        _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
968    textures = textures_base + offset;
969
970    glGenTextures(
971        (GLsizei)n,
972        (GLuint *)textures
973    );
974
975exit:
976    if (textures_base) {
977        _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
978            _exception ? JNI_ABORT: 0);
979    }
980    if (_exception) {
981        jniThrowException(_env, _exceptionType, _exceptionMessage);
982    }
983}
984
985/* void glGenTextures ( GLsizei n, GLuint *textures ) */
986static void
987android_glGenTextures__ILjava_nio_IntBuffer_2
988  (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
989    jint _exception = 0;
990    const char * _exceptionType;
991    const char * _exceptionMessage;
992    jarray _array = (jarray) 0;
993    jint _remaining;
994    GLuint *textures = (GLuint *) 0;
995
996    textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining);
997    if (_remaining < n) {
998        _exception = 1;
999        _exceptionType = "java/lang/IllegalArgumentException";
1000        _exceptionMessage = "remaining() < n < needed";
1001        goto exit;
1002    }
1003    glGenTextures(
1004        (GLsizei)n,
1005        (GLuint *)textures
1006    );
1007
1008exit:
1009    if (_array) {
1010        releasePointer(_env, _array, textures, _exception ? JNI_FALSE : JNI_TRUE);
1011    }
1012    if (_exception) {
1013        jniThrowException(_env, _exceptionType, _exceptionMessage);
1014    }
1015}
1016
1017/* GLenum glGetError ( void ) */
1018static jint
1019android_glGetError__
1020  (JNIEnv *_env, jobject _this) {
1021    GLenum _returnValue;
1022    _returnValue = glGetError();
1023    return _returnValue;
1024}
1025
1026/* void glGetIntegerv ( GLenum pname, GLint *params ) */
1027static void
1028android_glGetIntegerv__I_3II
1029  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
1030    jint _exception = 0;
1031    const char * _exceptionType;
1032    const char * _exceptionMessage;
1033    GLint *params_base = (GLint *) 0;
1034    jint _remaining;
1035    GLint *params = (GLint *) 0;
1036
1037    if (!params_ref) {
1038        _exception = 1;
1039        _exceptionType = "java/lang/IllegalArgumentException";
1040        _exceptionMessage = "params == null";
1041        goto exit;
1042    }
1043    if (offset < 0) {
1044        _exception = 1;
1045        _exceptionType = "java/lang/IllegalArgumentException";
1046        _exceptionMessage = "offset < 0";
1047        goto exit;
1048    }
1049    _remaining = _env->GetArrayLength(params_ref) - offset;
1050    int _needed;
1051    switch (pname) {
1052#if defined(GL_ALPHA_BITS)
1053        case GL_ALPHA_BITS:
1054#endif // defined(GL_ALPHA_BITS)
1055#if defined(GL_ALPHA_TEST_FUNC)
1056        case GL_ALPHA_TEST_FUNC:
1057#endif // defined(GL_ALPHA_TEST_FUNC)
1058#if defined(GL_ALPHA_TEST_REF)
1059        case GL_ALPHA_TEST_REF:
1060#endif // defined(GL_ALPHA_TEST_REF)
1061#if defined(GL_BLEND_DST)
1062        case GL_BLEND_DST:
1063#endif // defined(GL_BLEND_DST)
1064#if defined(GL_BLUE_BITS)
1065        case GL_BLUE_BITS:
1066#endif // defined(GL_BLUE_BITS)
1067#if defined(GL_COLOR_ARRAY_BUFFER_BINDING)
1068        case GL_COLOR_ARRAY_BUFFER_BINDING:
1069#endif // defined(GL_COLOR_ARRAY_BUFFER_BINDING)
1070#if defined(GL_COLOR_ARRAY_SIZE)
1071        case GL_COLOR_ARRAY_SIZE:
1072#endif // defined(GL_COLOR_ARRAY_SIZE)
1073#if defined(GL_COLOR_ARRAY_STRIDE)
1074        case GL_COLOR_ARRAY_STRIDE:
1075#endif // defined(GL_COLOR_ARRAY_STRIDE)
1076#if defined(GL_COLOR_ARRAY_TYPE)
1077        case GL_COLOR_ARRAY_TYPE:
1078#endif // defined(GL_COLOR_ARRAY_TYPE)
1079#if defined(GL_CULL_FACE)
1080        case GL_CULL_FACE:
1081#endif // defined(GL_CULL_FACE)
1082#if defined(GL_DEPTH_BITS)
1083        case GL_DEPTH_BITS:
1084#endif // defined(GL_DEPTH_BITS)
1085#if defined(GL_DEPTH_CLEAR_VALUE)
1086        case GL_DEPTH_CLEAR_VALUE:
1087#endif // defined(GL_DEPTH_CLEAR_VALUE)
1088#if defined(GL_DEPTH_FUNC)
1089        case GL_DEPTH_FUNC:
1090#endif // defined(GL_DEPTH_FUNC)
1091#if defined(GL_DEPTH_WRITEMASK)
1092        case GL_DEPTH_WRITEMASK:
1093#endif // defined(GL_DEPTH_WRITEMASK)
1094#if defined(GL_FOG_DENSITY)
1095        case GL_FOG_DENSITY:
1096#endif // defined(GL_FOG_DENSITY)
1097#if defined(GL_FOG_END)
1098        case GL_FOG_END:
1099#endif // defined(GL_FOG_END)
1100#if defined(GL_FOG_MODE)
1101        case GL_FOG_MODE:
1102#endif // defined(GL_FOG_MODE)
1103#if defined(GL_FOG_START)
1104        case GL_FOG_START:
1105#endif // defined(GL_FOG_START)
1106#if defined(GL_FRONT_FACE)
1107        case GL_FRONT_FACE:
1108#endif // defined(GL_FRONT_FACE)
1109#if defined(GL_GREEN_BITS)
1110        case GL_GREEN_BITS:
1111#endif // defined(GL_GREEN_BITS)
1112#if defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)
1113        case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
1114#endif // defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)
1115#if defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)
1116        case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
1117#endif // defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)
1118#if defined(GL_LIGHT_MODEL_COLOR_CONTROL)
1119        case GL_LIGHT_MODEL_COLOR_CONTROL:
1120#endif // defined(GL_LIGHT_MODEL_COLOR_CONTROL)
1121#if defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
1122        case GL_LIGHT_MODEL_LOCAL_VIEWER:
1123#endif // defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
1124#if defined(GL_LIGHT_MODEL_TWO_SIDE)
1125        case GL_LIGHT_MODEL_TWO_SIDE:
1126#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
1127#if defined(GL_LINE_SMOOTH_HINT)
1128        case GL_LINE_SMOOTH_HINT:
1129#endif // defined(GL_LINE_SMOOTH_HINT)
1130#if defined(GL_LINE_WIDTH)
1131        case GL_LINE_WIDTH:
1132#endif // defined(GL_LINE_WIDTH)
1133#if defined(GL_LOGIC_OP_MODE)
1134        case GL_LOGIC_OP_MODE:
1135#endif // defined(GL_LOGIC_OP_MODE)
1136#if defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES)
1137        case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES:
1138#endif // defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES)
1139#if defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES)
1140        case GL_MATRIX_INDEX_ARRAY_SIZE_OES:
1141#endif // defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES)
1142#if defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES)
1143        case GL_MATRIX_INDEX_ARRAY_STRIDE_OES:
1144#endif // defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES)
1145#if defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES)
1146        case GL_MATRIX_INDEX_ARRAY_TYPE_OES:
1147#endif // defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES)
1148#if defined(GL_MATRIX_MODE)
1149        case GL_MATRIX_MODE:
1150#endif // defined(GL_MATRIX_MODE)
1151#if defined(GL_MAX_CLIP_PLANES)
1152        case GL_MAX_CLIP_PLANES:
1153#endif // defined(GL_MAX_CLIP_PLANES)
1154#if defined(GL_MAX_ELEMENTS_INDICES)
1155        case GL_MAX_ELEMENTS_INDICES:
1156#endif // defined(GL_MAX_ELEMENTS_INDICES)
1157#if defined(GL_MAX_ELEMENTS_VERTICES)
1158        case GL_MAX_ELEMENTS_VERTICES:
1159#endif // defined(GL_MAX_ELEMENTS_VERTICES)
1160#if defined(GL_MAX_LIGHTS)
1161        case GL_MAX_LIGHTS:
1162#endif // defined(GL_MAX_LIGHTS)
1163#if defined(GL_MAX_MODELVIEW_STACK_DEPTH)
1164        case GL_MAX_MODELVIEW_STACK_DEPTH:
1165#endif // defined(GL_MAX_MODELVIEW_STACK_DEPTH)
1166#if defined(GL_MAX_PALETTE_MATRICES_OES)
1167        case GL_MAX_PALETTE_MATRICES_OES:
1168#endif // defined(GL_MAX_PALETTE_MATRICES_OES)
1169#if defined(GL_MAX_PROJECTION_STACK_DEPTH)
1170        case GL_MAX_PROJECTION_STACK_DEPTH:
1171#endif // defined(GL_MAX_PROJECTION_STACK_DEPTH)
1172#if defined(GL_MAX_TEXTURE_SIZE)
1173        case GL_MAX_TEXTURE_SIZE:
1174#endif // defined(GL_MAX_TEXTURE_SIZE)
1175#if defined(GL_MAX_TEXTURE_STACK_DEPTH)
1176        case GL_MAX_TEXTURE_STACK_DEPTH:
1177#endif // defined(GL_MAX_TEXTURE_STACK_DEPTH)
1178#if defined(GL_MAX_TEXTURE_UNITS)
1179        case GL_MAX_TEXTURE_UNITS:
1180#endif // defined(GL_MAX_TEXTURE_UNITS)
1181#if defined(GL_MAX_VERTEX_UNITS_OES)
1182        case GL_MAX_VERTEX_UNITS_OES:
1183#endif // defined(GL_MAX_VERTEX_UNITS_OES)
1184#if defined(GL_MODELVIEW_STACK_DEPTH)
1185        case GL_MODELVIEW_STACK_DEPTH:
1186#endif // defined(GL_MODELVIEW_STACK_DEPTH)
1187#if defined(GL_NORMAL_ARRAY_BUFFER_BINDING)
1188        case GL_NORMAL_ARRAY_BUFFER_BINDING:
1189#endif // defined(GL_NORMAL_ARRAY_BUFFER_BINDING)
1190#if defined(GL_NORMAL_ARRAY_STRIDE)
1191        case GL_NORMAL_ARRAY_STRIDE:
1192#endif // defined(GL_NORMAL_ARRAY_STRIDE)
1193#if defined(GL_NORMAL_ARRAY_TYPE)
1194        case GL_NORMAL_ARRAY_TYPE:
1195#endif // defined(GL_NORMAL_ARRAY_TYPE)
1196#if defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
1197        case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
1198#endif // defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
1199#if defined(GL_PACK_ALIGNMENT)
1200        case GL_PACK_ALIGNMENT:
1201#endif // defined(GL_PACK_ALIGNMENT)
1202#if defined(GL_PERSPECTIVE_CORRECTION_HINT)
1203        case GL_PERSPECTIVE_CORRECTION_HINT:
1204#endif // defined(GL_PERSPECTIVE_CORRECTION_HINT)
1205#if defined(GL_POINT_SIZE)
1206        case GL_POINT_SIZE:
1207#endif // defined(GL_POINT_SIZE)
1208#if defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES)
1209        case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
1210#endif // defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES)
1211#if defined(GL_POINT_SIZE_ARRAY_STRIDE_OES)
1212        case GL_POINT_SIZE_ARRAY_STRIDE_OES:
1213#endif // defined(GL_POINT_SIZE_ARRAY_STRIDE_OES)
1214#if defined(GL_POINT_SIZE_ARRAY_TYPE_OES)
1215        case GL_POINT_SIZE_ARRAY_TYPE_OES:
1216#endif // defined(GL_POINT_SIZE_ARRAY_TYPE_OES)
1217#if defined(GL_POINT_SMOOTH_HINT)
1218        case GL_POINT_SMOOTH_HINT:
1219#endif // defined(GL_POINT_SMOOTH_HINT)
1220#if defined(GL_POLYGON_OFFSET_FACTOR)
1221        case GL_POLYGON_OFFSET_FACTOR:
1222#endif // defined(GL_POLYGON_OFFSET_FACTOR)
1223#if defined(GL_POLYGON_OFFSET_UNITS)
1224        case GL_POLYGON_OFFSET_UNITS:
1225#endif // defined(GL_POLYGON_OFFSET_UNITS)
1226#if defined(GL_PROJECTION_STACK_DEPTH)
1227        case GL_PROJECTION_STACK_DEPTH:
1228#endif // defined(GL_PROJECTION_STACK_DEPTH)
1229#if defined(GL_RED_BITS)
1230        case GL_RED_BITS:
1231#endif // defined(GL_RED_BITS)
1232#if defined(GL_SHADE_MODEL)
1233        case GL_SHADE_MODEL:
1234#endif // defined(GL_SHADE_MODEL)
1235#if defined(GL_STENCIL_BITS)
1236        case GL_STENCIL_BITS:
1237#endif // defined(GL_STENCIL_BITS)
1238#if defined(GL_STENCIL_CLEAR_VALUE)
1239        case GL_STENCIL_CLEAR_VALUE:
1240#endif // defined(GL_STENCIL_CLEAR_VALUE)
1241#if defined(GL_STENCIL_FAIL)
1242        case GL_STENCIL_FAIL:
1243#endif // defined(GL_STENCIL_FAIL)
1244#if defined(GL_STENCIL_FUNC)
1245        case GL_STENCIL_FUNC:
1246#endif // defined(GL_STENCIL_FUNC)
1247#if defined(GL_STENCIL_PASS_DEPTH_FAIL)
1248        case GL_STENCIL_PASS_DEPTH_FAIL:
1249#endif // defined(GL_STENCIL_PASS_DEPTH_FAIL)
1250#if defined(GL_STENCIL_PASS_DEPTH_PASS)
1251        case GL_STENCIL_PASS_DEPTH_PASS:
1252#endif // defined(GL_STENCIL_PASS_DEPTH_PASS)
1253#if defined(GL_STENCIL_REF)
1254        case GL_STENCIL_REF:
1255#endif // defined(GL_STENCIL_REF)
1256#if defined(GL_STENCIL_VALUE_MASK)
1257        case GL_STENCIL_VALUE_MASK:
1258#endif // defined(GL_STENCIL_VALUE_MASK)
1259#if defined(GL_STENCIL_WRITEMASK)
1260        case GL_STENCIL_WRITEMASK:
1261#endif // defined(GL_STENCIL_WRITEMASK)
1262#if defined(GL_SUBPIXEL_BITS)
1263        case GL_SUBPIXEL_BITS:
1264#endif // defined(GL_SUBPIXEL_BITS)
1265#if defined(GL_TEXTURE_BINDING_2D)
1266        case GL_TEXTURE_BINDING_2D:
1267#endif // defined(GL_TEXTURE_BINDING_2D)
1268#if defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)
1269        case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
1270#endif // defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)
1271#if defined(GL_TEXTURE_COORD_ARRAY_SIZE)
1272        case GL_TEXTURE_COORD_ARRAY_SIZE:
1273#endif // defined(GL_TEXTURE_COORD_ARRAY_SIZE)
1274#if defined(GL_TEXTURE_COORD_ARRAY_STRIDE)
1275        case GL_TEXTURE_COORD_ARRAY_STRIDE:
1276#endif // defined(GL_TEXTURE_COORD_ARRAY_STRIDE)
1277#if defined(GL_TEXTURE_COORD_ARRAY_TYPE)
1278        case GL_TEXTURE_COORD_ARRAY_TYPE:
1279#endif // defined(GL_TEXTURE_COORD_ARRAY_TYPE)
1280#if defined(GL_TEXTURE_STACK_DEPTH)
1281        case GL_TEXTURE_STACK_DEPTH:
1282#endif // defined(GL_TEXTURE_STACK_DEPTH)
1283#if defined(GL_UNPACK_ALIGNMENT)
1284        case GL_UNPACK_ALIGNMENT:
1285#endif // defined(GL_UNPACK_ALIGNMENT)
1286#if defined(GL_VERTEX_ARRAY_BUFFER_BINDING)
1287        case GL_VERTEX_ARRAY_BUFFER_BINDING:
1288#endif // defined(GL_VERTEX_ARRAY_BUFFER_BINDING)
1289#if defined(GL_VERTEX_ARRAY_SIZE)
1290        case GL_VERTEX_ARRAY_SIZE:
1291#endif // defined(GL_VERTEX_ARRAY_SIZE)
1292#if defined(GL_VERTEX_ARRAY_STRIDE)
1293        case GL_VERTEX_ARRAY_STRIDE:
1294#endif // defined(GL_VERTEX_ARRAY_STRIDE)
1295#if defined(GL_VERTEX_ARRAY_TYPE)
1296        case GL_VERTEX_ARRAY_TYPE:
1297#endif // defined(GL_VERTEX_ARRAY_TYPE)
1298#if defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES)
1299        case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES:
1300#endif // defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES)
1301#if defined(GL_WEIGHT_ARRAY_SIZE_OES)
1302        case GL_WEIGHT_ARRAY_SIZE_OES:
1303#endif // defined(GL_WEIGHT_ARRAY_SIZE_OES)
1304#if defined(GL_WEIGHT_ARRAY_STRIDE_OES)
1305        case GL_WEIGHT_ARRAY_STRIDE_OES:
1306#endif // defined(GL_WEIGHT_ARRAY_STRIDE_OES)
1307#if defined(GL_WEIGHT_ARRAY_TYPE_OES)
1308        case GL_WEIGHT_ARRAY_TYPE_OES:
1309#endif // defined(GL_WEIGHT_ARRAY_TYPE_OES)
1310            _needed = 1;
1311            break;
1312#if defined(GL_ALIASED_POINT_SIZE_RANGE)
1313        case GL_ALIASED_POINT_SIZE_RANGE:
1314#endif // defined(GL_ALIASED_POINT_SIZE_RANGE)
1315#if defined(GL_ALIASED_LINE_WIDTH_RANGE)
1316        case GL_ALIASED_LINE_WIDTH_RANGE:
1317#endif // defined(GL_ALIASED_LINE_WIDTH_RANGE)
1318#if defined(GL_DEPTH_RANGE)
1319        case GL_DEPTH_RANGE:
1320#endif // defined(GL_DEPTH_RANGE)
1321#if defined(GL_MAX_VIEWPORT_DIMS)
1322        case GL_MAX_VIEWPORT_DIMS:
1323#endif // defined(GL_MAX_VIEWPORT_DIMS)
1324#if defined(GL_SMOOTH_LINE_WIDTH_RANGE)
1325        case GL_SMOOTH_LINE_WIDTH_RANGE:
1326#endif // defined(GL_SMOOTH_LINE_WIDTH_RANGE)
1327#if defined(GL_SMOOTH_POINT_SIZE_RANGE)
1328        case GL_SMOOTH_POINT_SIZE_RANGE:
1329#endif // defined(GL_SMOOTH_POINT_SIZE_RANGE)
1330            _needed = 2;
1331            break;
1332#if defined(GL_COLOR_CLEAR_VALUE)
1333        case GL_COLOR_CLEAR_VALUE:
1334#endif // defined(GL_COLOR_CLEAR_VALUE)
1335#if defined(GL_COLOR_WRITEMASK)
1336        case GL_COLOR_WRITEMASK:
1337#endif // defined(GL_COLOR_WRITEMASK)
1338#if defined(GL_FOG_COLOR)
1339        case GL_FOG_COLOR:
1340#endif // defined(GL_FOG_COLOR)
1341#if defined(GL_LIGHT_MODEL_AMBIENT)
1342        case GL_LIGHT_MODEL_AMBIENT:
1343#endif // defined(GL_LIGHT_MODEL_AMBIENT)
1344#if defined(GL_SCISSOR_BOX)
1345        case GL_SCISSOR_BOX:
1346#endif // defined(GL_SCISSOR_BOX)
1347#if defined(GL_VIEWPORT)
1348        case GL_VIEWPORT:
1349#endif // defined(GL_VIEWPORT)
1350            _needed = 4;
1351            break;
1352#if defined(GL_MODELVIEW_MATRIX)
1353        case GL_MODELVIEW_MATRIX:
1354#endif // defined(GL_MODELVIEW_MATRIX)
1355#if defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES)
1356        case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES:
1357#endif // defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES)
1358#if defined(GL_PROJECTION_MATRIX)
1359        case GL_PROJECTION_MATRIX:
1360#endif // defined(GL_PROJECTION_MATRIX)
1361#if defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES)
1362        case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES:
1363#endif // defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES)
1364#if defined(GL_TEXTURE_MATRIX)
1365        case GL_TEXTURE_MATRIX:
1366#endif // defined(GL_TEXTURE_MATRIX)
1367#if defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES)
1368        case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES:
1369#endif // defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES)
1370            _needed = 16;
1371            break;
1372#if defined(GL_COMPRESSED_TEXTURE_FORMATS)
1373        case GL_COMPRESSED_TEXTURE_FORMATS:
1374#endif // defined(GL_COMPRESSED_TEXTURE_FORMATS)
1375            _needed = getNumCompressedTextureFormats();
1376            break;
1377        default:
1378            _needed = 0;
1379            break;
1380    }
1381    if (_remaining < _needed) {
1382        _exception = 1;
1383        _exceptionType = "java/lang/IllegalArgumentException";
1384        _exceptionMessage = "length - offset < needed";
1385        goto exit;
1386    }
1387    params_base = (GLint *)
1388        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1389    params = params_base + offset;
1390
1391    glGetIntegerv(
1392        (GLenum)pname,
1393        (GLint *)params
1394    );
1395
1396exit:
1397    if (params_base) {
1398        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1399            _exception ? JNI_ABORT: 0);
1400    }
1401    if (_exception) {
1402        jniThrowException(_env, _exceptionType, _exceptionMessage);
1403    }
1404}
1405
1406/* void glGetIntegerv ( GLenum pname, GLint *params ) */
1407static void
1408android_glGetIntegerv__ILjava_nio_IntBuffer_2
1409  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
1410    jint _exception = 0;
1411    const char * _exceptionType;
1412    const char * _exceptionMessage;
1413    jarray _array = (jarray) 0;
1414    jint _remaining;
1415    GLint *params = (GLint *) 0;
1416
1417    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
1418    int _needed;
1419    switch (pname) {
1420#if defined(GL_ALPHA_BITS)
1421        case GL_ALPHA_BITS:
1422#endif // defined(GL_ALPHA_BITS)
1423#if defined(GL_ALPHA_TEST_FUNC)
1424        case GL_ALPHA_TEST_FUNC:
1425#endif // defined(GL_ALPHA_TEST_FUNC)
1426#if defined(GL_ALPHA_TEST_REF)
1427        case GL_ALPHA_TEST_REF:
1428#endif // defined(GL_ALPHA_TEST_REF)
1429#if defined(GL_BLEND_DST)
1430        case GL_BLEND_DST:
1431#endif // defined(GL_BLEND_DST)
1432#if defined(GL_BLUE_BITS)
1433        case GL_BLUE_BITS:
1434#endif // defined(GL_BLUE_BITS)
1435#if defined(GL_COLOR_ARRAY_BUFFER_BINDING)
1436        case GL_COLOR_ARRAY_BUFFER_BINDING:
1437#endif // defined(GL_COLOR_ARRAY_BUFFER_BINDING)
1438#if defined(GL_COLOR_ARRAY_SIZE)
1439        case GL_COLOR_ARRAY_SIZE:
1440#endif // defined(GL_COLOR_ARRAY_SIZE)
1441#if defined(GL_COLOR_ARRAY_STRIDE)
1442        case GL_COLOR_ARRAY_STRIDE:
1443#endif // defined(GL_COLOR_ARRAY_STRIDE)
1444#if defined(GL_COLOR_ARRAY_TYPE)
1445        case GL_COLOR_ARRAY_TYPE:
1446#endif // defined(GL_COLOR_ARRAY_TYPE)
1447#if defined(GL_CULL_FACE)
1448        case GL_CULL_FACE:
1449#endif // defined(GL_CULL_FACE)
1450#if defined(GL_DEPTH_BITS)
1451        case GL_DEPTH_BITS:
1452#endif // defined(GL_DEPTH_BITS)
1453#if defined(GL_DEPTH_CLEAR_VALUE)
1454        case GL_DEPTH_CLEAR_VALUE:
1455#endif // defined(GL_DEPTH_CLEAR_VALUE)
1456#if defined(GL_DEPTH_FUNC)
1457        case GL_DEPTH_FUNC:
1458#endif // defined(GL_DEPTH_FUNC)
1459#if defined(GL_DEPTH_WRITEMASK)
1460        case GL_DEPTH_WRITEMASK:
1461#endif // defined(GL_DEPTH_WRITEMASK)
1462#if defined(GL_FOG_DENSITY)
1463        case GL_FOG_DENSITY:
1464#endif // defined(GL_FOG_DENSITY)
1465#if defined(GL_FOG_END)
1466        case GL_FOG_END:
1467#endif // defined(GL_FOG_END)
1468#if defined(GL_FOG_MODE)
1469        case GL_FOG_MODE:
1470#endif // defined(GL_FOG_MODE)
1471#if defined(GL_FOG_START)
1472        case GL_FOG_START:
1473#endif // defined(GL_FOG_START)
1474#if defined(GL_FRONT_FACE)
1475        case GL_FRONT_FACE:
1476#endif // defined(GL_FRONT_FACE)
1477#if defined(GL_GREEN_BITS)
1478        case GL_GREEN_BITS:
1479#endif // defined(GL_GREEN_BITS)
1480#if defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)
1481        case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
1482#endif // defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)
1483#if defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)
1484        case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
1485#endif // defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)
1486#if defined(GL_LIGHT_MODEL_COLOR_CONTROL)
1487        case GL_LIGHT_MODEL_COLOR_CONTROL:
1488#endif // defined(GL_LIGHT_MODEL_COLOR_CONTROL)
1489#if defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
1490        case GL_LIGHT_MODEL_LOCAL_VIEWER:
1491#endif // defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
1492#if defined(GL_LIGHT_MODEL_TWO_SIDE)
1493        case GL_LIGHT_MODEL_TWO_SIDE:
1494#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
1495#if defined(GL_LINE_SMOOTH_HINT)
1496        case GL_LINE_SMOOTH_HINT:
1497#endif // defined(GL_LINE_SMOOTH_HINT)
1498#if defined(GL_LINE_WIDTH)
1499        case GL_LINE_WIDTH:
1500#endif // defined(GL_LINE_WIDTH)
1501#if defined(GL_LOGIC_OP_MODE)
1502        case GL_LOGIC_OP_MODE:
1503#endif // defined(GL_LOGIC_OP_MODE)
1504#if defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES)
1505        case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES:
1506#endif // defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES)
1507#if defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES)
1508        case GL_MATRIX_INDEX_ARRAY_SIZE_OES:
1509#endif // defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES)
1510#if defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES)
1511        case GL_MATRIX_INDEX_ARRAY_STRIDE_OES:
1512#endif // defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES)
1513#if defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES)
1514        case GL_MATRIX_INDEX_ARRAY_TYPE_OES:
1515#endif // defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES)
1516#if defined(GL_MATRIX_MODE)
1517        case GL_MATRIX_MODE:
1518#endif // defined(GL_MATRIX_MODE)
1519#if defined(GL_MAX_CLIP_PLANES)
1520        case GL_MAX_CLIP_PLANES:
1521#endif // defined(GL_MAX_CLIP_PLANES)
1522#if defined(GL_MAX_ELEMENTS_INDICES)
1523        case GL_MAX_ELEMENTS_INDICES:
1524#endif // defined(GL_MAX_ELEMENTS_INDICES)
1525#if defined(GL_MAX_ELEMENTS_VERTICES)
1526        case GL_MAX_ELEMENTS_VERTICES:
1527#endif // defined(GL_MAX_ELEMENTS_VERTICES)
1528#if defined(GL_MAX_LIGHTS)
1529        case GL_MAX_LIGHTS:
1530#endif // defined(GL_MAX_LIGHTS)
1531#if defined(GL_MAX_MODELVIEW_STACK_DEPTH)
1532        case GL_MAX_MODELVIEW_STACK_DEPTH:
1533#endif // defined(GL_MAX_MODELVIEW_STACK_DEPTH)
1534#if defined(GL_MAX_PALETTE_MATRICES_OES)
1535        case GL_MAX_PALETTE_MATRICES_OES:
1536#endif // defined(GL_MAX_PALETTE_MATRICES_OES)
1537#if defined(GL_MAX_PROJECTION_STACK_DEPTH)
1538        case GL_MAX_PROJECTION_STACK_DEPTH:
1539#endif // defined(GL_MAX_PROJECTION_STACK_DEPTH)
1540#if defined(GL_MAX_TEXTURE_SIZE)
1541        case GL_MAX_TEXTURE_SIZE:
1542#endif // defined(GL_MAX_TEXTURE_SIZE)
1543#if defined(GL_MAX_TEXTURE_STACK_DEPTH)
1544        case GL_MAX_TEXTURE_STACK_DEPTH:
1545#endif // defined(GL_MAX_TEXTURE_STACK_DEPTH)
1546#if defined(GL_MAX_TEXTURE_UNITS)
1547        case GL_MAX_TEXTURE_UNITS:
1548#endif // defined(GL_MAX_TEXTURE_UNITS)
1549#if defined(GL_MAX_VERTEX_UNITS_OES)
1550        case GL_MAX_VERTEX_UNITS_OES:
1551#endif // defined(GL_MAX_VERTEX_UNITS_OES)
1552#if defined(GL_MODELVIEW_STACK_DEPTH)
1553        case GL_MODELVIEW_STACK_DEPTH:
1554#endif // defined(GL_MODELVIEW_STACK_DEPTH)
1555#if defined(GL_NORMAL_ARRAY_BUFFER_BINDING)
1556        case GL_NORMAL_ARRAY_BUFFER_BINDING:
1557#endif // defined(GL_NORMAL_ARRAY_BUFFER_BINDING)
1558#if defined(GL_NORMAL_ARRAY_STRIDE)
1559        case GL_NORMAL_ARRAY_STRIDE:
1560#endif // defined(GL_NORMAL_ARRAY_STRIDE)
1561#if defined(GL_NORMAL_ARRAY_TYPE)
1562        case GL_NORMAL_ARRAY_TYPE:
1563#endif // defined(GL_NORMAL_ARRAY_TYPE)
1564#if defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
1565        case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
1566#endif // defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
1567#if defined(GL_PACK_ALIGNMENT)
1568        case GL_PACK_ALIGNMENT:
1569#endif // defined(GL_PACK_ALIGNMENT)
1570#if defined(GL_PERSPECTIVE_CORRECTION_HINT)
1571        case GL_PERSPECTIVE_CORRECTION_HINT:
1572#endif // defined(GL_PERSPECTIVE_CORRECTION_HINT)
1573#if defined(GL_POINT_SIZE)
1574        case GL_POINT_SIZE:
1575#endif // defined(GL_POINT_SIZE)
1576#if defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES)
1577        case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
1578#endif // defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES)
1579#if defined(GL_POINT_SIZE_ARRAY_STRIDE_OES)
1580        case GL_POINT_SIZE_ARRAY_STRIDE_OES:
1581#endif // defined(GL_POINT_SIZE_ARRAY_STRIDE_OES)
1582#if defined(GL_POINT_SIZE_ARRAY_TYPE_OES)
1583        case GL_POINT_SIZE_ARRAY_TYPE_OES:
1584#endif // defined(GL_POINT_SIZE_ARRAY_TYPE_OES)
1585#if defined(GL_POINT_SMOOTH_HINT)
1586        case GL_POINT_SMOOTH_HINT:
1587#endif // defined(GL_POINT_SMOOTH_HINT)
1588#if defined(GL_POLYGON_OFFSET_FACTOR)
1589        case GL_POLYGON_OFFSET_FACTOR:
1590#endif // defined(GL_POLYGON_OFFSET_FACTOR)
1591#if defined(GL_POLYGON_OFFSET_UNITS)
1592        case GL_POLYGON_OFFSET_UNITS:
1593#endif // defined(GL_POLYGON_OFFSET_UNITS)
1594#if defined(GL_PROJECTION_STACK_DEPTH)
1595        case GL_PROJECTION_STACK_DEPTH:
1596#endif // defined(GL_PROJECTION_STACK_DEPTH)
1597#if defined(GL_RED_BITS)
1598        case GL_RED_BITS:
1599#endif // defined(GL_RED_BITS)
1600#if defined(GL_SHADE_MODEL)
1601        case GL_SHADE_MODEL:
1602#endif // defined(GL_SHADE_MODEL)
1603#if defined(GL_STENCIL_BITS)
1604        case GL_STENCIL_BITS:
1605#endif // defined(GL_STENCIL_BITS)
1606#if defined(GL_STENCIL_CLEAR_VALUE)
1607        case GL_STENCIL_CLEAR_VALUE:
1608#endif // defined(GL_STENCIL_CLEAR_VALUE)
1609#if defined(GL_STENCIL_FAIL)
1610        case GL_STENCIL_FAIL:
1611#endif // defined(GL_STENCIL_FAIL)
1612#if defined(GL_STENCIL_FUNC)
1613        case GL_STENCIL_FUNC:
1614#endif // defined(GL_STENCIL_FUNC)
1615#if defined(GL_STENCIL_PASS_DEPTH_FAIL)
1616        case GL_STENCIL_PASS_DEPTH_FAIL:
1617#endif // defined(GL_STENCIL_PASS_DEPTH_FAIL)
1618#if defined(GL_STENCIL_PASS_DEPTH_PASS)
1619        case GL_STENCIL_PASS_DEPTH_PASS:
1620#endif // defined(GL_STENCIL_PASS_DEPTH_PASS)
1621#if defined(GL_STENCIL_REF)
1622        case GL_STENCIL_REF:
1623#endif // defined(GL_STENCIL_REF)
1624#if defined(GL_STENCIL_VALUE_MASK)
1625        case GL_STENCIL_VALUE_MASK:
1626#endif // defined(GL_STENCIL_VALUE_MASK)
1627#if defined(GL_STENCIL_WRITEMASK)
1628        case GL_STENCIL_WRITEMASK:
1629#endif // defined(GL_STENCIL_WRITEMASK)
1630#if defined(GL_SUBPIXEL_BITS)
1631        case GL_SUBPIXEL_BITS:
1632#endif // defined(GL_SUBPIXEL_BITS)
1633#if defined(GL_TEXTURE_BINDING_2D)
1634        case GL_TEXTURE_BINDING_2D:
1635#endif // defined(GL_TEXTURE_BINDING_2D)
1636#if defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)
1637        case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
1638#endif // defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)
1639#if defined(GL_TEXTURE_COORD_ARRAY_SIZE)
1640        case GL_TEXTURE_COORD_ARRAY_SIZE:
1641#endif // defined(GL_TEXTURE_COORD_ARRAY_SIZE)
1642#if defined(GL_TEXTURE_COORD_ARRAY_STRIDE)
1643        case GL_TEXTURE_COORD_ARRAY_STRIDE:
1644#endif // defined(GL_TEXTURE_COORD_ARRAY_STRIDE)
1645#if defined(GL_TEXTURE_COORD_ARRAY_TYPE)
1646        case GL_TEXTURE_COORD_ARRAY_TYPE:
1647#endif // defined(GL_TEXTURE_COORD_ARRAY_TYPE)
1648#if defined(GL_TEXTURE_STACK_DEPTH)
1649        case GL_TEXTURE_STACK_DEPTH:
1650#endif // defined(GL_TEXTURE_STACK_DEPTH)
1651#if defined(GL_UNPACK_ALIGNMENT)
1652        case GL_UNPACK_ALIGNMENT:
1653#endif // defined(GL_UNPACK_ALIGNMENT)
1654#if defined(GL_VERTEX_ARRAY_BUFFER_BINDING)
1655        case GL_VERTEX_ARRAY_BUFFER_BINDING:
1656#endif // defined(GL_VERTEX_ARRAY_BUFFER_BINDING)
1657#if defined(GL_VERTEX_ARRAY_SIZE)
1658        case GL_VERTEX_ARRAY_SIZE:
1659#endif // defined(GL_VERTEX_ARRAY_SIZE)
1660#if defined(GL_VERTEX_ARRAY_STRIDE)
1661        case GL_VERTEX_ARRAY_STRIDE:
1662#endif // defined(GL_VERTEX_ARRAY_STRIDE)
1663#if defined(GL_VERTEX_ARRAY_TYPE)
1664        case GL_VERTEX_ARRAY_TYPE:
1665#endif // defined(GL_VERTEX_ARRAY_TYPE)
1666#if defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES)
1667        case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES:
1668#endif // defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES)
1669#if defined(GL_WEIGHT_ARRAY_SIZE_OES)
1670        case GL_WEIGHT_ARRAY_SIZE_OES:
1671#endif // defined(GL_WEIGHT_ARRAY_SIZE_OES)
1672#if defined(GL_WEIGHT_ARRAY_STRIDE_OES)
1673        case GL_WEIGHT_ARRAY_STRIDE_OES:
1674#endif // defined(GL_WEIGHT_ARRAY_STRIDE_OES)
1675#if defined(GL_WEIGHT_ARRAY_TYPE_OES)
1676        case GL_WEIGHT_ARRAY_TYPE_OES:
1677#endif // defined(GL_WEIGHT_ARRAY_TYPE_OES)
1678            _needed = 1;
1679            break;
1680#if defined(GL_ALIASED_POINT_SIZE_RANGE)
1681        case GL_ALIASED_POINT_SIZE_RANGE:
1682#endif // defined(GL_ALIASED_POINT_SIZE_RANGE)
1683#if defined(GL_ALIASED_LINE_WIDTH_RANGE)
1684        case GL_ALIASED_LINE_WIDTH_RANGE:
1685#endif // defined(GL_ALIASED_LINE_WIDTH_RANGE)
1686#if defined(GL_DEPTH_RANGE)
1687        case GL_DEPTH_RANGE:
1688#endif // defined(GL_DEPTH_RANGE)
1689#if defined(GL_MAX_VIEWPORT_DIMS)
1690        case GL_MAX_VIEWPORT_DIMS:
1691#endif // defined(GL_MAX_VIEWPORT_DIMS)
1692#if defined(GL_SMOOTH_LINE_WIDTH_RANGE)
1693        case GL_SMOOTH_LINE_WIDTH_RANGE:
1694#endif // defined(GL_SMOOTH_LINE_WIDTH_RANGE)
1695#if defined(GL_SMOOTH_POINT_SIZE_RANGE)
1696        case GL_SMOOTH_POINT_SIZE_RANGE:
1697#endif // defined(GL_SMOOTH_POINT_SIZE_RANGE)
1698            _needed = 2;
1699            break;
1700#if defined(GL_COLOR_CLEAR_VALUE)
1701        case GL_COLOR_CLEAR_VALUE:
1702#endif // defined(GL_COLOR_CLEAR_VALUE)
1703#if defined(GL_COLOR_WRITEMASK)
1704        case GL_COLOR_WRITEMASK:
1705#endif // defined(GL_COLOR_WRITEMASK)
1706#if defined(GL_FOG_COLOR)
1707        case GL_FOG_COLOR:
1708#endif // defined(GL_FOG_COLOR)
1709#if defined(GL_LIGHT_MODEL_AMBIENT)
1710        case GL_LIGHT_MODEL_AMBIENT:
1711#endif // defined(GL_LIGHT_MODEL_AMBIENT)
1712#if defined(GL_SCISSOR_BOX)
1713        case GL_SCISSOR_BOX:
1714#endif // defined(GL_SCISSOR_BOX)
1715#if defined(GL_VIEWPORT)
1716        case GL_VIEWPORT:
1717#endif // defined(GL_VIEWPORT)
1718            _needed = 4;
1719            break;
1720#if defined(GL_MODELVIEW_MATRIX)
1721        case GL_MODELVIEW_MATRIX:
1722#endif // defined(GL_MODELVIEW_MATRIX)
1723#if defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES)
1724        case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES:
1725#endif // defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES)
1726#if defined(GL_PROJECTION_MATRIX)
1727        case GL_PROJECTION_MATRIX:
1728#endif // defined(GL_PROJECTION_MATRIX)
1729#if defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES)
1730        case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES:
1731#endif // defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES)
1732#if defined(GL_TEXTURE_MATRIX)
1733        case GL_TEXTURE_MATRIX:
1734#endif // defined(GL_TEXTURE_MATRIX)
1735#if defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES)
1736        case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES:
1737#endif // defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES)
1738            _needed = 16;
1739            break;
1740#if defined(GL_COMPRESSED_TEXTURE_FORMATS)
1741        case GL_COMPRESSED_TEXTURE_FORMATS:
1742#endif // defined(GL_COMPRESSED_TEXTURE_FORMATS)
1743            _needed = getNumCompressedTextureFormats();
1744            break;
1745        default:
1746            _needed = 0;
1747            break;
1748    }
1749    if (_remaining < _needed) {
1750        _exception = 1;
1751        _exceptionType = "java/lang/IllegalArgumentException";
1752        _exceptionMessage = "remaining() < needed";
1753        goto exit;
1754    }
1755    glGetIntegerv(
1756        (GLenum)pname,
1757        (GLint *)params
1758    );
1759
1760exit:
1761    if (_array) {
1762        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1763    }
1764    if (_exception) {
1765        jniThrowException(_env, _exceptionType, _exceptionMessage);
1766    }
1767}
1768
1769/* const GLubyte * glGetString ( GLenum name ) */
1770static jstring android_glGetString(JNIEnv* _env, jobject, jint name) {
1771    const char* chars = (const char*) glGetString((GLenum) name);
1772    return _env->NewStringUTF(chars);
1773}
1774/* void glHint ( GLenum target, GLenum mode ) */
1775static void
1776android_glHint__II
1777  (JNIEnv *_env, jobject _this, jint target, jint mode) {
1778    glHint(
1779        (GLenum)target,
1780        (GLenum)mode
1781    );
1782}
1783
1784/* void glLightModelf ( GLenum pname, GLfloat param ) */
1785static void
1786android_glLightModelf__IF
1787  (JNIEnv *_env, jobject _this, jint pname, jfloat param) {
1788    glLightModelf(
1789        (GLenum)pname,
1790        (GLfloat)param
1791    );
1792}
1793
1794/* void glLightModelfv ( GLenum pname, const GLfloat *params ) */
1795static void
1796android_glLightModelfv__I_3FI
1797  (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
1798    jint _exception = 0;
1799    const char * _exceptionType;
1800    const char * _exceptionMessage;
1801    GLfloat *params_base = (GLfloat *) 0;
1802    jint _remaining;
1803    GLfloat *params = (GLfloat *) 0;
1804
1805    if (!params_ref) {
1806        _exception = 1;
1807        _exceptionType = "java/lang/IllegalArgumentException";
1808        _exceptionMessage = "params == null";
1809        goto exit;
1810    }
1811    if (offset < 0) {
1812        _exception = 1;
1813        _exceptionType = "java/lang/IllegalArgumentException";
1814        _exceptionMessage = "offset < 0";
1815        goto exit;
1816    }
1817    _remaining = _env->GetArrayLength(params_ref) - offset;
1818    int _needed;
1819    switch (pname) {
1820#if defined(GL_LIGHT_MODEL_TWO_SIDE)
1821        case GL_LIGHT_MODEL_TWO_SIDE:
1822#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
1823            _needed = 1;
1824            break;
1825#if defined(GL_LIGHT_MODEL_AMBIENT)
1826        case GL_LIGHT_MODEL_AMBIENT:
1827#endif // defined(GL_LIGHT_MODEL_AMBIENT)
1828            _needed = 4;
1829            break;
1830        default:
1831            _needed = 0;
1832            break;
1833    }
1834    if (_remaining < _needed) {
1835        _exception = 1;
1836        _exceptionType = "java/lang/IllegalArgumentException";
1837        _exceptionMessage = "length - offset < needed";
1838        goto exit;
1839    }
1840    params_base = (GLfloat *)
1841        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1842    params = params_base + offset;
1843
1844    glLightModelfv(
1845        (GLenum)pname,
1846        (GLfloat *)params
1847    );
1848
1849exit:
1850    if (params_base) {
1851        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1852            JNI_ABORT);
1853    }
1854    if (_exception) {
1855        jniThrowException(_env, _exceptionType, _exceptionMessage);
1856    }
1857}
1858
1859/* void glLightModelfv ( GLenum pname, const GLfloat *params ) */
1860static void
1861android_glLightModelfv__ILjava_nio_FloatBuffer_2
1862  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
1863    jint _exception = 0;
1864    const char * _exceptionType;
1865    const char * _exceptionMessage;
1866    jarray _array = (jarray) 0;
1867    jint _remaining;
1868    GLfloat *params = (GLfloat *) 0;
1869
1870    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
1871    int _needed;
1872    switch (pname) {
1873#if defined(GL_LIGHT_MODEL_TWO_SIDE)
1874        case GL_LIGHT_MODEL_TWO_SIDE:
1875#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
1876            _needed = 1;
1877            break;
1878#if defined(GL_LIGHT_MODEL_AMBIENT)
1879        case GL_LIGHT_MODEL_AMBIENT:
1880#endif // defined(GL_LIGHT_MODEL_AMBIENT)
1881            _needed = 4;
1882            break;
1883        default:
1884            _needed = 0;
1885            break;
1886    }
1887    if (_remaining < _needed) {
1888        _exception = 1;
1889        _exceptionType = "java/lang/IllegalArgumentException";
1890        _exceptionMessage = "remaining() < needed";
1891        goto exit;
1892    }
1893    glLightModelfv(
1894        (GLenum)pname,
1895        (GLfloat *)params
1896    );
1897
1898exit:
1899    if (_array) {
1900        releasePointer(_env, _array, params, JNI_FALSE);
1901    }
1902    if (_exception) {
1903        jniThrowException(_env, _exceptionType, _exceptionMessage);
1904    }
1905}
1906
1907/* void glLightModelx ( GLenum pname, GLfixed param ) */
1908static void
1909android_glLightModelx__II
1910  (JNIEnv *_env, jobject _this, jint pname, jint param) {
1911    glLightModelx(
1912        (GLenum)pname,
1913        (GLfixed)param
1914    );
1915}
1916
1917/* void glLightModelxv ( GLenum pname, const GLfixed *params ) */
1918static void
1919android_glLightModelxv__I_3II
1920  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
1921    jint _exception = 0;
1922    const char * _exceptionType;
1923    const char * _exceptionMessage;
1924    GLfixed *params_base = (GLfixed *) 0;
1925    jint _remaining;
1926    GLfixed *params = (GLfixed *) 0;
1927
1928    if (!params_ref) {
1929        _exception = 1;
1930        _exceptionType = "java/lang/IllegalArgumentException";
1931        _exceptionMessage = "params == null";
1932        goto exit;
1933    }
1934    if (offset < 0) {
1935        _exception = 1;
1936        _exceptionType = "java/lang/IllegalArgumentException";
1937        _exceptionMessage = "offset < 0";
1938        goto exit;
1939    }
1940    _remaining = _env->GetArrayLength(params_ref) - offset;
1941    int _needed;
1942    switch (pname) {
1943#if defined(GL_LIGHT_MODEL_TWO_SIDE)
1944        case GL_LIGHT_MODEL_TWO_SIDE:
1945#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
1946            _needed = 1;
1947            break;
1948#if defined(GL_LIGHT_MODEL_AMBIENT)
1949        case GL_LIGHT_MODEL_AMBIENT:
1950#endif // defined(GL_LIGHT_MODEL_AMBIENT)
1951            _needed = 4;
1952            break;
1953        default:
1954            _needed = 0;
1955            break;
1956    }
1957    if (_remaining < _needed) {
1958        _exception = 1;
1959        _exceptionType = "java/lang/IllegalArgumentException";
1960        _exceptionMessage = "length - offset < needed";
1961        goto exit;
1962    }
1963    params_base = (GLfixed *)
1964        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1965    params = params_base + offset;
1966
1967    glLightModelxv(
1968        (GLenum)pname,
1969        (GLfixed *)params
1970    );
1971
1972exit:
1973    if (params_base) {
1974        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1975            JNI_ABORT);
1976    }
1977    if (_exception) {
1978        jniThrowException(_env, _exceptionType, _exceptionMessage);
1979    }
1980}
1981
1982/* void glLightModelxv ( GLenum pname, const GLfixed *params ) */
1983static void
1984android_glLightModelxv__ILjava_nio_IntBuffer_2
1985  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
1986    jint _exception = 0;
1987    const char * _exceptionType;
1988    const char * _exceptionMessage;
1989    jarray _array = (jarray) 0;
1990    jint _remaining;
1991    GLfixed *params = (GLfixed *) 0;
1992
1993    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
1994    int _needed;
1995    switch (pname) {
1996#if defined(GL_LIGHT_MODEL_TWO_SIDE)
1997        case GL_LIGHT_MODEL_TWO_SIDE:
1998#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
1999            _needed = 1;
2000            break;
2001#if defined(GL_LIGHT_MODEL_AMBIENT)
2002        case GL_LIGHT_MODEL_AMBIENT:
2003#endif // defined(GL_LIGHT_MODEL_AMBIENT)
2004            _needed = 4;
2005            break;
2006        default:
2007            _needed = 0;
2008            break;
2009    }
2010    if (_remaining < _needed) {
2011        _exception = 1;
2012        _exceptionType = "java/lang/IllegalArgumentException";
2013        _exceptionMessage = "remaining() < needed";
2014        goto exit;
2015    }
2016    glLightModelxv(
2017        (GLenum)pname,
2018        (GLfixed *)params
2019    );
2020
2021exit:
2022    if (_array) {
2023        releasePointer(_env, _array, params, JNI_FALSE);
2024    }
2025    if (_exception) {
2026        jniThrowException(_env, _exceptionType, _exceptionMessage);
2027    }
2028}
2029
2030/* void glLightf ( GLenum light, GLenum pname, GLfloat param ) */
2031static void
2032android_glLightf__IIF
2033  (JNIEnv *_env, jobject _this, jint light, jint pname, jfloat param) {
2034    glLightf(
2035        (GLenum)light,
2036        (GLenum)pname,
2037        (GLfloat)param
2038    );
2039}
2040
2041/* void glLightfv ( GLenum light, GLenum pname, const GLfloat *params ) */
2042static void
2043android_glLightfv__II_3FI
2044  (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) {
2045    jint _exception = 0;
2046    const char * _exceptionType;
2047    const char * _exceptionMessage;
2048    GLfloat *params_base = (GLfloat *) 0;
2049    jint _remaining;
2050    GLfloat *params = (GLfloat *) 0;
2051
2052    if (!params_ref) {
2053        _exception = 1;
2054        _exceptionType = "java/lang/IllegalArgumentException";
2055        _exceptionMessage = "params == null";
2056        goto exit;
2057    }
2058    if (offset < 0) {
2059        _exception = 1;
2060        _exceptionType = "java/lang/IllegalArgumentException";
2061        _exceptionMessage = "offset < 0";
2062        goto exit;
2063    }
2064    _remaining = _env->GetArrayLength(params_ref) - offset;
2065    int _needed;
2066    switch (pname) {
2067#if defined(GL_SPOT_EXPONENT)
2068        case GL_SPOT_EXPONENT:
2069#endif // defined(GL_SPOT_EXPONENT)
2070#if defined(GL_SPOT_CUTOFF)
2071        case GL_SPOT_CUTOFF:
2072#endif // defined(GL_SPOT_CUTOFF)
2073#if defined(GL_CONSTANT_ATTENUATION)
2074        case GL_CONSTANT_ATTENUATION:
2075#endif // defined(GL_CONSTANT_ATTENUATION)
2076#if defined(GL_LINEAR_ATTENUATION)
2077        case GL_LINEAR_ATTENUATION:
2078#endif // defined(GL_LINEAR_ATTENUATION)
2079#if defined(GL_QUADRATIC_ATTENUATION)
2080        case GL_QUADRATIC_ATTENUATION:
2081#endif // defined(GL_QUADRATIC_ATTENUATION)
2082            _needed = 1;
2083            break;
2084#if defined(GL_SPOT_DIRECTION)
2085        case GL_SPOT_DIRECTION:
2086#endif // defined(GL_SPOT_DIRECTION)
2087            _needed = 3;
2088            break;
2089#if defined(GL_AMBIENT)
2090        case GL_AMBIENT:
2091#endif // defined(GL_AMBIENT)
2092#if defined(GL_DIFFUSE)
2093        case GL_DIFFUSE:
2094#endif // defined(GL_DIFFUSE)
2095#if defined(GL_SPECULAR)
2096        case GL_SPECULAR:
2097#endif // defined(GL_SPECULAR)
2098#if defined(GL_EMISSION)
2099        case GL_EMISSION:
2100#endif // defined(GL_EMISSION)
2101            _needed = 4;
2102            break;
2103        default:
2104            _needed = 0;
2105            break;
2106    }
2107    if (_remaining < _needed) {
2108        _exception = 1;
2109        _exceptionType = "java/lang/IllegalArgumentException";
2110        _exceptionMessage = "length - offset < needed";
2111        goto exit;
2112    }
2113    params_base = (GLfloat *)
2114        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2115    params = params_base + offset;
2116
2117    glLightfv(
2118        (GLenum)light,
2119        (GLenum)pname,
2120        (GLfloat *)params
2121    );
2122
2123exit:
2124    if (params_base) {
2125        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2126            JNI_ABORT);
2127    }
2128    if (_exception) {
2129        jniThrowException(_env, _exceptionType, _exceptionMessage);
2130    }
2131}
2132
2133/* void glLightfv ( GLenum light, GLenum pname, const GLfloat *params ) */
2134static void
2135android_glLightfv__IILjava_nio_FloatBuffer_2
2136  (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
2137    jint _exception = 0;
2138    const char * _exceptionType;
2139    const char * _exceptionMessage;
2140    jarray _array = (jarray) 0;
2141    jint _remaining;
2142    GLfloat *params = (GLfloat *) 0;
2143
2144    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
2145    int _needed;
2146    switch (pname) {
2147#if defined(GL_SPOT_EXPONENT)
2148        case GL_SPOT_EXPONENT:
2149#endif // defined(GL_SPOT_EXPONENT)
2150#if defined(GL_SPOT_CUTOFF)
2151        case GL_SPOT_CUTOFF:
2152#endif // defined(GL_SPOT_CUTOFF)
2153#if defined(GL_CONSTANT_ATTENUATION)
2154        case GL_CONSTANT_ATTENUATION:
2155#endif // defined(GL_CONSTANT_ATTENUATION)
2156#if defined(GL_LINEAR_ATTENUATION)
2157        case GL_LINEAR_ATTENUATION:
2158#endif // defined(GL_LINEAR_ATTENUATION)
2159#if defined(GL_QUADRATIC_ATTENUATION)
2160        case GL_QUADRATIC_ATTENUATION:
2161#endif // defined(GL_QUADRATIC_ATTENUATION)
2162            _needed = 1;
2163            break;
2164#if defined(GL_SPOT_DIRECTION)
2165        case GL_SPOT_DIRECTION:
2166#endif // defined(GL_SPOT_DIRECTION)
2167            _needed = 3;
2168            break;
2169#if defined(GL_AMBIENT)
2170        case GL_AMBIENT:
2171#endif // defined(GL_AMBIENT)
2172#if defined(GL_DIFFUSE)
2173        case GL_DIFFUSE:
2174#endif // defined(GL_DIFFUSE)
2175#if defined(GL_SPECULAR)
2176        case GL_SPECULAR:
2177#endif // defined(GL_SPECULAR)
2178#if defined(GL_EMISSION)
2179        case GL_EMISSION:
2180#endif // defined(GL_EMISSION)
2181            _needed = 4;
2182            break;
2183        default:
2184            _needed = 0;
2185            break;
2186    }
2187    if (_remaining < _needed) {
2188        _exception = 1;
2189        _exceptionType = "java/lang/IllegalArgumentException";
2190        _exceptionMessage = "remaining() < needed";
2191        goto exit;
2192    }
2193    glLightfv(
2194        (GLenum)light,
2195        (GLenum)pname,
2196        (GLfloat *)params
2197    );
2198
2199exit:
2200    if (_array) {
2201        releasePointer(_env, _array, params, JNI_FALSE);
2202    }
2203    if (_exception) {
2204        jniThrowException(_env, _exceptionType, _exceptionMessage);
2205    }
2206}
2207
2208/* void glLightx ( GLenum light, GLenum pname, GLfixed param ) */
2209static void
2210android_glLightx__III
2211  (JNIEnv *_env, jobject _this, jint light, jint pname, jint param) {
2212    glLightx(
2213        (GLenum)light,
2214        (GLenum)pname,
2215        (GLfixed)param
2216    );
2217}
2218
2219/* void glLightxv ( GLenum light, GLenum pname, const GLfixed *params ) */
2220static void
2221android_glLightxv__II_3II
2222  (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) {
2223    jint _exception = 0;
2224    const char * _exceptionType;
2225    const char * _exceptionMessage;
2226    GLfixed *params_base = (GLfixed *) 0;
2227    jint _remaining;
2228    GLfixed *params = (GLfixed *) 0;
2229
2230    if (!params_ref) {
2231        _exception = 1;
2232        _exceptionType = "java/lang/IllegalArgumentException";
2233        _exceptionMessage = "params == null";
2234        goto exit;
2235    }
2236    if (offset < 0) {
2237        _exception = 1;
2238        _exceptionType = "java/lang/IllegalArgumentException";
2239        _exceptionMessage = "offset < 0";
2240        goto exit;
2241    }
2242    _remaining = _env->GetArrayLength(params_ref) - offset;
2243    int _needed;
2244    switch (pname) {
2245#if defined(GL_SPOT_EXPONENT)
2246        case GL_SPOT_EXPONENT:
2247#endif // defined(GL_SPOT_EXPONENT)
2248#if defined(GL_SPOT_CUTOFF)
2249        case GL_SPOT_CUTOFF:
2250#endif // defined(GL_SPOT_CUTOFF)
2251#if defined(GL_CONSTANT_ATTENUATION)
2252        case GL_CONSTANT_ATTENUATION:
2253#endif // defined(GL_CONSTANT_ATTENUATION)
2254#if defined(GL_LINEAR_ATTENUATION)
2255        case GL_LINEAR_ATTENUATION:
2256#endif // defined(GL_LINEAR_ATTENUATION)
2257#if defined(GL_QUADRATIC_ATTENUATION)
2258        case GL_QUADRATIC_ATTENUATION:
2259#endif // defined(GL_QUADRATIC_ATTENUATION)
2260            _needed = 1;
2261            break;
2262#if defined(GL_SPOT_DIRECTION)
2263        case GL_SPOT_DIRECTION:
2264#endif // defined(GL_SPOT_DIRECTION)
2265            _needed = 3;
2266            break;
2267#if defined(GL_AMBIENT)
2268        case GL_AMBIENT:
2269#endif // defined(GL_AMBIENT)
2270#if defined(GL_DIFFUSE)
2271        case GL_DIFFUSE:
2272#endif // defined(GL_DIFFUSE)
2273#if defined(GL_SPECULAR)
2274        case GL_SPECULAR:
2275#endif // defined(GL_SPECULAR)
2276#if defined(GL_EMISSION)
2277        case GL_EMISSION:
2278#endif // defined(GL_EMISSION)
2279            _needed = 4;
2280            break;
2281        default:
2282            _needed = 0;
2283            break;
2284    }
2285    if (_remaining < _needed) {
2286        _exception = 1;
2287        _exceptionType = "java/lang/IllegalArgumentException";
2288        _exceptionMessage = "length - offset < needed";
2289        goto exit;
2290    }
2291    params_base = (GLfixed *)
2292        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2293    params = params_base + offset;
2294
2295    glLightxv(
2296        (GLenum)light,
2297        (GLenum)pname,
2298        (GLfixed *)params
2299    );
2300
2301exit:
2302    if (params_base) {
2303        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2304            JNI_ABORT);
2305    }
2306    if (_exception) {
2307        jniThrowException(_env, _exceptionType, _exceptionMessage);
2308    }
2309}
2310
2311/* void glLightxv ( GLenum light, GLenum pname, const GLfixed *params ) */
2312static void
2313android_glLightxv__IILjava_nio_IntBuffer_2
2314  (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
2315    jint _exception = 0;
2316    const char * _exceptionType;
2317    const char * _exceptionMessage;
2318    jarray _array = (jarray) 0;
2319    jint _remaining;
2320    GLfixed *params = (GLfixed *) 0;
2321
2322    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
2323    int _needed;
2324    switch (pname) {
2325#if defined(GL_SPOT_EXPONENT)
2326        case GL_SPOT_EXPONENT:
2327#endif // defined(GL_SPOT_EXPONENT)
2328#if defined(GL_SPOT_CUTOFF)
2329        case GL_SPOT_CUTOFF:
2330#endif // defined(GL_SPOT_CUTOFF)
2331#if defined(GL_CONSTANT_ATTENUATION)
2332        case GL_CONSTANT_ATTENUATION:
2333#endif // defined(GL_CONSTANT_ATTENUATION)
2334#if defined(GL_LINEAR_ATTENUATION)
2335        case GL_LINEAR_ATTENUATION:
2336#endif // defined(GL_LINEAR_ATTENUATION)
2337#if defined(GL_QUADRATIC_ATTENUATION)
2338        case GL_QUADRATIC_ATTENUATION:
2339#endif // defined(GL_QUADRATIC_ATTENUATION)
2340            _needed = 1;
2341            break;
2342#if defined(GL_SPOT_DIRECTION)
2343        case GL_SPOT_DIRECTION:
2344#endif // defined(GL_SPOT_DIRECTION)
2345            _needed = 3;
2346            break;
2347#if defined(GL_AMBIENT)
2348        case GL_AMBIENT:
2349#endif // defined(GL_AMBIENT)
2350#if defined(GL_DIFFUSE)
2351        case GL_DIFFUSE:
2352#endif // defined(GL_DIFFUSE)
2353#if defined(GL_SPECULAR)
2354        case GL_SPECULAR:
2355#endif // defined(GL_SPECULAR)
2356#if defined(GL_EMISSION)
2357        case GL_EMISSION:
2358#endif // defined(GL_EMISSION)
2359            _needed = 4;
2360            break;
2361        default:
2362            _needed = 0;
2363            break;
2364    }
2365    if (_remaining < _needed) {
2366        _exception = 1;
2367        _exceptionType = "java/lang/IllegalArgumentException";
2368        _exceptionMessage = "remaining() < needed";
2369        goto exit;
2370    }
2371    glLightxv(
2372        (GLenum)light,
2373        (GLenum)pname,
2374        (GLfixed *)params
2375    );
2376
2377exit:
2378    if (_array) {
2379        releasePointer(_env, _array, params, JNI_FALSE);
2380    }
2381    if (_exception) {
2382        jniThrowException(_env, _exceptionType, _exceptionMessage);
2383    }
2384}
2385
2386/* void glLineWidth ( GLfloat width ) */
2387static void
2388android_glLineWidth__F
2389  (JNIEnv *_env, jobject _this, jfloat width) {
2390    glLineWidth(
2391        (GLfloat)width
2392    );
2393}
2394
2395/* void glLineWidthx ( GLfixed width ) */
2396static void
2397android_glLineWidthx__I
2398  (JNIEnv *_env, jobject _this, jint width) {
2399    glLineWidthx(
2400        (GLfixed)width
2401    );
2402}
2403
2404/* void glLoadIdentity ( void ) */
2405static void
2406android_glLoadIdentity__
2407  (JNIEnv *_env, jobject _this) {
2408    glLoadIdentity();
2409}
2410
2411/* void glLoadMatrixf ( const GLfloat *m ) */
2412static void
2413android_glLoadMatrixf___3FI
2414  (JNIEnv *_env, jobject _this, jfloatArray m_ref, jint offset) {
2415    jint _exception = 0;
2416    const char * _exceptionType;
2417    const char * _exceptionMessage;
2418    GLfloat *m_base = (GLfloat *) 0;
2419    jint _remaining;
2420    GLfloat *m = (GLfloat *) 0;
2421
2422    if (!m_ref) {
2423        _exception = 1;
2424        _exceptionType = "java/lang/IllegalArgumentException";
2425        _exceptionMessage = "m == null";
2426        goto exit;
2427    }
2428    if (offset < 0) {
2429        _exception = 1;
2430        _exceptionType = "java/lang/IllegalArgumentException";
2431        _exceptionMessage = "offset < 0";
2432        goto exit;
2433    }
2434    _remaining = _env->GetArrayLength(m_ref) - offset;
2435    m_base = (GLfloat *)
2436        _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
2437    m = m_base + offset;
2438
2439    glLoadMatrixf(
2440        (GLfloat *)m
2441    );
2442
2443exit:
2444    if (m_base) {
2445        _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
2446            JNI_ABORT);
2447    }
2448    if (_exception) {
2449        jniThrowException(_env, _exceptionType, _exceptionMessage);
2450    }
2451}
2452
2453/* void glLoadMatrixf ( const GLfloat *m ) */
2454static void
2455android_glLoadMatrixf__Ljava_nio_FloatBuffer_2
2456  (JNIEnv *_env, jobject _this, jobject m_buf) {
2457    jarray _array = (jarray) 0;
2458    jint _remaining;
2459    GLfloat *m = (GLfloat *) 0;
2460
2461    m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining);
2462    glLoadMatrixf(
2463        (GLfloat *)m
2464    );
2465    if (_array) {
2466        releasePointer(_env, _array, m, JNI_FALSE);
2467    }
2468}
2469
2470/* void glLoadMatrixx ( const GLfixed *m ) */
2471static void
2472android_glLoadMatrixx___3II
2473  (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) {
2474    jint _exception = 0;
2475    const char * _exceptionType;
2476    const char * _exceptionMessage;
2477    GLfixed *m_base = (GLfixed *) 0;
2478    jint _remaining;
2479    GLfixed *m = (GLfixed *) 0;
2480
2481    if (!m_ref) {
2482        _exception = 1;
2483        _exceptionType = "java/lang/IllegalArgumentException";
2484        _exceptionMessage = "m == null";
2485        goto exit;
2486    }
2487    if (offset < 0) {
2488        _exception = 1;
2489        _exceptionType = "java/lang/IllegalArgumentException";
2490        _exceptionMessage = "offset < 0";
2491        goto exit;
2492    }
2493    _remaining = _env->GetArrayLength(m_ref) - offset;
2494    m_base = (GLfixed *)
2495        _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
2496    m = m_base + offset;
2497
2498    glLoadMatrixx(
2499        (GLfixed *)m
2500    );
2501
2502exit:
2503    if (m_base) {
2504        _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
2505            JNI_ABORT);
2506    }
2507    if (_exception) {
2508        jniThrowException(_env, _exceptionType, _exceptionMessage);
2509    }
2510}
2511
2512/* void glLoadMatrixx ( const GLfixed *m ) */
2513static void
2514android_glLoadMatrixx__Ljava_nio_IntBuffer_2
2515  (JNIEnv *_env, jobject _this, jobject m_buf) {
2516    jarray _array = (jarray) 0;
2517    jint _remaining;
2518    GLfixed *m = (GLfixed *) 0;
2519
2520    m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining);
2521    glLoadMatrixx(
2522        (GLfixed *)m
2523    );
2524    if (_array) {
2525        releasePointer(_env, _array, m, JNI_FALSE);
2526    }
2527}
2528
2529/* void glLogicOp ( GLenum opcode ) */
2530static void
2531android_glLogicOp__I
2532  (JNIEnv *_env, jobject _this, jint opcode) {
2533    glLogicOp(
2534        (GLenum)opcode
2535    );
2536}
2537
2538/* void glMaterialf ( GLenum face, GLenum pname, GLfloat param ) */
2539static void
2540android_glMaterialf__IIF
2541  (JNIEnv *_env, jobject _this, jint face, jint pname, jfloat param) {
2542    glMaterialf(
2543        (GLenum)face,
2544        (GLenum)pname,
2545        (GLfloat)param
2546    );
2547}
2548
2549/* void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) */
2550static void
2551android_glMaterialfv__II_3FI
2552  (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) {
2553    jint _exception = 0;
2554    const char * _exceptionType;
2555    const char * _exceptionMessage;
2556    GLfloat *params_base = (GLfloat *) 0;
2557    jint _remaining;
2558    GLfloat *params = (GLfloat *) 0;
2559
2560    if (!params_ref) {
2561        _exception = 1;
2562        _exceptionType = "java/lang/IllegalArgumentException";
2563        _exceptionMessage = "params == null";
2564        goto exit;
2565    }
2566    if (offset < 0) {
2567        _exception = 1;
2568        _exceptionType = "java/lang/IllegalArgumentException";
2569        _exceptionMessage = "offset < 0";
2570        goto exit;
2571    }
2572    _remaining = _env->GetArrayLength(params_ref) - offset;
2573    int _needed;
2574    switch (pname) {
2575#if defined(GL_SHININESS)
2576        case GL_SHININESS:
2577#endif // defined(GL_SHININESS)
2578            _needed = 1;
2579            break;
2580#if defined(GL_AMBIENT)
2581        case GL_AMBIENT:
2582#endif // defined(GL_AMBIENT)
2583#if defined(GL_DIFFUSE)
2584        case GL_DIFFUSE:
2585#endif // defined(GL_DIFFUSE)
2586#if defined(GL_SPECULAR)
2587        case GL_SPECULAR:
2588#endif // defined(GL_SPECULAR)
2589#if defined(GL_EMISSION)
2590        case GL_EMISSION:
2591#endif // defined(GL_EMISSION)
2592#if defined(GL_AMBIENT_AND_DIFFUSE)
2593        case GL_AMBIENT_AND_DIFFUSE:
2594#endif // defined(GL_AMBIENT_AND_DIFFUSE)
2595            _needed = 4;
2596            break;
2597        default:
2598            _needed = 0;
2599            break;
2600    }
2601    if (_remaining < _needed) {
2602        _exception = 1;
2603        _exceptionType = "java/lang/IllegalArgumentException";
2604        _exceptionMessage = "length - offset < needed";
2605        goto exit;
2606    }
2607    params_base = (GLfloat *)
2608        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2609    params = params_base + offset;
2610
2611    glMaterialfv(
2612        (GLenum)face,
2613        (GLenum)pname,
2614        (GLfloat *)params
2615    );
2616
2617exit:
2618    if (params_base) {
2619        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2620            JNI_ABORT);
2621    }
2622    if (_exception) {
2623        jniThrowException(_env, _exceptionType, _exceptionMessage);
2624    }
2625}
2626
2627/* void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) */
2628static void
2629android_glMaterialfv__IILjava_nio_FloatBuffer_2
2630  (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
2631    jint _exception = 0;
2632    const char * _exceptionType;
2633    const char * _exceptionMessage;
2634    jarray _array = (jarray) 0;
2635    jint _remaining;
2636    GLfloat *params = (GLfloat *) 0;
2637
2638    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
2639    int _needed;
2640    switch (pname) {
2641#if defined(GL_SHININESS)
2642        case GL_SHININESS:
2643#endif // defined(GL_SHININESS)
2644            _needed = 1;
2645            break;
2646#if defined(GL_AMBIENT)
2647        case GL_AMBIENT:
2648#endif // defined(GL_AMBIENT)
2649#if defined(GL_DIFFUSE)
2650        case GL_DIFFUSE:
2651#endif // defined(GL_DIFFUSE)
2652#if defined(GL_SPECULAR)
2653        case GL_SPECULAR:
2654#endif // defined(GL_SPECULAR)
2655#if defined(GL_EMISSION)
2656        case GL_EMISSION:
2657#endif // defined(GL_EMISSION)
2658#if defined(GL_AMBIENT_AND_DIFFUSE)
2659        case GL_AMBIENT_AND_DIFFUSE:
2660#endif // defined(GL_AMBIENT_AND_DIFFUSE)
2661            _needed = 4;
2662            break;
2663        default:
2664            _needed = 0;
2665            break;
2666    }
2667    if (_remaining < _needed) {
2668        _exception = 1;
2669        _exceptionType = "java/lang/IllegalArgumentException";
2670        _exceptionMessage = "remaining() < needed";
2671        goto exit;
2672    }
2673    glMaterialfv(
2674        (GLenum)face,
2675        (GLenum)pname,
2676        (GLfloat *)params
2677    );
2678
2679exit:
2680    if (_array) {
2681        releasePointer(_env, _array, params, JNI_FALSE);
2682    }
2683    if (_exception) {
2684        jniThrowException(_env, _exceptionType, _exceptionMessage);
2685    }
2686}
2687
2688/* void glMaterialx ( GLenum face, GLenum pname, GLfixed param ) */
2689static void
2690android_glMaterialx__III
2691  (JNIEnv *_env, jobject _this, jint face, jint pname, jint param) {
2692    glMaterialx(
2693        (GLenum)face,
2694        (GLenum)pname,
2695        (GLfixed)param
2696    );
2697}
2698
2699/* void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params ) */
2700static void
2701android_glMaterialxv__II_3II
2702  (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) {
2703    jint _exception = 0;
2704    const char * _exceptionType;
2705    const char * _exceptionMessage;
2706    GLfixed *params_base = (GLfixed *) 0;
2707    jint _remaining;
2708    GLfixed *params = (GLfixed *) 0;
2709
2710    if (!params_ref) {
2711        _exception = 1;
2712        _exceptionType = "java/lang/IllegalArgumentException";
2713        _exceptionMessage = "params == null";
2714        goto exit;
2715    }
2716    if (offset < 0) {
2717        _exception = 1;
2718        _exceptionType = "java/lang/IllegalArgumentException";
2719        _exceptionMessage = "offset < 0";
2720        goto exit;
2721    }
2722    _remaining = _env->GetArrayLength(params_ref) - offset;
2723    int _needed;
2724    switch (pname) {
2725#if defined(GL_SHININESS)
2726        case GL_SHININESS:
2727#endif // defined(GL_SHININESS)
2728            _needed = 1;
2729            break;
2730#if defined(GL_AMBIENT)
2731        case GL_AMBIENT:
2732#endif // defined(GL_AMBIENT)
2733#if defined(GL_DIFFUSE)
2734        case GL_DIFFUSE:
2735#endif // defined(GL_DIFFUSE)
2736#if defined(GL_SPECULAR)
2737        case GL_SPECULAR:
2738#endif // defined(GL_SPECULAR)
2739#if defined(GL_EMISSION)
2740        case GL_EMISSION:
2741#endif // defined(GL_EMISSION)
2742#if defined(GL_AMBIENT_AND_DIFFUSE)
2743        case GL_AMBIENT_AND_DIFFUSE:
2744#endif // defined(GL_AMBIENT_AND_DIFFUSE)
2745            _needed = 4;
2746            break;
2747        default:
2748            _needed = 0;
2749            break;
2750    }
2751    if (_remaining < _needed) {
2752        _exception = 1;
2753        _exceptionType = "java/lang/IllegalArgumentException";
2754        _exceptionMessage = "length - offset < needed";
2755        goto exit;
2756    }
2757    params_base = (GLfixed *)
2758        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2759    params = params_base + offset;
2760
2761    glMaterialxv(
2762        (GLenum)face,
2763        (GLenum)pname,
2764        (GLfixed *)params
2765    );
2766
2767exit:
2768    if (params_base) {
2769        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2770            JNI_ABORT);
2771    }
2772    if (_exception) {
2773        jniThrowException(_env, _exceptionType, _exceptionMessage);
2774    }
2775}
2776
2777/* void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params ) */
2778static void
2779android_glMaterialxv__IILjava_nio_IntBuffer_2
2780  (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
2781    jint _exception = 0;
2782    const char * _exceptionType;
2783    const char * _exceptionMessage;
2784    jarray _array = (jarray) 0;
2785    jint _remaining;
2786    GLfixed *params = (GLfixed *) 0;
2787
2788    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
2789    int _needed;
2790    switch (pname) {
2791#if defined(GL_SHININESS)
2792        case GL_SHININESS:
2793#endif // defined(GL_SHININESS)
2794            _needed = 1;
2795            break;
2796#if defined(GL_AMBIENT)
2797        case GL_AMBIENT:
2798#endif // defined(GL_AMBIENT)
2799#if defined(GL_DIFFUSE)
2800        case GL_DIFFUSE:
2801#endif // defined(GL_DIFFUSE)
2802#if defined(GL_SPECULAR)
2803        case GL_SPECULAR:
2804#endif // defined(GL_SPECULAR)
2805#if defined(GL_EMISSION)
2806        case GL_EMISSION:
2807#endif // defined(GL_EMISSION)
2808#if defined(GL_AMBIENT_AND_DIFFUSE)
2809        case GL_AMBIENT_AND_DIFFUSE:
2810#endif // defined(GL_AMBIENT_AND_DIFFUSE)
2811            _needed = 4;
2812            break;
2813        default:
2814            _needed = 0;
2815            break;
2816    }
2817    if (_remaining < _needed) {
2818        _exception = 1;
2819        _exceptionType = "java/lang/IllegalArgumentException";
2820        _exceptionMessage = "remaining() < needed";
2821        goto exit;
2822    }
2823    glMaterialxv(
2824        (GLenum)face,
2825        (GLenum)pname,
2826        (GLfixed *)params
2827    );
2828
2829exit:
2830    if (_array) {
2831        releasePointer(_env, _array, params, JNI_FALSE);
2832    }
2833    if (_exception) {
2834        jniThrowException(_env, _exceptionType, _exceptionMessage);
2835    }
2836}
2837
2838/* void glMatrixMode ( GLenum mode ) */
2839static void
2840android_glMatrixMode__I
2841  (JNIEnv *_env, jobject _this, jint mode) {
2842    glMatrixMode(
2843        (GLenum)mode
2844    );
2845}
2846
2847/* void glMultMatrixf ( const GLfloat *m ) */
2848static void
2849android_glMultMatrixf___3FI
2850  (JNIEnv *_env, jobject _this, jfloatArray m_ref, jint offset) {
2851    jint _exception = 0;
2852    const char * _exceptionType;
2853    const char * _exceptionMessage;
2854    GLfloat *m_base = (GLfloat *) 0;
2855    jint _remaining;
2856    GLfloat *m = (GLfloat *) 0;
2857
2858    if (!m_ref) {
2859        _exception = 1;
2860        _exceptionType = "java/lang/IllegalArgumentException";
2861        _exceptionMessage = "m == null";
2862        goto exit;
2863    }
2864    if (offset < 0) {
2865        _exception = 1;
2866        _exceptionType = "java/lang/IllegalArgumentException";
2867        _exceptionMessage = "offset < 0";
2868        goto exit;
2869    }
2870    _remaining = _env->GetArrayLength(m_ref) - offset;
2871    m_base = (GLfloat *)
2872        _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
2873    m = m_base + offset;
2874
2875    glMultMatrixf(
2876        (GLfloat *)m
2877    );
2878
2879exit:
2880    if (m_base) {
2881        _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
2882            JNI_ABORT);
2883    }
2884    if (_exception) {
2885        jniThrowException(_env, _exceptionType, _exceptionMessage);
2886    }
2887}
2888
2889/* void glMultMatrixf ( const GLfloat *m ) */
2890static void
2891android_glMultMatrixf__Ljava_nio_FloatBuffer_2
2892  (JNIEnv *_env, jobject _this, jobject m_buf) {
2893    jarray _array = (jarray) 0;
2894    jint _remaining;
2895    GLfloat *m = (GLfloat *) 0;
2896
2897    m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining);
2898    glMultMatrixf(
2899        (GLfloat *)m
2900    );
2901    if (_array) {
2902        releasePointer(_env, _array, m, JNI_FALSE);
2903    }
2904}
2905
2906/* void glMultMatrixx ( const GLfixed *m ) */
2907static void
2908android_glMultMatrixx___3II
2909  (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) {
2910    jint _exception = 0;
2911    const char * _exceptionType;
2912    const char * _exceptionMessage;
2913    GLfixed *m_base = (GLfixed *) 0;
2914    jint _remaining;
2915    GLfixed *m = (GLfixed *) 0;
2916
2917    if (!m_ref) {
2918        _exception = 1;
2919        _exceptionType = "java/lang/IllegalArgumentException";
2920        _exceptionMessage = "m == null";
2921        goto exit;
2922    }
2923    if (offset < 0) {
2924        _exception = 1;
2925        _exceptionType = "java/lang/IllegalArgumentException";
2926        _exceptionMessage = "offset < 0";
2927        goto exit;
2928    }
2929    _remaining = _env->GetArrayLength(m_ref) - offset;
2930    m_base = (GLfixed *)
2931        _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
2932    m = m_base + offset;
2933
2934    glMultMatrixx(
2935        (GLfixed *)m
2936    );
2937
2938exit:
2939    if (m_base) {
2940        _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
2941            JNI_ABORT);
2942    }
2943    if (_exception) {
2944        jniThrowException(_env, _exceptionType, _exceptionMessage);
2945    }
2946}
2947
2948/* void glMultMatrixx ( const GLfixed *m ) */
2949static void
2950android_glMultMatrixx__Ljava_nio_IntBuffer_2
2951  (JNIEnv *_env, jobject _this, jobject m_buf) {
2952    jarray _array = (jarray) 0;
2953    jint _remaining;
2954    GLfixed *m = (GLfixed *) 0;
2955
2956    m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining);
2957    glMultMatrixx(
2958        (GLfixed *)m
2959    );
2960    if (_array) {
2961        releasePointer(_env, _array, m, JNI_FALSE);
2962    }
2963}
2964
2965/* void glMultiTexCoord4f ( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ) */
2966static void
2967android_glMultiTexCoord4f__IFFFF
2968  (JNIEnv *_env, jobject _this, jint target, jfloat s, jfloat t, jfloat r, jfloat q) {
2969    glMultiTexCoord4f(
2970        (GLenum)target,
2971        (GLfloat)s,
2972        (GLfloat)t,
2973        (GLfloat)r,
2974        (GLfloat)q
2975    );
2976}
2977
2978/* void glMultiTexCoord4x ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q ) */
2979static void
2980android_glMultiTexCoord4x__IIIII
2981  (JNIEnv *_env, jobject _this, jint target, jint s, jint t, jint r, jint q) {
2982    glMultiTexCoord4x(
2983        (GLenum)target,
2984        (GLfixed)s,
2985        (GLfixed)t,
2986        (GLfixed)r,
2987        (GLfixed)q
2988    );
2989}
2990
2991/* void glNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz ) */
2992static void
2993android_glNormal3f__FFF
2994  (JNIEnv *_env, jobject _this, jfloat nx, jfloat ny, jfloat nz) {
2995    glNormal3f(
2996        (GLfloat)nx,
2997        (GLfloat)ny,
2998        (GLfloat)nz
2999    );
3000}
3001
3002/* void glNormal3x ( GLfixed nx, GLfixed ny, GLfixed nz ) */
3003static void
3004android_glNormal3x__III
3005  (JNIEnv *_env, jobject _this, jint nx, jint ny, jint nz) {
3006    glNormal3x(
3007        (GLfixed)nx,
3008        (GLfixed)ny,
3009        (GLfixed)nz
3010    );
3011}
3012
3013/* void glNormalPointer ( GLenum type, GLsizei stride, const GLvoid *pointer ) */
3014static void
3015android_glNormalPointerBounds__IILjava_nio_Buffer_2I
3016  (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) {
3017    jarray _array = (jarray) 0;
3018    jint _remaining;
3019    GLvoid *pointer = (GLvoid *) 0;
3020
3021    if (pointer_buf) {
3022        pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
3023        if ( ! pointer ) {
3024            return;
3025        }
3026    }
3027    glNormalPointerBounds(
3028        (GLenum)type,
3029        (GLsizei)stride,
3030        (GLvoid *)pointer,
3031        (GLsizei)remaining
3032    );
3033}
3034
3035/* void glOrthof ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */
3036static void
3037android_glOrthof__FFFFFF
3038  (JNIEnv *_env, jobject _this, jfloat left, jfloat right, jfloat bottom, jfloat top, jfloat zNear, jfloat zFar) {
3039    glOrthof(
3040        (GLfloat)left,
3041        (GLfloat)right,
3042        (GLfloat)bottom,
3043        (GLfloat)top,
3044        (GLfloat)zNear,
3045        (GLfloat)zFar
3046    );
3047}
3048
3049/* void glOrthox ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) */
3050static void
3051android_glOrthox__IIIIII
3052  (JNIEnv *_env, jobject _this, jint left, jint right, jint bottom, jint top, jint zNear, jint zFar) {
3053    glOrthox(
3054        (GLfixed)left,
3055        (GLfixed)right,
3056        (GLfixed)bottom,
3057        (GLfixed)top,
3058        (GLfixed)zNear,
3059        (GLfixed)zFar
3060    );
3061}
3062
3063/* void glPixelStorei ( GLenum pname, GLint param ) */
3064static void
3065android_glPixelStorei__II
3066  (JNIEnv *_env, jobject _this, jint pname, jint param) {
3067    glPixelStorei(
3068        (GLenum)pname,
3069        (GLint)param
3070    );
3071}
3072
3073/* void glPointSize ( GLfloat size ) */
3074static void
3075android_glPointSize__F
3076  (JNIEnv *_env, jobject _this, jfloat size) {
3077    glPointSize(
3078        (GLfloat)size
3079    );
3080}
3081
3082/* void glPointSizex ( GLfixed size ) */
3083static void
3084android_glPointSizex__I
3085  (JNIEnv *_env, jobject _this, jint size) {
3086    glPointSizex(
3087        (GLfixed)size
3088    );
3089}
3090
3091/* void glPolygonOffset ( GLfloat factor, GLfloat units ) */
3092static void
3093android_glPolygonOffset__FF
3094  (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) {
3095    glPolygonOffset(
3096        (GLfloat)factor,
3097        (GLfloat)units
3098    );
3099}
3100
3101/* void glPolygonOffsetx ( GLfixed factor, GLfixed units ) */
3102static void
3103android_glPolygonOffsetx__II
3104  (JNIEnv *_env, jobject _this, jint factor, jint units) {
3105    glPolygonOffsetx(
3106        (GLfixed)factor,
3107        (GLfixed)units
3108    );
3109}
3110
3111/* void glPopMatrix ( void ) */
3112static void
3113android_glPopMatrix__
3114  (JNIEnv *_env, jobject _this) {
3115    glPopMatrix();
3116}
3117
3118/* void glPushMatrix ( void ) */
3119static void
3120android_glPushMatrix__
3121  (JNIEnv *_env, jobject _this) {
3122    glPushMatrix();
3123}
3124
3125/* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */
3126static void
3127android_glReadPixels__IIIIIILjava_nio_Buffer_2
3128  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) {
3129    jarray _array = (jarray) 0;
3130    jint _remaining;
3131    GLvoid *pixels = (GLvoid *) 0;
3132
3133    pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining);
3134    glReadPixels(
3135        (GLint)x,
3136        (GLint)y,
3137        (GLsizei)width,
3138        (GLsizei)height,
3139        (GLenum)format,
3140        (GLenum)type,
3141        (GLvoid *)pixels
3142    );
3143    if (_array) {
3144        releasePointer(_env, _array, pixels, JNI_TRUE);
3145    }
3146}
3147
3148/* void glRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) */
3149static void
3150android_glRotatef__FFFF
3151  (JNIEnv *_env, jobject _this, jfloat angle, jfloat x, jfloat y, jfloat z) {
3152    glRotatef(
3153        (GLfloat)angle,
3154        (GLfloat)x,
3155        (GLfloat)y,
3156        (GLfloat)z
3157    );
3158}
3159
3160/* void glRotatex ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z ) */
3161static void
3162android_glRotatex__IIII
3163  (JNIEnv *_env, jobject _this, jint angle, jint x, jint y, jint z) {
3164    glRotatex(
3165        (GLfixed)angle,
3166        (GLfixed)x,
3167        (GLfixed)y,
3168        (GLfixed)z
3169    );
3170}
3171
3172/* void glSampleCoverage ( GLclampf value, GLboolean invert ) */
3173static void
3174android_glSampleCoverage__FZ
3175  (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) {
3176    glSampleCoverage(
3177        (GLclampf)value,
3178        (GLboolean)invert
3179    );
3180}
3181
3182/* void glSampleCoveragex ( GLclampx value, GLboolean invert ) */
3183static void
3184android_glSampleCoveragex__IZ
3185  (JNIEnv *_env, jobject _this, jint value, jboolean invert) {
3186    glSampleCoveragex(
3187        (GLclampx)value,
3188        (GLboolean)invert
3189    );
3190}
3191
3192/* void glScalef ( GLfloat x, GLfloat y, GLfloat z ) */
3193static void
3194android_glScalef__FFF
3195  (JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat z) {
3196    glScalef(
3197        (GLfloat)x,
3198        (GLfloat)y,
3199        (GLfloat)z
3200    );
3201}
3202
3203/* void glScalex ( GLfixed x, GLfixed y, GLfixed z ) */
3204static void
3205android_glScalex__III
3206  (JNIEnv *_env, jobject _this, jint x, jint y, jint z) {
3207    glScalex(
3208        (GLfixed)x,
3209        (GLfixed)y,
3210        (GLfixed)z
3211    );
3212}
3213
3214/* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */
3215static void
3216android_glScissor__IIII
3217  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
3218    glScissor(
3219        (GLint)x,
3220        (GLint)y,
3221        (GLsizei)width,
3222        (GLsizei)height
3223    );
3224}
3225
3226/* void glShadeModel ( GLenum mode ) */
3227static void
3228android_glShadeModel__I
3229  (JNIEnv *_env, jobject _this, jint mode) {
3230    glShadeModel(
3231        (GLenum)mode
3232    );
3233}
3234
3235/* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */
3236static void
3237android_glStencilFunc__III
3238  (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) {
3239    glStencilFunc(
3240        (GLenum)func,
3241        (GLint)ref,
3242        (GLuint)mask
3243    );
3244}
3245
3246/* void glStencilMask ( GLuint mask ) */
3247static void
3248android_glStencilMask__I
3249  (JNIEnv *_env, jobject _this, jint mask) {
3250    glStencilMask(
3251        (GLuint)mask
3252    );
3253}
3254
3255/* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */
3256static void
3257android_glStencilOp__III
3258  (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) {
3259    glStencilOp(
3260        (GLenum)fail,
3261        (GLenum)zfail,
3262        (GLenum)zpass
3263    );
3264}
3265
3266/* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
3267static void
3268android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I
3269  (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
3270    jarray _array = (jarray) 0;
3271    jint _remaining;
3272    GLvoid *pointer = (GLvoid *) 0;
3273
3274    if (pointer_buf) {
3275        pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
3276        if ( ! pointer ) {
3277            return;
3278        }
3279    }
3280    glTexCoordPointerBounds(
3281        (GLint)size,
3282        (GLenum)type,
3283        (GLsizei)stride,
3284        (GLvoid *)pointer,
3285        (GLsizei)remaining
3286    );
3287}
3288
3289/* void glTexEnvf ( GLenum target, GLenum pname, GLfloat param ) */
3290static void
3291android_glTexEnvf__IIF
3292  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
3293    glTexEnvf(
3294        (GLenum)target,
3295        (GLenum)pname,
3296        (GLfloat)param
3297    );
3298}
3299
3300/* void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) */
3301static void
3302android_glTexEnvfv__II_3FI
3303  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
3304    jint _exception = 0;
3305    const char * _exceptionType;
3306    const char * _exceptionMessage;
3307    GLfloat *params_base = (GLfloat *) 0;
3308    jint _remaining;
3309    GLfloat *params = (GLfloat *) 0;
3310
3311    if (!params_ref) {
3312        _exception = 1;
3313        _exceptionType = "java/lang/IllegalArgumentException";
3314        _exceptionMessage = "params == null";
3315        goto exit;
3316    }
3317    if (offset < 0) {
3318        _exception = 1;
3319        _exceptionType = "java/lang/IllegalArgumentException";
3320        _exceptionMessage = "offset < 0";
3321        goto exit;
3322    }
3323    _remaining = _env->GetArrayLength(params_ref) - offset;
3324    int _needed;
3325    switch (pname) {
3326#if defined(GL_TEXTURE_ENV_MODE)
3327        case GL_TEXTURE_ENV_MODE:
3328#endif // defined(GL_TEXTURE_ENV_MODE)
3329#if defined(GL_COMBINE_RGB)
3330        case GL_COMBINE_RGB:
3331#endif // defined(GL_COMBINE_RGB)
3332#if defined(GL_COMBINE_ALPHA)
3333        case GL_COMBINE_ALPHA:
3334#endif // defined(GL_COMBINE_ALPHA)
3335            _needed = 1;
3336            break;
3337#if defined(GL_TEXTURE_ENV_COLOR)
3338        case GL_TEXTURE_ENV_COLOR:
3339#endif // defined(GL_TEXTURE_ENV_COLOR)
3340            _needed = 4;
3341            break;
3342        default:
3343            _needed = 0;
3344            break;
3345    }
3346    if (_remaining < _needed) {
3347        _exception = 1;
3348        _exceptionType = "java/lang/IllegalArgumentException";
3349        _exceptionMessage = "length - offset < needed";
3350        goto exit;
3351    }
3352    params_base = (GLfloat *)
3353        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3354    params = params_base + offset;
3355
3356    glTexEnvfv(
3357        (GLenum)target,
3358        (GLenum)pname,
3359        (GLfloat *)params
3360    );
3361
3362exit:
3363    if (params_base) {
3364        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3365            JNI_ABORT);
3366    }
3367    if (_exception) {
3368        jniThrowException(_env, _exceptionType, _exceptionMessage);
3369    }
3370}
3371
3372/* void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) */
3373static void
3374android_glTexEnvfv__IILjava_nio_FloatBuffer_2
3375  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3376    jint _exception = 0;
3377    const char * _exceptionType;
3378    const char * _exceptionMessage;
3379    jarray _array = (jarray) 0;
3380    jint _remaining;
3381    GLfloat *params = (GLfloat *) 0;
3382
3383    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
3384    int _needed;
3385    switch (pname) {
3386#if defined(GL_TEXTURE_ENV_MODE)
3387        case GL_TEXTURE_ENV_MODE:
3388#endif // defined(GL_TEXTURE_ENV_MODE)
3389#if defined(GL_COMBINE_RGB)
3390        case GL_COMBINE_RGB:
3391#endif // defined(GL_COMBINE_RGB)
3392#if defined(GL_COMBINE_ALPHA)
3393        case GL_COMBINE_ALPHA:
3394#endif // defined(GL_COMBINE_ALPHA)
3395            _needed = 1;
3396            break;
3397#if defined(GL_TEXTURE_ENV_COLOR)
3398        case GL_TEXTURE_ENV_COLOR:
3399#endif // defined(GL_TEXTURE_ENV_COLOR)
3400            _needed = 4;
3401            break;
3402        default:
3403            _needed = 0;
3404            break;
3405    }
3406    if (_remaining < _needed) {
3407        _exception = 1;
3408        _exceptionType = "java/lang/IllegalArgumentException";
3409        _exceptionMessage = "remaining() < needed";
3410        goto exit;
3411    }
3412    glTexEnvfv(
3413        (GLenum)target,
3414        (GLenum)pname,
3415        (GLfloat *)params
3416    );
3417
3418exit:
3419    if (_array) {
3420        releasePointer(_env, _array, params, JNI_FALSE);
3421    }
3422    if (_exception) {
3423        jniThrowException(_env, _exceptionType, _exceptionMessage);
3424    }
3425}
3426
3427/* void glTexEnvx ( GLenum target, GLenum pname, GLfixed param ) */
3428static void
3429android_glTexEnvx__III
3430  (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
3431    glTexEnvx(
3432        (GLenum)target,
3433        (GLenum)pname,
3434        (GLfixed)param
3435    );
3436}
3437
3438/* void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params ) */
3439static void
3440android_glTexEnvxv__II_3II
3441  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
3442    jint _exception = 0;
3443    const char * _exceptionType;
3444    const char * _exceptionMessage;
3445    GLfixed *params_base = (GLfixed *) 0;
3446    jint _remaining;
3447    GLfixed *params = (GLfixed *) 0;
3448
3449    if (!params_ref) {
3450        _exception = 1;
3451        _exceptionType = "java/lang/IllegalArgumentException";
3452        _exceptionMessage = "params == null";
3453        goto exit;
3454    }
3455    if (offset < 0) {
3456        _exception = 1;
3457        _exceptionType = "java/lang/IllegalArgumentException";
3458        _exceptionMessage = "offset < 0";
3459        goto exit;
3460    }
3461    _remaining = _env->GetArrayLength(params_ref) - offset;
3462    int _needed;
3463    switch (pname) {
3464#if defined(GL_TEXTURE_ENV_MODE)
3465        case GL_TEXTURE_ENV_MODE:
3466#endif // defined(GL_TEXTURE_ENV_MODE)
3467#if defined(GL_COMBINE_RGB)
3468        case GL_COMBINE_RGB:
3469#endif // defined(GL_COMBINE_RGB)
3470#if defined(GL_COMBINE_ALPHA)
3471        case GL_COMBINE_ALPHA:
3472#endif // defined(GL_COMBINE_ALPHA)
3473            _needed = 1;
3474            break;
3475#if defined(GL_TEXTURE_ENV_COLOR)
3476        case GL_TEXTURE_ENV_COLOR:
3477#endif // defined(GL_TEXTURE_ENV_COLOR)
3478            _needed = 4;
3479            break;
3480        default:
3481            _needed = 0;
3482            break;
3483    }
3484    if (_remaining < _needed) {
3485        _exception = 1;
3486        _exceptionType = "java/lang/IllegalArgumentException";
3487        _exceptionMessage = "length - offset < needed";
3488        goto exit;
3489    }
3490    params_base = (GLfixed *)
3491        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3492    params = params_base + offset;
3493
3494    glTexEnvxv(
3495        (GLenum)target,
3496        (GLenum)pname,
3497        (GLfixed *)params
3498    );
3499
3500exit:
3501    if (params_base) {
3502        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3503            JNI_ABORT);
3504    }
3505    if (_exception) {
3506        jniThrowException(_env, _exceptionType, _exceptionMessage);
3507    }
3508}
3509
3510/* void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params ) */
3511static void
3512android_glTexEnvxv__IILjava_nio_IntBuffer_2
3513  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3514    jint _exception = 0;
3515    const char * _exceptionType;
3516    const char * _exceptionMessage;
3517    jarray _array = (jarray) 0;
3518    jint _remaining;
3519    GLfixed *params = (GLfixed *) 0;
3520
3521    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
3522    int _needed;
3523    switch (pname) {
3524#if defined(GL_TEXTURE_ENV_MODE)
3525        case GL_TEXTURE_ENV_MODE:
3526#endif // defined(GL_TEXTURE_ENV_MODE)
3527#if defined(GL_COMBINE_RGB)
3528        case GL_COMBINE_RGB:
3529#endif // defined(GL_COMBINE_RGB)
3530#if defined(GL_COMBINE_ALPHA)
3531        case GL_COMBINE_ALPHA:
3532#endif // defined(GL_COMBINE_ALPHA)
3533            _needed = 1;
3534            break;
3535#if defined(GL_TEXTURE_ENV_COLOR)
3536        case GL_TEXTURE_ENV_COLOR:
3537#endif // defined(GL_TEXTURE_ENV_COLOR)
3538            _needed = 4;
3539            break;
3540        default:
3541            _needed = 0;
3542            break;
3543    }
3544    if (_remaining < _needed) {
3545        _exception = 1;
3546        _exceptionType = "java/lang/IllegalArgumentException";
3547        _exceptionMessage = "remaining() < needed";
3548        goto exit;
3549    }
3550    glTexEnvxv(
3551        (GLenum)target,
3552        (GLenum)pname,
3553        (GLfixed *)params
3554    );
3555
3556exit:
3557    if (_array) {
3558        releasePointer(_env, _array, params, JNI_FALSE);
3559    }
3560    if (_exception) {
3561        jniThrowException(_env, _exceptionType, _exceptionMessage);
3562    }
3563}
3564
3565/* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */
3566static void
3567android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2
3568  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) {
3569    jarray _array = (jarray) 0;
3570    jint _remaining;
3571    GLvoid *pixels = (GLvoid *) 0;
3572
3573    if (pixels_buf) {
3574        pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining);
3575    }
3576    glTexImage2D(
3577        (GLenum)target,
3578        (GLint)level,
3579        (GLint)internalformat,
3580        (GLsizei)width,
3581        (GLsizei)height,
3582        (GLint)border,
3583        (GLenum)format,
3584        (GLenum)type,
3585        (GLvoid *)pixels
3586    );
3587    if (_array) {
3588        releasePointer(_env, _array, pixels, JNI_FALSE);
3589    }
3590}
3591
3592/* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */
3593static void
3594android_glTexParameterf__IIF
3595  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
3596    glTexParameterf(
3597        (GLenum)target,
3598        (GLenum)pname,
3599        (GLfloat)param
3600    );
3601}
3602
3603/* void glTexParameterx ( GLenum target, GLenum pname, GLfixed param ) */
3604static void
3605android_glTexParameterx__III
3606  (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
3607    glTexParameterx(
3608        (GLenum)target,
3609        (GLenum)pname,
3610        (GLfixed)param
3611    );
3612}
3613
3614/* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */
3615static void
3616android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
3617  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) {
3618    jarray _array = (jarray) 0;
3619    jint _remaining;
3620    GLvoid *pixels = (GLvoid *) 0;
3621
3622    if (pixels_buf) {
3623        pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining);
3624    }
3625    glTexSubImage2D(
3626        (GLenum)target,
3627        (GLint)level,
3628        (GLint)xoffset,
3629        (GLint)yoffset,
3630        (GLsizei)width,
3631        (GLsizei)height,
3632        (GLenum)format,
3633        (GLenum)type,
3634        (GLvoid *)pixels
3635    );
3636    if (_array) {
3637        releasePointer(_env, _array, pixels, JNI_FALSE);
3638    }
3639}
3640
3641/* void glTranslatef ( GLfloat x, GLfloat y, GLfloat z ) */
3642static void
3643android_glTranslatef__FFF
3644  (JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat z) {
3645    glTranslatef(
3646        (GLfloat)x,
3647        (GLfloat)y,
3648        (GLfloat)z
3649    );
3650}
3651
3652/* void glTranslatex ( GLfixed x, GLfixed y, GLfixed z ) */
3653static void
3654android_glTranslatex__III
3655  (JNIEnv *_env, jobject _this, jint x, jint y, jint z) {
3656    glTranslatex(
3657        (GLfixed)x,
3658        (GLfixed)y,
3659        (GLfixed)z
3660    );
3661}
3662
3663/* void glVertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
3664static void
3665android_glVertexPointerBounds__IIILjava_nio_Buffer_2I
3666  (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
3667    jarray _array = (jarray) 0;
3668    jint _remaining;
3669    GLvoid *pointer = (GLvoid *) 0;
3670
3671    if (pointer_buf) {
3672        pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
3673        if ( ! pointer ) {
3674            return;
3675        }
3676    }
3677    glVertexPointerBounds(
3678        (GLint)size,
3679        (GLenum)type,
3680        (GLsizei)stride,
3681        (GLvoid *)pointer,
3682        (GLsizei)remaining
3683    );
3684}
3685
3686/* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */
3687static void
3688android_glViewport__IIII
3689  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
3690    glViewport(
3691        (GLint)x,
3692        (GLint)y,
3693        (GLsizei)width,
3694        (GLsizei)height
3695    );
3696}
3697
3698static const char *classPathName = "android/opengl/GLES10";
3699
3700static JNINativeMethod methods[] = {
3701{"_nativeClassInit", "()V", (void*)nativeClassInit },
3702{"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I },
3703{"glAlphaFunc", "(IF)V", (void *) android_glAlphaFunc__IF },
3704{"glAlphaFuncx", "(II)V", (void *) android_glAlphaFuncx__II },
3705{"glBindTexture", "(II)V", (void *) android_glBindTexture__II },
3706{"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II },
3707{"glClear", "(I)V", (void *) android_glClear__I },
3708{"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF },
3709{"glClearColorx", "(IIII)V", (void *) android_glClearColorx__IIII },
3710{"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F },
3711{"glClearDepthx", "(I)V", (void *) android_glClearDepthx__I },
3712{"glClearStencil", "(I)V", (void *) android_glClearStencil__I },
3713{"glClientActiveTexture", "(I)V", (void *) android_glClientActiveTexture__I },
3714{"glColor4f", "(FFFF)V", (void *) android_glColor4f__FFFF },
3715{"glColor4x", "(IIII)V", (void *) android_glColor4x__IIII },
3716{"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ },
3717{"glColorPointerBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glColorPointerBounds__IIILjava_nio_Buffer_2I },
3718{"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 },
3719{"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
3720{"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII },
3721{"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII },
3722{"glCullFace", "(I)V", (void *) android_glCullFace__I },
3723{"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II },
3724{"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 },
3725{"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I },
3726{"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z },
3727{"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF },
3728{"glDepthRangex", "(II)V", (void *) android_glDepthRangex__II },
3729{"glDisable", "(I)V", (void *) android_glDisable__I },
3730{"glDisableClientState", "(I)V", (void *) android_glDisableClientState__I },
3731{"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III },
3732{"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 },
3733{"glEnable", "(I)V", (void *) android_glEnable__I },
3734{"glEnableClientState", "(I)V", (void *) android_glEnableClientState__I },
3735{"glFinish", "()V", (void *) android_glFinish__ },
3736{"glFlush", "()V", (void *) android_glFlush__ },
3737{"glFogf", "(IF)V", (void *) android_glFogf__IF },
3738{"glFogfv", "(I[FI)V", (void *) android_glFogfv__I_3FI },
3739{"glFogfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glFogfv__ILjava_nio_FloatBuffer_2 },
3740{"glFogx", "(II)V", (void *) android_glFogx__II },
3741{"glFogxv", "(I[II)V", (void *) android_glFogxv__I_3II },
3742{"glFogxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glFogxv__ILjava_nio_IntBuffer_2 },
3743{"glFrontFace", "(I)V", (void *) android_glFrontFace__I },
3744{"glFrustumf", "(FFFFFF)V", (void *) android_glFrustumf__FFFFFF },
3745{"glFrustumx", "(IIIIII)V", (void *) android_glFrustumx__IIIIII },
3746{"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II },
3747{"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 },
3748{"glGetError", "()I", (void *) android_glGetError__ },
3749{"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II },
3750{"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 },
3751{"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString },
3752{"glHint", "(II)V", (void *) android_glHint__II },
3753{"glLightModelf", "(IF)V", (void *) android_glLightModelf__IF },
3754{"glLightModelfv", "(I[FI)V", (void *) android_glLightModelfv__I_3FI },
3755{"glLightModelfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glLightModelfv__ILjava_nio_FloatBuffer_2 },
3756{"glLightModelx", "(II)V", (void *) android_glLightModelx__II },
3757{"glLightModelxv", "(I[II)V", (void *) android_glLightModelxv__I_3II },
3758{"glLightModelxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glLightModelxv__ILjava_nio_IntBuffer_2 },
3759{"glLightf", "(IIF)V", (void *) android_glLightf__IIF },
3760{"glLightfv", "(II[FI)V", (void *) android_glLightfv__II_3FI },
3761{"glLightfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glLightfv__IILjava_nio_FloatBuffer_2 },
3762{"glLightx", "(III)V", (void *) android_glLightx__III },
3763{"glLightxv", "(II[II)V", (void *) android_glLightxv__II_3II },
3764{"glLightxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glLightxv__IILjava_nio_IntBuffer_2 },
3765{"glLineWidth", "(F)V", (void *) android_glLineWidth__F },
3766{"glLineWidthx", "(I)V", (void *) android_glLineWidthx__I },
3767{"glLoadIdentity", "()V", (void *) android_glLoadIdentity__ },
3768{"glLoadMatrixf", "([FI)V", (void *) android_glLoadMatrixf___3FI },
3769{"glLoadMatrixf", "(Ljava/nio/FloatBuffer;)V", (void *) android_glLoadMatrixf__Ljava_nio_FloatBuffer_2 },
3770{"glLoadMatrixx", "([II)V", (void *) android_glLoadMatrixx___3II },
3771{"glLoadMatrixx", "(Ljava/nio/IntBuffer;)V", (void *) android_glLoadMatrixx__Ljava_nio_IntBuffer_2 },
3772{"glLogicOp", "(I)V", (void *) android_glLogicOp__I },
3773{"glMaterialf", "(IIF)V", (void *) android_glMaterialf__IIF },
3774{"glMaterialfv", "(II[FI)V", (void *) android_glMaterialfv__II_3FI },
3775{"glMaterialfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glMaterialfv__IILjava_nio_FloatBuffer_2 },
3776{"glMaterialx", "(III)V", (void *) android_glMaterialx__III },
3777{"glMaterialxv", "(II[II)V", (void *) android_glMaterialxv__II_3II },
3778{"glMaterialxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glMaterialxv__IILjava_nio_IntBuffer_2 },
3779{"glMatrixMode", "(I)V", (void *) android_glMatrixMode__I },
3780{"glMultMatrixf", "([FI)V", (void *) android_glMultMatrixf___3FI },
3781{"glMultMatrixf", "(Ljava/nio/FloatBuffer;)V", (void *) android_glMultMatrixf__Ljava_nio_FloatBuffer_2 },
3782{"glMultMatrixx", "([II)V", (void *) android_glMultMatrixx___3II },
3783{"glMultMatrixx", "(Ljava/nio/IntBuffer;)V", (void *) android_glMultMatrixx__Ljava_nio_IntBuffer_2 },
3784{"glMultiTexCoord4f", "(IFFFF)V", (void *) android_glMultiTexCoord4f__IFFFF },
3785{"glMultiTexCoord4x", "(IIIII)V", (void *) android_glMultiTexCoord4x__IIIII },
3786{"glNormal3f", "(FFF)V", (void *) android_glNormal3f__FFF },
3787{"glNormal3x", "(III)V", (void *) android_glNormal3x__III },
3788{"glNormalPointerBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glNormalPointerBounds__IILjava_nio_Buffer_2I },
3789{"glOrthof", "(FFFFFF)V", (void *) android_glOrthof__FFFFFF },
3790{"glOrthox", "(IIIIII)V", (void *) android_glOrthox__IIIIII },
3791{"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II },
3792{"glPointSize", "(F)V", (void *) android_glPointSize__F },
3793{"glPointSizex", "(I)V", (void *) android_glPointSizex__I },
3794{"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF },
3795{"glPolygonOffsetx", "(II)V", (void *) android_glPolygonOffsetx__II },
3796{"glPopMatrix", "()V", (void *) android_glPopMatrix__ },
3797{"glPushMatrix", "()V", (void *) android_glPushMatrix__ },
3798{"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 },
3799{"glRotatef", "(FFFF)V", (void *) android_glRotatef__FFFF },
3800{"glRotatex", "(IIII)V", (void *) android_glRotatex__IIII },
3801{"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ },
3802{"glSampleCoveragex", "(IZ)V", (void *) android_glSampleCoveragex__IZ },
3803{"glScalef", "(FFF)V", (void *) android_glScalef__FFF },
3804{"glScalex", "(III)V", (void *) android_glScalex__III },
3805{"glScissor", "(IIII)V", (void *) android_glScissor__IIII },
3806{"glShadeModel", "(I)V", (void *) android_glShadeModel__I },
3807{"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III },
3808{"glStencilMask", "(I)V", (void *) android_glStencilMask__I },
3809{"glStencilOp", "(III)V", (void *) android_glStencilOp__III },
3810{"glTexCoordPointerBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I },
3811{"glTexEnvf", "(IIF)V", (void *) android_glTexEnvf__IIF },
3812{"glTexEnvfv", "(II[FI)V", (void *) android_glTexEnvfv__II_3FI },
3813{"glTexEnvfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexEnvfv__IILjava_nio_FloatBuffer_2 },
3814{"glTexEnvx", "(III)V", (void *) android_glTexEnvx__III },
3815{"glTexEnvxv", "(II[II)V", (void *) android_glTexEnvxv__II_3II },
3816{"glTexEnvxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexEnvxv__IILjava_nio_IntBuffer_2 },
3817{"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 },
3818{"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF },
3819{"glTexParameterx", "(III)V", (void *) android_glTexParameterx__III },
3820{"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
3821{"glTranslatef", "(FFF)V", (void *) android_glTranslatef__FFF },
3822{"glTranslatex", "(III)V", (void *) android_glTranslatex__III },
3823{"glVertexPointerBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glVertexPointerBounds__IIILjava_nio_Buffer_2I },
3824{"glViewport", "(IIII)V", (void *) android_glViewport__IIII },
3825};
3826
3827int register_android_opengl_jni_GLES10(JNIEnv *_env)
3828{
3829    int err;
3830    err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
3831    return err;
3832}
3833