blob: ac3bf7a5b73558700cdedb1243cf3d3874992f89 [file] [log] [blame]
Jack Palevich560814f2009-11-19 16:34:55 +08001/*
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 Palevich560814f2009-11-19 16:34:55 +08008**
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07009** http://www.apache.org/licenses/LICENSE-2.0
Jack Palevich560814f2009-11-19 16:34:55 +080010**
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 Palevich560814f2009-11-19 16:34:55 +080015** 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 <GLES2/gl2.h>
25#include <GLES2/gl2ext.h>
26
Jesse Hall9626f822014-05-19 20:57:49 -070027#include <jni.h>
28#include <JNIHelp.h>
Jack Palevich560814f2009-11-19 16:34:55 +080029#include <android_runtime/AndroidRuntime.h>
30#include <utils/misc.h>
Jack Palevich560814f2009-11-19 16:34:55 +080031#include <assert.h>
Jack Palevich560814f2009-11-19 16:34:55 +080032
33static int initialized = 0;
34
35static jclass nioAccessClass;
36static jclass bufferClass;
Jack Palevich560814f2009-11-19 16:34:55 +080037static 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 Palevich560814f2009-11-19 16:34:55 +080078/* 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 Palevich560814f2009-11-19 16:34:55 +080082{
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 Palevich560814f2009-11-19 16:34:55 +0800102static void *
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700103getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
Jack Palevich560814f2009-11-19 16:34:55 +0800104{
105 jint position;
106 jint limit;
107 jint elementSizeShift;
108 jlong pointer;
Jack Palevich560814f2009-11-19 16:34:55 +0800109
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 Palevich560814f2009-11-19 16:34:55 +0800119 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700120
Jack Palevich560814f2009-11-19 16:34:55 +0800121 *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
122 getBaseArrayID, buffer);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700123 *offset = _env->CallStaticIntMethod(nioAccessClass,
Jack Palevich560814f2009-11-19 16:34:55 +0800124 getBaseArrayOffsetID, buffer);
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700125
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700126 return NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800127}
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 Palevich560814f2009-11-19 16:34:55 +0800239static 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 Palevich560814f2009-11-19 16:34:55 +0800244}
245
246static 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 Palevich560814f2009-11-19 16:34:55 +0800256 }
257 return (void*) buf;
258}
259
Mathias Agopian2ad04772013-02-23 03:12:30 -0800260// --------------------------------------------------------------------------
261
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;
Jack Palevich560814f2009-11-19 16:34:55 +0800340}
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 }
Jack Palevich560814f2009-11-19 16:34:55 +0800442}
443
444// --------------------------------------------------------------------------
Jack Palevich560814f2009-11-19 16:34:55 +0800445/* void glActiveTexture ( GLenum texture ) */
446static void
447android_glActiveTexture__I
448 (JNIEnv *_env, jobject _this, jint texture) {
449 glActiveTexture(
450 (GLenum)texture
451 );
452}
453
454/* void glAttachShader ( GLuint program, GLuint shader ) */
455static void
456android_glAttachShader__II
457 (JNIEnv *_env, jobject _this, jint program, jint shader) {
458 glAttachShader(
459 (GLuint)program,
460 (GLuint)shader
461 );
462}
463
464/* void glBindAttribLocation ( GLuint program, GLuint index, const char *name ) */
465static void
466android_glBindAttribLocation__IILjava_lang_String_2
467 (JNIEnv *_env, jobject _this, jint program, jint index, jstring name) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700468 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800469 const char * _exceptionType = NULL;
470 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800471 const char* _nativename = 0;
472
473 if (!name) {
Elliott Hughes428d3fc2013-09-24 17:15:41 -0700474 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700475 _exceptionType = "java/lang/IllegalArgumentException";
476 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +0800477 goto exit;
478 }
479 _nativename = _env->GetStringUTFChars(name, 0);
480
481 glBindAttribLocation(
482 (GLuint)program,
483 (GLuint)index,
484 (char *)_nativename
485 );
486
487exit:
488 if (_nativename) {
489 _env->ReleaseStringUTFChars(name, _nativename);
490 }
491
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700492 if (_exception) {
493 jniThrowException(_env, _exceptionType, _exceptionMessage);
494 }
Jack Palevich560814f2009-11-19 16:34:55 +0800495}
496
497/* void glBindBuffer ( GLenum target, GLuint buffer ) */
498static void
499android_glBindBuffer__II
500 (JNIEnv *_env, jobject _this, jint target, jint buffer) {
501 glBindBuffer(
502 (GLenum)target,
503 (GLuint)buffer
504 );
505}
506
507/* void glBindFramebuffer ( GLenum target, GLuint framebuffer ) */
508static void
509android_glBindFramebuffer__II
510 (JNIEnv *_env, jobject _this, jint target, jint framebuffer) {
511 glBindFramebuffer(
512 (GLenum)target,
513 (GLuint)framebuffer
514 );
515}
516
517/* void glBindRenderbuffer ( GLenum target, GLuint renderbuffer ) */
518static void
519android_glBindRenderbuffer__II
520 (JNIEnv *_env, jobject _this, jint target, jint renderbuffer) {
521 glBindRenderbuffer(
522 (GLenum)target,
523 (GLuint)renderbuffer
524 );
525}
526
527/* void glBindTexture ( GLenum target, GLuint texture ) */
528static void
529android_glBindTexture__II
530 (JNIEnv *_env, jobject _this, jint target, jint texture) {
531 glBindTexture(
532 (GLenum)target,
533 (GLuint)texture
534 );
535}
536
537/* void glBlendColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
538static void
539android_glBlendColor__FFFF
540 (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
541 glBlendColor(
542 (GLclampf)red,
543 (GLclampf)green,
544 (GLclampf)blue,
545 (GLclampf)alpha
546 );
547}
548
549/* void glBlendEquation ( GLenum mode ) */
550static void
551android_glBlendEquation__I
552 (JNIEnv *_env, jobject _this, jint mode) {
Jack Palevich73108672011-03-28 14:49:12 -0700553 glBlendEquation(
554 (GLenum)mode
555 );
Jack Palevich560814f2009-11-19 16:34:55 +0800556}
557
558/* void glBlendEquationSeparate ( GLenum modeRGB, GLenum modeAlpha ) */
559static void
560android_glBlendEquationSeparate__II
561 (JNIEnv *_env, jobject _this, jint modeRGB, jint modeAlpha) {
Jack Palevich73108672011-03-28 14:49:12 -0700562 glBlendEquationSeparate(
563 (GLenum)modeRGB,
564 (GLenum)modeAlpha
565 );
Jack Palevich560814f2009-11-19 16:34:55 +0800566}
567
568/* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */
569static void
570android_glBlendFunc__II
571 (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) {
572 glBlendFunc(
573 (GLenum)sfactor,
574 (GLenum)dfactor
575 );
576}
577
578/* void glBlendFuncSeparate ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) */
579static void
580android_glBlendFuncSeparate__IIII
581 (JNIEnv *_env, jobject _this, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) {
Jack Palevich73108672011-03-28 14:49:12 -0700582 glBlendFuncSeparate(
583 (GLenum)srcRGB,
584 (GLenum)dstRGB,
585 (GLenum)srcAlpha,
586 (GLenum)dstAlpha
587 );
Jack Palevich560814f2009-11-19 16:34:55 +0800588}
589
590/* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */
591static void
592android_glBufferData__IILjava_nio_Buffer_2I
593 (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700594 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800595 const char * _exceptionType = NULL;
596 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800597 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700598 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800599 jint _remaining;
600 GLvoid *data = (GLvoid *) 0;
601
602 if (data_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700603 data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +0800604 if (_remaining < size) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700605 _exception = 1;
606 _exceptionType = "java/lang/IllegalArgumentException";
607 _exceptionMessage = "remaining() < size < needed";
Jack Palevich560814f2009-11-19 16:34:55 +0800608 goto exit;
609 }
610 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -0700611 if (data_buf && data == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700612 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
613 data = (GLvoid *) (_dataBase + _bufferOffset);
614 }
Jack Palevich560814f2009-11-19 16:34:55 +0800615 glBufferData(
616 (GLenum)target,
617 (GLsizeiptr)size,
618 (GLvoid *)data,
619 (GLenum)usage
620 );
621
622exit:
623 if (_array) {
624 releasePointer(_env, _array, data, JNI_FALSE);
625 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700626 if (_exception) {
627 jniThrowException(_env, _exceptionType, _exceptionMessage);
628 }
Jack Palevich560814f2009-11-19 16:34:55 +0800629}
630
631/* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */
632static void
633android_glBufferSubData__IIILjava_nio_Buffer_2
634 (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700635 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800636 const char * _exceptionType = NULL;
637 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800638 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700639 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800640 jint _remaining;
641 GLvoid *data = (GLvoid *) 0;
642
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700643 data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +0800644 if (_remaining < size) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700645 _exception = 1;
646 _exceptionType = "java/lang/IllegalArgumentException";
647 _exceptionMessage = "remaining() < size < needed";
Jack Palevich560814f2009-11-19 16:34:55 +0800648 goto exit;
649 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700650 if (data == NULL) {
651 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
652 data = (GLvoid *) (_dataBase + _bufferOffset);
653 }
Jack Palevich560814f2009-11-19 16:34:55 +0800654 glBufferSubData(
655 (GLenum)target,
656 (GLintptr)offset,
657 (GLsizeiptr)size,
658 (GLvoid *)data
659 );
660
661exit:
662 if (_array) {
663 releasePointer(_env, _array, data, JNI_FALSE);
664 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700665 if (_exception) {
666 jniThrowException(_env, _exceptionType, _exceptionMessage);
667 }
Jack Palevich560814f2009-11-19 16:34:55 +0800668}
669
670/* GLenum glCheckFramebufferStatus ( GLenum target ) */
671static jint
672android_glCheckFramebufferStatus__I
673 (JNIEnv *_env, jobject _this, jint target) {
674 GLenum _returnValue;
675 _returnValue = glCheckFramebufferStatus(
676 (GLenum)target
677 );
Andy McFaddencee51982013-04-25 16:08:31 -0700678 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +0800679}
680
681/* void glClear ( GLbitfield mask ) */
682static void
683android_glClear__I
684 (JNIEnv *_env, jobject _this, jint mask) {
685 glClear(
686 (GLbitfield)mask
687 );
688}
689
690/* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
691static void
692android_glClearColor__FFFF
693 (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
694 glClearColor(
695 (GLclampf)red,
696 (GLclampf)green,
697 (GLclampf)blue,
698 (GLclampf)alpha
699 );
700}
701
702/* void glClearDepthf ( GLclampf depth ) */
703static void
704android_glClearDepthf__F
705 (JNIEnv *_env, jobject _this, jfloat depth) {
706 glClearDepthf(
707 (GLclampf)depth
708 );
709}
710
711/* void glClearStencil ( GLint s ) */
712static void
713android_glClearStencil__I
714 (JNIEnv *_env, jobject _this, jint s) {
715 glClearStencil(
716 (GLint)s
717 );
718}
719
720/* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */
721static void
722android_glColorMask__ZZZZ
723 (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) {
724 glColorMask(
725 (GLboolean)red,
726 (GLboolean)green,
727 (GLboolean)blue,
728 (GLboolean)alpha
729 );
730}
731
732/* void glCompileShader ( GLuint shader ) */
733static void
734android_glCompileShader__I
735 (JNIEnv *_env, jobject _this, jint shader) {
736 glCompileShader(
737 (GLuint)shader
738 );
739}
740
741/* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */
742static void
743android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2
744 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) {
745 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700746 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800747 jint _remaining;
748 GLvoid *data = (GLvoid *) 0;
749
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700750 data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700751 if (data == NULL) {
752 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
753 data = (GLvoid *) (_dataBase + _bufferOffset);
754 }
Jack Palevich560814f2009-11-19 16:34:55 +0800755 glCompressedTexImage2D(
756 (GLenum)target,
757 (GLint)level,
758 (GLenum)internalformat,
759 (GLsizei)width,
760 (GLsizei)height,
761 (GLint)border,
762 (GLsizei)imageSize,
763 (GLvoid *)data
764 );
765 if (_array) {
766 releasePointer(_env, _array, data, JNI_FALSE);
767 }
768}
769
770/* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */
771static void
772android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
773 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) {
774 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700775 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800776 jint _remaining;
777 GLvoid *data = (GLvoid *) 0;
778
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700779 data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700780 if (data == NULL) {
781 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
782 data = (GLvoid *) (_dataBase + _bufferOffset);
783 }
Jack Palevich560814f2009-11-19 16:34:55 +0800784 glCompressedTexSubImage2D(
785 (GLenum)target,
786 (GLint)level,
787 (GLint)xoffset,
788 (GLint)yoffset,
789 (GLsizei)width,
790 (GLsizei)height,
791 (GLenum)format,
792 (GLsizei)imageSize,
793 (GLvoid *)data
794 );
795 if (_array) {
796 releasePointer(_env, _array, data, JNI_FALSE);
797 }
798}
799
800/* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */
801static void
802android_glCopyTexImage2D__IIIIIIII
803 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) {
804 glCopyTexImage2D(
805 (GLenum)target,
806 (GLint)level,
807 (GLenum)internalformat,
808 (GLint)x,
809 (GLint)y,
810 (GLsizei)width,
811 (GLsizei)height,
812 (GLint)border
813 );
814}
815
816/* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */
817static void
818android_glCopyTexSubImage2D__IIIIIIII
819 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) {
820 glCopyTexSubImage2D(
821 (GLenum)target,
822 (GLint)level,
823 (GLint)xoffset,
824 (GLint)yoffset,
825 (GLint)x,
826 (GLint)y,
827 (GLsizei)width,
828 (GLsizei)height
829 );
830}
831
832/* GLuint glCreateProgram ( void ) */
833static jint
834android_glCreateProgram__
835 (JNIEnv *_env, jobject _this) {
836 GLuint _returnValue;
837 _returnValue = glCreateProgram();
Andy McFaddencee51982013-04-25 16:08:31 -0700838 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +0800839}
840
841/* GLuint glCreateShader ( GLenum type ) */
842static jint
843android_glCreateShader__I
844 (JNIEnv *_env, jobject _this, jint type) {
845 GLuint _returnValue;
846 _returnValue = glCreateShader(
847 (GLenum)type
848 );
Andy McFaddencee51982013-04-25 16:08:31 -0700849 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +0800850}
851
852/* void glCullFace ( GLenum mode ) */
853static void
854android_glCullFace__I
855 (JNIEnv *_env, jobject _this, jint mode) {
856 glCullFace(
857 (GLenum)mode
858 );
859}
860
861/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
862static void
863android_glDeleteBuffers__I_3II
864 (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700865 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800866 const char * _exceptionType = NULL;
867 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800868 GLuint *buffers_base = (GLuint *) 0;
869 jint _remaining;
870 GLuint *buffers = (GLuint *) 0;
871
872 if (!buffers_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700873 _exception = 1;
874 _exceptionType = "java/lang/IllegalArgumentException";
875 _exceptionMessage = "buffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +0800876 goto exit;
877 }
878 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700879 _exception = 1;
880 _exceptionType = "java/lang/IllegalArgumentException";
881 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +0800882 goto exit;
883 }
884 _remaining = _env->GetArrayLength(buffers_ref) - offset;
885 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700886 _exception = 1;
887 _exceptionType = "java/lang/IllegalArgumentException";
888 _exceptionMessage = "length - offset < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +0800889 goto exit;
890 }
891 buffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700892 _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +0800893 buffers = buffers_base + offset;
894
895 glDeleteBuffers(
896 (GLsizei)n,
897 (GLuint *)buffers
898 );
899
900exit:
901 if (buffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700902 _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
Jack Palevich560814f2009-11-19 16:34:55 +0800903 JNI_ABORT);
904 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700905 if (_exception) {
906 jniThrowException(_env, _exceptionType, _exceptionMessage);
907 }
Jack Palevich560814f2009-11-19 16:34:55 +0800908}
909
910/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
911static void
912android_glDeleteBuffers__ILjava_nio_IntBuffer_2
913 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700914 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800915 const char * _exceptionType = NULL;
916 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700917 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700918 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800919 jint _remaining;
920 GLuint *buffers = (GLuint *) 0;
921
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700922 buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +0800923 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700924 _exception = 1;
925 _exceptionType = "java/lang/IllegalArgumentException";
926 _exceptionMessage = "remaining() < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +0800927 goto exit;
928 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700929 if (buffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700930 char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700931 buffers = (GLuint *) (_buffersBase + _bufferOffset);
932 }
Jack Palevich560814f2009-11-19 16:34:55 +0800933 glDeleteBuffers(
934 (GLsizei)n,
935 (GLuint *)buffers
936 );
937
938exit:
939 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700940 _env->ReleaseIntArrayElements(_array, (jint*)buffers, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +0800941 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700942 if (_exception) {
943 jniThrowException(_env, _exceptionType, _exceptionMessage);
944 }
Jack Palevich560814f2009-11-19 16:34:55 +0800945}
946
947/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */
948static void
949android_glDeleteFramebuffers__I_3II
950 (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700951 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800952 const char * _exceptionType = NULL;
953 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800954 GLuint *framebuffers_base = (GLuint *) 0;
955 jint _remaining;
956 GLuint *framebuffers = (GLuint *) 0;
957
958 if (!framebuffers_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700959 _exception = 1;
960 _exceptionType = "java/lang/IllegalArgumentException";
961 _exceptionMessage = "framebuffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +0800962 goto exit;
963 }
964 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700965 _exception = 1;
966 _exceptionType = "java/lang/IllegalArgumentException";
967 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +0800968 goto exit;
969 }
970 _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800971 if (_remaining < n) {
972 _exception = 1;
973 _exceptionType = "java/lang/IllegalArgumentException";
974 _exceptionMessage = "length - offset < n < needed";
975 goto exit;
976 }
Jack Palevich560814f2009-11-19 16:34:55 +0800977 framebuffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700978 _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +0800979 framebuffers = framebuffers_base + offset;
980
981 glDeleteFramebuffers(
982 (GLsizei)n,
983 (GLuint *)framebuffers
984 );
985
986exit:
987 if (framebuffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700988 _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base,
Jack Palevich560814f2009-11-19 16:34:55 +0800989 JNI_ABORT);
990 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700991 if (_exception) {
992 jniThrowException(_env, _exceptionType, _exceptionMessage);
993 }
Jack Palevich560814f2009-11-19 16:34:55 +0800994}
995
996/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */
997static void
998android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2
999 (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001000 jint _exception = 0;
1001 const char * _exceptionType = NULL;
1002 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001003 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001004 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001005 jint _remaining;
1006 GLuint *framebuffers = (GLuint *) 0;
1007
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001008 framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001009 if (_remaining < n) {
1010 _exception = 1;
1011 _exceptionType = "java/lang/IllegalArgumentException";
1012 _exceptionMessage = "remaining() < n < needed";
1013 goto exit;
1014 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001015 if (framebuffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001016 char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001017 framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
1018 }
Jack Palevich560814f2009-11-19 16:34:55 +08001019 glDeleteFramebuffers(
1020 (GLsizei)n,
1021 (GLuint *)framebuffers
1022 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08001023
1024exit:
Jack Palevich560814f2009-11-19 16:34:55 +08001025 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001026 _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08001027 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08001028 if (_exception) {
1029 jniThrowException(_env, _exceptionType, _exceptionMessage);
1030 }
Jack Palevich560814f2009-11-19 16:34:55 +08001031}
1032
1033/* void glDeleteProgram ( GLuint program ) */
1034static void
1035android_glDeleteProgram__I
1036 (JNIEnv *_env, jobject _this, jint program) {
1037 glDeleteProgram(
1038 (GLuint)program
1039 );
1040}
1041
1042/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */
1043static void
1044android_glDeleteRenderbuffers__I_3II
1045 (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001046 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001047 const char * _exceptionType = NULL;
1048 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001049 GLuint *renderbuffers_base = (GLuint *) 0;
1050 jint _remaining;
1051 GLuint *renderbuffers = (GLuint *) 0;
1052
1053 if (!renderbuffers_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001054 _exception = 1;
1055 _exceptionType = "java/lang/IllegalArgumentException";
1056 _exceptionMessage = "renderbuffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001057 goto exit;
1058 }
1059 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001060 _exception = 1;
1061 _exceptionType = "java/lang/IllegalArgumentException";
1062 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001063 goto exit;
1064 }
1065 _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001066 if (_remaining < n) {
1067 _exception = 1;
1068 _exceptionType = "java/lang/IllegalArgumentException";
1069 _exceptionMessage = "length - offset < n < needed";
1070 goto exit;
1071 }
Jack Palevich560814f2009-11-19 16:34:55 +08001072 renderbuffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001073 _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001074 renderbuffers = renderbuffers_base + offset;
1075
1076 glDeleteRenderbuffers(
1077 (GLsizei)n,
1078 (GLuint *)renderbuffers
1079 );
1080
1081exit:
1082 if (renderbuffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001083 _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001084 JNI_ABORT);
1085 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001086 if (_exception) {
1087 jniThrowException(_env, _exceptionType, _exceptionMessage);
1088 }
Jack Palevich560814f2009-11-19 16:34:55 +08001089}
1090
1091/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */
1092static void
1093android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2
1094 (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001095 jint _exception = 0;
1096 const char * _exceptionType = NULL;
1097 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001098 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001099 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001100 jint _remaining;
1101 GLuint *renderbuffers = (GLuint *) 0;
1102
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001103 renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001104 if (_remaining < n) {
1105 _exception = 1;
1106 _exceptionType = "java/lang/IllegalArgumentException";
1107 _exceptionMessage = "remaining() < n < needed";
1108 goto exit;
1109 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001110 if (renderbuffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001111 char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001112 renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
1113 }
Jack Palevich560814f2009-11-19 16:34:55 +08001114 glDeleteRenderbuffers(
1115 (GLsizei)n,
1116 (GLuint *)renderbuffers
1117 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08001118
1119exit:
Jack Palevich560814f2009-11-19 16:34:55 +08001120 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001121 _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08001122 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08001123 if (_exception) {
1124 jniThrowException(_env, _exceptionType, _exceptionMessage);
1125 }
Jack Palevich560814f2009-11-19 16:34:55 +08001126}
1127
1128/* void glDeleteShader ( GLuint shader ) */
1129static void
1130android_glDeleteShader__I
1131 (JNIEnv *_env, jobject _this, jint shader) {
1132 glDeleteShader(
1133 (GLuint)shader
1134 );
1135}
1136
1137/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
1138static void
1139android_glDeleteTextures__I_3II
1140 (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001141 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001142 const char * _exceptionType = NULL;
1143 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001144 GLuint *textures_base = (GLuint *) 0;
1145 jint _remaining;
1146 GLuint *textures = (GLuint *) 0;
1147
1148 if (!textures_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001149 _exception = 1;
1150 _exceptionType = "java/lang/IllegalArgumentException";
1151 _exceptionMessage = "textures == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001152 goto exit;
1153 }
1154 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001155 _exception = 1;
1156 _exceptionType = "java/lang/IllegalArgumentException";
1157 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001158 goto exit;
1159 }
1160 _remaining = _env->GetArrayLength(textures_ref) - offset;
1161 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001162 _exception = 1;
1163 _exceptionType = "java/lang/IllegalArgumentException";
1164 _exceptionMessage = "length - offset < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001165 goto exit;
1166 }
1167 textures_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001168 _env->GetIntArrayElements(textures_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001169 textures = textures_base + offset;
1170
1171 glDeleteTextures(
1172 (GLsizei)n,
1173 (GLuint *)textures
1174 );
1175
1176exit:
1177 if (textures_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001178 _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001179 JNI_ABORT);
1180 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001181 if (_exception) {
1182 jniThrowException(_env, _exceptionType, _exceptionMessage);
1183 }
Jack Palevich560814f2009-11-19 16:34:55 +08001184}
1185
1186/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
1187static void
1188android_glDeleteTextures__ILjava_nio_IntBuffer_2
1189 (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001190 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001191 const char * _exceptionType = NULL;
1192 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001193 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001194 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001195 jint _remaining;
1196 GLuint *textures = (GLuint *) 0;
1197
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001198 textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08001199 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001200 _exception = 1;
1201 _exceptionType = "java/lang/IllegalArgumentException";
1202 _exceptionMessage = "remaining() < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001203 goto exit;
1204 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001205 if (textures == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001206 char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001207 textures = (GLuint *) (_texturesBase + _bufferOffset);
1208 }
Jack Palevich560814f2009-11-19 16:34:55 +08001209 glDeleteTextures(
1210 (GLsizei)n,
1211 (GLuint *)textures
1212 );
1213
1214exit:
1215 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001216 _env->ReleaseIntArrayElements(_array, (jint*)textures, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08001217 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001218 if (_exception) {
1219 jniThrowException(_env, _exceptionType, _exceptionMessage);
1220 }
Jack Palevich560814f2009-11-19 16:34:55 +08001221}
1222
1223/* void glDepthFunc ( GLenum func ) */
1224static void
1225android_glDepthFunc__I
1226 (JNIEnv *_env, jobject _this, jint func) {
1227 glDepthFunc(
1228 (GLenum)func
1229 );
1230}
1231
1232/* void glDepthMask ( GLboolean flag ) */
1233static void
1234android_glDepthMask__Z
1235 (JNIEnv *_env, jobject _this, jboolean flag) {
1236 glDepthMask(
1237 (GLboolean)flag
1238 );
1239}
1240
1241/* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */
1242static void
1243android_glDepthRangef__FF
1244 (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) {
1245 glDepthRangef(
1246 (GLclampf)zNear,
1247 (GLclampf)zFar
1248 );
1249}
1250
1251/* void glDetachShader ( GLuint program, GLuint shader ) */
1252static void
1253android_glDetachShader__II
1254 (JNIEnv *_env, jobject _this, jint program, jint shader) {
1255 glDetachShader(
1256 (GLuint)program,
1257 (GLuint)shader
1258 );
1259}
1260
1261/* void glDisable ( GLenum cap ) */
1262static void
1263android_glDisable__I
1264 (JNIEnv *_env, jobject _this, jint cap) {
1265 glDisable(
1266 (GLenum)cap
1267 );
1268}
1269
1270/* void glDisableVertexAttribArray ( GLuint index ) */
1271static void
1272android_glDisableVertexAttribArray__I
1273 (JNIEnv *_env, jobject _this, jint index) {
1274 glDisableVertexAttribArray(
1275 (GLuint)index
1276 );
1277}
1278
1279/* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */
1280static void
1281android_glDrawArrays__III
1282 (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) {
1283 glDrawArrays(
1284 (GLenum)mode,
1285 (GLint)first,
1286 (GLsizei)count
1287 );
1288}
1289
Jack Palevich224107a2010-06-22 20:08:40 +08001290/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */
1291static void
1292android_glDrawElements__IIII
1293 (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001294 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001295 const char * _exceptionType = NULL;
1296 const char * _exceptionMessage = NULL;
Jack Palevich224107a2010-06-22 20:08:40 +08001297 glDrawElements(
1298 (GLenum)mode,
1299 (GLsizei)count,
1300 (GLenum)type,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00001301 reinterpret_cast<GLvoid *>(offset)
Jack Palevich224107a2010-06-22 20:08:40 +08001302 );
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001303 if (_exception) {
1304 jniThrowException(_env, _exceptionType, _exceptionMessage);
1305 }
Jack Palevich224107a2010-06-22 20:08:40 +08001306}
1307
Jack Palevich560814f2009-11-19 16:34:55 +08001308/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */
1309static void
1310android_glDrawElements__IIILjava_nio_Buffer_2
1311 (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001312 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001313 const char * _exceptionType = NULL;
1314 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001315 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001316 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001317 jint _remaining;
1318 GLvoid *indices = (GLvoid *) 0;
1319
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001320 indices = (GLvoid *)getPointer(_env, indices_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08001321 if (_remaining < count) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001322 _exception = 1;
1323 _exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
1324 _exceptionMessage = "remaining() < count < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001325 goto exit;
1326 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001327 if (indices == NULL) {
1328 char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1329 indices = (GLvoid *) (_indicesBase + _bufferOffset);
1330 }
Jack Palevich560814f2009-11-19 16:34:55 +08001331 glDrawElements(
1332 (GLenum)mode,
1333 (GLsizei)count,
1334 (GLenum)type,
1335 (GLvoid *)indices
1336 );
1337
1338exit:
1339 if (_array) {
1340 releasePointer(_env, _array, indices, JNI_FALSE);
1341 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001342 if (_exception) {
1343 jniThrowException(_env, _exceptionType, _exceptionMessage);
1344 }
Jack Palevich560814f2009-11-19 16:34:55 +08001345}
1346
1347/* void glEnable ( GLenum cap ) */
1348static void
1349android_glEnable__I
1350 (JNIEnv *_env, jobject _this, jint cap) {
1351 glEnable(
1352 (GLenum)cap
1353 );
1354}
1355
1356/* void glEnableVertexAttribArray ( GLuint index ) */
1357static void
1358android_glEnableVertexAttribArray__I
1359 (JNIEnv *_env, jobject _this, jint index) {
1360 glEnableVertexAttribArray(
1361 (GLuint)index
1362 );
1363}
1364
1365/* void glFinish ( void ) */
1366static void
1367android_glFinish__
1368 (JNIEnv *_env, jobject _this) {
1369 glFinish();
1370}
1371
1372/* void glFlush ( void ) */
1373static void
1374android_glFlush__
1375 (JNIEnv *_env, jobject _this) {
1376 glFlush();
1377}
1378
1379/* void glFramebufferRenderbuffer ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) */
1380static void
1381android_glFramebufferRenderbuffer__IIII
1382 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint renderbuffertarget, jint renderbuffer) {
1383 glFramebufferRenderbuffer(
1384 (GLenum)target,
1385 (GLenum)attachment,
1386 (GLenum)renderbuffertarget,
1387 (GLuint)renderbuffer
1388 );
1389}
1390
1391/* void glFramebufferTexture2D ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) */
1392static void
1393android_glFramebufferTexture2D__IIIII
1394 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint textarget, jint texture, jint level) {
1395 glFramebufferTexture2D(
1396 (GLenum)target,
1397 (GLenum)attachment,
1398 (GLenum)textarget,
1399 (GLuint)texture,
1400 (GLint)level
1401 );
1402}
1403
1404/* void glFrontFace ( GLenum mode ) */
1405static void
1406android_glFrontFace__I
1407 (JNIEnv *_env, jobject _this, jint mode) {
1408 glFrontFace(
1409 (GLenum)mode
1410 );
1411}
1412
1413/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
1414static void
1415android_glGenBuffers__I_3II
1416 (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
1417 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001418 const char * _exceptionType = NULL;
1419 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001420 GLuint *buffers_base = (GLuint *) 0;
1421 jint _remaining;
1422 GLuint *buffers = (GLuint *) 0;
1423
1424 if (!buffers_ref) {
1425 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001426 _exceptionType = "java/lang/IllegalArgumentException";
1427 _exceptionMessage = "buffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001428 goto exit;
1429 }
1430 if (offset < 0) {
1431 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001432 _exceptionType = "java/lang/IllegalArgumentException";
1433 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001434 goto exit;
1435 }
1436 _remaining = _env->GetArrayLength(buffers_ref) - offset;
1437 if (_remaining < n) {
1438 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001439 _exceptionType = "java/lang/IllegalArgumentException";
1440 _exceptionMessage = "length - offset < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001441 goto exit;
1442 }
1443 buffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001444 _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001445 buffers = buffers_base + offset;
1446
1447 glGenBuffers(
1448 (GLsizei)n,
1449 (GLuint *)buffers
1450 );
1451
1452exit:
1453 if (buffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001454 _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001455 _exception ? JNI_ABORT: 0);
1456 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001457 if (_exception) {
1458 jniThrowException(_env, _exceptionType, _exceptionMessage);
1459 }
Jack Palevich560814f2009-11-19 16:34:55 +08001460}
1461
1462/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
1463static void
1464android_glGenBuffers__ILjava_nio_IntBuffer_2
1465 (JNIEnv *_env, jobject _this, jint n, jobject buffers_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 Palevich560814f2009-11-19 16:34:55 +08001471 jint _remaining;
1472 GLuint *buffers = (GLuint *) 0;
1473
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001474 buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08001475 if (_remaining < n) {
1476 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001477 _exceptionType = "java/lang/IllegalArgumentException";
1478 _exceptionMessage = "remaining() < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001479 goto exit;
1480 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001481 if (buffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001482 char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001483 buffers = (GLuint *) (_buffersBase + _bufferOffset);
1484 }
Jack Palevich560814f2009-11-19 16:34:55 +08001485 glGenBuffers(
1486 (GLsizei)n,
1487 (GLuint *)buffers
1488 );
1489
1490exit:
1491 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001492 _env->ReleaseIntArrayElements(_array, (jint*)buffers, _exception ? JNI_ABORT : 0);
Jack Palevich560814f2009-11-19 16:34:55 +08001493 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001494 if (_exception) {
1495 jniThrowException(_env, _exceptionType, _exceptionMessage);
1496 }
Jack Palevich560814f2009-11-19 16:34:55 +08001497}
1498
1499/* void glGenerateMipmap ( GLenum target ) */
1500static void
1501android_glGenerateMipmap__I
1502 (JNIEnv *_env, jobject _this, jint target) {
1503 glGenerateMipmap(
1504 (GLenum)target
1505 );
1506}
1507
1508/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */
1509static void
1510android_glGenFramebuffers__I_3II
1511 (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
1512 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001513 const char * _exceptionType = NULL;
1514 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001515 GLuint *framebuffers_base = (GLuint *) 0;
1516 jint _remaining;
1517 GLuint *framebuffers = (GLuint *) 0;
1518
1519 if (!framebuffers_ref) {
1520 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001521 _exceptionType = "java/lang/IllegalArgumentException";
1522 _exceptionMessage = "framebuffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001523 goto exit;
1524 }
1525 if (offset < 0) {
1526 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001527 _exceptionType = "java/lang/IllegalArgumentException";
1528 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001529 goto exit;
1530 }
1531 _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001532 if (_remaining < n) {
1533 _exception = 1;
1534 _exceptionType = "java/lang/IllegalArgumentException";
1535 _exceptionMessage = "length - offset < n < needed";
1536 goto exit;
1537 }
Jack Palevich560814f2009-11-19 16:34:55 +08001538 framebuffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001539 _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001540 framebuffers = framebuffers_base + offset;
1541
1542 glGenFramebuffers(
1543 (GLsizei)n,
1544 (GLuint *)framebuffers
1545 );
1546
1547exit:
1548 if (framebuffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001549 _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001550 _exception ? JNI_ABORT: 0);
1551 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001552 if (_exception) {
1553 jniThrowException(_env, _exceptionType, _exceptionMessage);
1554 }
Jack Palevich560814f2009-11-19 16:34:55 +08001555}
1556
1557/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */
1558static void
1559android_glGenFramebuffers__ILjava_nio_IntBuffer_2
1560 (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001561 jint _exception = 0;
1562 const char * _exceptionType = NULL;
1563 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001564 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001565 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001566 jint _remaining;
1567 GLuint *framebuffers = (GLuint *) 0;
1568
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001569 framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001570 if (_remaining < n) {
1571 _exception = 1;
1572 _exceptionType = "java/lang/IllegalArgumentException";
1573 _exceptionMessage = "remaining() < n < needed";
1574 goto exit;
1575 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001576 if (framebuffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001577 char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001578 framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
1579 }
Jack Palevich560814f2009-11-19 16:34:55 +08001580 glGenFramebuffers(
1581 (GLsizei)n,
1582 (GLuint *)framebuffers
1583 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08001584
1585exit:
Jack Palevich560814f2009-11-19 16:34:55 +08001586 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001587 _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001588 }
1589 if (_exception) {
1590 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08001591 }
1592}
1593
1594/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */
1595static void
1596android_glGenRenderbuffers__I_3II
1597 (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
1598 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001599 const char * _exceptionType = NULL;
1600 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001601 GLuint *renderbuffers_base = (GLuint *) 0;
1602 jint _remaining;
1603 GLuint *renderbuffers = (GLuint *) 0;
1604
1605 if (!renderbuffers_ref) {
1606 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001607 _exceptionType = "java/lang/IllegalArgumentException";
1608 _exceptionMessage = "renderbuffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001609 goto exit;
1610 }
1611 if (offset < 0) {
1612 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001613 _exceptionType = "java/lang/IllegalArgumentException";
1614 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001615 goto exit;
1616 }
1617 _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001618 if (_remaining < n) {
1619 _exception = 1;
1620 _exceptionType = "java/lang/IllegalArgumentException";
1621 _exceptionMessage = "length - offset < n < needed";
1622 goto exit;
1623 }
Jack Palevich560814f2009-11-19 16:34:55 +08001624 renderbuffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001625 _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001626 renderbuffers = renderbuffers_base + offset;
1627
1628 glGenRenderbuffers(
1629 (GLsizei)n,
1630 (GLuint *)renderbuffers
1631 );
1632
1633exit:
1634 if (renderbuffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001635 _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001636 _exception ? JNI_ABORT: 0);
1637 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001638 if (_exception) {
1639 jniThrowException(_env, _exceptionType, _exceptionMessage);
1640 }
Jack Palevich560814f2009-11-19 16:34:55 +08001641}
1642
1643/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */
1644static void
1645android_glGenRenderbuffers__ILjava_nio_IntBuffer_2
1646 (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001647 jint _exception = 0;
1648 const char * _exceptionType = NULL;
1649 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001650 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001651 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001652 jint _remaining;
1653 GLuint *renderbuffers = (GLuint *) 0;
1654
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001655 renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001656 if (_remaining < n) {
1657 _exception = 1;
1658 _exceptionType = "java/lang/IllegalArgumentException";
1659 _exceptionMessage = "remaining() < n < needed";
1660 goto exit;
1661 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001662 if (renderbuffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001663 char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001664 renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
1665 }
Jack Palevich560814f2009-11-19 16:34:55 +08001666 glGenRenderbuffers(
1667 (GLsizei)n,
1668 (GLuint *)renderbuffers
1669 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08001670
1671exit:
Jack Palevich560814f2009-11-19 16:34:55 +08001672 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001673 _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001674 }
1675 if (_exception) {
1676 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08001677 }
1678}
1679
1680/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1681static void
1682android_glGenTextures__I_3II
1683 (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
1684 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001685 const char * _exceptionType = NULL;
1686 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001687 GLuint *textures_base = (GLuint *) 0;
1688 jint _remaining;
1689 GLuint *textures = (GLuint *) 0;
1690
1691 if (!textures_ref) {
1692 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001693 _exceptionType = "java/lang/IllegalArgumentException";
1694 _exceptionMessage = "textures == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001695 goto exit;
1696 }
1697 if (offset < 0) {
1698 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001699 _exceptionType = "java/lang/IllegalArgumentException";
1700 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001701 goto exit;
1702 }
1703 _remaining = _env->GetArrayLength(textures_ref) - offset;
1704 if (_remaining < n) {
1705 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001706 _exceptionType = "java/lang/IllegalArgumentException";
1707 _exceptionMessage = "length - offset < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001708 goto exit;
1709 }
1710 textures_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001711 _env->GetIntArrayElements(textures_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001712 textures = textures_base + offset;
1713
1714 glGenTextures(
1715 (GLsizei)n,
1716 (GLuint *)textures
1717 );
1718
1719exit:
1720 if (textures_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001721 _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001722 _exception ? JNI_ABORT: 0);
1723 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001724 if (_exception) {
1725 jniThrowException(_env, _exceptionType, _exceptionMessage);
1726 }
Jack Palevich560814f2009-11-19 16:34:55 +08001727}
1728
1729/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1730static void
1731android_glGenTextures__ILjava_nio_IntBuffer_2
1732 (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
1733 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001734 const char * _exceptionType = NULL;
1735 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001736 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001737 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001738 jint _remaining;
1739 GLuint *textures = (GLuint *) 0;
1740
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001741 textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08001742 if (_remaining < n) {
1743 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001744 _exceptionType = "java/lang/IllegalArgumentException";
1745 _exceptionMessage = "remaining() < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001746 goto exit;
1747 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001748 if (textures == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001749 char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001750 textures = (GLuint *) (_texturesBase + _bufferOffset);
1751 }
Jack Palevich560814f2009-11-19 16:34:55 +08001752 glGenTextures(
1753 (GLsizei)n,
1754 (GLuint *)textures
1755 );
1756
1757exit:
1758 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001759 _env->ReleaseIntArrayElements(_array, (jint*)textures, _exception ? JNI_ABORT : 0);
Jack Palevich560814f2009-11-19 16:34:55 +08001760 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001761 if (_exception) {
1762 jniThrowException(_env, _exceptionType, _exceptionMessage);
1763 }
Jack Palevich560814f2009-11-19 16:34:55 +08001764}
1765
1766/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1767static void
1768android_glGetActiveAttrib__III_3II_3II_3II_3BI
1769 (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jintArray length_ref, jint lengthOffset, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset, jbyteArray name_ref, jint nameOffset) {
1770 jint _exception = 0;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001771 const char * _exceptionType;
1772 const char * _exceptionMessage;
Jack Palevich560814f2009-11-19 16:34:55 +08001773 GLsizei *length_base = (GLsizei *) 0;
1774 jint _lengthRemaining;
1775 GLsizei *length = (GLsizei *) 0;
1776 GLint *size_base = (GLint *) 0;
1777 jint _sizeRemaining;
1778 GLint *size = (GLint *) 0;
1779 GLenum *type_base = (GLenum *) 0;
1780 jint _typeRemaining;
1781 GLenum *type = (GLenum *) 0;
1782 char *name_base = (char *) 0;
1783 jint _nameRemaining;
1784 char *name = (char *) 0;
1785
Pablo Ceballos6aff9062015-10-01 18:35:39 -07001786 if (length_ref) {
1787 if (lengthOffset < 0) {
1788 _exception = 1;
1789 _exceptionType = "java/lang/IllegalArgumentException";
1790 _exceptionMessage = "lengthOffset < 0";
1791 goto exit;
1792 }
1793 _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
1794 length_base = (GLsizei *)
1795 _env->GetIntArrayElements(length_ref, (jboolean *)0);
1796 length = length_base + lengthOffset;
Jack Palevich560814f2009-11-19 16:34:55 +08001797 }
Jack Palevich560814f2009-11-19 16:34:55 +08001798
1799 if (!size_ref) {
1800 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001801 _exceptionType = "java/lang/IllegalArgumentException";
1802 _exceptionMessage = "size == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001803 goto exit;
1804 }
1805 if (sizeOffset < 0) {
1806 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001807 _exceptionType = "java/lang/IllegalArgumentException";
1808 _exceptionMessage = "sizeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001809 goto exit;
1810 }
1811 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
1812 size_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001813 _env->GetIntArrayElements(size_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001814 size = size_base + sizeOffset;
1815
1816 if (!type_ref) {
1817 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001818 _exceptionType = "java/lang/IllegalArgumentException";
1819 _exceptionMessage = "type == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001820 goto exit;
1821 }
1822 if (typeOffset < 0) {
1823 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001824 _exceptionType = "java/lang/IllegalArgumentException";
1825 _exceptionMessage = "typeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001826 goto exit;
1827 }
1828 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
1829 type_base = (GLenum *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001830 _env->GetIntArrayElements(type_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001831 type = type_base + typeOffset;
1832
1833 if (!name_ref) {
1834 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001835 _exceptionType = "java/lang/IllegalArgumentException";
1836 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001837 goto exit;
1838 }
1839 if (nameOffset < 0) {
1840 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001841 _exceptionType = "java/lang/IllegalArgumentException";
1842 _exceptionMessage = "nameOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001843 goto exit;
1844 }
1845 _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
1846 name_base = (char *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001847 _env->GetByteArrayElements(name_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001848 name = name_base + nameOffset;
1849
1850 glGetActiveAttrib(
1851 (GLuint)program,
1852 (GLuint)index,
1853 (GLsizei)bufsize,
1854 (GLsizei *)length,
1855 (GLint *)size,
1856 (GLenum *)type,
1857 (char *)name
1858 );
1859
1860exit:
1861 if (name_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001862 _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001863 _exception ? JNI_ABORT: 0);
1864 }
1865 if (type_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001866 _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001867 _exception ? JNI_ABORT: 0);
1868 }
1869 if (size_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001870 _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001871 _exception ? JNI_ABORT: 0);
1872 }
1873 if (length_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001874 _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001875 _exception ? JNI_ABORT: 0);
1876 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001877 if (_exception) {
1878 jniThrowException(_env, _exceptionType, _exceptionMessage);
1879 }
Jack Palevich560814f2009-11-19 16:34:55 +08001880}
1881
1882/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1883static void
1884android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
1885 (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001886 jintArray _lengthArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001887 jint _lengthBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001888 jintArray _sizeArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001889 jint _sizeBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001890 jintArray _typeArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001891 jint _typeBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001892 jint _lengthRemaining;
1893 GLsizei *length = (GLsizei *) 0;
1894 jint _sizeRemaining;
1895 GLint *size = (GLint *) 0;
1896 jint _typeRemaining;
1897 GLenum *type = (GLenum *) 0;
1898
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001899 length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
1900 size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
1901 type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001902 if (length == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001903 char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001904 length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
1905 }
1906 if (size == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001907 char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001908 size = (GLint *) (_sizeBase + _sizeBufferOffset);
1909 }
1910 if (type == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001911 char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001912 type = (GLenum *) (_typeBase + _typeBufferOffset);
1913 }
Jack Palevich560814f2009-11-19 16:34:55 +08001914 glGetActiveAttrib(
1915 (GLuint)program,
1916 (GLuint)index,
1917 (GLsizei)bufsize,
1918 (GLsizei *)length,
1919 (GLint *)size,
1920 (GLenum *)type,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00001921 reinterpret_cast<char *>(name)
Jack Palevich560814f2009-11-19 16:34:55 +08001922 );
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001923 if (_typeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001924 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08001925 }
1926 if (_sizeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001927 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08001928 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001929 if (_lengthArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001930 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08001931 }
1932}
1933
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07001934/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1935static jstring
1936android_glGetActiveAttrib1
1937 (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
1938 jint _exception = 0;
1939 const char * _exceptionType;
1940 const char * _exceptionMessage;
1941 GLint *size_base = (GLint *) 0;
1942 jint _sizeRemaining;
1943 GLint *size = (GLint *) 0;
1944 GLenum *type_base = (GLenum *) 0;
1945 jint _typeRemaining;
1946 GLenum *type = (GLenum *) 0;
1947
1948 jstring result = 0;
1949
1950 GLint len = 0;
1951 glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
1952 if (!len) {
1953 return _env->NewStringUTF("");
1954 }
1955 char* buf = (char*) malloc(len);
1956
1957 if (buf == NULL) {
1958 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
1959 return NULL;
1960 }
1961 if (!size_ref) {
1962 _exception = 1;
1963 _exceptionType = "java/lang/IllegalArgumentException";
1964 _exceptionMessage = "size == null";
1965 goto exit;
1966 }
1967 if (sizeOffset < 0) {
1968 _exception = 1;
1969 _exceptionType = "java/lang/IllegalArgumentException";
1970 _exceptionMessage = "sizeOffset < 0";
1971 goto exit;
1972 }
1973 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
1974 size_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001975 _env->GetIntArrayElements(size_ref, (jboolean *)0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07001976 size = size_base + sizeOffset;
1977
1978 if (!type_ref) {
1979 _exception = 1;
1980 _exceptionType = "java/lang/IllegalArgumentException";
1981 _exceptionMessage = "type == null";
1982 goto exit;
1983 }
1984 if (typeOffset < 0) {
1985 _exception = 1;
1986 _exceptionType = "java/lang/IllegalArgumentException";
1987 _exceptionMessage = "typeOffset < 0";
1988 goto exit;
1989 }
1990 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
1991 type_base = (GLenum *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001992 _env->GetIntArrayElements(type_ref, (jboolean *)0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07001993 type = type_base + typeOffset;
1994
1995 glGetActiveAttrib(
1996 (GLuint)program,
1997 (GLuint)index,
1998 (GLsizei)len,
1999 NULL,
2000 (GLint *)size,
2001 (GLenum *)type,
2002 (char *)buf
2003 );
2004exit:
2005 if (type_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002006 _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002007 _exception ? JNI_ABORT: 0);
2008 }
2009 if (size_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002010 _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002011 _exception ? JNI_ABORT: 0);
2012 }
2013 if (_exception != 1) {
2014 result = _env->NewStringUTF(buf);
2015 }
2016 if (buf) {
2017 free(buf);
2018 }
2019 if (_exception) {
2020 jniThrowException(_env, _exceptionType, _exceptionMessage);
2021 }
2022 if (result == 0) {
2023 result = _env->NewStringUTF("");
2024 }
2025
2026 return result;
2027}
2028
2029/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2030static jstring
2031android_glGetActiveAttrib2
2032 (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002033 jintArray _sizeArray = (jintArray) 0;
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002034 jint _sizeBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002035 jintArray _typeArray = (jintArray) 0;
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002036 jint _typeBufferOffset = (jint) 0;
2037 jint _lengthRemaining;
2038 GLsizei *length = (GLsizei *) 0;
2039 jint _sizeRemaining;
2040 GLint *size = (GLint *) 0;
2041 jint _typeRemaining;
2042 GLenum *type = (GLenum *) 0;
2043
2044 jstring result = 0;
2045
2046 GLint len = 0;
2047 glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
2048 if (!len) {
2049 return _env->NewStringUTF("");
2050 }
2051 char* buf = (char*) malloc(len);
2052
2053 if (buf == NULL) {
2054 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2055 return NULL;
2056 }
2057
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002058 size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
2059 type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002060 if (size == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002061 char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002062 size = (GLint *) (_sizeBase + _sizeBufferOffset);
2063 }
2064 if (type == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002065 char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002066 type = (GLenum *) (_typeBase + _typeBufferOffset);
2067 }
2068 glGetActiveAttrib(
2069 (GLuint)program,
2070 (GLuint)index,
2071 (GLsizei)len,
2072 NULL,
2073 (GLint *)size,
2074 (GLenum *)type,
2075 (char *)buf
2076 );
2077
2078 if (_typeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002079 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002080 }
2081 if (_sizeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002082 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002083 }
2084 result = _env->NewStringUTF(buf);
2085 if (buf) {
2086 free(buf);
2087 }
2088 return result;
2089}
Jack Palevich560814f2009-11-19 16:34:55 +08002090/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2091static void
2092android_glGetActiveUniform__III_3II_3II_3II_3BI
2093 (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jintArray length_ref, jint lengthOffset, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset, jbyteArray name_ref, jint nameOffset) {
2094 jint _exception = 0;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002095 const char * _exceptionType;
2096 const char * _exceptionMessage;
Jack Palevich560814f2009-11-19 16:34:55 +08002097 GLsizei *length_base = (GLsizei *) 0;
2098 jint _lengthRemaining;
2099 GLsizei *length = (GLsizei *) 0;
2100 GLint *size_base = (GLint *) 0;
2101 jint _sizeRemaining;
2102 GLint *size = (GLint *) 0;
2103 GLenum *type_base = (GLenum *) 0;
2104 jint _typeRemaining;
2105 GLenum *type = (GLenum *) 0;
2106 char *name_base = (char *) 0;
2107 jint _nameRemaining;
2108 char *name = (char *) 0;
2109
Pablo Ceballos6aff9062015-10-01 18:35:39 -07002110 if (length_ref) {
2111 if (lengthOffset < 0) {
2112 _exception = 1;
2113 _exceptionType = "java/lang/IllegalArgumentException";
2114 _exceptionMessage = "lengthOffset < 0";
2115 goto exit;
2116 }
2117 _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
2118 length_base = (GLsizei *)
2119 _env->GetIntArrayElements(length_ref, (jboolean *)0);
2120 length = length_base + lengthOffset;
Jack Palevich560814f2009-11-19 16:34:55 +08002121 }
Jack Palevich560814f2009-11-19 16:34:55 +08002122
2123 if (!size_ref) {
2124 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002125 _exceptionType = "java/lang/IllegalArgumentException";
2126 _exceptionMessage = "size == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002127 goto exit;
2128 }
2129 if (sizeOffset < 0) {
2130 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002131 _exceptionType = "java/lang/IllegalArgumentException";
2132 _exceptionMessage = "sizeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002133 goto exit;
2134 }
2135 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2136 size_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002137 _env->GetIntArrayElements(size_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08002138 size = size_base + sizeOffset;
2139
2140 if (!type_ref) {
2141 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002142 _exceptionType = "java/lang/IllegalArgumentException";
2143 _exceptionMessage = "type == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002144 goto exit;
2145 }
2146 if (typeOffset < 0) {
2147 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002148 _exceptionType = "java/lang/IllegalArgumentException";
2149 _exceptionMessage = "typeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002150 goto exit;
2151 }
2152 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2153 type_base = (GLenum *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002154 _env->GetIntArrayElements(type_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08002155 type = type_base + typeOffset;
2156
2157 if (!name_ref) {
2158 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002159 _exceptionType = "java/lang/IllegalArgumentException";
2160 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002161 goto exit;
2162 }
2163 if (nameOffset < 0) {
2164 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002165 _exceptionType = "java/lang/IllegalArgumentException";
2166 _exceptionMessage = "nameOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002167 goto exit;
2168 }
2169 _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
2170 name_base = (char *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002171 _env->GetByteArrayElements(name_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08002172 name = name_base + nameOffset;
2173
2174 glGetActiveUniform(
2175 (GLuint)program,
2176 (GLuint)index,
2177 (GLsizei)bufsize,
2178 (GLsizei *)length,
2179 (GLint *)size,
2180 (GLenum *)type,
2181 (char *)name
2182 );
2183
2184exit:
2185 if (name_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002186 _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002187 _exception ? JNI_ABORT: 0);
2188 }
2189 if (type_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002190 _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002191 _exception ? JNI_ABORT: 0);
2192 }
2193 if (size_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002194 _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002195 _exception ? JNI_ABORT: 0);
2196 }
2197 if (length_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002198 _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002199 _exception ? JNI_ABORT: 0);
2200 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002201 if (_exception) {
2202 jniThrowException(_env, _exceptionType, _exceptionMessage);
2203 }
Jack Palevich560814f2009-11-19 16:34:55 +08002204}
2205
2206/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2207static void
2208android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
2209 (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002210 jintArray _lengthArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002211 jint _lengthBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002212 jintArray _sizeArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002213 jint _sizeBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002214 jintArray _typeArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002215 jint _typeBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002216 jint _lengthRemaining;
2217 GLsizei *length = (GLsizei *) 0;
2218 jint _sizeRemaining;
2219 GLint *size = (GLint *) 0;
2220 jint _typeRemaining;
2221 GLenum *type = (GLenum *) 0;
2222
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002223 length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
2224 size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
2225 type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002226 if (length == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002227 char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002228 length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
2229 }
2230 if (size == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002231 char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002232 size = (GLint *) (_sizeBase + _sizeBufferOffset);
2233 }
2234 if (type == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002235 char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002236 type = (GLenum *) (_typeBase + _typeBufferOffset);
2237 }
Jack Palevich560814f2009-11-19 16:34:55 +08002238 glGetActiveUniform(
2239 (GLuint)program,
2240 (GLuint)index,
2241 (GLsizei)bufsize,
2242 (GLsizei *)length,
2243 (GLint *)size,
2244 (GLenum *)type,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00002245 reinterpret_cast<char *>(name)
Jack Palevich560814f2009-11-19 16:34:55 +08002246 );
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002247 if (_typeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002248 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08002249 }
2250 if (_sizeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002251 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08002252 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002253 if (_lengthArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002254 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08002255 }
2256}
2257
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002258/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2259static jstring
2260android_glGetActiveUniform1
2261 (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
2262 jint _exception = 0;
2263 const char * _exceptionType;
2264 const char * _exceptionMessage;
2265
2266 GLint *size_base = (GLint *) 0;
2267 jint _sizeRemaining;
2268 GLint *size = (GLint *) 0;
2269
2270 GLenum *type_base = (GLenum *) 0;
2271 jint _typeRemaining;
2272 GLenum *type = (GLenum *) 0;
2273
2274 jstring result = 0;
2275
2276 GLint len = 0;
2277 glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
2278 if (!len) {
2279 return _env->NewStringUTF("");
2280 }
2281 char* buf = (char*) malloc(len);
2282
2283 if (buf == NULL) {
2284 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2285 return NULL;
2286 }
2287
2288 if (!size_ref) {
2289 _exception = 1;
2290 _exceptionType = "java/lang/IllegalArgumentException";
2291 _exceptionMessage = "size == null";
2292 goto exit;
2293 }
2294 if (sizeOffset < 0) {
2295 _exception = 1;
2296 _exceptionType = "java/lang/IllegalArgumentException";
2297 _exceptionMessage = "sizeOffset < 0";
2298 goto exit;
2299 }
2300 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2301 size_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002302 _env->GetIntArrayElements(size_ref, (jboolean *)0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002303 size = size_base + sizeOffset;
2304
2305 if (!type_ref) {
2306 _exception = 1;
2307 _exceptionType = "java/lang/IllegalArgumentException";
2308 _exceptionMessage = "type == null";
2309 goto exit;
2310 }
2311 if (typeOffset < 0) {
2312 _exception = 1;
2313 _exceptionType = "java/lang/IllegalArgumentException";
2314 _exceptionMessage = "typeOffset < 0";
2315 goto exit;
2316 }
2317 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2318 type_base = (GLenum *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002319 _env->GetIntArrayElements(type_ref, (jboolean *)0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002320 type = type_base + typeOffset;
2321
2322 glGetActiveUniform(
2323 (GLuint)program,
2324 (GLuint)index,
2325 (GLsizei)len,
2326 NULL,
2327 (GLint *)size,
2328 (GLenum *)type,
2329 (char *)buf
2330 );
2331
2332exit:
2333 if (type_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002334 _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002335 _exception ? JNI_ABORT: 0);
2336 }
2337 if (size_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002338 _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002339 _exception ? JNI_ABORT: 0);
2340 }
2341 if (_exception != 1) {
2342 result = _env->NewStringUTF(buf);
2343 }
2344 if (buf) {
2345 free(buf);
2346 }
2347 if (_exception) {
2348 jniThrowException(_env, _exceptionType, _exceptionMessage);
2349 }
2350 if (result == 0) {
2351 result = _env->NewStringUTF("");
2352 }
2353 return result;
2354}
2355
2356/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2357static jstring
2358android_glGetActiveUniform2
2359 (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002360 jintArray _sizeArray = (jintArray) 0;
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002361 jint _sizeBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002362 jintArray _typeArray = (jintArray) 0;
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002363 jint _typeBufferOffset = (jint) 0;
2364 jint _sizeRemaining;
2365 GLint *size = (GLint *) 0;
2366 jint _typeRemaining;
2367 GLenum *type = (GLenum *) 0;
2368
2369 jstring result = 0;
2370 GLint len = 0;
2371 glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
2372 if (!len) {
2373 return _env->NewStringUTF("");
2374 }
2375 char* buf = (char*) malloc(len);
2376
2377 if (buf == NULL) {
2378 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2379 return NULL;
2380 }
2381
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002382 size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
2383 type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002384
2385 if (size == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002386 char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002387 size = (GLint *) (_sizeBase + _sizeBufferOffset);
2388 }
2389 if (type == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002390 char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002391 type = (GLenum *) (_typeBase + _typeBufferOffset);
2392 }
2393 glGetActiveUniform(
2394 (GLuint)program,
2395 (GLuint)index,
2396 len,
2397 NULL,
2398 (GLint *)size,
2399 (GLenum *)type,
2400 (char *)buf
2401 );
2402
2403 if (_typeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002404 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002405 }
2406 if (_sizeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002407 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002408 }
2409 result = _env->NewStringUTF(buf);
2410 if (buf) {
2411 free(buf);
2412 }
2413 return result;
2414}
Jack Palevich560814f2009-11-19 16:34:55 +08002415/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */
2416static void
2417android_glGetAttachedShaders__II_3II_3II
2418 (JNIEnv *_env, jobject _this, jint program, jint maxcount, jintArray count_ref, jint countOffset, jintArray shaders_ref, jint shadersOffset) {
2419 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002420 const char * _exceptionType = NULL;
2421 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002422 GLsizei *count_base = (GLsizei *) 0;
2423 jint _countRemaining;
2424 GLsizei *count = (GLsizei *) 0;
2425 GLuint *shaders_base = (GLuint *) 0;
2426 jint _shadersRemaining;
2427 GLuint *shaders = (GLuint *) 0;
2428
Pablo Ceballos6aff9062015-10-01 18:35:39 -07002429 if (count_ref) {
2430 if (countOffset < 0) {
2431 _exception = 1;
2432 _exceptionType = "java/lang/IllegalArgumentException";
2433 _exceptionMessage = "countOffset < 0";
2434 goto exit;
2435 }
2436 _countRemaining = _env->GetArrayLength(count_ref) - countOffset;
2437 if (_countRemaining < 1) {
2438 _exception = 1;
2439 _exceptionType = "java/lang/IllegalArgumentException";
2440 _exceptionMessage = "length - countOffset < 1 < needed";
2441 goto exit;
2442 }
2443 count_base = (GLsizei *)
2444 _env->GetIntArrayElements(count_ref, (jboolean *)0);
2445 count = count_base + countOffset;
Jack Palevich560814f2009-11-19 16:34:55 +08002446 }
Jack Palevich560814f2009-11-19 16:34:55 +08002447
2448 if (!shaders_ref) {
2449 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002450 _exceptionType = "java/lang/IllegalArgumentException";
2451 _exceptionMessage = "shaders == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002452 goto exit;
2453 }
2454 if (shadersOffset < 0) {
2455 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002456 _exceptionType = "java/lang/IllegalArgumentException";
2457 _exceptionMessage = "shadersOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002458 goto exit;
2459 }
2460 _shadersRemaining = _env->GetArrayLength(shaders_ref) - shadersOffset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002461 if (_shadersRemaining < maxcount) {
2462 _exception = 1;
2463 _exceptionType = "java/lang/IllegalArgumentException";
2464 _exceptionMessage = "length - shadersOffset < maxcount < needed";
2465 goto exit;
2466 }
Jack Palevich560814f2009-11-19 16:34:55 +08002467 shaders_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002468 _env->GetIntArrayElements(shaders_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08002469 shaders = shaders_base + shadersOffset;
2470
2471 glGetAttachedShaders(
2472 (GLuint)program,
2473 (GLsizei)maxcount,
2474 (GLsizei *)count,
2475 (GLuint *)shaders
2476 );
2477
2478exit:
2479 if (shaders_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002480 _env->ReleaseIntArrayElements(shaders_ref, (jint*)shaders_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002481 _exception ? JNI_ABORT: 0);
2482 }
2483 if (count_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002484 _env->ReleaseIntArrayElements(count_ref, (jint*)count_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002485 _exception ? JNI_ABORT: 0);
2486 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002487 if (_exception) {
2488 jniThrowException(_env, _exceptionType, _exceptionMessage);
2489 }
Jack Palevich560814f2009-11-19 16:34:55 +08002490}
2491
2492/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */
2493static void
2494android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
2495 (JNIEnv *_env, jobject _this, jint program, jint maxcount, jobject count_buf, jobject shaders_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002496 jint _exception = 0;
2497 const char * _exceptionType = NULL;
2498 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002499 jintArray _countArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002500 jint _countBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002501 jintArray _shadersArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002502 jint _shadersBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002503 jint _countRemaining;
2504 GLsizei *count = (GLsizei *) 0;
2505 jint _shadersRemaining;
2506 GLuint *shaders = (GLuint *) 0;
2507
Mathias Agopian2ad04772013-02-23 03:12:30 -08002508 if (count_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002509 count = (GLsizei *)getPointer(_env, count_buf, (jarray*)&_countArray, &_countRemaining, &_countBufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08002510 if (_countRemaining < 1) {
2511 _exception = 1;
2512 _exceptionType = "java/lang/IllegalArgumentException";
2513 _exceptionMessage = "remaining() < 1 < needed";
2514 goto exit;
2515 }
2516 }
Pablo Ceballos6aff9062015-10-01 18:35:39 -07002517 shaders = (GLuint *)getPointer(_env, shaders_buf, (jarray*)&_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
2518 if (_shadersRemaining < maxcount) {
2519 _exception = 1;
2520 _exceptionType = "java/lang/IllegalArgumentException";
2521 _exceptionMessage = "remaining() < maxcount < needed";
2522 goto exit;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002523 }
2524 if (count_buf && count == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002525 char * _countBase = (char *)_env->GetIntArrayElements(_countArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002526 count = (GLsizei *) (_countBase + _countBufferOffset);
2527 }
Pablo Ceballos6aff9062015-10-01 18:35:39 -07002528 if (shaders == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002529 char * _shadersBase = (char *)_env->GetIntArrayElements(_shadersArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002530 shaders = (GLuint *) (_shadersBase + _shadersBufferOffset);
2531 }
Jack Palevich560814f2009-11-19 16:34:55 +08002532 glGetAttachedShaders(
2533 (GLuint)program,
2534 (GLsizei)maxcount,
2535 (GLsizei *)count,
2536 (GLuint *)shaders
2537 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08002538
2539exit:
Jack Palevich560814f2009-11-19 16:34:55 +08002540 if (_shadersArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002541 _env->ReleaseIntArrayElements(_shadersArray, (jint*)shaders, _exception ? JNI_ABORT : 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002542 }
2543 if (_countArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002544 _env->ReleaseIntArrayElements(_countArray, (jint*)count, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08002545 }
2546 if (_exception) {
2547 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08002548 }
2549}
2550
Mathias Agopian89be00b2013-02-22 20:08:06 -08002551/* GLint glGetAttribLocation ( GLuint program, const char *name ) */
Jack Palevich560814f2009-11-19 16:34:55 +08002552static jint
2553android_glGetAttribLocation__ILjava_lang_String_2
2554 (JNIEnv *_env, jobject _this, jint program, jstring name) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002555 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002556 const char * _exceptionType = NULL;
2557 const char * _exceptionMessage = NULL;
Mathias Agopian89be00b2013-02-22 20:08:06 -08002558 GLint _returnValue = 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002559 const char* _nativename = 0;
2560
2561 if (!name) {
Elliott Hughes428d3fc2013-09-24 17:15:41 -07002562 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002563 _exceptionType = "java/lang/IllegalArgumentException";
2564 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002565 goto exit;
2566 }
2567 _nativename = _env->GetStringUTFChars(name, 0);
2568
2569 _returnValue = glGetAttribLocation(
2570 (GLuint)program,
2571 (char *)_nativename
2572 );
2573
2574exit:
2575 if (_nativename) {
2576 _env->ReleaseStringUTFChars(name, _nativename);
2577 }
2578
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002579 if (_exception) {
2580 jniThrowException(_env, _exceptionType, _exceptionMessage);
2581 }
Andy McFaddencee51982013-04-25 16:08:31 -07002582 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08002583}
2584
2585/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
2586static void
2587android_glGetBooleanv__I_3ZI
2588 (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002589 get<jbooleanArray, BooleanArrayGetter, jboolean*, BooleanArrayReleaser, GLboolean, glGetBooleanv>(
2590 _env, _this, pname, params_ref, offset);
Jack Palevich560814f2009-11-19 16:34:55 +08002591}
2592
2593/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
2594static void
2595android_glGetBooleanv__ILjava_nio_IntBuffer_2
2596 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002597 getarray<GLboolean, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetBooleanv>(
2598 _env, _this, pname, params_buf);
Jack Palevich560814f2009-11-19 16:34:55 +08002599}
Jack Palevich560814f2009-11-19 16:34:55 +08002600/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2601static void
2602android_glGetBufferParameteriv__II_3II
2603 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Jack Palevich73108672011-03-28 14:49:12 -07002604 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002605 const char * _exceptionType = NULL;
2606 const char * _exceptionMessage = NULL;
Jack Palevich73108672011-03-28 14:49:12 -07002607 GLint *params_base = (GLint *) 0;
2608 jint _remaining;
2609 GLint *params = (GLint *) 0;
2610
2611 if (!params_ref) {
2612 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002613 _exceptionType = "java/lang/IllegalArgumentException";
2614 _exceptionMessage = "params == null";
Jack Palevich73108672011-03-28 14:49:12 -07002615 goto exit;
2616 }
2617 if (offset < 0) {
2618 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002619 _exceptionType = "java/lang/IllegalArgumentException";
2620 _exceptionMessage = "offset < 0";
Jack Palevich73108672011-03-28 14:49:12 -07002621 goto exit;
2622 }
2623 _remaining = _env->GetArrayLength(params_ref) - offset;
2624 if (_remaining < 1) {
2625 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002626 _exceptionType = "java/lang/IllegalArgumentException";
2627 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich73108672011-03-28 14:49:12 -07002628 goto exit;
2629 }
2630 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002631 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich73108672011-03-28 14:49:12 -07002632 params = params_base + offset;
2633
2634 glGetBufferParameteriv(
2635 (GLenum)target,
2636 (GLenum)pname,
2637 (GLint *)params
2638 );
2639
2640exit:
2641 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002642 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich73108672011-03-28 14:49:12 -07002643 _exception ? JNI_ABORT: 0);
2644 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002645 if (_exception) {
2646 jniThrowException(_env, _exceptionType, _exceptionMessage);
2647 }
Jack Palevich560814f2009-11-19 16:34:55 +08002648}
2649
2650/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2651static void
2652android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
2653 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Jack Palevich73108672011-03-28 14:49:12 -07002654 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002655 const char * _exceptionType = NULL;
2656 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002657 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002658 jint _bufferOffset = (jint) 0;
Jack Palevich73108672011-03-28 14:49:12 -07002659 jint _remaining;
2660 GLint *params = (GLint *) 0;
2661
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002662 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich73108672011-03-28 14:49:12 -07002663 if (_remaining < 1) {
2664 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002665 _exceptionType = "java/lang/IllegalArgumentException";
2666 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich73108672011-03-28 14:49:12 -07002667 goto exit;
2668 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002669 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002670 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002671 params = (GLint *) (_paramsBase + _bufferOffset);
2672 }
Jack Palevich73108672011-03-28 14:49:12 -07002673 glGetBufferParameteriv(
2674 (GLenum)target,
2675 (GLenum)pname,
2676 (GLint *)params
2677 );
2678
2679exit:
2680 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002681 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich73108672011-03-28 14:49:12 -07002682 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002683 if (_exception) {
2684 jniThrowException(_env, _exceptionType, _exceptionMessage);
2685 }
Jack Palevich560814f2009-11-19 16:34:55 +08002686}
2687
2688/* GLenum glGetError ( void ) */
2689static jint
2690android_glGetError__
2691 (JNIEnv *_env, jobject _this) {
2692 GLenum _returnValue;
2693 _returnValue = glGetError();
Andy McFaddencee51982013-04-25 16:08:31 -07002694 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08002695}
2696
2697/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
2698static void
2699android_glGetFloatv__I_3FI
2700 (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002701 get<jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, GLfloat, glGetFloatv>(
2702 _env, _this, pname, params_ref, offset);
Jack Palevich560814f2009-11-19 16:34:55 +08002703}
2704
2705/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
2706static void
2707android_glGetFloatv__ILjava_nio_FloatBuffer_2
2708 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002709 getarray<GLfloat, jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, glGetFloatv>(
2710 _env, _this, pname, params_buf);
Jack Palevich560814f2009-11-19 16:34:55 +08002711}
Jack Palevich560814f2009-11-19 16:34:55 +08002712/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
2713static void
2714android_glGetFramebufferAttachmentParameteriv__III_3II
2715 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jintArray params_ref, jint offset) {
2716 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002717 const char * _exceptionType = NULL;
2718 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002719 GLint *params_base = (GLint *) 0;
2720 jint _remaining;
2721 GLint *params = (GLint *) 0;
2722
2723 if (!params_ref) {
2724 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002725 _exceptionType = "java/lang/IllegalArgumentException";
2726 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002727 goto exit;
2728 }
2729 if (offset < 0) {
2730 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002731 _exceptionType = "java/lang/IllegalArgumentException";
2732 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002733 goto exit;
2734 }
2735 _remaining = _env->GetArrayLength(params_ref) - offset;
2736 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002737 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08002738 params = params_base + offset;
2739
2740 glGetFramebufferAttachmentParameteriv(
2741 (GLenum)target,
2742 (GLenum)attachment,
2743 (GLenum)pname,
2744 (GLint *)params
2745 );
2746
2747exit:
2748 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002749 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002750 _exception ? JNI_ABORT: 0);
2751 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002752 if (_exception) {
2753 jniThrowException(_env, _exceptionType, _exceptionMessage);
2754 }
Jack Palevich560814f2009-11-19 16:34:55 +08002755}
2756
2757/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
2758static void
2759android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2
2760 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002761 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002762 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002763 jint _remaining;
2764 GLint *params = (GLint *) 0;
2765
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002766 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002767 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002768 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002769 params = (GLint *) (_paramsBase + _bufferOffset);
2770 }
Jack Palevich560814f2009-11-19 16:34:55 +08002771 glGetFramebufferAttachmentParameteriv(
2772 (GLenum)target,
2773 (GLenum)attachment,
2774 (GLenum)pname,
2775 (GLint *)params
2776 );
2777 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002778 _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
Jack Palevich560814f2009-11-19 16:34:55 +08002779 }
2780}
2781
2782/* void glGetIntegerv ( GLenum pname, GLint *params ) */
2783static void
2784android_glGetIntegerv__I_3II
2785 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002786 get<jintArray, IntArrayGetter, jint*, IntArrayReleaser, GLint, glGetIntegerv>(
2787 _env, _this, pname, params_ref, offset);
Jack Palevich560814f2009-11-19 16:34:55 +08002788}
2789
2790/* void glGetIntegerv ( GLenum pname, GLint *params ) */
2791static void
2792android_glGetIntegerv__ILjava_nio_IntBuffer_2
2793 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002794 getarray<GLint, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetIntegerv>(
2795 _env, _this, pname, params_buf);
Jack Palevich560814f2009-11-19 16:34:55 +08002796}
Jack Palevich560814f2009-11-19 16:34:55 +08002797/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2798static void
2799android_glGetProgramiv__II_3II
2800 (JNIEnv *_env, jobject _this, jint program, jint pname, jintArray params_ref, jint offset) {
2801 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002802 const char * _exceptionType = NULL;
2803 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002804 GLint *params_base = (GLint *) 0;
2805 jint _remaining;
2806 GLint *params = (GLint *) 0;
2807
2808 if (!params_ref) {
2809 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002810 _exceptionType = "java/lang/IllegalArgumentException";
2811 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002812 goto exit;
2813 }
2814 if (offset < 0) {
2815 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002816 _exceptionType = "java/lang/IllegalArgumentException";
2817 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002818 goto exit;
2819 }
2820 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002821 if (_remaining < 1) {
2822 _exception = 1;
2823 _exceptionType = "java/lang/IllegalArgumentException";
2824 _exceptionMessage = "length - offset < 1 < needed";
2825 goto exit;
2826 }
Jack Palevich560814f2009-11-19 16:34:55 +08002827 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002828 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08002829 params = params_base + offset;
2830
2831 glGetProgramiv(
2832 (GLuint)program,
2833 (GLenum)pname,
2834 (GLint *)params
2835 );
2836
2837exit:
2838 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002839 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002840 _exception ? JNI_ABORT: 0);
2841 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002842 if (_exception) {
2843 jniThrowException(_env, _exceptionType, _exceptionMessage);
2844 }
Jack Palevich560814f2009-11-19 16:34:55 +08002845}
2846
2847/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2848static void
2849android_glGetProgramiv__IILjava_nio_IntBuffer_2
2850 (JNIEnv *_env, jobject _this, jint program, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002851 jint _exception = 0;
2852 const char * _exceptionType = NULL;
2853 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002854 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002855 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002856 jint _remaining;
2857 GLint *params = (GLint *) 0;
2858
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002859 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08002860 if (_remaining < 1) {
2861 _exception = 1;
2862 _exceptionType = "java/lang/IllegalArgumentException";
2863 _exceptionMessage = "remaining() < 1 < needed";
2864 goto exit;
2865 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002866 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002867 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002868 params = (GLint *) (_paramsBase + _bufferOffset);
2869 }
Jack Palevich560814f2009-11-19 16:34:55 +08002870 glGetProgramiv(
2871 (GLuint)program,
2872 (GLenum)pname,
2873 (GLint *)params
2874 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08002875
2876exit:
Jack Palevich560814f2009-11-19 16:34:55 +08002877 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002878 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08002879 }
2880 if (_exception) {
2881 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08002882 }
2883}
2884
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002885#include <stdlib.h>
Jack Palevich560814f2009-11-19 16:34:55 +08002886
2887/* void glGetProgramInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002888static jstring android_glGetProgramInfoLog(JNIEnv *_env, jobject, jint shader) {
Jack Palevich560814f2009-11-19 16:34:55 +08002889 GLint infoLen = 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002890 glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002891 if (!infoLen) {
2892 return _env->NewStringUTF("");
Jack Palevich560814f2009-11-19 16:34:55 +08002893 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002894 char* buf = (char*) malloc(infoLen);
2895 if (buf == NULL) {
2896 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2897 return NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002898 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002899 glGetProgramInfoLog(shader, infoLen, NULL, buf);
2900 jstring result = _env->NewStringUTF(buf);
2901 free(buf);
2902 return result;
Jack Palevich560814f2009-11-19 16:34:55 +08002903}
2904/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2905static void
2906android_glGetRenderbufferParameteriv__II_3II
2907 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2908 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002909 const char * _exceptionType = NULL;
2910 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002911 GLint *params_base = (GLint *) 0;
2912 jint _remaining;
2913 GLint *params = (GLint *) 0;
2914
2915 if (!params_ref) {
2916 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002917 _exceptionType = "java/lang/IllegalArgumentException";
2918 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002919 goto exit;
2920 }
2921 if (offset < 0) {
2922 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002923 _exceptionType = "java/lang/IllegalArgumentException";
2924 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002925 goto exit;
2926 }
2927 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002928 if (_remaining < 1) {
2929 _exception = 1;
2930 _exceptionType = "java/lang/IllegalArgumentException";
2931 _exceptionMessage = "length - offset < 1 < needed";
2932 goto exit;
2933 }
Jack Palevich560814f2009-11-19 16:34:55 +08002934 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002935 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08002936 params = params_base + offset;
2937
2938 glGetRenderbufferParameteriv(
2939 (GLenum)target,
2940 (GLenum)pname,
2941 (GLint *)params
2942 );
2943
2944exit:
2945 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002946 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002947 _exception ? JNI_ABORT: 0);
2948 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002949 if (_exception) {
2950 jniThrowException(_env, _exceptionType, _exceptionMessage);
2951 }
Jack Palevich560814f2009-11-19 16:34:55 +08002952}
2953
2954/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2955static void
2956android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2
2957 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002958 jint _exception = 0;
2959 const char * _exceptionType = NULL;
2960 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002961 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002962 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002963 jint _remaining;
2964 GLint *params = (GLint *) 0;
2965
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002966 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08002967 if (_remaining < 1) {
2968 _exception = 1;
2969 _exceptionType = "java/lang/IllegalArgumentException";
2970 _exceptionMessage = "remaining() < 1 < needed";
2971 goto exit;
2972 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002973 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002974 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002975 params = (GLint *) (_paramsBase + _bufferOffset);
2976 }
Jack Palevich560814f2009-11-19 16:34:55 +08002977 glGetRenderbufferParameteriv(
2978 (GLenum)target,
2979 (GLenum)pname,
2980 (GLint *)params
2981 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08002982
2983exit:
Jack Palevich560814f2009-11-19 16:34:55 +08002984 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002985 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08002986 }
2987 if (_exception) {
2988 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08002989 }
2990}
2991
2992/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
2993static void
2994android_glGetShaderiv__II_3II
2995 (JNIEnv *_env, jobject _this, jint shader, jint pname, jintArray params_ref, jint offset) {
2996 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002997 const char * _exceptionType = NULL;
2998 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002999 GLint *params_base = (GLint *) 0;
3000 jint _remaining;
3001 GLint *params = (GLint *) 0;
3002
3003 if (!params_ref) {
3004 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003005 _exceptionType = "java/lang/IllegalArgumentException";
3006 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003007 goto exit;
3008 }
3009 if (offset < 0) {
3010 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003011 _exceptionType = "java/lang/IllegalArgumentException";
3012 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003013 goto exit;
3014 }
3015 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003016 if (_remaining < 1) {
3017 _exception = 1;
3018 _exceptionType = "java/lang/IllegalArgumentException";
3019 _exceptionMessage = "length - offset < 1 < needed";
3020 goto exit;
3021 }
Jack Palevich560814f2009-11-19 16:34:55 +08003022 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003023 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003024 params = params_base + offset;
3025
3026 glGetShaderiv(
3027 (GLuint)shader,
3028 (GLenum)pname,
3029 (GLint *)params
3030 );
3031
3032exit:
3033 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003034 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003035 _exception ? JNI_ABORT: 0);
3036 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003037 if (_exception) {
3038 jniThrowException(_env, _exceptionType, _exceptionMessage);
3039 }
Jack Palevich560814f2009-11-19 16:34:55 +08003040}
3041
3042/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
3043static void
3044android_glGetShaderiv__IILjava_nio_IntBuffer_2
3045 (JNIEnv *_env, jobject _this, jint shader, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003046 jint _exception = 0;
3047 const char * _exceptionType = NULL;
3048 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003049 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003050 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003051 jint _remaining;
3052 GLint *params = (GLint *) 0;
3053
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003054 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003055 if (_remaining < 1) {
3056 _exception = 1;
3057 _exceptionType = "java/lang/IllegalArgumentException";
3058 _exceptionMessage = "remaining() < 1 < needed";
3059 goto exit;
3060 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003061 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003062 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003063 params = (GLint *) (_paramsBase + _bufferOffset);
3064 }
Jack Palevich560814f2009-11-19 16:34:55 +08003065 glGetShaderiv(
3066 (GLuint)shader,
3067 (GLenum)pname,
3068 (GLint *)params
3069 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003070
3071exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003072 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003073 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003074 }
3075 if (_exception) {
3076 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003077 }
3078}
3079
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003080#include <stdlib.h>
Jack Palevich560814f2009-11-19 16:34:55 +08003081
3082/* void glGetShaderInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003083static jstring android_glGetShaderInfoLog(JNIEnv *_env, jobject, jint shader) {
Jack Palevich560814f2009-11-19 16:34:55 +08003084 GLint infoLen = 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003085 glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003086 if (!infoLen) {
3087 return _env->NewStringUTF("");
Jack Palevich560814f2009-11-19 16:34:55 +08003088 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003089 char* buf = (char*) malloc(infoLen);
3090 if (buf == NULL) {
3091 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
3092 return NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003093 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003094 glGetShaderInfoLog(shader, infoLen, NULL, buf);
3095 jstring result = _env->NewStringUTF(buf);
3096 free(buf);
3097 return result;
Jack Palevich560814f2009-11-19 16:34:55 +08003098}
3099/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
3100static void
3101android_glGetShaderPrecisionFormat__II_3II_3II
3102 (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jintArray range_ref, jint rangeOffset, jintArray precision_ref, jint precisionOffset) {
3103 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003104 const char * _exceptionType = NULL;
3105 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003106 GLint *range_base = (GLint *) 0;
3107 jint _rangeRemaining;
3108 GLint *range = (GLint *) 0;
3109 GLint *precision_base = (GLint *) 0;
3110 jint _precisionRemaining;
3111 GLint *precision = (GLint *) 0;
3112
3113 if (!range_ref) {
3114 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003115 _exceptionType = "java/lang/IllegalArgumentException";
3116 _exceptionMessage = "range == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003117 goto exit;
3118 }
3119 if (rangeOffset < 0) {
3120 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003121 _exceptionType = "java/lang/IllegalArgumentException";
3122 _exceptionMessage = "rangeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003123 goto exit;
3124 }
3125 _rangeRemaining = _env->GetArrayLength(range_ref) - rangeOffset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003126 if (_rangeRemaining < 1) {
3127 _exception = 1;
3128 _exceptionType = "java/lang/IllegalArgumentException";
3129 _exceptionMessage = "length - rangeOffset < 1 < needed";
3130 goto exit;
3131 }
Jack Palevich560814f2009-11-19 16:34:55 +08003132 range_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003133 _env->GetIntArrayElements(range_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003134 range = range_base + rangeOffset;
3135
3136 if (!precision_ref) {
3137 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003138 _exceptionType = "java/lang/IllegalArgumentException";
3139 _exceptionMessage = "precision == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003140 goto exit;
3141 }
3142 if (precisionOffset < 0) {
3143 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003144 _exceptionType = "java/lang/IllegalArgumentException";
3145 _exceptionMessage = "precisionOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003146 goto exit;
3147 }
3148 _precisionRemaining = _env->GetArrayLength(precision_ref) - precisionOffset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003149 if (_precisionRemaining < 1) {
3150 _exception = 1;
3151 _exceptionType = "java/lang/IllegalArgumentException";
3152 _exceptionMessage = "length - precisionOffset < 1 < needed";
3153 goto exit;
3154 }
Jack Palevich560814f2009-11-19 16:34:55 +08003155 precision_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003156 _env->GetIntArrayElements(precision_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003157 precision = precision_base + precisionOffset;
3158
3159 glGetShaderPrecisionFormat(
3160 (GLenum)shadertype,
3161 (GLenum)precisiontype,
3162 (GLint *)range,
3163 (GLint *)precision
3164 );
3165
3166exit:
3167 if (precision_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003168 _env->ReleaseIntArrayElements(precision_ref, (jint*)precision_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003169 _exception ? JNI_ABORT: 0);
3170 }
3171 if (range_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003172 _env->ReleaseIntArrayElements(range_ref, (jint*)range_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003173 _exception ? JNI_ABORT: 0);
3174 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003175 if (_exception) {
3176 jniThrowException(_env, _exceptionType, _exceptionMessage);
3177 }
Jack Palevich560814f2009-11-19 16:34:55 +08003178}
3179
3180/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
3181static void
3182android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
3183 (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jobject range_buf, jobject precision_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003184 jint _exception = 0;
3185 const char * _exceptionType = NULL;
3186 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003187 jintArray _rangeArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003188 jint _rangeBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003189 jintArray _precisionArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003190 jint _precisionBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003191 jint _rangeRemaining;
3192 GLint *range = (GLint *) 0;
3193 jint _precisionRemaining;
3194 GLint *precision = (GLint *) 0;
3195
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003196 range = (GLint *)getPointer(_env, range_buf, (jarray*)&_rangeArray, &_rangeRemaining, &_rangeBufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003197 if (_rangeRemaining < 1) {
3198 _exception = 1;
3199 _exceptionType = "java/lang/IllegalArgumentException";
3200 _exceptionMessage = "remaining() < 1 < needed";
3201 goto exit;
3202 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003203 precision = (GLint *)getPointer(_env, precision_buf, (jarray*)&_precisionArray, &_precisionRemaining, &_precisionBufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003204 if (_precisionRemaining < 1) {
3205 _exception = 1;
3206 _exceptionType = "java/lang/IllegalArgumentException";
3207 _exceptionMessage = "remaining() < 1 < needed";
3208 goto exit;
3209 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003210 if (range == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003211 char * _rangeBase = (char *)_env->GetIntArrayElements(_rangeArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003212 range = (GLint *) (_rangeBase + _rangeBufferOffset);
3213 }
3214 if (precision == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003215 char * _precisionBase = (char *)_env->GetIntArrayElements(_precisionArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003216 precision = (GLint *) (_precisionBase + _precisionBufferOffset);
3217 }
Jack Palevich560814f2009-11-19 16:34:55 +08003218 glGetShaderPrecisionFormat(
3219 (GLenum)shadertype,
3220 (GLenum)precisiontype,
3221 (GLint *)range,
3222 (GLint *)precision
3223 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003224
3225exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003226 if (_precisionArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003227 _env->ReleaseIntArrayElements(_precisionArray, (jint*)precision, _exception ? JNI_ABORT : 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003228 }
3229 if (_rangeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003230 _env->ReleaseIntArrayElements(_rangeArray, (jint*)range, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003231 }
3232 if (_exception) {
3233 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003234 }
3235}
3236
3237/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3238static void
3239android_glGetShaderSource__II_3II_3BI
3240 (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jintArray length_ref, jint lengthOffset, jbyteArray source_ref, jint sourceOffset) {
3241 jint _exception = 0;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003242 const char * _exceptionType;
3243 const char * _exceptionMessage;
Jack Palevich560814f2009-11-19 16:34:55 +08003244 GLsizei *length_base = (GLsizei *) 0;
3245 jint _lengthRemaining;
3246 GLsizei *length = (GLsizei *) 0;
3247 char *source_base = (char *) 0;
3248 jint _sourceRemaining;
3249 char *source = (char *) 0;
3250
Pablo Ceballos6aff9062015-10-01 18:35:39 -07003251 if (length_ref) {
3252 if (lengthOffset < 0) {
3253 _exception = 1;
3254 _exceptionType = "java/lang/IllegalArgumentException";
3255 _exceptionMessage = "lengthOffset < 0";
3256 goto exit;
3257 }
3258 _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
3259 length_base = (GLsizei *)
3260 _env->GetIntArrayElements(length_ref, (jboolean *)0);
3261 length = length_base + lengthOffset;
Jack Palevich560814f2009-11-19 16:34:55 +08003262 }
Jack Palevich560814f2009-11-19 16:34:55 +08003263
3264 if (!source_ref) {
3265 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003266 _exceptionType = "java/lang/IllegalArgumentException";
3267 _exceptionMessage = "source == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003268 goto exit;
3269 }
3270 if (sourceOffset < 0) {
3271 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003272 _exceptionType = "java/lang/IllegalArgumentException";
3273 _exceptionMessage = "sourceOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003274 goto exit;
3275 }
3276 _sourceRemaining = _env->GetArrayLength(source_ref) - sourceOffset;
3277 source_base = (char *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003278 _env->GetByteArrayElements(source_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003279 source = source_base + sourceOffset;
3280
3281 glGetShaderSource(
3282 (GLuint)shader,
3283 (GLsizei)bufsize,
3284 (GLsizei *)length,
3285 (char *)source
3286 );
3287
3288exit:
3289 if (source_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003290 _env->ReleaseByteArrayElements(source_ref, (jbyte*)source_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003291 _exception ? JNI_ABORT: 0);
3292 }
3293 if (length_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003294 _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003295 _exception ? JNI_ABORT: 0);
3296 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003297 if (_exception) {
3298 jniThrowException(_env, _exceptionType, _exceptionMessage);
3299 }
Jack Palevich560814f2009-11-19 16:34:55 +08003300}
3301
3302/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3303static void
3304android_glGetShaderSource__IILjava_nio_IntBuffer_2B
3305 (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jobject length_buf, jbyte source) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003306 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003307 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003308 jint _remaining;
3309 GLsizei *length = (GLsizei *) 0;
3310
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003311 length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003312 if (length == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003313 char * _lengthBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003314 length = (GLsizei *) (_lengthBase + _bufferOffset);
3315 }
Jack Palevich560814f2009-11-19 16:34:55 +08003316 glGetShaderSource(
3317 (GLuint)shader,
3318 (GLsizei)bufsize,
3319 (GLsizei *)length,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00003320 reinterpret_cast<char *>(source)
Jack Palevich560814f2009-11-19 16:34:55 +08003321 );
3322 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003323 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _array, (jint*)length, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08003324 }
3325}
3326
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07003327/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3328static jstring android_glGetShaderSource(JNIEnv *_env, jobject, jint shader) {
3329 GLint shaderLen = 0;
3330 glGetShaderiv((GLuint)shader, GL_SHADER_SOURCE_LENGTH, &shaderLen);
3331 if (!shaderLen) {
3332 return _env->NewStringUTF("");
3333 }
3334 char* buf = (char*) malloc(shaderLen);
3335 if (buf == NULL) {
3336 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
3337 return NULL;
3338 }
3339 glGetShaderSource(shader, shaderLen, NULL, buf);
3340 jstring result = _env->NewStringUTF(buf);
3341 free(buf);
3342 return result;
3343}
Jack Palevich560814f2009-11-19 16:34:55 +08003344/* const GLubyte * glGetString ( GLenum name ) */
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003345static jstring android_glGetString(JNIEnv* _env, jobject, jint name) {
3346 const char* chars = (const char*) glGetString((GLenum) name);
3347 return _env->NewStringUTF(chars);
Jack Palevich560814f2009-11-19 16:34:55 +08003348}
3349/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
3350static void
3351android_glGetTexParameterfv__II_3FI
3352 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
3353 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003354 const char * _exceptionType = NULL;
3355 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003356 GLfloat *params_base = (GLfloat *) 0;
3357 jint _remaining;
3358 GLfloat *params = (GLfloat *) 0;
3359
3360 if (!params_ref) {
3361 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003362 _exceptionType = "java/lang/IllegalArgumentException";
3363 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003364 goto exit;
3365 }
3366 if (offset < 0) {
3367 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003368 _exceptionType = "java/lang/IllegalArgumentException";
3369 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003370 goto exit;
3371 }
3372 _remaining = _env->GetArrayLength(params_ref) - offset;
3373 if (_remaining < 1) {
3374 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003375 _exceptionType = "java/lang/IllegalArgumentException";
3376 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08003377 goto exit;
3378 }
3379 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003380 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003381 params = params_base + offset;
3382
3383 glGetTexParameterfv(
3384 (GLenum)target,
3385 (GLenum)pname,
3386 (GLfloat *)params
3387 );
3388
3389exit:
3390 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003391 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003392 _exception ? JNI_ABORT: 0);
3393 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003394 if (_exception) {
3395 jniThrowException(_env, _exceptionType, _exceptionMessage);
3396 }
Jack Palevich560814f2009-11-19 16:34:55 +08003397}
3398
3399/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
3400static void
3401android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2
3402 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3403 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003404 const char * _exceptionType = NULL;
3405 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003406 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003407 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003408 jint _remaining;
3409 GLfloat *params = (GLfloat *) 0;
3410
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003411 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08003412 if (_remaining < 1) {
3413 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003414 _exceptionType = "java/lang/IllegalArgumentException";
3415 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08003416 goto exit;
3417 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003418 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003419 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003420 params = (GLfloat *) (_paramsBase + _bufferOffset);
3421 }
Jack Palevich560814f2009-11-19 16:34:55 +08003422 glGetTexParameterfv(
3423 (GLenum)target,
3424 (GLenum)pname,
3425 (GLfloat *)params
3426 );
3427
3428exit:
3429 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003430 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
Jack Palevich560814f2009-11-19 16:34:55 +08003431 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003432 if (_exception) {
3433 jniThrowException(_env, _exceptionType, _exceptionMessage);
3434 }
Jack Palevich560814f2009-11-19 16:34:55 +08003435}
3436
3437/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3438static void
3439android_glGetTexParameteriv__II_3II
3440 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
3441 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003442 const char * _exceptionType = NULL;
3443 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003444 GLint *params_base = (GLint *) 0;
3445 jint _remaining;
3446 GLint *params = (GLint *) 0;
3447
3448 if (!params_ref) {
3449 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003450 _exceptionType = "java/lang/IllegalArgumentException";
3451 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003452 goto exit;
3453 }
3454 if (offset < 0) {
3455 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003456 _exceptionType = "java/lang/IllegalArgumentException";
3457 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003458 goto exit;
3459 }
3460 _remaining = _env->GetArrayLength(params_ref) - offset;
3461 if (_remaining < 1) {
3462 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003463 _exceptionType = "java/lang/IllegalArgumentException";
3464 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08003465 goto exit;
3466 }
3467 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003468 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003469 params = params_base + offset;
3470
3471 glGetTexParameteriv(
3472 (GLenum)target,
3473 (GLenum)pname,
3474 (GLint *)params
3475 );
3476
3477exit:
3478 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003479 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003480 _exception ? JNI_ABORT: 0);
3481 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003482 if (_exception) {
3483 jniThrowException(_env, _exceptionType, _exceptionMessage);
3484 }
Jack Palevich560814f2009-11-19 16:34:55 +08003485}
3486
3487/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3488static void
3489android_glGetTexParameteriv__IILjava_nio_IntBuffer_2
3490 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3491 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003492 const char * _exceptionType = NULL;
3493 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003494 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003495 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003496 jint _remaining;
3497 GLint *params = (GLint *) 0;
3498
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003499 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08003500 if (_remaining < 1) {
3501 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003502 _exceptionType = "java/lang/IllegalArgumentException";
3503 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08003504 goto exit;
3505 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003506 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003507 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003508 params = (GLint *) (_paramsBase + _bufferOffset);
3509 }
Jack Palevich560814f2009-11-19 16:34:55 +08003510 glGetTexParameteriv(
3511 (GLenum)target,
3512 (GLenum)pname,
3513 (GLint *)params
3514 );
3515
3516exit:
3517 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003518 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich560814f2009-11-19 16:34:55 +08003519 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003520 if (_exception) {
3521 jniThrowException(_env, _exceptionType, _exceptionMessage);
3522 }
Jack Palevich560814f2009-11-19 16:34:55 +08003523}
3524
3525/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3526static void
3527android_glGetUniformfv__II_3FI
3528 (JNIEnv *_env, jobject _this, jint program, jint location, jfloatArray params_ref, jint offset) {
3529 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003530 const char * _exceptionType = NULL;
3531 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003532 GLfloat *params_base = (GLfloat *) 0;
3533 jint _remaining;
3534 GLfloat *params = (GLfloat *) 0;
3535
3536 if (!params_ref) {
3537 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003538 _exceptionType = "java/lang/IllegalArgumentException";
3539 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003540 goto exit;
3541 }
3542 if (offset < 0) {
3543 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003544 _exceptionType = "java/lang/IllegalArgumentException";
3545 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003546 goto exit;
3547 }
3548 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003549 if (_remaining < 1) {
3550 _exception = 1;
3551 _exceptionType = "java/lang/IllegalArgumentException";
3552 _exceptionMessage = "length - offset < 1 < needed";
3553 goto exit;
3554 }
Jack Palevich560814f2009-11-19 16:34:55 +08003555 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003556 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003557 params = params_base + offset;
3558
3559 glGetUniformfv(
3560 (GLuint)program,
3561 (GLint)location,
3562 (GLfloat *)params
3563 );
3564
3565exit:
3566 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003567 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003568 _exception ? JNI_ABORT: 0);
3569 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003570 if (_exception) {
3571 jniThrowException(_env, _exceptionType, _exceptionMessage);
3572 }
Jack Palevich560814f2009-11-19 16:34:55 +08003573}
3574
3575/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3576static void
3577android_glGetUniformfv__IILjava_nio_FloatBuffer_2
3578 (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003579 jint _exception = 0;
3580 const char * _exceptionType = NULL;
3581 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003582 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003583 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003584 jint _remaining;
3585 GLfloat *params = (GLfloat *) 0;
3586
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003587 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003588 if (_remaining < 1) {
3589 _exception = 1;
3590 _exceptionType = "java/lang/IllegalArgumentException";
3591 _exceptionMessage = "remaining() < 1 < needed";
3592 goto exit;
3593 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003594 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003595 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003596 params = (GLfloat *) (_paramsBase + _bufferOffset);
3597 }
Jack Palevich560814f2009-11-19 16:34:55 +08003598 glGetUniformfv(
3599 (GLuint)program,
3600 (GLint)location,
3601 (GLfloat *)params
3602 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003603
3604exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003605 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003606 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003607 }
3608 if (_exception) {
3609 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003610 }
3611}
3612
3613/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3614static void
3615android_glGetUniformiv__II_3II
3616 (JNIEnv *_env, jobject _this, jint program, jint location, jintArray params_ref, jint offset) {
3617 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003618 const char * _exceptionType = NULL;
3619 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003620 GLint *params_base = (GLint *) 0;
3621 jint _remaining;
3622 GLint *params = (GLint *) 0;
3623
3624 if (!params_ref) {
3625 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003626 _exceptionType = "java/lang/IllegalArgumentException";
3627 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003628 goto exit;
3629 }
3630 if (offset < 0) {
3631 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003632 _exceptionType = "java/lang/IllegalArgumentException";
3633 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003634 goto exit;
3635 }
3636 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003637 if (_remaining < 1) {
3638 _exception = 1;
3639 _exceptionType = "java/lang/IllegalArgumentException";
3640 _exceptionMessage = "length - offset < 1 < needed";
3641 goto exit;
3642 }
Jack Palevich560814f2009-11-19 16:34:55 +08003643 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003644 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003645 params = params_base + offset;
3646
3647 glGetUniformiv(
3648 (GLuint)program,
3649 (GLint)location,
3650 (GLint *)params
3651 );
3652
3653exit:
3654 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003655 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003656 _exception ? JNI_ABORT: 0);
3657 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003658 if (_exception) {
3659 jniThrowException(_env, _exceptionType, _exceptionMessage);
3660 }
Jack Palevich560814f2009-11-19 16:34:55 +08003661}
3662
3663/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3664static void
3665android_glGetUniformiv__IILjava_nio_IntBuffer_2
3666 (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003667 jint _exception = 0;
3668 const char * _exceptionType = NULL;
3669 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003670 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003671 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003672 jint _remaining;
3673 GLint *params = (GLint *) 0;
3674
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003675 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003676 if (_remaining < 1) {
3677 _exception = 1;
3678 _exceptionType = "java/lang/IllegalArgumentException";
3679 _exceptionMessage = "remaining() < 1 < needed";
3680 goto exit;
3681 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003682 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003683 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003684 params = (GLint *) (_paramsBase + _bufferOffset);
3685 }
Jack Palevich560814f2009-11-19 16:34:55 +08003686 glGetUniformiv(
3687 (GLuint)program,
3688 (GLint)location,
3689 (GLint *)params
3690 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003691
3692exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003693 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003694 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003695 }
3696 if (_exception) {
3697 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003698 }
3699}
3700
Mathias Agopian89be00b2013-02-22 20:08:06 -08003701/* GLint glGetUniformLocation ( GLuint program, const char *name ) */
Jack Palevich560814f2009-11-19 16:34:55 +08003702static jint
3703android_glGetUniformLocation__ILjava_lang_String_2
3704 (JNIEnv *_env, jobject _this, jint program, jstring name) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003705 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003706 const char * _exceptionType = NULL;
3707 const char * _exceptionMessage = NULL;
Mathias Agopian89be00b2013-02-22 20:08:06 -08003708 GLint _returnValue = 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003709 const char* _nativename = 0;
3710
3711 if (!name) {
Elliott Hughes428d3fc2013-09-24 17:15:41 -07003712 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003713 _exceptionType = "java/lang/IllegalArgumentException";
3714 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003715 goto exit;
3716 }
3717 _nativename = _env->GetStringUTFChars(name, 0);
3718
3719 _returnValue = glGetUniformLocation(
3720 (GLuint)program,
3721 (char *)_nativename
3722 );
3723
3724exit:
3725 if (_nativename) {
3726 _env->ReleaseStringUTFChars(name, _nativename);
3727 }
3728
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003729 if (_exception) {
3730 jniThrowException(_env, _exceptionType, _exceptionMessage);
3731 }
Andy McFaddencee51982013-04-25 16:08:31 -07003732 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08003733}
3734
3735/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3736static void
3737android_glGetVertexAttribfv__II_3FI
3738 (JNIEnv *_env, jobject _this, jint index, jint pname, jfloatArray params_ref, jint offset) {
3739 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003740 const char * _exceptionType = NULL;
3741 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003742 GLfloat *params_base = (GLfloat *) 0;
3743 jint _remaining;
3744 GLfloat *params = (GLfloat *) 0;
3745
3746 if (!params_ref) {
3747 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003748 _exceptionType = "java/lang/IllegalArgumentException";
3749 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003750 goto exit;
3751 }
3752 if (offset < 0) {
3753 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003754 _exceptionType = "java/lang/IllegalArgumentException";
3755 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003756 goto exit;
3757 }
3758 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003759 int _needed;
3760 switch (pname) {
3761#if defined(GL_CURRENT_VERTEX_ATTRIB)
3762 case GL_CURRENT_VERTEX_ATTRIB:
3763#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3764 _needed = 4;
3765 break;
3766 default:
3767 _needed = 1;
3768 break;
3769 }
3770 if (_remaining < _needed) {
3771 _exception = 1;
3772 _exceptionType = "java/lang/IllegalArgumentException";
3773 _exceptionMessage = "length - offset < needed";
3774 goto exit;
3775 }
Jack Palevich560814f2009-11-19 16:34:55 +08003776 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003777 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003778 params = params_base + offset;
3779
3780 glGetVertexAttribfv(
3781 (GLuint)index,
3782 (GLenum)pname,
3783 (GLfloat *)params
3784 );
3785
3786exit:
3787 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003788 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003789 _exception ? JNI_ABORT: 0);
3790 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003791 if (_exception) {
3792 jniThrowException(_env, _exceptionType, _exceptionMessage);
3793 }
Jack Palevich560814f2009-11-19 16:34:55 +08003794}
3795
3796/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3797static void
3798android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2
3799 (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003800 jint _exception = 0;
3801 const char * _exceptionType = NULL;
3802 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003803 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003804 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003805 jint _remaining;
3806 GLfloat *params = (GLfloat *) 0;
3807
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003808 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003809 int _needed;
3810 switch (pname) {
3811#if defined(GL_CURRENT_VERTEX_ATTRIB)
3812 case GL_CURRENT_VERTEX_ATTRIB:
3813#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3814 _needed = 4;
3815 break;
3816 default:
3817 _needed = 1;
3818 break;
3819 }
3820 if (_remaining < _needed) {
3821 _exception = 1;
3822 _exceptionType = "java/lang/IllegalArgumentException";
3823 _exceptionMessage = "remaining() < needed";
3824 goto exit;
3825 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003826 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003827 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003828 params = (GLfloat *) (_paramsBase + _bufferOffset);
3829 }
Jack Palevich560814f2009-11-19 16:34:55 +08003830 glGetVertexAttribfv(
3831 (GLuint)index,
3832 (GLenum)pname,
3833 (GLfloat *)params
3834 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003835
3836exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003837 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003838 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003839 }
3840 if (_exception) {
3841 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003842 }
3843}
3844
3845/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
3846static void
3847android_glGetVertexAttribiv__II_3II
3848 (JNIEnv *_env, jobject _this, jint index, jint pname, jintArray params_ref, jint offset) {
3849 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003850 const char * _exceptionType = NULL;
3851 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003852 GLint *params_base = (GLint *) 0;
3853 jint _remaining;
3854 GLint *params = (GLint *) 0;
3855
3856 if (!params_ref) {
3857 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003858 _exceptionType = "java/lang/IllegalArgumentException";
3859 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003860 goto exit;
3861 }
3862 if (offset < 0) {
3863 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003864 _exceptionType = "java/lang/IllegalArgumentException";
3865 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003866 goto exit;
3867 }
3868 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003869 int _needed;
3870 switch (pname) {
3871#if defined(GL_CURRENT_VERTEX_ATTRIB)
3872 case GL_CURRENT_VERTEX_ATTRIB:
3873#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3874 _needed = 4;
3875 break;
3876 default:
3877 _needed = 1;
3878 break;
3879 }
3880 if (_remaining < _needed) {
3881 _exception = 1;
3882 _exceptionType = "java/lang/IllegalArgumentException";
3883 _exceptionMessage = "length - offset < needed";
3884 goto exit;
3885 }
Jack Palevich560814f2009-11-19 16:34:55 +08003886 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003887 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003888 params = params_base + offset;
3889
3890 glGetVertexAttribiv(
3891 (GLuint)index,
3892 (GLenum)pname,
3893 (GLint *)params
3894 );
3895
3896exit:
3897 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003898 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003899 _exception ? JNI_ABORT: 0);
3900 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003901 if (_exception) {
3902 jniThrowException(_env, _exceptionType, _exceptionMessage);
3903 }
Jack Palevich560814f2009-11-19 16:34:55 +08003904}
3905
3906/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
3907static void
3908android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2
3909 (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003910 jint _exception = 0;
3911 const char * _exceptionType = NULL;
3912 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003913 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003914 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003915 jint _remaining;
3916 GLint *params = (GLint *) 0;
3917
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003918 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003919 int _needed;
3920 switch (pname) {
3921#if defined(GL_CURRENT_VERTEX_ATTRIB)
3922 case GL_CURRENT_VERTEX_ATTRIB:
3923#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3924 _needed = 4;
3925 break;
3926 default:
3927 _needed = 1;
3928 break;
3929 }
3930 if (_remaining < _needed) {
3931 _exception = 1;
3932 _exceptionType = "java/lang/IllegalArgumentException";
3933 _exceptionMessage = "remaining() < needed";
3934 goto exit;
3935 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003936 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003937 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003938 params = (GLint *) (_paramsBase + _bufferOffset);
3939 }
Jack Palevich560814f2009-11-19 16:34:55 +08003940 glGetVertexAttribiv(
3941 (GLuint)index,
3942 (GLenum)pname,
3943 (GLint *)params
3944 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003945
3946exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003947 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003948 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003949 }
3950 if (_exception) {
3951 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003952 }
3953}
3954
3955/* void glHint ( GLenum target, GLenum mode ) */
3956static void
3957android_glHint__II
3958 (JNIEnv *_env, jobject _this, jint target, jint mode) {
3959 glHint(
3960 (GLenum)target,
3961 (GLenum)mode
3962 );
3963}
3964
3965/* GLboolean glIsBuffer ( GLuint buffer ) */
3966static jboolean
3967android_glIsBuffer__I
3968 (JNIEnv *_env, jobject _this, jint buffer) {
3969 GLboolean _returnValue;
3970 _returnValue = glIsBuffer(
3971 (GLuint)buffer
3972 );
Andy McFaddencee51982013-04-25 16:08:31 -07003973 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08003974}
3975
3976/* GLboolean glIsEnabled ( GLenum cap ) */
3977static jboolean
3978android_glIsEnabled__I
3979 (JNIEnv *_env, jobject _this, jint cap) {
3980 GLboolean _returnValue;
3981 _returnValue = glIsEnabled(
3982 (GLenum)cap
3983 );
Andy McFaddencee51982013-04-25 16:08:31 -07003984 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08003985}
3986
3987/* GLboolean glIsFramebuffer ( GLuint framebuffer ) */
3988static jboolean
3989android_glIsFramebuffer__I
3990 (JNIEnv *_env, jobject _this, jint framebuffer) {
3991 GLboolean _returnValue;
3992 _returnValue = glIsFramebuffer(
3993 (GLuint)framebuffer
3994 );
Andy McFaddencee51982013-04-25 16:08:31 -07003995 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08003996}
3997
3998/* GLboolean glIsProgram ( GLuint program ) */
3999static jboolean
4000android_glIsProgram__I
4001 (JNIEnv *_env, jobject _this, jint program) {
4002 GLboolean _returnValue;
4003 _returnValue = glIsProgram(
4004 (GLuint)program
4005 );
Andy McFaddencee51982013-04-25 16:08:31 -07004006 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08004007}
4008
4009/* GLboolean glIsRenderbuffer ( GLuint renderbuffer ) */
4010static jboolean
4011android_glIsRenderbuffer__I
4012 (JNIEnv *_env, jobject _this, jint renderbuffer) {
4013 GLboolean _returnValue;
4014 _returnValue = glIsRenderbuffer(
4015 (GLuint)renderbuffer
4016 );
Andy McFaddencee51982013-04-25 16:08:31 -07004017 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08004018}
4019
4020/* GLboolean glIsShader ( GLuint shader ) */
4021static jboolean
4022android_glIsShader__I
4023 (JNIEnv *_env, jobject _this, jint shader) {
4024 GLboolean _returnValue;
4025 _returnValue = glIsShader(
4026 (GLuint)shader
4027 );
Andy McFaddencee51982013-04-25 16:08:31 -07004028 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08004029}
4030
4031/* GLboolean glIsTexture ( GLuint texture ) */
4032static jboolean
4033android_glIsTexture__I
4034 (JNIEnv *_env, jobject _this, jint texture) {
4035 GLboolean _returnValue;
4036 _returnValue = glIsTexture(
4037 (GLuint)texture
4038 );
Andy McFaddencee51982013-04-25 16:08:31 -07004039 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08004040}
4041
4042/* void glLineWidth ( GLfloat width ) */
4043static void
4044android_glLineWidth__F
4045 (JNIEnv *_env, jobject _this, jfloat width) {
4046 glLineWidth(
4047 (GLfloat)width
4048 );
4049}
4050
4051/* void glLinkProgram ( GLuint program ) */
4052static void
4053android_glLinkProgram__I
4054 (JNIEnv *_env, jobject _this, jint program) {
4055 glLinkProgram(
4056 (GLuint)program
4057 );
4058}
4059
4060/* void glPixelStorei ( GLenum pname, GLint param ) */
4061static void
4062android_glPixelStorei__II
4063 (JNIEnv *_env, jobject _this, jint pname, jint param) {
4064 glPixelStorei(
4065 (GLenum)pname,
4066 (GLint)param
4067 );
4068}
4069
4070/* void glPolygonOffset ( GLfloat factor, GLfloat units ) */
4071static void
4072android_glPolygonOffset__FF
4073 (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) {
4074 glPolygonOffset(
4075 (GLfloat)factor,
4076 (GLfloat)units
4077 );
4078}
4079
4080/* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */
4081static void
4082android_glReadPixels__IIIIIILjava_nio_Buffer_2
4083 (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) {
Jack Palevich560814f2009-11-19 16:34:55 +08004084 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004085 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004086 jint _remaining;
4087 GLvoid *pixels = (GLvoid *) 0;
4088
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004089 pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004090 if (pixels == NULL) {
4091 char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4092 pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
4093 }
Jack Palevich560814f2009-11-19 16:34:55 +08004094 glReadPixels(
4095 (GLint)x,
4096 (GLint)y,
4097 (GLsizei)width,
4098 (GLsizei)height,
4099 (GLenum)format,
4100 (GLenum)type,
4101 (GLvoid *)pixels
4102 );
4103 if (_array) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004104 releasePointer(_env, _array, pixels, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08004105 }
4106}
4107
4108/* void glReleaseShaderCompiler ( void ) */
4109static void
4110android_glReleaseShaderCompiler__
4111 (JNIEnv *_env, jobject _this) {
4112 glReleaseShaderCompiler();
4113}
4114
4115/* void glRenderbufferStorage ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) */
4116static void
4117android_glRenderbufferStorage__IIII
4118 (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint width, jint height) {
4119 glRenderbufferStorage(
4120 (GLenum)target,
4121 (GLenum)internalformat,
4122 (GLsizei)width,
4123 (GLsizei)height
4124 );
4125}
4126
4127/* void glSampleCoverage ( GLclampf value, GLboolean invert ) */
4128static void
4129android_glSampleCoverage__FZ
4130 (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) {
4131 glSampleCoverage(
4132 (GLclampf)value,
4133 (GLboolean)invert
4134 );
4135}
4136
4137/* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */
4138static void
4139android_glScissor__IIII
4140 (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
4141 glScissor(
4142 (GLint)x,
4143 (GLint)y,
4144 (GLsizei)width,
4145 (GLsizei)height
4146 );
4147}
4148
4149/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
4150static void
4151android_glShaderBinary__I_3IIILjava_nio_Buffer_2I
4152 (JNIEnv *_env, jobject _this, jint n, jintArray shaders_ref, jint offset, jint binaryformat, jobject binary_buf, jint length) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004153 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004154 const char * _exceptionType = NULL;
4155 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004156 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004157 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004158 GLuint *shaders_base = (GLuint *) 0;
4159 jint _shadersRemaining;
4160 GLuint *shaders = (GLuint *) 0;
4161 jint _binaryRemaining;
4162 GLvoid *binary = (GLvoid *) 0;
4163
4164 if (!shaders_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004165 _exception = 1;
4166 _exceptionType = "java/lang/IllegalArgumentException";
4167 _exceptionMessage = "shaders == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004168 goto exit;
4169 }
4170 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004171 _exception = 1;
4172 _exceptionType = "java/lang/IllegalArgumentException";
4173 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004174 goto exit;
4175 }
4176 _shadersRemaining = _env->GetArrayLength(shaders_ref) - offset;
4177 shaders_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004178 _env->GetIntArrayElements(shaders_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08004179 shaders = shaders_base + offset;
4180
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004181 binary = (GLvoid *)getPointer(_env, binary_buf, (jarray*)&_array, &_binaryRemaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004182 if (_binaryRemaining < length) {
4183 _exception = 1;
4184 _exceptionType = "java/lang/IllegalArgumentException";
4185 _exceptionMessage = "remaining() < length < needed";
4186 goto exit;
4187 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004188 if (binary == NULL) {
4189 char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4190 binary = (GLvoid *) (_binaryBase + _bufferOffset);
4191 }
Jack Palevich560814f2009-11-19 16:34:55 +08004192 glShaderBinary(
4193 (GLsizei)n,
4194 (GLuint *)shaders,
4195 (GLenum)binaryformat,
4196 (GLvoid *)binary,
4197 (GLsizei)length
4198 );
4199
4200exit:
4201 if (_array) {
4202 releasePointer(_env, _array, binary, JNI_FALSE);
4203 }
4204 if (shaders_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004205 _env->ReleaseIntArrayElements(shaders_ref, (jint*)shaders_base,
Jack Palevich560814f2009-11-19 16:34:55 +08004206 JNI_ABORT);
4207 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004208 if (_exception) {
4209 jniThrowException(_env, _exceptionType, _exceptionMessage);
4210 }
Jack Palevich560814f2009-11-19 16:34:55 +08004211}
4212
4213/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
4214static void
4215android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I
4216 (JNIEnv *_env, jobject _this, jint n, jobject shaders_buf, jint binaryformat, jobject binary_buf, jint length) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08004217 jint _exception = 0;
4218 const char * _exceptionType = NULL;
4219 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004220 jintArray _shadersArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004221 jint _shadersBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004222 jintArray _binaryArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004223 jint _binaryBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004224 jint _shadersRemaining;
4225 GLuint *shaders = (GLuint *) 0;
4226 jint _binaryRemaining;
4227 GLvoid *binary = (GLvoid *) 0;
4228
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004229 shaders = (GLuint *)getPointer(_env, shaders_buf, (jarray*)&_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
4230 binary = (GLvoid *)getPointer(_env, binary_buf, (jarray*)&_binaryArray, &_binaryRemaining, &_binaryBufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004231 if (_binaryRemaining < length) {
4232 _exception = 1;
4233 _exceptionType = "java/lang/IllegalArgumentException";
4234 _exceptionMessage = "remaining() < length < needed";
4235 goto exit;
4236 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004237 if (shaders == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004238 char * _shadersBase = (char *)_env->GetIntArrayElements(_shadersArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004239 shaders = (GLuint *) (_shadersBase + _shadersBufferOffset);
4240 }
4241 if (binary == NULL) {
4242 char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_binaryArray, (jboolean *) 0);
4243 binary = (GLvoid *) (_binaryBase + _binaryBufferOffset);
4244 }
Jack Palevich560814f2009-11-19 16:34:55 +08004245 glShaderBinary(
4246 (GLsizei)n,
4247 (GLuint *)shaders,
4248 (GLenum)binaryformat,
4249 (GLvoid *)binary,
4250 (GLsizei)length
4251 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08004252
4253exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004254 if (_binaryArray) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004255 releasePointer(_env, _binaryArray, binary, JNI_FALSE);
4256 }
4257 if (_shadersArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004258 _env->ReleaseIntArrayElements(_shadersArray, (jint*)shaders, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08004259 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08004260 if (_exception) {
4261 jniThrowException(_env, _exceptionType, _exceptionMessage);
4262 }
Jack Palevich560814f2009-11-19 16:34:55 +08004263}
4264
4265
4266/* void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint * length ) */
4267static
4268void
4269android_glShaderSource
4270 (JNIEnv *_env, jobject _this, jint shader, jstring string) {
4271
4272 if (!string) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07004273 jniThrowException(_env, "java/lang/IllegalArgumentException", "string == null");
Jack Palevich560814f2009-11-19 16:34:55 +08004274 return;
4275 }
4276
4277 const char* nativeString = _env->GetStringUTFChars(string, 0);
4278 const char* strings[] = {nativeString};
4279 glShaderSource(shader, 1, strings, 0);
4280 _env->ReleaseStringUTFChars(string, nativeString);
4281}
4282/* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */
4283static void
4284android_glStencilFunc__III
4285 (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) {
4286 glStencilFunc(
4287 (GLenum)func,
4288 (GLint)ref,
4289 (GLuint)mask
4290 );
4291}
4292
4293/* void glStencilFuncSeparate ( GLenum face, GLenum func, GLint ref, GLuint mask ) */
4294static void
4295android_glStencilFuncSeparate__IIII
4296 (JNIEnv *_env, jobject _this, jint face, jint func, jint ref, jint mask) {
4297 glStencilFuncSeparate(
4298 (GLenum)face,
4299 (GLenum)func,
4300 (GLint)ref,
4301 (GLuint)mask
4302 );
4303}
4304
4305/* void glStencilMask ( GLuint mask ) */
4306static void
4307android_glStencilMask__I
4308 (JNIEnv *_env, jobject _this, jint mask) {
4309 glStencilMask(
4310 (GLuint)mask
4311 );
4312}
4313
4314/* void glStencilMaskSeparate ( GLenum face, GLuint mask ) */
4315static void
4316android_glStencilMaskSeparate__II
4317 (JNIEnv *_env, jobject _this, jint face, jint mask) {
4318 glStencilMaskSeparate(
4319 (GLenum)face,
4320 (GLuint)mask
4321 );
4322}
4323
4324/* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */
4325static void
4326android_glStencilOp__III
4327 (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) {
4328 glStencilOp(
4329 (GLenum)fail,
4330 (GLenum)zfail,
4331 (GLenum)zpass
4332 );
4333}
4334
4335/* void glStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) */
4336static void
4337android_glStencilOpSeparate__IIII
4338 (JNIEnv *_env, jobject _this, jint face, jint fail, jint zfail, jint zpass) {
4339 glStencilOpSeparate(
4340 (GLenum)face,
4341 (GLenum)fail,
4342 (GLenum)zfail,
4343 (GLenum)zpass
4344 );
4345}
4346
4347/* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */
4348static void
4349android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2
4350 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) {
4351 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004352 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004353 jint _remaining;
4354 GLvoid *pixels = (GLvoid *) 0;
4355
4356 if (pixels_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004357 pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004358 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -07004359 if (pixels_buf && pixels == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004360 char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4361 pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08004362 }
4363 glTexImage2D(
4364 (GLenum)target,
4365 (GLint)level,
4366 (GLint)internalformat,
4367 (GLsizei)width,
4368 (GLsizei)height,
4369 (GLint)border,
4370 (GLenum)format,
4371 (GLenum)type,
4372 (GLvoid *)pixels
4373 );
4374 if (_array) {
4375 releasePointer(_env, _array, pixels, JNI_FALSE);
4376 }
4377}
4378
4379/* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */
4380static void
4381android_glTexParameterf__IIF
4382 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
4383 glTexParameterf(
4384 (GLenum)target,
4385 (GLenum)pname,
4386 (GLfloat)param
4387 );
4388}
4389
4390/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
4391static void
4392android_glTexParameterfv__II_3FI
4393 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004394 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004395 const char * _exceptionType = NULL;
4396 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004397 GLfloat *params_base = (GLfloat *) 0;
4398 jint _remaining;
4399 GLfloat *params = (GLfloat *) 0;
4400
4401 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004402 _exception = 1;
4403 _exceptionType = "java/lang/IllegalArgumentException";
4404 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004405 goto exit;
4406 }
4407 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004408 _exception = 1;
4409 _exceptionType = "java/lang/IllegalArgumentException";
4410 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004411 goto exit;
4412 }
4413 _remaining = _env->GetArrayLength(params_ref) - offset;
4414 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004415 _exception = 1;
4416 _exceptionType = "java/lang/IllegalArgumentException";
4417 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08004418 goto exit;
4419 }
4420 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004421 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08004422 params = params_base + offset;
4423
4424 glTexParameterfv(
4425 (GLenum)target,
4426 (GLenum)pname,
4427 (GLfloat *)params
4428 );
4429
4430exit:
4431 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004432 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08004433 JNI_ABORT);
4434 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004435 if (_exception) {
4436 jniThrowException(_env, _exceptionType, _exceptionMessage);
4437 }
Jack Palevich560814f2009-11-19 16:34:55 +08004438}
4439
4440/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
4441static void
4442android_glTexParameterfv__IILjava_nio_FloatBuffer_2
4443 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004444 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004445 const char * _exceptionType = NULL;
4446 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004447 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004448 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004449 jint _remaining;
4450 GLfloat *params = (GLfloat *) 0;
4451
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004452 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08004453 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004454 _exception = 1;
4455 _exceptionType = "java/lang/IllegalArgumentException";
4456 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08004457 goto exit;
4458 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004459 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004460 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004461 params = (GLfloat *) (_paramsBase + _bufferOffset);
4462 }
Jack Palevich560814f2009-11-19 16:34:55 +08004463 glTexParameterfv(
4464 (GLenum)target,
4465 (GLenum)pname,
4466 (GLfloat *)params
4467 );
4468
4469exit:
4470 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004471 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08004472 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004473 if (_exception) {
4474 jniThrowException(_env, _exceptionType, _exceptionMessage);
4475 }
Jack Palevich560814f2009-11-19 16:34:55 +08004476}
4477
4478/* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */
4479static void
4480android_glTexParameteri__III
4481 (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
4482 glTexParameteri(
4483 (GLenum)target,
4484 (GLenum)pname,
4485 (GLint)param
4486 );
4487}
4488
4489/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
4490static void
4491android_glTexParameteriv__II_3II
4492 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004493 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004494 const char * _exceptionType = NULL;
4495 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004496 GLint *params_base = (GLint *) 0;
4497 jint _remaining;
4498 GLint *params = (GLint *) 0;
4499
4500 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004501 _exception = 1;
4502 _exceptionType = "java/lang/IllegalArgumentException";
4503 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004504 goto exit;
4505 }
4506 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004507 _exception = 1;
4508 _exceptionType = "java/lang/IllegalArgumentException";
4509 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004510 goto exit;
4511 }
4512 _remaining = _env->GetArrayLength(params_ref) - offset;
4513 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004514 _exception = 1;
4515 _exceptionType = "java/lang/IllegalArgumentException";
4516 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08004517 goto exit;
4518 }
4519 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004520 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08004521 params = params_base + offset;
4522
4523 glTexParameteriv(
4524 (GLenum)target,
4525 (GLenum)pname,
4526 (GLint *)params
4527 );
4528
4529exit:
4530 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004531 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08004532 JNI_ABORT);
4533 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004534 if (_exception) {
4535 jniThrowException(_env, _exceptionType, _exceptionMessage);
4536 }
Jack Palevich560814f2009-11-19 16:34:55 +08004537}
4538
4539/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
4540static void
4541android_glTexParameteriv__IILjava_nio_IntBuffer_2
4542 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004543 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004544 const char * _exceptionType = NULL;
4545 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004546 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004547 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004548 jint _remaining;
4549 GLint *params = (GLint *) 0;
4550
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004551 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08004552 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004553 _exception = 1;
4554 _exceptionType = "java/lang/IllegalArgumentException";
4555 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08004556 goto exit;
4557 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004558 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004559 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004560 params = (GLint *) (_paramsBase + _bufferOffset);
4561 }
Jack Palevich560814f2009-11-19 16:34:55 +08004562 glTexParameteriv(
4563 (GLenum)target,
4564 (GLenum)pname,
4565 (GLint *)params
4566 );
4567
4568exit:
4569 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004570 _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08004571 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004572 if (_exception) {
4573 jniThrowException(_env, _exceptionType, _exceptionMessage);
4574 }
Jack Palevich560814f2009-11-19 16:34:55 +08004575}
4576
4577/* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */
4578static void
4579android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
4580 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) {
4581 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004582 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004583 jint _remaining;
4584 GLvoid *pixels = (GLvoid *) 0;
4585
4586 if (pixels_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004587 pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004588 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -07004589 if (pixels_buf && pixels == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004590 char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4591 pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08004592 }
4593 glTexSubImage2D(
4594 (GLenum)target,
4595 (GLint)level,
4596 (GLint)xoffset,
4597 (GLint)yoffset,
4598 (GLsizei)width,
4599 (GLsizei)height,
4600 (GLenum)format,
4601 (GLenum)type,
4602 (GLvoid *)pixels
4603 );
4604 if (_array) {
4605 releasePointer(_env, _array, pixels, JNI_FALSE);
4606 }
4607}
4608
4609/* void glUniform1f ( GLint location, GLfloat x ) */
4610static void
4611android_glUniform1f__IF
4612 (JNIEnv *_env, jobject _this, jint location, jfloat x) {
4613 glUniform1f(
4614 (GLint)location,
4615 (GLfloat)x
4616 );
4617}
4618
4619/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
4620static void
4621android_glUniform1fv__II_3FI
4622 (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004623 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004624 const char * _exceptionType = NULL;
4625 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004626 GLfloat *v_base = (GLfloat *) 0;
4627 jint _remaining;
4628 GLfloat *v = (GLfloat *) 0;
4629
4630 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004631 _exception = 1;
4632 _exceptionType = "java/lang/IllegalArgumentException";
4633 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004634 goto exit;
4635 }
4636 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004637 _exception = 1;
4638 _exceptionType = "java/lang/IllegalArgumentException";
4639 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004640 goto exit;
4641 }
4642 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004643 if (_remaining < count) {
4644 _exception = 1;
4645 _exceptionType = "java/lang/IllegalArgumentException";
4646 _exceptionMessage = "length - offset < count < needed";
4647 goto exit;
4648 }
Jack Palevich560814f2009-11-19 16:34:55 +08004649 v_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004650 _env->GetFloatArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08004651 v = v_base + offset;
4652
4653 glUniform1fv(
4654 (GLint)location,
4655 (GLsizei)count,
4656 (GLfloat *)v
4657 );
4658
4659exit:
4660 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004661 _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08004662 JNI_ABORT);
4663 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004664 if (_exception) {
4665 jniThrowException(_env, _exceptionType, _exceptionMessage);
4666 }
Jack Palevich560814f2009-11-19 16:34:55 +08004667}
4668
4669/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
4670static void
4671android_glUniform1fv__IILjava_nio_FloatBuffer_2
4672 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08004673 jint _exception = 0;
4674 const char * _exceptionType = NULL;
4675 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004676 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004677 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004678 jint _remaining;
4679 GLfloat *v = (GLfloat *) 0;
4680
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004681 v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004682 if (_remaining < count) {
4683 _exception = 1;
4684 _exceptionType = "java/lang/IllegalArgumentException";
4685 _exceptionMessage = "remaining() < count < needed";
4686 goto exit;
4687 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004688 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004689 char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004690 v = (GLfloat *) (_vBase + _bufferOffset);
4691 }
Jack Palevich560814f2009-11-19 16:34:55 +08004692 glUniform1fv(
4693 (GLint)location,
4694 (GLsizei)count,
4695 (GLfloat *)v
4696 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08004697
4698exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004699 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004700 _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08004701 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08004702 if (_exception) {
4703 jniThrowException(_env, _exceptionType, _exceptionMessage);
4704 }
Jack Palevich560814f2009-11-19 16:34:55 +08004705}
4706
4707/* void glUniform1i ( GLint location, GLint x ) */
4708static void
4709android_glUniform1i__II
4710 (JNIEnv *_env, jobject _this, jint location, jint x) {
4711 glUniform1i(
4712 (GLint)location,
4713 (GLint)x
4714 );
4715}
4716
4717/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
4718static void
4719android_glUniform1iv__II_3II
4720 (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004721 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004722 const char * _exceptionType = NULL;
4723 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004724 GLint *v_base = (GLint *) 0;
4725 jint _remaining;
4726 GLint *v = (GLint *) 0;
4727
4728 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004729 _exception = 1;
4730 _exceptionType = "java/lang/IllegalArgumentException";
4731 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004732 goto exit;
4733 }
4734 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004735 _exception = 1;
4736 _exceptionType = "java/lang/IllegalArgumentException";
4737 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004738 goto exit;
4739 }
4740 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004741 if (_remaining < count) {
4742 _exception = 1;
4743 _exceptionType = "java/lang/IllegalArgumentException";
4744 _exceptionMessage = "length - offset < count < needed";
4745 goto exit;
4746 }
Jack Palevich560814f2009-11-19 16:34:55 +08004747 v_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004748 _env->GetIntArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08004749 v = v_base + offset;
4750
4751 glUniform1iv(
4752 (GLint)location,
4753 (GLsizei)count,
4754 (GLint *)v
4755 );
4756
4757exit:
4758 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004759 _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08004760 JNI_ABORT);
4761 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004762 if (_exception) {
4763 jniThrowException(_env, _exceptionType, _exceptionMessage);
4764 }
Jack Palevich560814f2009-11-19 16:34:55 +08004765}
4766
4767/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
4768static void
4769android_glUniform1iv__IILjava_nio_IntBuffer_2
4770 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08004771 jint _exception = 0;
4772 const char * _exceptionType = NULL;
4773 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004774 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004775 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004776 jint _remaining;
4777 GLint *v = (GLint *) 0;
4778
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004779 v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004780 if (_remaining < count) {
4781 _exception = 1;
4782 _exceptionType = "java/lang/IllegalArgumentException";
4783 _exceptionMessage = "remaining() < count < needed";
4784 goto exit;
4785 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004786 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004787 char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004788 v = (GLint *) (_vBase + _bufferOffset);
4789 }
Jack Palevich560814f2009-11-19 16:34:55 +08004790 glUniform1iv(
4791 (GLint)location,
4792 (GLsizei)count,
4793 (GLint *)v
4794 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08004795
4796exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004797 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004798 _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08004799 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08004800 if (_exception) {
4801 jniThrowException(_env, _exceptionType, _exceptionMessage);
4802 }
Jack Palevich560814f2009-11-19 16:34:55 +08004803}
4804
4805/* void glUniform2f ( GLint location, GLfloat x, GLfloat y ) */
4806static void
4807android_glUniform2f__IFF
4808 (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y) {
4809 glUniform2f(
4810 (GLint)location,
4811 (GLfloat)x,
4812 (GLfloat)y
4813 );
4814}
4815
4816/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
4817static void
4818android_glUniform2fv__II_3FI
4819 (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004820 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004821 const char * _exceptionType = NULL;
4822 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004823 GLfloat *v_base = (GLfloat *) 0;
4824 jint _remaining;
4825 GLfloat *v = (GLfloat *) 0;
4826
4827 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004828 _exception = 1;
4829 _exceptionType = "java/lang/IllegalArgumentException";
4830 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004831 goto exit;
4832 }
4833 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004834 _exception = 1;
4835 _exceptionType = "java/lang/IllegalArgumentException";
4836 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004837 goto exit;
4838 }
4839 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004840 if (_remaining < count*2) {
4841 _exception = 1;
4842 _exceptionType = "java/lang/IllegalArgumentException";
4843 _exceptionMessage = "length - offset < count*2 < needed";
4844 goto exit;
4845 }
Jack Palevich560814f2009-11-19 16:34:55 +08004846 v_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004847 _env->GetFloatArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08004848 v = v_base + offset;
4849
4850 glUniform2fv(
4851 (GLint)location,
4852 (GLsizei)count,
4853 (GLfloat *)v
4854 );
4855
4856exit:
4857 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004858 _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08004859 JNI_ABORT);
4860 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004861 if (_exception) {
4862 jniThrowException(_env, _exceptionType, _exceptionMessage);
4863 }
Jack Palevich560814f2009-11-19 16:34:55 +08004864}
4865
4866/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
4867static void
4868android_glUniform2fv__IILjava_nio_FloatBuffer_2
4869 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08004870 jint _exception = 0;
4871 const char * _exceptionType = NULL;
4872 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004873 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004874 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004875 jint _remaining;
4876 GLfloat *v = (GLfloat *) 0;
4877
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004878 v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004879 if (_remaining < count*2) {
4880 _exception = 1;
4881 _exceptionType = "java/lang/IllegalArgumentException";
4882 _exceptionMessage = "remaining() < count*2 < needed";
4883 goto exit;
4884 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004885 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004886 char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004887 v = (GLfloat *) (_vBase + _bufferOffset);
4888 }
Jack Palevich560814f2009-11-19 16:34:55 +08004889 glUniform2fv(
4890 (GLint)location,
4891 (GLsizei)count,
4892 (GLfloat *)v
4893 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08004894
4895exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004896 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004897 _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08004898 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08004899 if (_exception) {
4900 jniThrowException(_env, _exceptionType, _exceptionMessage);
4901 }
Jack Palevich560814f2009-11-19 16:34:55 +08004902}
4903
4904/* void glUniform2i ( GLint location, GLint x, GLint y ) */
4905static void
4906android_glUniform2i__III
4907 (JNIEnv *_env, jobject _this, jint location, jint x, jint y) {
4908 glUniform2i(
4909 (GLint)location,
4910 (GLint)x,
4911 (GLint)y
4912 );
4913}
4914
4915/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
4916static void
4917android_glUniform2iv__II_3II
4918 (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004919 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004920 const char * _exceptionType = NULL;
4921 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004922 GLint *v_base = (GLint *) 0;
4923 jint _remaining;
4924 GLint *v = (GLint *) 0;
4925
4926 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004927 _exception = 1;
4928 _exceptionType = "java/lang/IllegalArgumentException";
4929 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004930 goto exit;
4931 }
4932 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004933 _exception = 1;
4934 _exceptionType = "java/lang/IllegalArgumentException";
4935 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004936 goto exit;
4937 }
4938 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004939 if (_remaining < count*2) {
4940 _exception = 1;
4941 _exceptionType = "java/lang/IllegalArgumentException";
4942 _exceptionMessage = "length - offset < count*2 < needed";
4943 goto exit;
4944 }
Jack Palevich560814f2009-11-19 16:34:55 +08004945 v_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004946 _env->GetIntArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08004947 v = v_base + offset;
4948
4949 glUniform2iv(
4950 (GLint)location,
4951 (GLsizei)count,
4952 (GLint *)v
4953 );
4954
4955exit:
4956 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004957 _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08004958 JNI_ABORT);
4959 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004960 if (_exception) {
4961 jniThrowException(_env, _exceptionType, _exceptionMessage);
4962 }
Jack Palevich560814f2009-11-19 16:34:55 +08004963}
4964
4965/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
4966static void
4967android_glUniform2iv__IILjava_nio_IntBuffer_2
4968 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08004969 jint _exception = 0;
4970 const char * _exceptionType = NULL;
4971 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004972 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004973 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004974 jint _remaining;
4975 GLint *v = (GLint *) 0;
4976
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004977 v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004978 if (_remaining < count*2) {
4979 _exception = 1;
4980 _exceptionType = "java/lang/IllegalArgumentException";
4981 _exceptionMessage = "remaining() < count*2 < needed";
4982 goto exit;
4983 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004984 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004985 char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004986 v = (GLint *) (_vBase + _bufferOffset);
4987 }
Jack Palevich560814f2009-11-19 16:34:55 +08004988 glUniform2iv(
4989 (GLint)location,
4990 (GLsizei)count,
4991 (GLint *)v
4992 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08004993
4994exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004995 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004996 _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08004997 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08004998 if (_exception) {
4999 jniThrowException(_env, _exceptionType, _exceptionMessage);
5000 }
Jack Palevich560814f2009-11-19 16:34:55 +08005001}
5002
5003/* void glUniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z ) */
5004static void
5005android_glUniform3f__IFFF
5006 (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z) {
5007 glUniform3f(
5008 (GLint)location,
5009 (GLfloat)x,
5010 (GLfloat)y,
5011 (GLfloat)z
5012 );
5013}
5014
5015/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
5016static void
5017android_glUniform3fv__II_3FI
5018 (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005019 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005020 const char * _exceptionType = NULL;
5021 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005022 GLfloat *v_base = (GLfloat *) 0;
5023 jint _remaining;
5024 GLfloat *v = (GLfloat *) 0;
5025
5026 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005027 _exception = 1;
5028 _exceptionType = "java/lang/IllegalArgumentException";
5029 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005030 goto exit;
5031 }
5032 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005033 _exception = 1;
5034 _exceptionType = "java/lang/IllegalArgumentException";
5035 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005036 goto exit;
5037 }
5038 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005039 if (_remaining < count*3) {
5040 _exception = 1;
5041 _exceptionType = "java/lang/IllegalArgumentException";
5042 _exceptionMessage = "length - offset < count*3 < needed";
5043 goto exit;
5044 }
Jack Palevich560814f2009-11-19 16:34:55 +08005045 v_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005046 _env->GetFloatArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005047 v = v_base + offset;
5048
5049 glUniform3fv(
5050 (GLint)location,
5051 (GLsizei)count,
5052 (GLfloat *)v
5053 );
5054
5055exit:
5056 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005057 _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005058 JNI_ABORT);
5059 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005060 if (_exception) {
5061 jniThrowException(_env, _exceptionType, _exceptionMessage);
5062 }
Jack Palevich560814f2009-11-19 16:34:55 +08005063}
5064
5065/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
5066static void
5067android_glUniform3fv__IILjava_nio_FloatBuffer_2
5068 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005069 jint _exception = 0;
5070 const char * _exceptionType = NULL;
5071 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005072 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005073 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005074 jint _remaining;
5075 GLfloat *v = (GLfloat *) 0;
5076
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005077 v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005078 if (_remaining < count*3) {
5079 _exception = 1;
5080 _exceptionType = "java/lang/IllegalArgumentException";
5081 _exceptionMessage = "remaining() < count*3 < needed";
5082 goto exit;
5083 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005084 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005085 char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005086 v = (GLfloat *) (_vBase + _bufferOffset);
5087 }
Jack Palevich560814f2009-11-19 16:34:55 +08005088 glUniform3fv(
5089 (GLint)location,
5090 (GLsizei)count,
5091 (GLfloat *)v
5092 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005093
5094exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005095 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005096 _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005097 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005098 if (_exception) {
5099 jniThrowException(_env, _exceptionType, _exceptionMessage);
5100 }
Jack Palevich560814f2009-11-19 16:34:55 +08005101}
5102
5103/* void glUniform3i ( GLint location, GLint x, GLint y, GLint z ) */
5104static void
5105android_glUniform3i__IIII
5106 (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z) {
5107 glUniform3i(
5108 (GLint)location,
5109 (GLint)x,
5110 (GLint)y,
5111 (GLint)z
5112 );
5113}
5114
5115/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
5116static void
5117android_glUniform3iv__II_3II
5118 (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005119 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005120 const char * _exceptionType = NULL;
5121 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005122 GLint *v_base = (GLint *) 0;
5123 jint _remaining;
5124 GLint *v = (GLint *) 0;
5125
5126 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005127 _exception = 1;
5128 _exceptionType = "java/lang/IllegalArgumentException";
5129 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005130 goto exit;
5131 }
5132 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005133 _exception = 1;
5134 _exceptionType = "java/lang/IllegalArgumentException";
5135 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005136 goto exit;
5137 }
5138 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005139 if (_remaining < count*3) {
5140 _exception = 1;
5141 _exceptionType = "java/lang/IllegalArgumentException";
5142 _exceptionMessage = "length - offset < count*3 < needed";
5143 goto exit;
5144 }
Jack Palevich560814f2009-11-19 16:34:55 +08005145 v_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005146 _env->GetIntArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005147 v = v_base + offset;
5148
5149 glUniform3iv(
5150 (GLint)location,
5151 (GLsizei)count,
5152 (GLint *)v
5153 );
5154
5155exit:
5156 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005157 _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005158 JNI_ABORT);
5159 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005160 if (_exception) {
5161 jniThrowException(_env, _exceptionType, _exceptionMessage);
5162 }
Jack Palevich560814f2009-11-19 16:34:55 +08005163}
5164
5165/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
5166static void
5167android_glUniform3iv__IILjava_nio_IntBuffer_2
5168 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005169 jint _exception = 0;
5170 const char * _exceptionType = NULL;
5171 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005172 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005173 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005174 jint _remaining;
5175 GLint *v = (GLint *) 0;
5176
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005177 v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005178 if (_remaining < count*3) {
5179 _exception = 1;
5180 _exceptionType = "java/lang/IllegalArgumentException";
5181 _exceptionMessage = "remaining() < count*3 < needed";
5182 goto exit;
5183 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005184 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005185 char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005186 v = (GLint *) (_vBase + _bufferOffset);
5187 }
Jack Palevich560814f2009-11-19 16:34:55 +08005188 glUniform3iv(
5189 (GLint)location,
5190 (GLsizei)count,
5191 (GLint *)v
5192 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005193
5194exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005195 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005196 _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005197 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005198 if (_exception) {
5199 jniThrowException(_env, _exceptionType, _exceptionMessage);
5200 }
Jack Palevich560814f2009-11-19 16:34:55 +08005201}
5202
5203/* void glUniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
5204static void
5205android_glUniform4f__IFFFF
5206 (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z, jfloat w) {
5207 glUniform4f(
5208 (GLint)location,
5209 (GLfloat)x,
5210 (GLfloat)y,
5211 (GLfloat)z,
5212 (GLfloat)w
5213 );
5214}
5215
5216/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
5217static void
5218android_glUniform4fv__II_3FI
5219 (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005220 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005221 const char * _exceptionType = NULL;
5222 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005223 GLfloat *v_base = (GLfloat *) 0;
5224 jint _remaining;
5225 GLfloat *v = (GLfloat *) 0;
5226
5227 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005228 _exception = 1;
5229 _exceptionType = "java/lang/IllegalArgumentException";
5230 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005231 goto exit;
5232 }
5233 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005234 _exception = 1;
5235 _exceptionType = "java/lang/IllegalArgumentException";
5236 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005237 goto exit;
5238 }
5239 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005240 if (_remaining < count*4) {
5241 _exception = 1;
5242 _exceptionType = "java/lang/IllegalArgumentException";
5243 _exceptionMessage = "length - offset < count*4 < needed";
5244 goto exit;
5245 }
Jack Palevich560814f2009-11-19 16:34:55 +08005246 v_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005247 _env->GetFloatArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005248 v = v_base + offset;
5249
5250 glUniform4fv(
5251 (GLint)location,
5252 (GLsizei)count,
5253 (GLfloat *)v
5254 );
5255
5256exit:
5257 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005258 _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005259 JNI_ABORT);
5260 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005261 if (_exception) {
5262 jniThrowException(_env, _exceptionType, _exceptionMessage);
5263 }
Jack Palevich560814f2009-11-19 16:34:55 +08005264}
5265
5266/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
5267static void
5268android_glUniform4fv__IILjava_nio_FloatBuffer_2
5269 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005270 jint _exception = 0;
5271 const char * _exceptionType = NULL;
5272 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005273 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005274 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005275 jint _remaining;
5276 GLfloat *v = (GLfloat *) 0;
5277
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005278 v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005279 if (_remaining < count*4) {
5280 _exception = 1;
5281 _exceptionType = "java/lang/IllegalArgumentException";
5282 _exceptionMessage = "remaining() < count*4 < needed";
5283 goto exit;
5284 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005285 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005286 char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005287 v = (GLfloat *) (_vBase + _bufferOffset);
5288 }
Jack Palevich560814f2009-11-19 16:34:55 +08005289 glUniform4fv(
5290 (GLint)location,
5291 (GLsizei)count,
5292 (GLfloat *)v
5293 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005294
5295exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005296 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005297 _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005298 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005299 if (_exception) {
5300 jniThrowException(_env, _exceptionType, _exceptionMessage);
5301 }
Jack Palevich560814f2009-11-19 16:34:55 +08005302}
5303
5304/* void glUniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w ) */
5305static void
5306android_glUniform4i__IIIII
5307 (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z, jint w) {
5308 glUniform4i(
5309 (GLint)location,
5310 (GLint)x,
5311 (GLint)y,
5312 (GLint)z,
5313 (GLint)w
5314 );
5315}
5316
5317/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
5318static void
5319android_glUniform4iv__II_3II
5320 (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005321 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005322 const char * _exceptionType = NULL;
5323 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005324 GLint *v_base = (GLint *) 0;
5325 jint _remaining;
5326 GLint *v = (GLint *) 0;
5327
5328 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005329 _exception = 1;
5330 _exceptionType = "java/lang/IllegalArgumentException";
5331 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005332 goto exit;
5333 }
5334 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005335 _exception = 1;
5336 _exceptionType = "java/lang/IllegalArgumentException";
5337 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005338 goto exit;
5339 }
5340 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005341 if (_remaining < count*4) {
5342 _exception = 1;
5343 _exceptionType = "java/lang/IllegalArgumentException";
5344 _exceptionMessage = "length - offset < count*4 < needed";
5345 goto exit;
5346 }
Jack Palevich560814f2009-11-19 16:34:55 +08005347 v_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005348 _env->GetIntArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005349 v = v_base + offset;
5350
5351 glUniform4iv(
5352 (GLint)location,
5353 (GLsizei)count,
5354 (GLint *)v
5355 );
5356
5357exit:
5358 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005359 _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005360 JNI_ABORT);
5361 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005362 if (_exception) {
5363 jniThrowException(_env, _exceptionType, _exceptionMessage);
5364 }
Jack Palevich560814f2009-11-19 16:34:55 +08005365}
5366
5367/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
5368static void
5369android_glUniform4iv__IILjava_nio_IntBuffer_2
5370 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005371 jint _exception = 0;
5372 const char * _exceptionType = NULL;
5373 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005374 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005375 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005376 jint _remaining;
5377 GLint *v = (GLint *) 0;
5378
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005379 v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005380 if (_remaining < count*4) {
5381 _exception = 1;
5382 _exceptionType = "java/lang/IllegalArgumentException";
5383 _exceptionMessage = "remaining() < count*4 < needed";
5384 goto exit;
5385 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005386 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005387 char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005388 v = (GLint *) (_vBase + _bufferOffset);
5389 }
Jack Palevich560814f2009-11-19 16:34:55 +08005390 glUniform4iv(
5391 (GLint)location,
5392 (GLsizei)count,
5393 (GLint *)v
5394 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005395
5396exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005397 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005398 _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005399 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005400 if (_exception) {
5401 jniThrowException(_env, _exceptionType, _exceptionMessage);
5402 }
Jack Palevich560814f2009-11-19 16:34:55 +08005403}
5404
5405/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5406static void
5407android_glUniformMatrix2fv__IIZ_3FI
5408 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005409 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005410 const char * _exceptionType = NULL;
5411 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005412 GLfloat *value_base = (GLfloat *) 0;
5413 jint _remaining;
5414 GLfloat *value = (GLfloat *) 0;
5415
5416 if (!value_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005417 _exception = 1;
5418 _exceptionType = "java/lang/IllegalArgumentException";
5419 _exceptionMessage = "value == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005420 goto exit;
5421 }
5422 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005423 _exception = 1;
5424 _exceptionType = "java/lang/IllegalArgumentException";
5425 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005426 goto exit;
5427 }
5428 _remaining = _env->GetArrayLength(value_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005429 if (_remaining < count*4) {
5430 _exception = 1;
5431 _exceptionType = "java/lang/IllegalArgumentException";
5432 _exceptionMessage = "length - offset < count*4 < needed";
5433 goto exit;
5434 }
Jack Palevich560814f2009-11-19 16:34:55 +08005435 value_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005436 _env->GetFloatArrayElements(value_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005437 value = value_base + offset;
5438
5439 glUniformMatrix2fv(
5440 (GLint)location,
5441 (GLsizei)count,
5442 (GLboolean)transpose,
5443 (GLfloat *)value
5444 );
5445
5446exit:
5447 if (value_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005448 _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005449 JNI_ABORT);
5450 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005451 if (_exception) {
5452 jniThrowException(_env, _exceptionType, _exceptionMessage);
5453 }
Jack Palevich560814f2009-11-19 16:34:55 +08005454}
5455
5456/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5457static void
5458android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2
5459 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005460 jint _exception = 0;
5461 const char * _exceptionType = NULL;
5462 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005463 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005464 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005465 jint _remaining;
5466 GLfloat *value = (GLfloat *) 0;
5467
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005468 value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005469 if (_remaining < count*4) {
5470 _exception = 1;
5471 _exceptionType = "java/lang/IllegalArgumentException";
5472 _exceptionMessage = "remaining() < count*4 < needed";
5473 goto exit;
5474 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005475 if (value == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005476 char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005477 value = (GLfloat *) (_valueBase + _bufferOffset);
5478 }
Jack Palevich560814f2009-11-19 16:34:55 +08005479 glUniformMatrix2fv(
5480 (GLint)location,
5481 (GLsizei)count,
5482 (GLboolean)transpose,
5483 (GLfloat *)value
5484 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005485
5486exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005487 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005488 _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005489 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005490 if (_exception) {
5491 jniThrowException(_env, _exceptionType, _exceptionMessage);
5492 }
Jack Palevich560814f2009-11-19 16:34:55 +08005493}
5494
5495/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5496static void
5497android_glUniformMatrix3fv__IIZ_3FI
5498 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005499 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005500 const char * _exceptionType = NULL;
5501 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005502 GLfloat *value_base = (GLfloat *) 0;
5503 jint _remaining;
5504 GLfloat *value = (GLfloat *) 0;
5505
5506 if (!value_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005507 _exception = 1;
5508 _exceptionType = "java/lang/IllegalArgumentException";
5509 _exceptionMessage = "value == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005510 goto exit;
5511 }
5512 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005513 _exception = 1;
5514 _exceptionType = "java/lang/IllegalArgumentException";
5515 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005516 goto exit;
5517 }
5518 _remaining = _env->GetArrayLength(value_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005519 if (_remaining < count*9) {
5520 _exception = 1;
5521 _exceptionType = "java/lang/IllegalArgumentException";
5522 _exceptionMessage = "length - offset < count*9 < needed";
5523 goto exit;
5524 }
Jack Palevich560814f2009-11-19 16:34:55 +08005525 value_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005526 _env->GetFloatArrayElements(value_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005527 value = value_base + offset;
5528
5529 glUniformMatrix3fv(
5530 (GLint)location,
5531 (GLsizei)count,
5532 (GLboolean)transpose,
5533 (GLfloat *)value
5534 );
5535
5536exit:
5537 if (value_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005538 _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005539 JNI_ABORT);
5540 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005541 if (_exception) {
5542 jniThrowException(_env, _exceptionType, _exceptionMessage);
5543 }
Jack Palevich560814f2009-11-19 16:34:55 +08005544}
5545
5546/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5547static void
5548android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2
5549 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005550 jint _exception = 0;
5551 const char * _exceptionType = NULL;
5552 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005553 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005554 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005555 jint _remaining;
5556 GLfloat *value = (GLfloat *) 0;
5557
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005558 value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005559 if (_remaining < count*9) {
5560 _exception = 1;
5561 _exceptionType = "java/lang/IllegalArgumentException";
5562 _exceptionMessage = "remaining() < count*9 < needed";
5563 goto exit;
5564 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005565 if (value == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005566 char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005567 value = (GLfloat *) (_valueBase + _bufferOffset);
5568 }
Jack Palevich560814f2009-11-19 16:34:55 +08005569 glUniformMatrix3fv(
5570 (GLint)location,
5571 (GLsizei)count,
5572 (GLboolean)transpose,
5573 (GLfloat *)value
5574 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005575
5576exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005577 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005578 _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005579 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005580 if (_exception) {
5581 jniThrowException(_env, _exceptionType, _exceptionMessage);
5582 }
Jack Palevich560814f2009-11-19 16:34:55 +08005583}
5584
5585/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5586static void
5587android_glUniformMatrix4fv__IIZ_3FI
5588 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005589 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005590 const char * _exceptionType = NULL;
5591 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005592 GLfloat *value_base = (GLfloat *) 0;
5593 jint _remaining;
5594 GLfloat *value = (GLfloat *) 0;
5595
5596 if (!value_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005597 _exception = 1;
5598 _exceptionType = "java/lang/IllegalArgumentException";
5599 _exceptionMessage = "value == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005600 goto exit;
5601 }
5602 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005603 _exception = 1;
5604 _exceptionType = "java/lang/IllegalArgumentException";
5605 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005606 goto exit;
5607 }
5608 _remaining = _env->GetArrayLength(value_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005609 if (_remaining < count*16) {
5610 _exception = 1;
5611 _exceptionType = "java/lang/IllegalArgumentException";
5612 _exceptionMessage = "length - offset < count*16 < needed";
5613 goto exit;
5614 }
Jack Palevich560814f2009-11-19 16:34:55 +08005615 value_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005616 _env->GetFloatArrayElements(value_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005617 value = value_base + offset;
5618
5619 glUniformMatrix4fv(
5620 (GLint)location,
5621 (GLsizei)count,
5622 (GLboolean)transpose,
5623 (GLfloat *)value
5624 );
5625
5626exit:
5627 if (value_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005628 _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005629 JNI_ABORT);
5630 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005631 if (_exception) {
5632 jniThrowException(_env, _exceptionType, _exceptionMessage);
5633 }
Jack Palevich560814f2009-11-19 16:34:55 +08005634}
5635
5636/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5637static void
5638android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2
5639 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005640 jint _exception = 0;
5641 const char * _exceptionType = NULL;
5642 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005643 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005644 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005645 jint _remaining;
5646 GLfloat *value = (GLfloat *) 0;
5647
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005648 value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005649 if (_remaining < count*16) {
5650 _exception = 1;
5651 _exceptionType = "java/lang/IllegalArgumentException";
5652 _exceptionMessage = "remaining() < count*16 < needed";
5653 goto exit;
5654 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005655 if (value == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005656 char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005657 value = (GLfloat *) (_valueBase + _bufferOffset);
5658 }
Jack Palevich560814f2009-11-19 16:34:55 +08005659 glUniformMatrix4fv(
5660 (GLint)location,
5661 (GLsizei)count,
5662 (GLboolean)transpose,
5663 (GLfloat *)value
5664 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005665
5666exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005667 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005668 _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005669 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005670 if (_exception) {
5671 jniThrowException(_env, _exceptionType, _exceptionMessage);
5672 }
Jack Palevich560814f2009-11-19 16:34:55 +08005673}
5674
5675/* void glUseProgram ( GLuint program ) */
5676static void
5677android_glUseProgram__I
5678 (JNIEnv *_env, jobject _this, jint program) {
5679 glUseProgram(
5680 (GLuint)program
5681 );
5682}
5683
5684/* void glValidateProgram ( GLuint program ) */
5685static void
5686android_glValidateProgram__I
5687 (JNIEnv *_env, jobject _this, jint program) {
5688 glValidateProgram(
5689 (GLuint)program
5690 );
5691}
5692
5693/* void glVertexAttrib1f ( GLuint indx, GLfloat x ) */
5694static void
5695android_glVertexAttrib1f__IF
5696 (JNIEnv *_env, jobject _this, jint indx, jfloat x) {
5697 glVertexAttrib1f(
5698 (GLuint)indx,
5699 (GLfloat)x
5700 );
5701}
5702
5703/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
5704static void
5705android_glVertexAttrib1fv__I_3FI
5706 (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005707 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005708 const char * _exceptionType = NULL;
5709 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005710 GLfloat *values_base = (GLfloat *) 0;
5711 jint _remaining;
5712 GLfloat *values = (GLfloat *) 0;
5713
5714 if (!values_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005715 _exception = 1;
5716 _exceptionType = "java/lang/IllegalArgumentException";
5717 _exceptionMessage = "values == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005718 goto exit;
5719 }
5720 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005721 _exception = 1;
5722 _exceptionType = "java/lang/IllegalArgumentException";
5723 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005724 goto exit;
5725 }
5726 _remaining = _env->GetArrayLength(values_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005727 if (_remaining < 1) {
5728 _exception = 1;
5729 _exceptionType = "java/lang/IllegalArgumentException";
5730 _exceptionMessage = "length - offset < 1 < needed";
5731 goto exit;
5732 }
Jack Palevich560814f2009-11-19 16:34:55 +08005733 values_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005734 _env->GetFloatArrayElements(values_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005735 values = values_base + offset;
5736
5737 glVertexAttrib1fv(
5738 (GLuint)indx,
5739 (GLfloat *)values
5740 );
5741
5742exit:
5743 if (values_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005744 _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005745 JNI_ABORT);
5746 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005747 if (_exception) {
5748 jniThrowException(_env, _exceptionType, _exceptionMessage);
5749 }
Jack Palevich560814f2009-11-19 16:34:55 +08005750}
5751
5752/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
5753static void
5754android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2
5755 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005756 jint _exception = 0;
5757 const char * _exceptionType = NULL;
5758 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005759 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005760 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005761 jint _remaining;
5762 GLfloat *values = (GLfloat *) 0;
5763
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005764 values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005765 if (_remaining < 1) {
5766 _exception = 1;
5767 _exceptionType = "java/lang/IllegalArgumentException";
5768 _exceptionMessage = "remaining() < 1 < needed";
5769 goto exit;
5770 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005771 if (values == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005772 char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005773 values = (GLfloat *) (_valuesBase + _bufferOffset);
5774 }
Jack Palevich560814f2009-11-19 16:34:55 +08005775 glVertexAttrib1fv(
5776 (GLuint)indx,
5777 (GLfloat *)values
5778 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005779
5780exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005781 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005782 _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005783 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005784 if (_exception) {
5785 jniThrowException(_env, _exceptionType, _exceptionMessage);
5786 }
Jack Palevich560814f2009-11-19 16:34:55 +08005787}
5788
5789/* void glVertexAttrib2f ( GLuint indx, GLfloat x, GLfloat y ) */
5790static void
5791android_glVertexAttrib2f__IFF
5792 (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y) {
5793 glVertexAttrib2f(
5794 (GLuint)indx,
5795 (GLfloat)x,
5796 (GLfloat)y
5797 );
5798}
5799
5800/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
5801static void
5802android_glVertexAttrib2fv__I_3FI
5803 (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005804 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005805 const char * _exceptionType = NULL;
5806 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005807 GLfloat *values_base = (GLfloat *) 0;
5808 jint _remaining;
5809 GLfloat *values = (GLfloat *) 0;
5810
5811 if (!values_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005812 _exception = 1;
5813 _exceptionType = "java/lang/IllegalArgumentException";
5814 _exceptionMessage = "values == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005815 goto exit;
5816 }
5817 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005818 _exception = 1;
5819 _exceptionType = "java/lang/IllegalArgumentException";
5820 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005821 goto exit;
5822 }
5823 _remaining = _env->GetArrayLength(values_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005824 if (_remaining < 2) {
5825 _exception = 1;
5826 _exceptionType = "java/lang/IllegalArgumentException";
5827 _exceptionMessage = "length - offset < 2 < needed";
5828 goto exit;
5829 }
Jack Palevich560814f2009-11-19 16:34:55 +08005830 values_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005831 _env->GetFloatArrayElements(values_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005832 values = values_base + offset;
5833
5834 glVertexAttrib2fv(
5835 (GLuint)indx,
5836 (GLfloat *)values
5837 );
5838
5839exit:
5840 if (values_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005841 _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005842 JNI_ABORT);
5843 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005844 if (_exception) {
5845 jniThrowException(_env, _exceptionType, _exceptionMessage);
5846 }
Jack Palevich560814f2009-11-19 16:34:55 +08005847}
5848
5849/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
5850static void
5851android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2
5852 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005853 jint _exception = 0;
5854 const char * _exceptionType = NULL;
5855 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005856 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005857 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005858 jint _remaining;
5859 GLfloat *values = (GLfloat *) 0;
5860
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005861 values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005862 if (_remaining < 2) {
5863 _exception = 1;
5864 _exceptionType = "java/lang/IllegalArgumentException";
5865 _exceptionMessage = "remaining() < 2 < needed";
5866 goto exit;
5867 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005868 if (values == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005869 char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005870 values = (GLfloat *) (_valuesBase + _bufferOffset);
5871 }
Jack Palevich560814f2009-11-19 16:34:55 +08005872 glVertexAttrib2fv(
5873 (GLuint)indx,
5874 (GLfloat *)values
5875 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005876
5877exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005878 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005879 _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005880 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005881 if (_exception) {
5882 jniThrowException(_env, _exceptionType, _exceptionMessage);
5883 }
Jack Palevich560814f2009-11-19 16:34:55 +08005884}
5885
5886/* void glVertexAttrib3f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z ) */
5887static void
5888android_glVertexAttrib3f__IFFF
5889 (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z) {
5890 glVertexAttrib3f(
5891 (GLuint)indx,
5892 (GLfloat)x,
5893 (GLfloat)y,
5894 (GLfloat)z
5895 );
5896}
5897
5898/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
5899static void
5900android_glVertexAttrib3fv__I_3FI
5901 (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005902 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005903 const char * _exceptionType = NULL;
5904 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005905 GLfloat *values_base = (GLfloat *) 0;
5906 jint _remaining;
5907 GLfloat *values = (GLfloat *) 0;
5908
5909 if (!values_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005910 _exception = 1;
5911 _exceptionType = "java/lang/IllegalArgumentException";
5912 _exceptionMessage = "values == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005913 goto exit;
5914 }
5915 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005916 _exception = 1;
5917 _exceptionType = "java/lang/IllegalArgumentException";
5918 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005919 goto exit;
5920 }
5921 _remaining = _env->GetArrayLength(values_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005922 if (_remaining < 3) {
5923 _exception = 1;
5924 _exceptionType = "java/lang/IllegalArgumentException";
5925 _exceptionMessage = "length - offset < 3 < needed";
5926 goto exit;
5927 }
Jack Palevich560814f2009-11-19 16:34:55 +08005928 values_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005929 _env->GetFloatArrayElements(values_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005930 values = values_base + offset;
5931
5932 glVertexAttrib3fv(
5933 (GLuint)indx,
5934 (GLfloat *)values
5935 );
5936
5937exit:
5938 if (values_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005939 _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005940 JNI_ABORT);
5941 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005942 if (_exception) {
5943 jniThrowException(_env, _exceptionType, _exceptionMessage);
5944 }
Jack Palevich560814f2009-11-19 16:34:55 +08005945}
5946
5947/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
5948static void
5949android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2
5950 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005951 jint _exception = 0;
5952 const char * _exceptionType = NULL;
5953 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005954 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005955 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005956 jint _remaining;
5957 GLfloat *values = (GLfloat *) 0;
5958
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005959 values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005960 if (_remaining < 3) {
5961 _exception = 1;
5962 _exceptionType = "java/lang/IllegalArgumentException";
5963 _exceptionMessage = "remaining() < 3 < needed";
5964 goto exit;
5965 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005966 if (values == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005967 char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005968 values = (GLfloat *) (_valuesBase + _bufferOffset);
5969 }
Jack Palevich560814f2009-11-19 16:34:55 +08005970 glVertexAttrib3fv(
5971 (GLuint)indx,
5972 (GLfloat *)values
5973 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005974
5975exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005976 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005977 _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005978 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005979 if (_exception) {
5980 jniThrowException(_env, _exceptionType, _exceptionMessage);
5981 }
Jack Palevich560814f2009-11-19 16:34:55 +08005982}
5983
5984/* void glVertexAttrib4f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
5985static void
5986android_glVertexAttrib4f__IFFFF
5987 (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z, jfloat w) {
5988 glVertexAttrib4f(
5989 (GLuint)indx,
5990 (GLfloat)x,
5991 (GLfloat)y,
5992 (GLfloat)z,
5993 (GLfloat)w
5994 );
5995}
5996
5997/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
5998static void
5999android_glVertexAttrib4fv__I_3FI
6000 (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006001 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08006002 const char * _exceptionType = NULL;
6003 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08006004 GLfloat *values_base = (GLfloat *) 0;
6005 jint _remaining;
6006 GLfloat *values = (GLfloat *) 0;
6007
6008 if (!values_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006009 _exception = 1;
6010 _exceptionType = "java/lang/IllegalArgumentException";
6011 _exceptionMessage = "values == null";
Jack Palevich560814f2009-11-19 16:34:55 +08006012 goto exit;
6013 }
6014 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006015 _exception = 1;
6016 _exceptionType = "java/lang/IllegalArgumentException";
6017 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08006018 goto exit;
6019 }
6020 _remaining = _env->GetArrayLength(values_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08006021 if (_remaining < 4) {
6022 _exception = 1;
6023 _exceptionType = "java/lang/IllegalArgumentException";
6024 _exceptionMessage = "length - offset < 4 < needed";
6025 goto exit;
6026 }
Jack Palevich560814f2009-11-19 16:34:55 +08006027 values_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006028 _env->GetFloatArrayElements(values_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08006029 values = values_base + offset;
6030
6031 glVertexAttrib4fv(
6032 (GLuint)indx,
6033 (GLfloat *)values
6034 );
6035
6036exit:
6037 if (values_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006038 _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
Jack Palevich560814f2009-11-19 16:34:55 +08006039 JNI_ABORT);
6040 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006041 if (_exception) {
6042 jniThrowException(_env, _exceptionType, _exceptionMessage);
6043 }
Jack Palevich560814f2009-11-19 16:34:55 +08006044}
6045
6046/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
6047static void
6048android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2
6049 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08006050 jint _exception = 0;
6051 const char * _exceptionType = NULL;
6052 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006053 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006054 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08006055 jint _remaining;
6056 GLfloat *values = (GLfloat *) 0;
6057
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006058 values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08006059 if (_remaining < 4) {
6060 _exception = 1;
6061 _exceptionType = "java/lang/IllegalArgumentException";
6062 _exceptionMessage = "remaining() < 4 < needed";
6063 goto exit;
6064 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006065 if (values == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006066 char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006067 values = (GLfloat *) (_valuesBase + _bufferOffset);
6068 }
Jack Palevich560814f2009-11-19 16:34:55 +08006069 glVertexAttrib4fv(
6070 (GLuint)indx,
6071 (GLfloat *)values
6072 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08006073
6074exit:
Jack Palevich560814f2009-11-19 16:34:55 +08006075 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006076 _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08006077 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08006078 if (_exception) {
6079 jniThrowException(_env, _exceptionType, _exceptionMessage);
6080 }
Jack Palevich560814f2009-11-19 16:34:55 +08006081}
6082
Jack Palevich224107a2010-06-22 20:08:40 +08006083/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint offset ) */
6084static void
6085android_glVertexAttribPointer__IIIZII
6086 (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jint offset) {
6087 glVertexAttribPointer(
6088 (GLuint)indx,
6089 (GLint)size,
6090 (GLenum)type,
6091 (GLboolean)normalized,
6092 (GLsizei)stride,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00006093 reinterpret_cast<GLvoid *>(offset)
Jack Palevich224107a2010-06-22 20:08:40 +08006094 );
6095}
6096
Jack Palevich560814f2009-11-19 16:34:55 +08006097/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr ) */
6098static void
6099android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I
6100 (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jobject ptr_buf, jint remaining) {
6101 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006102 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08006103 jint _remaining;
6104 GLvoid *ptr = (GLvoid *) 0;
6105
6106 if (ptr_buf) {
6107 ptr = (GLvoid *) getDirectBufferPointer(_env, ptr_buf);
6108 if ( ! ptr ) {
6109 return;
6110 }
6111 }
6112 glVertexAttribPointerBounds(
6113 (GLuint)indx,
6114 (GLint)size,
6115 (GLenum)type,
6116 (GLboolean)normalized,
6117 (GLsizei)stride,
6118 (GLvoid *)ptr,
6119 (GLsizei)remaining
6120 );
6121}
6122
6123/* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */
6124static void
6125android_glViewport__IIII
6126 (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
6127 glViewport(
6128 (GLint)x,
6129 (GLint)y,
6130 (GLsizei)width,
6131 (GLsizei)height
6132 );
6133}
6134
6135static const char *classPathName = "android/opengl/GLES20";
6136
Daniel Micay76f6a862015-09-19 17:31:01 -04006137static const JNINativeMethod methods[] = {
Jack Palevich560814f2009-11-19 16:34:55 +08006138{"_nativeClassInit", "()V", (void*)nativeClassInit },
6139{"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I },
6140{"glAttachShader", "(II)V", (void *) android_glAttachShader__II },
6141{"glBindAttribLocation", "(IILjava/lang/String;)V", (void *) android_glBindAttribLocation__IILjava_lang_String_2 },
6142{"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II },
6143{"glBindFramebuffer", "(II)V", (void *) android_glBindFramebuffer__II },
6144{"glBindRenderbuffer", "(II)V", (void *) android_glBindRenderbuffer__II },
6145{"glBindTexture", "(II)V", (void *) android_glBindTexture__II },
6146{"glBlendColor", "(FFFF)V", (void *) android_glBlendColor__FFFF },
6147{"glBlendEquation", "(I)V", (void *) android_glBlendEquation__I },
6148{"glBlendEquationSeparate", "(II)V", (void *) android_glBlendEquationSeparate__II },
6149{"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II },
6150{"glBlendFuncSeparate", "(IIII)V", (void *) android_glBlendFuncSeparate__IIII },
6151{"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I },
6152{"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 },
6153{"glCheckFramebufferStatus", "(I)I", (void *) android_glCheckFramebufferStatus__I },
6154{"glClear", "(I)V", (void *) android_glClear__I },
6155{"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF },
6156{"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F },
6157{"glClearStencil", "(I)V", (void *) android_glClearStencil__I },
6158{"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ },
6159{"glCompileShader", "(I)V", (void *) android_glCompileShader__I },
6160{"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 },
6161{"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
6162{"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII },
6163{"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII },
6164{"glCreateProgram", "()I", (void *) android_glCreateProgram__ },
6165{"glCreateShader", "(I)I", (void *) android_glCreateShader__I },
6166{"glCullFace", "(I)V", (void *) android_glCullFace__I },
6167{"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II },
6168{"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 },
6169{"glDeleteFramebuffers", "(I[II)V", (void *) android_glDeleteFramebuffers__I_3II },
6170{"glDeleteFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2 },
6171{"glDeleteProgram", "(I)V", (void *) android_glDeleteProgram__I },
6172{"glDeleteRenderbuffers", "(I[II)V", (void *) android_glDeleteRenderbuffers__I_3II },
6173{"glDeleteRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2 },
6174{"glDeleteShader", "(I)V", (void *) android_glDeleteShader__I },
6175{"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II },
6176{"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 },
6177{"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I },
6178{"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z },
6179{"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF },
6180{"glDetachShader", "(II)V", (void *) android_glDetachShader__II },
6181{"glDisable", "(I)V", (void *) android_glDisable__I },
6182{"glDisableVertexAttribArray", "(I)V", (void *) android_glDisableVertexAttribArray__I },
6183{"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III },
Jack Palevich224107a2010-06-22 20:08:40 +08006184{"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII },
Jack Palevich560814f2009-11-19 16:34:55 +08006185{"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 },
6186{"glEnable", "(I)V", (void *) android_glEnable__I },
6187{"glEnableVertexAttribArray", "(I)V", (void *) android_glEnableVertexAttribArray__I },
6188{"glFinish", "()V", (void *) android_glFinish__ },
6189{"glFlush", "()V", (void *) android_glFlush__ },
6190{"glFramebufferRenderbuffer", "(IIII)V", (void *) android_glFramebufferRenderbuffer__IIII },
6191{"glFramebufferTexture2D", "(IIIII)V", (void *) android_glFramebufferTexture2D__IIIII },
6192{"glFrontFace", "(I)V", (void *) android_glFrontFace__I },
6193{"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II },
6194{"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 },
6195{"glGenerateMipmap", "(I)V", (void *) android_glGenerateMipmap__I },
6196{"glGenFramebuffers", "(I[II)V", (void *) android_glGenFramebuffers__I_3II },
6197{"glGenFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenFramebuffers__ILjava_nio_IntBuffer_2 },
6198{"glGenRenderbuffers", "(I[II)V", (void *) android_glGenRenderbuffers__I_3II },
6199{"glGenRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenRenderbuffers__ILjava_nio_IntBuffer_2 },
6200{"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II },
6201{"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 },
6202{"glGetActiveAttrib", "(III[II[II[II[BI)V", (void *) android_glGetActiveAttrib__III_3II_3II_3II_3BI },
6203{"glGetActiveAttrib", "(IIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;B)V", (void *) android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B },
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07006204{"glGetActiveAttrib", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveAttrib1 },
6205{"glGetActiveAttrib", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveAttrib2 },
Jack Palevich560814f2009-11-19 16:34:55 +08006206{"glGetActiveUniform", "(III[II[II[II[BI)V", (void *) android_glGetActiveUniform__III_3II_3II_3II_3BI },
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07006207{"glGetActiveUniform", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveUniform1 },
Jack Palevich560814f2009-11-19 16:34:55 +08006208{"glGetActiveUniform", "(IIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;B)V", (void *) android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B },
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07006209{"glGetActiveUniform", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveUniform2 },
Jack Palevich560814f2009-11-19 16:34:55 +08006210{"glGetAttachedShaders", "(II[II[II)V", (void *) android_glGetAttachedShaders__II_3II_3II },
6211{"glGetAttachedShaders", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
6212{"glGetAttribLocation", "(ILjava/lang/String;)I", (void *) android_glGetAttribLocation__ILjava_lang_String_2 },
6213{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI },
6214{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 },
6215{"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II },
6216{"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 },
6217{"glGetError", "()I", (void *) android_glGetError__ },
6218{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI },
6219{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 },
6220{"glGetFramebufferAttachmentParameteriv", "(III[II)V", (void *) android_glGetFramebufferAttachmentParameteriv__III_3II },
6221{"glGetFramebufferAttachmentParameteriv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2 },
6222{"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II },
6223{"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 },
6224{"glGetProgramiv", "(II[II)V", (void *) android_glGetProgramiv__II_3II },
6225{"glGetProgramiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetProgramiv__IILjava_nio_IntBuffer_2 },
6226{"glGetProgramInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetProgramInfoLog },
6227{"glGetRenderbufferParameteriv", "(II[II)V", (void *) android_glGetRenderbufferParameteriv__II_3II },
6228{"glGetRenderbufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2 },
6229{"glGetShaderiv", "(II[II)V", (void *) android_glGetShaderiv__II_3II },
6230{"glGetShaderiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetShaderiv__IILjava_nio_IntBuffer_2 },
6231{"glGetShaderInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetShaderInfoLog },
6232{"glGetShaderPrecisionFormat", "(II[II[II)V", (void *) android_glGetShaderPrecisionFormat__II_3II_3II },
6233{"glGetShaderPrecisionFormat", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
6234{"glGetShaderSource", "(II[II[BI)V", (void *) android_glGetShaderSource__II_3II_3BI },
6235{"glGetShaderSource", "(IILjava/nio/IntBuffer;B)V", (void *) android_glGetShaderSource__IILjava_nio_IntBuffer_2B },
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07006236{"glGetShaderSource", "(I)Ljava/lang/String;", (void *) android_glGetShaderSource },
Jack Palevich560814f2009-11-19 16:34:55 +08006237{"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString },
6238{"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI },
6239{"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 },
6240{"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II },
6241{"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 },
6242{"glGetUniformfv", "(II[FI)V", (void *) android_glGetUniformfv__II_3FI },
6243{"glGetUniformfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetUniformfv__IILjava_nio_FloatBuffer_2 },
6244{"glGetUniformiv", "(II[II)V", (void *) android_glGetUniformiv__II_3II },
6245{"glGetUniformiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetUniformiv__IILjava_nio_IntBuffer_2 },
6246{"glGetUniformLocation", "(ILjava/lang/String;)I", (void *) android_glGetUniformLocation__ILjava_lang_String_2 },
6247{"glGetVertexAttribfv", "(II[FI)V", (void *) android_glGetVertexAttribfv__II_3FI },
6248{"glGetVertexAttribfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2 },
6249{"glGetVertexAttribiv", "(II[II)V", (void *) android_glGetVertexAttribiv__II_3II },
6250{"glGetVertexAttribiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2 },
6251{"glHint", "(II)V", (void *) android_glHint__II },
6252{"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I },
6253{"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I },
6254{"glIsFramebuffer", "(I)Z", (void *) android_glIsFramebuffer__I },
6255{"glIsProgram", "(I)Z", (void *) android_glIsProgram__I },
6256{"glIsRenderbuffer", "(I)Z", (void *) android_glIsRenderbuffer__I },
6257{"glIsShader", "(I)Z", (void *) android_glIsShader__I },
6258{"glIsTexture", "(I)Z", (void *) android_glIsTexture__I },
6259{"glLineWidth", "(F)V", (void *) android_glLineWidth__F },
6260{"glLinkProgram", "(I)V", (void *) android_glLinkProgram__I },
6261{"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II },
6262{"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF },
6263{"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 },
6264{"glReleaseShaderCompiler", "()V", (void *) android_glReleaseShaderCompiler__ },
6265{"glRenderbufferStorage", "(IIII)V", (void *) android_glRenderbufferStorage__IIII },
6266{"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ },
6267{"glScissor", "(IIII)V", (void *) android_glScissor__IIII },
6268{"glShaderBinary", "(I[IIILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__I_3IIILjava_nio_Buffer_2I },
6269{"glShaderBinary", "(ILjava/nio/IntBuffer;ILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I },
6270{"glShaderSource", "(ILjava/lang/String;)V", (void *) android_glShaderSource },
6271{"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III },
6272{"glStencilFuncSeparate", "(IIII)V", (void *) android_glStencilFuncSeparate__IIII },
6273{"glStencilMask", "(I)V", (void *) android_glStencilMask__I },
6274{"glStencilMaskSeparate", "(II)V", (void *) android_glStencilMaskSeparate__II },
6275{"glStencilOp", "(III)V", (void *) android_glStencilOp__III },
6276{"glStencilOpSeparate", "(IIII)V", (void *) android_glStencilOpSeparate__IIII },
6277{"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 },
6278{"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF },
6279{"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI },
6280{"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 },
6281{"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III },
6282{"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II },
6283{"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 },
6284{"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
6285{"glUniform1f", "(IF)V", (void *) android_glUniform1f__IF },
6286{"glUniform1fv", "(II[FI)V", (void *) android_glUniform1fv__II_3FI },
6287{"glUniform1fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform1fv__IILjava_nio_FloatBuffer_2 },
6288{"glUniform1i", "(II)V", (void *) android_glUniform1i__II },
6289{"glUniform1iv", "(II[II)V", (void *) android_glUniform1iv__II_3II },
6290{"glUniform1iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform1iv__IILjava_nio_IntBuffer_2 },
6291{"glUniform2f", "(IFF)V", (void *) android_glUniform2f__IFF },
6292{"glUniform2fv", "(II[FI)V", (void *) android_glUniform2fv__II_3FI },
6293{"glUniform2fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform2fv__IILjava_nio_FloatBuffer_2 },
6294{"glUniform2i", "(III)V", (void *) android_glUniform2i__III },
6295{"glUniform2iv", "(II[II)V", (void *) android_glUniform2iv__II_3II },
6296{"glUniform2iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform2iv__IILjava_nio_IntBuffer_2 },
6297{"glUniform3f", "(IFFF)V", (void *) android_glUniform3f__IFFF },
6298{"glUniform3fv", "(II[FI)V", (void *) android_glUniform3fv__II_3FI },
6299{"glUniform3fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform3fv__IILjava_nio_FloatBuffer_2 },
6300{"glUniform3i", "(IIII)V", (void *) android_glUniform3i__IIII },
6301{"glUniform3iv", "(II[II)V", (void *) android_glUniform3iv__II_3II },
6302{"glUniform3iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform3iv__IILjava_nio_IntBuffer_2 },
6303{"glUniform4f", "(IFFFF)V", (void *) android_glUniform4f__IFFFF },
6304{"glUniform4fv", "(II[FI)V", (void *) android_glUniform4fv__II_3FI },
6305{"glUniform4fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform4fv__IILjava_nio_FloatBuffer_2 },
6306{"glUniform4i", "(IIIII)V", (void *) android_glUniform4i__IIIII },
6307{"glUniform4iv", "(II[II)V", (void *) android_glUniform4iv__II_3II },
6308{"glUniform4iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform4iv__IILjava_nio_IntBuffer_2 },
6309{"glUniformMatrix2fv", "(IIZ[FI)V", (void *) android_glUniformMatrix2fv__IIZ_3FI },
6310{"glUniformMatrix2fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2 },
6311{"glUniformMatrix3fv", "(IIZ[FI)V", (void *) android_glUniformMatrix3fv__IIZ_3FI },
6312{"glUniformMatrix3fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2 },
6313{"glUniformMatrix4fv", "(IIZ[FI)V", (void *) android_glUniformMatrix4fv__IIZ_3FI },
6314{"glUniformMatrix4fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2 },
6315{"glUseProgram", "(I)V", (void *) android_glUseProgram__I },
6316{"glValidateProgram", "(I)V", (void *) android_glValidateProgram__I },
6317{"glVertexAttrib1f", "(IF)V", (void *) android_glVertexAttrib1f__IF },
6318{"glVertexAttrib1fv", "(I[FI)V", (void *) android_glVertexAttrib1fv__I_3FI },
6319{"glVertexAttrib1fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2 },
6320{"glVertexAttrib2f", "(IFF)V", (void *) android_glVertexAttrib2f__IFF },
6321{"glVertexAttrib2fv", "(I[FI)V", (void *) android_glVertexAttrib2fv__I_3FI },
6322{"glVertexAttrib2fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2 },
6323{"glVertexAttrib3f", "(IFFF)V", (void *) android_glVertexAttrib3f__IFFF },
6324{"glVertexAttrib3fv", "(I[FI)V", (void *) android_glVertexAttrib3fv__I_3FI },
6325{"glVertexAttrib3fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2 },
6326{"glVertexAttrib4f", "(IFFFF)V", (void *) android_glVertexAttrib4f__IFFFF },
6327{"glVertexAttrib4fv", "(I[FI)V", (void *) android_glVertexAttrib4fv__I_3FI },
6328{"glVertexAttrib4fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2 },
Jack Palevich224107a2010-06-22 20:08:40 +08006329{"glVertexAttribPointer", "(IIIZII)V", (void *) android_glVertexAttribPointer__IIIZII },
Jack Palevich560814f2009-11-19 16:34:55 +08006330{"glVertexAttribPointerBounds", "(IIIZILjava/nio/Buffer;I)V", (void *) android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I },
6331{"glViewport", "(IIII)V", (void *) android_glViewport__IIII },
6332};
6333
6334int register_android_opengl_jni_GLES20(JNIEnv *_env)
6335{
6336 int err;
6337 err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
6338 return err;
6339}