blob: 2625e03c962ea77212cfd3300e58848d70f302e7 [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"
21#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
22#pragma GCC diagnostic ignored "-Wunused-function"
23
Mathias Agopian2ad04772013-02-23 03:12:30 -080024#include <GLES/gl.h>
25#include <GLES/glext.h>
26
Jesse Hall9626f822014-05-19 20:57:49 -070027#include <jni.h>
28#include <JNIHelp.h>
Jack Palevich27f80022009-04-15 19:13:17 -070029#include <android_runtime/AndroidRuntime.h>
30#include <utils/misc.h>
Jack Palevich27f80022009-04-15 19:13:17 -070031#include <assert.h>
Jack Palevichbe6eac82009-12-08 15:43:51 +080032
Jack Palevich27f80022009-04-15 19:13:17 -070033static int initialized = 0;
34
35static jclass nioAccessClass;
36static jclass bufferClass;
Jack Palevich27f80022009-04-15 19:13:17 -070037static jmethodID getBasePointerID;
38static jmethodID getBaseArrayID;
39static jmethodID getBaseArrayOffsetID;
40static jfieldID positionID;
41static jfieldID limitID;
42static jfieldID elementSizeShiftID;
43
Mathias Agopian2ad04772013-02-23 03:12:30 -080044
45/* special calls implemented in Android's GLES wrapper used to more
46 * efficiently bound-check passed arrays */
47extern "C" {
48#ifdef GL_VERSION_ES_CM_1_1
49GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
50 const GLvoid *ptr, GLsizei count);
51GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
52 const GLvoid *pointer, GLsizei count);
53GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
54 GLsizei stride, const GLvoid *pointer, GLsizei count);
55GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
56 GLsizei stride, const GLvoid *pointer, GLsizei count);
57GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
58 GLsizei stride, const GLvoid *pointer, GLsizei count);
59GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
60 GLsizei stride, const GLvoid *pointer, GLsizei count);
61GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
62 GLsizei stride, const GLvoid *pointer, GLsizei count);
63#endif
64#ifdef GL_ES_VERSION_2_0
65static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type,
66 GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) {
67 glVertexAttribPointer(indx, size, type, normalized, stride, pointer);
68}
69#endif
Andy McFaddencee51982013-04-25 16:08:31 -070070#ifdef GL_ES_VERSION_3_0
71static void glVertexAttribIPointerBounds(GLuint indx, GLint size, GLenum type,
72 GLsizei stride, const GLvoid *pointer, GLsizei count) {
73 glVertexAttribIPointer(indx, size, type, stride, pointer);
74}
75#endif
Mathias Agopian2ad04772013-02-23 03:12:30 -080076}
77
Jack Palevich27f80022009-04-15 19:13:17 -070078/* Cache method IDs each time the class is loaded. */
79
80static void
Elliott Hughes24ce5fb2011-04-08 20:01:01 -070081nativeClassInit(JNIEnv *_env, jclass glImplClass)
Jack Palevich27f80022009-04-15 19:13:17 -070082{
83 jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
84 nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
85
86 jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
87 bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
88
89 getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
90 "getBasePointer", "(Ljava/nio/Buffer;)J");
91 getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
92 "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
93 getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
94 "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
95
96 positionID = _env->GetFieldID(bufferClass, "position", "I");
97 limitID = _env->GetFieldID(bufferClass, "limit", "I");
98 elementSizeShiftID =
99 _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
100}
101
Jack Palevich27f80022009-04-15 19:13:17 -0700102static void *
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700103getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
Jack Palevich27f80022009-04-15 19:13:17 -0700104{
105 jint position;
106 jint limit;
107 jint elementSizeShift;
108 jlong pointer;
Jack Palevich27f80022009-04-15 19:13:17 -0700109
110 position = _env->GetIntField(buffer, positionID);
111 limit = _env->GetIntField(buffer, limitID);
112 elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
113 *remaining = (limit - position) << elementSizeShift;
114 pointer = _env->CallStaticLongMethod(nioAccessClass,
115 getBasePointerID, buffer);
116 if (pointer != 0L) {
117 *array = NULL;
Ashok Bhat01c26ea2014-02-24 09:49:07 +0000118 return reinterpret_cast<void*>(pointer);
Jack Palevich27f80022009-04-15 19:13:17 -0700119 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700120
Jack Palevich27f80022009-04-15 19:13:17 -0700121 *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
122 getBaseArrayID, buffer);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700123 *offset = _env->CallStaticIntMethod(nioAccessClass,
Jack Palevich27f80022009-04-15 19:13:17 -0700124 getBaseArrayOffsetID, buffer);
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700125
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700126 return NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700127}
128
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700129class ByteArrayGetter {
130public:
131 static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
132 return _env->GetByteArrayElements(array, is_copy);
133 }
134};
135class BooleanArrayGetter {
136public:
137 static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
138 return _env->GetBooleanArrayElements(array, is_copy);
139 }
140};
141class CharArrayGetter {
142public:
143 static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
144 return _env->GetCharArrayElements(array, is_copy);
145 }
146};
147class ShortArrayGetter {
148public:
149 static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
150 return _env->GetShortArrayElements(array, is_copy);
151 }
152};
153class IntArrayGetter {
154public:
155 static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
156 return _env->GetIntArrayElements(array, is_copy);
157 }
158};
159class LongArrayGetter {
160public:
161 static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
162 return _env->GetLongArrayElements(array, is_copy);
163 }
164};
165class FloatArrayGetter {
166public:
167 static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
168 return _env->GetFloatArrayElements(array, is_copy);
169 }
170};
171class DoubleArrayGetter {
172public:
173 static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
174 return _env->GetDoubleArrayElements(array, is_copy);
175 }
176};
177
178template<typename JTYPEARRAY, typename ARRAYGETTER>
179static void*
180getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
181 return ARRAYGETTER::Get(_env, array, is_copy);
182}
183
184class ByteArrayReleaser {
185public:
186 static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
187 _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
188 }
189};
190class BooleanArrayReleaser {
191public:
192 static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
193 _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
194 }
195};
196class CharArrayReleaser {
197public:
198 static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
199 _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
200 }
201};
202class ShortArrayReleaser {
203public:
204 static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
205 _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
206 }
207};
208class IntArrayReleaser {
209public:
210 static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
211 _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
212 }
213};
214class LongArrayReleaser {
215public:
216 static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
217 _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
218 }
219};
220class FloatArrayReleaser {
221public:
222 static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
223 _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
224 }
225};
226class DoubleArrayReleaser {
227public:
228 static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
229 _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
230 }
231};
232
233template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
234static void
235releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
236 ARRAYRELEASER::Release(_env, array, data, commit);
237}
238
Jack Palevich27f80022009-04-15 19:13:17 -0700239static void
240releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
241{
242 _env->ReleasePrimitiveArrayCritical(array, data,
Mathias Agopian2ad04772013-02-23 03:12:30 -0800243 commit ? 0 : JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -0700244}
245
Jack Palevichbe6eac82009-12-08 15:43:51 +0800246static void *
247getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
248 char* buf = (char*) _env->GetDirectBufferAddress(buffer);
249 if (buf) {
250 jint position = _env->GetIntField(buffer, positionID);
251 jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
252 buf += position << elementSizeShift;
253 } else {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700254 jniThrowException(_env, "java/lang/IllegalArgumentException",
255 "Must use a native order direct Buffer");
Jack Palevichbe6eac82009-12-08 15:43:51 +0800256 }
257 return (void*) buf;
258}
259
Jack Palevich27f80022009-04-15 19:13:17 -0700260// --------------------------------------------------------------------------
Mathias Agopian2ad04772013-02-23 03:12:30 -0800261
262/*
263 * returns the number of values glGet returns for a given pname.
264 *
265 * The code below is written such that pnames requiring only one values
266 * are the default (and are not explicitely tested for). This makes the
267 * checking code much shorter/readable/efficient.
268 *
269 * This means that unknown pnames (e.g.: extensions) will default to 1. If
270 * that unknown pname needs more than 1 value, then the validation check
271 * is incomplete and the app may crash if it passed the wrong number params.
272 */
273static int getNeededCount(GLint pname) {
274 int needed = 1;
275#ifdef GL_ES_VERSION_2_0
276 // GLES 2.x pnames
277 switch (pname) {
278 case GL_ALIASED_LINE_WIDTH_RANGE:
279 case GL_ALIASED_POINT_SIZE_RANGE:
280 needed = 2;
281 break;
282
283 case GL_BLEND_COLOR:
284 case GL_COLOR_CLEAR_VALUE:
285 case GL_COLOR_WRITEMASK:
286 case GL_SCISSOR_BOX:
287 case GL_VIEWPORT:
288 needed = 4;
289 break;
290
291 case GL_COMPRESSED_TEXTURE_FORMATS:
292 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
293 break;
294
295 case GL_SHADER_BINARY_FORMATS:
296 glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed);
297 break;
298 }
299#endif
300
301#ifdef GL_VERSION_ES_CM_1_1
302 // GLES 1.x pnames
303 switch (pname) {
304 case GL_ALIASED_LINE_WIDTH_RANGE:
305 case GL_ALIASED_POINT_SIZE_RANGE:
306 case GL_DEPTH_RANGE:
307 case GL_SMOOTH_LINE_WIDTH_RANGE:
308 case GL_SMOOTH_POINT_SIZE_RANGE:
309 needed = 2;
310 break;
311
312 case GL_CURRENT_NORMAL:
313 case GL_POINT_DISTANCE_ATTENUATION:
314 needed = 3;
315 break;
316
317 case GL_COLOR_CLEAR_VALUE:
318 case GL_COLOR_WRITEMASK:
319 case GL_CURRENT_COLOR:
320 case GL_CURRENT_TEXTURE_COORDS:
321 case GL_FOG_COLOR:
322 case GL_LIGHT_MODEL_AMBIENT:
323 case GL_SCISSOR_BOX:
324 case GL_VIEWPORT:
325 needed = 4;
326 break;
327
328 case GL_MODELVIEW_MATRIX:
329 case GL_PROJECTION_MATRIX:
330 case GL_TEXTURE_MATRIX:
331 needed = 16;
332 break;
333
334 case GL_COMPRESSED_TEXTURE_FORMATS:
335 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
336 break;
337 }
338#endif
339 return needed;
340}
341
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700342template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
343 typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
Mathias Agopian2ad04772013-02-23 03:12:30 -0800344static void
345get
346 (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
347 jint _exception = 0;
348 const char * _exceptionType;
349 const char * _exceptionMessage;
350 CTYPE *params_base = (CTYPE *) 0;
351 jint _remaining;
352 CTYPE *params = (CTYPE *) 0;
353 int _needed = 0;
354
355 if (!params_ref) {
356 _exception = 1;
357 _exceptionType = "java/lang/IllegalArgumentException";
358 _exceptionMessage = "params == null";
359 goto exit;
360 }
361 if (offset < 0) {
362 _exception = 1;
363 _exceptionType = "java/lang/IllegalArgumentException";
364 _exceptionMessage = "offset < 0";
365 goto exit;
366 }
367 _remaining = _env->GetArrayLength(params_ref) - offset;
368 _needed = getNeededCount(pname);
369 // if we didn't find this pname, we just assume the user passed
370 // an array of the right size -- this might happen with extensions
371 // or if we forget an enum here.
372 if (_remaining < _needed) {
373 _exception = 1;
374 _exceptionType = "java/lang/IllegalArgumentException";
375 _exceptionMessage = "length - offset < needed";
376 goto exit;
377 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700378 params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
379 _env, params_ref, (jboolean *)0);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800380 params = params_base + offset;
381
382 GET(
383 (GLenum)pname,
384 (CTYPE *)params
385 );
386
387exit:
388 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700389 releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
390 _env, params_ref, params_base, !_exception);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800391 }
392 if (_exception) {
393 jniThrowException(_env, _exceptionType, _exceptionMessage);
394 }
395}
396
397
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700398template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
399 typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
Mathias Agopian2ad04772013-02-23 03:12:30 -0800400static void
401getarray
402 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
403 jint _exception = 0;
404 const char * _exceptionType;
405 const char * _exceptionMessage;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700406 JTYPEARRAY _array = (JTYPEARRAY) 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800407 jint _bufferOffset = (jint) 0;
408 jint _remaining;
409 CTYPE *params = (CTYPE *) 0;
410 int _needed = 0;
411
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700412 params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Andy McFaddencee51982013-04-25 16:08:31 -0700413 _remaining /= sizeof(CTYPE); // convert from bytes to item count
Mathias Agopian2ad04772013-02-23 03:12:30 -0800414 _needed = getNeededCount(pname);
415 // if we didn't find this pname, we just assume the user passed
416 // an array of the right size -- this might happen with extensions
417 // or if we forget an enum here.
418 if (_needed>0 && _remaining < _needed) {
419 _exception = 1;
420 _exceptionType = "java/lang/IllegalArgumentException";
421 _exceptionMessage = "remaining() < needed";
422 goto exit;
423 }
424 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700425 char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
426 _env, _array, (jboolean *) 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800427 params = (CTYPE *) (_paramsBase + _bufferOffset);
428 }
429 GET(
430 (GLenum)pname,
431 (CTYPE *)params
432 );
433
434exit:
435 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700436 releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
437 _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800438 }
439 if (_exception) {
440 jniThrowException(_env, _exceptionType, _exceptionMessage);
441 }
442}
443
444// --------------------------------------------------------------------------
Jack Palevich27f80022009-04-15 19:13:17 -0700445/* void glBindBuffer ( GLenum target, GLuint buffer ) */
446static void
447android_glBindBuffer__II
448 (JNIEnv *_env, jobject _this, jint target, jint buffer) {
449 glBindBuffer(
450 (GLenum)target,
451 (GLuint)buffer
452 );
453}
454
455/* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */
456static void
457android_glBufferData__IILjava_nio_Buffer_2I
458 (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700459 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800460 const char * _exceptionType = NULL;
461 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700462 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700463 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700464 jint _remaining;
465 GLvoid *data = (GLvoid *) 0;
466
467 if (data_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700468 data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevichc620a522009-10-21 11:02:44 -0700469 if (_remaining < size) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700470 _exception = 1;
471 _exceptionType = "java/lang/IllegalArgumentException";
472 _exceptionMessage = "remaining() < size < needed";
Jack Palevichc620a522009-10-21 11:02:44 -0700473 goto exit;
474 }
Jack Palevich27f80022009-04-15 19:13:17 -0700475 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -0700476 if (data_buf && data == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700477 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
478 data = (GLvoid *) (_dataBase + _bufferOffset);
479 }
Jack Palevich27f80022009-04-15 19:13:17 -0700480 glBufferData(
481 (GLenum)target,
482 (GLsizeiptr)size,
483 (GLvoid *)data,
484 (GLenum)usage
485 );
Jack Palevichc620a522009-10-21 11:02:44 -0700486
487exit:
Jack Palevich27f80022009-04-15 19:13:17 -0700488 if (_array) {
489 releasePointer(_env, _array, data, JNI_FALSE);
490 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700491 if (_exception) {
492 jniThrowException(_env, _exceptionType, _exceptionMessage);
493 }
Jack Palevich27f80022009-04-15 19:13:17 -0700494}
495
496/* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */
497static void
498android_glBufferSubData__IIILjava_nio_Buffer_2
499 (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700500 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800501 const char * _exceptionType = NULL;
502 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700503 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700504 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700505 jint _remaining;
506 GLvoid *data = (GLvoid *) 0;
507
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700508 data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevichc620a522009-10-21 11:02:44 -0700509 if (_remaining < size) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700510 _exception = 1;
511 _exceptionType = "java/lang/IllegalArgumentException";
512 _exceptionMessage = "remaining() < size < needed";
Jack Palevichc620a522009-10-21 11:02:44 -0700513 goto exit;
514 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700515 if (data == NULL) {
516 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
517 data = (GLvoid *) (_dataBase + _bufferOffset);
518 }
Jack Palevich27f80022009-04-15 19:13:17 -0700519 glBufferSubData(
520 (GLenum)target,
521 (GLintptr)offset,
522 (GLsizeiptr)size,
523 (GLvoid *)data
524 );
Jack Palevichc620a522009-10-21 11:02:44 -0700525
526exit:
Jack Palevich27f80022009-04-15 19:13:17 -0700527 if (_array) {
528 releasePointer(_env, _array, data, JNI_FALSE);
529 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700530 if (_exception) {
531 jniThrowException(_env, _exceptionType, _exceptionMessage);
532 }
Jack Palevich27f80022009-04-15 19:13:17 -0700533}
534
535/* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */
536static void
537android_glClipPlanef__I_3FI
538 (JNIEnv *_env, jobject _this, jint plane, jfloatArray equation_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700539 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800540 const char * _exceptionType = NULL;
541 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700542 GLfloat *equation_base = (GLfloat *) 0;
543 jint _remaining;
544 GLfloat *equation = (GLfloat *) 0;
545
546 if (!equation_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700547 _exception = 1;
548 _exceptionType = "java/lang/IllegalArgumentException";
549 _exceptionMessage = "equation == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700550 goto exit;
551 }
552 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700553 _exception = 1;
554 _exceptionType = "java/lang/IllegalArgumentException";
555 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700556 goto exit;
557 }
558 _remaining = _env->GetArrayLength(equation_ref) - offset;
559 equation_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700560 _env->GetFloatArrayElements(equation_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -0700561 equation = equation_base + offset;
562
563 glClipPlanef(
564 (GLenum)plane,
565 (GLfloat *)equation
566 );
567
568exit:
569 if (equation_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700570 _env->ReleaseFloatArrayElements(equation_ref, (jfloat*)equation_base,
Jack Palevich27f80022009-04-15 19:13:17 -0700571 JNI_ABORT);
572 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700573 if (_exception) {
574 jniThrowException(_env, _exceptionType, _exceptionMessage);
575 }
Jack Palevich27f80022009-04-15 19:13:17 -0700576}
577
578/* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */
579static void
580android_glClipPlanef__ILjava_nio_FloatBuffer_2
581 (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700582 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800583 const char * _exceptionType = NULL;
584 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700585 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700586 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700587 jint _remaining;
588 GLfloat *equation = (GLfloat *) 0;
589
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700590 equation = (GLfloat *)getPointer(_env, equation_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700591 if (equation == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700592 char * _equationBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700593 equation = (GLfloat *) (_equationBase + _bufferOffset);
594 }
Jack Palevich27f80022009-04-15 19:13:17 -0700595 glClipPlanef(
596 (GLenum)plane,
597 (GLfloat *)equation
598 );
599 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700600 _env->ReleaseFloatArrayElements(_array, (jfloat*)equation, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -0700601 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700602 if (_exception) {
603 jniThrowException(_env, _exceptionType, _exceptionMessage);
604 }
Jack Palevich27f80022009-04-15 19:13:17 -0700605}
606
607/* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */
608static void
609android_glClipPlanex__I_3II
610 (JNIEnv *_env, jobject _this, jint plane, jintArray equation_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700611 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800612 const char * _exceptionType = NULL;
613 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700614 GLfixed *equation_base = (GLfixed *) 0;
615 jint _remaining;
616 GLfixed *equation = (GLfixed *) 0;
617
618 if (!equation_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700619 _exception = 1;
620 _exceptionType = "java/lang/IllegalArgumentException";
621 _exceptionMessage = "equation == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700622 goto exit;
623 }
624 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700625 _exception = 1;
626 _exceptionType = "java/lang/IllegalArgumentException";
627 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700628 goto exit;
629 }
630 _remaining = _env->GetArrayLength(equation_ref) - offset;
631 equation_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700632 _env->GetIntArrayElements(equation_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -0700633 equation = equation_base + offset;
634
635 glClipPlanex(
636 (GLenum)plane,
637 (GLfixed *)equation
638 );
639
640exit:
641 if (equation_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700642 _env->ReleaseIntArrayElements(equation_ref, (jint*)equation_base,
Jack Palevich27f80022009-04-15 19:13:17 -0700643 JNI_ABORT);
644 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700645 if (_exception) {
646 jniThrowException(_env, _exceptionType, _exceptionMessage);
647 }
Jack Palevich27f80022009-04-15 19:13:17 -0700648}
649
650/* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */
651static void
652android_glClipPlanex__ILjava_nio_IntBuffer_2
653 (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700654 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800655 const char * _exceptionType = NULL;
656 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700657 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700658 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700659 jint _remaining;
660 GLfixed *equation = (GLfixed *) 0;
661
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700662 equation = (GLfixed *)getPointer(_env, equation_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700663 if (equation == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700664 char * _equationBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700665 equation = (GLfixed *) (_equationBase + _bufferOffset);
666 }
Jack Palevich27f80022009-04-15 19:13:17 -0700667 glClipPlanex(
668 (GLenum)plane,
669 (GLfixed *)equation
670 );
671 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
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700764 buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -0700765 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700766 _exception = 1;
767 _exceptionType = "java/lang/IllegalArgumentException";
768 _exceptionMessage = "remaining() < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700769 goto exit;
770 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700771 if (buffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700772 char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700773 buffers = (GLuint *) (_buffersBase + _bufferOffset);
774 }
Jack Palevich27f80022009-04-15 19:13:17 -0700775 glDeleteBuffers(
776 (GLsizei)n,
777 (GLuint *)buffers
778 );
779
780exit:
781 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700782 _env->ReleaseIntArrayElements(_array, (jint*)buffers, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -0700783 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700784 if (_exception) {
785 jniThrowException(_env, _exceptionType, _exceptionMessage);
786 }
Jack Palevich27f80022009-04-15 19:13:17 -0700787}
788
789/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */
790static void
791android_glDrawElements__IIII
792 (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700793 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800794 const char * _exceptionType = NULL;
795 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700796 glDrawElements(
797 (GLenum)mode,
798 (GLsizei)count,
799 (GLenum)type,
Ashok Bhat01c26ea2014-02-24 09:49:07 +0000800 reinterpret_cast<GLvoid *>(offset)
Jack Palevich27f80022009-04-15 19:13:17 -0700801 );
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700802 if (_exception) {
803 jniThrowException(_env, _exceptionType, _exceptionMessage);
804 }
Jack Palevich27f80022009-04-15 19:13:17 -0700805}
806
807/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
808static void
809android_glGenBuffers__I_3II
810 (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
811 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800812 const char * _exceptionType = NULL;
813 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700814 GLuint *buffers_base = (GLuint *) 0;
815 jint _remaining;
816 GLuint *buffers = (GLuint *) 0;
817
818 if (!buffers_ref) {
819 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700820 _exceptionType = "java/lang/IllegalArgumentException";
821 _exceptionMessage = "buffers == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700822 goto exit;
823 }
824 if (offset < 0) {
825 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700826 _exceptionType = "java/lang/IllegalArgumentException";
827 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700828 goto exit;
829 }
830 _remaining = _env->GetArrayLength(buffers_ref) - offset;
831 if (_remaining < n) {
832 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700833 _exceptionType = "java/lang/IllegalArgumentException";
834 _exceptionMessage = "length - offset < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700835 goto exit;
836 }
837 buffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700838 _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -0700839 buffers = buffers_base + offset;
840
841 glGenBuffers(
842 (GLsizei)n,
843 (GLuint *)buffers
844 );
845
846exit:
847 if (buffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700848 _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
Jack Palevich27f80022009-04-15 19:13:17 -0700849 _exception ? JNI_ABORT: 0);
850 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700851 if (_exception) {
852 jniThrowException(_env, _exceptionType, _exceptionMessage);
853 }
Jack Palevich27f80022009-04-15 19:13:17 -0700854}
855
856/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
857static void
858android_glGenBuffers__ILjava_nio_IntBuffer_2
859 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
860 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800861 const char * _exceptionType = NULL;
862 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700863 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700864 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700865 jint _remaining;
866 GLuint *buffers = (GLuint *) 0;
867
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700868 buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -0700869 if (_remaining < n) {
870 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700871 _exceptionType = "java/lang/IllegalArgumentException";
872 _exceptionMessage = "remaining() < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700873 goto exit;
874 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700875 if (buffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700876 char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700877 buffers = (GLuint *) (_buffersBase + _bufferOffset);
878 }
Jack Palevich27f80022009-04-15 19:13:17 -0700879 glGenBuffers(
880 (GLsizei)n,
881 (GLuint *)buffers
882 );
883
884exit:
885 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700886 _env->ReleaseIntArrayElements(_array, (jint*)buffers, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -0700887 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700888 if (_exception) {
889 jniThrowException(_env, _exceptionType, _exceptionMessage);
890 }
Jack Palevich27f80022009-04-15 19:13:17 -0700891}
892
893/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
894static void
895android_glGetBooleanv__I_3ZI
896 (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700897 get<jbooleanArray, BooleanArrayGetter, jboolean*, BooleanArrayReleaser, GLboolean, glGetBooleanv>(
898 _env, _this, pname, params_ref, offset);
Jack Palevich27f80022009-04-15 19:13:17 -0700899}
900
901/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
902static void
903android_glGetBooleanv__ILjava_nio_IntBuffer_2
904 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700905 getarray<GLboolean, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetBooleanv>(
906 _env, _this, pname, params_buf);
Jack Palevich27f80022009-04-15 19:13:17 -0700907}
Jack Palevich27f80022009-04-15 19:13:17 -0700908/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
909static void
910android_glGetBufferParameteriv__II_3II
911 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Jack Palevich73108672011-03-28 14:49:12 -0700912 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800913 const char * _exceptionType = NULL;
914 const char * _exceptionMessage = NULL;
Jack Palevich73108672011-03-28 14:49:12 -0700915 GLint *params_base = (GLint *) 0;
916 jint _remaining;
917 GLint *params = (GLint *) 0;
918
919 if (!params_ref) {
920 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700921 _exceptionType = "java/lang/IllegalArgumentException";
922 _exceptionMessage = "params == null";
Jack Palevich73108672011-03-28 14:49:12 -0700923 goto exit;
924 }
925 if (offset < 0) {
926 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700927 _exceptionType = "java/lang/IllegalArgumentException";
928 _exceptionMessage = "offset < 0";
Jack Palevich73108672011-03-28 14:49:12 -0700929 goto exit;
930 }
931 _remaining = _env->GetArrayLength(params_ref) - offset;
932 if (_remaining < 1) {
933 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700934 _exceptionType = "java/lang/IllegalArgumentException";
935 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich73108672011-03-28 14:49:12 -0700936 goto exit;
937 }
938 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700939 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich73108672011-03-28 14:49:12 -0700940 params = params_base + offset;
941
942 glGetBufferParameteriv(
943 (GLenum)target,
944 (GLenum)pname,
945 (GLint *)params
946 );
947
948exit:
949 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700950 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich73108672011-03-28 14:49:12 -0700951 _exception ? JNI_ABORT: 0);
952 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700953 if (_exception) {
954 jniThrowException(_env, _exceptionType, _exceptionMessage);
955 }
Jack Palevich27f80022009-04-15 19:13:17 -0700956}
957
958/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
959static void
960android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
961 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Jack Palevich73108672011-03-28 14:49:12 -0700962 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800963 const char * _exceptionType = NULL;
964 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700965 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700966 jint _bufferOffset = (jint) 0;
Jack Palevich73108672011-03-28 14:49:12 -0700967 jint _remaining;
968 GLint *params = (GLint *) 0;
969
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700970 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich73108672011-03-28 14:49:12 -0700971 if (_remaining < 1) {
972 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700973 _exceptionType = "java/lang/IllegalArgumentException";
974 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich73108672011-03-28 14:49:12 -0700975 goto exit;
976 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700977 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700978 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700979 params = (GLint *) (_paramsBase + _bufferOffset);
980 }
Jack Palevich73108672011-03-28 14:49:12 -0700981 glGetBufferParameteriv(
982 (GLenum)target,
983 (GLenum)pname,
984 (GLint *)params
985 );
986
987exit:
988 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700989 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich73108672011-03-28 14:49:12 -0700990 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700991 if (_exception) {
992 jniThrowException(_env, _exceptionType, _exceptionMessage);
993 }
Jack Palevich27f80022009-04-15 19:13:17 -0700994}
995
996/* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */
997static void
998android_glGetClipPlanef__I_3FI
999 (JNIEnv *_env, jobject _this, jint pname, jfloatArray eqn_ref, jint offset) {
1000 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001001 const char * _exceptionType = NULL;
1002 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001003 GLfloat *eqn_base = (GLfloat *) 0;
1004 jint _remaining;
1005 GLfloat *eqn = (GLfloat *) 0;
1006
1007 if (!eqn_ref) {
1008 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001009 _exceptionType = "java/lang/IllegalArgumentException";
1010 _exceptionMessage = "eqn == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001011 goto exit;
1012 }
1013 if (offset < 0) {
1014 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001015 _exceptionType = "java/lang/IllegalArgumentException";
1016 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001017 goto exit;
1018 }
1019 _remaining = _env->GetArrayLength(eqn_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001020 if (_remaining < 4) {
1021 _exception = 1;
1022 _exceptionType = "java/lang/IllegalArgumentException";
1023 _exceptionMessage = "length - offset < 4 < needed";
1024 goto exit;
1025 }
Jack Palevich27f80022009-04-15 19:13:17 -07001026 eqn_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001027 _env->GetFloatArrayElements(eqn_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001028 eqn = eqn_base + offset;
1029
1030 glGetClipPlanef(
1031 (GLenum)pname,
1032 (GLfloat *)eqn
1033 );
1034
1035exit:
1036 if (eqn_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001037 _env->ReleaseFloatArrayElements(eqn_ref, (jfloat*)eqn_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001038 _exception ? JNI_ABORT: 0);
1039 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001040 if (_exception) {
1041 jniThrowException(_env, _exceptionType, _exceptionMessage);
1042 }
Jack Palevich27f80022009-04-15 19:13:17 -07001043}
1044
1045/* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */
1046static void
1047android_glGetClipPlanef__ILjava_nio_FloatBuffer_2
1048 (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001049 jint _exception = 0;
1050 const char * _exceptionType = NULL;
1051 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001052 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001053 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001054 jint _remaining;
1055 GLfloat *eqn = (GLfloat *) 0;
1056
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001057 eqn = (GLfloat *)getPointer(_env, eqn_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001058 if (_remaining < 4) {
1059 _exception = 1;
1060 _exceptionType = "java/lang/IllegalArgumentException";
1061 _exceptionMessage = "remaining() < 4 < needed";
1062 goto exit;
1063 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001064 if (eqn == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001065 char * _eqnBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001066 eqn = (GLfloat *) (_eqnBase + _bufferOffset);
1067 }
Jack Palevich27f80022009-04-15 19:13:17 -07001068 glGetClipPlanef(
1069 (GLenum)pname,
1070 (GLfloat *)eqn
1071 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08001072
1073exit:
Jack Palevich27f80022009-04-15 19:13:17 -07001074 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001075 _env->ReleaseFloatArrayElements(_array, (jfloat*)eqn, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001076 }
1077 if (_exception) {
1078 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich27f80022009-04-15 19:13:17 -07001079 }
1080}
1081
1082/* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */
1083static void
1084android_glGetClipPlanex__I_3II
1085 (JNIEnv *_env, jobject _this, jint pname, jintArray eqn_ref, jint offset) {
1086 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001087 const char * _exceptionType = NULL;
1088 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001089 GLfixed *eqn_base = (GLfixed *) 0;
1090 jint _remaining;
1091 GLfixed *eqn = (GLfixed *) 0;
1092
1093 if (!eqn_ref) {
1094 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001095 _exceptionType = "java/lang/IllegalArgumentException";
1096 _exceptionMessage = "eqn == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001097 goto exit;
1098 }
1099 if (offset < 0) {
1100 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001101 _exceptionType = "java/lang/IllegalArgumentException";
1102 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001103 goto exit;
1104 }
1105 _remaining = _env->GetArrayLength(eqn_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001106 if (_remaining < 4) {
1107 _exception = 1;
1108 _exceptionType = "java/lang/IllegalArgumentException";
1109 _exceptionMessage = "length - offset < 4 < needed";
1110 goto exit;
1111 }
Jack Palevich27f80022009-04-15 19:13:17 -07001112 eqn_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001113 _env->GetIntArrayElements(eqn_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001114 eqn = eqn_base + offset;
1115
1116 glGetClipPlanex(
1117 (GLenum)pname,
1118 (GLfixed *)eqn
1119 );
1120
1121exit:
1122 if (eqn_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001123 _env->ReleaseIntArrayElements(eqn_ref, (jint*)eqn_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001124 _exception ? JNI_ABORT: 0);
1125 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001126 if (_exception) {
1127 jniThrowException(_env, _exceptionType, _exceptionMessage);
1128 }
Jack Palevich27f80022009-04-15 19:13:17 -07001129}
1130
1131/* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */
1132static void
1133android_glGetClipPlanex__ILjava_nio_IntBuffer_2
1134 (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001135 jint _exception = 0;
1136 const char * _exceptionType = NULL;
1137 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001138 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001139 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001140 jint _remaining;
1141 GLfixed *eqn = (GLfixed *) 0;
1142
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001143 eqn = (GLfixed *)getPointer(_env, eqn_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001144 if (_remaining < 4) {
1145 _exception = 1;
1146 _exceptionType = "java/lang/IllegalArgumentException";
1147 _exceptionMessage = "remaining() < 4 < needed";
1148 goto exit;
1149 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001150 if (eqn == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001151 char * _eqnBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001152 eqn = (GLfixed *) (_eqnBase + _bufferOffset);
1153 }
Jack Palevich27f80022009-04-15 19:13:17 -07001154 glGetClipPlanex(
1155 (GLenum)pname,
1156 (GLfixed *)eqn
1157 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08001158
1159exit:
Jack Palevich27f80022009-04-15 19:13:17 -07001160 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001161 _env->ReleaseIntArrayElements(_array, (jint*)eqn, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001162 }
1163 if (_exception) {
1164 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich27f80022009-04-15 19:13:17 -07001165 }
1166}
1167
1168/* void glGetFixedv ( GLenum pname, GLfixed *params ) */
1169static void
1170android_glGetFixedv__I_3II
1171 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
1172 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001173 const char * _exceptionType = NULL;
1174 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001175 GLfixed *params_base = (GLfixed *) 0;
1176 jint _remaining;
1177 GLfixed *params = (GLfixed *) 0;
1178
1179 if (!params_ref) {
1180 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001181 _exceptionType = "java/lang/IllegalArgumentException";
1182 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001183 goto exit;
1184 }
1185 if (offset < 0) {
1186 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001187 _exceptionType = "java/lang/IllegalArgumentException";
1188 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001189 goto exit;
1190 }
1191 _remaining = _env->GetArrayLength(params_ref) - offset;
1192 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001193 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001194 params = params_base + offset;
1195
1196 glGetFixedv(
1197 (GLenum)pname,
1198 (GLfixed *)params
1199 );
1200
1201exit:
1202 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001203 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001204 _exception ? JNI_ABORT: 0);
1205 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001206 if (_exception) {
1207 jniThrowException(_env, _exceptionType, _exceptionMessage);
1208 }
Jack Palevich27f80022009-04-15 19:13:17 -07001209}
1210
1211/* void glGetFixedv ( GLenum pname, GLfixed *params ) */
1212static void
1213android_glGetFixedv__ILjava_nio_IntBuffer_2
1214 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001215 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001216 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001217 jint _remaining;
1218 GLfixed *params = (GLfixed *) 0;
1219
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001220 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001221 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001222 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001223 params = (GLfixed *) (_paramsBase + _bufferOffset);
1224 }
Jack Palevich27f80022009-04-15 19:13:17 -07001225 glGetFixedv(
1226 (GLenum)pname,
1227 (GLfixed *)params
1228 );
1229 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001230 _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
Jack Palevich27f80022009-04-15 19:13:17 -07001231 }
1232}
1233
1234/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
1235static void
1236android_glGetFloatv__I_3FI
1237 (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001238 get<jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, GLfloat, glGetFloatv>(
1239 _env, _this, pname, params_ref, offset);
Jack Palevich27f80022009-04-15 19:13:17 -07001240}
1241
1242/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
1243static void
1244android_glGetFloatv__ILjava_nio_FloatBuffer_2
1245 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001246 getarray<GLfloat, jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, glGetFloatv>(
1247 _env, _this, pname, params_buf);
Jack Palevich27f80022009-04-15 19:13:17 -07001248}
Jack Palevich27f80022009-04-15 19:13:17 -07001249/* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */
1250static void
1251android_glGetLightfv__II_3FI
1252 (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) {
1253 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001254 const char * _exceptionType = NULL;
1255 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001256 GLfloat *params_base = (GLfloat *) 0;
1257 jint _remaining;
1258 GLfloat *params = (GLfloat *) 0;
1259
1260 if (!params_ref) {
1261 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001262 _exceptionType = "java/lang/IllegalArgumentException";
1263 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001264 goto exit;
1265 }
1266 if (offset < 0) {
1267 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001268 _exceptionType = "java/lang/IllegalArgumentException";
1269 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001270 goto exit;
1271 }
1272 _remaining = _env->GetArrayLength(params_ref) - offset;
1273 int _needed;
1274 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001275#if defined(GL_SPOT_DIRECTION)
1276 case GL_SPOT_DIRECTION:
1277#endif // defined(GL_SPOT_DIRECTION)
1278 _needed = 3;
1279 break;
1280#if defined(GL_AMBIENT)
1281 case GL_AMBIENT:
1282#endif // defined(GL_AMBIENT)
1283#if defined(GL_DIFFUSE)
1284 case GL_DIFFUSE:
1285#endif // defined(GL_DIFFUSE)
1286#if defined(GL_SPECULAR)
1287 case GL_SPECULAR:
1288#endif // defined(GL_SPECULAR)
1289#if defined(GL_EMISSION)
1290 case GL_EMISSION:
1291#endif // defined(GL_EMISSION)
1292 _needed = 4;
1293 break;
1294 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001295 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001296 break;
1297 }
1298 if (_remaining < _needed) {
1299 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001300 _exceptionType = "java/lang/IllegalArgumentException";
1301 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001302 goto exit;
1303 }
1304 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001305 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001306 params = params_base + offset;
1307
1308 glGetLightfv(
1309 (GLenum)light,
1310 (GLenum)pname,
1311 (GLfloat *)params
1312 );
1313
1314exit:
1315 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001316 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001317 _exception ? JNI_ABORT: 0);
1318 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001319 if (_exception) {
1320 jniThrowException(_env, _exceptionType, _exceptionMessage);
1321 }
Jack Palevich27f80022009-04-15 19:13:17 -07001322}
1323
1324/* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */
1325static void
1326android_glGetLightfv__IILjava_nio_FloatBuffer_2
1327 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
1328 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001329 const char * _exceptionType = NULL;
1330 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001331 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001332 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001333 jint _remaining;
1334 GLfloat *params = (GLfloat *) 0;
1335
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001336 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001337 int _needed;
1338 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001339#if defined(GL_SPOT_DIRECTION)
1340 case GL_SPOT_DIRECTION:
1341#endif // defined(GL_SPOT_DIRECTION)
1342 _needed = 3;
1343 break;
1344#if defined(GL_AMBIENT)
1345 case GL_AMBIENT:
1346#endif // defined(GL_AMBIENT)
1347#if defined(GL_DIFFUSE)
1348 case GL_DIFFUSE:
1349#endif // defined(GL_DIFFUSE)
1350#if defined(GL_SPECULAR)
1351 case GL_SPECULAR:
1352#endif // defined(GL_SPECULAR)
1353#if defined(GL_EMISSION)
1354 case GL_EMISSION:
1355#endif // defined(GL_EMISSION)
1356 _needed = 4;
1357 break;
1358 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001359 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001360 break;
1361 }
1362 if (_remaining < _needed) {
1363 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001364 _exceptionType = "java/lang/IllegalArgumentException";
1365 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001366 goto exit;
1367 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001368 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001369 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001370 params = (GLfloat *) (_paramsBase + _bufferOffset);
1371 }
Jack Palevich27f80022009-04-15 19:13:17 -07001372 glGetLightfv(
1373 (GLenum)light,
1374 (GLenum)pname,
1375 (GLfloat *)params
1376 );
1377
1378exit:
1379 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001380 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07001381 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001382 if (_exception) {
1383 jniThrowException(_env, _exceptionType, _exceptionMessage);
1384 }
Jack Palevich27f80022009-04-15 19:13:17 -07001385}
1386
1387/* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */
1388static void
1389android_glGetLightxv__II_3II
1390 (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) {
1391 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001392 const char * _exceptionType = NULL;
1393 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001394 GLfixed *params_base = (GLfixed *) 0;
1395 jint _remaining;
1396 GLfixed *params = (GLfixed *) 0;
1397
1398 if (!params_ref) {
1399 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001400 _exceptionType = "java/lang/IllegalArgumentException";
1401 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001402 goto exit;
1403 }
1404 if (offset < 0) {
1405 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001406 _exceptionType = "java/lang/IllegalArgumentException";
1407 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001408 goto exit;
1409 }
1410 _remaining = _env->GetArrayLength(params_ref) - offset;
1411 int _needed;
1412 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001413#if defined(GL_SPOT_DIRECTION)
1414 case GL_SPOT_DIRECTION:
1415#endif // defined(GL_SPOT_DIRECTION)
1416 _needed = 3;
1417 break;
1418#if defined(GL_AMBIENT)
1419 case GL_AMBIENT:
1420#endif // defined(GL_AMBIENT)
1421#if defined(GL_DIFFUSE)
1422 case GL_DIFFUSE:
1423#endif // defined(GL_DIFFUSE)
1424#if defined(GL_SPECULAR)
1425 case GL_SPECULAR:
1426#endif // defined(GL_SPECULAR)
1427#if defined(GL_EMISSION)
1428 case GL_EMISSION:
1429#endif // defined(GL_EMISSION)
1430 _needed = 4;
1431 break;
1432 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001433 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001434 break;
1435 }
1436 if (_remaining < _needed) {
1437 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001438 _exceptionType = "java/lang/IllegalArgumentException";
1439 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001440 goto exit;
1441 }
1442 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001443 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001444 params = params_base + offset;
1445
1446 glGetLightxv(
1447 (GLenum)light,
1448 (GLenum)pname,
1449 (GLfixed *)params
1450 );
1451
1452exit:
1453 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001454 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001455 _exception ? JNI_ABORT: 0);
1456 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001457 if (_exception) {
1458 jniThrowException(_env, _exceptionType, _exceptionMessage);
1459 }
Jack Palevich27f80022009-04-15 19:13:17 -07001460}
1461
1462/* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */
1463static void
1464android_glGetLightxv__IILjava_nio_IntBuffer_2
1465 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
1466 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001467 const char * _exceptionType = NULL;
1468 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001469 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001470 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001471 jint _remaining;
1472 GLfixed *params = (GLfixed *) 0;
1473
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001474 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001475 int _needed;
1476 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001477#if defined(GL_SPOT_DIRECTION)
1478 case GL_SPOT_DIRECTION:
1479#endif // defined(GL_SPOT_DIRECTION)
1480 _needed = 3;
1481 break;
1482#if defined(GL_AMBIENT)
1483 case GL_AMBIENT:
1484#endif // defined(GL_AMBIENT)
1485#if defined(GL_DIFFUSE)
1486 case GL_DIFFUSE:
1487#endif // defined(GL_DIFFUSE)
1488#if defined(GL_SPECULAR)
1489 case GL_SPECULAR:
1490#endif // defined(GL_SPECULAR)
1491#if defined(GL_EMISSION)
1492 case GL_EMISSION:
1493#endif // defined(GL_EMISSION)
1494 _needed = 4;
1495 break;
1496 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001497 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001498 break;
1499 }
1500 if (_remaining < _needed) {
1501 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001502 _exceptionType = "java/lang/IllegalArgumentException";
1503 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001504 goto exit;
1505 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001506 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001507 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001508 params = (GLfixed *) (_paramsBase + _bufferOffset);
1509 }
Jack Palevich27f80022009-04-15 19:13:17 -07001510 glGetLightxv(
1511 (GLenum)light,
1512 (GLenum)pname,
1513 (GLfixed *)params
1514 );
1515
1516exit:
1517 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001518 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07001519 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001520 if (_exception) {
1521 jniThrowException(_env, _exceptionType, _exceptionMessage);
1522 }
Jack Palevich27f80022009-04-15 19:13:17 -07001523}
1524
1525/* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */
1526static void
1527android_glGetMaterialfv__II_3FI
1528 (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) {
1529 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001530 const char * _exceptionType = NULL;
1531 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001532 GLfloat *params_base = (GLfloat *) 0;
1533 jint _remaining;
1534 GLfloat *params = (GLfloat *) 0;
1535
1536 if (!params_ref) {
1537 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001538 _exceptionType = "java/lang/IllegalArgumentException";
1539 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001540 goto exit;
1541 }
1542 if (offset < 0) {
1543 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001544 _exceptionType = "java/lang/IllegalArgumentException";
1545 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001546 goto exit;
1547 }
1548 _remaining = _env->GetArrayLength(params_ref) - offset;
1549 int _needed;
1550 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001551#if defined(GL_AMBIENT)
1552 case GL_AMBIENT:
1553#endif // defined(GL_AMBIENT)
1554#if defined(GL_DIFFUSE)
1555 case GL_DIFFUSE:
1556#endif // defined(GL_DIFFUSE)
1557#if defined(GL_SPECULAR)
1558 case GL_SPECULAR:
1559#endif // defined(GL_SPECULAR)
1560#if defined(GL_EMISSION)
1561 case GL_EMISSION:
1562#endif // defined(GL_EMISSION)
1563#if defined(GL_AMBIENT_AND_DIFFUSE)
1564 case GL_AMBIENT_AND_DIFFUSE:
1565#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1566 _needed = 4;
1567 break;
1568 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001569 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001570 break;
1571 }
1572 if (_remaining < _needed) {
1573 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001574 _exceptionType = "java/lang/IllegalArgumentException";
1575 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001576 goto exit;
1577 }
1578 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001579 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001580 params = params_base + offset;
1581
1582 glGetMaterialfv(
1583 (GLenum)face,
1584 (GLenum)pname,
1585 (GLfloat *)params
1586 );
1587
1588exit:
1589 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001590 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001591 _exception ? JNI_ABORT: 0);
1592 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001593 if (_exception) {
1594 jniThrowException(_env, _exceptionType, _exceptionMessage);
1595 }
Jack Palevich27f80022009-04-15 19:13:17 -07001596}
1597
1598/* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */
1599static void
1600android_glGetMaterialfv__IILjava_nio_FloatBuffer_2
1601 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
1602 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001603 const char * _exceptionType = NULL;
1604 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001605 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001606 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001607 jint _remaining;
1608 GLfloat *params = (GLfloat *) 0;
1609
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001610 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001611 int _needed;
1612 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001613#if defined(GL_AMBIENT)
1614 case GL_AMBIENT:
1615#endif // defined(GL_AMBIENT)
1616#if defined(GL_DIFFUSE)
1617 case GL_DIFFUSE:
1618#endif // defined(GL_DIFFUSE)
1619#if defined(GL_SPECULAR)
1620 case GL_SPECULAR:
1621#endif // defined(GL_SPECULAR)
1622#if defined(GL_EMISSION)
1623 case GL_EMISSION:
1624#endif // defined(GL_EMISSION)
1625#if defined(GL_AMBIENT_AND_DIFFUSE)
1626 case GL_AMBIENT_AND_DIFFUSE:
1627#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1628 _needed = 4;
1629 break;
1630 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001631 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001632 break;
1633 }
1634 if (_remaining < _needed) {
1635 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001636 _exceptionType = "java/lang/IllegalArgumentException";
1637 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001638 goto exit;
1639 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001640 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001641 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001642 params = (GLfloat *) (_paramsBase + _bufferOffset);
1643 }
Jack Palevich27f80022009-04-15 19:13:17 -07001644 glGetMaterialfv(
1645 (GLenum)face,
1646 (GLenum)pname,
1647 (GLfloat *)params
1648 );
1649
1650exit:
1651 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001652 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07001653 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001654 if (_exception) {
1655 jniThrowException(_env, _exceptionType, _exceptionMessage);
1656 }
Jack Palevich27f80022009-04-15 19:13:17 -07001657}
1658
1659/* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */
1660static void
1661android_glGetMaterialxv__II_3II
1662 (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) {
1663 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001664 const char * _exceptionType = NULL;
1665 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001666 GLfixed *params_base = (GLfixed *) 0;
1667 jint _remaining;
1668 GLfixed *params = (GLfixed *) 0;
1669
1670 if (!params_ref) {
1671 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001672 _exceptionType = "java/lang/IllegalArgumentException";
1673 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001674 goto exit;
1675 }
1676 if (offset < 0) {
1677 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001678 _exceptionType = "java/lang/IllegalArgumentException";
1679 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001680 goto exit;
1681 }
1682 _remaining = _env->GetArrayLength(params_ref) - offset;
1683 int _needed;
1684 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001685#if defined(GL_AMBIENT)
1686 case GL_AMBIENT:
1687#endif // defined(GL_AMBIENT)
1688#if defined(GL_DIFFUSE)
1689 case GL_DIFFUSE:
1690#endif // defined(GL_DIFFUSE)
1691#if defined(GL_SPECULAR)
1692 case GL_SPECULAR:
1693#endif // defined(GL_SPECULAR)
1694#if defined(GL_EMISSION)
1695 case GL_EMISSION:
1696#endif // defined(GL_EMISSION)
1697#if defined(GL_AMBIENT_AND_DIFFUSE)
1698 case GL_AMBIENT_AND_DIFFUSE:
1699#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1700 _needed = 4;
1701 break;
1702 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001703 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001704 break;
1705 }
1706 if (_remaining < _needed) {
1707 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001708 _exceptionType = "java/lang/IllegalArgumentException";
1709 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001710 goto exit;
1711 }
1712 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001713 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001714 params = params_base + offset;
1715
1716 glGetMaterialxv(
1717 (GLenum)face,
1718 (GLenum)pname,
1719 (GLfixed *)params
1720 );
1721
1722exit:
1723 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001724 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001725 _exception ? JNI_ABORT: 0);
1726 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001727 if (_exception) {
1728 jniThrowException(_env, _exceptionType, _exceptionMessage);
1729 }
Jack Palevich27f80022009-04-15 19:13:17 -07001730}
1731
1732/* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */
1733static void
1734android_glGetMaterialxv__IILjava_nio_IntBuffer_2
1735 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
1736 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001737 const char * _exceptionType = NULL;
1738 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001739 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001740 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001741 jint _remaining;
1742 GLfixed *params = (GLfixed *) 0;
1743
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001744 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001745 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 = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001772 goto exit;
1773 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001774 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001775 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001776 params = (GLfixed *) (_paramsBase + _bufferOffset);
1777 }
Jack Palevich27f80022009-04-15 19:13:17 -07001778 glGetMaterialxv(
1779 (GLenum)face,
1780 (GLenum)pname,
1781 (GLfixed *)params
1782 );
1783
1784exit:
1785 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001786 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07001787 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001788 if (_exception) {
1789 jniThrowException(_env, _exceptionType, _exceptionMessage);
1790 }
Jack Palevich27f80022009-04-15 19:13:17 -07001791}
1792
1793/* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */
1794static void
1795android_glGetTexEnvfv__II_3FI
1796 (JNIEnv *_env, jobject _this, jint env, jint pname, jfloatArray params_ref, jint offset) {
1797 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001798 const char * _exceptionType = NULL;
1799 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001800 GLfloat *params_base = (GLfloat *) 0;
1801 jint _remaining;
1802 GLfloat *params = (GLfloat *) 0;
1803
1804 if (!params_ref) {
1805 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001806 _exceptionType = "java/lang/IllegalArgumentException";
1807 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001808 goto exit;
1809 }
1810 if (offset < 0) {
1811 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001812 _exceptionType = "java/lang/IllegalArgumentException";
1813 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001814 goto exit;
1815 }
1816 _remaining = _env->GetArrayLength(params_ref) - offset;
1817 int _needed;
1818 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001819#if defined(GL_TEXTURE_ENV_COLOR)
1820 case GL_TEXTURE_ENV_COLOR:
1821#endif // defined(GL_TEXTURE_ENV_COLOR)
1822 _needed = 4;
1823 break;
1824 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001825 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001826 break;
1827 }
1828 if (_remaining < _needed) {
1829 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001830 _exceptionType = "java/lang/IllegalArgumentException";
1831 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001832 goto exit;
1833 }
1834 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001835 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001836 params = params_base + offset;
1837
1838 glGetTexEnvfv(
1839 (GLenum)env,
1840 (GLenum)pname,
1841 (GLfloat *)params
1842 );
1843
1844exit:
1845 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001846 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001847 _exception ? JNI_ABORT: 0);
1848 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001849 if (_exception) {
1850 jniThrowException(_env, _exceptionType, _exceptionMessage);
1851 }
Jack Palevich27f80022009-04-15 19:13:17 -07001852}
1853
1854/* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */
1855static void
1856android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2
1857 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
1858 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001859 const char * _exceptionType = NULL;
1860 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001861 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001862 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001863 jint _remaining;
1864 GLfloat *params = (GLfloat *) 0;
1865
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001866 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001867 int _needed;
1868 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001869#if defined(GL_TEXTURE_ENV_COLOR)
1870 case GL_TEXTURE_ENV_COLOR:
1871#endif // defined(GL_TEXTURE_ENV_COLOR)
1872 _needed = 4;
1873 break;
1874 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001875 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001876 break;
1877 }
1878 if (_remaining < _needed) {
1879 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001880 _exceptionType = "java/lang/IllegalArgumentException";
1881 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001882 goto exit;
1883 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001884 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001885 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001886 params = (GLfloat *) (_paramsBase + _bufferOffset);
1887 }
Jack Palevich27f80022009-04-15 19:13:17 -07001888 glGetTexEnvfv(
1889 (GLenum)env,
1890 (GLenum)pname,
1891 (GLfloat *)params
1892 );
1893
1894exit:
1895 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001896 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07001897 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001898 if (_exception) {
1899 jniThrowException(_env, _exceptionType, _exceptionMessage);
1900 }
Jack Palevich27f80022009-04-15 19:13:17 -07001901}
1902
1903/* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */
1904static void
1905android_glGetTexEnviv__II_3II
1906 (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) {
1907 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001908 const char * _exceptionType = NULL;
1909 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001910 GLint *params_base = (GLint *) 0;
1911 jint _remaining;
1912 GLint *params = (GLint *) 0;
1913
1914 if (!params_ref) {
1915 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001916 _exceptionType = "java/lang/IllegalArgumentException";
1917 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001918 goto exit;
1919 }
1920 if (offset < 0) {
1921 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001922 _exceptionType = "java/lang/IllegalArgumentException";
1923 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001924 goto exit;
1925 }
1926 _remaining = _env->GetArrayLength(params_ref) - offset;
1927 int _needed;
1928 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001929#if defined(GL_TEXTURE_ENV_COLOR)
1930 case GL_TEXTURE_ENV_COLOR:
1931#endif // defined(GL_TEXTURE_ENV_COLOR)
1932 _needed = 4;
1933 break;
1934 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001935 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001936 break;
1937 }
1938 if (_remaining < _needed) {
1939 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001940 _exceptionType = "java/lang/IllegalArgumentException";
1941 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001942 goto exit;
1943 }
1944 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001945 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07001946 params = params_base + offset;
1947
1948 glGetTexEnviv(
1949 (GLenum)env,
1950 (GLenum)pname,
1951 (GLint *)params
1952 );
1953
1954exit:
1955 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001956 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07001957 _exception ? JNI_ABORT: 0);
1958 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001959 if (_exception) {
1960 jniThrowException(_env, _exceptionType, _exceptionMessage);
1961 }
Jack Palevich27f80022009-04-15 19:13:17 -07001962}
1963
1964/* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */
1965static void
1966android_glGetTexEnviv__IILjava_nio_IntBuffer_2
1967 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
1968 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001969 const char * _exceptionType = NULL;
1970 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001971 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001972 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001973 jint _remaining;
1974 GLint *params = (GLint *) 0;
1975
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001976 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001977 int _needed;
1978 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001979#if defined(GL_TEXTURE_ENV_COLOR)
1980 case GL_TEXTURE_ENV_COLOR:
1981#endif // defined(GL_TEXTURE_ENV_COLOR)
1982 _needed = 4;
1983 break;
1984 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001985 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001986 break;
1987 }
1988 if (_remaining < _needed) {
1989 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001990 _exceptionType = "java/lang/IllegalArgumentException";
1991 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001992 goto exit;
1993 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001994 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001995 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001996 params = (GLint *) (_paramsBase + _bufferOffset);
1997 }
Jack Palevich27f80022009-04-15 19:13:17 -07001998 glGetTexEnviv(
1999 (GLenum)env,
2000 (GLenum)pname,
2001 (GLint *)params
2002 );
2003
2004exit:
2005 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002006 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07002007 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002008 if (_exception) {
2009 jniThrowException(_env, _exceptionType, _exceptionMessage);
2010 }
Jack Palevich27f80022009-04-15 19:13:17 -07002011}
2012
2013/* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */
2014static void
2015android_glGetTexEnvxv__II_3II
2016 (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) {
2017 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002018 const char * _exceptionType = NULL;
2019 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002020 GLfixed *params_base = (GLfixed *) 0;
2021 jint _remaining;
2022 GLfixed *params = (GLfixed *) 0;
2023
2024 if (!params_ref) {
2025 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002026 _exceptionType = "java/lang/IllegalArgumentException";
2027 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002028 goto exit;
2029 }
2030 if (offset < 0) {
2031 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002032 _exceptionType = "java/lang/IllegalArgumentException";
2033 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002034 goto exit;
2035 }
2036 _remaining = _env->GetArrayLength(params_ref) - offset;
2037 int _needed;
2038 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002039#if defined(GL_TEXTURE_ENV_COLOR)
2040 case GL_TEXTURE_ENV_COLOR:
2041#endif // defined(GL_TEXTURE_ENV_COLOR)
2042 _needed = 4;
2043 break;
2044 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002045 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002046 break;
2047 }
2048 if (_remaining < _needed) {
2049 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002050 _exceptionType = "java/lang/IllegalArgumentException";
2051 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002052 goto exit;
2053 }
2054 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002055 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002056 params = params_base + offset;
2057
2058 glGetTexEnvxv(
2059 (GLenum)env,
2060 (GLenum)pname,
2061 (GLfixed *)params
2062 );
2063
2064exit:
2065 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002066 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002067 _exception ? JNI_ABORT: 0);
2068 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002069 if (_exception) {
2070 jniThrowException(_env, _exceptionType, _exceptionMessage);
2071 }
Jack Palevich27f80022009-04-15 19:13:17 -07002072}
2073
2074/* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */
2075static void
2076android_glGetTexEnvxv__IILjava_nio_IntBuffer_2
2077 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
2078 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002079 const char * _exceptionType = NULL;
2080 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002081 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002082 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002083 jint _remaining;
2084 GLfixed *params = (GLfixed *) 0;
2085
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002086 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002087 int _needed;
2088 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002089#if defined(GL_TEXTURE_ENV_COLOR)
2090 case GL_TEXTURE_ENV_COLOR:
2091#endif // defined(GL_TEXTURE_ENV_COLOR)
2092 _needed = 4;
2093 break;
2094 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002095 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002096 break;
2097 }
2098 if (_remaining < _needed) {
2099 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002100 _exceptionType = "java/lang/IllegalArgumentException";
2101 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002102 goto exit;
2103 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002104 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002105 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002106 params = (GLfixed *) (_paramsBase + _bufferOffset);
2107 }
Jack Palevich27f80022009-04-15 19:13:17 -07002108 glGetTexEnvxv(
2109 (GLenum)env,
2110 (GLenum)pname,
2111 (GLfixed *)params
2112 );
2113
2114exit:
2115 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002116 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07002117 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002118 if (_exception) {
2119 jniThrowException(_env, _exceptionType, _exceptionMessage);
2120 }
Jack Palevich27f80022009-04-15 19:13:17 -07002121}
2122
2123/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
2124static void
2125android_glGetTexParameterfv__II_3FI
2126 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
2127 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002128 const char * _exceptionType = NULL;
2129 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002130 GLfloat *params_base = (GLfloat *) 0;
2131 jint _remaining;
2132 GLfloat *params = (GLfloat *) 0;
2133
2134 if (!params_ref) {
2135 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002136 _exceptionType = "java/lang/IllegalArgumentException";
2137 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002138 goto exit;
2139 }
2140 if (offset < 0) {
2141 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002142 _exceptionType = "java/lang/IllegalArgumentException";
2143 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002144 goto exit;
2145 }
2146 _remaining = _env->GetArrayLength(params_ref) - offset;
2147 if (_remaining < 1) {
2148 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002149 _exceptionType = "java/lang/IllegalArgumentException";
2150 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002151 goto exit;
2152 }
2153 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002154 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002155 params = params_base + offset;
2156
2157 glGetTexParameterfv(
2158 (GLenum)target,
2159 (GLenum)pname,
2160 (GLfloat *)params
2161 );
2162
2163exit:
2164 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002165 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002166 _exception ? JNI_ABORT: 0);
2167 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002168 if (_exception) {
2169 jniThrowException(_env, _exceptionType, _exceptionMessage);
2170 }
Jack Palevich27f80022009-04-15 19:13:17 -07002171}
2172
2173/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
2174static void
2175android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2
2176 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2177 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002178 const char * _exceptionType = NULL;
2179 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002180 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002181 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002182 jint _remaining;
2183 GLfloat *params = (GLfloat *) 0;
2184
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002185 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002186 if (_remaining < 1) {
2187 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002188 _exceptionType = "java/lang/IllegalArgumentException";
2189 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002190 goto exit;
2191 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002192 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002193 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002194 params = (GLfloat *) (_paramsBase + _bufferOffset);
2195 }
Jack Palevich27f80022009-04-15 19:13:17 -07002196 glGetTexParameterfv(
2197 (GLenum)target,
2198 (GLenum)pname,
2199 (GLfloat *)params
2200 );
2201
2202exit:
2203 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002204 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07002205 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002206 if (_exception) {
2207 jniThrowException(_env, _exceptionType, _exceptionMessage);
2208 }
Jack Palevich27f80022009-04-15 19:13:17 -07002209}
2210
2211/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2212static void
2213android_glGetTexParameteriv__II_3II
2214 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2215 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002216 const char * _exceptionType = NULL;
2217 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002218 GLint *params_base = (GLint *) 0;
2219 jint _remaining;
2220 GLint *params = (GLint *) 0;
2221
2222 if (!params_ref) {
2223 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002224 _exceptionType = "java/lang/IllegalArgumentException";
2225 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002226 goto exit;
2227 }
2228 if (offset < 0) {
2229 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002230 _exceptionType = "java/lang/IllegalArgumentException";
2231 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002232 goto exit;
2233 }
2234 _remaining = _env->GetArrayLength(params_ref) - offset;
2235 if (_remaining < 1) {
2236 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002237 _exceptionType = "java/lang/IllegalArgumentException";
2238 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002239 goto exit;
2240 }
2241 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002242 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002243 params = params_base + offset;
2244
2245 glGetTexParameteriv(
2246 (GLenum)target,
2247 (GLenum)pname,
2248 (GLint *)params
2249 );
2250
2251exit:
2252 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002253 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002254 _exception ? JNI_ABORT: 0);
2255 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002256 if (_exception) {
2257 jniThrowException(_env, _exceptionType, _exceptionMessage);
2258 }
Jack Palevich27f80022009-04-15 19:13:17 -07002259}
2260
2261/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2262static void
2263android_glGetTexParameteriv__IILjava_nio_IntBuffer_2
2264 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2265 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002266 const char * _exceptionType = NULL;
2267 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002268 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002269 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002270 jint _remaining;
2271 GLint *params = (GLint *) 0;
2272
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002273 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002274 if (_remaining < 1) {
2275 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002276 _exceptionType = "java/lang/IllegalArgumentException";
2277 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002278 goto exit;
2279 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002280 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002281 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002282 params = (GLint *) (_paramsBase + _bufferOffset);
2283 }
Jack Palevich27f80022009-04-15 19:13:17 -07002284 glGetTexParameteriv(
2285 (GLenum)target,
2286 (GLenum)pname,
2287 (GLint *)params
2288 );
2289
2290exit:
2291 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002292 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07002293 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002294 if (_exception) {
2295 jniThrowException(_env, _exceptionType, _exceptionMessage);
2296 }
Jack Palevich27f80022009-04-15 19:13:17 -07002297}
2298
2299/* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */
2300static void
2301android_glGetTexParameterxv__II_3II
2302 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2303 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002304 const char * _exceptionType = NULL;
2305 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002306 GLfixed *params_base = (GLfixed *) 0;
2307 jint _remaining;
2308 GLfixed *params = (GLfixed *) 0;
2309
2310 if (!params_ref) {
2311 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002312 _exceptionType = "java/lang/IllegalArgumentException";
2313 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002314 goto exit;
2315 }
2316 if (offset < 0) {
2317 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002318 _exceptionType = "java/lang/IllegalArgumentException";
2319 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002320 goto exit;
2321 }
2322 _remaining = _env->GetArrayLength(params_ref) - offset;
2323 if (_remaining < 1) {
2324 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002325 _exceptionType = "java/lang/IllegalArgumentException";
2326 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002327 goto exit;
2328 }
2329 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002330 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002331 params = params_base + offset;
2332
2333 glGetTexParameterxv(
2334 (GLenum)target,
2335 (GLenum)pname,
2336 (GLfixed *)params
2337 );
2338
2339exit:
2340 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002341 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002342 _exception ? JNI_ABORT: 0);
2343 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002344 if (_exception) {
2345 jniThrowException(_env, _exceptionType, _exceptionMessage);
2346 }
Jack Palevich27f80022009-04-15 19:13:17 -07002347}
2348
2349/* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */
2350static void
2351android_glGetTexParameterxv__IILjava_nio_IntBuffer_2
2352 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2353 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002354 const char * _exceptionType = NULL;
2355 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002356 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002357 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002358 jint _remaining;
2359 GLfixed *params = (GLfixed *) 0;
2360
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002361 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002362 if (_remaining < 1) {
2363 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002364 _exceptionType = "java/lang/IllegalArgumentException";
2365 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002366 goto exit;
2367 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002368 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002369 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002370 params = (GLfixed *) (_paramsBase + _bufferOffset);
2371 }
Jack Palevich27f80022009-04-15 19:13:17 -07002372 glGetTexParameterxv(
2373 (GLenum)target,
2374 (GLenum)pname,
2375 (GLfixed *)params
2376 );
2377
2378exit:
2379 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002380 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich27f80022009-04-15 19:13:17 -07002381 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002382 if (_exception) {
2383 jniThrowException(_env, _exceptionType, _exceptionMessage);
2384 }
Jack Palevich27f80022009-04-15 19:13:17 -07002385}
2386
2387/* GLboolean glIsBuffer ( GLuint buffer ) */
2388static jboolean
2389android_glIsBuffer__I
2390 (JNIEnv *_env, jobject _this, jint buffer) {
2391 GLboolean _returnValue;
2392 _returnValue = glIsBuffer(
2393 (GLuint)buffer
2394 );
Andy McFaddencee51982013-04-25 16:08:31 -07002395 return (jboolean)_returnValue;
Jack Palevich27f80022009-04-15 19:13:17 -07002396}
2397
2398/* GLboolean glIsEnabled ( GLenum cap ) */
2399static jboolean
2400android_glIsEnabled__I
2401 (JNIEnv *_env, jobject _this, jint cap) {
2402 GLboolean _returnValue;
2403 _returnValue = glIsEnabled(
2404 (GLenum)cap
2405 );
Andy McFaddencee51982013-04-25 16:08:31 -07002406 return (jboolean)_returnValue;
Jack Palevich27f80022009-04-15 19:13:17 -07002407}
2408
2409/* GLboolean glIsTexture ( GLuint texture ) */
2410static jboolean
2411android_glIsTexture__I
2412 (JNIEnv *_env, jobject _this, jint texture) {
2413 GLboolean _returnValue;
2414 _returnValue = glIsTexture(
2415 (GLuint)texture
2416 );
Andy McFaddencee51982013-04-25 16:08:31 -07002417 return (jboolean)_returnValue;
Jack Palevich27f80022009-04-15 19:13:17 -07002418}
2419
2420/* void glNormalPointer ( GLenum type, GLsizei stride, GLint offset ) */
2421static void
2422android_glNormalPointer__III
2423 (JNIEnv *_env, jobject _this, jint type, jint stride, jint offset) {
2424 glNormalPointer(
2425 (GLenum)type,
2426 (GLsizei)stride,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00002427 reinterpret_cast<GLvoid *>(offset)
Jack Palevich27f80022009-04-15 19:13:17 -07002428 );
2429}
2430
2431/* void glPointParameterf ( GLenum pname, GLfloat param ) */
2432static void
2433android_glPointParameterf__IF
2434 (JNIEnv *_env, jobject _this, jint pname, jfloat param) {
2435 glPointParameterf(
2436 (GLenum)pname,
2437 (GLfloat)param
2438 );
2439}
2440
2441/* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */
2442static void
2443android_glPointParameterfv__I_3FI
2444 (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002445 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002446 const char * _exceptionType = NULL;
2447 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002448 GLfloat *params_base = (GLfloat *) 0;
2449 jint _remaining;
2450 GLfloat *params = (GLfloat *) 0;
2451
2452 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002453 _exception = 1;
2454 _exceptionType = "java/lang/IllegalArgumentException";
2455 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002456 goto exit;
2457 }
2458 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002459 _exception = 1;
2460 _exceptionType = "java/lang/IllegalArgumentException";
2461 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002462 goto exit;
2463 }
2464 _remaining = _env->GetArrayLength(params_ref) - offset;
2465 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002466 _exception = 1;
2467 _exceptionType = "java/lang/IllegalArgumentException";
2468 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002469 goto exit;
2470 }
2471 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002472 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002473 params = params_base + offset;
2474
2475 glPointParameterfv(
2476 (GLenum)pname,
2477 (GLfloat *)params
2478 );
2479
2480exit:
2481 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002482 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002483 JNI_ABORT);
2484 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002485 if (_exception) {
2486 jniThrowException(_env, _exceptionType, _exceptionMessage);
2487 }
Jack Palevich27f80022009-04-15 19:13:17 -07002488}
2489
2490/* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */
2491static void
2492android_glPointParameterfv__ILjava_nio_FloatBuffer_2
2493 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002494 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002495 const char * _exceptionType = NULL;
2496 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002497 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002498 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002499 jint _remaining;
2500 GLfloat *params = (GLfloat *) 0;
2501
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002502 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002503 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002504 _exception = 1;
2505 _exceptionType = "java/lang/IllegalArgumentException";
2506 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002507 goto exit;
2508 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002509 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002510 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002511 params = (GLfloat *) (_paramsBase + _bufferOffset);
2512 }
Jack Palevich27f80022009-04-15 19:13:17 -07002513 glPointParameterfv(
2514 (GLenum)pname,
2515 (GLfloat *)params
2516 );
2517
2518exit:
2519 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002520 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07002521 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002522 if (_exception) {
2523 jniThrowException(_env, _exceptionType, _exceptionMessage);
2524 }
Jack Palevich27f80022009-04-15 19:13:17 -07002525}
2526
2527/* void glPointParameterx ( GLenum pname, GLfixed param ) */
2528static void
2529android_glPointParameterx__II
2530 (JNIEnv *_env, jobject _this, jint pname, jint param) {
2531 glPointParameterx(
2532 (GLenum)pname,
2533 (GLfixed)param
2534 );
2535}
2536
2537/* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */
2538static void
2539android_glPointParameterxv__I_3II
2540 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002541 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002542 const char * _exceptionType = NULL;
2543 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002544 GLfixed *params_base = (GLfixed *) 0;
2545 jint _remaining;
2546 GLfixed *params = (GLfixed *) 0;
2547
2548 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002549 _exception = 1;
2550 _exceptionType = "java/lang/IllegalArgumentException";
2551 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002552 goto exit;
2553 }
2554 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002555 _exception = 1;
2556 _exceptionType = "java/lang/IllegalArgumentException";
2557 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002558 goto exit;
2559 }
2560 _remaining = _env->GetArrayLength(params_ref) - offset;
2561 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002562 _exception = 1;
2563 _exceptionType = "java/lang/IllegalArgumentException";
2564 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002565 goto exit;
2566 }
2567 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002568 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002569 params = params_base + offset;
2570
2571 glPointParameterxv(
2572 (GLenum)pname,
2573 (GLfixed *)params
2574 );
2575
2576exit:
2577 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002578 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002579 JNI_ABORT);
2580 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002581 if (_exception) {
2582 jniThrowException(_env, _exceptionType, _exceptionMessage);
2583 }
Jack Palevich27f80022009-04-15 19:13:17 -07002584}
2585
2586/* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */
2587static void
2588android_glPointParameterxv__ILjava_nio_IntBuffer_2
2589 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002590 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002591 const char * _exceptionType = NULL;
2592 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002593 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002594 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002595 jint _remaining;
2596 GLfixed *params = (GLfixed *) 0;
2597
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002598 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002599 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002600 _exception = 1;
2601 _exceptionType = "java/lang/IllegalArgumentException";
2602 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002603 goto exit;
2604 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002605 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002606 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002607 params = (GLfixed *) (_paramsBase + _bufferOffset);
2608 }
Jack Palevich27f80022009-04-15 19:13:17 -07002609 glPointParameterxv(
2610 (GLenum)pname,
2611 (GLfixed *)params
2612 );
2613
2614exit:
2615 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002616 _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07002617 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002618 if (_exception) {
2619 jniThrowException(_env, _exceptionType, _exceptionMessage);
2620 }
Jack Palevich27f80022009-04-15 19:13:17 -07002621}
2622
2623/* void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) */
2624static void
Jack Palevichbe6eac82009-12-08 15:43:51 +08002625android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I
2626 (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) {
Jack Palevich27f80022009-04-15 19:13:17 -07002627 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002628 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002629 jint _remaining;
2630 GLvoid *pointer = (GLvoid *) 0;
2631
Jack Palevichbe6eac82009-12-08 15:43:51 +08002632 if (pointer_buf) {
2633 pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
2634 if ( ! pointer ) {
2635 return;
2636 }
2637 }
2638 glPointSizePointerOESBounds(
Jack Palevich27f80022009-04-15 19:13:17 -07002639 (GLenum)type,
2640 (GLsizei)stride,
Jack Palevichbe6eac82009-12-08 15:43:51 +08002641 (GLvoid *)pointer,
2642 (GLsizei)remaining
Jack Palevich27f80022009-04-15 19:13:17 -07002643 );
Jack Palevich27f80022009-04-15 19:13:17 -07002644}
2645
2646/* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
2647static void
2648android_glTexCoordPointer__IIII
2649 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
2650 glTexCoordPointer(
2651 (GLint)size,
2652 (GLenum)type,
2653 (GLsizei)stride,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00002654 reinterpret_cast<GLvoid *>(offset)
Jack Palevich27f80022009-04-15 19:13:17 -07002655 );
2656}
2657
2658/* void glTexEnvi ( GLenum target, GLenum pname, GLint param ) */
2659static void
2660android_glTexEnvi__III
2661 (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
2662 glTexEnvi(
2663 (GLenum)target,
2664 (GLenum)pname,
2665 (GLint)param
2666 );
2667}
2668
2669/* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */
2670static void
2671android_glTexEnviv__II_3II
2672 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002673 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002674 const char * _exceptionType = NULL;
2675 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002676 GLint *params_base = (GLint *) 0;
2677 jint _remaining;
2678 GLint *params = (GLint *) 0;
2679
2680 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002681 _exception = 1;
2682 _exceptionType = "java/lang/IllegalArgumentException";
2683 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002684 goto exit;
2685 }
2686 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002687 _exception = 1;
2688 _exceptionType = "java/lang/IllegalArgumentException";
2689 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002690 goto exit;
2691 }
2692 _remaining = _env->GetArrayLength(params_ref) - offset;
2693 int _needed;
2694 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002695#if defined(GL_TEXTURE_ENV_COLOR)
2696 case GL_TEXTURE_ENV_COLOR:
2697#endif // defined(GL_TEXTURE_ENV_COLOR)
2698 _needed = 4;
2699 break;
2700 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002701 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002702 break;
2703 }
2704 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002705 _exception = 1;
2706 _exceptionType = "java/lang/IllegalArgumentException";
2707 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002708 goto exit;
2709 }
2710 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002711 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002712 params = params_base + offset;
2713
2714 glTexEnviv(
2715 (GLenum)target,
2716 (GLenum)pname,
2717 (GLint *)params
2718 );
2719
2720exit:
2721 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002722 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002723 JNI_ABORT);
2724 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002725 if (_exception) {
2726 jniThrowException(_env, _exceptionType, _exceptionMessage);
2727 }
Jack Palevich27f80022009-04-15 19:13:17 -07002728}
2729
2730/* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */
2731static void
2732android_glTexEnviv__IILjava_nio_IntBuffer_2
2733 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002734 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002735 const char * _exceptionType = NULL;
2736 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002737 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002738 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002739 jint _remaining;
2740 GLint *params = (GLint *) 0;
2741
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002742 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002743 int _needed;
2744 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002745#if defined(GL_TEXTURE_ENV_COLOR)
2746 case GL_TEXTURE_ENV_COLOR:
2747#endif // defined(GL_TEXTURE_ENV_COLOR)
2748 _needed = 4;
2749 break;
2750 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002751 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002752 break;
2753 }
2754 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002755 _exception = 1;
2756 _exceptionType = "java/lang/IllegalArgumentException";
2757 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002758 goto exit;
2759 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002760 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002761 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002762 params = (GLint *) (_paramsBase + _bufferOffset);
2763 }
Jack Palevich27f80022009-04-15 19:13:17 -07002764 glTexEnviv(
2765 (GLenum)target,
2766 (GLenum)pname,
2767 (GLint *)params
2768 );
2769
2770exit:
2771 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002772 _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07002773 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002774 if (_exception) {
2775 jniThrowException(_env, _exceptionType, _exceptionMessage);
2776 }
Jack Palevich27f80022009-04-15 19:13:17 -07002777}
2778
2779/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
2780static void
2781android_glTexParameterfv__II_3FI
2782 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002783 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002784 const char * _exceptionType = NULL;
2785 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002786 GLfloat *params_base = (GLfloat *) 0;
2787 jint _remaining;
2788 GLfloat *params = (GLfloat *) 0;
2789
2790 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002791 _exception = 1;
2792 _exceptionType = "java/lang/IllegalArgumentException";
2793 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002794 goto exit;
2795 }
2796 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002797 _exception = 1;
2798 _exceptionType = "java/lang/IllegalArgumentException";
2799 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002800 goto exit;
2801 }
2802 _remaining = _env->GetArrayLength(params_ref) - offset;
2803 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002804 _exception = 1;
2805 _exceptionType = "java/lang/IllegalArgumentException";
2806 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002807 goto exit;
2808 }
2809 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002810 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002811 params = params_base + offset;
2812
2813 glTexParameterfv(
2814 (GLenum)target,
2815 (GLenum)pname,
2816 (GLfloat *)params
2817 );
2818
2819exit:
2820 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002821 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002822 JNI_ABORT);
2823 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002824 if (_exception) {
2825 jniThrowException(_env, _exceptionType, _exceptionMessage);
2826 }
Jack Palevich27f80022009-04-15 19:13:17 -07002827}
2828
2829/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
2830static void
2831android_glTexParameterfv__IILjava_nio_FloatBuffer_2
2832 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002833 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002834 const char * _exceptionType = NULL;
2835 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002836 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002837 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002838 jint _remaining;
2839 GLfloat *params = (GLfloat *) 0;
2840
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002841 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002842 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002843 _exception = 1;
2844 _exceptionType = "java/lang/IllegalArgumentException";
2845 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002846 goto exit;
2847 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002848 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002849 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002850 params = (GLfloat *) (_paramsBase + _bufferOffset);
2851 }
Jack Palevich27f80022009-04-15 19:13:17 -07002852 glTexParameterfv(
2853 (GLenum)target,
2854 (GLenum)pname,
2855 (GLfloat *)params
2856 );
2857
2858exit:
2859 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002860 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07002861 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002862 if (_exception) {
2863 jniThrowException(_env, _exceptionType, _exceptionMessage);
2864 }
Jack Palevich27f80022009-04-15 19:13:17 -07002865}
2866
2867/* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */
2868static void
2869android_glTexParameteri__III
2870 (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
2871 glTexParameteri(
2872 (GLenum)target,
2873 (GLenum)pname,
2874 (GLint)param
2875 );
2876}
2877
2878/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
2879static void
2880android_glTexParameteriv__II_3II
2881 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002882 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002883 const char * _exceptionType = NULL;
2884 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002885 GLint *params_base = (GLint *) 0;
2886 jint _remaining;
2887 GLint *params = (GLint *) 0;
2888
2889 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002890 _exception = 1;
2891 _exceptionType = "java/lang/IllegalArgumentException";
2892 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002893 goto exit;
2894 }
2895 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002896 _exception = 1;
2897 _exceptionType = "java/lang/IllegalArgumentException";
2898 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002899 goto exit;
2900 }
2901 _remaining = _env->GetArrayLength(params_ref) - offset;
2902 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002903 _exception = 1;
2904 _exceptionType = "java/lang/IllegalArgumentException";
2905 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002906 goto exit;
2907 }
2908 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002909 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002910 params = params_base + offset;
2911
2912 glTexParameteriv(
2913 (GLenum)target,
2914 (GLenum)pname,
2915 (GLint *)params
2916 );
2917
2918exit:
2919 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002920 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07002921 JNI_ABORT);
2922 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002923 if (_exception) {
2924 jniThrowException(_env, _exceptionType, _exceptionMessage);
2925 }
Jack Palevich27f80022009-04-15 19:13:17 -07002926}
2927
2928/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
2929static void
2930android_glTexParameteriv__IILjava_nio_IntBuffer_2
2931 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002932 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002933 const char * _exceptionType = NULL;
2934 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002935 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002936 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002937 jint _remaining;
2938 GLint *params = (GLint *) 0;
2939
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002940 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002941 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002942 _exception = 1;
2943 _exceptionType = "java/lang/IllegalArgumentException";
2944 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002945 goto exit;
2946 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002947 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002948 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002949 params = (GLint *) (_paramsBase + _bufferOffset);
2950 }
Jack Palevich27f80022009-04-15 19:13:17 -07002951 glTexParameteriv(
2952 (GLenum)target,
2953 (GLenum)pname,
2954 (GLint *)params
2955 );
2956
2957exit:
2958 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002959 _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07002960 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002961 if (_exception) {
2962 jniThrowException(_env, _exceptionType, _exceptionMessage);
2963 }
Jack Palevich27f80022009-04-15 19:13:17 -07002964}
2965
2966/* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */
2967static void
2968android_glTexParameterxv__II_3II
2969 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002970 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002971 const char * _exceptionType = NULL;
2972 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002973 GLfixed *params_base = (GLfixed *) 0;
2974 jint _remaining;
2975 GLfixed *params = (GLfixed *) 0;
2976
2977 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002978 _exception = 1;
2979 _exceptionType = "java/lang/IllegalArgumentException";
2980 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002981 goto exit;
2982 }
2983 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002984 _exception = 1;
2985 _exceptionType = "java/lang/IllegalArgumentException";
2986 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002987 goto exit;
2988 }
2989 _remaining = _env->GetArrayLength(params_ref) - offset;
2990 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002991 _exception = 1;
2992 _exceptionType = "java/lang/IllegalArgumentException";
2993 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002994 goto exit;
2995 }
2996 params_base = (GLfixed *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002997 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich27f80022009-04-15 19:13:17 -07002998 params = params_base + offset;
2999
3000 glTexParameterxv(
3001 (GLenum)target,
3002 (GLenum)pname,
3003 (GLfixed *)params
3004 );
3005
3006exit:
3007 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003008 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich27f80022009-04-15 19:13:17 -07003009 JNI_ABORT);
3010 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003011 if (_exception) {
3012 jniThrowException(_env, _exceptionType, _exceptionMessage);
3013 }
Jack Palevich27f80022009-04-15 19:13:17 -07003014}
3015
3016/* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */
3017static void
3018android_glTexParameterxv__IILjava_nio_IntBuffer_2
3019 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003020 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003021 const char * _exceptionType = NULL;
3022 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003023 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003024 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07003025 jint _remaining;
3026 GLfixed *params = (GLfixed *) 0;
3027
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003028 params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07003029 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003030 _exception = 1;
3031 _exceptionType = "java/lang/IllegalArgumentException";
3032 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07003033 goto exit;
3034 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003035 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003036 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003037 params = (GLfixed *) (_paramsBase + _bufferOffset);
3038 }
Jack Palevich27f80022009-04-15 19:13:17 -07003039 glTexParameterxv(
3040 (GLenum)target,
3041 (GLenum)pname,
3042 (GLfixed *)params
3043 );
3044
3045exit:
3046 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003047 _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -07003048 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003049 if (_exception) {
3050 jniThrowException(_env, _exceptionType, _exceptionMessage);
3051 }
Jack Palevich27f80022009-04-15 19:13:17 -07003052}
3053
3054/* void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
3055static void
3056android_glVertexPointer__IIII
3057 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
3058 glVertexPointer(
3059 (GLint)size,
3060 (GLenum)type,
3061 (GLsizei)stride,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00003062 reinterpret_cast<GLvoid *>(offset)
Jack Palevich27f80022009-04-15 19:13:17 -07003063 );
3064}
3065
3066static const char *classPathName = "android/opengl/GLES11";
3067
Daniel Micay76f6a862015-09-19 17:31:01 -04003068static const JNINativeMethod methods[] = {
Jack Palevich27f80022009-04-15 19:13:17 -07003069{"_nativeClassInit", "()V", (void*)nativeClassInit },
3070{"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II },
3071{"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I },
3072{"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 },
3073{"glClipPlanef", "(I[FI)V", (void *) android_glClipPlanef__I_3FI },
3074{"glClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glClipPlanef__ILjava_nio_FloatBuffer_2 },
3075{"glClipPlanex", "(I[II)V", (void *) android_glClipPlanex__I_3II },
3076{"glClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glClipPlanex__ILjava_nio_IntBuffer_2 },
3077{"glColor4ub", "(BBBB)V", (void *) android_glColor4ub__BBBB },
3078{"glColorPointer", "(IIII)V", (void *) android_glColorPointer__IIII },
3079{"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II },
3080{"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 },
3081{"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII },
3082{"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II },
3083{"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 },
3084{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI },
3085{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 },
3086{"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II },
3087{"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 },
3088{"glGetClipPlanef", "(I[FI)V", (void *) android_glGetClipPlanef__I_3FI },
3089{"glGetClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetClipPlanef__ILjava_nio_FloatBuffer_2 },
3090{"glGetClipPlanex", "(I[II)V", (void *) android_glGetClipPlanex__I_3II },
3091{"glGetClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetClipPlanex__ILjava_nio_IntBuffer_2 },
3092{"glGetFixedv", "(I[II)V", (void *) android_glGetFixedv__I_3II },
3093{"glGetFixedv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetFixedv__ILjava_nio_IntBuffer_2 },
3094{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI },
3095{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 },
3096{"glGetLightfv", "(II[FI)V", (void *) android_glGetLightfv__II_3FI },
3097{"glGetLightfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetLightfv__IILjava_nio_FloatBuffer_2 },
3098{"glGetLightxv", "(II[II)V", (void *) android_glGetLightxv__II_3II },
3099{"glGetLightxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetLightxv__IILjava_nio_IntBuffer_2 },
3100{"glGetMaterialfv", "(II[FI)V", (void *) android_glGetMaterialfv__II_3FI },
3101{"glGetMaterialfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetMaterialfv__IILjava_nio_FloatBuffer_2 },
3102{"glGetMaterialxv", "(II[II)V", (void *) android_glGetMaterialxv__II_3II },
3103{"glGetMaterialxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetMaterialxv__IILjava_nio_IntBuffer_2 },
3104{"glGetTexEnvfv", "(II[FI)V", (void *) android_glGetTexEnvfv__II_3FI },
3105{"glGetTexEnvfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2 },
3106{"glGetTexEnviv", "(II[II)V", (void *) android_glGetTexEnviv__II_3II },
3107{"glGetTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnviv__IILjava_nio_IntBuffer_2 },
3108{"glGetTexEnvxv", "(II[II)V", (void *) android_glGetTexEnvxv__II_3II },
3109{"glGetTexEnvxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnvxv__IILjava_nio_IntBuffer_2 },
3110{"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI },
3111{"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 },
3112{"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II },
3113{"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 },
3114{"glGetTexParameterxv", "(II[II)V", (void *) android_glGetTexParameterxv__II_3II },
3115{"glGetTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameterxv__IILjava_nio_IntBuffer_2 },
3116{"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I },
3117{"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I },
3118{"glIsTexture", "(I)Z", (void *) android_glIsTexture__I },
3119{"glNormalPointer", "(III)V", (void *) android_glNormalPointer__III },
3120{"glPointParameterf", "(IF)V", (void *) android_glPointParameterf__IF },
3121{"glPointParameterfv", "(I[FI)V", (void *) android_glPointParameterfv__I_3FI },
3122{"glPointParameterfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glPointParameterfv__ILjava_nio_FloatBuffer_2 },
3123{"glPointParameterx", "(II)V", (void *) android_glPointParameterx__II },
3124{"glPointParameterxv", "(I[II)V", (void *) android_glPointParameterxv__I_3II },
3125{"glPointParameterxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glPointParameterxv__ILjava_nio_IntBuffer_2 },
Jack Palevichbe6eac82009-12-08 15:43:51 +08003126{"glPointSizePointerOESBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I },
Jack Palevich27f80022009-04-15 19:13:17 -07003127{"glTexCoordPointer", "(IIII)V", (void *) android_glTexCoordPointer__IIII },
3128{"glTexEnvi", "(III)V", (void *) android_glTexEnvi__III },
3129{"glTexEnviv", "(II[II)V", (void *) android_glTexEnviv__II_3II },
3130{"glTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexEnviv__IILjava_nio_IntBuffer_2 },
3131{"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI },
3132{"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 },
3133{"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III },
3134{"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II },
3135{"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 },
3136{"glTexParameterxv", "(II[II)V", (void *) android_glTexParameterxv__II_3II },
3137{"glTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameterxv__IILjava_nio_IntBuffer_2 },
3138{"glVertexPointer", "(IIII)V", (void *) android_glVertexPointer__IIII },
3139};
3140
3141int register_android_opengl_jni_GLES11(JNIEnv *_env)
3142{
3143 int err;
3144 err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
3145 return err;
3146}