blob: 391ae5366a3bcff9bb942b82337698682d33153b [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>
Jack Palevichbe6eac82009-12-08 15:43:51 +080031
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 Palevichbe6eac82009-12-08 15:43:51 +0800245static 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 Palevichbe6eac82009-12-08 15:43:51 +0800255 }
256 return (void*) buf;
257}
258
Jack Palevich27f80022009-04-15 19:13:17 -0700259// --------------------------------------------------------------------------
Mathias Agopian2ad04772013-02-23 03:12:30 -0800260
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 }
454}
455
456// --------------------------------------------------------------------------
Jack Palevich27f80022009-04-15 19:13:17 -0700457/* void glBindBuffer ( GLenum target, GLuint buffer ) */
458static void
459android_glBindBuffer__II
460 (JNIEnv *_env, jobject _this, jint target, jint buffer) {
461 glBindBuffer(
462 (GLenum)target,
463 (GLuint)buffer
464 );
465}
466
467/* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */
468static void
469android_glBufferData__IILjava_nio_Buffer_2I
470 (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700471 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800472 const char * _exceptionType = NULL;
473 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700474 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700475 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700476 jint _remaining;
477 GLvoid *data = (GLvoid *) 0;
478
479 if (data_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700480 data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevichc620a522009-10-21 11:02:44 -0700481 if (_remaining < size) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700482 _exception = 1;
483 _exceptionType = "java/lang/IllegalArgumentException";
484 _exceptionMessage = "remaining() < size < needed";
Jack Palevichc620a522009-10-21 11:02:44 -0700485 goto exit;
486 }
Jack Palevich27f80022009-04-15 19:13:17 -0700487 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -0700488 if (data_buf && data == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700489 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
490 data = (GLvoid *) (_dataBase + _bufferOffset);
491 }
Jack Palevich27f80022009-04-15 19:13:17 -0700492 glBufferData(
493 (GLenum)target,
494 (GLsizeiptr)size,
495 (GLvoid *)data,
496 (GLenum)usage
497 );
Jack Palevichc620a522009-10-21 11:02:44 -0700498
499exit:
Jack Palevich27f80022009-04-15 19:13:17 -0700500 if (_array) {
501 releasePointer(_env, _array, data, JNI_FALSE);
502 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700503 if (_exception) {
504 jniThrowException(_env, _exceptionType, _exceptionMessage);
505 }
Jack Palevich27f80022009-04-15 19:13:17 -0700506}
507
508/* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */
509static void
510android_glBufferSubData__IIILjava_nio_Buffer_2
511 (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700512 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800513 const char * _exceptionType = NULL;
514 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700515 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700516 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700517 jint _remaining;
518 GLvoid *data = (GLvoid *) 0;
519
Romain Guy84cac202016-12-05 12:26:02 -0800520 if (!data_buf) {
521 _exception = 1;
522 _exceptionType = "java/lang/IllegalArgumentException";
523 _exceptionMessage = "data == null";
524 goto exit;
525 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700526 data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevichc620a522009-10-21 11:02:44 -0700527 if (_remaining < size) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700528 _exception = 1;
529 _exceptionType = "java/lang/IllegalArgumentException";
530 _exceptionMessage = "remaining() < size < needed";
Jack Palevichc620a522009-10-21 11:02:44 -0700531 goto exit;
532 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700533 if (data == NULL) {
534 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
535 data = (GLvoid *) (_dataBase + _bufferOffset);
536 }
Jack Palevich27f80022009-04-15 19:13:17 -0700537 glBufferSubData(
538 (GLenum)target,
539 (GLintptr)offset,
540 (GLsizeiptr)size,
541 (GLvoid *)data
542 );
Jack Palevichc620a522009-10-21 11:02:44 -0700543
544exit:
Jack Palevich27f80022009-04-15 19:13:17 -0700545 if (_array) {
546 releasePointer(_env, _array, data, JNI_FALSE);
547 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700548 if (_exception) {
549 jniThrowException(_env, _exceptionType, _exceptionMessage);
550 }
Jack Palevich27f80022009-04-15 19:13:17 -0700551}
552
553/* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */
554static void
555android_glClipPlanef__I_3FI
556 (JNIEnv *_env, jobject _this, jint plane, jfloatArray equation_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700557 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800558 const char * _exceptionType = NULL;
559 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700560 GLfloat *equation_base = (GLfloat *) 0;
561 jint _remaining;
562 GLfloat *equation = (GLfloat *) 0;
563
564 if (!equation_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700565 _exception = 1;
566 _exceptionType = "java/lang/IllegalArgumentException";
567 _exceptionMessage = "equation == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700568 goto exit;
569 }
570 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700571 _exception = 1;
572 _exceptionType = "java/lang/IllegalArgumentException";
573 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700574 goto exit;
575 }
576 _remaining = _env->GetArrayLength(equation_ref) - offset;
577 equation_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700578 _env->GetFloatArrayElements(equation_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -0700579 equation = equation_base + offset;
580
581 glClipPlanef(
582 (GLenum)plane,
583 (GLfloat *)equation
584 );
585
586exit:
587 if (equation_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700588 _env->ReleaseFloatArrayElements(equation_ref, (jfloat*)equation_base,
Jack Palevich27f80022009-04-15 19:13:17 -0700589 JNI_ABORT);
590 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700591 if (_exception) {
592 jniThrowException(_env, _exceptionType, _exceptionMessage);
593 }
Jack Palevich27f80022009-04-15 19:13:17 -0700594}
595
596/* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */
597static void
598android_glClipPlanef__ILjava_nio_FloatBuffer_2
599 (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700600 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800601 const char * _exceptionType = NULL;
602 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700603 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700604 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700605 jint _remaining;
606 GLfloat *equation = (GLfloat *) 0;
607
Romain Guy84cac202016-12-05 12:26:02 -0800608 if (!equation_buf) {
609 _exception = 1;
610 _exceptionType = "java/lang/IllegalArgumentException";
611 _exceptionMessage = "equation == null";
612 goto exit;
613 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700614 equation = (GLfloat *)getPointer(_env, equation_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700615 if (equation == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700616 char * _equationBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700617 equation = (GLfloat *) (_equationBase + _bufferOffset);
618 }
Jack Palevich27f80022009-04-15 19:13:17 -0700619 glClipPlanef(
620 (GLenum)plane,
621 (GLfloat *)equation
622 );
Romain Guy84cac202016-12-05 12:26:02 -0800623
624exit:
Jack Palevich27f80022009-04-15 19:13:17 -0700625 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700626 _env->ReleaseFloatArrayElements(_array, (jfloat*)equation, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -0700627 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700628 if (_exception) {
629 jniThrowException(_env, _exceptionType, _exceptionMessage);
630 }
Jack Palevich27f80022009-04-15 19:13:17 -0700631}
632
633/* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */
634static void
635android_glClipPlanex__I_3II
636 (JNIEnv *_env, jobject _this, jint plane, jintArray equation_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700637 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800638 const char * _exceptionType = NULL;
639 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700640 GLfixed *equation_base = (GLfixed *) 0;
641 jint _remaining;
642 GLfixed *equation = (GLfixed *) 0;
643
644 if (!equation_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700645 _exception = 1;
646 _exceptionType = "java/lang/IllegalArgumentException";
647 _exceptionMessage = "equation == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700648 goto exit;
649 }
650 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700651 _exception = 1;
652 _exceptionType = "java/lang/IllegalArgumentException";
653 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700654 goto exit;
655 }
656 _remaining = _env->GetArrayLength(equation_ref) - offset;
657 equation_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700658 _env->GetIntArrayElements(equation_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -0700659 equation = equation_base + offset;
660
661 glClipPlanex(
662 (GLenum)plane,
663 (GLfixed *)equation
664 );
665
666exit:
667 if (equation_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700668 _env->ReleaseIntArrayElements(equation_ref, (jint*)equation_base,
Jack Palevich27f80022009-04-15 19:13:17 -0700669 JNI_ABORT);
670 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700671 if (_exception) {
672 jniThrowException(_env, _exceptionType, _exceptionMessage);
673 }
Jack Palevich27f80022009-04-15 19:13:17 -0700674}
675
676/* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */
677static void
678android_glClipPlanex__ILjava_nio_IntBuffer_2
679 (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700680 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800681 const char * _exceptionType = NULL;
682 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700683 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700684 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700685 jint _remaining;
686 GLfixed *equation = (GLfixed *) 0;
687
Romain Guy84cac202016-12-05 12:26:02 -0800688 if (!equation_buf) {
689 _exception = 1;
690 _exceptionType = "java/lang/IllegalArgumentException";
691 _exceptionMessage = "equation == null";
692 goto exit;
693 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700694 equation = (GLfixed *)getPointer(_env, equation_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700695 if (equation == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700696 char * _equationBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700697 equation = (GLfixed *) (_equationBase + _bufferOffset);
698 }
Jack Palevich27f80022009-04-15 19:13:17 -0700699 glClipPlanex(
700 (GLenum)plane,
701 (GLfixed *)equation
702 );
Romain Guy84cac202016-12-05 12:26:02 -0800703
704exit:
Jack Palevich27f80022009-04-15 19:13:17 -0700705 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700706 _env->ReleaseIntArrayElements(_array, (jint*)equation, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -0700707 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700708 if (_exception) {
709 jniThrowException(_env, _exceptionType, _exceptionMessage);
710 }
Jack Palevich27f80022009-04-15 19:13:17 -0700711}
712
713/* void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) */
714static void
715android_glColor4ub__BBBB
716 (JNIEnv *_env, jobject _this, jbyte red, jbyte green, jbyte blue, jbyte alpha) {
717 glColor4ub(
718 (GLubyte)red,
719 (GLubyte)green,
720 (GLubyte)blue,
721 (GLubyte)alpha
722 );
723}
724
725/* void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
726static void
727android_glColorPointer__IIII
728 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
729 glColorPointer(
730 (GLint)size,
731 (GLenum)type,
732 (GLsizei)stride,
Ashok Bhat01c26ea2014-02-24 09:49:07 +0000733 reinterpret_cast<GLvoid *>(offset)
Jack Palevich27f80022009-04-15 19:13:17 -0700734 );
735}
736
737/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
738static void
739android_glDeleteBuffers__I_3II
740 (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700741 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800742 const char * _exceptionType = NULL;
743 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700744 GLuint *buffers_base = (GLuint *) 0;
745 jint _remaining;
746 GLuint *buffers = (GLuint *) 0;
747
748 if (!buffers_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700749 _exception = 1;
750 _exceptionType = "java/lang/IllegalArgumentException";
751 _exceptionMessage = "buffers == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700752 goto exit;
753 }
754 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700755 _exception = 1;
756 _exceptionType = "java/lang/IllegalArgumentException";
757 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700758 goto exit;
759 }
760 _remaining = _env->GetArrayLength(buffers_ref) - offset;
761 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700762 _exception = 1;
763 _exceptionType = "java/lang/IllegalArgumentException";
764 _exceptionMessage = "length - offset < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700765 goto exit;
766 }
767 buffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700768 _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -0700769 buffers = buffers_base + offset;
770
771 glDeleteBuffers(
772 (GLsizei)n,
773 (GLuint *)buffers
774 );
775
776exit:
777 if (buffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700778 _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
Jack Palevich27f80022009-04-15 19:13:17 -0700779 JNI_ABORT);
780 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700781 if (_exception) {
782 jniThrowException(_env, _exceptionType, _exceptionMessage);
783 }
Jack Palevich27f80022009-04-15 19:13:17 -0700784}
785
786/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
787static void
788android_glDeleteBuffers__ILjava_nio_IntBuffer_2
789 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700790 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800791 const char * _exceptionType = NULL;
792 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700793 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700794 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700795 jint _remaining;
796 GLuint *buffers = (GLuint *) 0;
797
Romain Guy84cac202016-12-05 12:26:02 -0800798 if (!buffers_buf) {
799 _exception = 1;
800 _exceptionType = "java/lang/IllegalArgumentException";
801 _exceptionMessage = "buffers == null";
802 goto exit;
803 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700804 buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -0700805 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700806 _exception = 1;
807 _exceptionType = "java/lang/IllegalArgumentException";
808 _exceptionMessage = "remaining() < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700809 goto exit;
810 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700811 if (buffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700812 char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700813 buffers = (GLuint *) (_buffersBase + _bufferOffset);
814 }
Jack Palevich27f80022009-04-15 19:13:17 -0700815 glDeleteBuffers(
816 (GLsizei)n,
817 (GLuint *)buffers
818 );
819
820exit:
821 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700822 _env->ReleaseIntArrayElements(_array, (jint*)buffers, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -0700823 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700824 if (_exception) {
825 jniThrowException(_env, _exceptionType, _exceptionMessage);
826 }
Jack Palevich27f80022009-04-15 19:13:17 -0700827}
828
829/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */
830static void
831android_glDrawElements__IIII
832 (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700833 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800834 const char * _exceptionType = NULL;
835 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700836 glDrawElements(
837 (GLenum)mode,
838 (GLsizei)count,
839 (GLenum)type,
Ashok Bhat01c26ea2014-02-24 09:49:07 +0000840 reinterpret_cast<GLvoid *>(offset)
Jack Palevich27f80022009-04-15 19:13:17 -0700841 );
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700842 if (_exception) {
843 jniThrowException(_env, _exceptionType, _exceptionMessage);
844 }
Jack Palevich27f80022009-04-15 19:13:17 -0700845}
846
847/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
848static void
849android_glGenBuffers__I_3II
850 (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
851 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800852 const char * _exceptionType = NULL;
853 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700854 GLuint *buffers_base = (GLuint *) 0;
855 jint _remaining;
856 GLuint *buffers = (GLuint *) 0;
857
858 if (!buffers_ref) {
859 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700860 _exceptionType = "java/lang/IllegalArgumentException";
861 _exceptionMessage = "buffers == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700862 goto exit;
863 }
864 if (offset < 0) {
865 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700866 _exceptionType = "java/lang/IllegalArgumentException";
867 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700868 goto exit;
869 }
870 _remaining = _env->GetArrayLength(buffers_ref) - offset;
871 if (_remaining < n) {
872 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700873 _exceptionType = "java/lang/IllegalArgumentException";
874 _exceptionMessage = "length - offset < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700875 goto exit;
876 }
877 buffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700878 _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -0700879 buffers = buffers_base + offset;
880
881 glGenBuffers(
882 (GLsizei)n,
883 (GLuint *)buffers
884 );
885
886exit:
887 if (buffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700888 _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
Jack Palevich27f80022009-04-15 19:13:17 -0700889 _exception ? JNI_ABORT: 0);
890 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700891 if (_exception) {
892 jniThrowException(_env, _exceptionType, _exceptionMessage);
893 }
Jack Palevich27f80022009-04-15 19:13:17 -0700894}
895
896/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
897static void
898android_glGenBuffers__ILjava_nio_IntBuffer_2
899 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
900 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800901 const char * _exceptionType = NULL;
902 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700903 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700904 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700905 jint _remaining;
906 GLuint *buffers = (GLuint *) 0;
907
Romain Guy84cac202016-12-05 12:26:02 -0800908 if (!buffers_buf) {
909 _exception = 1;
910 _exceptionType = "java/lang/IllegalArgumentException";
911 _exceptionMessage = "buffers == null";
912 goto exit;
913 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700914 buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -0700915 if (_remaining < n) {
916 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700917 _exceptionType = "java/lang/IllegalArgumentException";
918 _exceptionMessage = "remaining() < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700919 goto exit;
920 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700921 if (buffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700922 char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700923 buffers = (GLuint *) (_buffersBase + _bufferOffset);
924 }
Jack Palevich27f80022009-04-15 19:13:17 -0700925 glGenBuffers(
926 (GLsizei)n,
927 (GLuint *)buffers
928 );
929
930exit:
931 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700932 _env->ReleaseIntArrayElements(_array, (jint*)buffers, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -0700933 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700934 if (_exception) {
935 jniThrowException(_env, _exceptionType, _exceptionMessage);
936 }
Jack Palevich27f80022009-04-15 19:13:17 -0700937}
938
939/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
940static void
941android_glGetBooleanv__I_3ZI
942 (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700943 get<jbooleanArray, BooleanArrayGetter, jboolean*, BooleanArrayReleaser, GLboolean, glGetBooleanv>(
944 _env, _this, pname, params_ref, offset);
Jack Palevich27f80022009-04-15 19:13:17 -0700945}
946
947/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
948static void
949android_glGetBooleanv__ILjava_nio_IntBuffer_2
950 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700951 getarray<GLboolean, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetBooleanv>(
952 _env, _this, pname, params_buf);
Jack Palevich27f80022009-04-15 19:13:17 -0700953}
Jack Palevich27f80022009-04-15 19:13:17 -0700954/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
955static void
956android_glGetBufferParameteriv__II_3II
957 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Jack Palevich73108672011-03-28 14:49:12 -0700958 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800959 const char * _exceptionType = NULL;
960 const char * _exceptionMessage = NULL;
Jack Palevich73108672011-03-28 14:49:12 -0700961 GLint *params_base = (GLint *) 0;
962 jint _remaining;
963 GLint *params = (GLint *) 0;
964
965 if (!params_ref) {
966 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700967 _exceptionType = "java/lang/IllegalArgumentException";
968 _exceptionMessage = "params == null";
Jack Palevich73108672011-03-28 14:49:12 -0700969 goto exit;
970 }
971 if (offset < 0) {
972 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700973 _exceptionType = "java/lang/IllegalArgumentException";
974 _exceptionMessage = "offset < 0";
Jack Palevich73108672011-03-28 14:49:12 -0700975 goto exit;
976 }
977 _remaining = _env->GetArrayLength(params_ref) - offset;
978 if (_remaining < 1) {
979 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700980 _exceptionType = "java/lang/IllegalArgumentException";
981 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich73108672011-03-28 14:49:12 -0700982 goto exit;
983 }
984 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700985 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich73108672011-03-28 14:49:12 -0700986 params = params_base + offset;
987
988 glGetBufferParameteriv(
989 (GLenum)target,
990 (GLenum)pname,
991 (GLint *)params
992 );
993
994exit:
995 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700996 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich73108672011-03-28 14:49:12 -0700997 _exception ? JNI_ABORT: 0);
998 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700999 if (_exception) {
1000 jniThrowException(_env, _exceptionType, _exceptionMessage);
1001 }
Jack Palevich27f80022009-04-15 19:13:17 -07001002}
1003
1004/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
1005static void
1006android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
1007 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Jack Palevich73108672011-03-28 14:49:12 -07001008 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001009 const char * _exceptionType = NULL;
1010 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001011 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001012 jint _bufferOffset = (jint) 0;
Jack Palevich73108672011-03-28 14:49:12 -07001013 jint _remaining;
1014 GLint *params = (GLint *) 0;
1015
Romain Guy84cac202016-12-05 12:26:02 -08001016 if (!params_buf) {
1017 _exception = 1;
1018 _exceptionType = "java/lang/IllegalArgumentException";
1019 _exceptionMessage = "params == null";
1020 goto exit;
1021 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001022 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich73108672011-03-28 14:49:12 -07001023 if (_remaining < 1) {
1024 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001025 _exceptionType = "java/lang/IllegalArgumentException";
1026 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich73108672011-03-28 14:49:12 -07001027 goto exit;
1028 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001029 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001030 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001031 params = (GLint *) (_paramsBase + _bufferOffset);
1032 }
Jack Palevich73108672011-03-28 14:49:12 -07001033 glGetBufferParameteriv(
1034 (GLenum)target,
1035 (GLenum)pname,
1036 (GLint *)params
1037 );
1038
1039exit:
1040 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001041 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich73108672011-03-28 14:49:12 -07001042 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001043 if (_exception) {
1044 jniThrowException(_env, _exceptionType, _exceptionMessage);
1045 }
Jack Palevich27f80022009-04-15 19:13:17 -07001046}
1047
1048/* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */
1049static void
1050android_glGetClipPlanef__I_3FI
1051 (JNIEnv *_env, jobject _this, jint pname, jfloatArray eqn_ref, jint offset) {
1052 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001053 const char * _exceptionType = NULL;
1054 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001055 GLfloat *eqn_base = (GLfloat *) 0;
1056 jint _remaining;
1057 GLfloat *eqn = (GLfloat *) 0;
1058
1059 if (!eqn_ref) {
1060 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001061 _exceptionType = "java/lang/IllegalArgumentException";
1062 _exceptionMessage = "eqn == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001063 goto exit;
1064 }
1065 if (offset < 0) {
1066 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001067 _exceptionType = "java/lang/IllegalArgumentException";
1068 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001069 goto exit;
1070 }
1071 _remaining = _env->GetArrayLength(eqn_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001072 if (_remaining < 4) {
1073 _exception = 1;
1074 _exceptionType = "java/lang/IllegalArgumentException";
1075 _exceptionMessage = "length - offset < 4 < needed";
1076 goto exit;
1077 }
Jack Palevich27f80022009-04-15 19:13:17 -07001078 eqn_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001079 _env->GetFloatArrayElements(eqn_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001080 eqn = eqn_base + offset;
1081
1082 glGetClipPlanef(
1083 (GLenum)pname,
1084 (GLfloat *)eqn
1085 );
1086
1087exit:
1088 if (eqn_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001089 _env->ReleaseFloatArrayElements(eqn_ref, (jfloat*)eqn_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001090 _exception ? JNI_ABORT: 0);
1091 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001092 if (_exception) {
1093 jniThrowException(_env, _exceptionType, _exceptionMessage);
1094 }
Jack Palevich27f80022009-04-15 19:13:17 -07001095}
1096
1097/* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */
1098static void
1099android_glGetClipPlanef__ILjava_nio_FloatBuffer_2
1100 (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001101 jint _exception = 0;
1102 const char * _exceptionType = NULL;
1103 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001104 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001105 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001106 jint _remaining;
1107 GLfloat *eqn = (GLfloat *) 0;
1108
Romain Guy84cac202016-12-05 12:26:02 -08001109 if (!eqn_buf) {
1110 _exception = 1;
1111 _exceptionType = "java/lang/IllegalArgumentException";
1112 _exceptionMessage = "eqn == null";
1113 goto exit;
1114 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001115 eqn = (GLfloat *)getPointer(_env, eqn_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001116 if (_remaining < 4) {
1117 _exception = 1;
1118 _exceptionType = "java/lang/IllegalArgumentException";
1119 _exceptionMessage = "remaining() < 4 < needed";
1120 goto exit;
1121 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001122 if (eqn == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001123 char * _eqnBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001124 eqn = (GLfloat *) (_eqnBase + _bufferOffset);
1125 }
Jack Palevich27f80022009-04-15 19:13:17 -07001126 glGetClipPlanef(
1127 (GLenum)pname,
1128 (GLfloat *)eqn
1129 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08001130
1131exit:
Jack Palevich27f80022009-04-15 19:13:17 -07001132 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001133 _env->ReleaseFloatArrayElements(_array, (jfloat*)eqn, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001134 }
1135 if (_exception) {
1136 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich27f80022009-04-15 19:13:17 -07001137 }
1138}
1139
1140/* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */
1141static void
1142android_glGetClipPlanex__I_3II
1143 (JNIEnv *_env, jobject _this, jint pname, jintArray eqn_ref, jint offset) {
1144 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001145 const char * _exceptionType = NULL;
1146 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001147 GLfixed *eqn_base = (GLfixed *) 0;
1148 jint _remaining;
1149 GLfixed *eqn = (GLfixed *) 0;
1150
1151 if (!eqn_ref) {
1152 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001153 _exceptionType = "java/lang/IllegalArgumentException";
1154 _exceptionMessage = "eqn == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001155 goto exit;
1156 }
1157 if (offset < 0) {
1158 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001159 _exceptionType = "java/lang/IllegalArgumentException";
1160 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001161 goto exit;
1162 }
1163 _remaining = _env->GetArrayLength(eqn_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001164 if (_remaining < 4) {
1165 _exception = 1;
1166 _exceptionType = "java/lang/IllegalArgumentException";
1167 _exceptionMessage = "length - offset < 4 < needed";
1168 goto exit;
1169 }
Jack Palevich27f80022009-04-15 19:13:17 -07001170 eqn_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001171 _env->GetIntArrayElements(eqn_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001172 eqn = eqn_base + offset;
1173
1174 glGetClipPlanex(
1175 (GLenum)pname,
1176 (GLfixed *)eqn
1177 );
1178
1179exit:
1180 if (eqn_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001181 _env->ReleaseIntArrayElements(eqn_ref, (jint*)eqn_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001182 _exception ? JNI_ABORT: 0);
1183 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001184 if (_exception) {
1185 jniThrowException(_env, _exceptionType, _exceptionMessage);
1186 }
Jack Palevich27f80022009-04-15 19:13:17 -07001187}
1188
1189/* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */
1190static void
1191android_glGetClipPlanex__ILjava_nio_IntBuffer_2
1192 (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001193 jint _exception = 0;
1194 const char * _exceptionType = NULL;
1195 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001196 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001197 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001198 jint _remaining;
1199 GLfixed *eqn = (GLfixed *) 0;
1200
Romain Guy84cac202016-12-05 12:26:02 -08001201 if (!eqn_buf) {
1202 _exception = 1;
1203 _exceptionType = "java/lang/IllegalArgumentException";
1204 _exceptionMessage = "eqn == null";
1205 goto exit;
1206 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001207 eqn = (GLfixed *)getPointer(_env, eqn_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001208 if (_remaining < 4) {
1209 _exception = 1;
1210 _exceptionType = "java/lang/IllegalArgumentException";
1211 _exceptionMessage = "remaining() < 4 < needed";
1212 goto exit;
1213 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001214 if (eqn == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001215 char * _eqnBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001216 eqn = (GLfixed *) (_eqnBase + _bufferOffset);
1217 }
Jack Palevich27f80022009-04-15 19:13:17 -07001218 glGetClipPlanex(
1219 (GLenum)pname,
1220 (GLfixed *)eqn
1221 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08001222
1223exit:
Jack Palevich27f80022009-04-15 19:13:17 -07001224 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001225 _env->ReleaseIntArrayElements(_array, (jint*)eqn, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001226 }
1227 if (_exception) {
1228 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich27f80022009-04-15 19:13:17 -07001229 }
1230}
1231
1232/* void glGetFixedv ( GLenum pname, GLfixed *params ) */
1233static void
1234android_glGetFixedv__I_3II
1235 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
1236 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001237 const char * _exceptionType = NULL;
1238 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001239 GLfixed *params_base = (GLfixed *) 0;
1240 jint _remaining;
1241 GLfixed *params = (GLfixed *) 0;
1242
1243 if (!params_ref) {
1244 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001245 _exceptionType = "java/lang/IllegalArgumentException";
1246 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001247 goto exit;
1248 }
1249 if (offset < 0) {
1250 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001251 _exceptionType = "java/lang/IllegalArgumentException";
1252 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001253 goto exit;
1254 }
1255 _remaining = _env->GetArrayLength(params_ref) - offset;
1256 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001257 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001258 params = params_base + offset;
1259
1260 glGetFixedv(
1261 (GLenum)pname,
1262 (GLfixed *)params
1263 );
1264
1265exit:
1266 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001267 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001268 _exception ? JNI_ABORT: 0);
1269 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001270 if (_exception) {
1271 jniThrowException(_env, _exceptionType, _exceptionMessage);
1272 }
Jack Palevich27f80022009-04-15 19:13:17 -07001273}
1274
1275/* void glGetFixedv ( GLenum pname, GLfixed *params ) */
1276static void
1277android_glGetFixedv__ILjava_nio_IntBuffer_2
1278 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Romain Guy84cac202016-12-05 12:26:02 -08001279 jint _exception = 0;
1280 const char * _exceptionType = NULL;
1281 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001282 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001283 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001284 jint _remaining;
1285 GLfixed *params = (GLfixed *) 0;
1286
Romain Guy84cac202016-12-05 12:26:02 -08001287 if (!params_buf) {
1288 _exception = 1;
1289 _exceptionType = "java/lang/IllegalArgumentException";
1290 _exceptionMessage = "params == null";
1291 goto exit;
1292 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001293 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001294 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001295 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001296 params = (GLfixed *) (_paramsBase + _bufferOffset);
1297 }
Jack Palevich27f80022009-04-15 19:13:17 -07001298 glGetFixedv(
1299 (GLenum)pname,
1300 (GLfixed *)params
1301 );
Romain Guy84cac202016-12-05 12:26:02 -08001302
1303exit:
Jack Palevich27f80022009-04-15 19:13:17 -07001304 if (_array) {
Romain Guy84cac202016-12-05 12:26:02 -08001305 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
1306 }
1307 if (_exception) {
1308 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich27f80022009-04-15 19:13:17 -07001309 }
1310}
1311
1312/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
1313static void
1314android_glGetFloatv__I_3FI
1315 (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001316 get<jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, GLfloat, glGetFloatv>(
1317 _env, _this, pname, params_ref, offset);
Jack Palevich27f80022009-04-15 19:13:17 -07001318}
1319
1320/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
1321static void
1322android_glGetFloatv__ILjava_nio_FloatBuffer_2
1323 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001324 getarray<GLfloat, jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, glGetFloatv>(
1325 _env, _this, pname, params_buf);
Jack Palevich27f80022009-04-15 19:13:17 -07001326}
Jack Palevich27f80022009-04-15 19:13:17 -07001327/* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */
1328static void
1329android_glGetLightfv__II_3FI
1330 (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) {
1331 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001332 const char * _exceptionType = NULL;
1333 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001334 GLfloat *params_base = (GLfloat *) 0;
1335 jint _remaining;
1336 GLfloat *params = (GLfloat *) 0;
1337
1338 if (!params_ref) {
1339 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001340 _exceptionType = "java/lang/IllegalArgumentException";
1341 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001342 goto exit;
1343 }
1344 if (offset < 0) {
1345 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001346 _exceptionType = "java/lang/IllegalArgumentException";
1347 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001348 goto exit;
1349 }
1350 _remaining = _env->GetArrayLength(params_ref) - offset;
1351 int _needed;
1352 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001353#if defined(GL_SPOT_DIRECTION)
1354 case GL_SPOT_DIRECTION:
1355#endif // defined(GL_SPOT_DIRECTION)
1356 _needed = 3;
1357 break;
1358#if defined(GL_AMBIENT)
1359 case GL_AMBIENT:
1360#endif // defined(GL_AMBIENT)
1361#if defined(GL_DIFFUSE)
1362 case GL_DIFFUSE:
1363#endif // defined(GL_DIFFUSE)
1364#if defined(GL_SPECULAR)
1365 case GL_SPECULAR:
1366#endif // defined(GL_SPECULAR)
1367#if defined(GL_EMISSION)
1368 case GL_EMISSION:
1369#endif // defined(GL_EMISSION)
1370 _needed = 4;
1371 break;
1372 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001373 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001374 break;
1375 }
1376 if (_remaining < _needed) {
1377 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001378 _exceptionType = "java/lang/IllegalArgumentException";
1379 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001380 goto exit;
1381 }
1382 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001383 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001384 params = params_base + offset;
1385
1386 glGetLightfv(
1387 (GLenum)light,
1388 (GLenum)pname,
1389 (GLfloat *)params
1390 );
1391
1392exit:
1393 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001394 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001395 _exception ? JNI_ABORT: 0);
1396 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001397 if (_exception) {
1398 jniThrowException(_env, _exceptionType, _exceptionMessage);
1399 }
Jack Palevich27f80022009-04-15 19:13:17 -07001400}
1401
1402/* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */
1403static void
1404android_glGetLightfv__IILjava_nio_FloatBuffer_2
1405 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
1406 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001407 const char * _exceptionType = NULL;
1408 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001409 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001410 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001411 jint _remaining;
1412 GLfloat *params = (GLfloat *) 0;
1413
Romain Guy84cac202016-12-05 12:26:02 -08001414 if (!params_buf) {
1415 _exception = 1;
1416 _exceptionType = "java/lang/IllegalArgumentException";
1417 _exceptionMessage = "params == null";
1418 goto exit;
1419 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001420 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001421 int _needed;
1422 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001423#if defined(GL_SPOT_DIRECTION)
1424 case GL_SPOT_DIRECTION:
1425#endif // defined(GL_SPOT_DIRECTION)
1426 _needed = 3;
1427 break;
1428#if defined(GL_AMBIENT)
1429 case GL_AMBIENT:
1430#endif // defined(GL_AMBIENT)
1431#if defined(GL_DIFFUSE)
1432 case GL_DIFFUSE:
1433#endif // defined(GL_DIFFUSE)
1434#if defined(GL_SPECULAR)
1435 case GL_SPECULAR:
1436#endif // defined(GL_SPECULAR)
1437#if defined(GL_EMISSION)
1438 case GL_EMISSION:
1439#endif // defined(GL_EMISSION)
1440 _needed = 4;
1441 break;
1442 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001443 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001444 break;
1445 }
1446 if (_remaining < _needed) {
1447 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001448 _exceptionType = "java/lang/IllegalArgumentException";
1449 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001450 goto exit;
1451 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001452 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001453 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001454 params = (GLfloat *) (_paramsBase + _bufferOffset);
1455 }
Jack Palevich27f80022009-04-15 19:13:17 -07001456 glGetLightfv(
1457 (GLenum)light,
1458 (GLenum)pname,
1459 (GLfloat *)params
1460 );
1461
1462exit:
1463 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001464 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07001465 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001466 if (_exception) {
1467 jniThrowException(_env, _exceptionType, _exceptionMessage);
1468 }
Jack Palevich27f80022009-04-15 19:13:17 -07001469}
1470
1471/* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */
1472static void
1473android_glGetLightxv__II_3II
1474 (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) {
1475 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001476 const char * _exceptionType = NULL;
1477 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001478 GLfixed *params_base = (GLfixed *) 0;
1479 jint _remaining;
1480 GLfixed *params = (GLfixed *) 0;
1481
1482 if (!params_ref) {
1483 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001484 _exceptionType = "java/lang/IllegalArgumentException";
1485 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001486 goto exit;
1487 }
1488 if (offset < 0) {
1489 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001490 _exceptionType = "java/lang/IllegalArgumentException";
1491 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001492 goto exit;
1493 }
1494 _remaining = _env->GetArrayLength(params_ref) - offset;
1495 int _needed;
1496 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001497#if defined(GL_SPOT_DIRECTION)
1498 case GL_SPOT_DIRECTION:
1499#endif // defined(GL_SPOT_DIRECTION)
1500 _needed = 3;
1501 break;
1502#if defined(GL_AMBIENT)
1503 case GL_AMBIENT:
1504#endif // defined(GL_AMBIENT)
1505#if defined(GL_DIFFUSE)
1506 case GL_DIFFUSE:
1507#endif // defined(GL_DIFFUSE)
1508#if defined(GL_SPECULAR)
1509 case GL_SPECULAR:
1510#endif // defined(GL_SPECULAR)
1511#if defined(GL_EMISSION)
1512 case GL_EMISSION:
1513#endif // defined(GL_EMISSION)
1514 _needed = 4;
1515 break;
1516 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001517 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001518 break;
1519 }
1520 if (_remaining < _needed) {
1521 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001522 _exceptionType = "java/lang/IllegalArgumentException";
1523 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001524 goto exit;
1525 }
1526 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001527 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001528 params = params_base + offset;
1529
1530 glGetLightxv(
1531 (GLenum)light,
1532 (GLenum)pname,
1533 (GLfixed *)params
1534 );
1535
1536exit:
1537 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001538 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001539 _exception ? JNI_ABORT: 0);
1540 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001541 if (_exception) {
1542 jniThrowException(_env, _exceptionType, _exceptionMessage);
1543 }
Jack Palevich27f80022009-04-15 19:13:17 -07001544}
1545
1546/* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */
1547static void
1548android_glGetLightxv__IILjava_nio_IntBuffer_2
1549 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
1550 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001551 const char * _exceptionType = NULL;
1552 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001553 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001554 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001555 jint _remaining;
1556 GLfixed *params = (GLfixed *) 0;
1557
Romain Guy84cac202016-12-05 12:26:02 -08001558 if (!params_buf) {
1559 _exception = 1;
1560 _exceptionType = "java/lang/IllegalArgumentException";
1561 _exceptionMessage = "params == null";
1562 goto exit;
1563 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001564 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001565 int _needed;
1566 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001567#if defined(GL_SPOT_DIRECTION)
1568 case GL_SPOT_DIRECTION:
1569#endif // defined(GL_SPOT_DIRECTION)
1570 _needed = 3;
1571 break;
1572#if defined(GL_AMBIENT)
1573 case GL_AMBIENT:
1574#endif // defined(GL_AMBIENT)
1575#if defined(GL_DIFFUSE)
1576 case GL_DIFFUSE:
1577#endif // defined(GL_DIFFUSE)
1578#if defined(GL_SPECULAR)
1579 case GL_SPECULAR:
1580#endif // defined(GL_SPECULAR)
1581#if defined(GL_EMISSION)
1582 case GL_EMISSION:
1583#endif // defined(GL_EMISSION)
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) {
1591 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001592 _exceptionType = "java/lang/IllegalArgumentException";
1593 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001594 goto exit;
1595 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001596 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001597 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001598 params = (GLfixed *) (_paramsBase + _bufferOffset);
1599 }
Jack Palevich27f80022009-04-15 19:13:17 -07001600 glGetLightxv(
1601 (GLenum)light,
1602 (GLenum)pname,
1603 (GLfixed *)params
1604 );
1605
1606exit:
1607 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001608 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07001609 }
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 glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */
1616static void
1617android_glGetMaterialfv__II_3FI
1618 (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) {
1619 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001620 const char * _exceptionType = NULL;
1621 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001622 GLfloat *params_base = (GLfloat *) 0;
1623 jint _remaining;
1624 GLfloat *params = (GLfloat *) 0;
1625
1626 if (!params_ref) {
1627 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001628 _exceptionType = "java/lang/IllegalArgumentException";
1629 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001630 goto exit;
1631 }
1632 if (offset < 0) {
1633 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001634 _exceptionType = "java/lang/IllegalArgumentException";
1635 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001636 goto exit;
1637 }
1638 _remaining = _env->GetArrayLength(params_ref) - offset;
1639 int _needed;
1640 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001641#if defined(GL_AMBIENT)
1642 case GL_AMBIENT:
1643#endif // defined(GL_AMBIENT)
1644#if defined(GL_DIFFUSE)
1645 case GL_DIFFUSE:
1646#endif // defined(GL_DIFFUSE)
1647#if defined(GL_SPECULAR)
1648 case GL_SPECULAR:
1649#endif // defined(GL_SPECULAR)
1650#if defined(GL_EMISSION)
1651 case GL_EMISSION:
1652#endif // defined(GL_EMISSION)
1653#if defined(GL_AMBIENT_AND_DIFFUSE)
1654 case GL_AMBIENT_AND_DIFFUSE:
1655#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1656 _needed = 4;
1657 break;
1658 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001659 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001660 break;
1661 }
1662 if (_remaining < _needed) {
1663 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001664 _exceptionType = "java/lang/IllegalArgumentException";
1665 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001666 goto exit;
1667 }
1668 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001669 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001670 params = params_base + offset;
1671
1672 glGetMaterialfv(
1673 (GLenum)face,
1674 (GLenum)pname,
1675 (GLfloat *)params
1676 );
1677
1678exit:
1679 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001680 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001681 _exception ? JNI_ABORT: 0);
1682 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001683 if (_exception) {
1684 jniThrowException(_env, _exceptionType, _exceptionMessage);
1685 }
Jack Palevich27f80022009-04-15 19:13:17 -07001686}
1687
1688/* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */
1689static void
1690android_glGetMaterialfv__IILjava_nio_FloatBuffer_2
1691 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
1692 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001693 const char * _exceptionType = NULL;
1694 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001695 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001696 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001697 jint _remaining;
1698 GLfloat *params = (GLfloat *) 0;
1699
Romain Guy84cac202016-12-05 12:26:02 -08001700 if (!params_buf) {
1701 _exception = 1;
1702 _exceptionType = "java/lang/IllegalArgumentException";
1703 _exceptionMessage = "params == null";
1704 goto exit;
1705 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001706 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001707 int _needed;
1708 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001709#if defined(GL_AMBIENT)
1710 case GL_AMBIENT:
1711#endif // defined(GL_AMBIENT)
1712#if defined(GL_DIFFUSE)
1713 case GL_DIFFUSE:
1714#endif // defined(GL_DIFFUSE)
1715#if defined(GL_SPECULAR)
1716 case GL_SPECULAR:
1717#endif // defined(GL_SPECULAR)
1718#if defined(GL_EMISSION)
1719 case GL_EMISSION:
1720#endif // defined(GL_EMISSION)
1721#if defined(GL_AMBIENT_AND_DIFFUSE)
1722 case GL_AMBIENT_AND_DIFFUSE:
1723#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1724 _needed = 4;
1725 break;
1726 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001727 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001728 break;
1729 }
1730 if (_remaining < _needed) {
1731 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001732 _exceptionType = "java/lang/IllegalArgumentException";
1733 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001734 goto exit;
1735 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001736 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001737 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001738 params = (GLfloat *) (_paramsBase + _bufferOffset);
1739 }
Jack Palevich27f80022009-04-15 19:13:17 -07001740 glGetMaterialfv(
1741 (GLenum)face,
1742 (GLenum)pname,
1743 (GLfloat *)params
1744 );
1745
1746exit:
1747 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001748 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07001749 }
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 glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */
1756static void
1757android_glGetMaterialxv__II_3II
1758 (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) {
1759 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001760 const char * _exceptionType = NULL;
1761 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001762 GLfixed *params_base = (GLfixed *) 0;
1763 jint _remaining;
1764 GLfixed *params = (GLfixed *) 0;
1765
1766 if (!params_ref) {
1767 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001768 _exceptionType = "java/lang/IllegalArgumentException";
1769 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001770 goto exit;
1771 }
1772 if (offset < 0) {
1773 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001774 _exceptionType = "java/lang/IllegalArgumentException";
1775 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001776 goto exit;
1777 }
1778 _remaining = _env->GetArrayLength(params_ref) - offset;
1779 int _needed;
1780 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001781#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#if defined(GL_AMBIENT_AND_DIFFUSE)
1794 case GL_AMBIENT_AND_DIFFUSE:
1795#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1796 _needed = 4;
1797 break;
1798 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001799 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001800 break;
1801 }
1802 if (_remaining < _needed) {
1803 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001804 _exceptionType = "java/lang/IllegalArgumentException";
1805 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001806 goto exit;
1807 }
1808 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001809 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001810 params = params_base + offset;
1811
1812 glGetMaterialxv(
1813 (GLenum)face,
1814 (GLenum)pname,
1815 (GLfixed *)params
1816 );
1817
1818exit:
1819 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001820 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001821 _exception ? JNI_ABORT: 0);
1822 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001823 if (_exception) {
1824 jniThrowException(_env, _exceptionType, _exceptionMessage);
1825 }
Jack Palevich27f80022009-04-15 19:13:17 -07001826}
1827
1828/* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */
1829static void
1830android_glGetMaterialxv__IILjava_nio_IntBuffer_2
1831 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
1832 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001833 const char * _exceptionType = NULL;
1834 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001835 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001836 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001837 jint _remaining;
1838 GLfixed *params = (GLfixed *) 0;
1839
Romain Guy84cac202016-12-05 12:26:02 -08001840 if (!params_buf) {
1841 _exception = 1;
1842 _exceptionType = "java/lang/IllegalArgumentException";
1843 _exceptionMessage = "params == null";
1844 goto exit;
1845 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001846 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001847 int _needed;
1848 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001849#if defined(GL_AMBIENT)
1850 case GL_AMBIENT:
1851#endif // defined(GL_AMBIENT)
1852#if defined(GL_DIFFUSE)
1853 case GL_DIFFUSE:
1854#endif // defined(GL_DIFFUSE)
1855#if defined(GL_SPECULAR)
1856 case GL_SPECULAR:
1857#endif // defined(GL_SPECULAR)
1858#if defined(GL_EMISSION)
1859 case GL_EMISSION:
1860#endif // defined(GL_EMISSION)
1861#if defined(GL_AMBIENT_AND_DIFFUSE)
1862 case GL_AMBIENT_AND_DIFFUSE:
1863#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1864 _needed = 4;
1865 break;
1866 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001867 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001868 break;
1869 }
1870 if (_remaining < _needed) {
1871 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001872 _exceptionType = "java/lang/IllegalArgumentException";
1873 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001874 goto exit;
1875 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001876 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001877 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001878 params = (GLfixed *) (_paramsBase + _bufferOffset);
1879 }
Jack Palevich27f80022009-04-15 19:13:17 -07001880 glGetMaterialxv(
1881 (GLenum)face,
1882 (GLenum)pname,
1883 (GLfixed *)params
1884 );
1885
1886exit:
1887 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001888 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07001889 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001890 if (_exception) {
1891 jniThrowException(_env, _exceptionType, _exceptionMessage);
1892 }
Jack Palevich27f80022009-04-15 19:13:17 -07001893}
1894
1895/* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */
1896static void
1897android_glGetTexEnvfv__II_3FI
1898 (JNIEnv *_env, jobject _this, jint env, jint pname, jfloatArray params_ref, jint offset) {
1899 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001900 const char * _exceptionType = NULL;
1901 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001902 GLfloat *params_base = (GLfloat *) 0;
1903 jint _remaining;
1904 GLfloat *params = (GLfloat *) 0;
1905
1906 if (!params_ref) {
1907 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001908 _exceptionType = "java/lang/IllegalArgumentException";
1909 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001910 goto exit;
1911 }
1912 if (offset < 0) {
1913 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001914 _exceptionType = "java/lang/IllegalArgumentException";
1915 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001916 goto exit;
1917 }
1918 _remaining = _env->GetArrayLength(params_ref) - offset;
1919 int _needed;
1920 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001921#if defined(GL_TEXTURE_ENV_COLOR)
1922 case GL_TEXTURE_ENV_COLOR:
1923#endif // defined(GL_TEXTURE_ENV_COLOR)
1924 _needed = 4;
1925 break;
1926 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001927 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001928 break;
1929 }
1930 if (_remaining < _needed) {
1931 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001932 _exceptionType = "java/lang/IllegalArgumentException";
1933 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001934 goto exit;
1935 }
1936 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001937 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001938 params = params_base + offset;
1939
1940 glGetTexEnvfv(
1941 (GLenum)env,
1942 (GLenum)pname,
1943 (GLfloat *)params
1944 );
1945
1946exit:
1947 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001948 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001949 _exception ? JNI_ABORT: 0);
1950 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001951 if (_exception) {
1952 jniThrowException(_env, _exceptionType, _exceptionMessage);
1953 }
Jack Palevich27f80022009-04-15 19:13:17 -07001954}
1955
1956/* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */
1957static void
1958android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2
1959 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
1960 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001961 const char * _exceptionType = NULL;
1962 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001963 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001964 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001965 jint _remaining;
1966 GLfloat *params = (GLfloat *) 0;
1967
Romain Guy84cac202016-12-05 12:26:02 -08001968 if (!params_buf) {
1969 _exception = 1;
1970 _exceptionType = "java/lang/IllegalArgumentException";
1971 _exceptionMessage = "params == null";
1972 goto exit;
1973 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001974 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001975 int _needed;
1976 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001977#if defined(GL_TEXTURE_ENV_COLOR)
1978 case GL_TEXTURE_ENV_COLOR:
1979#endif // defined(GL_TEXTURE_ENV_COLOR)
1980 _needed = 4;
1981 break;
1982 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001983 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001984 break;
1985 }
1986 if (_remaining < _needed) {
1987 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001988 _exceptionType = "java/lang/IllegalArgumentException";
1989 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001990 goto exit;
1991 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001992 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001993 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001994 params = (GLfloat *) (_paramsBase + _bufferOffset);
1995 }
Jack Palevich27f80022009-04-15 19:13:17 -07001996 glGetTexEnvfv(
1997 (GLenum)env,
1998 (GLenum)pname,
1999 (GLfloat *)params
2000 );
2001
2002exit:
2003 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002004 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07002005 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002006 if (_exception) {
2007 jniThrowException(_env, _exceptionType, _exceptionMessage);
2008 }
Jack Palevich27f80022009-04-15 19:13:17 -07002009}
2010
2011/* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */
2012static void
2013android_glGetTexEnviv__II_3II
2014 (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) {
2015 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002016 const char * _exceptionType = NULL;
2017 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002018 GLint *params_base = (GLint *) 0;
2019 jint _remaining;
2020 GLint *params = (GLint *) 0;
2021
2022 if (!params_ref) {
2023 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002024 _exceptionType = "java/lang/IllegalArgumentException";
2025 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002026 goto exit;
2027 }
2028 if (offset < 0) {
2029 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002030 _exceptionType = "java/lang/IllegalArgumentException";
2031 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002032 goto exit;
2033 }
2034 _remaining = _env->GetArrayLength(params_ref) - offset;
2035 int _needed;
2036 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002037#if defined(GL_TEXTURE_ENV_COLOR)
2038 case GL_TEXTURE_ENV_COLOR:
2039#endif // defined(GL_TEXTURE_ENV_COLOR)
2040 _needed = 4;
2041 break;
2042 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002043 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002044 break;
2045 }
2046 if (_remaining < _needed) {
2047 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002048 _exceptionType = "java/lang/IllegalArgumentException";
2049 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002050 goto exit;
2051 }
2052 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002053 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002054 params = params_base + offset;
2055
2056 glGetTexEnviv(
2057 (GLenum)env,
2058 (GLenum)pname,
2059 (GLint *)params
2060 );
2061
2062exit:
2063 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002064 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002065 _exception ? JNI_ABORT: 0);
2066 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002067 if (_exception) {
2068 jniThrowException(_env, _exceptionType, _exceptionMessage);
2069 }
Jack Palevich27f80022009-04-15 19:13:17 -07002070}
2071
2072/* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */
2073static void
2074android_glGetTexEnviv__IILjava_nio_IntBuffer_2
2075 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
2076 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002077 const char * _exceptionType = NULL;
2078 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002079 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002080 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002081 jint _remaining;
2082 GLint *params = (GLint *) 0;
2083
Romain Guy84cac202016-12-05 12:26:02 -08002084 if (!params_buf) {
2085 _exception = 1;
2086 _exceptionType = "java/lang/IllegalArgumentException";
2087 _exceptionMessage = "params == null";
2088 goto exit;
2089 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002090 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002091 int _needed;
2092 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002093#if defined(GL_TEXTURE_ENV_COLOR)
2094 case GL_TEXTURE_ENV_COLOR:
2095#endif // defined(GL_TEXTURE_ENV_COLOR)
2096 _needed = 4;
2097 break;
2098 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002099 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002100 break;
2101 }
2102 if (_remaining < _needed) {
2103 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002104 _exceptionType = "java/lang/IllegalArgumentException";
2105 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002106 goto exit;
2107 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002108 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002109 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002110 params = (GLint *) (_paramsBase + _bufferOffset);
2111 }
Jack Palevich27f80022009-04-15 19:13:17 -07002112 glGetTexEnviv(
2113 (GLenum)env,
2114 (GLenum)pname,
2115 (GLint *)params
2116 );
2117
2118exit:
2119 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002120 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07002121 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002122 if (_exception) {
2123 jniThrowException(_env, _exceptionType, _exceptionMessage);
2124 }
Jack Palevich27f80022009-04-15 19:13:17 -07002125}
2126
2127/* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */
2128static void
2129android_glGetTexEnvxv__II_3II
2130 (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) {
2131 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002132 const char * _exceptionType = NULL;
2133 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002134 GLfixed *params_base = (GLfixed *) 0;
2135 jint _remaining;
2136 GLfixed *params = (GLfixed *) 0;
2137
2138 if (!params_ref) {
2139 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002140 _exceptionType = "java/lang/IllegalArgumentException";
2141 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002142 goto exit;
2143 }
2144 if (offset < 0) {
2145 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002146 _exceptionType = "java/lang/IllegalArgumentException";
2147 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002148 goto exit;
2149 }
2150 _remaining = _env->GetArrayLength(params_ref) - offset;
2151 int _needed;
2152 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002153#if defined(GL_TEXTURE_ENV_COLOR)
2154 case GL_TEXTURE_ENV_COLOR:
2155#endif // defined(GL_TEXTURE_ENV_COLOR)
2156 _needed = 4;
2157 break;
2158 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002159 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002160 break;
2161 }
2162 if (_remaining < _needed) {
2163 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002164 _exceptionType = "java/lang/IllegalArgumentException";
2165 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002166 goto exit;
2167 }
2168 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002169 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002170 params = params_base + offset;
2171
2172 glGetTexEnvxv(
2173 (GLenum)env,
2174 (GLenum)pname,
2175 (GLfixed *)params
2176 );
2177
2178exit:
2179 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002180 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002181 _exception ? JNI_ABORT: 0);
2182 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002183 if (_exception) {
2184 jniThrowException(_env, _exceptionType, _exceptionMessage);
2185 }
Jack Palevich27f80022009-04-15 19:13:17 -07002186}
2187
2188/* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */
2189static void
2190android_glGetTexEnvxv__IILjava_nio_IntBuffer_2
2191 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
2192 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002193 const char * _exceptionType = NULL;
2194 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002195 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002196 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002197 jint _remaining;
2198 GLfixed *params = (GLfixed *) 0;
2199
Romain Guy84cac202016-12-05 12:26:02 -08002200 if (!params_buf) {
2201 _exception = 1;
2202 _exceptionType = "java/lang/IllegalArgumentException";
2203 _exceptionMessage = "params == null";
2204 goto exit;
2205 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002206 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002207 int _needed;
2208 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002209#if defined(GL_TEXTURE_ENV_COLOR)
2210 case GL_TEXTURE_ENV_COLOR:
2211#endif // defined(GL_TEXTURE_ENV_COLOR)
2212 _needed = 4;
2213 break;
2214 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002215 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002216 break;
2217 }
2218 if (_remaining < _needed) {
2219 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002220 _exceptionType = "java/lang/IllegalArgumentException";
2221 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002222 goto exit;
2223 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002224 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002225 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002226 params = (GLfixed *) (_paramsBase + _bufferOffset);
2227 }
Jack Palevich27f80022009-04-15 19:13:17 -07002228 glGetTexEnvxv(
2229 (GLenum)env,
2230 (GLenum)pname,
2231 (GLfixed *)params
2232 );
2233
2234exit:
2235 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002236 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07002237 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002238 if (_exception) {
2239 jniThrowException(_env, _exceptionType, _exceptionMessage);
2240 }
Jack Palevich27f80022009-04-15 19:13:17 -07002241}
2242
2243/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
2244static void
2245android_glGetTexParameterfv__II_3FI
2246 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
2247 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002248 const char * _exceptionType = NULL;
2249 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002250 GLfloat *params_base = (GLfloat *) 0;
2251 jint _remaining;
2252 GLfloat *params = (GLfloat *) 0;
2253
2254 if (!params_ref) {
2255 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002256 _exceptionType = "java/lang/IllegalArgumentException";
2257 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002258 goto exit;
2259 }
2260 if (offset < 0) {
2261 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002262 _exceptionType = "java/lang/IllegalArgumentException";
2263 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002264 goto exit;
2265 }
2266 _remaining = _env->GetArrayLength(params_ref) - offset;
2267 if (_remaining < 1) {
2268 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002269 _exceptionType = "java/lang/IllegalArgumentException";
2270 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002271 goto exit;
2272 }
2273 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002274 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002275 params = params_base + offset;
2276
2277 glGetTexParameterfv(
2278 (GLenum)target,
2279 (GLenum)pname,
2280 (GLfloat *)params
2281 );
2282
2283exit:
2284 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002285 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002286 _exception ? JNI_ABORT: 0);
2287 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002288 if (_exception) {
2289 jniThrowException(_env, _exceptionType, _exceptionMessage);
2290 }
Jack Palevich27f80022009-04-15 19:13:17 -07002291}
2292
2293/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
2294static void
2295android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2
2296 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2297 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002298 const char * _exceptionType = NULL;
2299 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002300 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002301 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002302 jint _remaining;
2303 GLfloat *params = (GLfloat *) 0;
2304
Romain Guy84cac202016-12-05 12:26:02 -08002305 if (!params_buf) {
2306 _exception = 1;
2307 _exceptionType = "java/lang/IllegalArgumentException";
2308 _exceptionMessage = "params == null";
2309 goto exit;
2310 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002311 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002312 if (_remaining < 1) {
2313 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002314 _exceptionType = "java/lang/IllegalArgumentException";
2315 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002316 goto exit;
2317 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002318 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002319 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002320 params = (GLfloat *) (_paramsBase + _bufferOffset);
2321 }
Jack Palevich27f80022009-04-15 19:13:17 -07002322 glGetTexParameterfv(
2323 (GLenum)target,
2324 (GLenum)pname,
2325 (GLfloat *)params
2326 );
2327
2328exit:
2329 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002330 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07002331 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002332 if (_exception) {
2333 jniThrowException(_env, _exceptionType, _exceptionMessage);
2334 }
Jack Palevich27f80022009-04-15 19:13:17 -07002335}
2336
2337/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2338static void
2339android_glGetTexParameteriv__II_3II
2340 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2341 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002342 const char * _exceptionType = NULL;
2343 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002344 GLint *params_base = (GLint *) 0;
2345 jint _remaining;
2346 GLint *params = (GLint *) 0;
2347
2348 if (!params_ref) {
2349 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002350 _exceptionType = "java/lang/IllegalArgumentException";
2351 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002352 goto exit;
2353 }
2354 if (offset < 0) {
2355 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002356 _exceptionType = "java/lang/IllegalArgumentException";
2357 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002358 goto exit;
2359 }
2360 _remaining = _env->GetArrayLength(params_ref) - offset;
2361 if (_remaining < 1) {
2362 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002363 _exceptionType = "java/lang/IllegalArgumentException";
2364 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002365 goto exit;
2366 }
2367 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002368 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002369 params = params_base + offset;
2370
2371 glGetTexParameteriv(
2372 (GLenum)target,
2373 (GLenum)pname,
2374 (GLint *)params
2375 );
2376
2377exit:
2378 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002379 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002380 _exception ? JNI_ABORT: 0);
2381 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002382 if (_exception) {
2383 jniThrowException(_env, _exceptionType, _exceptionMessage);
2384 }
Jack Palevich27f80022009-04-15 19:13:17 -07002385}
2386
2387/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2388static void
2389android_glGetTexParameteriv__IILjava_nio_IntBuffer_2
2390 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2391 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002392 const char * _exceptionType = NULL;
2393 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002394 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002395 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002396 jint _remaining;
2397 GLint *params = (GLint *) 0;
2398
Romain Guy84cac202016-12-05 12:26:02 -08002399 if (!params_buf) {
2400 _exception = 1;
2401 _exceptionType = "java/lang/IllegalArgumentException";
2402 _exceptionMessage = "params == null";
2403 goto exit;
2404 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002405 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002406 if (_remaining < 1) {
2407 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002408 _exceptionType = "java/lang/IllegalArgumentException";
2409 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002410 goto exit;
2411 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002412 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002413 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002414 params = (GLint *) (_paramsBase + _bufferOffset);
2415 }
Jack Palevich27f80022009-04-15 19:13:17 -07002416 glGetTexParameteriv(
2417 (GLenum)target,
2418 (GLenum)pname,
2419 (GLint *)params
2420 );
2421
2422exit:
2423 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002424 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07002425 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002426 if (_exception) {
2427 jniThrowException(_env, _exceptionType, _exceptionMessage);
2428 }
Jack Palevich27f80022009-04-15 19:13:17 -07002429}
2430
2431/* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */
2432static void
2433android_glGetTexParameterxv__II_3II
2434 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2435 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002436 const char * _exceptionType = NULL;
2437 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002438 GLfixed *params_base = (GLfixed *) 0;
2439 jint _remaining;
2440 GLfixed *params = (GLfixed *) 0;
2441
2442 if (!params_ref) {
2443 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002444 _exceptionType = "java/lang/IllegalArgumentException";
2445 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002446 goto exit;
2447 }
2448 if (offset < 0) {
2449 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002450 _exceptionType = "java/lang/IllegalArgumentException";
2451 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002452 goto exit;
2453 }
2454 _remaining = _env->GetArrayLength(params_ref) - offset;
2455 if (_remaining < 1) {
2456 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002457 _exceptionType = "java/lang/IllegalArgumentException";
2458 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002459 goto exit;
2460 }
2461 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002462 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002463 params = params_base + offset;
2464
2465 glGetTexParameterxv(
2466 (GLenum)target,
2467 (GLenum)pname,
2468 (GLfixed *)params
2469 );
2470
2471exit:
2472 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002473 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002474 _exception ? JNI_ABORT: 0);
2475 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002476 if (_exception) {
2477 jniThrowException(_env, _exceptionType, _exceptionMessage);
2478 }
Jack Palevich27f80022009-04-15 19:13:17 -07002479}
2480
2481/* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */
2482static void
2483android_glGetTexParameterxv__IILjava_nio_IntBuffer_2
2484 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2485 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002486 const char * _exceptionType = NULL;
2487 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002488 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002489 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002490 jint _remaining;
2491 GLfixed *params = (GLfixed *) 0;
2492
Romain Guy84cac202016-12-05 12:26:02 -08002493 if (!params_buf) {
2494 _exception = 1;
2495 _exceptionType = "java/lang/IllegalArgumentException";
2496 _exceptionMessage = "params == null";
2497 goto exit;
2498 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002499 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002500 if (_remaining < 1) {
2501 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002502 _exceptionType = "java/lang/IllegalArgumentException";
2503 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002504 goto exit;
2505 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002506 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002507 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002508 params = (GLfixed *) (_paramsBase + _bufferOffset);
2509 }
Jack Palevich27f80022009-04-15 19:13:17 -07002510 glGetTexParameterxv(
2511 (GLenum)target,
2512 (GLenum)pname,
2513 (GLfixed *)params
2514 );
2515
2516exit:
2517 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002518 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07002519 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002520 if (_exception) {
2521 jniThrowException(_env, _exceptionType, _exceptionMessage);
2522 }
Jack Palevich27f80022009-04-15 19:13:17 -07002523}
2524
2525/* GLboolean glIsBuffer ( GLuint buffer ) */
2526static jboolean
2527android_glIsBuffer__I
2528 (JNIEnv *_env, jobject _this, jint buffer) {
2529 GLboolean _returnValue;
2530 _returnValue = glIsBuffer(
2531 (GLuint)buffer
2532 );
Andy McFaddencee51982013-04-25 16:08:31 -07002533 return (jboolean)_returnValue;
Jack Palevich27f80022009-04-15 19:13:17 -07002534}
2535
2536/* GLboolean glIsEnabled ( GLenum cap ) */
2537static jboolean
2538android_glIsEnabled__I
2539 (JNIEnv *_env, jobject _this, jint cap) {
2540 GLboolean _returnValue;
2541 _returnValue = glIsEnabled(
2542 (GLenum)cap
2543 );
Andy McFaddencee51982013-04-25 16:08:31 -07002544 return (jboolean)_returnValue;
Jack Palevich27f80022009-04-15 19:13:17 -07002545}
2546
2547/* GLboolean glIsTexture ( GLuint texture ) */
2548static jboolean
2549android_glIsTexture__I
2550 (JNIEnv *_env, jobject _this, jint texture) {
2551 GLboolean _returnValue;
2552 _returnValue = glIsTexture(
2553 (GLuint)texture
2554 );
Andy McFaddencee51982013-04-25 16:08:31 -07002555 return (jboolean)_returnValue;
Jack Palevich27f80022009-04-15 19:13:17 -07002556}
2557
2558/* void glNormalPointer ( GLenum type, GLsizei stride, GLint offset ) */
2559static void
2560android_glNormalPointer__III
2561 (JNIEnv *_env, jobject _this, jint type, jint stride, jint offset) {
2562 glNormalPointer(
2563 (GLenum)type,
2564 (GLsizei)stride,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00002565 reinterpret_cast<GLvoid *>(offset)
Jack Palevich27f80022009-04-15 19:13:17 -07002566 );
2567}
2568
2569/* void glPointParameterf ( GLenum pname, GLfloat param ) */
2570static void
2571android_glPointParameterf__IF
2572 (JNIEnv *_env, jobject _this, jint pname, jfloat param) {
2573 glPointParameterf(
2574 (GLenum)pname,
2575 (GLfloat)param
2576 );
2577}
2578
2579/* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */
2580static void
2581android_glPointParameterfv__I_3FI
2582 (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002583 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002584 const char * _exceptionType = NULL;
2585 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002586 GLfloat *params_base = (GLfloat *) 0;
2587 jint _remaining;
2588 GLfloat *params = (GLfloat *) 0;
2589
2590 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002591 _exception = 1;
2592 _exceptionType = "java/lang/IllegalArgumentException";
2593 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002594 goto exit;
2595 }
2596 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002597 _exception = 1;
2598 _exceptionType = "java/lang/IllegalArgumentException";
2599 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002600 goto exit;
2601 }
2602 _remaining = _env->GetArrayLength(params_ref) - offset;
2603 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002604 _exception = 1;
2605 _exceptionType = "java/lang/IllegalArgumentException";
2606 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002607 goto exit;
2608 }
2609 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002610 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002611 params = params_base + offset;
2612
2613 glPointParameterfv(
2614 (GLenum)pname,
2615 (GLfloat *)params
2616 );
2617
2618exit:
2619 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002620 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002621 JNI_ABORT);
2622 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002623 if (_exception) {
2624 jniThrowException(_env, _exceptionType, _exceptionMessage);
2625 }
Jack Palevich27f80022009-04-15 19:13:17 -07002626}
2627
2628/* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */
2629static void
2630android_glPointParameterfv__ILjava_nio_FloatBuffer_2
2631 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002632 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002633 const char * _exceptionType = NULL;
2634 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002635 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002636 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002637 jint _remaining;
2638 GLfloat *params = (GLfloat *) 0;
2639
Romain Guy84cac202016-12-05 12:26:02 -08002640 if (!params_buf) {
2641 _exception = 1;
2642 _exceptionType = "java/lang/IllegalArgumentException";
2643 _exceptionMessage = "params == null";
2644 goto exit;
2645 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002646 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002647 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002648 _exception = 1;
2649 _exceptionType = "java/lang/IllegalArgumentException";
2650 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002651 goto exit;
2652 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002653 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002654 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002655 params = (GLfloat *) (_paramsBase + _bufferOffset);
2656 }
Jack Palevich27f80022009-04-15 19:13:17 -07002657 glPointParameterfv(
2658 (GLenum)pname,
2659 (GLfloat *)params
2660 );
2661
2662exit:
2663 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002664 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07002665 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002666 if (_exception) {
2667 jniThrowException(_env, _exceptionType, _exceptionMessage);
2668 }
Jack Palevich27f80022009-04-15 19:13:17 -07002669}
2670
2671/* void glPointParameterx ( GLenum pname, GLfixed param ) */
2672static void
2673android_glPointParameterx__II
2674 (JNIEnv *_env, jobject _this, jint pname, jint param) {
2675 glPointParameterx(
2676 (GLenum)pname,
2677 (GLfixed)param
2678 );
2679}
2680
2681/* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */
2682static void
2683android_glPointParameterxv__I_3II
2684 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002685 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002686 const char * _exceptionType = NULL;
2687 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002688 GLfixed *params_base = (GLfixed *) 0;
2689 jint _remaining;
2690 GLfixed *params = (GLfixed *) 0;
2691
2692 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002693 _exception = 1;
2694 _exceptionType = "java/lang/IllegalArgumentException";
2695 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002696 goto exit;
2697 }
2698 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002699 _exception = 1;
2700 _exceptionType = "java/lang/IllegalArgumentException";
2701 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002702 goto exit;
2703 }
2704 _remaining = _env->GetArrayLength(params_ref) - offset;
2705 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002706 _exception = 1;
2707 _exceptionType = "java/lang/IllegalArgumentException";
2708 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002709 goto exit;
2710 }
2711 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002712 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002713 params = params_base + offset;
2714
2715 glPointParameterxv(
2716 (GLenum)pname,
2717 (GLfixed *)params
2718 );
2719
2720exit:
2721 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002722 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002723 JNI_ABORT);
2724 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002725 if (_exception) {
2726 jniThrowException(_env, _exceptionType, _exceptionMessage);
2727 }
Jack Palevich27f80022009-04-15 19:13:17 -07002728}
2729
2730/* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */
2731static void
2732android_glPointParameterxv__ILjava_nio_IntBuffer_2
2733 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002734 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002735 const char * _exceptionType = NULL;
2736 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002737 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002738 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002739 jint _remaining;
2740 GLfixed *params = (GLfixed *) 0;
2741
Romain Guy84cac202016-12-05 12:26:02 -08002742 if (!params_buf) {
2743 _exception = 1;
2744 _exceptionType = "java/lang/IllegalArgumentException";
2745 _exceptionMessage = "params == null";
2746 goto exit;
2747 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002748 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002749 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002750 _exception = 1;
2751 _exceptionType = "java/lang/IllegalArgumentException";
2752 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002753 goto exit;
2754 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002755 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002756 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002757 params = (GLfixed *) (_paramsBase + _bufferOffset);
2758 }
Jack Palevich27f80022009-04-15 19:13:17 -07002759 glPointParameterxv(
2760 (GLenum)pname,
2761 (GLfixed *)params
2762 );
2763
2764exit:
2765 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002766 _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07002767 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002768 if (_exception) {
2769 jniThrowException(_env, _exceptionType, _exceptionMessage);
2770 }
Jack Palevich27f80022009-04-15 19:13:17 -07002771}
2772
2773/* void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) */
2774static void
Jack Palevichbe6eac82009-12-08 15:43:51 +08002775android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I
2776 (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) {
Romain Guy84cac202016-12-05 12:26:02 -08002777 jint _exception = 0;
2778 const char * _exceptionType = NULL;
2779 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002780 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002781 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002782 jint _remaining;
2783 GLvoid *pointer = (GLvoid *) 0;
2784
Jack Palevichbe6eac82009-12-08 15:43:51 +08002785 if (pointer_buf) {
2786 pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
2787 if ( ! pointer ) {
2788 return;
2789 }
2790 }
2791 glPointSizePointerOESBounds(
Jack Palevich27f80022009-04-15 19:13:17 -07002792 (GLenum)type,
2793 (GLsizei)stride,
Jack Palevichbe6eac82009-12-08 15:43:51 +08002794 (GLvoid *)pointer,
2795 (GLsizei)remaining
Jack Palevich27f80022009-04-15 19:13:17 -07002796 );
Romain Guy84cac202016-12-05 12:26:02 -08002797 if (_exception) {
2798 jniThrowException(_env, _exceptionType, _exceptionMessage);
2799 }
Jack Palevich27f80022009-04-15 19:13:17 -07002800}
2801
2802/* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
2803static void
2804android_glTexCoordPointer__IIII
2805 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
2806 glTexCoordPointer(
2807 (GLint)size,
2808 (GLenum)type,
2809 (GLsizei)stride,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00002810 reinterpret_cast<GLvoid *>(offset)
Jack Palevich27f80022009-04-15 19:13:17 -07002811 );
2812}
2813
2814/* void glTexEnvi ( GLenum target, GLenum pname, GLint param ) */
2815static void
2816android_glTexEnvi__III
2817 (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
2818 glTexEnvi(
2819 (GLenum)target,
2820 (GLenum)pname,
2821 (GLint)param
2822 );
2823}
2824
2825/* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */
2826static void
2827android_glTexEnviv__II_3II
2828 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002829 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002830 const char * _exceptionType = NULL;
2831 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002832 GLint *params_base = (GLint *) 0;
2833 jint _remaining;
2834 GLint *params = (GLint *) 0;
2835
2836 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002837 _exception = 1;
2838 _exceptionType = "java/lang/IllegalArgumentException";
2839 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002840 goto exit;
2841 }
2842 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002843 _exception = 1;
2844 _exceptionType = "java/lang/IllegalArgumentException";
2845 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002846 goto exit;
2847 }
2848 _remaining = _env->GetArrayLength(params_ref) - offset;
2849 int _needed;
2850 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002851#if defined(GL_TEXTURE_ENV_COLOR)
2852 case GL_TEXTURE_ENV_COLOR:
2853#endif // defined(GL_TEXTURE_ENV_COLOR)
2854 _needed = 4;
2855 break;
2856 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002857 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002858 break;
2859 }
2860 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002861 _exception = 1;
2862 _exceptionType = "java/lang/IllegalArgumentException";
2863 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002864 goto exit;
2865 }
2866 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002867 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002868 params = params_base + offset;
2869
2870 glTexEnviv(
2871 (GLenum)target,
2872 (GLenum)pname,
2873 (GLint *)params
2874 );
2875
2876exit:
2877 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002878 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002879 JNI_ABORT);
2880 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002881 if (_exception) {
2882 jniThrowException(_env, _exceptionType, _exceptionMessage);
2883 }
Jack Palevich27f80022009-04-15 19:13:17 -07002884}
2885
2886/* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */
2887static void
2888android_glTexEnviv__IILjava_nio_IntBuffer_2
2889 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002890 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002891 const char * _exceptionType = NULL;
2892 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002893 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002894 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002895 jint _remaining;
2896 GLint *params = (GLint *) 0;
2897
Romain Guy84cac202016-12-05 12:26:02 -08002898 if (!params_buf) {
2899 _exception = 1;
2900 _exceptionType = "java/lang/IllegalArgumentException";
2901 _exceptionMessage = "params == null";
2902 goto exit;
2903 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002904 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002905 int _needed;
2906 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002907#if defined(GL_TEXTURE_ENV_COLOR)
2908 case GL_TEXTURE_ENV_COLOR:
2909#endif // defined(GL_TEXTURE_ENV_COLOR)
2910 _needed = 4;
2911 break;
2912 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002913 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002914 break;
2915 }
2916 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002917 _exception = 1;
2918 _exceptionType = "java/lang/IllegalArgumentException";
2919 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002920 goto exit;
2921 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002922 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002923 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002924 params = (GLint *) (_paramsBase + _bufferOffset);
2925 }
Jack Palevich27f80022009-04-15 19:13:17 -07002926 glTexEnviv(
2927 (GLenum)target,
2928 (GLenum)pname,
2929 (GLint *)params
2930 );
2931
2932exit:
2933 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002934 _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07002935 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002936 if (_exception) {
2937 jniThrowException(_env, _exceptionType, _exceptionMessage);
2938 }
Jack Palevich27f80022009-04-15 19:13:17 -07002939}
2940
2941/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
2942static void
2943android_glTexParameterfv__II_3FI
2944 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002945 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002946 const char * _exceptionType = NULL;
2947 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002948 GLfloat *params_base = (GLfloat *) 0;
2949 jint _remaining;
2950 GLfloat *params = (GLfloat *) 0;
2951
2952 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002953 _exception = 1;
2954 _exceptionType = "java/lang/IllegalArgumentException";
2955 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002956 goto exit;
2957 }
2958 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002959 _exception = 1;
2960 _exceptionType = "java/lang/IllegalArgumentException";
2961 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002962 goto exit;
2963 }
2964 _remaining = _env->GetArrayLength(params_ref) - offset;
2965 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002966 _exception = 1;
2967 _exceptionType = "java/lang/IllegalArgumentException";
2968 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002969 goto exit;
2970 }
2971 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002972 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002973 params = params_base + offset;
2974
2975 glTexParameterfv(
2976 (GLenum)target,
2977 (GLenum)pname,
2978 (GLfloat *)params
2979 );
2980
2981exit:
2982 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002983 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002984 JNI_ABORT);
2985 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002986 if (_exception) {
2987 jniThrowException(_env, _exceptionType, _exceptionMessage);
2988 }
Jack Palevich27f80022009-04-15 19:13:17 -07002989}
2990
2991/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
2992static void
2993android_glTexParameterfv__IILjava_nio_FloatBuffer_2
2994 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002995 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002996 const char * _exceptionType = NULL;
2997 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002998 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002999 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07003000 jint _remaining;
3001 GLfloat *params = (GLfloat *) 0;
3002
Romain Guy84cac202016-12-05 12:26:02 -08003003 if (!params_buf) {
3004 _exception = 1;
3005 _exceptionType = "java/lang/IllegalArgumentException";
3006 _exceptionMessage = "params == null";
3007 goto exit;
3008 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003009 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07003010 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003011 _exception = 1;
3012 _exceptionType = "java/lang/IllegalArgumentException";
3013 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07003014 goto exit;
3015 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003016 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003017 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003018 params = (GLfloat *) (_paramsBase + _bufferOffset);
3019 }
Jack Palevich27f80022009-04-15 19:13:17 -07003020 glTexParameterfv(
3021 (GLenum)target,
3022 (GLenum)pname,
3023 (GLfloat *)params
3024 );
3025
3026exit:
3027 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003028 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07003029 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003030 if (_exception) {
3031 jniThrowException(_env, _exceptionType, _exceptionMessage);
3032 }
Jack Palevich27f80022009-04-15 19:13:17 -07003033}
3034
3035/* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */
3036static void
3037android_glTexParameteri__III
3038 (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
3039 glTexParameteri(
3040 (GLenum)target,
3041 (GLenum)pname,
3042 (GLint)param
3043 );
3044}
3045
3046/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
3047static void
3048android_glTexParameteriv__II_3II
3049 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003050 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003051 const char * _exceptionType = NULL;
3052 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07003053 GLint *params_base = (GLint *) 0;
3054 jint _remaining;
3055 GLint *params = (GLint *) 0;
3056
3057 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003058 _exception = 1;
3059 _exceptionType = "java/lang/IllegalArgumentException";
3060 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07003061 goto exit;
3062 }
3063 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003064 _exception = 1;
3065 _exceptionType = "java/lang/IllegalArgumentException";
3066 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07003067 goto exit;
3068 }
3069 _remaining = _env->GetArrayLength(params_ref) - offset;
3070 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003071 _exception = 1;
3072 _exceptionType = "java/lang/IllegalArgumentException";
3073 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07003074 goto exit;
3075 }
3076 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003077 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07003078 params = params_base + offset;
3079
3080 glTexParameteriv(
3081 (GLenum)target,
3082 (GLenum)pname,
3083 (GLint *)params
3084 );
3085
3086exit:
3087 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003088 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07003089 JNI_ABORT);
3090 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003091 if (_exception) {
3092 jniThrowException(_env, _exceptionType, _exceptionMessage);
3093 }
Jack Palevich27f80022009-04-15 19:13:17 -07003094}
3095
3096/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
3097static void
3098android_glTexParameteriv__IILjava_nio_IntBuffer_2
3099 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003100 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003101 const char * _exceptionType = NULL;
3102 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003103 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003104 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07003105 jint _remaining;
3106 GLint *params = (GLint *) 0;
3107
Romain Guy84cac202016-12-05 12:26:02 -08003108 if (!params_buf) {
3109 _exception = 1;
3110 _exceptionType = "java/lang/IllegalArgumentException";
3111 _exceptionMessage = "params == null";
3112 goto exit;
3113 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003114 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07003115 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003116 _exception = 1;
3117 _exceptionType = "java/lang/IllegalArgumentException";
3118 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07003119 goto exit;
3120 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003121 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003122 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003123 params = (GLint *) (_paramsBase + _bufferOffset);
3124 }
Jack Palevich27f80022009-04-15 19:13:17 -07003125 glTexParameteriv(
3126 (GLenum)target,
3127 (GLenum)pname,
3128 (GLint *)params
3129 );
3130
3131exit:
3132 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003133 _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07003134 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003135 if (_exception) {
3136 jniThrowException(_env, _exceptionType, _exceptionMessage);
3137 }
Jack Palevich27f80022009-04-15 19:13:17 -07003138}
3139
3140/* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */
3141static void
3142android_glTexParameterxv__II_3II
3143 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003144 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003145 const char * _exceptionType = NULL;
3146 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07003147 GLfixed *params_base = (GLfixed *) 0;
3148 jint _remaining;
3149 GLfixed *params = (GLfixed *) 0;
3150
3151 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003152 _exception = 1;
3153 _exceptionType = "java/lang/IllegalArgumentException";
3154 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07003155 goto exit;
3156 }
3157 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003158 _exception = 1;
3159 _exceptionType = "java/lang/IllegalArgumentException";
3160 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07003161 goto exit;
3162 }
3163 _remaining = _env->GetArrayLength(params_ref) - offset;
3164 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003165 _exception = 1;
3166 _exceptionType = "java/lang/IllegalArgumentException";
3167 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07003168 goto exit;
3169 }
3170 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003171 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07003172 params = params_base + offset;
3173
3174 glTexParameterxv(
3175 (GLenum)target,
3176 (GLenum)pname,
3177 (GLfixed *)params
3178 );
3179
3180exit:
3181 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003182 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07003183 JNI_ABORT);
3184 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003185 if (_exception) {
3186 jniThrowException(_env, _exceptionType, _exceptionMessage);
3187 }
Jack Palevich27f80022009-04-15 19:13:17 -07003188}
3189
3190/* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */
3191static void
3192android_glTexParameterxv__IILjava_nio_IntBuffer_2
3193 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003194 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003195 const char * _exceptionType = NULL;
3196 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003197 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003198 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07003199 jint _remaining;
3200 GLfixed *params = (GLfixed *) 0;
3201
Romain Guy84cac202016-12-05 12:26:02 -08003202 if (!params_buf) {
3203 _exception = 1;
3204 _exceptionType = "java/lang/IllegalArgumentException";
3205 _exceptionMessage = "params == null";
3206 goto exit;
3207 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003208 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07003209 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003210 _exception = 1;
3211 _exceptionType = "java/lang/IllegalArgumentException";
3212 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07003213 goto exit;
3214 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003215 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003216 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003217 params = (GLfixed *) (_paramsBase + _bufferOffset);
3218 }
Jack Palevich27f80022009-04-15 19:13:17 -07003219 glTexParameterxv(
3220 (GLenum)target,
3221 (GLenum)pname,
3222 (GLfixed *)params
3223 );
3224
3225exit:
3226 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003227 _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07003228 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003229 if (_exception) {
3230 jniThrowException(_env, _exceptionType, _exceptionMessage);
3231 }
Jack Palevich27f80022009-04-15 19:13:17 -07003232}
3233
3234/* void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
3235static void
3236android_glVertexPointer__IIII
3237 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
3238 glVertexPointer(
3239 (GLint)size,
3240 (GLenum)type,
3241 (GLsizei)stride,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00003242 reinterpret_cast<GLvoid *>(offset)
Jack Palevich27f80022009-04-15 19:13:17 -07003243 );
3244}
3245
3246static const char *classPathName = "android/opengl/GLES11";
3247
Daniel Micay76f6a862015-09-19 17:31:01 -04003248static const JNINativeMethod methods[] = {
Jack Palevich27f80022009-04-15 19:13:17 -07003249{"_nativeClassInit", "()V", (void*)nativeClassInit },
3250{"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II },
3251{"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I },
3252{"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 },
3253{"glClipPlanef", "(I[FI)V", (void *) android_glClipPlanef__I_3FI },
3254{"glClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glClipPlanef__ILjava_nio_FloatBuffer_2 },
3255{"glClipPlanex", "(I[II)V", (void *) android_glClipPlanex__I_3II },
3256{"glClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glClipPlanex__ILjava_nio_IntBuffer_2 },
3257{"glColor4ub", "(BBBB)V", (void *) android_glColor4ub__BBBB },
3258{"glColorPointer", "(IIII)V", (void *) android_glColorPointer__IIII },
3259{"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II },
3260{"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 },
3261{"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII },
3262{"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II },
3263{"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 },
3264{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI },
3265{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 },
3266{"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II },
3267{"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 },
3268{"glGetClipPlanef", "(I[FI)V", (void *) android_glGetClipPlanef__I_3FI },
3269{"glGetClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetClipPlanef__ILjava_nio_FloatBuffer_2 },
3270{"glGetClipPlanex", "(I[II)V", (void *) android_glGetClipPlanex__I_3II },
3271{"glGetClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetClipPlanex__ILjava_nio_IntBuffer_2 },
3272{"glGetFixedv", "(I[II)V", (void *) android_glGetFixedv__I_3II },
3273{"glGetFixedv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetFixedv__ILjava_nio_IntBuffer_2 },
3274{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI },
3275{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 },
3276{"glGetLightfv", "(II[FI)V", (void *) android_glGetLightfv__II_3FI },
3277{"glGetLightfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetLightfv__IILjava_nio_FloatBuffer_2 },
3278{"glGetLightxv", "(II[II)V", (void *) android_glGetLightxv__II_3II },
3279{"glGetLightxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetLightxv__IILjava_nio_IntBuffer_2 },
3280{"glGetMaterialfv", "(II[FI)V", (void *) android_glGetMaterialfv__II_3FI },
3281{"glGetMaterialfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetMaterialfv__IILjava_nio_FloatBuffer_2 },
3282{"glGetMaterialxv", "(II[II)V", (void *) android_glGetMaterialxv__II_3II },
3283{"glGetMaterialxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetMaterialxv__IILjava_nio_IntBuffer_2 },
3284{"glGetTexEnvfv", "(II[FI)V", (void *) android_glGetTexEnvfv__II_3FI },
3285{"glGetTexEnvfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2 },
3286{"glGetTexEnviv", "(II[II)V", (void *) android_glGetTexEnviv__II_3II },
3287{"glGetTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnviv__IILjava_nio_IntBuffer_2 },
3288{"glGetTexEnvxv", "(II[II)V", (void *) android_glGetTexEnvxv__II_3II },
3289{"glGetTexEnvxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnvxv__IILjava_nio_IntBuffer_2 },
3290{"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI },
3291{"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 },
3292{"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II },
3293{"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 },
3294{"glGetTexParameterxv", "(II[II)V", (void *) android_glGetTexParameterxv__II_3II },
3295{"glGetTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameterxv__IILjava_nio_IntBuffer_2 },
3296{"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I },
3297{"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I },
3298{"glIsTexture", "(I)Z", (void *) android_glIsTexture__I },
3299{"glNormalPointer", "(III)V", (void *) android_glNormalPointer__III },
3300{"glPointParameterf", "(IF)V", (void *) android_glPointParameterf__IF },
3301{"glPointParameterfv", "(I[FI)V", (void *) android_glPointParameterfv__I_3FI },
3302{"glPointParameterfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glPointParameterfv__ILjava_nio_FloatBuffer_2 },
3303{"glPointParameterx", "(II)V", (void *) android_glPointParameterx__II },
3304{"glPointParameterxv", "(I[II)V", (void *) android_glPointParameterxv__I_3II },
3305{"glPointParameterxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glPointParameterxv__ILjava_nio_IntBuffer_2 },
Jack Palevichbe6eac82009-12-08 15:43:51 +08003306{"glPointSizePointerOESBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I },
Jack Palevich27f80022009-04-15 19:13:17 -07003307{"glTexCoordPointer", "(IIII)V", (void *) android_glTexCoordPointer__IIII },
3308{"glTexEnvi", "(III)V", (void *) android_glTexEnvi__III },
3309{"glTexEnviv", "(II[II)V", (void *) android_glTexEnviv__II_3II },
3310{"glTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexEnviv__IILjava_nio_IntBuffer_2 },
3311{"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI },
3312{"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 },
3313{"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III },
3314{"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II },
3315{"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 },
3316{"glTexParameterxv", "(II[II)V", (void *) android_glTexParameterxv__II_3II },
3317{"glTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameterxv__IILjava_nio_IntBuffer_2 },
3318{"glVertexPointer", "(IIII)V", (void *) android_glVertexPointer__IIII },
3319};
3320
3321int register_android_opengl_jni_GLES11(JNIEnv *_env)
3322{
3323 int err;
3324 err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
3325 return err;
3326}