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