blob: 39ef41a0e19e73f03e71ce04e9ff3a329f3330b0 [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
Mathias Agopian2ad04772013-02-23 03:12:30 -080032
33/* special calls implemented in Android's GLES wrapper used to more
34 * efficiently bound-check passed arrays */
35extern "C" {
36#ifdef GL_VERSION_ES_CM_1_1
37GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
38 const GLvoid *ptr, GLsizei count);
39GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
40 const GLvoid *pointer, GLsizei count);
41GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
42 GLsizei stride, const GLvoid *pointer, GLsizei count);
43GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
44 GLsizei stride, const GLvoid *pointer, GLsizei count);
45GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
46 GLsizei stride, const GLvoid *pointer, GLsizei count);
47GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
48 GLsizei stride, const GLvoid *pointer, GLsizei count);
49GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
50 GLsizei stride, const GLvoid *pointer, GLsizei count);
51#endif
52#ifdef GL_ES_VERSION_2_0
53static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type,
54 GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) {
55 glVertexAttribPointer(indx, size, type, normalized, stride, pointer);
56}
57#endif
Andy McFaddencee51982013-04-25 16:08:31 -070058#ifdef GL_ES_VERSION_3_0
59static void glVertexAttribIPointerBounds(GLuint indx, GLint size, GLenum type,
60 GLsizei stride, const GLvoid *pointer, GLsizei count) {
61 glVertexAttribIPointer(indx, size, type, stride, pointer);
62}
63#endif
Mathias Agopian2ad04772013-02-23 03:12:30 -080064}
65
Jack Palevich27f80022009-04-15 19:13:17 -070066static void
Elliott Hughes24ce5fb2011-04-08 20:01:01 -070067nativeClassInit(JNIEnv *_env, jclass glImplClass)
Jack Palevich27f80022009-04-15 19:13:17 -070068{
Jack Palevich27f80022009-04-15 19:13:17 -070069}
70
Jack Palevich27f80022009-04-15 19:13:17 -070071static void *
Thomas Tafertshofer17045a12012-07-12 13:55:55 -070072getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
Jack Palevich27f80022009-04-15 19:13:17 -070073{
74 jint position;
75 jint limit;
76 jint elementSizeShift;
77 jlong pointer;
Jack Palevich27f80022009-04-15 19:13:17 -070078
Orion Hodson02440d32019-02-28 15:15:34 +000079 pointer = jniGetNioBufferFields(_env, buffer, &position, &limit, &elementSizeShift);
Jack Palevich27f80022009-04-15 19:13:17 -070080 *remaining = (limit - position) << elementSizeShift;
Jack Palevich27f80022009-04-15 19:13:17 -070081 if (pointer != 0L) {
Orion Hodson02440d32019-02-28 15:15:34 +000082 *array = nullptr;
83 pointer += position << elementSizeShift;
Ashok Bhat01c26ea2014-02-24 09:49:07 +000084 return reinterpret_cast<void*>(pointer);
Jack Palevich27f80022009-04-15 19:13:17 -070085 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -070086
Orion Hodson02440d32019-02-28 15:15:34 +000087 *array = jniGetNioBufferBaseArray(_env, buffer);
88 *offset = jniGetNioBufferBaseArrayOffset(_env, buffer);
89 return nullptr;
Jack Palevich27f80022009-04-15 19:13:17 -070090}
91
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -070092class ByteArrayGetter {
93public:
94 static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
95 return _env->GetByteArrayElements(array, is_copy);
96 }
97};
98class BooleanArrayGetter {
99public:
100 static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
101 return _env->GetBooleanArrayElements(array, is_copy);
102 }
103};
104class CharArrayGetter {
105public:
106 static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
107 return _env->GetCharArrayElements(array, is_copy);
108 }
109};
110class ShortArrayGetter {
111public:
112 static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
113 return _env->GetShortArrayElements(array, is_copy);
114 }
115};
116class IntArrayGetter {
117public:
118 static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
119 return _env->GetIntArrayElements(array, is_copy);
120 }
121};
122class LongArrayGetter {
123public:
124 static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
125 return _env->GetLongArrayElements(array, is_copy);
126 }
127};
128class FloatArrayGetter {
129public:
130 static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
131 return _env->GetFloatArrayElements(array, is_copy);
132 }
133};
134class DoubleArrayGetter {
135public:
136 static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
137 return _env->GetDoubleArrayElements(array, is_copy);
138 }
139};
140
141template<typename JTYPEARRAY, typename ARRAYGETTER>
142static void*
143getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
144 return ARRAYGETTER::Get(_env, array, is_copy);
145}
146
147class ByteArrayReleaser {
148public:
149 static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
150 _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
151 }
152};
153class BooleanArrayReleaser {
154public:
155 static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
156 _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
157 }
158};
159class CharArrayReleaser {
160public:
161 static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
162 _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
163 }
164};
165class ShortArrayReleaser {
166public:
167 static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
168 _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
169 }
170};
171class IntArrayReleaser {
172public:
173 static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
174 _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
175 }
176};
177class LongArrayReleaser {
178public:
179 static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
180 _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
181 }
182};
183class FloatArrayReleaser {
184public:
185 static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
186 _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
187 }
188};
189class DoubleArrayReleaser {
190public:
191 static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
192 _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
193 }
194};
195
196template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
197static void
198releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
199 ARRAYRELEASER::Release(_env, array, data, commit);
200}
201
Jack Palevich27f80022009-04-15 19:13:17 -0700202static void
203releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
204{
205 _env->ReleasePrimitiveArrayCritical(array, data,
Mathias Agopian2ad04772013-02-23 03:12:30 -0800206 commit ? 0 : JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -0700207}
208
Jack Palevichbe6eac82009-12-08 15:43:51 +0800209static void *
210getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
Orion Hodson02440d32019-02-28 15:15:34 +0000211 jint position;
212 jint limit;
213 jint elementSizeShift;
214 jlong pointer;
215 pointer = jniGetNioBufferFields(_env, buffer, &position, &limit, &elementSizeShift);
216 if (pointer == 0) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700217 jniThrowException(_env, "java/lang/IllegalArgumentException",
218 "Must use a native order direct Buffer");
Orion Hodson02440d32019-02-28 15:15:34 +0000219 return nullptr;
Jack Palevichbe6eac82009-12-08 15:43:51 +0800220 }
Orion Hodson02440d32019-02-28 15:15:34 +0000221 pointer += position << elementSizeShift;
222 return reinterpret_cast<void*>(pointer);
Jack Palevichbe6eac82009-12-08 15:43:51 +0800223}
224
Jack Palevich27f80022009-04-15 19:13:17 -0700225// --------------------------------------------------------------------------
Mathias Agopian2ad04772013-02-23 03:12:30 -0800226
227/*
228 * returns the number of values glGet returns for a given pname.
229 *
230 * The code below is written such that pnames requiring only one values
231 * are the default (and are not explicitely tested for). This makes the
232 * checking code much shorter/readable/efficient.
233 *
234 * This means that unknown pnames (e.g.: extensions) will default to 1. If
235 * that unknown pname needs more than 1 value, then the validation check
236 * is incomplete and the app may crash if it passed the wrong number params.
237 */
238static int getNeededCount(GLint pname) {
239 int needed = 1;
Romain Guydc43a6c2017-02-17 19:54:25 -0800240#ifdef GL_ES_VERSION_3_0
241 // GLES 3.x pnames
242 switch (pname) {
243 case GL_MAX_VIEWPORT_DIMS:
244 needed = 2;
245 break;
246
247 case GL_PROGRAM_BINARY_FORMATS:
248 glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &needed);
249 break;
250 }
251#endif
252
Mathias Agopian2ad04772013-02-23 03:12:30 -0800253#ifdef GL_ES_VERSION_2_0
254 // GLES 2.x pnames
255 switch (pname) {
256 case GL_ALIASED_LINE_WIDTH_RANGE:
257 case GL_ALIASED_POINT_SIZE_RANGE:
258 needed = 2;
259 break;
260
261 case GL_BLEND_COLOR:
262 case GL_COLOR_CLEAR_VALUE:
263 case GL_COLOR_WRITEMASK:
264 case GL_SCISSOR_BOX:
265 case GL_VIEWPORT:
266 needed = 4;
267 break;
268
269 case GL_COMPRESSED_TEXTURE_FORMATS:
270 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
271 break;
272
273 case GL_SHADER_BINARY_FORMATS:
274 glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed);
275 break;
276 }
277#endif
278
279#ifdef GL_VERSION_ES_CM_1_1
280 // GLES 1.x pnames
281 switch (pname) {
282 case GL_ALIASED_LINE_WIDTH_RANGE:
283 case GL_ALIASED_POINT_SIZE_RANGE:
284 case GL_DEPTH_RANGE:
285 case GL_SMOOTH_LINE_WIDTH_RANGE:
286 case GL_SMOOTH_POINT_SIZE_RANGE:
287 needed = 2;
288 break;
289
290 case GL_CURRENT_NORMAL:
291 case GL_POINT_DISTANCE_ATTENUATION:
292 needed = 3;
293 break;
294
295 case GL_COLOR_CLEAR_VALUE:
296 case GL_COLOR_WRITEMASK:
297 case GL_CURRENT_COLOR:
298 case GL_CURRENT_TEXTURE_COORDS:
299 case GL_FOG_COLOR:
300 case GL_LIGHT_MODEL_AMBIENT:
301 case GL_SCISSOR_BOX:
302 case GL_VIEWPORT:
303 needed = 4;
304 break;
305
306 case GL_MODELVIEW_MATRIX:
307 case GL_PROJECTION_MATRIX:
308 case GL_TEXTURE_MATRIX:
309 needed = 16;
310 break;
311
312 case GL_COMPRESSED_TEXTURE_FORMATS:
313 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
314 break;
315 }
316#endif
317 return needed;
318}
319
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700320template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
321 typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
Mathias Agopian2ad04772013-02-23 03:12:30 -0800322static void
323get
324 (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
325 jint _exception = 0;
326 const char * _exceptionType;
327 const char * _exceptionMessage;
328 CTYPE *params_base = (CTYPE *) 0;
329 jint _remaining;
330 CTYPE *params = (CTYPE *) 0;
331 int _needed = 0;
332
333 if (!params_ref) {
334 _exception = 1;
335 _exceptionType = "java/lang/IllegalArgumentException";
336 _exceptionMessage = "params == null";
337 goto exit;
338 }
339 if (offset < 0) {
340 _exception = 1;
341 _exceptionType = "java/lang/IllegalArgumentException";
342 _exceptionMessage = "offset < 0";
343 goto exit;
344 }
345 _remaining = _env->GetArrayLength(params_ref) - offset;
346 _needed = getNeededCount(pname);
347 // if we didn't find this pname, we just assume the user passed
348 // an array of the right size -- this might happen with extensions
349 // or if we forget an enum here.
350 if (_remaining < _needed) {
351 _exception = 1;
352 _exceptionType = "java/lang/IllegalArgumentException";
353 _exceptionMessage = "length - offset < needed";
354 goto exit;
355 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700356 params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
357 _env, params_ref, (jboolean *)0);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800358 params = params_base + offset;
359
360 GET(
361 (GLenum)pname,
362 (CTYPE *)params
363 );
364
365exit:
366 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700367 releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
368 _env, params_ref, params_base, !_exception);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800369 }
370 if (_exception) {
371 jniThrowException(_env, _exceptionType, _exceptionMessage);
372 }
373}
374
375
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700376template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
377 typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
Mathias Agopian2ad04772013-02-23 03:12:30 -0800378static void
379getarray
380 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
381 jint _exception = 0;
382 const char * _exceptionType;
383 const char * _exceptionMessage;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700384 JTYPEARRAY _array = (JTYPEARRAY) 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800385 jint _bufferOffset = (jint) 0;
386 jint _remaining;
387 CTYPE *params = (CTYPE *) 0;
388 int _needed = 0;
389
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700390 params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Andy McFaddencee51982013-04-25 16:08:31 -0700391 _remaining /= sizeof(CTYPE); // convert from bytes to item count
Mathias Agopian2ad04772013-02-23 03:12:30 -0800392 _needed = getNeededCount(pname);
393 // if we didn't find this pname, we just assume the user passed
394 // an array of the right size -- this might happen with extensions
395 // or if we forget an enum here.
396 if (_needed>0 && _remaining < _needed) {
397 _exception = 1;
398 _exceptionType = "java/lang/IllegalArgumentException";
399 _exceptionMessage = "remaining() < needed";
400 goto exit;
401 }
402 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700403 char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
404 _env, _array, (jboolean *) 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800405 params = (CTYPE *) (_paramsBase + _bufferOffset);
406 }
407 GET(
408 (GLenum)pname,
409 (CTYPE *)params
410 );
411
412exit:
413 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700414 releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
415 _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800416 }
417 if (_exception) {
418 jniThrowException(_env, _exceptionType, _exceptionMessage);
419 }
420}
421
422// --------------------------------------------------------------------------
Jack Palevich27f80022009-04-15 19:13:17 -0700423/* void glBindBuffer ( GLenum target, GLuint buffer ) */
424static void
425android_glBindBuffer__II
426 (JNIEnv *_env, jobject _this, jint target, jint buffer) {
427 glBindBuffer(
428 (GLenum)target,
429 (GLuint)buffer
430 );
431}
432
433/* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */
434static void
435android_glBufferData__IILjava_nio_Buffer_2I
436 (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700437 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800438 const char * _exceptionType = NULL;
439 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700440 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700441 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700442 jint _remaining;
443 GLvoid *data = (GLvoid *) 0;
444
445 if (data_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700446 data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevichc620a522009-10-21 11:02:44 -0700447 if (_remaining < size) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700448 _exception = 1;
449 _exceptionType = "java/lang/IllegalArgumentException";
450 _exceptionMessage = "remaining() < size < needed";
Jack Palevichc620a522009-10-21 11:02:44 -0700451 goto exit;
452 }
Jack Palevich27f80022009-04-15 19:13:17 -0700453 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -0700454 if (data_buf && data == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700455 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
456 data = (GLvoid *) (_dataBase + _bufferOffset);
457 }
Jack Palevich27f80022009-04-15 19:13:17 -0700458 glBufferData(
459 (GLenum)target,
460 (GLsizeiptr)size,
461 (GLvoid *)data,
462 (GLenum)usage
463 );
Jack Palevichc620a522009-10-21 11:02:44 -0700464
465exit:
Jack Palevich27f80022009-04-15 19:13:17 -0700466 if (_array) {
467 releasePointer(_env, _array, data, JNI_FALSE);
468 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700469 if (_exception) {
470 jniThrowException(_env, _exceptionType, _exceptionMessage);
471 }
Jack Palevich27f80022009-04-15 19:13:17 -0700472}
473
474/* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */
475static void
476android_glBufferSubData__IIILjava_nio_Buffer_2
477 (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700478 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800479 const char * _exceptionType = NULL;
480 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700481 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700482 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700483 jint _remaining;
484 GLvoid *data = (GLvoid *) 0;
485
Romain Guy84cac202016-12-05 12:26:02 -0800486 if (!data_buf) {
487 _exception = 1;
488 _exceptionType = "java/lang/IllegalArgumentException";
489 _exceptionMessage = "data == null";
490 goto exit;
491 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700492 data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevichc620a522009-10-21 11:02:44 -0700493 if (_remaining < size) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700494 _exception = 1;
495 _exceptionType = "java/lang/IllegalArgumentException";
496 _exceptionMessage = "remaining() < size < needed";
Jack Palevichc620a522009-10-21 11:02:44 -0700497 goto exit;
498 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700499 if (data == NULL) {
500 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
501 data = (GLvoid *) (_dataBase + _bufferOffset);
502 }
Jack Palevich27f80022009-04-15 19:13:17 -0700503 glBufferSubData(
504 (GLenum)target,
505 (GLintptr)offset,
506 (GLsizeiptr)size,
507 (GLvoid *)data
508 );
Jack Palevichc620a522009-10-21 11:02:44 -0700509
510exit:
Jack Palevich27f80022009-04-15 19:13:17 -0700511 if (_array) {
512 releasePointer(_env, _array, data, JNI_FALSE);
513 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700514 if (_exception) {
515 jniThrowException(_env, _exceptionType, _exceptionMessage);
516 }
Jack Palevich27f80022009-04-15 19:13:17 -0700517}
518
519/* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */
520static void
521android_glClipPlanef__I_3FI
522 (JNIEnv *_env, jobject _this, jint plane, jfloatArray equation_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700523 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800524 const char * _exceptionType = NULL;
525 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700526 GLfloat *equation_base = (GLfloat *) 0;
527 jint _remaining;
528 GLfloat *equation = (GLfloat *) 0;
529
530 if (!equation_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700531 _exception = 1;
532 _exceptionType = "java/lang/IllegalArgumentException";
533 _exceptionMessage = "equation == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700534 goto exit;
535 }
536 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700537 _exception = 1;
538 _exceptionType = "java/lang/IllegalArgumentException";
539 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700540 goto exit;
541 }
542 _remaining = _env->GetArrayLength(equation_ref) - offset;
543 equation_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700544 _env->GetFloatArrayElements(equation_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -0700545 equation = equation_base + offset;
546
547 glClipPlanef(
548 (GLenum)plane,
549 (GLfloat *)equation
550 );
551
552exit:
553 if (equation_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700554 _env->ReleaseFloatArrayElements(equation_ref, (jfloat*)equation_base,
Jack Palevich27f80022009-04-15 19:13:17 -0700555 JNI_ABORT);
556 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700557 if (_exception) {
558 jniThrowException(_env, _exceptionType, _exceptionMessage);
559 }
Jack Palevich27f80022009-04-15 19:13:17 -0700560}
561
562/* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */
563static void
564android_glClipPlanef__ILjava_nio_FloatBuffer_2
565 (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700566 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800567 const char * _exceptionType = NULL;
568 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700569 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700570 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700571 jint _remaining;
572 GLfloat *equation = (GLfloat *) 0;
573
Romain Guy84cac202016-12-05 12:26:02 -0800574 if (!equation_buf) {
575 _exception = 1;
576 _exceptionType = "java/lang/IllegalArgumentException";
577 _exceptionMessage = "equation == null";
578 goto exit;
579 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700580 equation = (GLfloat *)getPointer(_env, equation_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700581 if (equation == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700582 char * _equationBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700583 equation = (GLfloat *) (_equationBase + _bufferOffset);
584 }
Jack Palevich27f80022009-04-15 19:13:17 -0700585 glClipPlanef(
586 (GLenum)plane,
587 (GLfloat *)equation
588 );
Romain Guy84cac202016-12-05 12:26:02 -0800589
590exit:
Jack Palevich27f80022009-04-15 19:13:17 -0700591 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700592 _env->ReleaseFloatArrayElements(_array, (jfloat*)equation, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -0700593 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700594 if (_exception) {
595 jniThrowException(_env, _exceptionType, _exceptionMessage);
596 }
Jack Palevich27f80022009-04-15 19:13:17 -0700597}
598
599/* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */
600static void
601android_glClipPlanex__I_3II
602 (JNIEnv *_env, jobject _this, jint plane, jintArray equation_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700603 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800604 const char * _exceptionType = NULL;
605 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700606 GLfixed *equation_base = (GLfixed *) 0;
607 jint _remaining;
608 GLfixed *equation = (GLfixed *) 0;
609
610 if (!equation_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700611 _exception = 1;
612 _exceptionType = "java/lang/IllegalArgumentException";
613 _exceptionMessage = "equation == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700614 goto exit;
615 }
616 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700617 _exception = 1;
618 _exceptionType = "java/lang/IllegalArgumentException";
619 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700620 goto exit;
621 }
622 _remaining = _env->GetArrayLength(equation_ref) - offset;
623 equation_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700624 _env->GetIntArrayElements(equation_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -0700625 equation = equation_base + offset;
626
627 glClipPlanex(
628 (GLenum)plane,
629 (GLfixed *)equation
630 );
631
632exit:
633 if (equation_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700634 _env->ReleaseIntArrayElements(equation_ref, (jint*)equation_base,
Jack Palevich27f80022009-04-15 19:13:17 -0700635 JNI_ABORT);
636 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700637 if (_exception) {
638 jniThrowException(_env, _exceptionType, _exceptionMessage);
639 }
Jack Palevich27f80022009-04-15 19:13:17 -0700640}
641
642/* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */
643static void
644android_glClipPlanex__ILjava_nio_IntBuffer_2
645 (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700646 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800647 const char * _exceptionType = NULL;
648 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700649 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700650 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700651 jint _remaining;
652 GLfixed *equation = (GLfixed *) 0;
653
Romain Guy84cac202016-12-05 12:26:02 -0800654 if (!equation_buf) {
655 _exception = 1;
656 _exceptionType = "java/lang/IllegalArgumentException";
657 _exceptionMessage = "equation == null";
658 goto exit;
659 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700660 equation = (GLfixed *)getPointer(_env, equation_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700661 if (equation == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700662 char * _equationBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700663 equation = (GLfixed *) (_equationBase + _bufferOffset);
664 }
Jack Palevich27f80022009-04-15 19:13:17 -0700665 glClipPlanex(
666 (GLenum)plane,
667 (GLfixed *)equation
668 );
Romain Guy84cac202016-12-05 12:26:02 -0800669
670exit:
Jack Palevich27f80022009-04-15 19:13:17 -0700671 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700672 _env->ReleaseIntArrayElements(_array, (jint*)equation, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -0700673 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700674 if (_exception) {
675 jniThrowException(_env, _exceptionType, _exceptionMessage);
676 }
Jack Palevich27f80022009-04-15 19:13:17 -0700677}
678
679/* void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) */
680static void
681android_glColor4ub__BBBB
682 (JNIEnv *_env, jobject _this, jbyte red, jbyte green, jbyte blue, jbyte alpha) {
683 glColor4ub(
684 (GLubyte)red,
685 (GLubyte)green,
686 (GLubyte)blue,
687 (GLubyte)alpha
688 );
689}
690
691/* void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
692static void
693android_glColorPointer__IIII
694 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
695 glColorPointer(
696 (GLint)size,
697 (GLenum)type,
698 (GLsizei)stride,
Ashok Bhat01c26ea2014-02-24 09:49:07 +0000699 reinterpret_cast<GLvoid *>(offset)
Jack Palevich27f80022009-04-15 19:13:17 -0700700 );
701}
702
703/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
704static void
705android_glDeleteBuffers__I_3II
706 (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700707 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800708 const char * _exceptionType = NULL;
709 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700710 GLuint *buffers_base = (GLuint *) 0;
711 jint _remaining;
712 GLuint *buffers = (GLuint *) 0;
713
714 if (!buffers_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700715 _exception = 1;
716 _exceptionType = "java/lang/IllegalArgumentException";
717 _exceptionMessage = "buffers == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700718 goto exit;
719 }
720 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700721 _exception = 1;
722 _exceptionType = "java/lang/IllegalArgumentException";
723 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700724 goto exit;
725 }
726 _remaining = _env->GetArrayLength(buffers_ref) - offset;
727 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700728 _exception = 1;
729 _exceptionType = "java/lang/IllegalArgumentException";
730 _exceptionMessage = "length - offset < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700731 goto exit;
732 }
733 buffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700734 _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -0700735 buffers = buffers_base + offset;
736
737 glDeleteBuffers(
738 (GLsizei)n,
739 (GLuint *)buffers
740 );
741
742exit:
743 if (buffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700744 _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
Jack Palevich27f80022009-04-15 19:13:17 -0700745 JNI_ABORT);
746 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700747 if (_exception) {
748 jniThrowException(_env, _exceptionType, _exceptionMessage);
749 }
Jack Palevich27f80022009-04-15 19:13:17 -0700750}
751
752/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
753static void
754android_glDeleteBuffers__ILjava_nio_IntBuffer_2
755 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700756 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800757 const char * _exceptionType = NULL;
758 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700759 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700760 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700761 jint _remaining;
762 GLuint *buffers = (GLuint *) 0;
763
Romain Guy84cac202016-12-05 12:26:02 -0800764 if (!buffers_buf) {
765 _exception = 1;
766 _exceptionType = "java/lang/IllegalArgumentException";
767 _exceptionMessage = "buffers == null";
768 goto exit;
769 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700770 buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -0700771 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700772 _exception = 1;
773 _exceptionType = "java/lang/IllegalArgumentException";
774 _exceptionMessage = "remaining() < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700775 goto exit;
776 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700777 if (buffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700778 char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700779 buffers = (GLuint *) (_buffersBase + _bufferOffset);
780 }
Jack Palevich27f80022009-04-15 19:13:17 -0700781 glDeleteBuffers(
782 (GLsizei)n,
783 (GLuint *)buffers
784 );
785
786exit:
787 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700788 _env->ReleaseIntArrayElements(_array, (jint*)buffers, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -0700789 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700790 if (_exception) {
791 jniThrowException(_env, _exceptionType, _exceptionMessage);
792 }
Jack Palevich27f80022009-04-15 19:13:17 -0700793}
794
795/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */
796static void
797android_glDrawElements__IIII
798 (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700799 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800800 const char * _exceptionType = NULL;
801 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700802 glDrawElements(
803 (GLenum)mode,
804 (GLsizei)count,
805 (GLenum)type,
Ashok Bhat01c26ea2014-02-24 09:49:07 +0000806 reinterpret_cast<GLvoid *>(offset)
Jack Palevich27f80022009-04-15 19:13:17 -0700807 );
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700808 if (_exception) {
809 jniThrowException(_env, _exceptionType, _exceptionMessage);
810 }
Jack Palevich27f80022009-04-15 19:13:17 -0700811}
812
813/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
814static void
815android_glGenBuffers__I_3II
816 (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
817 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800818 const char * _exceptionType = NULL;
819 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700820 GLuint *buffers_base = (GLuint *) 0;
821 jint _remaining;
822 GLuint *buffers = (GLuint *) 0;
823
824 if (!buffers_ref) {
825 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700826 _exceptionType = "java/lang/IllegalArgumentException";
827 _exceptionMessage = "buffers == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700828 goto exit;
829 }
830 if (offset < 0) {
831 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700832 _exceptionType = "java/lang/IllegalArgumentException";
833 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700834 goto exit;
835 }
836 _remaining = _env->GetArrayLength(buffers_ref) - offset;
837 if (_remaining < n) {
838 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700839 _exceptionType = "java/lang/IllegalArgumentException";
840 _exceptionMessage = "length - offset < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700841 goto exit;
842 }
843 buffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700844 _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -0700845 buffers = buffers_base + offset;
846
847 glGenBuffers(
848 (GLsizei)n,
849 (GLuint *)buffers
850 );
851
852exit:
853 if (buffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700854 _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
Jack Palevich27f80022009-04-15 19:13:17 -0700855 _exception ? JNI_ABORT: 0);
856 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700857 if (_exception) {
858 jniThrowException(_env, _exceptionType, _exceptionMessage);
859 }
Jack Palevich27f80022009-04-15 19:13:17 -0700860}
861
862/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
863static void
864android_glGenBuffers__ILjava_nio_IntBuffer_2
865 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
866 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800867 const char * _exceptionType = NULL;
868 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700869 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700870 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700871 jint _remaining;
872 GLuint *buffers = (GLuint *) 0;
873
Romain Guy84cac202016-12-05 12:26:02 -0800874 if (!buffers_buf) {
875 _exception = 1;
876 _exceptionType = "java/lang/IllegalArgumentException";
877 _exceptionMessage = "buffers == null";
878 goto exit;
879 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700880 buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -0700881 if (_remaining < n) {
882 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700883 _exceptionType = "java/lang/IllegalArgumentException";
884 _exceptionMessage = "remaining() < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700885 goto exit;
886 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700887 if (buffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700888 char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700889 buffers = (GLuint *) (_buffersBase + _bufferOffset);
890 }
Jack Palevich27f80022009-04-15 19:13:17 -0700891 glGenBuffers(
892 (GLsizei)n,
893 (GLuint *)buffers
894 );
895
896exit:
897 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700898 _env->ReleaseIntArrayElements(_array, (jint*)buffers, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -0700899 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700900 if (_exception) {
901 jniThrowException(_env, _exceptionType, _exceptionMessage);
902 }
Jack Palevich27f80022009-04-15 19:13:17 -0700903}
904
905/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
906static void
907android_glGetBooleanv__I_3ZI
908 (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700909 get<jbooleanArray, BooleanArrayGetter, jboolean*, BooleanArrayReleaser, GLboolean, glGetBooleanv>(
910 _env, _this, pname, params_ref, offset);
Jack Palevich27f80022009-04-15 19:13:17 -0700911}
912
913/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
914static void
915android_glGetBooleanv__ILjava_nio_IntBuffer_2
916 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700917 getarray<GLboolean, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetBooleanv>(
918 _env, _this, pname, params_buf);
Jack Palevich27f80022009-04-15 19:13:17 -0700919}
Jack Palevich27f80022009-04-15 19:13:17 -0700920/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
921static void
922android_glGetBufferParameteriv__II_3II
923 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Jack Palevich73108672011-03-28 14:49:12 -0700924 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800925 const char * _exceptionType = NULL;
926 const char * _exceptionMessage = NULL;
Jack Palevich73108672011-03-28 14:49:12 -0700927 GLint *params_base = (GLint *) 0;
928 jint _remaining;
929 GLint *params = (GLint *) 0;
930
931 if (!params_ref) {
932 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700933 _exceptionType = "java/lang/IllegalArgumentException";
934 _exceptionMessage = "params == null";
Jack Palevich73108672011-03-28 14:49:12 -0700935 goto exit;
936 }
937 if (offset < 0) {
938 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700939 _exceptionType = "java/lang/IllegalArgumentException";
940 _exceptionMessage = "offset < 0";
Jack Palevich73108672011-03-28 14:49:12 -0700941 goto exit;
942 }
943 _remaining = _env->GetArrayLength(params_ref) - offset;
944 if (_remaining < 1) {
945 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700946 _exceptionType = "java/lang/IllegalArgumentException";
947 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich73108672011-03-28 14:49:12 -0700948 goto exit;
949 }
950 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700951 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich73108672011-03-28 14:49:12 -0700952 params = params_base + offset;
953
954 glGetBufferParameteriv(
955 (GLenum)target,
956 (GLenum)pname,
957 (GLint *)params
958 );
959
960exit:
961 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700962 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich73108672011-03-28 14:49:12 -0700963 _exception ? JNI_ABORT: 0);
964 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700965 if (_exception) {
966 jniThrowException(_env, _exceptionType, _exceptionMessage);
967 }
Jack Palevich27f80022009-04-15 19:13:17 -0700968}
969
970/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
971static void
972android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
973 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Jack Palevich73108672011-03-28 14:49:12 -0700974 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800975 const char * _exceptionType = NULL;
976 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700977 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700978 jint _bufferOffset = (jint) 0;
Jack Palevich73108672011-03-28 14:49:12 -0700979 jint _remaining;
980 GLint *params = (GLint *) 0;
981
Romain Guy84cac202016-12-05 12:26:02 -0800982 if (!params_buf) {
983 _exception = 1;
984 _exceptionType = "java/lang/IllegalArgumentException";
985 _exceptionMessage = "params == null";
986 goto exit;
987 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700988 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich73108672011-03-28 14:49:12 -0700989 if (_remaining < 1) {
990 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700991 _exceptionType = "java/lang/IllegalArgumentException";
992 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich73108672011-03-28 14:49:12 -0700993 goto exit;
994 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700995 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700996 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700997 params = (GLint *) (_paramsBase + _bufferOffset);
998 }
Jack Palevich73108672011-03-28 14:49:12 -0700999 glGetBufferParameteriv(
1000 (GLenum)target,
1001 (GLenum)pname,
1002 (GLint *)params
1003 );
1004
1005exit:
1006 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001007 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich73108672011-03-28 14:49:12 -07001008 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001009 if (_exception) {
1010 jniThrowException(_env, _exceptionType, _exceptionMessage);
1011 }
Jack Palevich27f80022009-04-15 19:13:17 -07001012}
1013
1014/* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */
1015static void
1016android_glGetClipPlanef__I_3FI
1017 (JNIEnv *_env, jobject _this, jint pname, jfloatArray eqn_ref, jint offset) {
1018 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001019 const char * _exceptionType = NULL;
1020 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001021 GLfloat *eqn_base = (GLfloat *) 0;
1022 jint _remaining;
1023 GLfloat *eqn = (GLfloat *) 0;
1024
1025 if (!eqn_ref) {
1026 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001027 _exceptionType = "java/lang/IllegalArgumentException";
1028 _exceptionMessage = "eqn == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001029 goto exit;
1030 }
1031 if (offset < 0) {
1032 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001033 _exceptionType = "java/lang/IllegalArgumentException";
1034 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001035 goto exit;
1036 }
1037 _remaining = _env->GetArrayLength(eqn_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001038 if (_remaining < 4) {
1039 _exception = 1;
1040 _exceptionType = "java/lang/IllegalArgumentException";
1041 _exceptionMessage = "length - offset < 4 < needed";
1042 goto exit;
1043 }
Jack Palevich27f80022009-04-15 19:13:17 -07001044 eqn_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001045 _env->GetFloatArrayElements(eqn_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001046 eqn = eqn_base + offset;
1047
1048 glGetClipPlanef(
1049 (GLenum)pname,
1050 (GLfloat *)eqn
1051 );
1052
1053exit:
1054 if (eqn_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001055 _env->ReleaseFloatArrayElements(eqn_ref, (jfloat*)eqn_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001056 _exception ? JNI_ABORT: 0);
1057 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001058 if (_exception) {
1059 jniThrowException(_env, _exceptionType, _exceptionMessage);
1060 }
Jack Palevich27f80022009-04-15 19:13:17 -07001061}
1062
1063/* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */
1064static void
1065android_glGetClipPlanef__ILjava_nio_FloatBuffer_2
1066 (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001067 jint _exception = 0;
1068 const char * _exceptionType = NULL;
1069 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001070 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001071 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001072 jint _remaining;
1073 GLfloat *eqn = (GLfloat *) 0;
1074
Romain Guy84cac202016-12-05 12:26:02 -08001075 if (!eqn_buf) {
1076 _exception = 1;
1077 _exceptionType = "java/lang/IllegalArgumentException";
1078 _exceptionMessage = "eqn == null";
1079 goto exit;
1080 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001081 eqn = (GLfloat *)getPointer(_env, eqn_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001082 if (_remaining < 4) {
1083 _exception = 1;
1084 _exceptionType = "java/lang/IllegalArgumentException";
1085 _exceptionMessage = "remaining() < 4 < needed";
1086 goto exit;
1087 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001088 if (eqn == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001089 char * _eqnBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001090 eqn = (GLfloat *) (_eqnBase + _bufferOffset);
1091 }
Jack Palevich27f80022009-04-15 19:13:17 -07001092 glGetClipPlanef(
1093 (GLenum)pname,
1094 (GLfloat *)eqn
1095 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08001096
1097exit:
Jack Palevich27f80022009-04-15 19:13:17 -07001098 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001099 _env->ReleaseFloatArrayElements(_array, (jfloat*)eqn, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001100 }
1101 if (_exception) {
1102 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich27f80022009-04-15 19:13:17 -07001103 }
1104}
1105
1106/* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */
1107static void
1108android_glGetClipPlanex__I_3II
1109 (JNIEnv *_env, jobject _this, jint pname, jintArray eqn_ref, jint offset) {
1110 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001111 const char * _exceptionType = NULL;
1112 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001113 GLfixed *eqn_base = (GLfixed *) 0;
1114 jint _remaining;
1115 GLfixed *eqn = (GLfixed *) 0;
1116
1117 if (!eqn_ref) {
1118 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001119 _exceptionType = "java/lang/IllegalArgumentException";
1120 _exceptionMessage = "eqn == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001121 goto exit;
1122 }
1123 if (offset < 0) {
1124 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001125 _exceptionType = "java/lang/IllegalArgumentException";
1126 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001127 goto exit;
1128 }
1129 _remaining = _env->GetArrayLength(eqn_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001130 if (_remaining < 4) {
1131 _exception = 1;
1132 _exceptionType = "java/lang/IllegalArgumentException";
1133 _exceptionMessage = "length - offset < 4 < needed";
1134 goto exit;
1135 }
Jack Palevich27f80022009-04-15 19:13:17 -07001136 eqn_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001137 _env->GetIntArrayElements(eqn_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001138 eqn = eqn_base + offset;
1139
1140 glGetClipPlanex(
1141 (GLenum)pname,
1142 (GLfixed *)eqn
1143 );
1144
1145exit:
1146 if (eqn_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001147 _env->ReleaseIntArrayElements(eqn_ref, (jint*)eqn_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001148 _exception ? JNI_ABORT: 0);
1149 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001150 if (_exception) {
1151 jniThrowException(_env, _exceptionType, _exceptionMessage);
1152 }
Jack Palevich27f80022009-04-15 19:13:17 -07001153}
1154
1155/* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */
1156static void
1157android_glGetClipPlanex__ILjava_nio_IntBuffer_2
1158 (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001159 jint _exception = 0;
1160 const char * _exceptionType = NULL;
1161 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001162 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001163 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001164 jint _remaining;
1165 GLfixed *eqn = (GLfixed *) 0;
1166
Romain Guy84cac202016-12-05 12:26:02 -08001167 if (!eqn_buf) {
1168 _exception = 1;
1169 _exceptionType = "java/lang/IllegalArgumentException";
1170 _exceptionMessage = "eqn == null";
1171 goto exit;
1172 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001173 eqn = (GLfixed *)getPointer(_env, eqn_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001174 if (_remaining < 4) {
1175 _exception = 1;
1176 _exceptionType = "java/lang/IllegalArgumentException";
1177 _exceptionMessage = "remaining() < 4 < needed";
1178 goto exit;
1179 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001180 if (eqn == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001181 char * _eqnBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001182 eqn = (GLfixed *) (_eqnBase + _bufferOffset);
1183 }
Jack Palevich27f80022009-04-15 19:13:17 -07001184 glGetClipPlanex(
1185 (GLenum)pname,
1186 (GLfixed *)eqn
1187 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08001188
1189exit:
Jack Palevich27f80022009-04-15 19:13:17 -07001190 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001191 _env->ReleaseIntArrayElements(_array, (jint*)eqn, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001192 }
1193 if (_exception) {
1194 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich27f80022009-04-15 19:13:17 -07001195 }
1196}
1197
1198/* void glGetFixedv ( GLenum pname, GLfixed *params ) */
1199static void
1200android_glGetFixedv__I_3II
1201 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
1202 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001203 const char * _exceptionType = NULL;
1204 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001205 GLfixed *params_base = (GLfixed *) 0;
1206 jint _remaining;
1207 GLfixed *params = (GLfixed *) 0;
1208
1209 if (!params_ref) {
1210 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001211 _exceptionType = "java/lang/IllegalArgumentException";
1212 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001213 goto exit;
1214 }
1215 if (offset < 0) {
1216 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001217 _exceptionType = "java/lang/IllegalArgumentException";
1218 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001219 goto exit;
1220 }
1221 _remaining = _env->GetArrayLength(params_ref) - offset;
1222 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001223 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001224 params = params_base + offset;
1225
1226 glGetFixedv(
1227 (GLenum)pname,
1228 (GLfixed *)params
1229 );
1230
1231exit:
1232 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001233 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001234 _exception ? JNI_ABORT: 0);
1235 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001236 if (_exception) {
1237 jniThrowException(_env, _exceptionType, _exceptionMessage);
1238 }
Jack Palevich27f80022009-04-15 19:13:17 -07001239}
1240
1241/* void glGetFixedv ( GLenum pname, GLfixed *params ) */
1242static void
1243android_glGetFixedv__ILjava_nio_IntBuffer_2
1244 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Romain Guy84cac202016-12-05 12:26:02 -08001245 jint _exception = 0;
1246 const char * _exceptionType = NULL;
1247 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001248 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001249 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001250 jint _remaining;
1251 GLfixed *params = (GLfixed *) 0;
1252
Romain Guy84cac202016-12-05 12:26:02 -08001253 if (!params_buf) {
1254 _exception = 1;
1255 _exceptionType = "java/lang/IllegalArgumentException";
1256 _exceptionMessage = "params == null";
1257 goto exit;
1258 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001259 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001260 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001261 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001262 params = (GLfixed *) (_paramsBase + _bufferOffset);
1263 }
Jack Palevich27f80022009-04-15 19:13:17 -07001264 glGetFixedv(
1265 (GLenum)pname,
1266 (GLfixed *)params
1267 );
Romain Guy84cac202016-12-05 12:26:02 -08001268
1269exit:
Jack Palevich27f80022009-04-15 19:13:17 -07001270 if (_array) {
Romain Guy84cac202016-12-05 12:26:02 -08001271 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
1272 }
1273 if (_exception) {
1274 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich27f80022009-04-15 19:13:17 -07001275 }
1276}
1277
1278/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
1279static void
1280android_glGetFloatv__I_3FI
1281 (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001282 get<jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, GLfloat, glGetFloatv>(
1283 _env, _this, pname, params_ref, offset);
Jack Palevich27f80022009-04-15 19:13:17 -07001284}
1285
1286/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
1287static void
1288android_glGetFloatv__ILjava_nio_FloatBuffer_2
1289 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001290 getarray<GLfloat, jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, glGetFloatv>(
1291 _env, _this, pname, params_buf);
Jack Palevich27f80022009-04-15 19:13:17 -07001292}
Jack Palevich27f80022009-04-15 19:13:17 -07001293/* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */
1294static void
1295android_glGetLightfv__II_3FI
1296 (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) {
1297 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001298 const char * _exceptionType = NULL;
1299 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001300 GLfloat *params_base = (GLfloat *) 0;
1301 jint _remaining;
1302 GLfloat *params = (GLfloat *) 0;
1303
1304 if (!params_ref) {
1305 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001306 _exceptionType = "java/lang/IllegalArgumentException";
1307 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001308 goto exit;
1309 }
1310 if (offset < 0) {
1311 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001312 _exceptionType = "java/lang/IllegalArgumentException";
1313 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001314 goto exit;
1315 }
1316 _remaining = _env->GetArrayLength(params_ref) - offset;
1317 int _needed;
1318 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001319#if defined(GL_SPOT_DIRECTION)
1320 case GL_SPOT_DIRECTION:
1321#endif // defined(GL_SPOT_DIRECTION)
1322 _needed = 3;
1323 break;
1324#if defined(GL_AMBIENT)
1325 case GL_AMBIENT:
1326#endif // defined(GL_AMBIENT)
1327#if defined(GL_DIFFUSE)
1328 case GL_DIFFUSE:
1329#endif // defined(GL_DIFFUSE)
1330#if defined(GL_SPECULAR)
1331 case GL_SPECULAR:
1332#endif // defined(GL_SPECULAR)
1333#if defined(GL_EMISSION)
1334 case GL_EMISSION:
1335#endif // defined(GL_EMISSION)
1336 _needed = 4;
1337 break;
1338 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001339 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001340 break;
1341 }
1342 if (_remaining < _needed) {
1343 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001344 _exceptionType = "java/lang/IllegalArgumentException";
1345 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001346 goto exit;
1347 }
1348 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001349 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001350 params = params_base + offset;
1351
1352 glGetLightfv(
1353 (GLenum)light,
1354 (GLenum)pname,
1355 (GLfloat *)params
1356 );
1357
1358exit:
1359 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001360 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001361 _exception ? JNI_ABORT: 0);
1362 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001363 if (_exception) {
1364 jniThrowException(_env, _exceptionType, _exceptionMessage);
1365 }
Jack Palevich27f80022009-04-15 19:13:17 -07001366}
1367
1368/* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */
1369static void
1370android_glGetLightfv__IILjava_nio_FloatBuffer_2
1371 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
1372 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001373 const char * _exceptionType = NULL;
1374 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001375 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001376 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001377 jint _remaining;
1378 GLfloat *params = (GLfloat *) 0;
1379
Romain Guy84cac202016-12-05 12:26:02 -08001380 if (!params_buf) {
1381 _exception = 1;
1382 _exceptionType = "java/lang/IllegalArgumentException";
1383 _exceptionMessage = "params == null";
1384 goto exit;
1385 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001386 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001387 int _needed;
1388 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001389#if defined(GL_SPOT_DIRECTION)
1390 case GL_SPOT_DIRECTION:
1391#endif // defined(GL_SPOT_DIRECTION)
1392 _needed = 3;
1393 break;
1394#if defined(GL_AMBIENT)
1395 case GL_AMBIENT:
1396#endif // defined(GL_AMBIENT)
1397#if defined(GL_DIFFUSE)
1398 case GL_DIFFUSE:
1399#endif // defined(GL_DIFFUSE)
1400#if defined(GL_SPECULAR)
1401 case GL_SPECULAR:
1402#endif // defined(GL_SPECULAR)
1403#if defined(GL_EMISSION)
1404 case GL_EMISSION:
1405#endif // defined(GL_EMISSION)
1406 _needed = 4;
1407 break;
1408 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001409 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001410 break;
1411 }
1412 if (_remaining < _needed) {
1413 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001414 _exceptionType = "java/lang/IllegalArgumentException";
1415 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001416 goto exit;
1417 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001418 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001419 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001420 params = (GLfloat *) (_paramsBase + _bufferOffset);
1421 }
Jack Palevich27f80022009-04-15 19:13:17 -07001422 glGetLightfv(
1423 (GLenum)light,
1424 (GLenum)pname,
1425 (GLfloat *)params
1426 );
1427
1428exit:
1429 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001430 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07001431 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001432 if (_exception) {
1433 jniThrowException(_env, _exceptionType, _exceptionMessage);
1434 }
Jack Palevich27f80022009-04-15 19:13:17 -07001435}
1436
1437/* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */
1438static void
1439android_glGetLightxv__II_3II
1440 (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) {
1441 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001442 const char * _exceptionType = NULL;
1443 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001444 GLfixed *params_base = (GLfixed *) 0;
1445 jint _remaining;
1446 GLfixed *params = (GLfixed *) 0;
1447
1448 if (!params_ref) {
1449 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001450 _exceptionType = "java/lang/IllegalArgumentException";
1451 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001452 goto exit;
1453 }
1454 if (offset < 0) {
1455 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001456 _exceptionType = "java/lang/IllegalArgumentException";
1457 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001458 goto exit;
1459 }
1460 _remaining = _env->GetArrayLength(params_ref) - offset;
1461 int _needed;
1462 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001463#if defined(GL_SPOT_DIRECTION)
1464 case GL_SPOT_DIRECTION:
1465#endif // defined(GL_SPOT_DIRECTION)
1466 _needed = 3;
1467 break;
1468#if defined(GL_AMBIENT)
1469 case GL_AMBIENT:
1470#endif // defined(GL_AMBIENT)
1471#if defined(GL_DIFFUSE)
1472 case GL_DIFFUSE:
1473#endif // defined(GL_DIFFUSE)
1474#if defined(GL_SPECULAR)
1475 case GL_SPECULAR:
1476#endif // defined(GL_SPECULAR)
1477#if defined(GL_EMISSION)
1478 case GL_EMISSION:
1479#endif // defined(GL_EMISSION)
1480 _needed = 4;
1481 break;
1482 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001483 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001484 break;
1485 }
1486 if (_remaining < _needed) {
1487 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001488 _exceptionType = "java/lang/IllegalArgumentException";
1489 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001490 goto exit;
1491 }
1492 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001493 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001494 params = params_base + offset;
1495
1496 glGetLightxv(
1497 (GLenum)light,
1498 (GLenum)pname,
1499 (GLfixed *)params
1500 );
1501
1502exit:
1503 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001504 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001505 _exception ? JNI_ABORT: 0);
1506 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001507 if (_exception) {
1508 jniThrowException(_env, _exceptionType, _exceptionMessage);
1509 }
Jack Palevich27f80022009-04-15 19:13:17 -07001510}
1511
1512/* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */
1513static void
1514android_glGetLightxv__IILjava_nio_IntBuffer_2
1515 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
1516 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001517 const char * _exceptionType = NULL;
1518 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001519 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001520 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001521 jint _remaining;
1522 GLfixed *params = (GLfixed *) 0;
1523
Romain Guy84cac202016-12-05 12:26:02 -08001524 if (!params_buf) {
1525 _exception = 1;
1526 _exceptionType = "java/lang/IllegalArgumentException";
1527 _exceptionMessage = "params == null";
1528 goto exit;
1529 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001530 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001531 int _needed;
1532 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001533#if defined(GL_SPOT_DIRECTION)
1534 case GL_SPOT_DIRECTION:
1535#endif // defined(GL_SPOT_DIRECTION)
1536 _needed = 3;
1537 break;
1538#if defined(GL_AMBIENT)
1539 case GL_AMBIENT:
1540#endif // defined(GL_AMBIENT)
1541#if defined(GL_DIFFUSE)
1542 case GL_DIFFUSE:
1543#endif // defined(GL_DIFFUSE)
1544#if defined(GL_SPECULAR)
1545 case GL_SPECULAR:
1546#endif // defined(GL_SPECULAR)
1547#if defined(GL_EMISSION)
1548 case GL_EMISSION:
1549#endif // defined(GL_EMISSION)
1550 _needed = 4;
1551 break;
1552 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001553 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001554 break;
1555 }
1556 if (_remaining < _needed) {
1557 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001558 _exceptionType = "java/lang/IllegalArgumentException";
1559 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001560 goto exit;
1561 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001562 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001563 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001564 params = (GLfixed *) (_paramsBase + _bufferOffset);
1565 }
Jack Palevich27f80022009-04-15 19:13:17 -07001566 glGetLightxv(
1567 (GLenum)light,
1568 (GLenum)pname,
1569 (GLfixed *)params
1570 );
1571
1572exit:
1573 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001574 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07001575 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001576 if (_exception) {
1577 jniThrowException(_env, _exceptionType, _exceptionMessage);
1578 }
Jack Palevich27f80022009-04-15 19:13:17 -07001579}
1580
1581/* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */
1582static void
1583android_glGetMaterialfv__II_3FI
1584 (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) {
1585 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001586 const char * _exceptionType = NULL;
1587 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001588 GLfloat *params_base = (GLfloat *) 0;
1589 jint _remaining;
1590 GLfloat *params = (GLfloat *) 0;
1591
1592 if (!params_ref) {
1593 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001594 _exceptionType = "java/lang/IllegalArgumentException";
1595 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001596 goto exit;
1597 }
1598 if (offset < 0) {
1599 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001600 _exceptionType = "java/lang/IllegalArgumentException";
1601 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001602 goto exit;
1603 }
1604 _remaining = _env->GetArrayLength(params_ref) - offset;
1605 int _needed;
1606 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001607#if defined(GL_AMBIENT)
1608 case GL_AMBIENT:
1609#endif // defined(GL_AMBIENT)
1610#if defined(GL_DIFFUSE)
1611 case GL_DIFFUSE:
1612#endif // defined(GL_DIFFUSE)
1613#if defined(GL_SPECULAR)
1614 case GL_SPECULAR:
1615#endif // defined(GL_SPECULAR)
1616#if defined(GL_EMISSION)
1617 case GL_EMISSION:
1618#endif // defined(GL_EMISSION)
1619#if defined(GL_AMBIENT_AND_DIFFUSE)
1620 case GL_AMBIENT_AND_DIFFUSE:
1621#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1622 _needed = 4;
1623 break;
1624 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001625 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001626 break;
1627 }
1628 if (_remaining < _needed) {
1629 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001630 _exceptionType = "java/lang/IllegalArgumentException";
1631 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001632 goto exit;
1633 }
1634 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001635 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001636 params = params_base + offset;
1637
1638 glGetMaterialfv(
1639 (GLenum)face,
1640 (GLenum)pname,
1641 (GLfloat *)params
1642 );
1643
1644exit:
1645 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001646 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001647 _exception ? JNI_ABORT: 0);
1648 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001649 if (_exception) {
1650 jniThrowException(_env, _exceptionType, _exceptionMessage);
1651 }
Jack Palevich27f80022009-04-15 19:13:17 -07001652}
1653
1654/* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */
1655static void
1656android_glGetMaterialfv__IILjava_nio_FloatBuffer_2
1657 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
1658 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001659 const char * _exceptionType = NULL;
1660 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001661 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001662 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001663 jint _remaining;
1664 GLfloat *params = (GLfloat *) 0;
1665
Romain Guy84cac202016-12-05 12:26:02 -08001666 if (!params_buf) {
1667 _exception = 1;
1668 _exceptionType = "java/lang/IllegalArgumentException";
1669 _exceptionMessage = "params == null";
1670 goto exit;
1671 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001672 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001673 int _needed;
1674 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001675#if defined(GL_AMBIENT)
1676 case GL_AMBIENT:
1677#endif // defined(GL_AMBIENT)
1678#if defined(GL_DIFFUSE)
1679 case GL_DIFFUSE:
1680#endif // defined(GL_DIFFUSE)
1681#if defined(GL_SPECULAR)
1682 case GL_SPECULAR:
1683#endif // defined(GL_SPECULAR)
1684#if defined(GL_EMISSION)
1685 case GL_EMISSION:
1686#endif // defined(GL_EMISSION)
1687#if defined(GL_AMBIENT_AND_DIFFUSE)
1688 case GL_AMBIENT_AND_DIFFUSE:
1689#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1690 _needed = 4;
1691 break;
1692 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001693 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001694 break;
1695 }
1696 if (_remaining < _needed) {
1697 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001698 _exceptionType = "java/lang/IllegalArgumentException";
1699 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001700 goto exit;
1701 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001702 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001703 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001704 params = (GLfloat *) (_paramsBase + _bufferOffset);
1705 }
Jack Palevich27f80022009-04-15 19:13:17 -07001706 glGetMaterialfv(
1707 (GLenum)face,
1708 (GLenum)pname,
1709 (GLfloat *)params
1710 );
1711
1712exit:
1713 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001714 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07001715 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001716 if (_exception) {
1717 jniThrowException(_env, _exceptionType, _exceptionMessage);
1718 }
Jack Palevich27f80022009-04-15 19:13:17 -07001719}
1720
1721/* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */
1722static void
1723android_glGetMaterialxv__II_3II
1724 (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) {
1725 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001726 const char * _exceptionType = NULL;
1727 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001728 GLfixed *params_base = (GLfixed *) 0;
1729 jint _remaining;
1730 GLfixed *params = (GLfixed *) 0;
1731
1732 if (!params_ref) {
1733 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001734 _exceptionType = "java/lang/IllegalArgumentException";
1735 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001736 goto exit;
1737 }
1738 if (offset < 0) {
1739 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001740 _exceptionType = "java/lang/IllegalArgumentException";
1741 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001742 goto exit;
1743 }
1744 _remaining = _env->GetArrayLength(params_ref) - offset;
1745 int _needed;
1746 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001747#if defined(GL_AMBIENT)
1748 case GL_AMBIENT:
1749#endif // defined(GL_AMBIENT)
1750#if defined(GL_DIFFUSE)
1751 case GL_DIFFUSE:
1752#endif // defined(GL_DIFFUSE)
1753#if defined(GL_SPECULAR)
1754 case GL_SPECULAR:
1755#endif // defined(GL_SPECULAR)
1756#if defined(GL_EMISSION)
1757 case GL_EMISSION:
1758#endif // defined(GL_EMISSION)
1759#if defined(GL_AMBIENT_AND_DIFFUSE)
1760 case GL_AMBIENT_AND_DIFFUSE:
1761#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1762 _needed = 4;
1763 break;
1764 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001765 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001766 break;
1767 }
1768 if (_remaining < _needed) {
1769 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001770 _exceptionType = "java/lang/IllegalArgumentException";
1771 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001772 goto exit;
1773 }
1774 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001775 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001776 params = params_base + offset;
1777
1778 glGetMaterialxv(
1779 (GLenum)face,
1780 (GLenum)pname,
1781 (GLfixed *)params
1782 );
1783
1784exit:
1785 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001786 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001787 _exception ? JNI_ABORT: 0);
1788 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001789 if (_exception) {
1790 jniThrowException(_env, _exceptionType, _exceptionMessage);
1791 }
Jack Palevich27f80022009-04-15 19:13:17 -07001792}
1793
1794/* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */
1795static void
1796android_glGetMaterialxv__IILjava_nio_IntBuffer_2
1797 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
1798 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001799 const char * _exceptionType = NULL;
1800 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001801 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001802 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001803 jint _remaining;
1804 GLfixed *params = (GLfixed *) 0;
1805
Romain Guy84cac202016-12-05 12:26:02 -08001806 if (!params_buf) {
1807 _exception = 1;
1808 _exceptionType = "java/lang/IllegalArgumentException";
1809 _exceptionMessage = "params == null";
1810 goto exit;
1811 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001812 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001813 int _needed;
1814 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001815#if defined(GL_AMBIENT)
1816 case GL_AMBIENT:
1817#endif // defined(GL_AMBIENT)
1818#if defined(GL_DIFFUSE)
1819 case GL_DIFFUSE:
1820#endif // defined(GL_DIFFUSE)
1821#if defined(GL_SPECULAR)
1822 case GL_SPECULAR:
1823#endif // defined(GL_SPECULAR)
1824#if defined(GL_EMISSION)
1825 case GL_EMISSION:
1826#endif // defined(GL_EMISSION)
1827#if defined(GL_AMBIENT_AND_DIFFUSE)
1828 case GL_AMBIENT_AND_DIFFUSE:
1829#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1830 _needed = 4;
1831 break;
1832 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001833 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001834 break;
1835 }
1836 if (_remaining < _needed) {
1837 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001838 _exceptionType = "java/lang/IllegalArgumentException";
1839 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001840 goto exit;
1841 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001842 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001843 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001844 params = (GLfixed *) (_paramsBase + _bufferOffset);
1845 }
Jack Palevich27f80022009-04-15 19:13:17 -07001846 glGetMaterialxv(
1847 (GLenum)face,
1848 (GLenum)pname,
1849 (GLfixed *)params
1850 );
1851
1852exit:
1853 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001854 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07001855 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001856 if (_exception) {
1857 jniThrowException(_env, _exceptionType, _exceptionMessage);
1858 }
Jack Palevich27f80022009-04-15 19:13:17 -07001859}
1860
1861/* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */
1862static void
1863android_glGetTexEnvfv__II_3FI
1864 (JNIEnv *_env, jobject _this, jint env, jint pname, jfloatArray params_ref, jint offset) {
1865 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001866 const char * _exceptionType = NULL;
1867 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001868 GLfloat *params_base = (GLfloat *) 0;
1869 jint _remaining;
1870 GLfloat *params = (GLfloat *) 0;
1871
1872 if (!params_ref) {
1873 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001874 _exceptionType = "java/lang/IllegalArgumentException";
1875 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001876 goto exit;
1877 }
1878 if (offset < 0) {
1879 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001880 _exceptionType = "java/lang/IllegalArgumentException";
1881 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001882 goto exit;
1883 }
1884 _remaining = _env->GetArrayLength(params_ref) - offset;
1885 int _needed;
1886 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001887#if defined(GL_TEXTURE_ENV_COLOR)
1888 case GL_TEXTURE_ENV_COLOR:
1889#endif // defined(GL_TEXTURE_ENV_COLOR)
1890 _needed = 4;
1891 break;
1892 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001893 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001894 break;
1895 }
1896 if (_remaining < _needed) {
1897 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001898 _exceptionType = "java/lang/IllegalArgumentException";
1899 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001900 goto exit;
1901 }
1902 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001903 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001904 params = params_base + offset;
1905
1906 glGetTexEnvfv(
1907 (GLenum)env,
1908 (GLenum)pname,
1909 (GLfloat *)params
1910 );
1911
1912exit:
1913 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001914 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001915 _exception ? JNI_ABORT: 0);
1916 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001917 if (_exception) {
1918 jniThrowException(_env, _exceptionType, _exceptionMessage);
1919 }
Jack Palevich27f80022009-04-15 19:13:17 -07001920}
1921
1922/* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */
1923static void
1924android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2
1925 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
1926 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001927 const char * _exceptionType = NULL;
1928 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001929 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001930 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001931 jint _remaining;
1932 GLfloat *params = (GLfloat *) 0;
1933
Romain Guy84cac202016-12-05 12:26:02 -08001934 if (!params_buf) {
1935 _exception = 1;
1936 _exceptionType = "java/lang/IllegalArgumentException";
1937 _exceptionMessage = "params == null";
1938 goto exit;
1939 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001940 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001941 int _needed;
1942 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001943#if defined(GL_TEXTURE_ENV_COLOR)
1944 case GL_TEXTURE_ENV_COLOR:
1945#endif // defined(GL_TEXTURE_ENV_COLOR)
1946 _needed = 4;
1947 break;
1948 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001949 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001950 break;
1951 }
1952 if (_remaining < _needed) {
1953 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001954 _exceptionType = "java/lang/IllegalArgumentException";
1955 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001956 goto exit;
1957 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001958 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001959 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001960 params = (GLfloat *) (_paramsBase + _bufferOffset);
1961 }
Jack Palevich27f80022009-04-15 19:13:17 -07001962 glGetTexEnvfv(
1963 (GLenum)env,
1964 (GLenum)pname,
1965 (GLfloat *)params
1966 );
1967
1968exit:
1969 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001970 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07001971 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001972 if (_exception) {
1973 jniThrowException(_env, _exceptionType, _exceptionMessage);
1974 }
Jack Palevich27f80022009-04-15 19:13:17 -07001975}
1976
1977/* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */
1978static void
1979android_glGetTexEnviv__II_3II
1980 (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) {
1981 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001982 const char * _exceptionType = NULL;
1983 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001984 GLint *params_base = (GLint *) 0;
1985 jint _remaining;
1986 GLint *params = (GLint *) 0;
1987
1988 if (!params_ref) {
1989 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001990 _exceptionType = "java/lang/IllegalArgumentException";
1991 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001992 goto exit;
1993 }
1994 if (offset < 0) {
1995 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001996 _exceptionType = "java/lang/IllegalArgumentException";
1997 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001998 goto exit;
1999 }
2000 _remaining = _env->GetArrayLength(params_ref) - offset;
2001 int _needed;
2002 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002003#if defined(GL_TEXTURE_ENV_COLOR)
2004 case GL_TEXTURE_ENV_COLOR:
2005#endif // defined(GL_TEXTURE_ENV_COLOR)
2006 _needed = 4;
2007 break;
2008 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002009 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002010 break;
2011 }
2012 if (_remaining < _needed) {
2013 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002014 _exceptionType = "java/lang/IllegalArgumentException";
2015 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002016 goto exit;
2017 }
2018 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002019 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002020 params = params_base + offset;
2021
2022 glGetTexEnviv(
2023 (GLenum)env,
2024 (GLenum)pname,
2025 (GLint *)params
2026 );
2027
2028exit:
2029 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002030 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002031 _exception ? JNI_ABORT: 0);
2032 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002033 if (_exception) {
2034 jniThrowException(_env, _exceptionType, _exceptionMessage);
2035 }
Jack Palevich27f80022009-04-15 19:13:17 -07002036}
2037
2038/* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */
2039static void
2040android_glGetTexEnviv__IILjava_nio_IntBuffer_2
2041 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
2042 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002043 const char * _exceptionType = NULL;
2044 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002045 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002046 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002047 jint _remaining;
2048 GLint *params = (GLint *) 0;
2049
Romain Guy84cac202016-12-05 12:26:02 -08002050 if (!params_buf) {
2051 _exception = 1;
2052 _exceptionType = "java/lang/IllegalArgumentException";
2053 _exceptionMessage = "params == null";
2054 goto exit;
2055 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002056 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002057 int _needed;
2058 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002059#if defined(GL_TEXTURE_ENV_COLOR)
2060 case GL_TEXTURE_ENV_COLOR:
2061#endif // defined(GL_TEXTURE_ENV_COLOR)
2062 _needed = 4;
2063 break;
2064 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002065 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002066 break;
2067 }
2068 if (_remaining < _needed) {
2069 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002070 _exceptionType = "java/lang/IllegalArgumentException";
2071 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002072 goto exit;
2073 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002074 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002075 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002076 params = (GLint *) (_paramsBase + _bufferOffset);
2077 }
Jack Palevich27f80022009-04-15 19:13:17 -07002078 glGetTexEnviv(
2079 (GLenum)env,
2080 (GLenum)pname,
2081 (GLint *)params
2082 );
2083
2084exit:
2085 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002086 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07002087 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002088 if (_exception) {
2089 jniThrowException(_env, _exceptionType, _exceptionMessage);
2090 }
Jack Palevich27f80022009-04-15 19:13:17 -07002091}
2092
2093/* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */
2094static void
2095android_glGetTexEnvxv__II_3II
2096 (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) {
2097 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002098 const char * _exceptionType = NULL;
2099 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002100 GLfixed *params_base = (GLfixed *) 0;
2101 jint _remaining;
2102 GLfixed *params = (GLfixed *) 0;
2103
2104 if (!params_ref) {
2105 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002106 _exceptionType = "java/lang/IllegalArgumentException";
2107 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002108 goto exit;
2109 }
2110 if (offset < 0) {
2111 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002112 _exceptionType = "java/lang/IllegalArgumentException";
2113 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002114 goto exit;
2115 }
2116 _remaining = _env->GetArrayLength(params_ref) - offset;
2117 int _needed;
2118 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002119#if defined(GL_TEXTURE_ENV_COLOR)
2120 case GL_TEXTURE_ENV_COLOR:
2121#endif // defined(GL_TEXTURE_ENV_COLOR)
2122 _needed = 4;
2123 break;
2124 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002125 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002126 break;
2127 }
2128 if (_remaining < _needed) {
2129 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002130 _exceptionType = "java/lang/IllegalArgumentException";
2131 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002132 goto exit;
2133 }
2134 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002135 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002136 params = params_base + offset;
2137
2138 glGetTexEnvxv(
2139 (GLenum)env,
2140 (GLenum)pname,
2141 (GLfixed *)params
2142 );
2143
2144exit:
2145 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002146 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002147 _exception ? JNI_ABORT: 0);
2148 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002149 if (_exception) {
2150 jniThrowException(_env, _exceptionType, _exceptionMessage);
2151 }
Jack Palevich27f80022009-04-15 19:13:17 -07002152}
2153
2154/* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */
2155static void
2156android_glGetTexEnvxv__IILjava_nio_IntBuffer_2
2157 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
2158 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002159 const char * _exceptionType = NULL;
2160 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002161 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002162 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002163 jint _remaining;
2164 GLfixed *params = (GLfixed *) 0;
2165
Romain Guy84cac202016-12-05 12:26:02 -08002166 if (!params_buf) {
2167 _exception = 1;
2168 _exceptionType = "java/lang/IllegalArgumentException";
2169 _exceptionMessage = "params == null";
2170 goto exit;
2171 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002172 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002173 int _needed;
2174 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002175#if defined(GL_TEXTURE_ENV_COLOR)
2176 case GL_TEXTURE_ENV_COLOR:
2177#endif // defined(GL_TEXTURE_ENV_COLOR)
2178 _needed = 4;
2179 break;
2180 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002181 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002182 break;
2183 }
2184 if (_remaining < _needed) {
2185 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002186 _exceptionType = "java/lang/IllegalArgumentException";
2187 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002188 goto exit;
2189 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002190 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002191 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002192 params = (GLfixed *) (_paramsBase + _bufferOffset);
2193 }
Jack Palevich27f80022009-04-15 19:13:17 -07002194 glGetTexEnvxv(
2195 (GLenum)env,
2196 (GLenum)pname,
2197 (GLfixed *)params
2198 );
2199
2200exit:
2201 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002202 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07002203 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002204 if (_exception) {
2205 jniThrowException(_env, _exceptionType, _exceptionMessage);
2206 }
Jack Palevich27f80022009-04-15 19:13:17 -07002207}
2208
2209/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
2210static void
2211android_glGetTexParameterfv__II_3FI
2212 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
2213 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002214 const char * _exceptionType = NULL;
2215 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002216 GLfloat *params_base = (GLfloat *) 0;
2217 jint _remaining;
2218 GLfloat *params = (GLfloat *) 0;
2219
2220 if (!params_ref) {
2221 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002222 _exceptionType = "java/lang/IllegalArgumentException";
2223 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002224 goto exit;
2225 }
2226 if (offset < 0) {
2227 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002228 _exceptionType = "java/lang/IllegalArgumentException";
2229 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002230 goto exit;
2231 }
2232 _remaining = _env->GetArrayLength(params_ref) - offset;
2233 if (_remaining < 1) {
2234 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002235 _exceptionType = "java/lang/IllegalArgumentException";
2236 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002237 goto exit;
2238 }
2239 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002240 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002241 params = params_base + offset;
2242
2243 glGetTexParameterfv(
2244 (GLenum)target,
2245 (GLenum)pname,
2246 (GLfloat *)params
2247 );
2248
2249exit:
2250 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002251 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002252 _exception ? JNI_ABORT: 0);
2253 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002254 if (_exception) {
2255 jniThrowException(_env, _exceptionType, _exceptionMessage);
2256 }
Jack Palevich27f80022009-04-15 19:13:17 -07002257}
2258
2259/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
2260static void
2261android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2
2262 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2263 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002264 const char * _exceptionType = NULL;
2265 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002266 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002267 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002268 jint _remaining;
2269 GLfloat *params = (GLfloat *) 0;
2270
Romain Guy84cac202016-12-05 12:26:02 -08002271 if (!params_buf) {
2272 _exception = 1;
2273 _exceptionType = "java/lang/IllegalArgumentException";
2274 _exceptionMessage = "params == null";
2275 goto exit;
2276 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002277 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002278 if (_remaining < 1) {
2279 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002280 _exceptionType = "java/lang/IllegalArgumentException";
2281 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002282 goto exit;
2283 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002284 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002285 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002286 params = (GLfloat *) (_paramsBase + _bufferOffset);
2287 }
Jack Palevich27f80022009-04-15 19:13:17 -07002288 glGetTexParameterfv(
2289 (GLenum)target,
2290 (GLenum)pname,
2291 (GLfloat *)params
2292 );
2293
2294exit:
2295 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002296 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07002297 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002298 if (_exception) {
2299 jniThrowException(_env, _exceptionType, _exceptionMessage);
2300 }
Jack Palevich27f80022009-04-15 19:13:17 -07002301}
2302
2303/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2304static void
2305android_glGetTexParameteriv__II_3II
2306 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2307 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002308 const char * _exceptionType = NULL;
2309 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002310 GLint *params_base = (GLint *) 0;
2311 jint _remaining;
2312 GLint *params = (GLint *) 0;
2313
2314 if (!params_ref) {
2315 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002316 _exceptionType = "java/lang/IllegalArgumentException";
2317 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002318 goto exit;
2319 }
2320 if (offset < 0) {
2321 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002322 _exceptionType = "java/lang/IllegalArgumentException";
2323 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002324 goto exit;
2325 }
2326 _remaining = _env->GetArrayLength(params_ref) - offset;
2327 if (_remaining < 1) {
2328 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002329 _exceptionType = "java/lang/IllegalArgumentException";
2330 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002331 goto exit;
2332 }
2333 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002334 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002335 params = params_base + offset;
2336
2337 glGetTexParameteriv(
2338 (GLenum)target,
2339 (GLenum)pname,
2340 (GLint *)params
2341 );
2342
2343exit:
2344 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002345 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002346 _exception ? JNI_ABORT: 0);
2347 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002348 if (_exception) {
2349 jniThrowException(_env, _exceptionType, _exceptionMessage);
2350 }
Jack Palevich27f80022009-04-15 19:13:17 -07002351}
2352
2353/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2354static void
2355android_glGetTexParameteriv__IILjava_nio_IntBuffer_2
2356 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2357 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002358 const char * _exceptionType = NULL;
2359 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002360 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002361 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002362 jint _remaining;
2363 GLint *params = (GLint *) 0;
2364
Romain Guy84cac202016-12-05 12:26:02 -08002365 if (!params_buf) {
2366 _exception = 1;
2367 _exceptionType = "java/lang/IllegalArgumentException";
2368 _exceptionMessage = "params == null";
2369 goto exit;
2370 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002371 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002372 if (_remaining < 1) {
2373 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002374 _exceptionType = "java/lang/IllegalArgumentException";
2375 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002376 goto exit;
2377 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002378 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002379 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002380 params = (GLint *) (_paramsBase + _bufferOffset);
2381 }
Jack Palevich27f80022009-04-15 19:13:17 -07002382 glGetTexParameteriv(
2383 (GLenum)target,
2384 (GLenum)pname,
2385 (GLint *)params
2386 );
2387
2388exit:
2389 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002390 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07002391 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002392 if (_exception) {
2393 jniThrowException(_env, _exceptionType, _exceptionMessage);
2394 }
Jack Palevich27f80022009-04-15 19:13:17 -07002395}
2396
2397/* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */
2398static void
2399android_glGetTexParameterxv__II_3II
2400 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2401 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002402 const char * _exceptionType = NULL;
2403 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002404 GLfixed *params_base = (GLfixed *) 0;
2405 jint _remaining;
2406 GLfixed *params = (GLfixed *) 0;
2407
2408 if (!params_ref) {
2409 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002410 _exceptionType = "java/lang/IllegalArgumentException";
2411 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002412 goto exit;
2413 }
2414 if (offset < 0) {
2415 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002416 _exceptionType = "java/lang/IllegalArgumentException";
2417 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002418 goto exit;
2419 }
2420 _remaining = _env->GetArrayLength(params_ref) - offset;
2421 if (_remaining < 1) {
2422 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002423 _exceptionType = "java/lang/IllegalArgumentException";
2424 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002425 goto exit;
2426 }
2427 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002428 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002429 params = params_base + offset;
2430
2431 glGetTexParameterxv(
2432 (GLenum)target,
2433 (GLenum)pname,
2434 (GLfixed *)params
2435 );
2436
2437exit:
2438 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002439 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002440 _exception ? JNI_ABORT: 0);
2441 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002442 if (_exception) {
2443 jniThrowException(_env, _exceptionType, _exceptionMessage);
2444 }
Jack Palevich27f80022009-04-15 19:13:17 -07002445}
2446
2447/* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */
2448static void
2449android_glGetTexParameterxv__IILjava_nio_IntBuffer_2
2450 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2451 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002452 const char * _exceptionType = NULL;
2453 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002454 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002455 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002456 jint _remaining;
2457 GLfixed *params = (GLfixed *) 0;
2458
Romain Guy84cac202016-12-05 12:26:02 -08002459 if (!params_buf) {
2460 _exception = 1;
2461 _exceptionType = "java/lang/IllegalArgumentException";
2462 _exceptionMessage = "params == null";
2463 goto exit;
2464 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002465 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002466 if (_remaining < 1) {
2467 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002468 _exceptionType = "java/lang/IllegalArgumentException";
2469 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002470 goto exit;
2471 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002472 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002473 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002474 params = (GLfixed *) (_paramsBase + _bufferOffset);
2475 }
Jack Palevich27f80022009-04-15 19:13:17 -07002476 glGetTexParameterxv(
2477 (GLenum)target,
2478 (GLenum)pname,
2479 (GLfixed *)params
2480 );
2481
2482exit:
2483 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002484 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07002485 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002486 if (_exception) {
2487 jniThrowException(_env, _exceptionType, _exceptionMessage);
2488 }
Jack Palevich27f80022009-04-15 19:13:17 -07002489}
2490
2491/* GLboolean glIsBuffer ( GLuint buffer ) */
2492static jboolean
2493android_glIsBuffer__I
2494 (JNIEnv *_env, jobject _this, jint buffer) {
2495 GLboolean _returnValue;
2496 _returnValue = glIsBuffer(
2497 (GLuint)buffer
2498 );
Andy McFaddencee51982013-04-25 16:08:31 -07002499 return (jboolean)_returnValue;
Jack Palevich27f80022009-04-15 19:13:17 -07002500}
2501
2502/* GLboolean glIsEnabled ( GLenum cap ) */
2503static jboolean
2504android_glIsEnabled__I
2505 (JNIEnv *_env, jobject _this, jint cap) {
2506 GLboolean _returnValue;
2507 _returnValue = glIsEnabled(
2508 (GLenum)cap
2509 );
Andy McFaddencee51982013-04-25 16:08:31 -07002510 return (jboolean)_returnValue;
Jack Palevich27f80022009-04-15 19:13:17 -07002511}
2512
2513/* GLboolean glIsTexture ( GLuint texture ) */
2514static jboolean
2515android_glIsTexture__I
2516 (JNIEnv *_env, jobject _this, jint texture) {
2517 GLboolean _returnValue;
2518 _returnValue = glIsTexture(
2519 (GLuint)texture
2520 );
Andy McFaddencee51982013-04-25 16:08:31 -07002521 return (jboolean)_returnValue;
Jack Palevich27f80022009-04-15 19:13:17 -07002522}
2523
2524/* void glNormalPointer ( GLenum type, GLsizei stride, GLint offset ) */
2525static void
2526android_glNormalPointer__III
2527 (JNIEnv *_env, jobject _this, jint type, jint stride, jint offset) {
2528 glNormalPointer(
2529 (GLenum)type,
2530 (GLsizei)stride,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00002531 reinterpret_cast<GLvoid *>(offset)
Jack Palevich27f80022009-04-15 19:13:17 -07002532 );
2533}
2534
2535/* void glPointParameterf ( GLenum pname, GLfloat param ) */
2536static void
2537android_glPointParameterf__IF
2538 (JNIEnv *_env, jobject _this, jint pname, jfloat param) {
2539 glPointParameterf(
2540 (GLenum)pname,
2541 (GLfloat)param
2542 );
2543}
2544
2545/* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */
2546static void
2547android_glPointParameterfv__I_3FI
2548 (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002549 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002550 const char * _exceptionType = NULL;
2551 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002552 GLfloat *params_base = (GLfloat *) 0;
2553 jint _remaining;
2554 GLfloat *params = (GLfloat *) 0;
2555
2556 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002557 _exception = 1;
2558 _exceptionType = "java/lang/IllegalArgumentException";
2559 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002560 goto exit;
2561 }
2562 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002563 _exception = 1;
2564 _exceptionType = "java/lang/IllegalArgumentException";
2565 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002566 goto exit;
2567 }
2568 _remaining = _env->GetArrayLength(params_ref) - offset;
2569 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002570 _exception = 1;
2571 _exceptionType = "java/lang/IllegalArgumentException";
2572 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002573 goto exit;
2574 }
2575 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002576 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002577 params = params_base + offset;
2578
2579 glPointParameterfv(
2580 (GLenum)pname,
2581 (GLfloat *)params
2582 );
2583
2584exit:
2585 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002586 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002587 JNI_ABORT);
2588 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002589 if (_exception) {
2590 jniThrowException(_env, _exceptionType, _exceptionMessage);
2591 }
Jack Palevich27f80022009-04-15 19:13:17 -07002592}
2593
2594/* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */
2595static void
2596android_glPointParameterfv__ILjava_nio_FloatBuffer_2
2597 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002598 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002599 const char * _exceptionType = NULL;
2600 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002601 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002602 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002603 jint _remaining;
2604 GLfloat *params = (GLfloat *) 0;
2605
Romain Guy84cac202016-12-05 12:26:02 -08002606 if (!params_buf) {
2607 _exception = 1;
2608 _exceptionType = "java/lang/IllegalArgumentException";
2609 _exceptionMessage = "params == null";
2610 goto exit;
2611 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002612 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002613 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002614 _exception = 1;
2615 _exceptionType = "java/lang/IllegalArgumentException";
2616 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002617 goto exit;
2618 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002619 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002620 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002621 params = (GLfloat *) (_paramsBase + _bufferOffset);
2622 }
Jack Palevich27f80022009-04-15 19:13:17 -07002623 glPointParameterfv(
2624 (GLenum)pname,
2625 (GLfloat *)params
2626 );
2627
2628exit:
2629 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002630 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07002631 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002632 if (_exception) {
2633 jniThrowException(_env, _exceptionType, _exceptionMessage);
2634 }
Jack Palevich27f80022009-04-15 19:13:17 -07002635}
2636
2637/* void glPointParameterx ( GLenum pname, GLfixed param ) */
2638static void
2639android_glPointParameterx__II
2640 (JNIEnv *_env, jobject _this, jint pname, jint param) {
2641 glPointParameterx(
2642 (GLenum)pname,
2643 (GLfixed)param
2644 );
2645}
2646
2647/* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */
2648static void
2649android_glPointParameterxv__I_3II
2650 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002651 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002652 const char * _exceptionType = NULL;
2653 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002654 GLfixed *params_base = (GLfixed *) 0;
2655 jint _remaining;
2656 GLfixed *params = (GLfixed *) 0;
2657
2658 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002659 _exception = 1;
2660 _exceptionType = "java/lang/IllegalArgumentException";
2661 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002662 goto exit;
2663 }
2664 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002665 _exception = 1;
2666 _exceptionType = "java/lang/IllegalArgumentException";
2667 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002668 goto exit;
2669 }
2670 _remaining = _env->GetArrayLength(params_ref) - offset;
2671 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002672 _exception = 1;
2673 _exceptionType = "java/lang/IllegalArgumentException";
2674 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002675 goto exit;
2676 }
2677 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002678 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002679 params = params_base + offset;
2680
2681 glPointParameterxv(
2682 (GLenum)pname,
2683 (GLfixed *)params
2684 );
2685
2686exit:
2687 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002688 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002689 JNI_ABORT);
2690 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002691 if (_exception) {
2692 jniThrowException(_env, _exceptionType, _exceptionMessage);
2693 }
Jack Palevich27f80022009-04-15 19:13:17 -07002694}
2695
2696/* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */
2697static void
2698android_glPointParameterxv__ILjava_nio_IntBuffer_2
2699 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002700 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002701 const char * _exceptionType = NULL;
2702 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002703 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002704 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002705 jint _remaining;
2706 GLfixed *params = (GLfixed *) 0;
2707
Romain Guy84cac202016-12-05 12:26:02 -08002708 if (!params_buf) {
2709 _exception = 1;
2710 _exceptionType = "java/lang/IllegalArgumentException";
2711 _exceptionMessage = "params == null";
2712 goto exit;
2713 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002714 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002715 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002716 _exception = 1;
2717 _exceptionType = "java/lang/IllegalArgumentException";
2718 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002719 goto exit;
2720 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002721 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002722 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002723 params = (GLfixed *) (_paramsBase + _bufferOffset);
2724 }
Jack Palevich27f80022009-04-15 19:13:17 -07002725 glPointParameterxv(
2726 (GLenum)pname,
2727 (GLfixed *)params
2728 );
2729
2730exit:
2731 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002732 _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07002733 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002734 if (_exception) {
2735 jniThrowException(_env, _exceptionType, _exceptionMessage);
2736 }
Jack Palevich27f80022009-04-15 19:13:17 -07002737}
2738
2739/* void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) */
2740static void
Jack Palevichbe6eac82009-12-08 15:43:51 +08002741android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I
2742 (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) {
Romain Guy84cac202016-12-05 12:26:02 -08002743 jint _exception = 0;
2744 const char * _exceptionType = NULL;
2745 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002746 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002747 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002748 jint _remaining;
2749 GLvoid *pointer = (GLvoid *) 0;
2750
Jack Palevichbe6eac82009-12-08 15:43:51 +08002751 if (pointer_buf) {
2752 pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
2753 if ( ! pointer ) {
2754 return;
2755 }
2756 }
2757 glPointSizePointerOESBounds(
Jack Palevich27f80022009-04-15 19:13:17 -07002758 (GLenum)type,
2759 (GLsizei)stride,
Jack Palevichbe6eac82009-12-08 15:43:51 +08002760 (GLvoid *)pointer,
2761 (GLsizei)remaining
Jack Palevich27f80022009-04-15 19:13:17 -07002762 );
Romain Guy84cac202016-12-05 12:26:02 -08002763 if (_exception) {
2764 jniThrowException(_env, _exceptionType, _exceptionMessage);
2765 }
Jack Palevich27f80022009-04-15 19:13:17 -07002766}
2767
2768/* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
2769static void
2770android_glTexCoordPointer__IIII
2771 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
2772 glTexCoordPointer(
2773 (GLint)size,
2774 (GLenum)type,
2775 (GLsizei)stride,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00002776 reinterpret_cast<GLvoid *>(offset)
Jack Palevich27f80022009-04-15 19:13:17 -07002777 );
2778}
2779
2780/* void glTexEnvi ( GLenum target, GLenum pname, GLint param ) */
2781static void
2782android_glTexEnvi__III
2783 (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
2784 glTexEnvi(
2785 (GLenum)target,
2786 (GLenum)pname,
2787 (GLint)param
2788 );
2789}
2790
2791/* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */
2792static void
2793android_glTexEnviv__II_3II
2794 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002795 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002796 const char * _exceptionType = NULL;
2797 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002798 GLint *params_base = (GLint *) 0;
2799 jint _remaining;
2800 GLint *params = (GLint *) 0;
2801
2802 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002803 _exception = 1;
2804 _exceptionType = "java/lang/IllegalArgumentException";
2805 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002806 goto exit;
2807 }
2808 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002809 _exception = 1;
2810 _exceptionType = "java/lang/IllegalArgumentException";
2811 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002812 goto exit;
2813 }
2814 _remaining = _env->GetArrayLength(params_ref) - offset;
2815 int _needed;
2816 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002817#if defined(GL_TEXTURE_ENV_COLOR)
2818 case GL_TEXTURE_ENV_COLOR:
2819#endif // defined(GL_TEXTURE_ENV_COLOR)
2820 _needed = 4;
2821 break;
2822 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002823 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002824 break;
2825 }
2826 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002827 _exception = 1;
2828 _exceptionType = "java/lang/IllegalArgumentException";
2829 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002830 goto exit;
2831 }
2832 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002833 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002834 params = params_base + offset;
2835
2836 glTexEnviv(
2837 (GLenum)target,
2838 (GLenum)pname,
2839 (GLint *)params
2840 );
2841
2842exit:
2843 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002844 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002845 JNI_ABORT);
2846 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002847 if (_exception) {
2848 jniThrowException(_env, _exceptionType, _exceptionMessage);
2849 }
Jack Palevich27f80022009-04-15 19:13:17 -07002850}
2851
2852/* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */
2853static void
2854android_glTexEnviv__IILjava_nio_IntBuffer_2
2855 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002856 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002857 const char * _exceptionType = NULL;
2858 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002859 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002860 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002861 jint _remaining;
2862 GLint *params = (GLint *) 0;
2863
Romain Guy84cac202016-12-05 12:26:02 -08002864 if (!params_buf) {
2865 _exception = 1;
2866 _exceptionType = "java/lang/IllegalArgumentException";
2867 _exceptionMessage = "params == null";
2868 goto exit;
2869 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002870 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002871 int _needed;
2872 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002873#if defined(GL_TEXTURE_ENV_COLOR)
2874 case GL_TEXTURE_ENV_COLOR:
2875#endif // defined(GL_TEXTURE_ENV_COLOR)
2876 _needed = 4;
2877 break;
2878 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002879 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002880 break;
2881 }
2882 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002883 _exception = 1;
2884 _exceptionType = "java/lang/IllegalArgumentException";
2885 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002886 goto exit;
2887 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002888 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002889 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002890 params = (GLint *) (_paramsBase + _bufferOffset);
2891 }
Jack Palevich27f80022009-04-15 19:13:17 -07002892 glTexEnviv(
2893 (GLenum)target,
2894 (GLenum)pname,
2895 (GLint *)params
2896 );
2897
2898exit:
2899 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002900 _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07002901 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002902 if (_exception) {
2903 jniThrowException(_env, _exceptionType, _exceptionMessage);
2904 }
Jack Palevich27f80022009-04-15 19:13:17 -07002905}
2906
2907/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
2908static void
2909android_glTexParameterfv__II_3FI
2910 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002911 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002912 const char * _exceptionType = NULL;
2913 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002914 GLfloat *params_base = (GLfloat *) 0;
2915 jint _remaining;
2916 GLfloat *params = (GLfloat *) 0;
2917
2918 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002919 _exception = 1;
2920 _exceptionType = "java/lang/IllegalArgumentException";
2921 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002922 goto exit;
2923 }
2924 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002925 _exception = 1;
2926 _exceptionType = "java/lang/IllegalArgumentException";
2927 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002928 goto exit;
2929 }
2930 _remaining = _env->GetArrayLength(params_ref) - offset;
2931 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002932 _exception = 1;
2933 _exceptionType = "java/lang/IllegalArgumentException";
2934 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002935 goto exit;
2936 }
2937 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002938 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002939 params = params_base + offset;
2940
2941 glTexParameterfv(
2942 (GLenum)target,
2943 (GLenum)pname,
2944 (GLfloat *)params
2945 );
2946
2947exit:
2948 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002949 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002950 JNI_ABORT);
2951 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002952 if (_exception) {
2953 jniThrowException(_env, _exceptionType, _exceptionMessage);
2954 }
Jack Palevich27f80022009-04-15 19:13:17 -07002955}
2956
2957/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
2958static void
2959android_glTexParameterfv__IILjava_nio_FloatBuffer_2
2960 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002961 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002962 const char * _exceptionType = NULL;
2963 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002964 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002965 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002966 jint _remaining;
2967 GLfloat *params = (GLfloat *) 0;
2968
Romain Guy84cac202016-12-05 12:26:02 -08002969 if (!params_buf) {
2970 _exception = 1;
2971 _exceptionType = "java/lang/IllegalArgumentException";
2972 _exceptionMessage = "params == null";
2973 goto exit;
2974 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002975 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002976 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002977 _exception = 1;
2978 _exceptionType = "java/lang/IllegalArgumentException";
2979 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002980 goto exit;
2981 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002982 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002983 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002984 params = (GLfloat *) (_paramsBase + _bufferOffset);
2985 }
Jack Palevich27f80022009-04-15 19:13:17 -07002986 glTexParameterfv(
2987 (GLenum)target,
2988 (GLenum)pname,
2989 (GLfloat *)params
2990 );
2991
2992exit:
2993 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002994 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07002995 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002996 if (_exception) {
2997 jniThrowException(_env, _exceptionType, _exceptionMessage);
2998 }
Jack Palevich27f80022009-04-15 19:13:17 -07002999}
3000
3001/* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */
3002static void
3003android_glTexParameteri__III
3004 (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
3005 glTexParameteri(
3006 (GLenum)target,
3007 (GLenum)pname,
3008 (GLint)param
3009 );
3010}
3011
3012/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
3013static void
3014android_glTexParameteriv__II_3II
3015 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003016 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003017 const char * _exceptionType = NULL;
3018 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07003019 GLint *params_base = (GLint *) 0;
3020 jint _remaining;
3021 GLint *params = (GLint *) 0;
3022
3023 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003024 _exception = 1;
3025 _exceptionType = "java/lang/IllegalArgumentException";
3026 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07003027 goto exit;
3028 }
3029 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003030 _exception = 1;
3031 _exceptionType = "java/lang/IllegalArgumentException";
3032 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07003033 goto exit;
3034 }
3035 _remaining = _env->GetArrayLength(params_ref) - offset;
3036 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003037 _exception = 1;
3038 _exceptionType = "java/lang/IllegalArgumentException";
3039 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07003040 goto exit;
3041 }
3042 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003043 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07003044 params = params_base + offset;
3045
3046 glTexParameteriv(
3047 (GLenum)target,
3048 (GLenum)pname,
3049 (GLint *)params
3050 );
3051
3052exit:
3053 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003054 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07003055 JNI_ABORT);
3056 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003057 if (_exception) {
3058 jniThrowException(_env, _exceptionType, _exceptionMessage);
3059 }
Jack Palevich27f80022009-04-15 19:13:17 -07003060}
3061
3062/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
3063static void
3064android_glTexParameteriv__IILjava_nio_IntBuffer_2
3065 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003066 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003067 const char * _exceptionType = NULL;
3068 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003069 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003070 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07003071 jint _remaining;
3072 GLint *params = (GLint *) 0;
3073
Romain Guy84cac202016-12-05 12:26:02 -08003074 if (!params_buf) {
3075 _exception = 1;
3076 _exceptionType = "java/lang/IllegalArgumentException";
3077 _exceptionMessage = "params == null";
3078 goto exit;
3079 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003080 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07003081 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003082 _exception = 1;
3083 _exceptionType = "java/lang/IllegalArgumentException";
3084 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07003085 goto exit;
3086 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003087 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003088 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003089 params = (GLint *) (_paramsBase + _bufferOffset);
3090 }
Jack Palevich27f80022009-04-15 19:13:17 -07003091 glTexParameteriv(
3092 (GLenum)target,
3093 (GLenum)pname,
3094 (GLint *)params
3095 );
3096
3097exit:
3098 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003099 _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07003100 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003101 if (_exception) {
3102 jniThrowException(_env, _exceptionType, _exceptionMessage);
3103 }
Jack Palevich27f80022009-04-15 19:13:17 -07003104}
3105
3106/* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */
3107static void
3108android_glTexParameterxv__II_3II
3109 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003110 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003111 const char * _exceptionType = NULL;
3112 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07003113 GLfixed *params_base = (GLfixed *) 0;
3114 jint _remaining;
3115 GLfixed *params = (GLfixed *) 0;
3116
3117 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003118 _exception = 1;
3119 _exceptionType = "java/lang/IllegalArgumentException";
3120 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07003121 goto exit;
3122 }
3123 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003124 _exception = 1;
3125 _exceptionType = "java/lang/IllegalArgumentException";
3126 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07003127 goto exit;
3128 }
3129 _remaining = _env->GetArrayLength(params_ref) - offset;
3130 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003131 _exception = 1;
3132 _exceptionType = "java/lang/IllegalArgumentException";
3133 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07003134 goto exit;
3135 }
3136 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003137 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07003138 params = params_base + offset;
3139
3140 glTexParameterxv(
3141 (GLenum)target,
3142 (GLenum)pname,
3143 (GLfixed *)params
3144 );
3145
3146exit:
3147 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003148 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07003149 JNI_ABORT);
3150 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003151 if (_exception) {
3152 jniThrowException(_env, _exceptionType, _exceptionMessage);
3153 }
Jack Palevich27f80022009-04-15 19:13:17 -07003154}
3155
3156/* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */
3157static void
3158android_glTexParameterxv__IILjava_nio_IntBuffer_2
3159 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003160 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003161 const char * _exceptionType = NULL;
3162 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003163 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003164 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07003165 jint _remaining;
3166 GLfixed *params = (GLfixed *) 0;
3167
Romain Guy84cac202016-12-05 12:26:02 -08003168 if (!params_buf) {
3169 _exception = 1;
3170 _exceptionType = "java/lang/IllegalArgumentException";
3171 _exceptionMessage = "params == null";
3172 goto exit;
3173 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003174 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07003175 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003176 _exception = 1;
3177 _exceptionType = "java/lang/IllegalArgumentException";
3178 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07003179 goto exit;
3180 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003181 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003182 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003183 params = (GLfixed *) (_paramsBase + _bufferOffset);
3184 }
Jack Palevich27f80022009-04-15 19:13:17 -07003185 glTexParameterxv(
3186 (GLenum)target,
3187 (GLenum)pname,
3188 (GLfixed *)params
3189 );
3190
3191exit:
3192 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003193 _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07003194 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003195 if (_exception) {
3196 jniThrowException(_env, _exceptionType, _exceptionMessage);
3197 }
Jack Palevich27f80022009-04-15 19:13:17 -07003198}
3199
3200/* void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
3201static void
3202android_glVertexPointer__IIII
3203 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
3204 glVertexPointer(
3205 (GLint)size,
3206 (GLenum)type,
3207 (GLsizei)stride,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00003208 reinterpret_cast<GLvoid *>(offset)
Jack Palevich27f80022009-04-15 19:13:17 -07003209 );
3210}
3211
3212static const char *classPathName = "android/opengl/GLES11";
3213
Daniel Micay76f6a862015-09-19 17:31:01 -04003214static const JNINativeMethod methods[] = {
Jack Palevich27f80022009-04-15 19:13:17 -07003215{"_nativeClassInit", "()V", (void*)nativeClassInit },
3216{"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II },
3217{"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I },
3218{"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 },
3219{"glClipPlanef", "(I[FI)V", (void *) android_glClipPlanef__I_3FI },
3220{"glClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glClipPlanef__ILjava_nio_FloatBuffer_2 },
3221{"glClipPlanex", "(I[II)V", (void *) android_glClipPlanex__I_3II },
3222{"glClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glClipPlanex__ILjava_nio_IntBuffer_2 },
3223{"glColor4ub", "(BBBB)V", (void *) android_glColor4ub__BBBB },
3224{"glColorPointer", "(IIII)V", (void *) android_glColorPointer__IIII },
3225{"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II },
3226{"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 },
3227{"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII },
3228{"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II },
3229{"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 },
3230{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI },
3231{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 },
3232{"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II },
3233{"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 },
3234{"glGetClipPlanef", "(I[FI)V", (void *) android_glGetClipPlanef__I_3FI },
3235{"glGetClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetClipPlanef__ILjava_nio_FloatBuffer_2 },
3236{"glGetClipPlanex", "(I[II)V", (void *) android_glGetClipPlanex__I_3II },
3237{"glGetClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetClipPlanex__ILjava_nio_IntBuffer_2 },
3238{"glGetFixedv", "(I[II)V", (void *) android_glGetFixedv__I_3II },
3239{"glGetFixedv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetFixedv__ILjava_nio_IntBuffer_2 },
3240{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI },
3241{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 },
3242{"glGetLightfv", "(II[FI)V", (void *) android_glGetLightfv__II_3FI },
3243{"glGetLightfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetLightfv__IILjava_nio_FloatBuffer_2 },
3244{"glGetLightxv", "(II[II)V", (void *) android_glGetLightxv__II_3II },
3245{"glGetLightxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetLightxv__IILjava_nio_IntBuffer_2 },
3246{"glGetMaterialfv", "(II[FI)V", (void *) android_glGetMaterialfv__II_3FI },
3247{"glGetMaterialfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetMaterialfv__IILjava_nio_FloatBuffer_2 },
3248{"glGetMaterialxv", "(II[II)V", (void *) android_glGetMaterialxv__II_3II },
3249{"glGetMaterialxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetMaterialxv__IILjava_nio_IntBuffer_2 },
3250{"glGetTexEnvfv", "(II[FI)V", (void *) android_glGetTexEnvfv__II_3FI },
3251{"glGetTexEnvfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2 },
3252{"glGetTexEnviv", "(II[II)V", (void *) android_glGetTexEnviv__II_3II },
3253{"glGetTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnviv__IILjava_nio_IntBuffer_2 },
3254{"glGetTexEnvxv", "(II[II)V", (void *) android_glGetTexEnvxv__II_3II },
3255{"glGetTexEnvxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnvxv__IILjava_nio_IntBuffer_2 },
3256{"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI },
3257{"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 },
3258{"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II },
3259{"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 },
3260{"glGetTexParameterxv", "(II[II)V", (void *) android_glGetTexParameterxv__II_3II },
3261{"glGetTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameterxv__IILjava_nio_IntBuffer_2 },
3262{"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I },
3263{"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I },
3264{"glIsTexture", "(I)Z", (void *) android_glIsTexture__I },
3265{"glNormalPointer", "(III)V", (void *) android_glNormalPointer__III },
3266{"glPointParameterf", "(IF)V", (void *) android_glPointParameterf__IF },
3267{"glPointParameterfv", "(I[FI)V", (void *) android_glPointParameterfv__I_3FI },
3268{"glPointParameterfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glPointParameterfv__ILjava_nio_FloatBuffer_2 },
3269{"glPointParameterx", "(II)V", (void *) android_glPointParameterx__II },
3270{"glPointParameterxv", "(I[II)V", (void *) android_glPointParameterxv__I_3II },
3271{"glPointParameterxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glPointParameterxv__ILjava_nio_IntBuffer_2 },
Jack Palevichbe6eac82009-12-08 15:43:51 +08003272{"glPointSizePointerOESBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I },
Jack Palevich27f80022009-04-15 19:13:17 -07003273{"glTexCoordPointer", "(IIII)V", (void *) android_glTexCoordPointer__IIII },
3274{"glTexEnvi", "(III)V", (void *) android_glTexEnvi__III },
3275{"glTexEnviv", "(II[II)V", (void *) android_glTexEnviv__II_3II },
3276{"glTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexEnviv__IILjava_nio_IntBuffer_2 },
3277{"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI },
3278{"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 },
3279{"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III },
3280{"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II },
3281{"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 },
3282{"glTexParameterxv", "(II[II)V", (void *) android_glTexParameterxv__II_3II },
3283{"glTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameterxv__IILjava_nio_IntBuffer_2 },
3284{"glVertexPointer", "(IIII)V", (void *) android_glVertexPointer__IIII },
3285};
3286
3287int register_android_opengl_jni_GLES11(JNIEnv *_env)
3288{
3289 int err;
3290 err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
3291 return err;
3292}