blob: ee5b5941202db62249d74678053c53ffd28bdb8b [file] [log] [blame]
Jack Palevich27f80022009-04-15 19:13:17 -07001/*
2**
3** Copyright 2009, The Android Open Source Project
4**
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07005** 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
Jack Palevich27f80022009-04-15 19:13:17 -07008**
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07009** http://www.apache.org/licenses/LICENSE-2.0
Jack Palevich27f80022009-04-15 19:13:17 -070010**
Elliott Hughes24ce5fb2011-04-08 20:01:01 -070011** 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
Jack Palevich27f80022009-04-15 19:13:17 -070015** limitations under the License.
16*/
17
18// This source file is automatically generated
19
Andreas Gampebfe63332014-11-12 14:12:45 -080020#pragma GCC diagnostic ignored "-Wunused-variable"
Andreas Gampebfe63332014-11-12 14:12:45 -080021#pragma GCC diagnostic ignored "-Wunused-function"
22
Mathias Agopian2ad04772013-02-23 03:12:30 -080023#include <GLES/gl.h>
24#include <GLES/glext.h>
25
Jesse Hall9626f822014-05-19 20:57:49 -070026#include <jni.h>
Steven Moreland2279b252017-07-19 09:50:45 -070027#include <nativehelper/JNIHelp.h>
Jack Palevich27f80022009-04-15 19:13:17 -070028#include <android_runtime/AndroidRuntime.h>
29#include <utils/misc.h>
Jack Palevich27f80022009-04-15 19:13:17 -070030#include <assert.h>
Mathias Agopian8331f722009-05-08 15:35:17 -070031
Jack Palevich27f80022009-04-15 19:13:17 -070032static int initialized = 0;
33
34static jclass nioAccessClass;
35static jclass bufferClass;
Jack Palevich27f80022009-04-15 19:13:17 -070036static jmethodID getBasePointerID;
37static jmethodID getBaseArrayID;
38static jmethodID getBaseArrayOffsetID;
39static jfieldID positionID;
40static jfieldID limitID;
41static jfieldID elementSizeShiftID;
42
Mathias Agopian2ad04772013-02-23 03:12:30 -080043
44/* special calls implemented in Android's GLES wrapper used to more
45 * efficiently bound-check passed arrays */
46extern "C" {
47#ifdef GL_VERSION_ES_CM_1_1
48GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
49 const GLvoid *ptr, GLsizei count);
50GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
51 const GLvoid *pointer, GLsizei count);
52GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
53 GLsizei stride, const GLvoid *pointer, GLsizei count);
54GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
55 GLsizei stride, const GLvoid *pointer, GLsizei count);
56GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
57 GLsizei stride, const GLvoid *pointer, GLsizei count);
58GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
59 GLsizei stride, const GLvoid *pointer, GLsizei count);
60GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
61 GLsizei stride, const GLvoid *pointer, GLsizei count);
62#endif
63#ifdef GL_ES_VERSION_2_0
64static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type,
65 GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) {
66 glVertexAttribPointer(indx, size, type, normalized, stride, pointer);
67}
68#endif
Andy McFaddencee51982013-04-25 16:08:31 -070069#ifdef GL_ES_VERSION_3_0
70static void glVertexAttribIPointerBounds(GLuint indx, GLint size, GLenum type,
71 GLsizei stride, const GLvoid *pointer, GLsizei count) {
72 glVertexAttribIPointer(indx, size, type, stride, pointer);
73}
74#endif
Mathias Agopian2ad04772013-02-23 03:12:30 -080075}
76
Jack Palevich27f80022009-04-15 19:13:17 -070077/* Cache method IDs each time the class is loaded. */
78
79static void
Elliott Hughes24ce5fb2011-04-08 20:01:01 -070080nativeClassInit(JNIEnv *_env, jclass glImplClass)
Jack Palevich27f80022009-04-15 19:13:17 -070081{
82 jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
83 nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
84
85 jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
86 bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
87
88 getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
89 "getBasePointer", "(Ljava/nio/Buffer;)J");
90 getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
91 "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
92 getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
93 "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
94
95 positionID = _env->GetFieldID(bufferClass, "position", "I");
96 limitID = _env->GetFieldID(bufferClass, "limit", "I");
97 elementSizeShiftID =
98 _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
99}
100
Jack Palevich27f80022009-04-15 19:13:17 -0700101static void *
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700102getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
Jack Palevich27f80022009-04-15 19:13:17 -0700103{
104 jint position;
105 jint limit;
106 jint elementSizeShift;
107 jlong pointer;
Jack Palevich27f80022009-04-15 19:13:17 -0700108
109 position = _env->GetIntField(buffer, positionID);
110 limit = _env->GetIntField(buffer, limitID);
111 elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
112 *remaining = (limit - position) << elementSizeShift;
113 pointer = _env->CallStaticLongMethod(nioAccessClass,
114 getBasePointerID, buffer);
115 if (pointer != 0L) {
116 *array = NULL;
Ashok Bhat01c26ea2014-02-24 09:49:07 +0000117 return reinterpret_cast<void*>(pointer);
Jack Palevich27f80022009-04-15 19:13:17 -0700118 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700119
Jack Palevich27f80022009-04-15 19:13:17 -0700120 *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
121 getBaseArrayID, buffer);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700122 *offset = _env->CallStaticIntMethod(nioAccessClass,
Jack Palevich27f80022009-04-15 19:13:17 -0700123 getBaseArrayOffsetID, buffer);
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700124
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700125 return NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700126}
127
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700128class ByteArrayGetter {
129public:
130 static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
131 return _env->GetByteArrayElements(array, is_copy);
132 }
133};
134class BooleanArrayGetter {
135public:
136 static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
137 return _env->GetBooleanArrayElements(array, is_copy);
138 }
139};
140class CharArrayGetter {
141public:
142 static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
143 return _env->GetCharArrayElements(array, is_copy);
144 }
145};
146class ShortArrayGetter {
147public:
148 static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
149 return _env->GetShortArrayElements(array, is_copy);
150 }
151};
152class IntArrayGetter {
153public:
154 static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
155 return _env->GetIntArrayElements(array, is_copy);
156 }
157};
158class LongArrayGetter {
159public:
160 static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
161 return _env->GetLongArrayElements(array, is_copy);
162 }
163};
164class FloatArrayGetter {
165public:
166 static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
167 return _env->GetFloatArrayElements(array, is_copy);
168 }
169};
170class DoubleArrayGetter {
171public:
172 static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
173 return _env->GetDoubleArrayElements(array, is_copy);
174 }
175};
176
177template<typename JTYPEARRAY, typename ARRAYGETTER>
178static void*
179getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
180 return ARRAYGETTER::Get(_env, array, is_copy);
181}
182
183class ByteArrayReleaser {
184public:
185 static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
186 _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
187 }
188};
189class BooleanArrayReleaser {
190public:
191 static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
192 _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
193 }
194};
195class CharArrayReleaser {
196public:
197 static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
198 _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
199 }
200};
201class ShortArrayReleaser {
202public:
203 static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
204 _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
205 }
206};
207class IntArrayReleaser {
208public:
209 static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
210 _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
211 }
212};
213class LongArrayReleaser {
214public:
215 static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
216 _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
217 }
218};
219class FloatArrayReleaser {
220public:
221 static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
222 _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
223 }
224};
225class DoubleArrayReleaser {
226public:
227 static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
228 _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
229 }
230};
231
232template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
233static void
234releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
235 ARRAYRELEASER::Release(_env, array, data, commit);
236}
237
Jack Palevich27f80022009-04-15 19:13:17 -0700238static void
239releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
240{
241 _env->ReleasePrimitiveArrayCritical(array, data,
Mathias Agopian2ad04772013-02-23 03:12:30 -0800242 commit ? 0 : JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -0700243}
244
Jack Palevich16e79722009-05-15 18:13:34 -0700245static void *
246getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
247 char* buf = (char*) _env->GetDirectBufferAddress(buffer);
248 if (buf) {
249 jint position = _env->GetIntField(buffer, positionID);
250 jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
251 buf += position << elementSizeShift;
252 } else {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700253 jniThrowException(_env, "java/lang/IllegalArgumentException",
254 "Must use a native order direct Buffer");
Jack Palevich16e79722009-05-15 18:13:34 -0700255 }
256 return (void*) buf;
257}
258
Mathias Agopian2ad04772013-02-23 03:12:30 -0800259// --------------------------------------------------------------------------
260
261/*
262 * returns the number of values glGet returns for a given pname.
263 *
264 * The code below is written such that pnames requiring only one values
265 * are the default (and are not explicitely tested for). This makes the
266 * checking code much shorter/readable/efficient.
267 *
268 * This means that unknown pnames (e.g.: extensions) will default to 1. If
269 * that unknown pname needs more than 1 value, then the validation check
270 * is incomplete and the app may crash if it passed the wrong number params.
271 */
272static int getNeededCount(GLint pname) {
273 int needed = 1;
Romain Guydc43a6c2017-02-17 19:54:25 -0800274#ifdef GL_ES_VERSION_3_0
275 // GLES 3.x pnames
276 switch (pname) {
277 case GL_MAX_VIEWPORT_DIMS:
278 needed = 2;
279 break;
280
281 case GL_PROGRAM_BINARY_FORMATS:
282 glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &needed);
283 break;
284 }
285#endif
286
Mathias Agopian2ad04772013-02-23 03:12:30 -0800287#ifdef GL_ES_VERSION_2_0
288 // GLES 2.x pnames
289 switch (pname) {
290 case GL_ALIASED_LINE_WIDTH_RANGE:
291 case GL_ALIASED_POINT_SIZE_RANGE:
292 needed = 2;
293 break;
294
295 case GL_BLEND_COLOR:
296 case GL_COLOR_CLEAR_VALUE:
297 case GL_COLOR_WRITEMASK:
298 case GL_SCISSOR_BOX:
299 case GL_VIEWPORT:
300 needed = 4;
301 break;
302
303 case GL_COMPRESSED_TEXTURE_FORMATS:
304 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
305 break;
306
307 case GL_SHADER_BINARY_FORMATS:
308 glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed);
309 break;
310 }
311#endif
312
313#ifdef GL_VERSION_ES_CM_1_1
314 // GLES 1.x pnames
315 switch (pname) {
316 case GL_ALIASED_LINE_WIDTH_RANGE:
317 case GL_ALIASED_POINT_SIZE_RANGE:
318 case GL_DEPTH_RANGE:
319 case GL_SMOOTH_LINE_WIDTH_RANGE:
320 case GL_SMOOTH_POINT_SIZE_RANGE:
321 needed = 2;
322 break;
323
324 case GL_CURRENT_NORMAL:
325 case GL_POINT_DISTANCE_ATTENUATION:
326 needed = 3;
327 break;
328
329 case GL_COLOR_CLEAR_VALUE:
330 case GL_COLOR_WRITEMASK:
331 case GL_CURRENT_COLOR:
332 case GL_CURRENT_TEXTURE_COORDS:
333 case GL_FOG_COLOR:
334 case GL_LIGHT_MODEL_AMBIENT:
335 case GL_SCISSOR_BOX:
336 case GL_VIEWPORT:
337 needed = 4;
338 break;
339
340 case GL_MODELVIEW_MATRIX:
341 case GL_PROJECTION_MATRIX:
342 case GL_TEXTURE_MATRIX:
343 needed = 16;
344 break;
345
346 case GL_COMPRESSED_TEXTURE_FORMATS:
347 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
348 break;
349 }
350#endif
351 return needed;
352}
353
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700354template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
355 typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
Mathias Agopian2ad04772013-02-23 03:12:30 -0800356static void
357get
358 (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
359 jint _exception = 0;
360 const char * _exceptionType;
361 const char * _exceptionMessage;
362 CTYPE *params_base = (CTYPE *) 0;
363 jint _remaining;
364 CTYPE *params = (CTYPE *) 0;
365 int _needed = 0;
366
367 if (!params_ref) {
368 _exception = 1;
369 _exceptionType = "java/lang/IllegalArgumentException";
370 _exceptionMessage = "params == null";
371 goto exit;
372 }
373 if (offset < 0) {
374 _exception = 1;
375 _exceptionType = "java/lang/IllegalArgumentException";
376 _exceptionMessage = "offset < 0";
377 goto exit;
378 }
379 _remaining = _env->GetArrayLength(params_ref) - offset;
380 _needed = getNeededCount(pname);
381 // if we didn't find this pname, we just assume the user passed
382 // an array of the right size -- this might happen with extensions
383 // or if we forget an enum here.
384 if (_remaining < _needed) {
385 _exception = 1;
386 _exceptionType = "java/lang/IllegalArgumentException";
387 _exceptionMessage = "length - offset < needed";
388 goto exit;
389 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700390 params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
391 _env, params_ref, (jboolean *)0);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800392 params = params_base + offset;
393
394 GET(
395 (GLenum)pname,
396 (CTYPE *)params
397 );
398
399exit:
400 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700401 releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
402 _env, params_ref, params_base, !_exception);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800403 }
404 if (_exception) {
405 jniThrowException(_env, _exceptionType, _exceptionMessage);
406 }
407}
408
409
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700410template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
411 typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
Mathias Agopian2ad04772013-02-23 03:12:30 -0800412static void
413getarray
414 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
415 jint _exception = 0;
416 const char * _exceptionType;
417 const char * _exceptionMessage;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700418 JTYPEARRAY _array = (JTYPEARRAY) 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800419 jint _bufferOffset = (jint) 0;
420 jint _remaining;
421 CTYPE *params = (CTYPE *) 0;
422 int _needed = 0;
423
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700424 params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Andy McFaddencee51982013-04-25 16:08:31 -0700425 _remaining /= sizeof(CTYPE); // convert from bytes to item count
Mathias Agopian2ad04772013-02-23 03:12:30 -0800426 _needed = getNeededCount(pname);
427 // if we didn't find this pname, we just assume the user passed
428 // an array of the right size -- this might happen with extensions
429 // or if we forget an enum here.
430 if (_needed>0 && _remaining < _needed) {
431 _exception = 1;
432 _exceptionType = "java/lang/IllegalArgumentException";
433 _exceptionMessage = "remaining() < needed";
434 goto exit;
435 }
436 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700437 char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
438 _env, _array, (jboolean *) 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800439 params = (CTYPE *) (_paramsBase + _bufferOffset);
440 }
441 GET(
442 (GLenum)pname,
443 (CTYPE *)params
444 );
445
446exit:
447 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700448 releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
449 _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800450 }
451 if (_exception) {
452 jniThrowException(_env, _exceptionType, _exceptionMessage);
453 }
Jack Palevichbe509c92009-05-07 09:52:14 -0700454}
455
Jack Palevich27f80022009-04-15 19:13:17 -0700456// --------------------------------------------------------------------------
Jack Palevich27f80022009-04-15 19:13:17 -0700457/* void glActiveTexture ( GLenum texture ) */
458static void
459android_glActiveTexture__I
460 (JNIEnv *_env, jobject _this, jint texture) {
461 glActiveTexture(
462 (GLenum)texture
463 );
464}
465
466/* void glAlphaFunc ( GLenum func, GLclampf ref ) */
467static void
468android_glAlphaFunc__IF
469 (JNIEnv *_env, jobject _this, jint func, jfloat ref) {
470 glAlphaFunc(
471 (GLenum)func,
472 (GLclampf)ref
473 );
474}
475
476/* void glAlphaFuncx ( GLenum func, GLclampx ref ) */
477static void
478android_glAlphaFuncx__II
479 (JNIEnv *_env, jobject _this, jint func, jint ref) {
480 glAlphaFuncx(
481 (GLenum)func,
482 (GLclampx)ref
483 );
484}
485
486/* void glBindTexture ( GLenum target, GLuint texture ) */
487static void
488android_glBindTexture__II
489 (JNIEnv *_env, jobject _this, jint target, jint texture) {
490 glBindTexture(
491 (GLenum)target,
492 (GLuint)texture
493 );
494}
495
496/* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */
497static void
498android_glBlendFunc__II
499 (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) {
500 glBlendFunc(
501 (GLenum)sfactor,
502 (GLenum)dfactor
503 );
504}
505
506/* void glClear ( GLbitfield mask ) */
507static void
508android_glClear__I
509 (JNIEnv *_env, jobject _this, jint mask) {
510 glClear(
511 (GLbitfield)mask
512 );
513}
514
515/* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
516static void
517android_glClearColor__FFFF
518 (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
519 glClearColor(
520 (GLclampf)red,
521 (GLclampf)green,
522 (GLclampf)blue,
523 (GLclampf)alpha
524 );
525}
526
527/* void glClearColorx ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha ) */
528static void
529android_glClearColorx__IIII
530 (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) {
531 glClearColorx(
532 (GLclampx)red,
533 (GLclampx)green,
534 (GLclampx)blue,
535 (GLclampx)alpha
536 );
537}
538
539/* void glClearDepthf ( GLclampf depth ) */
540static void
541android_glClearDepthf__F
542 (JNIEnv *_env, jobject _this, jfloat depth) {
543 glClearDepthf(
544 (GLclampf)depth
545 );
546}
547
548/* void glClearDepthx ( GLclampx depth ) */
549static void
550android_glClearDepthx__I
551 (JNIEnv *_env, jobject _this, jint depth) {
552 glClearDepthx(
553 (GLclampx)depth
554 );
555}
556
557/* void glClearStencil ( GLint s ) */
558static void
559android_glClearStencil__I
560 (JNIEnv *_env, jobject _this, jint s) {
561 glClearStencil(
562 (GLint)s
563 );
564}
565
566/* void glClientActiveTexture ( GLenum texture ) */
567static void
568android_glClientActiveTexture__I
569 (JNIEnv *_env, jobject _this, jint texture) {
570 glClientActiveTexture(
571 (GLenum)texture
572 );
573}
574
575/* void glColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) */
576static void
577android_glColor4f__FFFF
578 (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
579 glColor4f(
580 (GLfloat)red,
581 (GLfloat)green,
582 (GLfloat)blue,
583 (GLfloat)alpha
584 );
585}
586
587/* void glColor4x ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha ) */
588static void
589android_glColor4x__IIII
590 (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) {
591 glColor4x(
592 (GLfixed)red,
593 (GLfixed)green,
594 (GLfixed)blue,
595 (GLfixed)alpha
596 );
597}
598
599/* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */
600static void
601android_glColorMask__ZZZZ
602 (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) {
603 glColorMask(
604 (GLboolean)red,
605 (GLboolean)green,
606 (GLboolean)blue,
607 (GLboolean)alpha
608 );
609}
610
611/* void glColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
612static void
613android_glColorPointerBounds__IIILjava_nio_Buffer_2I
614 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
Romain Guy84cac202016-12-05 12:26:02 -0800615 jint _exception = 0;
616 const char * _exceptionType = NULL;
617 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700618 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700619 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700620 jint _remaining;
621 GLvoid *pointer = (GLvoid *) 0;
622
Jack Paleviche20ea782009-05-07 18:28:29 -0700623 if (pointer_buf) {
Jack Palevich16e79722009-05-15 18:13:34 -0700624 pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
Jack Paleviche20ea782009-05-07 18:28:29 -0700625 if ( ! pointer ) {
Jack Paleviche20ea782009-05-07 18:28:29 -0700626 return;
627 }
628 }
Jack Palevich27f80022009-04-15 19:13:17 -0700629 glColorPointerBounds(
630 (GLint)size,
631 (GLenum)type,
632 (GLsizei)stride,
633 (GLvoid *)pointer,
634 (GLsizei)remaining
635 );
Romain Guy84cac202016-12-05 12:26:02 -0800636 if (_exception) {
637 jniThrowException(_env, _exceptionType, _exceptionMessage);
638 }
Jack Palevich27f80022009-04-15 19:13:17 -0700639}
640
641/* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */
642static void
643android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2
644 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) {
Romain Guy84cac202016-12-05 12:26:02 -0800645 jint _exception = 0;
646 const char * _exceptionType = NULL;
647 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700648 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700649 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700650 jint _remaining;
651 GLvoid *data = (GLvoid *) 0;
652
Romain Guy84cac202016-12-05 12:26:02 -0800653 if (!data_buf) {
654 _exception = 1;
655 _exceptionType = "java/lang/IllegalArgumentException";
656 _exceptionMessage = "data == null";
657 goto exit;
658 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700659 data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700660 if (data == NULL) {
661 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
662 data = (GLvoid *) (_dataBase + _bufferOffset);
663 }
Jack Palevich27f80022009-04-15 19:13:17 -0700664 glCompressedTexImage2D(
665 (GLenum)target,
666 (GLint)level,
667 (GLenum)internalformat,
668 (GLsizei)width,
669 (GLsizei)height,
670 (GLint)border,
671 (GLsizei)imageSize,
672 (GLvoid *)data
673 );
Romain Guy84cac202016-12-05 12:26:02 -0800674
675exit:
Jack Palevich27f80022009-04-15 19:13:17 -0700676 if (_array) {
677 releasePointer(_env, _array, data, JNI_FALSE);
678 }
Romain Guy84cac202016-12-05 12:26:02 -0800679 if (_exception) {
680 jniThrowException(_env, _exceptionType, _exceptionMessage);
681 }
Jack Palevich27f80022009-04-15 19:13:17 -0700682}
683
684/* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */
685static void
686android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
687 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) {
Romain Guy84cac202016-12-05 12:26:02 -0800688 jint _exception = 0;
689 const char * _exceptionType = NULL;
690 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700691 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700692 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700693 jint _remaining;
694 GLvoid *data = (GLvoid *) 0;
695
Romain Guy84cac202016-12-05 12:26:02 -0800696 if (!data_buf) {
697 _exception = 1;
698 _exceptionType = "java/lang/IllegalArgumentException";
699 _exceptionMessage = "data == null";
700 goto exit;
701 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700702 data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700703 if (data == NULL) {
704 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
705 data = (GLvoid *) (_dataBase + _bufferOffset);
706 }
Jack Palevich27f80022009-04-15 19:13:17 -0700707 glCompressedTexSubImage2D(
708 (GLenum)target,
709 (GLint)level,
710 (GLint)xoffset,
711 (GLint)yoffset,
712 (GLsizei)width,
713 (GLsizei)height,
714 (GLenum)format,
715 (GLsizei)imageSize,
716 (GLvoid *)data
717 );
Romain Guy84cac202016-12-05 12:26:02 -0800718
719exit:
Jack Palevich27f80022009-04-15 19:13:17 -0700720 if (_array) {
721 releasePointer(_env, _array, data, JNI_FALSE);
722 }
Romain Guy84cac202016-12-05 12:26:02 -0800723 if (_exception) {
724 jniThrowException(_env, _exceptionType, _exceptionMessage);
725 }
Jack Palevich27f80022009-04-15 19:13:17 -0700726}
727
728/* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */
729static void
730android_glCopyTexImage2D__IIIIIIII
731 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) {
732 glCopyTexImage2D(
733 (GLenum)target,
734 (GLint)level,
735 (GLenum)internalformat,
736 (GLint)x,
737 (GLint)y,
738 (GLsizei)width,
739 (GLsizei)height,
740 (GLint)border
741 );
742}
743
744/* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */
745static void
746android_glCopyTexSubImage2D__IIIIIIII
747 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) {
748 glCopyTexSubImage2D(
749 (GLenum)target,
750 (GLint)level,
751 (GLint)xoffset,
752 (GLint)yoffset,
753 (GLint)x,
754 (GLint)y,
755 (GLsizei)width,
756 (GLsizei)height
757 );
758}
759
760/* void glCullFace ( GLenum mode ) */
761static void
762android_glCullFace__I
763 (JNIEnv *_env, jobject _this, jint mode) {
764 glCullFace(
765 (GLenum)mode
766 );
767}
768
769/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
770static void
771android_glDeleteTextures__I_3II
772 (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700773 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800774 const char * _exceptionType = NULL;
775 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700776 GLuint *textures_base = (GLuint *) 0;
777 jint _remaining;
778 GLuint *textures = (GLuint *) 0;
779
780 if (!textures_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700781 _exception = 1;
782 _exceptionType = "java/lang/IllegalArgumentException";
783 _exceptionMessage = "textures == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700784 goto exit;
785 }
786 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700787 _exception = 1;
788 _exceptionType = "java/lang/IllegalArgumentException";
789 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700790 goto exit;
791 }
792 _remaining = _env->GetArrayLength(textures_ref) - offset;
793 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700794 _exception = 1;
795 _exceptionType = "java/lang/IllegalArgumentException";
796 _exceptionMessage = "length - offset < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700797 goto exit;
798 }
799 textures_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700800 _env->GetIntArrayElements(textures_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -0700801 textures = textures_base + offset;
802
803 glDeleteTextures(
804 (GLsizei)n,
805 (GLuint *)textures
806 );
807
808exit:
809 if (textures_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700810 _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base,
Jack Palevich27f80022009-04-15 19:13:17 -0700811 JNI_ABORT);
812 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700813 if (_exception) {
814 jniThrowException(_env, _exceptionType, _exceptionMessage);
815 }
Jack Palevich27f80022009-04-15 19:13:17 -0700816}
817
818/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
819static void
820android_glDeleteTextures__ILjava_nio_IntBuffer_2
821 (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700822 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800823 const char * _exceptionType = NULL;
824 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700825 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700826 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700827 jint _remaining;
828 GLuint *textures = (GLuint *) 0;
829
Romain Guy84cac202016-12-05 12:26:02 -0800830 if (!textures_buf) {
831 _exception = 1;
832 _exceptionType = "java/lang/IllegalArgumentException";
833 _exceptionMessage = "textures == null";
834 goto exit;
835 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700836 textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -0700837 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700838 _exception = 1;
839 _exceptionType = "java/lang/IllegalArgumentException";
840 _exceptionMessage = "remaining() < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700841 goto exit;
842 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700843 if (textures == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700844 char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700845 textures = (GLuint *) (_texturesBase + _bufferOffset);
846 }
Jack Palevich27f80022009-04-15 19:13:17 -0700847 glDeleteTextures(
848 (GLsizei)n,
849 (GLuint *)textures
850 );
851
852exit:
853 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700854 _env->ReleaseIntArrayElements(_array, (jint*)textures, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -0700855 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700856 if (_exception) {
857 jniThrowException(_env, _exceptionType, _exceptionMessage);
858 }
Jack Palevich27f80022009-04-15 19:13:17 -0700859}
860
861/* void glDepthFunc ( GLenum func ) */
862static void
863android_glDepthFunc__I
864 (JNIEnv *_env, jobject _this, jint func) {
865 glDepthFunc(
866 (GLenum)func
867 );
868}
869
870/* void glDepthMask ( GLboolean flag ) */
871static void
872android_glDepthMask__Z
873 (JNIEnv *_env, jobject _this, jboolean flag) {
874 glDepthMask(
875 (GLboolean)flag
876 );
877}
878
879/* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */
880static void
881android_glDepthRangef__FF
882 (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) {
883 glDepthRangef(
884 (GLclampf)zNear,
885 (GLclampf)zFar
886 );
887}
888
889/* void glDepthRangex ( GLclampx zNear, GLclampx zFar ) */
890static void
891android_glDepthRangex__II
892 (JNIEnv *_env, jobject _this, jint zNear, jint zFar) {
893 glDepthRangex(
894 (GLclampx)zNear,
895 (GLclampx)zFar
896 );
897}
898
899/* void glDisable ( GLenum cap ) */
900static void
901android_glDisable__I
902 (JNIEnv *_env, jobject _this, jint cap) {
903 glDisable(
904 (GLenum)cap
905 );
906}
907
908/* void glDisableClientState ( GLenum array ) */
909static void
910android_glDisableClientState__I
911 (JNIEnv *_env, jobject _this, jint array) {
912 glDisableClientState(
913 (GLenum)array
914 );
915}
916
917/* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */
918static void
919android_glDrawArrays__III
920 (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) {
921 glDrawArrays(
922 (GLenum)mode,
923 (GLint)first,
924 (GLsizei)count
925 );
926}
927
928/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */
929static void
930android_glDrawElements__IIILjava_nio_Buffer_2
931 (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700932 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800933 const char * _exceptionType = NULL;
934 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700935 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700936 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700937 jint _remaining;
938 GLvoid *indices = (GLvoid *) 0;
939
Romain Guy84cac202016-12-05 12:26:02 -0800940 if (!indices_buf) {
941 _exception = 1;
942 _exceptionType = "java/lang/IllegalArgumentException";
943 _exceptionMessage = "indices == null";
944 goto exit;
945 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700946 indices = (GLvoid *)getPointer(_env, indices_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -0700947 if (_remaining < count) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700948 _exception = 1;
949 _exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
950 _exceptionMessage = "remaining() < count < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700951 goto exit;
952 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700953 if (indices == NULL) {
954 char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
955 indices = (GLvoid *) (_indicesBase + _bufferOffset);
956 }
Jack Palevich27f80022009-04-15 19:13:17 -0700957 glDrawElements(
958 (GLenum)mode,
959 (GLsizei)count,
960 (GLenum)type,
961 (GLvoid *)indices
962 );
963
964exit:
965 if (_array) {
966 releasePointer(_env, _array, indices, JNI_FALSE);
967 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700968 if (_exception) {
969 jniThrowException(_env, _exceptionType, _exceptionMessage);
970 }
Jack Palevich27f80022009-04-15 19:13:17 -0700971}
972
973/* void glEnable ( GLenum cap ) */
974static void
975android_glEnable__I
976 (JNIEnv *_env, jobject _this, jint cap) {
977 glEnable(
978 (GLenum)cap
979 );
980}
981
982/* void glEnableClientState ( GLenum array ) */
983static void
984android_glEnableClientState__I
985 (JNIEnv *_env, jobject _this, jint array) {
986 glEnableClientState(
987 (GLenum)array
988 );
989}
990
991/* void glFinish ( void ) */
992static void
993android_glFinish__
994 (JNIEnv *_env, jobject _this) {
995 glFinish();
996}
997
998/* void glFlush ( void ) */
999static void
1000android_glFlush__
1001 (JNIEnv *_env, jobject _this) {
1002 glFlush();
1003}
1004
1005/* void glFogf ( GLenum pname, GLfloat param ) */
1006static void
1007android_glFogf__IF
1008 (JNIEnv *_env, jobject _this, jint pname, jfloat param) {
1009 glFogf(
1010 (GLenum)pname,
1011 (GLfloat)param
1012 );
1013}
1014
1015/* void glFogfv ( GLenum pname, const GLfloat *params ) */
1016static void
1017android_glFogfv__I_3FI
1018 (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001019 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001020 const char * _exceptionType = NULL;
1021 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001022 GLfloat *params_base = (GLfloat *) 0;
1023 jint _remaining;
1024 GLfloat *params = (GLfloat *) 0;
1025
1026 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001027 _exception = 1;
1028 _exceptionType = "java/lang/IllegalArgumentException";
1029 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001030 goto exit;
1031 }
1032 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001033 _exception = 1;
1034 _exceptionType = "java/lang/IllegalArgumentException";
1035 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001036 goto exit;
1037 }
1038 _remaining = _env->GetArrayLength(params_ref) - offset;
1039 int _needed;
1040 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001041#if defined(GL_FOG_COLOR)
1042 case GL_FOG_COLOR:
1043#endif // defined(GL_FOG_COLOR)
1044 _needed = 4;
1045 break;
1046 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001047 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001048 break;
1049 }
1050 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001051 _exception = 1;
1052 _exceptionType = "java/lang/IllegalArgumentException";
1053 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001054 goto exit;
1055 }
1056 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001057 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001058 params = params_base + offset;
1059
1060 glFogfv(
1061 (GLenum)pname,
1062 (GLfloat *)params
1063 );
1064
1065exit:
1066 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001067 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001068 JNI_ABORT);
1069 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001070 if (_exception) {
1071 jniThrowException(_env, _exceptionType, _exceptionMessage);
1072 }
Jack Palevich27f80022009-04-15 19:13:17 -07001073}
1074
1075/* void glFogfv ( GLenum pname, const GLfloat *params ) */
1076static void
1077android_glFogfv__ILjava_nio_FloatBuffer_2
1078 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001079 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001080 const char * _exceptionType = NULL;
1081 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001082 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001083 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001084 jint _remaining;
1085 GLfloat *params = (GLfloat *) 0;
1086
Romain Guy84cac202016-12-05 12:26:02 -08001087 if (!params_buf) {
1088 _exception = 1;
1089 _exceptionType = "java/lang/IllegalArgumentException";
1090 _exceptionMessage = "params == null";
1091 goto exit;
1092 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001093 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001094 int _needed;
1095 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001096#if defined(GL_FOG_COLOR)
1097 case GL_FOG_COLOR:
1098#endif // defined(GL_FOG_COLOR)
1099 _needed = 4;
1100 break;
1101 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001102 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001103 break;
1104 }
1105 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001106 _exception = 1;
1107 _exceptionType = "java/lang/IllegalArgumentException";
1108 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001109 goto exit;
1110 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001111 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001112 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001113 params = (GLfloat *) (_paramsBase + _bufferOffset);
1114 }
Jack Palevich27f80022009-04-15 19:13:17 -07001115 glFogfv(
1116 (GLenum)pname,
1117 (GLfloat *)params
1118 );
1119
1120exit:
1121 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001122 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07001123 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001124 if (_exception) {
1125 jniThrowException(_env, _exceptionType, _exceptionMessage);
1126 }
Jack Palevich27f80022009-04-15 19:13:17 -07001127}
1128
1129/* void glFogx ( GLenum pname, GLfixed param ) */
1130static void
1131android_glFogx__II
1132 (JNIEnv *_env, jobject _this, jint pname, jint param) {
1133 glFogx(
1134 (GLenum)pname,
1135 (GLfixed)param
1136 );
1137}
1138
1139/* void glFogxv ( GLenum pname, const GLfixed *params ) */
1140static void
1141android_glFogxv__I_3II
1142 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001143 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001144 const char * _exceptionType = NULL;
1145 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001146 GLfixed *params_base = (GLfixed *) 0;
1147 jint _remaining;
1148 GLfixed *params = (GLfixed *) 0;
1149
1150 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001151 _exception = 1;
1152 _exceptionType = "java/lang/IllegalArgumentException";
1153 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001154 goto exit;
1155 }
1156 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001157 _exception = 1;
1158 _exceptionType = "java/lang/IllegalArgumentException";
1159 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001160 goto exit;
1161 }
1162 _remaining = _env->GetArrayLength(params_ref) - offset;
1163 int _needed;
1164 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001165#if defined(GL_FOG_COLOR)
1166 case GL_FOG_COLOR:
1167#endif // defined(GL_FOG_COLOR)
1168 _needed = 4;
1169 break;
1170 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001171 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001172 break;
1173 }
1174 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001175 _exception = 1;
1176 _exceptionType = "java/lang/IllegalArgumentException";
1177 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001178 goto exit;
1179 }
1180 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001181 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001182 params = params_base + offset;
1183
1184 glFogxv(
1185 (GLenum)pname,
1186 (GLfixed *)params
1187 );
1188
1189exit:
1190 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001191 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001192 JNI_ABORT);
1193 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001194 if (_exception) {
1195 jniThrowException(_env, _exceptionType, _exceptionMessage);
1196 }
Jack Palevich27f80022009-04-15 19:13:17 -07001197}
1198
1199/* void glFogxv ( GLenum pname, const GLfixed *params ) */
1200static void
1201android_glFogxv__ILjava_nio_IntBuffer_2
1202 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001203 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001204 const char * _exceptionType = NULL;
1205 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001206 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001207 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001208 jint _remaining;
1209 GLfixed *params = (GLfixed *) 0;
1210
Romain Guy84cac202016-12-05 12:26:02 -08001211 if (!params_buf) {
1212 _exception = 1;
1213 _exceptionType = "java/lang/IllegalArgumentException";
1214 _exceptionMessage = "params == null";
1215 goto exit;
1216 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001217 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001218 int _needed;
1219 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001220#if defined(GL_FOG_COLOR)
1221 case GL_FOG_COLOR:
1222#endif // defined(GL_FOG_COLOR)
1223 _needed = 4;
1224 break;
1225 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001226 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001227 break;
1228 }
1229 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001230 _exception = 1;
1231 _exceptionType = "java/lang/IllegalArgumentException";
1232 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001233 goto exit;
1234 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001235 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001236 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001237 params = (GLfixed *) (_paramsBase + _bufferOffset);
1238 }
Jack Palevich27f80022009-04-15 19:13:17 -07001239 glFogxv(
1240 (GLenum)pname,
1241 (GLfixed *)params
1242 );
1243
1244exit:
1245 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001246 _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07001247 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001248 if (_exception) {
1249 jniThrowException(_env, _exceptionType, _exceptionMessage);
1250 }
Jack Palevich27f80022009-04-15 19:13:17 -07001251}
1252
1253/* void glFrontFace ( GLenum mode ) */
1254static void
1255android_glFrontFace__I
1256 (JNIEnv *_env, jobject _this, jint mode) {
1257 glFrontFace(
1258 (GLenum)mode
1259 );
1260}
1261
1262/* void glFrustumf ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */
1263static void
1264android_glFrustumf__FFFFFF
1265 (JNIEnv *_env, jobject _this, jfloat left, jfloat right, jfloat bottom, jfloat top, jfloat zNear, jfloat zFar) {
1266 glFrustumf(
1267 (GLfloat)left,
1268 (GLfloat)right,
1269 (GLfloat)bottom,
1270 (GLfloat)top,
1271 (GLfloat)zNear,
1272 (GLfloat)zFar
1273 );
1274}
1275
1276/* void glFrustumx ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) */
1277static void
1278android_glFrustumx__IIIIII
1279 (JNIEnv *_env, jobject _this, jint left, jint right, jint bottom, jint top, jint zNear, jint zFar) {
1280 glFrustumx(
1281 (GLfixed)left,
1282 (GLfixed)right,
1283 (GLfixed)bottom,
1284 (GLfixed)top,
1285 (GLfixed)zNear,
1286 (GLfixed)zFar
1287 );
1288}
1289
1290/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1291static void
1292android_glGenTextures__I_3II
1293 (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
1294 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001295 const char * _exceptionType = NULL;
1296 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001297 GLuint *textures_base = (GLuint *) 0;
1298 jint _remaining;
1299 GLuint *textures = (GLuint *) 0;
1300
1301 if (!textures_ref) {
1302 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001303 _exceptionType = "java/lang/IllegalArgumentException";
1304 _exceptionMessage = "textures == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001305 goto exit;
1306 }
1307 if (offset < 0) {
1308 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001309 _exceptionType = "java/lang/IllegalArgumentException";
1310 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001311 goto exit;
1312 }
1313 _remaining = _env->GetArrayLength(textures_ref) - offset;
1314 if (_remaining < n) {
1315 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001316 _exceptionType = "java/lang/IllegalArgumentException";
1317 _exceptionMessage = "length - offset < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001318 goto exit;
1319 }
1320 textures_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001321 _env->GetIntArrayElements(textures_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001322 textures = textures_base + offset;
1323
1324 glGenTextures(
1325 (GLsizei)n,
1326 (GLuint *)textures
1327 );
1328
1329exit:
1330 if (textures_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001331 _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001332 _exception ? JNI_ABORT: 0);
1333 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001334 if (_exception) {
1335 jniThrowException(_env, _exceptionType, _exceptionMessage);
1336 }
Jack Palevich27f80022009-04-15 19:13:17 -07001337}
1338
1339/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1340static void
1341android_glGenTextures__ILjava_nio_IntBuffer_2
1342 (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
1343 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001344 const char * _exceptionType = NULL;
1345 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001346 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001347 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001348 jint _remaining;
1349 GLuint *textures = (GLuint *) 0;
1350
Romain Guy84cac202016-12-05 12:26:02 -08001351 if (!textures_buf) {
1352 _exception = 1;
1353 _exceptionType = "java/lang/IllegalArgumentException";
1354 _exceptionMessage = "textures == null";
1355 goto exit;
1356 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001357 textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001358 if (_remaining < n) {
1359 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001360 _exceptionType = "java/lang/IllegalArgumentException";
1361 _exceptionMessage = "remaining() < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001362 goto exit;
1363 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001364 if (textures == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001365 char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001366 textures = (GLuint *) (_texturesBase + _bufferOffset);
1367 }
Jack Palevich27f80022009-04-15 19:13:17 -07001368 glGenTextures(
1369 (GLsizei)n,
1370 (GLuint *)textures
1371 );
1372
1373exit:
1374 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001375 _env->ReleaseIntArrayElements(_array, (jint*)textures, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07001376 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001377 if (_exception) {
1378 jniThrowException(_env, _exceptionType, _exceptionMessage);
1379 }
Jack Palevich27f80022009-04-15 19:13:17 -07001380}
1381
1382/* GLenum glGetError ( void ) */
1383static jint
1384android_glGetError__
1385 (JNIEnv *_env, jobject _this) {
1386 GLenum _returnValue;
1387 _returnValue = glGetError();
Andy McFaddencee51982013-04-25 16:08:31 -07001388 return (jint)_returnValue;
Jack Palevich27f80022009-04-15 19:13:17 -07001389}
1390
1391/* void glGetIntegerv ( GLenum pname, GLint *params ) */
1392static void
1393android_glGetIntegerv__I_3II
1394 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001395 get<jintArray, IntArrayGetter, jint*, IntArrayReleaser, GLint, glGetIntegerv>(
1396 _env, _this, pname, params_ref, offset);
Jack Palevich27f80022009-04-15 19:13:17 -07001397}
1398
1399/* void glGetIntegerv ( GLenum pname, GLint *params ) */
1400static void
1401android_glGetIntegerv__ILjava_nio_IntBuffer_2
1402 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001403 getarray<GLint, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetIntegerv>(
1404 _env, _this, pname, params_buf);
Jack Palevich27f80022009-04-15 19:13:17 -07001405}
Jack Palevich27f80022009-04-15 19:13:17 -07001406/* const GLubyte * glGetString ( GLenum name ) */
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001407static jstring android_glGetString(JNIEnv* _env, jobject, jint name) {
1408 const char* chars = (const char*) glGetString((GLenum) name);
1409 return _env->NewStringUTF(chars);
Jack Palevich27f80022009-04-15 19:13:17 -07001410}
1411/* void glHint ( GLenum target, GLenum mode ) */
1412static void
1413android_glHint__II
1414 (JNIEnv *_env, jobject _this, jint target, jint mode) {
1415 glHint(
1416 (GLenum)target,
1417 (GLenum)mode
1418 );
1419}
1420
1421/* void glLightModelf ( GLenum pname, GLfloat param ) */
1422static void
1423android_glLightModelf__IF
1424 (JNIEnv *_env, jobject _this, jint pname, jfloat param) {
1425 glLightModelf(
1426 (GLenum)pname,
1427 (GLfloat)param
1428 );
1429}
1430
1431/* void glLightModelfv ( GLenum pname, const GLfloat *params ) */
1432static void
1433android_glLightModelfv__I_3FI
1434 (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001435 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001436 const char * _exceptionType = NULL;
1437 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001438 GLfloat *params_base = (GLfloat *) 0;
1439 jint _remaining;
1440 GLfloat *params = (GLfloat *) 0;
1441
1442 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001443 _exception = 1;
1444 _exceptionType = "java/lang/IllegalArgumentException";
1445 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001446 goto exit;
1447 }
1448 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001449 _exception = 1;
1450 _exceptionType = "java/lang/IllegalArgumentException";
1451 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001452 goto exit;
1453 }
1454 _remaining = _env->GetArrayLength(params_ref) - offset;
1455 int _needed;
1456 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001457#if defined(GL_LIGHT_MODEL_AMBIENT)
1458 case GL_LIGHT_MODEL_AMBIENT:
1459#endif // defined(GL_LIGHT_MODEL_AMBIENT)
1460 _needed = 4;
1461 break;
1462 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001463 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001464 break;
1465 }
1466 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001467 _exception = 1;
1468 _exceptionType = "java/lang/IllegalArgumentException";
1469 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001470 goto exit;
1471 }
1472 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001473 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001474 params = params_base + offset;
1475
1476 glLightModelfv(
1477 (GLenum)pname,
1478 (GLfloat *)params
1479 );
1480
1481exit:
1482 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001483 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001484 JNI_ABORT);
1485 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001486 if (_exception) {
1487 jniThrowException(_env, _exceptionType, _exceptionMessage);
1488 }
Jack Palevich27f80022009-04-15 19:13:17 -07001489}
1490
1491/* void glLightModelfv ( GLenum pname, const GLfloat *params ) */
1492static void
1493android_glLightModelfv__ILjava_nio_FloatBuffer_2
1494 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001495 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001496 const char * _exceptionType = NULL;
1497 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001498 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001499 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001500 jint _remaining;
1501 GLfloat *params = (GLfloat *) 0;
1502
Romain Guy84cac202016-12-05 12:26:02 -08001503 if (!params_buf) {
1504 _exception = 1;
1505 _exceptionType = "java/lang/IllegalArgumentException";
1506 _exceptionMessage = "params == null";
1507 goto exit;
1508 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001509 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001510 int _needed;
1511 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001512#if defined(GL_LIGHT_MODEL_AMBIENT)
1513 case GL_LIGHT_MODEL_AMBIENT:
1514#endif // defined(GL_LIGHT_MODEL_AMBIENT)
1515 _needed = 4;
1516 break;
1517 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001518 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001519 break;
1520 }
1521 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001522 _exception = 1;
1523 _exceptionType = "java/lang/IllegalArgumentException";
1524 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001525 goto exit;
1526 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001527 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001528 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001529 params = (GLfloat *) (_paramsBase + _bufferOffset);
1530 }
Jack Palevich27f80022009-04-15 19:13:17 -07001531 glLightModelfv(
1532 (GLenum)pname,
1533 (GLfloat *)params
1534 );
1535
1536exit:
1537 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001538 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07001539 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001540 if (_exception) {
1541 jniThrowException(_env, _exceptionType, _exceptionMessage);
1542 }
Jack Palevich27f80022009-04-15 19:13:17 -07001543}
1544
1545/* void glLightModelx ( GLenum pname, GLfixed param ) */
1546static void
1547android_glLightModelx__II
1548 (JNIEnv *_env, jobject _this, jint pname, jint param) {
1549 glLightModelx(
1550 (GLenum)pname,
1551 (GLfixed)param
1552 );
1553}
1554
1555/* void glLightModelxv ( GLenum pname, const GLfixed *params ) */
1556static void
1557android_glLightModelxv__I_3II
1558 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001559 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001560 const char * _exceptionType = NULL;
1561 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001562 GLfixed *params_base = (GLfixed *) 0;
1563 jint _remaining;
1564 GLfixed *params = (GLfixed *) 0;
1565
1566 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001567 _exception = 1;
1568 _exceptionType = "java/lang/IllegalArgumentException";
1569 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001570 goto exit;
1571 }
1572 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001573 _exception = 1;
1574 _exceptionType = "java/lang/IllegalArgumentException";
1575 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001576 goto exit;
1577 }
1578 _remaining = _env->GetArrayLength(params_ref) - offset;
1579 int _needed;
1580 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001581#if defined(GL_LIGHT_MODEL_AMBIENT)
1582 case GL_LIGHT_MODEL_AMBIENT:
1583#endif // defined(GL_LIGHT_MODEL_AMBIENT)
1584 _needed = 4;
1585 break;
1586 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001587 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001588 break;
1589 }
1590 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001591 _exception = 1;
1592 _exceptionType = "java/lang/IllegalArgumentException";
1593 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001594 goto exit;
1595 }
1596 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001597 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001598 params = params_base + offset;
1599
1600 glLightModelxv(
1601 (GLenum)pname,
1602 (GLfixed *)params
1603 );
1604
1605exit:
1606 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001607 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001608 JNI_ABORT);
1609 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001610 if (_exception) {
1611 jniThrowException(_env, _exceptionType, _exceptionMessage);
1612 }
Jack Palevich27f80022009-04-15 19:13:17 -07001613}
1614
1615/* void glLightModelxv ( GLenum pname, const GLfixed *params ) */
1616static void
1617android_glLightModelxv__ILjava_nio_IntBuffer_2
1618 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001619 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001620 const char * _exceptionType = NULL;
1621 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001622 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001623 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001624 jint _remaining;
1625 GLfixed *params = (GLfixed *) 0;
1626
Romain Guy84cac202016-12-05 12:26:02 -08001627 if (!params_buf) {
1628 _exception = 1;
1629 _exceptionType = "java/lang/IllegalArgumentException";
1630 _exceptionMessage = "params == null";
1631 goto exit;
1632 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001633 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001634 int _needed;
1635 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001636#if defined(GL_LIGHT_MODEL_AMBIENT)
1637 case GL_LIGHT_MODEL_AMBIENT:
1638#endif // defined(GL_LIGHT_MODEL_AMBIENT)
1639 _needed = 4;
1640 break;
1641 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001642 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001643 break;
1644 }
1645 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001646 _exception = 1;
1647 _exceptionType = "java/lang/IllegalArgumentException";
1648 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001649 goto exit;
1650 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001651 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001652 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001653 params = (GLfixed *) (_paramsBase + _bufferOffset);
1654 }
Jack Palevich27f80022009-04-15 19:13:17 -07001655 glLightModelxv(
1656 (GLenum)pname,
1657 (GLfixed *)params
1658 );
1659
1660exit:
1661 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001662 _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07001663 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001664 if (_exception) {
1665 jniThrowException(_env, _exceptionType, _exceptionMessage);
1666 }
Jack Palevich27f80022009-04-15 19:13:17 -07001667}
1668
1669/* void glLightf ( GLenum light, GLenum pname, GLfloat param ) */
1670static void
1671android_glLightf__IIF
1672 (JNIEnv *_env, jobject _this, jint light, jint pname, jfloat param) {
1673 glLightf(
1674 (GLenum)light,
1675 (GLenum)pname,
1676 (GLfloat)param
1677 );
1678}
1679
1680/* void glLightfv ( GLenum light, GLenum pname, const GLfloat *params ) */
1681static void
1682android_glLightfv__II_3FI
1683 (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001684 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001685 const char * _exceptionType = NULL;
1686 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001687 GLfloat *params_base = (GLfloat *) 0;
1688 jint _remaining;
1689 GLfloat *params = (GLfloat *) 0;
1690
1691 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001692 _exception = 1;
1693 _exceptionType = "java/lang/IllegalArgumentException";
1694 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001695 goto exit;
1696 }
1697 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001698 _exception = 1;
1699 _exceptionType = "java/lang/IllegalArgumentException";
1700 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001701 goto exit;
1702 }
1703 _remaining = _env->GetArrayLength(params_ref) - offset;
1704 int _needed;
1705 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001706#if defined(GL_SPOT_DIRECTION)
1707 case GL_SPOT_DIRECTION:
1708#endif // defined(GL_SPOT_DIRECTION)
1709 _needed = 3;
1710 break;
1711#if defined(GL_AMBIENT)
1712 case GL_AMBIENT:
1713#endif // defined(GL_AMBIENT)
1714#if defined(GL_DIFFUSE)
1715 case GL_DIFFUSE:
1716#endif // defined(GL_DIFFUSE)
1717#if defined(GL_SPECULAR)
1718 case GL_SPECULAR:
1719#endif // defined(GL_SPECULAR)
1720#if defined(GL_EMISSION)
1721 case GL_EMISSION:
1722#endif // defined(GL_EMISSION)
1723 _needed = 4;
1724 break;
1725 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001726 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001727 break;
1728 }
1729 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001730 _exception = 1;
1731 _exceptionType = "java/lang/IllegalArgumentException";
1732 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001733 goto exit;
1734 }
1735 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001736 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001737 params = params_base + offset;
1738
1739 glLightfv(
1740 (GLenum)light,
1741 (GLenum)pname,
1742 (GLfloat *)params
1743 );
1744
1745exit:
1746 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001747 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001748 JNI_ABORT);
1749 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001750 if (_exception) {
1751 jniThrowException(_env, _exceptionType, _exceptionMessage);
1752 }
Jack Palevich27f80022009-04-15 19:13:17 -07001753}
1754
1755/* void glLightfv ( GLenum light, GLenum pname, const GLfloat *params ) */
1756static void
1757android_glLightfv__IILjava_nio_FloatBuffer_2
1758 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001759 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001760 const char * _exceptionType = NULL;
1761 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001762 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001763 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001764 jint _remaining;
1765 GLfloat *params = (GLfloat *) 0;
1766
Romain Guy84cac202016-12-05 12:26:02 -08001767 if (!params_buf) {
1768 _exception = 1;
1769 _exceptionType = "java/lang/IllegalArgumentException";
1770 _exceptionMessage = "params == null";
1771 goto exit;
1772 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001773 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001774 int _needed;
1775 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001776#if defined(GL_SPOT_DIRECTION)
1777 case GL_SPOT_DIRECTION:
1778#endif // defined(GL_SPOT_DIRECTION)
1779 _needed = 3;
1780 break;
1781#if defined(GL_AMBIENT)
1782 case GL_AMBIENT:
1783#endif // defined(GL_AMBIENT)
1784#if defined(GL_DIFFUSE)
1785 case GL_DIFFUSE:
1786#endif // defined(GL_DIFFUSE)
1787#if defined(GL_SPECULAR)
1788 case GL_SPECULAR:
1789#endif // defined(GL_SPECULAR)
1790#if defined(GL_EMISSION)
1791 case GL_EMISSION:
1792#endif // defined(GL_EMISSION)
1793 _needed = 4;
1794 break;
1795 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001796 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001797 break;
1798 }
1799 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001800 _exception = 1;
1801 _exceptionType = "java/lang/IllegalArgumentException";
1802 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001803 goto exit;
1804 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001805 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001806 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001807 params = (GLfloat *) (_paramsBase + _bufferOffset);
1808 }
Jack Palevich27f80022009-04-15 19:13:17 -07001809 glLightfv(
1810 (GLenum)light,
1811 (GLenum)pname,
1812 (GLfloat *)params
1813 );
1814
1815exit:
1816 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001817 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07001818 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001819 if (_exception) {
1820 jniThrowException(_env, _exceptionType, _exceptionMessage);
1821 }
Jack Palevich27f80022009-04-15 19:13:17 -07001822}
1823
1824/* void glLightx ( GLenum light, GLenum pname, GLfixed param ) */
1825static void
1826android_glLightx__III
1827 (JNIEnv *_env, jobject _this, jint light, jint pname, jint param) {
1828 glLightx(
1829 (GLenum)light,
1830 (GLenum)pname,
1831 (GLfixed)param
1832 );
1833}
1834
1835/* void glLightxv ( GLenum light, GLenum pname, const GLfixed *params ) */
1836static void
1837android_glLightxv__II_3II
1838 (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001839 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001840 const char * _exceptionType = NULL;
1841 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001842 GLfixed *params_base = (GLfixed *) 0;
1843 jint _remaining;
1844 GLfixed *params = (GLfixed *) 0;
1845
1846 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001847 _exception = 1;
1848 _exceptionType = "java/lang/IllegalArgumentException";
1849 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001850 goto exit;
1851 }
1852 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001853 _exception = 1;
1854 _exceptionType = "java/lang/IllegalArgumentException";
1855 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001856 goto exit;
1857 }
1858 _remaining = _env->GetArrayLength(params_ref) - offset;
1859 int _needed;
1860 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001861#if defined(GL_SPOT_DIRECTION)
1862 case GL_SPOT_DIRECTION:
1863#endif // defined(GL_SPOT_DIRECTION)
1864 _needed = 3;
1865 break;
1866#if defined(GL_AMBIENT)
1867 case GL_AMBIENT:
1868#endif // defined(GL_AMBIENT)
1869#if defined(GL_DIFFUSE)
1870 case GL_DIFFUSE:
1871#endif // defined(GL_DIFFUSE)
1872#if defined(GL_SPECULAR)
1873 case GL_SPECULAR:
1874#endif // defined(GL_SPECULAR)
1875#if defined(GL_EMISSION)
1876 case GL_EMISSION:
1877#endif // defined(GL_EMISSION)
1878 _needed = 4;
1879 break;
1880 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001881 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001882 break;
1883 }
1884 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001885 _exception = 1;
1886 _exceptionType = "java/lang/IllegalArgumentException";
1887 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001888 goto exit;
1889 }
1890 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001891 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001892 params = params_base + offset;
1893
1894 glLightxv(
1895 (GLenum)light,
1896 (GLenum)pname,
1897 (GLfixed *)params
1898 );
1899
1900exit:
1901 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001902 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001903 JNI_ABORT);
1904 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001905 if (_exception) {
1906 jniThrowException(_env, _exceptionType, _exceptionMessage);
1907 }
Jack Palevich27f80022009-04-15 19:13:17 -07001908}
1909
1910/* void glLightxv ( GLenum light, GLenum pname, const GLfixed *params ) */
1911static void
1912android_glLightxv__IILjava_nio_IntBuffer_2
1913 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001914 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001915 const char * _exceptionType = NULL;
1916 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001917 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001918 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001919 jint _remaining;
1920 GLfixed *params = (GLfixed *) 0;
1921
Romain Guy84cac202016-12-05 12:26:02 -08001922 if (!params_buf) {
1923 _exception = 1;
1924 _exceptionType = "java/lang/IllegalArgumentException";
1925 _exceptionMessage = "params == null";
1926 goto exit;
1927 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001928 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001929 int _needed;
1930 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001931#if defined(GL_SPOT_DIRECTION)
1932 case GL_SPOT_DIRECTION:
1933#endif // defined(GL_SPOT_DIRECTION)
1934 _needed = 3;
1935 break;
1936#if defined(GL_AMBIENT)
1937 case GL_AMBIENT:
1938#endif // defined(GL_AMBIENT)
1939#if defined(GL_DIFFUSE)
1940 case GL_DIFFUSE:
1941#endif // defined(GL_DIFFUSE)
1942#if defined(GL_SPECULAR)
1943 case GL_SPECULAR:
1944#endif // defined(GL_SPECULAR)
1945#if defined(GL_EMISSION)
1946 case GL_EMISSION:
1947#endif // defined(GL_EMISSION)
1948 _needed = 4;
1949 break;
1950 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001951 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001952 break;
1953 }
1954 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001955 _exception = 1;
1956 _exceptionType = "java/lang/IllegalArgumentException";
1957 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001958 goto exit;
1959 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001960 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001961 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001962 params = (GLfixed *) (_paramsBase + _bufferOffset);
1963 }
Jack Palevich27f80022009-04-15 19:13:17 -07001964 glLightxv(
1965 (GLenum)light,
1966 (GLenum)pname,
1967 (GLfixed *)params
1968 );
1969
1970exit:
1971 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001972 _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07001973 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001974 if (_exception) {
1975 jniThrowException(_env, _exceptionType, _exceptionMessage);
1976 }
Jack Palevich27f80022009-04-15 19:13:17 -07001977}
1978
1979/* void glLineWidth ( GLfloat width ) */
1980static void
1981android_glLineWidth__F
1982 (JNIEnv *_env, jobject _this, jfloat width) {
1983 glLineWidth(
1984 (GLfloat)width
1985 );
1986}
1987
1988/* void glLineWidthx ( GLfixed width ) */
1989static void
1990android_glLineWidthx__I
1991 (JNIEnv *_env, jobject _this, jint width) {
1992 glLineWidthx(
1993 (GLfixed)width
1994 );
1995}
1996
1997/* void glLoadIdentity ( void ) */
1998static void
1999android_glLoadIdentity__
2000 (JNIEnv *_env, jobject _this) {
2001 glLoadIdentity();
2002}
2003
2004/* void glLoadMatrixf ( const GLfloat *m ) */
2005static void
2006android_glLoadMatrixf___3FI
2007 (JNIEnv *_env, jobject _this, jfloatArray m_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002008 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002009 const char * _exceptionType = NULL;
2010 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002011 GLfloat *m_base = (GLfloat *) 0;
2012 jint _remaining;
2013 GLfloat *m = (GLfloat *) 0;
2014
2015 if (!m_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002016 _exception = 1;
2017 _exceptionType = "java/lang/IllegalArgumentException";
2018 _exceptionMessage = "m == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002019 goto exit;
2020 }
2021 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002022 _exception = 1;
2023 _exceptionType = "java/lang/IllegalArgumentException";
2024 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002025 goto exit;
2026 }
2027 _remaining = _env->GetArrayLength(m_ref) - offset;
2028 m_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002029 _env->GetFloatArrayElements(m_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002030 m = m_base + offset;
2031
2032 glLoadMatrixf(
2033 (GLfloat *)m
2034 );
2035
2036exit:
2037 if (m_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002038 _env->ReleaseFloatArrayElements(m_ref, (jfloat*)m_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002039 JNI_ABORT);
2040 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002041 if (_exception) {
2042 jniThrowException(_env, _exceptionType, _exceptionMessage);
2043 }
Jack Palevich27f80022009-04-15 19:13:17 -07002044}
2045
2046/* void glLoadMatrixf ( const GLfloat *m ) */
2047static void
2048android_glLoadMatrixf__Ljava_nio_FloatBuffer_2
2049 (JNIEnv *_env, jobject _this, jobject m_buf) {
Romain Guy84cac202016-12-05 12:26:02 -08002050 jint _exception = 0;
2051 const char * _exceptionType = NULL;
2052 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002053 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002054 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002055 jint _remaining;
2056 GLfloat *m = (GLfloat *) 0;
2057
Romain Guy84cac202016-12-05 12:26:02 -08002058 if (!m_buf) {
2059 _exception = 1;
2060 _exceptionType = "java/lang/IllegalArgumentException";
2061 _exceptionMessage = "m == null";
2062 goto exit;
2063 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002064 m = (GLfloat *)getPointer(_env, m_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002065 if (m == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002066 char * _mBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002067 m = (GLfloat *) (_mBase + _bufferOffset);
2068 }
Jack Palevich27f80022009-04-15 19:13:17 -07002069 glLoadMatrixf(
2070 (GLfloat *)m
2071 );
Romain Guy84cac202016-12-05 12:26:02 -08002072
2073exit:
Jack Palevich27f80022009-04-15 19:13:17 -07002074 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002075 _env->ReleaseFloatArrayElements(_array, (jfloat*)m, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07002076 }
Romain Guy84cac202016-12-05 12:26:02 -08002077 if (_exception) {
2078 jniThrowException(_env, _exceptionType, _exceptionMessage);
2079 }
Jack Palevich27f80022009-04-15 19:13:17 -07002080}
2081
2082/* void glLoadMatrixx ( const GLfixed *m ) */
2083static void
2084android_glLoadMatrixx___3II
2085 (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002086 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002087 const char * _exceptionType = NULL;
2088 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002089 GLfixed *m_base = (GLfixed *) 0;
2090 jint _remaining;
2091 GLfixed *m = (GLfixed *) 0;
2092
2093 if (!m_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002094 _exception = 1;
2095 _exceptionType = "java/lang/IllegalArgumentException";
2096 _exceptionMessage = "m == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002097 goto exit;
2098 }
2099 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002100 _exception = 1;
2101 _exceptionType = "java/lang/IllegalArgumentException";
2102 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002103 goto exit;
2104 }
2105 _remaining = _env->GetArrayLength(m_ref) - offset;
2106 m_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002107 _env->GetIntArrayElements(m_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002108 m = m_base + offset;
2109
2110 glLoadMatrixx(
2111 (GLfixed *)m
2112 );
2113
2114exit:
2115 if (m_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002116 _env->ReleaseIntArrayElements(m_ref, (jint*)m_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002117 JNI_ABORT);
2118 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002119 if (_exception) {
2120 jniThrowException(_env, _exceptionType, _exceptionMessage);
2121 }
Jack Palevich27f80022009-04-15 19:13:17 -07002122}
2123
2124/* void glLoadMatrixx ( const GLfixed *m ) */
2125static void
2126android_glLoadMatrixx__Ljava_nio_IntBuffer_2
2127 (JNIEnv *_env, jobject _this, jobject m_buf) {
Romain Guy84cac202016-12-05 12:26:02 -08002128 jint _exception = 0;
2129 const char * _exceptionType = NULL;
2130 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002131 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002132 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002133 jint _remaining;
2134 GLfixed *m = (GLfixed *) 0;
2135
Romain Guy84cac202016-12-05 12:26:02 -08002136 if (!m_buf) {
2137 _exception = 1;
2138 _exceptionType = "java/lang/IllegalArgumentException";
2139 _exceptionMessage = "m == null";
2140 goto exit;
2141 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002142 m = (GLfixed *)getPointer(_env, m_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002143 if (m == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002144 char * _mBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002145 m = (GLfixed *) (_mBase + _bufferOffset);
2146 }
Jack Palevich27f80022009-04-15 19:13:17 -07002147 glLoadMatrixx(
2148 (GLfixed *)m
2149 );
Romain Guy84cac202016-12-05 12:26:02 -08002150
2151exit:
Jack Palevich27f80022009-04-15 19:13:17 -07002152 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002153 _env->ReleaseIntArrayElements(_array, (jint*)m, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07002154 }
Romain Guy84cac202016-12-05 12:26:02 -08002155 if (_exception) {
2156 jniThrowException(_env, _exceptionType, _exceptionMessage);
2157 }
Jack Palevich27f80022009-04-15 19:13:17 -07002158}
2159
2160/* void glLogicOp ( GLenum opcode ) */
2161static void
2162android_glLogicOp__I
2163 (JNIEnv *_env, jobject _this, jint opcode) {
2164 glLogicOp(
2165 (GLenum)opcode
2166 );
2167}
2168
2169/* void glMaterialf ( GLenum face, GLenum pname, GLfloat param ) */
2170static void
2171android_glMaterialf__IIF
2172 (JNIEnv *_env, jobject _this, jint face, jint pname, jfloat param) {
2173 glMaterialf(
2174 (GLenum)face,
2175 (GLenum)pname,
2176 (GLfloat)param
2177 );
2178}
2179
2180/* void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) */
2181static void
2182android_glMaterialfv__II_3FI
2183 (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002184 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002185 const char * _exceptionType = NULL;
2186 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002187 GLfloat *params_base = (GLfloat *) 0;
2188 jint _remaining;
2189 GLfloat *params = (GLfloat *) 0;
2190
2191 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002192 _exception = 1;
2193 _exceptionType = "java/lang/IllegalArgumentException";
2194 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002195 goto exit;
2196 }
2197 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002198 _exception = 1;
2199 _exceptionType = "java/lang/IllegalArgumentException";
2200 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002201 goto exit;
2202 }
2203 _remaining = _env->GetArrayLength(params_ref) - offset;
2204 int _needed;
2205 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002206#if defined(GL_AMBIENT)
2207 case GL_AMBIENT:
2208#endif // defined(GL_AMBIENT)
2209#if defined(GL_DIFFUSE)
2210 case GL_DIFFUSE:
2211#endif // defined(GL_DIFFUSE)
2212#if defined(GL_SPECULAR)
2213 case GL_SPECULAR:
2214#endif // defined(GL_SPECULAR)
2215#if defined(GL_EMISSION)
2216 case GL_EMISSION:
2217#endif // defined(GL_EMISSION)
2218#if defined(GL_AMBIENT_AND_DIFFUSE)
2219 case GL_AMBIENT_AND_DIFFUSE:
2220#endif // defined(GL_AMBIENT_AND_DIFFUSE)
2221 _needed = 4;
2222 break;
2223 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002224 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002225 break;
2226 }
2227 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002228 _exception = 1;
2229 _exceptionType = "java/lang/IllegalArgumentException";
2230 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002231 goto exit;
2232 }
2233 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002234 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002235 params = params_base + offset;
2236
2237 glMaterialfv(
2238 (GLenum)face,
2239 (GLenum)pname,
2240 (GLfloat *)params
2241 );
2242
2243exit:
2244 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002245 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002246 JNI_ABORT);
2247 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002248 if (_exception) {
2249 jniThrowException(_env, _exceptionType, _exceptionMessage);
2250 }
Jack Palevich27f80022009-04-15 19:13:17 -07002251}
2252
2253/* void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) */
2254static void
2255android_glMaterialfv__IILjava_nio_FloatBuffer_2
2256 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002257 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002258 const char * _exceptionType = NULL;
2259 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002260 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002261 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002262 jint _remaining;
2263 GLfloat *params = (GLfloat *) 0;
2264
Romain Guy84cac202016-12-05 12:26:02 -08002265 if (!params_buf) {
2266 _exception = 1;
2267 _exceptionType = "java/lang/IllegalArgumentException";
2268 _exceptionMessage = "params == null";
2269 goto exit;
2270 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002271 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002272 int _needed;
2273 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002274#if defined(GL_AMBIENT)
2275 case GL_AMBIENT:
2276#endif // defined(GL_AMBIENT)
2277#if defined(GL_DIFFUSE)
2278 case GL_DIFFUSE:
2279#endif // defined(GL_DIFFUSE)
2280#if defined(GL_SPECULAR)
2281 case GL_SPECULAR:
2282#endif // defined(GL_SPECULAR)
2283#if defined(GL_EMISSION)
2284 case GL_EMISSION:
2285#endif // defined(GL_EMISSION)
2286#if defined(GL_AMBIENT_AND_DIFFUSE)
2287 case GL_AMBIENT_AND_DIFFUSE:
2288#endif // defined(GL_AMBIENT_AND_DIFFUSE)
2289 _needed = 4;
2290 break;
2291 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002292 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002293 break;
2294 }
2295 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002296 _exception = 1;
2297 _exceptionType = "java/lang/IllegalArgumentException";
2298 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002299 goto exit;
2300 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002301 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002302 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002303 params = (GLfloat *) (_paramsBase + _bufferOffset);
2304 }
Jack Palevich27f80022009-04-15 19:13:17 -07002305 glMaterialfv(
2306 (GLenum)face,
2307 (GLenum)pname,
2308 (GLfloat *)params
2309 );
2310
2311exit:
2312 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002313 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07002314 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002315 if (_exception) {
2316 jniThrowException(_env, _exceptionType, _exceptionMessage);
2317 }
Jack Palevich27f80022009-04-15 19:13:17 -07002318}
2319
2320/* void glMaterialx ( GLenum face, GLenum pname, GLfixed param ) */
2321static void
2322android_glMaterialx__III
2323 (JNIEnv *_env, jobject _this, jint face, jint pname, jint param) {
2324 glMaterialx(
2325 (GLenum)face,
2326 (GLenum)pname,
2327 (GLfixed)param
2328 );
2329}
2330
2331/* void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params ) */
2332static void
2333android_glMaterialxv__II_3II
2334 (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002335 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002336 const char * _exceptionType = NULL;
2337 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002338 GLfixed *params_base = (GLfixed *) 0;
2339 jint _remaining;
2340 GLfixed *params = (GLfixed *) 0;
2341
2342 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002343 _exception = 1;
2344 _exceptionType = "java/lang/IllegalArgumentException";
2345 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002346 goto exit;
2347 }
2348 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002349 _exception = 1;
2350 _exceptionType = "java/lang/IllegalArgumentException";
2351 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002352 goto exit;
2353 }
2354 _remaining = _env->GetArrayLength(params_ref) - offset;
2355 int _needed;
2356 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002357#if defined(GL_AMBIENT)
2358 case GL_AMBIENT:
2359#endif // defined(GL_AMBIENT)
2360#if defined(GL_DIFFUSE)
2361 case GL_DIFFUSE:
2362#endif // defined(GL_DIFFUSE)
2363#if defined(GL_SPECULAR)
2364 case GL_SPECULAR:
2365#endif // defined(GL_SPECULAR)
2366#if defined(GL_EMISSION)
2367 case GL_EMISSION:
2368#endif // defined(GL_EMISSION)
2369#if defined(GL_AMBIENT_AND_DIFFUSE)
2370 case GL_AMBIENT_AND_DIFFUSE:
2371#endif // defined(GL_AMBIENT_AND_DIFFUSE)
2372 _needed = 4;
2373 break;
2374 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002375 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002376 break;
2377 }
2378 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002379 _exception = 1;
2380 _exceptionType = "java/lang/IllegalArgumentException";
2381 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002382 goto exit;
2383 }
2384 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002385 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002386 params = params_base + offset;
2387
2388 glMaterialxv(
2389 (GLenum)face,
2390 (GLenum)pname,
2391 (GLfixed *)params
2392 );
2393
2394exit:
2395 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002396 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002397 JNI_ABORT);
2398 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002399 if (_exception) {
2400 jniThrowException(_env, _exceptionType, _exceptionMessage);
2401 }
Jack Palevich27f80022009-04-15 19:13:17 -07002402}
2403
2404/* void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params ) */
2405static void
2406android_glMaterialxv__IILjava_nio_IntBuffer_2
2407 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002408 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002409 const char * _exceptionType = NULL;
2410 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002411 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002412 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002413 jint _remaining;
2414 GLfixed *params = (GLfixed *) 0;
2415
Romain Guy84cac202016-12-05 12:26:02 -08002416 if (!params_buf) {
2417 _exception = 1;
2418 _exceptionType = "java/lang/IllegalArgumentException";
2419 _exceptionMessage = "params == null";
2420 goto exit;
2421 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002422 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002423 int _needed;
2424 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002425#if defined(GL_AMBIENT)
2426 case GL_AMBIENT:
2427#endif // defined(GL_AMBIENT)
2428#if defined(GL_DIFFUSE)
2429 case GL_DIFFUSE:
2430#endif // defined(GL_DIFFUSE)
2431#if defined(GL_SPECULAR)
2432 case GL_SPECULAR:
2433#endif // defined(GL_SPECULAR)
2434#if defined(GL_EMISSION)
2435 case GL_EMISSION:
2436#endif // defined(GL_EMISSION)
2437#if defined(GL_AMBIENT_AND_DIFFUSE)
2438 case GL_AMBIENT_AND_DIFFUSE:
2439#endif // defined(GL_AMBIENT_AND_DIFFUSE)
2440 _needed = 4;
2441 break;
2442 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002443 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002444 break;
2445 }
2446 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002447 _exception = 1;
2448 _exceptionType = "java/lang/IllegalArgumentException";
2449 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002450 goto exit;
2451 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002452 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002453 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002454 params = (GLfixed *) (_paramsBase + _bufferOffset);
2455 }
Jack Palevich27f80022009-04-15 19:13:17 -07002456 glMaterialxv(
2457 (GLenum)face,
2458 (GLenum)pname,
2459 (GLfixed *)params
2460 );
2461
2462exit:
2463 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002464 _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07002465 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002466 if (_exception) {
2467 jniThrowException(_env, _exceptionType, _exceptionMessage);
2468 }
Jack Palevich27f80022009-04-15 19:13:17 -07002469}
2470
2471/* void glMatrixMode ( GLenum mode ) */
2472static void
2473android_glMatrixMode__I
2474 (JNIEnv *_env, jobject _this, jint mode) {
2475 glMatrixMode(
2476 (GLenum)mode
2477 );
2478}
2479
2480/* void glMultMatrixf ( const GLfloat *m ) */
2481static void
2482android_glMultMatrixf___3FI
2483 (JNIEnv *_env, jobject _this, jfloatArray m_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002484 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002485 const char * _exceptionType = NULL;
2486 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002487 GLfloat *m_base = (GLfloat *) 0;
2488 jint _remaining;
2489 GLfloat *m = (GLfloat *) 0;
2490
2491 if (!m_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002492 _exception = 1;
2493 _exceptionType = "java/lang/IllegalArgumentException";
2494 _exceptionMessage = "m == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002495 goto exit;
2496 }
2497 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002498 _exception = 1;
2499 _exceptionType = "java/lang/IllegalArgumentException";
2500 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002501 goto exit;
2502 }
2503 _remaining = _env->GetArrayLength(m_ref) - offset;
2504 m_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002505 _env->GetFloatArrayElements(m_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002506 m = m_base + offset;
2507
2508 glMultMatrixf(
2509 (GLfloat *)m
2510 );
2511
2512exit:
2513 if (m_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002514 _env->ReleaseFloatArrayElements(m_ref, (jfloat*)m_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002515 JNI_ABORT);
2516 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002517 if (_exception) {
2518 jniThrowException(_env, _exceptionType, _exceptionMessage);
2519 }
Jack Palevich27f80022009-04-15 19:13:17 -07002520}
2521
2522/* void glMultMatrixf ( const GLfloat *m ) */
2523static void
2524android_glMultMatrixf__Ljava_nio_FloatBuffer_2
2525 (JNIEnv *_env, jobject _this, jobject m_buf) {
Romain Guy84cac202016-12-05 12:26:02 -08002526 jint _exception = 0;
2527 const char * _exceptionType = NULL;
2528 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002529 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002530 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002531 jint _remaining;
2532 GLfloat *m = (GLfloat *) 0;
2533
Romain Guy84cac202016-12-05 12:26:02 -08002534 if (!m_buf) {
2535 _exception = 1;
2536 _exceptionType = "java/lang/IllegalArgumentException";
2537 _exceptionMessage = "m == null";
2538 goto exit;
2539 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002540 m = (GLfloat *)getPointer(_env, m_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002541 if (m == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002542 char * _mBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002543 m = (GLfloat *) (_mBase + _bufferOffset);
2544 }
Jack Palevich27f80022009-04-15 19:13:17 -07002545 glMultMatrixf(
2546 (GLfloat *)m
2547 );
Romain Guy84cac202016-12-05 12:26:02 -08002548
2549exit:
Jack Palevich27f80022009-04-15 19:13:17 -07002550 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002551 _env->ReleaseFloatArrayElements(_array, (jfloat*)m, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07002552 }
Romain Guy84cac202016-12-05 12:26:02 -08002553 if (_exception) {
2554 jniThrowException(_env, _exceptionType, _exceptionMessage);
2555 }
Jack Palevich27f80022009-04-15 19:13:17 -07002556}
2557
2558/* void glMultMatrixx ( const GLfixed *m ) */
2559static void
2560android_glMultMatrixx___3II
2561 (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002562 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002563 const char * _exceptionType = NULL;
2564 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002565 GLfixed *m_base = (GLfixed *) 0;
2566 jint _remaining;
2567 GLfixed *m = (GLfixed *) 0;
2568
2569 if (!m_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002570 _exception = 1;
2571 _exceptionType = "java/lang/IllegalArgumentException";
2572 _exceptionMessage = "m == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002573 goto exit;
2574 }
2575 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002576 _exception = 1;
2577 _exceptionType = "java/lang/IllegalArgumentException";
2578 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002579 goto exit;
2580 }
2581 _remaining = _env->GetArrayLength(m_ref) - offset;
2582 m_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002583 _env->GetIntArrayElements(m_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002584 m = m_base + offset;
2585
2586 glMultMatrixx(
2587 (GLfixed *)m
2588 );
2589
2590exit:
2591 if (m_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002592 _env->ReleaseIntArrayElements(m_ref, (jint*)m_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002593 JNI_ABORT);
2594 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002595 if (_exception) {
2596 jniThrowException(_env, _exceptionType, _exceptionMessage);
2597 }
Jack Palevich27f80022009-04-15 19:13:17 -07002598}
2599
2600/* void glMultMatrixx ( const GLfixed *m ) */
2601static void
2602android_glMultMatrixx__Ljava_nio_IntBuffer_2
2603 (JNIEnv *_env, jobject _this, jobject m_buf) {
Romain Guy84cac202016-12-05 12:26:02 -08002604 jint _exception = 0;
2605 const char * _exceptionType = NULL;
2606 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002607 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002608 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002609 jint _remaining;
2610 GLfixed *m = (GLfixed *) 0;
2611
Romain Guy84cac202016-12-05 12:26:02 -08002612 if (!m_buf) {
2613 _exception = 1;
2614 _exceptionType = "java/lang/IllegalArgumentException";
2615 _exceptionMessage = "m == null";
2616 goto exit;
2617 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002618 m = (GLfixed *)getPointer(_env, m_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002619 if (m == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002620 char * _mBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002621 m = (GLfixed *) (_mBase + _bufferOffset);
2622 }
Jack Palevich27f80022009-04-15 19:13:17 -07002623 glMultMatrixx(
2624 (GLfixed *)m
2625 );
Romain Guy84cac202016-12-05 12:26:02 -08002626
2627exit:
Jack Palevich27f80022009-04-15 19:13:17 -07002628 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002629 _env->ReleaseIntArrayElements(_array, (jint*)m, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07002630 }
Romain Guy84cac202016-12-05 12:26:02 -08002631 if (_exception) {
2632 jniThrowException(_env, _exceptionType, _exceptionMessage);
2633 }
Jack Palevich27f80022009-04-15 19:13:17 -07002634}
2635
2636/* void glMultiTexCoord4f ( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ) */
2637static void
2638android_glMultiTexCoord4f__IFFFF
2639 (JNIEnv *_env, jobject _this, jint target, jfloat s, jfloat t, jfloat r, jfloat q) {
2640 glMultiTexCoord4f(
2641 (GLenum)target,
2642 (GLfloat)s,
2643 (GLfloat)t,
2644 (GLfloat)r,
2645 (GLfloat)q
2646 );
2647}
2648
2649/* void glMultiTexCoord4x ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q ) */
2650static void
2651android_glMultiTexCoord4x__IIIII
2652 (JNIEnv *_env, jobject _this, jint target, jint s, jint t, jint r, jint q) {
2653 glMultiTexCoord4x(
2654 (GLenum)target,
2655 (GLfixed)s,
2656 (GLfixed)t,
2657 (GLfixed)r,
2658 (GLfixed)q
2659 );
2660}
2661
2662/* void glNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz ) */
2663static void
2664android_glNormal3f__FFF
2665 (JNIEnv *_env, jobject _this, jfloat nx, jfloat ny, jfloat nz) {
2666 glNormal3f(
2667 (GLfloat)nx,
2668 (GLfloat)ny,
2669 (GLfloat)nz
2670 );
2671}
2672
2673/* void glNormal3x ( GLfixed nx, GLfixed ny, GLfixed nz ) */
2674static void
2675android_glNormal3x__III
2676 (JNIEnv *_env, jobject _this, jint nx, jint ny, jint nz) {
2677 glNormal3x(
2678 (GLfixed)nx,
2679 (GLfixed)ny,
2680 (GLfixed)nz
2681 );
2682}
2683
2684/* void glNormalPointer ( GLenum type, GLsizei stride, const GLvoid *pointer ) */
2685static void
2686android_glNormalPointerBounds__IILjava_nio_Buffer_2I
2687 (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) {
Romain Guy84cac202016-12-05 12:26:02 -08002688 jint _exception = 0;
2689 const char * _exceptionType = NULL;
2690 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002691 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002692 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002693 jint _remaining;
2694 GLvoid *pointer = (GLvoid *) 0;
2695
Jack Paleviche20ea782009-05-07 18:28:29 -07002696 if (pointer_buf) {
Jack Palevich16e79722009-05-15 18:13:34 -07002697 pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
Jack Paleviche20ea782009-05-07 18:28:29 -07002698 if ( ! pointer ) {
Jack Paleviche20ea782009-05-07 18:28:29 -07002699 return;
2700 }
2701 }
Jack Palevich27f80022009-04-15 19:13:17 -07002702 glNormalPointerBounds(
2703 (GLenum)type,
2704 (GLsizei)stride,
2705 (GLvoid *)pointer,
2706 (GLsizei)remaining
2707 );
Romain Guy84cac202016-12-05 12:26:02 -08002708 if (_exception) {
2709 jniThrowException(_env, _exceptionType, _exceptionMessage);
2710 }
Jack Palevich27f80022009-04-15 19:13:17 -07002711}
2712
2713/* void glOrthof ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */
2714static void
2715android_glOrthof__FFFFFF
2716 (JNIEnv *_env, jobject _this, jfloat left, jfloat right, jfloat bottom, jfloat top, jfloat zNear, jfloat zFar) {
2717 glOrthof(
2718 (GLfloat)left,
2719 (GLfloat)right,
2720 (GLfloat)bottom,
2721 (GLfloat)top,
2722 (GLfloat)zNear,
2723 (GLfloat)zFar
2724 );
2725}
2726
2727/* void glOrthox ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) */
2728static void
2729android_glOrthox__IIIIII
2730 (JNIEnv *_env, jobject _this, jint left, jint right, jint bottom, jint top, jint zNear, jint zFar) {
2731 glOrthox(
2732 (GLfixed)left,
2733 (GLfixed)right,
2734 (GLfixed)bottom,
2735 (GLfixed)top,
2736 (GLfixed)zNear,
2737 (GLfixed)zFar
2738 );
2739}
2740
2741/* void glPixelStorei ( GLenum pname, GLint param ) */
2742static void
2743android_glPixelStorei__II
2744 (JNIEnv *_env, jobject _this, jint pname, jint param) {
2745 glPixelStorei(
2746 (GLenum)pname,
2747 (GLint)param
2748 );
2749}
2750
2751/* void glPointSize ( GLfloat size ) */
2752static void
2753android_glPointSize__F
2754 (JNIEnv *_env, jobject _this, jfloat size) {
2755 glPointSize(
2756 (GLfloat)size
2757 );
2758}
2759
2760/* void glPointSizex ( GLfixed size ) */
2761static void
2762android_glPointSizex__I
2763 (JNIEnv *_env, jobject _this, jint size) {
2764 glPointSizex(
2765 (GLfixed)size
2766 );
2767}
2768
2769/* void glPolygonOffset ( GLfloat factor, GLfloat units ) */
2770static void
2771android_glPolygonOffset__FF
2772 (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) {
2773 glPolygonOffset(
2774 (GLfloat)factor,
2775 (GLfloat)units
2776 );
2777}
2778
2779/* void glPolygonOffsetx ( GLfixed factor, GLfixed units ) */
2780static void
2781android_glPolygonOffsetx__II
2782 (JNIEnv *_env, jobject _this, jint factor, jint units) {
2783 glPolygonOffsetx(
2784 (GLfixed)factor,
2785 (GLfixed)units
2786 );
2787}
2788
2789/* void glPopMatrix ( void ) */
2790static void
2791android_glPopMatrix__
2792 (JNIEnv *_env, jobject _this) {
2793 glPopMatrix();
2794}
2795
2796/* void glPushMatrix ( void ) */
2797static void
2798android_glPushMatrix__
2799 (JNIEnv *_env, jobject _this) {
2800 glPushMatrix();
2801}
2802
2803/* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */
2804static void
2805android_glReadPixels__IIIIIILjava_nio_Buffer_2
2806 (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) {
Romain Guy84cac202016-12-05 12:26:02 -08002807 jint _exception = 0;
2808 const char * _exceptionType = NULL;
2809 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002810 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002811 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002812 jint _remaining;
2813 GLvoid *pixels = (GLvoid *) 0;
2814
Romain Guy84cac202016-12-05 12:26:02 -08002815 if (!pixels_buf) {
2816 _exception = 1;
2817 _exceptionType = "java/lang/IllegalArgumentException";
2818 _exceptionMessage = "pixels == null";
2819 goto exit;
2820 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002821 pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002822 if (pixels == NULL) {
2823 char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2824 pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
2825 }
Jack Palevich27f80022009-04-15 19:13:17 -07002826 glReadPixels(
2827 (GLint)x,
2828 (GLint)y,
2829 (GLsizei)width,
2830 (GLsizei)height,
2831 (GLenum)format,
2832 (GLenum)type,
2833 (GLvoid *)pixels
2834 );
Romain Guy84cac202016-12-05 12:26:02 -08002835
2836exit:
Jack Palevich27f80022009-04-15 19:13:17 -07002837 if (_array) {
Romain Guy84cac202016-12-05 12:26:02 -08002838 releasePointer(_env, _array, pixels, _exception ? JNI_FALSE : JNI_TRUE);
2839 }
2840 if (_exception) {
2841 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich27f80022009-04-15 19:13:17 -07002842 }
2843}
2844
2845/* void glRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) */
2846static void
2847android_glRotatef__FFFF
2848 (JNIEnv *_env, jobject _this, jfloat angle, jfloat x, jfloat y, jfloat z) {
2849 glRotatef(
2850 (GLfloat)angle,
2851 (GLfloat)x,
2852 (GLfloat)y,
2853 (GLfloat)z
2854 );
2855}
2856
2857/* void glRotatex ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z ) */
2858static void
2859android_glRotatex__IIII
2860 (JNIEnv *_env, jobject _this, jint angle, jint x, jint y, jint z) {
2861 glRotatex(
2862 (GLfixed)angle,
2863 (GLfixed)x,
2864 (GLfixed)y,
2865 (GLfixed)z
2866 );
2867}
2868
2869/* void glSampleCoverage ( GLclampf value, GLboolean invert ) */
2870static void
2871android_glSampleCoverage__FZ
2872 (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) {
2873 glSampleCoverage(
2874 (GLclampf)value,
2875 (GLboolean)invert
2876 );
2877}
2878
2879/* void glSampleCoveragex ( GLclampx value, GLboolean invert ) */
2880static void
2881android_glSampleCoveragex__IZ
2882 (JNIEnv *_env, jobject _this, jint value, jboolean invert) {
2883 glSampleCoveragex(
2884 (GLclampx)value,
2885 (GLboolean)invert
2886 );
2887}
2888
2889/* void glScalef ( GLfloat x, GLfloat y, GLfloat z ) */
2890static void
2891android_glScalef__FFF
2892 (JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat z) {
2893 glScalef(
2894 (GLfloat)x,
2895 (GLfloat)y,
2896 (GLfloat)z
2897 );
2898}
2899
2900/* void glScalex ( GLfixed x, GLfixed y, GLfixed z ) */
2901static void
2902android_glScalex__III
2903 (JNIEnv *_env, jobject _this, jint x, jint y, jint z) {
2904 glScalex(
2905 (GLfixed)x,
2906 (GLfixed)y,
2907 (GLfixed)z
2908 );
2909}
2910
2911/* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */
2912static void
2913android_glScissor__IIII
2914 (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
2915 glScissor(
2916 (GLint)x,
2917 (GLint)y,
2918 (GLsizei)width,
2919 (GLsizei)height
2920 );
2921}
2922
2923/* void glShadeModel ( GLenum mode ) */
2924static void
2925android_glShadeModel__I
2926 (JNIEnv *_env, jobject _this, jint mode) {
2927 glShadeModel(
2928 (GLenum)mode
2929 );
2930}
2931
2932/* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */
2933static void
2934android_glStencilFunc__III
2935 (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) {
2936 glStencilFunc(
2937 (GLenum)func,
2938 (GLint)ref,
2939 (GLuint)mask
2940 );
2941}
2942
2943/* void glStencilMask ( GLuint mask ) */
2944static void
2945android_glStencilMask__I
2946 (JNIEnv *_env, jobject _this, jint mask) {
2947 glStencilMask(
2948 (GLuint)mask
2949 );
2950}
2951
2952/* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */
2953static void
2954android_glStencilOp__III
2955 (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) {
2956 glStencilOp(
2957 (GLenum)fail,
2958 (GLenum)zfail,
2959 (GLenum)zpass
2960 );
2961}
2962
2963/* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
2964static void
2965android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I
2966 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
Romain Guy84cac202016-12-05 12:26:02 -08002967 jint _exception = 0;
2968 const char * _exceptionType = NULL;
2969 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002970 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002971 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002972 jint _remaining;
2973 GLvoid *pointer = (GLvoid *) 0;
2974
Jack Paleviche20ea782009-05-07 18:28:29 -07002975 if (pointer_buf) {
Jack Palevich16e79722009-05-15 18:13:34 -07002976 pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
Jack Paleviche20ea782009-05-07 18:28:29 -07002977 if ( ! pointer ) {
Jack Paleviche20ea782009-05-07 18:28:29 -07002978 return;
2979 }
2980 }
Jack Palevich27f80022009-04-15 19:13:17 -07002981 glTexCoordPointerBounds(
2982 (GLint)size,
2983 (GLenum)type,
2984 (GLsizei)stride,
2985 (GLvoid *)pointer,
2986 (GLsizei)remaining
2987 );
Romain Guy84cac202016-12-05 12:26:02 -08002988 if (_exception) {
2989 jniThrowException(_env, _exceptionType, _exceptionMessage);
2990 }
Jack Palevich27f80022009-04-15 19:13:17 -07002991}
2992
2993/* void glTexEnvf ( GLenum target, GLenum pname, GLfloat param ) */
2994static void
2995android_glTexEnvf__IIF
2996 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
2997 glTexEnvf(
2998 (GLenum)target,
2999 (GLenum)pname,
3000 (GLfloat)param
3001 );
3002}
3003
3004/* void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) */
3005static void
3006android_glTexEnvfv__II_3FI
3007 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003008 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003009 const char * _exceptionType = NULL;
3010 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07003011 GLfloat *params_base = (GLfloat *) 0;
3012 jint _remaining;
3013 GLfloat *params = (GLfloat *) 0;
3014
3015 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003016 _exception = 1;
3017 _exceptionType = "java/lang/IllegalArgumentException";
3018 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07003019 goto exit;
3020 }
3021 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003022 _exception = 1;
3023 _exceptionType = "java/lang/IllegalArgumentException";
3024 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07003025 goto exit;
3026 }
3027 _remaining = _env->GetArrayLength(params_ref) - offset;
3028 int _needed;
3029 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07003030#if defined(GL_TEXTURE_ENV_COLOR)
3031 case GL_TEXTURE_ENV_COLOR:
3032#endif // defined(GL_TEXTURE_ENV_COLOR)
3033 _needed = 4;
3034 break;
3035 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08003036 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07003037 break;
3038 }
3039 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003040 _exception = 1;
3041 _exceptionType = "java/lang/IllegalArgumentException";
3042 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07003043 goto exit;
3044 }
3045 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003046 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07003047 params = params_base + offset;
3048
3049 glTexEnvfv(
3050 (GLenum)target,
3051 (GLenum)pname,
3052 (GLfloat *)params
3053 );
3054
3055exit:
3056 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003057 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07003058 JNI_ABORT);
3059 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003060 if (_exception) {
3061 jniThrowException(_env, _exceptionType, _exceptionMessage);
3062 }
Jack Palevich27f80022009-04-15 19:13:17 -07003063}
3064
3065/* void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) */
3066static void
3067android_glTexEnvfv__IILjava_nio_FloatBuffer_2
3068 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003069 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003070 const char * _exceptionType = NULL;
3071 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003072 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003073 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07003074 jint _remaining;
3075 GLfloat *params = (GLfloat *) 0;
3076
Romain Guy84cac202016-12-05 12:26:02 -08003077 if (!params_buf) {
3078 _exception = 1;
3079 _exceptionType = "java/lang/IllegalArgumentException";
3080 _exceptionMessage = "params == null";
3081 goto exit;
3082 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003083 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07003084 int _needed;
3085 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07003086#if defined(GL_TEXTURE_ENV_COLOR)
3087 case GL_TEXTURE_ENV_COLOR:
3088#endif // defined(GL_TEXTURE_ENV_COLOR)
3089 _needed = 4;
3090 break;
3091 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08003092 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07003093 break;
3094 }
3095 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003096 _exception = 1;
3097 _exceptionType = "java/lang/IllegalArgumentException";
3098 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07003099 goto exit;
3100 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003101 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003102 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003103 params = (GLfloat *) (_paramsBase + _bufferOffset);
3104 }
Jack Palevich27f80022009-04-15 19:13:17 -07003105 glTexEnvfv(
3106 (GLenum)target,
3107 (GLenum)pname,
3108 (GLfloat *)params
3109 );
3110
3111exit:
3112 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003113 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07003114 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003115 if (_exception) {
3116 jniThrowException(_env, _exceptionType, _exceptionMessage);
3117 }
Jack Palevich27f80022009-04-15 19:13:17 -07003118}
3119
3120/* void glTexEnvx ( GLenum target, GLenum pname, GLfixed param ) */
3121static void
3122android_glTexEnvx__III
3123 (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
3124 glTexEnvx(
3125 (GLenum)target,
3126 (GLenum)pname,
3127 (GLfixed)param
3128 );
3129}
3130
3131/* void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params ) */
3132static void
3133android_glTexEnvxv__II_3II
3134 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003135 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003136 const char * _exceptionType = NULL;
3137 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07003138 GLfixed *params_base = (GLfixed *) 0;
3139 jint _remaining;
3140 GLfixed *params = (GLfixed *) 0;
3141
3142 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003143 _exception = 1;
3144 _exceptionType = "java/lang/IllegalArgumentException";
3145 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07003146 goto exit;
3147 }
3148 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003149 _exception = 1;
3150 _exceptionType = "java/lang/IllegalArgumentException";
3151 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07003152 goto exit;
3153 }
3154 _remaining = _env->GetArrayLength(params_ref) - offset;
3155 int _needed;
3156 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07003157#if defined(GL_TEXTURE_ENV_COLOR)
3158 case GL_TEXTURE_ENV_COLOR:
3159#endif // defined(GL_TEXTURE_ENV_COLOR)
3160 _needed = 4;
3161 break;
3162 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08003163 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07003164 break;
3165 }
3166 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003167 _exception = 1;
3168 _exceptionType = "java/lang/IllegalArgumentException";
3169 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07003170 goto exit;
3171 }
3172 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003173 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07003174 params = params_base + offset;
3175
3176 glTexEnvxv(
3177 (GLenum)target,
3178 (GLenum)pname,
3179 (GLfixed *)params
3180 );
3181
3182exit:
3183 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003184 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07003185 JNI_ABORT);
3186 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003187 if (_exception) {
3188 jniThrowException(_env, _exceptionType, _exceptionMessage);
3189 }
Jack Palevich27f80022009-04-15 19:13:17 -07003190}
3191
3192/* void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params ) */
3193static void
3194android_glTexEnvxv__IILjava_nio_IntBuffer_2
3195 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003196 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003197 const char * _exceptionType = NULL;
3198 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003199 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003200 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07003201 jint _remaining;
3202 GLfixed *params = (GLfixed *) 0;
3203
Romain Guy84cac202016-12-05 12:26:02 -08003204 if (!params_buf) {
3205 _exception = 1;
3206 _exceptionType = "java/lang/IllegalArgumentException";
3207 _exceptionMessage = "params == null";
3208 goto exit;
3209 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003210 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07003211 int _needed;
3212 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07003213#if defined(GL_TEXTURE_ENV_COLOR)
3214 case GL_TEXTURE_ENV_COLOR:
3215#endif // defined(GL_TEXTURE_ENV_COLOR)
3216 _needed = 4;
3217 break;
3218 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08003219 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07003220 break;
3221 }
3222 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003223 _exception = 1;
3224 _exceptionType = "java/lang/IllegalArgumentException";
3225 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07003226 goto exit;
3227 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003228 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003229 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003230 params = (GLfixed *) (_paramsBase + _bufferOffset);
3231 }
Jack Palevich27f80022009-04-15 19:13:17 -07003232 glTexEnvxv(
3233 (GLenum)target,
3234 (GLenum)pname,
3235 (GLfixed *)params
3236 );
3237
3238exit:
3239 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003240 _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07003241 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003242 if (_exception) {
3243 jniThrowException(_env, _exceptionType, _exceptionMessage);
3244 }
Jack Palevich27f80022009-04-15 19:13:17 -07003245}
3246
3247/* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */
3248static void
3249android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2
3250 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) {
Romain Guy84cac202016-12-05 12:26:02 -08003251 jint _exception = 0;
3252 const char * _exceptionType = NULL;
3253 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07003254 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003255 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07003256 jint _remaining;
3257 GLvoid *pixels = (GLvoid *) 0;
3258
3259 if (pixels_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003260 pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003261 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -07003262 if (pixels_buf && pixels == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003263 char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3264 pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07003265 }
3266 glTexImage2D(
3267 (GLenum)target,
3268 (GLint)level,
3269 (GLint)internalformat,
3270 (GLsizei)width,
3271 (GLsizei)height,
3272 (GLint)border,
3273 (GLenum)format,
3274 (GLenum)type,
3275 (GLvoid *)pixels
3276 );
3277 if (_array) {
3278 releasePointer(_env, _array, pixels, JNI_FALSE);
3279 }
Romain Guy84cac202016-12-05 12:26:02 -08003280 if (_exception) {
3281 jniThrowException(_env, _exceptionType, _exceptionMessage);
3282 }
Jack Palevich27f80022009-04-15 19:13:17 -07003283}
3284
3285/* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */
3286static void
3287android_glTexParameterf__IIF
3288 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
3289 glTexParameterf(
3290 (GLenum)target,
3291 (GLenum)pname,
3292 (GLfloat)param
3293 );
3294}
3295
3296/* void glTexParameterx ( GLenum target, GLenum pname, GLfixed param ) */
3297static void
3298android_glTexParameterx__III
3299 (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
3300 glTexParameterx(
3301 (GLenum)target,
3302 (GLenum)pname,
3303 (GLfixed)param
3304 );
3305}
3306
3307/* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */
3308static void
3309android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
3310 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) {
Romain Guy84cac202016-12-05 12:26:02 -08003311 jint _exception = 0;
3312 const char * _exceptionType = NULL;
3313 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07003314 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003315 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07003316 jint _remaining;
3317 GLvoid *pixels = (GLvoid *) 0;
3318
3319 if (pixels_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003320 pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003321 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -07003322 if (pixels_buf && pixels == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003323 char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3324 pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07003325 }
3326 glTexSubImage2D(
3327 (GLenum)target,
3328 (GLint)level,
3329 (GLint)xoffset,
3330 (GLint)yoffset,
3331 (GLsizei)width,
3332 (GLsizei)height,
3333 (GLenum)format,
3334 (GLenum)type,
3335 (GLvoid *)pixels
3336 );
3337 if (_array) {
3338 releasePointer(_env, _array, pixels, JNI_FALSE);
3339 }
Romain Guy84cac202016-12-05 12:26:02 -08003340 if (_exception) {
3341 jniThrowException(_env, _exceptionType, _exceptionMessage);
3342 }
Jack Palevich27f80022009-04-15 19:13:17 -07003343}
3344
3345/* void glTranslatef ( GLfloat x, GLfloat y, GLfloat z ) */
3346static void
3347android_glTranslatef__FFF
3348 (JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat z) {
3349 glTranslatef(
3350 (GLfloat)x,
3351 (GLfloat)y,
3352 (GLfloat)z
3353 );
3354}
3355
3356/* void glTranslatex ( GLfixed x, GLfixed y, GLfixed z ) */
3357static void
3358android_glTranslatex__III
3359 (JNIEnv *_env, jobject _this, jint x, jint y, jint z) {
3360 glTranslatex(
3361 (GLfixed)x,
3362 (GLfixed)y,
3363 (GLfixed)z
3364 );
3365}
3366
3367/* void glVertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
3368static void
3369android_glVertexPointerBounds__IIILjava_nio_Buffer_2I
3370 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
Romain Guy84cac202016-12-05 12:26:02 -08003371 jint _exception = 0;
3372 const char * _exceptionType = NULL;
3373 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07003374 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003375 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07003376 jint _remaining;
3377 GLvoid *pointer = (GLvoid *) 0;
3378
Jack Paleviche20ea782009-05-07 18:28:29 -07003379 if (pointer_buf) {
Jack Palevich16e79722009-05-15 18:13:34 -07003380 pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
Jack Paleviche20ea782009-05-07 18:28:29 -07003381 if ( ! pointer ) {
Jack Paleviche20ea782009-05-07 18:28:29 -07003382 return;
3383 }
3384 }
Jack Palevich27f80022009-04-15 19:13:17 -07003385 glVertexPointerBounds(
3386 (GLint)size,
3387 (GLenum)type,
3388 (GLsizei)stride,
3389 (GLvoid *)pointer,
3390 (GLsizei)remaining
3391 );
Romain Guy84cac202016-12-05 12:26:02 -08003392 if (_exception) {
3393 jniThrowException(_env, _exceptionType, _exceptionMessage);
3394 }
Jack Palevich27f80022009-04-15 19:13:17 -07003395}
3396
3397/* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */
3398static void
3399android_glViewport__IIII
3400 (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
3401 glViewport(
3402 (GLint)x,
3403 (GLint)y,
3404 (GLsizei)width,
3405 (GLsizei)height
3406 );
3407}
3408
3409static const char *classPathName = "android/opengl/GLES10";
3410
Daniel Micay76f6a862015-09-19 17:31:01 -04003411static const JNINativeMethod methods[] = {
Jack Palevich27f80022009-04-15 19:13:17 -07003412{"_nativeClassInit", "()V", (void*)nativeClassInit },
3413{"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I },
3414{"glAlphaFunc", "(IF)V", (void *) android_glAlphaFunc__IF },
3415{"glAlphaFuncx", "(II)V", (void *) android_glAlphaFuncx__II },
3416{"glBindTexture", "(II)V", (void *) android_glBindTexture__II },
3417{"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II },
3418{"glClear", "(I)V", (void *) android_glClear__I },
3419{"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF },
3420{"glClearColorx", "(IIII)V", (void *) android_glClearColorx__IIII },
3421{"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F },
3422{"glClearDepthx", "(I)V", (void *) android_glClearDepthx__I },
3423{"glClearStencil", "(I)V", (void *) android_glClearStencil__I },
3424{"glClientActiveTexture", "(I)V", (void *) android_glClientActiveTexture__I },
3425{"glColor4f", "(FFFF)V", (void *) android_glColor4f__FFFF },
3426{"glColor4x", "(IIII)V", (void *) android_glColor4x__IIII },
3427{"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ },
3428{"glColorPointerBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glColorPointerBounds__IIILjava_nio_Buffer_2I },
3429{"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 },
3430{"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
3431{"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII },
3432{"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII },
3433{"glCullFace", "(I)V", (void *) android_glCullFace__I },
3434{"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II },
3435{"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 },
3436{"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I },
3437{"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z },
3438{"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF },
3439{"glDepthRangex", "(II)V", (void *) android_glDepthRangex__II },
3440{"glDisable", "(I)V", (void *) android_glDisable__I },
3441{"glDisableClientState", "(I)V", (void *) android_glDisableClientState__I },
3442{"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III },
3443{"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 },
3444{"glEnable", "(I)V", (void *) android_glEnable__I },
3445{"glEnableClientState", "(I)V", (void *) android_glEnableClientState__I },
3446{"glFinish", "()V", (void *) android_glFinish__ },
3447{"glFlush", "()V", (void *) android_glFlush__ },
3448{"glFogf", "(IF)V", (void *) android_glFogf__IF },
3449{"glFogfv", "(I[FI)V", (void *) android_glFogfv__I_3FI },
3450{"glFogfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glFogfv__ILjava_nio_FloatBuffer_2 },
3451{"glFogx", "(II)V", (void *) android_glFogx__II },
3452{"glFogxv", "(I[II)V", (void *) android_glFogxv__I_3II },
3453{"glFogxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glFogxv__ILjava_nio_IntBuffer_2 },
3454{"glFrontFace", "(I)V", (void *) android_glFrontFace__I },
3455{"glFrustumf", "(FFFFFF)V", (void *) android_glFrustumf__FFFFFF },
3456{"glFrustumx", "(IIIIII)V", (void *) android_glFrustumx__IIIIII },
3457{"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II },
3458{"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 },
3459{"glGetError", "()I", (void *) android_glGetError__ },
3460{"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II },
3461{"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 },
Jack Palevicha3795852009-04-24 10:35:11 -07003462{"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString },
Jack Palevich27f80022009-04-15 19:13:17 -07003463{"glHint", "(II)V", (void *) android_glHint__II },
3464{"glLightModelf", "(IF)V", (void *) android_glLightModelf__IF },
3465{"glLightModelfv", "(I[FI)V", (void *) android_glLightModelfv__I_3FI },
3466{"glLightModelfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glLightModelfv__ILjava_nio_FloatBuffer_2 },
3467{"glLightModelx", "(II)V", (void *) android_glLightModelx__II },
3468{"glLightModelxv", "(I[II)V", (void *) android_glLightModelxv__I_3II },
3469{"glLightModelxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glLightModelxv__ILjava_nio_IntBuffer_2 },
3470{"glLightf", "(IIF)V", (void *) android_glLightf__IIF },
3471{"glLightfv", "(II[FI)V", (void *) android_glLightfv__II_3FI },
3472{"glLightfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glLightfv__IILjava_nio_FloatBuffer_2 },
3473{"glLightx", "(III)V", (void *) android_glLightx__III },
3474{"glLightxv", "(II[II)V", (void *) android_glLightxv__II_3II },
3475{"glLightxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glLightxv__IILjava_nio_IntBuffer_2 },
3476{"glLineWidth", "(F)V", (void *) android_glLineWidth__F },
3477{"glLineWidthx", "(I)V", (void *) android_glLineWidthx__I },
3478{"glLoadIdentity", "()V", (void *) android_glLoadIdentity__ },
3479{"glLoadMatrixf", "([FI)V", (void *) android_glLoadMatrixf___3FI },
3480{"glLoadMatrixf", "(Ljava/nio/FloatBuffer;)V", (void *) android_glLoadMatrixf__Ljava_nio_FloatBuffer_2 },
3481{"glLoadMatrixx", "([II)V", (void *) android_glLoadMatrixx___3II },
3482{"glLoadMatrixx", "(Ljava/nio/IntBuffer;)V", (void *) android_glLoadMatrixx__Ljava_nio_IntBuffer_2 },
3483{"glLogicOp", "(I)V", (void *) android_glLogicOp__I },
3484{"glMaterialf", "(IIF)V", (void *) android_glMaterialf__IIF },
3485{"glMaterialfv", "(II[FI)V", (void *) android_glMaterialfv__II_3FI },
3486{"glMaterialfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glMaterialfv__IILjava_nio_FloatBuffer_2 },
3487{"glMaterialx", "(III)V", (void *) android_glMaterialx__III },
3488{"glMaterialxv", "(II[II)V", (void *) android_glMaterialxv__II_3II },
3489{"glMaterialxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glMaterialxv__IILjava_nio_IntBuffer_2 },
3490{"glMatrixMode", "(I)V", (void *) android_glMatrixMode__I },
3491{"glMultMatrixf", "([FI)V", (void *) android_glMultMatrixf___3FI },
3492{"glMultMatrixf", "(Ljava/nio/FloatBuffer;)V", (void *) android_glMultMatrixf__Ljava_nio_FloatBuffer_2 },
3493{"glMultMatrixx", "([II)V", (void *) android_glMultMatrixx___3II },
3494{"glMultMatrixx", "(Ljava/nio/IntBuffer;)V", (void *) android_glMultMatrixx__Ljava_nio_IntBuffer_2 },
3495{"glMultiTexCoord4f", "(IFFFF)V", (void *) android_glMultiTexCoord4f__IFFFF },
3496{"glMultiTexCoord4x", "(IIIII)V", (void *) android_glMultiTexCoord4x__IIIII },
3497{"glNormal3f", "(FFF)V", (void *) android_glNormal3f__FFF },
3498{"glNormal3x", "(III)V", (void *) android_glNormal3x__III },
3499{"glNormalPointerBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glNormalPointerBounds__IILjava_nio_Buffer_2I },
3500{"glOrthof", "(FFFFFF)V", (void *) android_glOrthof__FFFFFF },
3501{"glOrthox", "(IIIIII)V", (void *) android_glOrthox__IIIIII },
3502{"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II },
3503{"glPointSize", "(F)V", (void *) android_glPointSize__F },
3504{"glPointSizex", "(I)V", (void *) android_glPointSizex__I },
3505{"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF },
3506{"glPolygonOffsetx", "(II)V", (void *) android_glPolygonOffsetx__II },
3507{"glPopMatrix", "()V", (void *) android_glPopMatrix__ },
3508{"glPushMatrix", "()V", (void *) android_glPushMatrix__ },
3509{"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 },
3510{"glRotatef", "(FFFF)V", (void *) android_glRotatef__FFFF },
3511{"glRotatex", "(IIII)V", (void *) android_glRotatex__IIII },
3512{"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ },
3513{"glSampleCoveragex", "(IZ)V", (void *) android_glSampleCoveragex__IZ },
3514{"glScalef", "(FFF)V", (void *) android_glScalef__FFF },
3515{"glScalex", "(III)V", (void *) android_glScalex__III },
3516{"glScissor", "(IIII)V", (void *) android_glScissor__IIII },
3517{"glShadeModel", "(I)V", (void *) android_glShadeModel__I },
3518{"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III },
3519{"glStencilMask", "(I)V", (void *) android_glStencilMask__I },
3520{"glStencilOp", "(III)V", (void *) android_glStencilOp__III },
3521{"glTexCoordPointerBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I },
3522{"glTexEnvf", "(IIF)V", (void *) android_glTexEnvf__IIF },
3523{"glTexEnvfv", "(II[FI)V", (void *) android_glTexEnvfv__II_3FI },
3524{"glTexEnvfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexEnvfv__IILjava_nio_FloatBuffer_2 },
3525{"glTexEnvx", "(III)V", (void *) android_glTexEnvx__III },
3526{"glTexEnvxv", "(II[II)V", (void *) android_glTexEnvxv__II_3II },
3527{"glTexEnvxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexEnvxv__IILjava_nio_IntBuffer_2 },
3528{"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 },
3529{"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF },
3530{"glTexParameterx", "(III)V", (void *) android_glTexParameterx__III },
3531{"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
3532{"glTranslatef", "(FFF)V", (void *) android_glTranslatef__FFF },
3533{"glTranslatex", "(III)V", (void *) android_glTranslatex__III },
3534{"glVertexPointerBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glVertexPointerBounds__IIILjava_nio_Buffer_2I },
3535{"glViewport", "(IIII)V", (void *) android_glViewport__IIII },
3536};
3537
3538int register_android_opengl_jni_GLES10(JNIEnv *_env)
3539{
3540 int err;
3541 err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
3542 return err;
3543}