blob: 417978524b1c76e33b17d508f42655bdde62bf10 [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
Mathias Agopian15284de2013-02-23 03:12:30 -080020#include <GLES2/gl2.h>
21#include <GLES2/gl2ext.h>
22
Elliott Hughes24ce5fb2011-04-08 20:01:01 -070023#include "jni.h"
24#include "JNIHelp.h"
Jack Palevich560814f2009-11-19 16:34:55 +080025#include <android_runtime/AndroidRuntime.h>
26#include <utils/misc.h>
Jack Palevich560814f2009-11-19 16:34:55 +080027#include <assert.h>
Jack Palevich560814f2009-11-19 16:34:55 +080028
29static int initialized = 0;
30
31static jclass nioAccessClass;
32static jclass bufferClass;
Jack Palevich560814f2009-11-19 16:34:55 +080033static jmethodID getBasePointerID;
34static jmethodID getBaseArrayID;
35static jmethodID getBaseArrayOffsetID;
36static jfieldID positionID;
37static jfieldID limitID;
38static jfieldID elementSizeShiftID;
39
Mathias Agopian15284de2013-02-23 03:12:30 -080040
41/* special calls implemented in Android's GLES wrapper used to more
42 * efficiently bound-check passed arrays */
43extern "C" {
44#ifdef GL_VERSION_ES_CM_1_1
45GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
46 const GLvoid *ptr, GLsizei count);
47GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
48 const GLvoid *pointer, GLsizei count);
49GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
50 GLsizei stride, const GLvoid *pointer, GLsizei count);
51GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
52 GLsizei stride, const GLvoid *pointer, GLsizei count);
53GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
54 GLsizei stride, const GLvoid *pointer, GLsizei count);
55GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
56 GLsizei stride, const GLvoid *pointer, GLsizei count);
57GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
58 GLsizei stride, const GLvoid *pointer, GLsizei count);
59#endif
60#ifdef GL_ES_VERSION_2_0
61static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type,
62 GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) {
63 glVertexAttribPointer(indx, size, type, normalized, stride, pointer);
64}
65#endif
66}
67
Jack Palevich560814f2009-11-19 16:34:55 +080068/* Cache method IDs each time the class is loaded. */
69
70static void
Elliott Hughes24ce5fb2011-04-08 20:01:01 -070071nativeClassInit(JNIEnv *_env, jclass glImplClass)
Jack Palevich560814f2009-11-19 16:34:55 +080072{
73 jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
74 nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
75
76 jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
77 bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
78
79 getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
80 "getBasePointer", "(Ljava/nio/Buffer;)J");
81 getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
82 "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
83 getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
84 "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
85
86 positionID = _env->GetFieldID(bufferClass, "position", "I");
87 limitID = _env->GetFieldID(bufferClass, "limit", "I");
88 elementSizeShiftID =
89 _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
90}
91
Jack Palevich560814f2009-11-19 16:34:55 +080092static void *
Thomas Tafertshofer17045a12012-07-12 13:55:55 -070093getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
Jack Palevich560814f2009-11-19 16:34:55 +080094{
95 jint position;
96 jint limit;
97 jint elementSizeShift;
98 jlong pointer;
Jack Palevich560814f2009-11-19 16:34:55 +080099
100 position = _env->GetIntField(buffer, positionID);
101 limit = _env->GetIntField(buffer, limitID);
102 elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
103 *remaining = (limit - position) << elementSizeShift;
104 pointer = _env->CallStaticLongMethod(nioAccessClass,
105 getBasePointerID, buffer);
106 if (pointer != 0L) {
107 *array = NULL;
108 return (void *) (jint) pointer;
109 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700110
Jack Palevich560814f2009-11-19 16:34:55 +0800111 *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
112 getBaseArrayID, buffer);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700113 *offset = _env->CallStaticIntMethod(nioAccessClass,
Jack Palevich560814f2009-11-19 16:34:55 +0800114 getBaseArrayOffsetID, buffer);
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700115
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700116 return NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800117}
118
Jack Palevich560814f2009-11-19 16:34:55 +0800119static void
120releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
121{
122 _env->ReleasePrimitiveArrayCritical(array, data,
Mathias Agopian15284de2013-02-23 03:12:30 -0800123 commit ? 0 : JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +0800124}
125
126static void *
127getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
128 char* buf = (char*) _env->GetDirectBufferAddress(buffer);
129 if (buf) {
130 jint position = _env->GetIntField(buffer, positionID);
131 jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
132 buf += position << elementSizeShift;
133 } else {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700134 jniThrowException(_env, "java/lang/IllegalArgumentException",
135 "Must use a native order direct Buffer");
Jack Palevich560814f2009-11-19 16:34:55 +0800136 }
137 return (void*) buf;
138}
139
Mathias Agopian15284de2013-02-23 03:12:30 -0800140// --------------------------------------------------------------------------
141
142/*
143 * returns the number of values glGet returns for a given pname.
144 *
145 * The code below is written such that pnames requiring only one values
146 * are the default (and are not explicitely tested for). This makes the
147 * checking code much shorter/readable/efficient.
148 *
149 * This means that unknown pnames (e.g.: extensions) will default to 1. If
150 * that unknown pname needs more than 1 value, then the validation check
151 * is incomplete and the app may crash if it passed the wrong number params.
152 */
153static int getNeededCount(GLint pname) {
154 int needed = 1;
155#ifdef GL_ES_VERSION_2_0
156 // GLES 2.x pnames
157 switch (pname) {
158 case GL_ALIASED_LINE_WIDTH_RANGE:
159 case GL_ALIASED_POINT_SIZE_RANGE:
160 needed = 2;
161 break;
162
163 case GL_BLEND_COLOR:
164 case GL_COLOR_CLEAR_VALUE:
165 case GL_COLOR_WRITEMASK:
166 case GL_SCISSOR_BOX:
167 case GL_VIEWPORT:
168 needed = 4;
169 break;
170
171 case GL_COMPRESSED_TEXTURE_FORMATS:
172 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
173 break;
174
175 case GL_SHADER_BINARY_FORMATS:
176 glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed);
177 break;
178 }
179#endif
180
181#ifdef GL_VERSION_ES_CM_1_1
182 // GLES 1.x pnames
183 switch (pname) {
184 case GL_ALIASED_LINE_WIDTH_RANGE:
185 case GL_ALIASED_POINT_SIZE_RANGE:
186 case GL_DEPTH_RANGE:
187 case GL_SMOOTH_LINE_WIDTH_RANGE:
188 case GL_SMOOTH_POINT_SIZE_RANGE:
189 needed = 2;
190 break;
191
192 case GL_CURRENT_NORMAL:
193 case GL_POINT_DISTANCE_ATTENUATION:
194 needed = 3;
195 break;
196
197 case GL_COLOR_CLEAR_VALUE:
198 case GL_COLOR_WRITEMASK:
199 case GL_CURRENT_COLOR:
200 case GL_CURRENT_TEXTURE_COORDS:
201 case GL_FOG_COLOR:
202 case GL_LIGHT_MODEL_AMBIENT:
203 case GL_SCISSOR_BOX:
204 case GL_VIEWPORT:
205 needed = 4;
206 break;
207
208 case GL_MODELVIEW_MATRIX:
209 case GL_PROJECTION_MATRIX:
210 case GL_TEXTURE_MATRIX:
211 needed = 16;
212 break;
213
214 case GL_COMPRESSED_TEXTURE_FORMATS:
215 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
216 break;
217 }
218#endif
219 return needed;
Jack Palevich560814f2009-11-19 16:34:55 +0800220}
221
Mathias Agopian15284de2013-02-23 03:12:30 -0800222template <typename JTYPEARRAY, typename CTYPE, void GET(GLenum, CTYPE*)>
223static void
224get
225 (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
226 jint _exception = 0;
227 const char * _exceptionType;
228 const char * _exceptionMessage;
229 CTYPE *params_base = (CTYPE *) 0;
230 jint _remaining;
231 CTYPE *params = (CTYPE *) 0;
232 int _needed = 0;
233
234 if (!params_ref) {
235 _exception = 1;
236 _exceptionType = "java/lang/IllegalArgumentException";
237 _exceptionMessage = "params == null";
238 goto exit;
239 }
240 if (offset < 0) {
241 _exception = 1;
242 _exceptionType = "java/lang/IllegalArgumentException";
243 _exceptionMessage = "offset < 0";
244 goto exit;
245 }
246 _remaining = _env->GetArrayLength(params_ref) - offset;
247 _needed = getNeededCount(pname);
248 // if we didn't find this pname, we just assume the user passed
249 // an array of the right size -- this might happen with extensions
250 // or if we forget an enum here.
251 if (_remaining < _needed) {
252 _exception = 1;
253 _exceptionType = "java/lang/IllegalArgumentException";
254 _exceptionMessage = "length - offset < needed";
255 goto exit;
256 }
257 params_base = (CTYPE *)
258 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
259 params = params_base + offset;
260
261 GET(
262 (GLenum)pname,
263 (CTYPE *)params
264 );
265
266exit:
267 if (params_base) {
268 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
269 _exception ? JNI_ABORT: 0);
270 }
271 if (_exception) {
272 jniThrowException(_env, _exceptionType, _exceptionMessage);
273 }
274}
275
276
277template <typename CTYPE, void GET(GLenum, CTYPE*)>
278static void
279getarray
280 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
281 jint _exception = 0;
282 const char * _exceptionType;
283 const char * _exceptionMessage;
284 jarray _array = (jarray) 0;
285 jint _bufferOffset = (jint) 0;
286 jint _remaining;
287 CTYPE *params = (CTYPE *) 0;
288 int _needed = 0;
289
290 params = (CTYPE *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
291 _needed = getNeededCount(pname);
292 // if we didn't find this pname, we just assume the user passed
293 // an array of the right size -- this might happen with extensions
294 // or if we forget an enum here.
295 if (_needed>0 && _remaining < _needed) {
296 _exception = 1;
297 _exceptionType = "java/lang/IllegalArgumentException";
298 _exceptionMessage = "remaining() < needed";
299 goto exit;
300 }
301 if (params == NULL) {
302 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
303 params = (CTYPE *) (_paramsBase + _bufferOffset);
304 }
305 GET(
306 (GLenum)pname,
307 (CTYPE *)params
308 );
309
310exit:
311 if (_array) {
312 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
313 }
314 if (_exception) {
315 jniThrowException(_env, _exceptionType, _exceptionMessage);
316 }
Jack Palevich560814f2009-11-19 16:34:55 +0800317}
318
319// --------------------------------------------------------------------------
Jack Palevich560814f2009-11-19 16:34:55 +0800320/* void glActiveTexture ( GLenum texture ) */
321static void
322android_glActiveTexture__I
323 (JNIEnv *_env, jobject _this, jint texture) {
324 glActiveTexture(
325 (GLenum)texture
326 );
327}
328
329/* void glAttachShader ( GLuint program, GLuint shader ) */
330static void
331android_glAttachShader__II
332 (JNIEnv *_env, jobject _this, jint program, jint shader) {
333 glAttachShader(
334 (GLuint)program,
335 (GLuint)shader
336 );
337}
338
339/* void glBindAttribLocation ( GLuint program, GLuint index, const char *name ) */
340static void
341android_glBindAttribLocation__IILjava_lang_String_2
342 (JNIEnv *_env, jobject _this, jint program, jint index, jstring name) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700343 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800344 const char * _exceptionType = NULL;
345 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800346 const char* _nativename = 0;
347
348 if (!name) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700349 _exceptionType = "java/lang/IllegalArgumentException";
350 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +0800351 goto exit;
352 }
353 _nativename = _env->GetStringUTFChars(name, 0);
354
355 glBindAttribLocation(
356 (GLuint)program,
357 (GLuint)index,
358 (char *)_nativename
359 );
360
361exit:
362 if (_nativename) {
363 _env->ReleaseStringUTFChars(name, _nativename);
364 }
365
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700366 if (_exception) {
367 jniThrowException(_env, _exceptionType, _exceptionMessage);
368 }
Jack Palevich560814f2009-11-19 16:34:55 +0800369}
370
371/* void glBindBuffer ( GLenum target, GLuint buffer ) */
372static void
373android_glBindBuffer__II
374 (JNIEnv *_env, jobject _this, jint target, jint buffer) {
375 glBindBuffer(
376 (GLenum)target,
377 (GLuint)buffer
378 );
379}
380
381/* void glBindFramebuffer ( GLenum target, GLuint framebuffer ) */
382static void
383android_glBindFramebuffer__II
384 (JNIEnv *_env, jobject _this, jint target, jint framebuffer) {
385 glBindFramebuffer(
386 (GLenum)target,
387 (GLuint)framebuffer
388 );
389}
390
391/* void glBindRenderbuffer ( GLenum target, GLuint renderbuffer ) */
392static void
393android_glBindRenderbuffer__II
394 (JNIEnv *_env, jobject _this, jint target, jint renderbuffer) {
395 glBindRenderbuffer(
396 (GLenum)target,
397 (GLuint)renderbuffer
398 );
399}
400
401/* void glBindTexture ( GLenum target, GLuint texture ) */
402static void
403android_glBindTexture__II
404 (JNIEnv *_env, jobject _this, jint target, jint texture) {
405 glBindTexture(
406 (GLenum)target,
407 (GLuint)texture
408 );
409}
410
411/* void glBlendColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
412static void
413android_glBlendColor__FFFF
414 (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
415 glBlendColor(
416 (GLclampf)red,
417 (GLclampf)green,
418 (GLclampf)blue,
419 (GLclampf)alpha
420 );
421}
422
423/* void glBlendEquation ( GLenum mode ) */
424static void
425android_glBlendEquation__I
426 (JNIEnv *_env, jobject _this, jint mode) {
Jack Palevich73108672011-03-28 14:49:12 -0700427 glBlendEquation(
428 (GLenum)mode
429 );
Jack Palevich560814f2009-11-19 16:34:55 +0800430}
431
432/* void glBlendEquationSeparate ( GLenum modeRGB, GLenum modeAlpha ) */
433static void
434android_glBlendEquationSeparate__II
435 (JNIEnv *_env, jobject _this, jint modeRGB, jint modeAlpha) {
Jack Palevich73108672011-03-28 14:49:12 -0700436 glBlendEquationSeparate(
437 (GLenum)modeRGB,
438 (GLenum)modeAlpha
439 );
Jack Palevich560814f2009-11-19 16:34:55 +0800440}
441
442/* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */
443static void
444android_glBlendFunc__II
445 (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) {
446 glBlendFunc(
447 (GLenum)sfactor,
448 (GLenum)dfactor
449 );
450}
451
452/* void glBlendFuncSeparate ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) */
453static void
454android_glBlendFuncSeparate__IIII
455 (JNIEnv *_env, jobject _this, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) {
Jack Palevich73108672011-03-28 14:49:12 -0700456 glBlendFuncSeparate(
457 (GLenum)srcRGB,
458 (GLenum)dstRGB,
459 (GLenum)srcAlpha,
460 (GLenum)dstAlpha
461 );
Jack Palevich560814f2009-11-19 16:34:55 +0800462}
463
464/* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */
465static void
466android_glBufferData__IILjava_nio_Buffer_2I
467 (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700468 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800469 const char * _exceptionType = NULL;
470 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800471 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700472 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800473 jint _remaining;
474 GLvoid *data = (GLvoid *) 0;
475
476 if (data_buf) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700477 data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +0800478 if (_remaining < size) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700479 _exception = 1;
480 _exceptionType = "java/lang/IllegalArgumentException";
481 _exceptionMessage = "remaining() < size < needed";
Jack Palevich560814f2009-11-19 16:34:55 +0800482 goto exit;
483 }
484 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -0700485 if (data_buf && data == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700486 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
487 data = (GLvoid *) (_dataBase + _bufferOffset);
488 }
Jack Palevich560814f2009-11-19 16:34:55 +0800489 glBufferData(
490 (GLenum)target,
491 (GLsizeiptr)size,
492 (GLvoid *)data,
493 (GLenum)usage
494 );
495
496exit:
497 if (_array) {
498 releasePointer(_env, _array, data, JNI_FALSE);
499 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700500 if (_exception) {
501 jniThrowException(_env, _exceptionType, _exceptionMessage);
502 }
Jack Palevich560814f2009-11-19 16:34:55 +0800503}
504
505/* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */
506static void
507android_glBufferSubData__IIILjava_nio_Buffer_2
508 (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700509 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800510 const char * _exceptionType = NULL;
511 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800512 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700513 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800514 jint _remaining;
515 GLvoid *data = (GLvoid *) 0;
516
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700517 data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +0800518 if (_remaining < size) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700519 _exception = 1;
520 _exceptionType = "java/lang/IllegalArgumentException";
521 _exceptionMessage = "remaining() < size < needed";
Jack Palevich560814f2009-11-19 16:34:55 +0800522 goto exit;
523 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700524 if (data == NULL) {
525 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
526 data = (GLvoid *) (_dataBase + _bufferOffset);
527 }
Jack Palevich560814f2009-11-19 16:34:55 +0800528 glBufferSubData(
529 (GLenum)target,
530 (GLintptr)offset,
531 (GLsizeiptr)size,
532 (GLvoid *)data
533 );
534
535exit:
536 if (_array) {
537 releasePointer(_env, _array, data, JNI_FALSE);
538 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700539 if (_exception) {
540 jniThrowException(_env, _exceptionType, _exceptionMessage);
541 }
Jack Palevich560814f2009-11-19 16:34:55 +0800542}
543
544/* GLenum glCheckFramebufferStatus ( GLenum target ) */
545static jint
546android_glCheckFramebufferStatus__I
547 (JNIEnv *_env, jobject _this, jint target) {
548 GLenum _returnValue;
549 _returnValue = glCheckFramebufferStatus(
550 (GLenum)target
551 );
552 return _returnValue;
553}
554
555/* void glClear ( GLbitfield mask ) */
556static void
557android_glClear__I
558 (JNIEnv *_env, jobject _this, jint mask) {
559 glClear(
560 (GLbitfield)mask
561 );
562}
563
564/* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
565static void
566android_glClearColor__FFFF
567 (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
568 glClearColor(
569 (GLclampf)red,
570 (GLclampf)green,
571 (GLclampf)blue,
572 (GLclampf)alpha
573 );
574}
575
576/* void glClearDepthf ( GLclampf depth ) */
577static void
578android_glClearDepthf__F
579 (JNIEnv *_env, jobject _this, jfloat depth) {
580 glClearDepthf(
581 (GLclampf)depth
582 );
583}
584
585/* void glClearStencil ( GLint s ) */
586static void
587android_glClearStencil__I
588 (JNIEnv *_env, jobject _this, jint s) {
589 glClearStencil(
590 (GLint)s
591 );
592}
593
594/* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */
595static void
596android_glColorMask__ZZZZ
597 (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) {
598 glColorMask(
599 (GLboolean)red,
600 (GLboolean)green,
601 (GLboolean)blue,
602 (GLboolean)alpha
603 );
604}
605
606/* void glCompileShader ( GLuint shader ) */
607static void
608android_glCompileShader__I
609 (JNIEnv *_env, jobject _this, jint shader) {
610 glCompileShader(
611 (GLuint)shader
612 );
613}
614
615/* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */
616static void
617android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2
618 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) {
619 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700620 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800621 jint _remaining;
622 GLvoid *data = (GLvoid *) 0;
623
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700624 data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
625 if (data == NULL) {
626 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
627 data = (GLvoid *) (_dataBase + _bufferOffset);
628 }
Jack Palevich560814f2009-11-19 16:34:55 +0800629 glCompressedTexImage2D(
630 (GLenum)target,
631 (GLint)level,
632 (GLenum)internalformat,
633 (GLsizei)width,
634 (GLsizei)height,
635 (GLint)border,
636 (GLsizei)imageSize,
637 (GLvoid *)data
638 );
639 if (_array) {
640 releasePointer(_env, _array, data, JNI_FALSE);
641 }
642}
643
644/* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */
645static void
646android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
647 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) {
648 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700649 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800650 jint _remaining;
651 GLvoid *data = (GLvoid *) 0;
652
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700653 data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
654 if (data == NULL) {
655 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
656 data = (GLvoid *) (_dataBase + _bufferOffset);
657 }
Jack Palevich560814f2009-11-19 16:34:55 +0800658 glCompressedTexSubImage2D(
659 (GLenum)target,
660 (GLint)level,
661 (GLint)xoffset,
662 (GLint)yoffset,
663 (GLsizei)width,
664 (GLsizei)height,
665 (GLenum)format,
666 (GLsizei)imageSize,
667 (GLvoid *)data
668 );
669 if (_array) {
670 releasePointer(_env, _array, data, JNI_FALSE);
671 }
672}
673
674/* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */
675static void
676android_glCopyTexImage2D__IIIIIIII
677 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) {
678 glCopyTexImage2D(
679 (GLenum)target,
680 (GLint)level,
681 (GLenum)internalformat,
682 (GLint)x,
683 (GLint)y,
684 (GLsizei)width,
685 (GLsizei)height,
686 (GLint)border
687 );
688}
689
690/* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */
691static void
692android_glCopyTexSubImage2D__IIIIIIII
693 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) {
694 glCopyTexSubImage2D(
695 (GLenum)target,
696 (GLint)level,
697 (GLint)xoffset,
698 (GLint)yoffset,
699 (GLint)x,
700 (GLint)y,
701 (GLsizei)width,
702 (GLsizei)height
703 );
704}
705
706/* GLuint glCreateProgram ( void ) */
707static jint
708android_glCreateProgram__
709 (JNIEnv *_env, jobject _this) {
710 GLuint _returnValue;
711 _returnValue = glCreateProgram();
712 return _returnValue;
713}
714
715/* GLuint glCreateShader ( GLenum type ) */
716static jint
717android_glCreateShader__I
718 (JNIEnv *_env, jobject _this, jint type) {
719 GLuint _returnValue;
720 _returnValue = glCreateShader(
721 (GLenum)type
722 );
723 return _returnValue;
724}
725
726/* void glCullFace ( GLenum mode ) */
727static void
728android_glCullFace__I
729 (JNIEnv *_env, jobject _this, jint mode) {
730 glCullFace(
731 (GLenum)mode
732 );
733}
734
735/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
736static void
737android_glDeleteBuffers__I_3II
738 (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700739 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800740 const char * _exceptionType = NULL;
741 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800742 GLuint *buffers_base = (GLuint *) 0;
743 jint _remaining;
744 GLuint *buffers = (GLuint *) 0;
745
746 if (!buffers_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700747 _exception = 1;
748 _exceptionType = "java/lang/IllegalArgumentException";
749 _exceptionMessage = "buffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +0800750 goto exit;
751 }
752 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700753 _exception = 1;
754 _exceptionType = "java/lang/IllegalArgumentException";
755 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +0800756 goto exit;
757 }
758 _remaining = _env->GetArrayLength(buffers_ref) - offset;
759 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700760 _exception = 1;
761 _exceptionType = "java/lang/IllegalArgumentException";
762 _exceptionMessage = "length - offset < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +0800763 goto exit;
764 }
765 buffers_base = (GLuint *)
766 _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
767 buffers = buffers_base + offset;
768
769 glDeleteBuffers(
770 (GLsizei)n,
771 (GLuint *)buffers
772 );
773
774exit:
775 if (buffers_base) {
776 _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
777 JNI_ABORT);
778 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700779 if (_exception) {
780 jniThrowException(_env, _exceptionType, _exceptionMessage);
781 }
Jack Palevich560814f2009-11-19 16:34:55 +0800782}
783
784/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
785static void
786android_glDeleteBuffers__ILjava_nio_IntBuffer_2
787 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700788 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800789 const char * _exceptionType = NULL;
790 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800791 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700792 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800793 jint _remaining;
794 GLuint *buffers = (GLuint *) 0;
795
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700796 buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +0800797 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700798 _exception = 1;
799 _exceptionType = "java/lang/IllegalArgumentException";
800 _exceptionMessage = "remaining() < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +0800801 goto exit;
802 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700803 if (buffers == NULL) {
804 char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
805 buffers = (GLuint *) (_buffersBase + _bufferOffset);
806 }
Jack Palevich560814f2009-11-19 16:34:55 +0800807 glDeleteBuffers(
808 (GLsizei)n,
809 (GLuint *)buffers
810 );
811
812exit:
813 if (_array) {
814 releasePointer(_env, _array, buffers, JNI_FALSE);
815 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700816 if (_exception) {
817 jniThrowException(_env, _exceptionType, _exceptionMessage);
818 }
Jack Palevich560814f2009-11-19 16:34:55 +0800819}
820
821/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */
822static void
823android_glDeleteFramebuffers__I_3II
824 (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700825 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800826 const char * _exceptionType = NULL;
827 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800828 GLuint *framebuffers_base = (GLuint *) 0;
829 jint _remaining;
830 GLuint *framebuffers = (GLuint *) 0;
831
832 if (!framebuffers_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700833 _exception = 1;
834 _exceptionType = "java/lang/IllegalArgumentException";
835 _exceptionMessage = "framebuffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +0800836 goto exit;
837 }
838 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700839 _exception = 1;
840 _exceptionType = "java/lang/IllegalArgumentException";
841 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +0800842 goto exit;
843 }
844 _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -0800845 if (_remaining < n) {
846 _exception = 1;
847 _exceptionType = "java/lang/IllegalArgumentException";
848 _exceptionMessage = "length - offset < n < needed";
849 goto exit;
850 }
Jack Palevich560814f2009-11-19 16:34:55 +0800851 framebuffers_base = (GLuint *)
852 _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0);
853 framebuffers = framebuffers_base + offset;
854
855 glDeleteFramebuffers(
856 (GLsizei)n,
857 (GLuint *)framebuffers
858 );
859
860exit:
861 if (framebuffers_base) {
862 _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base,
863 JNI_ABORT);
864 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700865 if (_exception) {
866 jniThrowException(_env, _exceptionType, _exceptionMessage);
867 }
Jack Palevich560814f2009-11-19 16:34:55 +0800868}
869
870/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */
871static void
872android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2
873 (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -0800874 jint _exception = 0;
875 const char * _exceptionType = NULL;
876 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800877 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700878 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800879 jint _remaining;
880 GLuint *framebuffers = (GLuint *) 0;
881
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700882 framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -0800883 if (_remaining < n) {
884 _exception = 1;
885 _exceptionType = "java/lang/IllegalArgumentException";
886 _exceptionMessage = "remaining() < n < needed";
887 goto exit;
888 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700889 if (framebuffers == NULL) {
890 char * _framebuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
891 framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
892 }
Jack Palevich560814f2009-11-19 16:34:55 +0800893 glDeleteFramebuffers(
894 (GLsizei)n,
895 (GLuint *)framebuffers
896 );
Mathias Agopian15284de2013-02-23 03:12:30 -0800897
898exit:
Jack Palevich560814f2009-11-19 16:34:55 +0800899 if (_array) {
900 releasePointer(_env, _array, framebuffers, JNI_FALSE);
901 }
Mathias Agopian15284de2013-02-23 03:12:30 -0800902 if (_exception) {
903 jniThrowException(_env, _exceptionType, _exceptionMessage);
904 }
Jack Palevich560814f2009-11-19 16:34:55 +0800905}
906
907/* void glDeleteProgram ( GLuint program ) */
908static void
909android_glDeleteProgram__I
910 (JNIEnv *_env, jobject _this, jint program) {
911 glDeleteProgram(
912 (GLuint)program
913 );
914}
915
916/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */
917static void
918android_glDeleteRenderbuffers__I_3II
919 (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700920 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800921 const char * _exceptionType = NULL;
922 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800923 GLuint *renderbuffers_base = (GLuint *) 0;
924 jint _remaining;
925 GLuint *renderbuffers = (GLuint *) 0;
926
927 if (!renderbuffers_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700928 _exception = 1;
929 _exceptionType = "java/lang/IllegalArgumentException";
930 _exceptionMessage = "renderbuffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +0800931 goto exit;
932 }
933 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700934 _exception = 1;
935 _exceptionType = "java/lang/IllegalArgumentException";
936 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +0800937 goto exit;
938 }
939 _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -0800940 if (_remaining < n) {
941 _exception = 1;
942 _exceptionType = "java/lang/IllegalArgumentException";
943 _exceptionMessage = "length - offset < n < needed";
944 goto exit;
945 }
Jack Palevich560814f2009-11-19 16:34:55 +0800946 renderbuffers_base = (GLuint *)
947 _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0);
948 renderbuffers = renderbuffers_base + offset;
949
950 glDeleteRenderbuffers(
951 (GLsizei)n,
952 (GLuint *)renderbuffers
953 );
954
955exit:
956 if (renderbuffers_base) {
957 _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base,
958 JNI_ABORT);
959 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700960 if (_exception) {
961 jniThrowException(_env, _exceptionType, _exceptionMessage);
962 }
Jack Palevich560814f2009-11-19 16:34:55 +0800963}
964
965/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */
966static void
967android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2
968 (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -0800969 jint _exception = 0;
970 const char * _exceptionType = NULL;
971 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800972 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700973 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800974 jint _remaining;
975 GLuint *renderbuffers = (GLuint *) 0;
976
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700977 renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -0800978 if (_remaining < n) {
979 _exception = 1;
980 _exceptionType = "java/lang/IllegalArgumentException";
981 _exceptionMessage = "remaining() < n < needed";
982 goto exit;
983 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700984 if (renderbuffers == NULL) {
985 char * _renderbuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
986 renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
987 }
Jack Palevich560814f2009-11-19 16:34:55 +0800988 glDeleteRenderbuffers(
989 (GLsizei)n,
990 (GLuint *)renderbuffers
991 );
Mathias Agopian15284de2013-02-23 03:12:30 -0800992
993exit:
Jack Palevich560814f2009-11-19 16:34:55 +0800994 if (_array) {
995 releasePointer(_env, _array, renderbuffers, JNI_FALSE);
996 }
Mathias Agopian15284de2013-02-23 03:12:30 -0800997 if (_exception) {
998 jniThrowException(_env, _exceptionType, _exceptionMessage);
999 }
Jack Palevich560814f2009-11-19 16:34:55 +08001000}
1001
1002/* void glDeleteShader ( GLuint shader ) */
1003static void
1004android_glDeleteShader__I
1005 (JNIEnv *_env, jobject _this, jint shader) {
1006 glDeleteShader(
1007 (GLuint)shader
1008 );
1009}
1010
1011/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
1012static void
1013android_glDeleteTextures__I_3II
1014 (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001015 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001016 const char * _exceptionType = NULL;
1017 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001018 GLuint *textures_base = (GLuint *) 0;
1019 jint _remaining;
1020 GLuint *textures = (GLuint *) 0;
1021
1022 if (!textures_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001023 _exception = 1;
1024 _exceptionType = "java/lang/IllegalArgumentException";
1025 _exceptionMessage = "textures == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001026 goto exit;
1027 }
1028 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001029 _exception = 1;
1030 _exceptionType = "java/lang/IllegalArgumentException";
1031 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001032 goto exit;
1033 }
1034 _remaining = _env->GetArrayLength(textures_ref) - offset;
1035 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001036 _exception = 1;
1037 _exceptionType = "java/lang/IllegalArgumentException";
1038 _exceptionMessage = "length - offset < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001039 goto exit;
1040 }
1041 textures_base = (GLuint *)
1042 _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
1043 textures = textures_base + offset;
1044
1045 glDeleteTextures(
1046 (GLsizei)n,
1047 (GLuint *)textures
1048 );
1049
1050exit:
1051 if (textures_base) {
1052 _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
1053 JNI_ABORT);
1054 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001055 if (_exception) {
1056 jniThrowException(_env, _exceptionType, _exceptionMessage);
1057 }
Jack Palevich560814f2009-11-19 16:34:55 +08001058}
1059
1060/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
1061static void
1062android_glDeleteTextures__ILjava_nio_IntBuffer_2
1063 (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001064 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001065 const char * _exceptionType = NULL;
1066 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001067 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001068 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001069 jint _remaining;
1070 GLuint *textures = (GLuint *) 0;
1071
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001072 textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08001073 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001074 _exception = 1;
1075 _exceptionType = "java/lang/IllegalArgumentException";
1076 _exceptionMessage = "remaining() < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001077 goto exit;
1078 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001079 if (textures == NULL) {
1080 char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1081 textures = (GLuint *) (_texturesBase + _bufferOffset);
1082 }
Jack Palevich560814f2009-11-19 16:34:55 +08001083 glDeleteTextures(
1084 (GLsizei)n,
1085 (GLuint *)textures
1086 );
1087
1088exit:
1089 if (_array) {
1090 releasePointer(_env, _array, textures, JNI_FALSE);
1091 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001092 if (_exception) {
1093 jniThrowException(_env, _exceptionType, _exceptionMessage);
1094 }
Jack Palevich560814f2009-11-19 16:34:55 +08001095}
1096
1097/* void glDepthFunc ( GLenum func ) */
1098static void
1099android_glDepthFunc__I
1100 (JNIEnv *_env, jobject _this, jint func) {
1101 glDepthFunc(
1102 (GLenum)func
1103 );
1104}
1105
1106/* void glDepthMask ( GLboolean flag ) */
1107static void
1108android_glDepthMask__Z
1109 (JNIEnv *_env, jobject _this, jboolean flag) {
1110 glDepthMask(
1111 (GLboolean)flag
1112 );
1113}
1114
1115/* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */
1116static void
1117android_glDepthRangef__FF
1118 (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) {
1119 glDepthRangef(
1120 (GLclampf)zNear,
1121 (GLclampf)zFar
1122 );
1123}
1124
1125/* void glDetachShader ( GLuint program, GLuint shader ) */
1126static void
1127android_glDetachShader__II
1128 (JNIEnv *_env, jobject _this, jint program, jint shader) {
1129 glDetachShader(
1130 (GLuint)program,
1131 (GLuint)shader
1132 );
1133}
1134
1135/* void glDisable ( GLenum cap ) */
1136static void
1137android_glDisable__I
1138 (JNIEnv *_env, jobject _this, jint cap) {
1139 glDisable(
1140 (GLenum)cap
1141 );
1142}
1143
1144/* void glDisableVertexAttribArray ( GLuint index ) */
1145static void
1146android_glDisableVertexAttribArray__I
1147 (JNIEnv *_env, jobject _this, jint index) {
1148 glDisableVertexAttribArray(
1149 (GLuint)index
1150 );
1151}
1152
1153/* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */
1154static void
1155android_glDrawArrays__III
1156 (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) {
1157 glDrawArrays(
1158 (GLenum)mode,
1159 (GLint)first,
1160 (GLsizei)count
1161 );
1162}
1163
Jack Palevich224107a2010-06-22 20:08:40 +08001164/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */
1165static void
1166android_glDrawElements__IIII
1167 (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001168 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001169 const char * _exceptionType = NULL;
1170 const char * _exceptionMessage = NULL;
Jack Palevich224107a2010-06-22 20:08:40 +08001171 glDrawElements(
1172 (GLenum)mode,
1173 (GLsizei)count,
1174 (GLenum)type,
1175 (const GLvoid *)offset
1176 );
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001177 if (_exception) {
1178 jniThrowException(_env, _exceptionType, _exceptionMessage);
1179 }
Jack Palevich224107a2010-06-22 20:08:40 +08001180}
1181
Jack Palevich560814f2009-11-19 16:34:55 +08001182/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */
1183static void
1184android_glDrawElements__IIILjava_nio_Buffer_2
1185 (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001186 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001187 const char * _exceptionType = NULL;
1188 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001189 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001190 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001191 jint _remaining;
1192 GLvoid *indices = (GLvoid *) 0;
1193
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001194 indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08001195 if (_remaining < count) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001196 _exception = 1;
1197 _exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
1198 _exceptionMessage = "remaining() < count < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001199 goto exit;
1200 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001201 if (indices == NULL) {
1202 char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1203 indices = (GLvoid *) (_indicesBase + _bufferOffset);
1204 }
Jack Palevich560814f2009-11-19 16:34:55 +08001205 glDrawElements(
1206 (GLenum)mode,
1207 (GLsizei)count,
1208 (GLenum)type,
1209 (GLvoid *)indices
1210 );
1211
1212exit:
1213 if (_array) {
1214 releasePointer(_env, _array, indices, JNI_FALSE);
1215 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001216 if (_exception) {
1217 jniThrowException(_env, _exceptionType, _exceptionMessage);
1218 }
Jack Palevich560814f2009-11-19 16:34:55 +08001219}
1220
1221/* void glEnable ( GLenum cap ) */
1222static void
1223android_glEnable__I
1224 (JNIEnv *_env, jobject _this, jint cap) {
1225 glEnable(
1226 (GLenum)cap
1227 );
1228}
1229
1230/* void glEnableVertexAttribArray ( GLuint index ) */
1231static void
1232android_glEnableVertexAttribArray__I
1233 (JNIEnv *_env, jobject _this, jint index) {
1234 glEnableVertexAttribArray(
1235 (GLuint)index
1236 );
1237}
1238
1239/* void glFinish ( void ) */
1240static void
1241android_glFinish__
1242 (JNIEnv *_env, jobject _this) {
1243 glFinish();
1244}
1245
1246/* void glFlush ( void ) */
1247static void
1248android_glFlush__
1249 (JNIEnv *_env, jobject _this) {
1250 glFlush();
1251}
1252
1253/* void glFramebufferRenderbuffer ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) */
1254static void
1255android_glFramebufferRenderbuffer__IIII
1256 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint renderbuffertarget, jint renderbuffer) {
1257 glFramebufferRenderbuffer(
1258 (GLenum)target,
1259 (GLenum)attachment,
1260 (GLenum)renderbuffertarget,
1261 (GLuint)renderbuffer
1262 );
1263}
1264
1265/* void glFramebufferTexture2D ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) */
1266static void
1267android_glFramebufferTexture2D__IIIII
1268 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint textarget, jint texture, jint level) {
1269 glFramebufferTexture2D(
1270 (GLenum)target,
1271 (GLenum)attachment,
1272 (GLenum)textarget,
1273 (GLuint)texture,
1274 (GLint)level
1275 );
1276}
1277
1278/* void glFrontFace ( GLenum mode ) */
1279static void
1280android_glFrontFace__I
1281 (JNIEnv *_env, jobject _this, jint mode) {
1282 glFrontFace(
1283 (GLenum)mode
1284 );
1285}
1286
1287/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
1288static void
1289android_glGenBuffers__I_3II
1290 (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
1291 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001292 const char * _exceptionType = NULL;
1293 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001294 GLuint *buffers_base = (GLuint *) 0;
1295 jint _remaining;
1296 GLuint *buffers = (GLuint *) 0;
1297
1298 if (!buffers_ref) {
1299 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001300 _exceptionType = "java/lang/IllegalArgumentException";
1301 _exceptionMessage = "buffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001302 goto exit;
1303 }
1304 if (offset < 0) {
1305 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001306 _exceptionType = "java/lang/IllegalArgumentException";
1307 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001308 goto exit;
1309 }
1310 _remaining = _env->GetArrayLength(buffers_ref) - offset;
1311 if (_remaining < n) {
1312 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001313 _exceptionType = "java/lang/IllegalArgumentException";
1314 _exceptionMessage = "length - offset < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001315 goto exit;
1316 }
1317 buffers_base = (GLuint *)
1318 _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
1319 buffers = buffers_base + offset;
1320
1321 glGenBuffers(
1322 (GLsizei)n,
1323 (GLuint *)buffers
1324 );
1325
1326exit:
1327 if (buffers_base) {
1328 _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
1329 _exception ? JNI_ABORT: 0);
1330 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001331 if (_exception) {
1332 jniThrowException(_env, _exceptionType, _exceptionMessage);
1333 }
Jack Palevich560814f2009-11-19 16:34:55 +08001334}
1335
1336/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
1337static void
1338android_glGenBuffers__ILjava_nio_IntBuffer_2
1339 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
1340 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001341 const char * _exceptionType = NULL;
1342 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001343 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001344 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001345 jint _remaining;
1346 GLuint *buffers = (GLuint *) 0;
1347
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001348 buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08001349 if (_remaining < n) {
1350 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001351 _exceptionType = "java/lang/IllegalArgumentException";
1352 _exceptionMessage = "remaining() < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001353 goto exit;
1354 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001355 if (buffers == NULL) {
1356 char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1357 buffers = (GLuint *) (_buffersBase + _bufferOffset);
1358 }
Jack Palevich560814f2009-11-19 16:34:55 +08001359 glGenBuffers(
1360 (GLsizei)n,
1361 (GLuint *)buffers
1362 );
1363
1364exit:
1365 if (_array) {
1366 releasePointer(_env, _array, buffers, _exception ? JNI_FALSE : JNI_TRUE);
1367 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001368 if (_exception) {
1369 jniThrowException(_env, _exceptionType, _exceptionMessage);
1370 }
Jack Palevich560814f2009-11-19 16:34:55 +08001371}
1372
1373/* void glGenerateMipmap ( GLenum target ) */
1374static void
1375android_glGenerateMipmap__I
1376 (JNIEnv *_env, jobject _this, jint target) {
1377 glGenerateMipmap(
1378 (GLenum)target
1379 );
1380}
1381
1382/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */
1383static void
1384android_glGenFramebuffers__I_3II
1385 (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
1386 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001387 const char * _exceptionType = NULL;
1388 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001389 GLuint *framebuffers_base = (GLuint *) 0;
1390 jint _remaining;
1391 GLuint *framebuffers = (GLuint *) 0;
1392
1393 if (!framebuffers_ref) {
1394 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001395 _exceptionType = "java/lang/IllegalArgumentException";
1396 _exceptionMessage = "framebuffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001397 goto exit;
1398 }
1399 if (offset < 0) {
1400 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001401 _exceptionType = "java/lang/IllegalArgumentException";
1402 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001403 goto exit;
1404 }
1405 _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08001406 if (_remaining < n) {
1407 _exception = 1;
1408 _exceptionType = "java/lang/IllegalArgumentException";
1409 _exceptionMessage = "length - offset < n < needed";
1410 goto exit;
1411 }
Jack Palevich560814f2009-11-19 16:34:55 +08001412 framebuffers_base = (GLuint *)
1413 _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0);
1414 framebuffers = framebuffers_base + offset;
1415
1416 glGenFramebuffers(
1417 (GLsizei)n,
1418 (GLuint *)framebuffers
1419 );
1420
1421exit:
1422 if (framebuffers_base) {
1423 _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base,
1424 _exception ? JNI_ABORT: 0);
1425 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001426 if (_exception) {
1427 jniThrowException(_env, _exceptionType, _exceptionMessage);
1428 }
Jack Palevich560814f2009-11-19 16:34:55 +08001429}
1430
1431/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */
1432static void
1433android_glGenFramebuffers__ILjava_nio_IntBuffer_2
1434 (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08001435 jint _exception = 0;
1436 const char * _exceptionType = NULL;
1437 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001438 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001439 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001440 jint _remaining;
1441 GLuint *framebuffers = (GLuint *) 0;
1442
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001443 framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08001444 if (_remaining < n) {
1445 _exception = 1;
1446 _exceptionType = "java/lang/IllegalArgumentException";
1447 _exceptionMessage = "remaining() < n < needed";
1448 goto exit;
1449 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001450 if (framebuffers == NULL) {
1451 char * _framebuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1452 framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
1453 }
Jack Palevich560814f2009-11-19 16:34:55 +08001454 glGenFramebuffers(
1455 (GLsizei)n,
1456 (GLuint *)framebuffers
1457 );
Mathias Agopian15284de2013-02-23 03:12:30 -08001458
1459exit:
Jack Palevich560814f2009-11-19 16:34:55 +08001460 if (_array) {
Mathias Agopian15284de2013-02-23 03:12:30 -08001461 releasePointer(_env, _array, framebuffers, _exception ? JNI_FALSE : JNI_TRUE);
1462 }
1463 if (_exception) {
1464 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08001465 }
1466}
1467
1468/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */
1469static void
1470android_glGenRenderbuffers__I_3II
1471 (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
1472 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001473 const char * _exceptionType = NULL;
1474 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001475 GLuint *renderbuffers_base = (GLuint *) 0;
1476 jint _remaining;
1477 GLuint *renderbuffers = (GLuint *) 0;
1478
1479 if (!renderbuffers_ref) {
1480 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001481 _exceptionType = "java/lang/IllegalArgumentException";
1482 _exceptionMessage = "renderbuffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001483 goto exit;
1484 }
1485 if (offset < 0) {
1486 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001487 _exceptionType = "java/lang/IllegalArgumentException";
1488 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001489 goto exit;
1490 }
1491 _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08001492 if (_remaining < n) {
1493 _exception = 1;
1494 _exceptionType = "java/lang/IllegalArgumentException";
1495 _exceptionMessage = "length - offset < n < needed";
1496 goto exit;
1497 }
Jack Palevich560814f2009-11-19 16:34:55 +08001498 renderbuffers_base = (GLuint *)
1499 _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0);
1500 renderbuffers = renderbuffers_base + offset;
1501
1502 glGenRenderbuffers(
1503 (GLsizei)n,
1504 (GLuint *)renderbuffers
1505 );
1506
1507exit:
1508 if (renderbuffers_base) {
1509 _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base,
1510 _exception ? JNI_ABORT: 0);
1511 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001512 if (_exception) {
1513 jniThrowException(_env, _exceptionType, _exceptionMessage);
1514 }
Jack Palevich560814f2009-11-19 16:34:55 +08001515}
1516
1517/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */
1518static void
1519android_glGenRenderbuffers__ILjava_nio_IntBuffer_2
1520 (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08001521 jint _exception = 0;
1522 const char * _exceptionType = NULL;
1523 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001524 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001525 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001526 jint _remaining;
1527 GLuint *renderbuffers = (GLuint *) 0;
1528
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001529 renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08001530 if (_remaining < n) {
1531 _exception = 1;
1532 _exceptionType = "java/lang/IllegalArgumentException";
1533 _exceptionMessage = "remaining() < n < needed";
1534 goto exit;
1535 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001536 if (renderbuffers == NULL) {
1537 char * _renderbuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1538 renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
1539 }
Jack Palevich560814f2009-11-19 16:34:55 +08001540 glGenRenderbuffers(
1541 (GLsizei)n,
1542 (GLuint *)renderbuffers
1543 );
Mathias Agopian15284de2013-02-23 03:12:30 -08001544
1545exit:
Jack Palevich560814f2009-11-19 16:34:55 +08001546 if (_array) {
Mathias Agopian15284de2013-02-23 03:12:30 -08001547 releasePointer(_env, _array, renderbuffers, _exception ? JNI_FALSE : JNI_TRUE);
1548 }
1549 if (_exception) {
1550 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08001551 }
1552}
1553
1554/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1555static void
1556android_glGenTextures__I_3II
1557 (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
1558 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001559 const char * _exceptionType = NULL;
1560 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001561 GLuint *textures_base = (GLuint *) 0;
1562 jint _remaining;
1563 GLuint *textures = (GLuint *) 0;
1564
1565 if (!textures_ref) {
1566 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001567 _exceptionType = "java/lang/IllegalArgumentException";
1568 _exceptionMessage = "textures == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001569 goto exit;
1570 }
1571 if (offset < 0) {
1572 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001573 _exceptionType = "java/lang/IllegalArgumentException";
1574 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001575 goto exit;
1576 }
1577 _remaining = _env->GetArrayLength(textures_ref) - offset;
1578 if (_remaining < n) {
1579 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001580 _exceptionType = "java/lang/IllegalArgumentException";
1581 _exceptionMessage = "length - offset < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001582 goto exit;
1583 }
1584 textures_base = (GLuint *)
1585 _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
1586 textures = textures_base + offset;
1587
1588 glGenTextures(
1589 (GLsizei)n,
1590 (GLuint *)textures
1591 );
1592
1593exit:
1594 if (textures_base) {
1595 _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
1596 _exception ? JNI_ABORT: 0);
1597 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001598 if (_exception) {
1599 jniThrowException(_env, _exceptionType, _exceptionMessage);
1600 }
Jack Palevich560814f2009-11-19 16:34:55 +08001601}
1602
1603/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1604static void
1605android_glGenTextures__ILjava_nio_IntBuffer_2
1606 (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
1607 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001608 const char * _exceptionType = NULL;
1609 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001610 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001611 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001612 jint _remaining;
1613 GLuint *textures = (GLuint *) 0;
1614
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001615 textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08001616 if (_remaining < n) {
1617 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001618 _exceptionType = "java/lang/IllegalArgumentException";
1619 _exceptionMessage = "remaining() < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001620 goto exit;
1621 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001622 if (textures == NULL) {
1623 char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1624 textures = (GLuint *) (_texturesBase + _bufferOffset);
1625 }
Jack Palevich560814f2009-11-19 16:34:55 +08001626 glGenTextures(
1627 (GLsizei)n,
1628 (GLuint *)textures
1629 );
1630
1631exit:
1632 if (_array) {
1633 releasePointer(_env, _array, textures, _exception ? JNI_FALSE : JNI_TRUE);
1634 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001635 if (_exception) {
1636 jniThrowException(_env, _exceptionType, _exceptionMessage);
1637 }
Jack Palevich560814f2009-11-19 16:34:55 +08001638}
1639
1640/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1641static void
1642android_glGetActiveAttrib__III_3II_3II_3II_3BI
1643 (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) {
1644 jint _exception = 0;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001645 const char * _exceptionType;
1646 const char * _exceptionMessage;
Jack Palevich560814f2009-11-19 16:34:55 +08001647 GLsizei *length_base = (GLsizei *) 0;
1648 jint _lengthRemaining;
1649 GLsizei *length = (GLsizei *) 0;
1650 GLint *size_base = (GLint *) 0;
1651 jint _sizeRemaining;
1652 GLint *size = (GLint *) 0;
1653 GLenum *type_base = (GLenum *) 0;
1654 jint _typeRemaining;
1655 GLenum *type = (GLenum *) 0;
1656 char *name_base = (char *) 0;
1657 jint _nameRemaining;
1658 char *name = (char *) 0;
1659
1660 if (!length_ref) {
1661 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001662 _exceptionType = "java/lang/IllegalArgumentException";
1663 _exceptionMessage = "length == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001664 goto exit;
1665 }
1666 if (lengthOffset < 0) {
1667 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001668 _exceptionType = "java/lang/IllegalArgumentException";
1669 _exceptionMessage = "lengthOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001670 goto exit;
1671 }
1672 _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
1673 length_base = (GLsizei *)
1674 _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
1675 length = length_base + lengthOffset;
1676
1677 if (!size_ref) {
1678 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001679 _exceptionType = "java/lang/IllegalArgumentException";
1680 _exceptionMessage = "size == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001681 goto exit;
1682 }
1683 if (sizeOffset < 0) {
1684 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001685 _exceptionType = "java/lang/IllegalArgumentException";
1686 _exceptionMessage = "sizeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001687 goto exit;
1688 }
1689 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
1690 size_base = (GLint *)
1691 _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
1692 size = size_base + sizeOffset;
1693
1694 if (!type_ref) {
1695 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001696 _exceptionType = "java/lang/IllegalArgumentException";
1697 _exceptionMessage = "type == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001698 goto exit;
1699 }
1700 if (typeOffset < 0) {
1701 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001702 _exceptionType = "java/lang/IllegalArgumentException";
1703 _exceptionMessage = "typeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001704 goto exit;
1705 }
1706 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
1707 type_base = (GLenum *)
1708 _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
1709 type = type_base + typeOffset;
1710
1711 if (!name_ref) {
1712 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001713 _exceptionType = "java/lang/IllegalArgumentException";
1714 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001715 goto exit;
1716 }
1717 if (nameOffset < 0) {
1718 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001719 _exceptionType = "java/lang/IllegalArgumentException";
1720 _exceptionMessage = "nameOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001721 goto exit;
1722 }
1723 _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
1724 name_base = (char *)
1725 _env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0);
1726 name = name_base + nameOffset;
1727
1728 glGetActiveAttrib(
1729 (GLuint)program,
1730 (GLuint)index,
1731 (GLsizei)bufsize,
1732 (GLsizei *)length,
1733 (GLint *)size,
1734 (GLenum *)type,
1735 (char *)name
1736 );
1737
1738exit:
1739 if (name_base) {
1740 _env->ReleasePrimitiveArrayCritical(name_ref, name_base,
1741 _exception ? JNI_ABORT: 0);
1742 }
1743 if (type_base) {
1744 _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
1745 _exception ? JNI_ABORT: 0);
1746 }
1747 if (size_base) {
1748 _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
1749 _exception ? JNI_ABORT: 0);
1750 }
1751 if (length_base) {
1752 _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
1753 _exception ? JNI_ABORT: 0);
1754 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001755 if (_exception) {
1756 jniThrowException(_env, _exceptionType, _exceptionMessage);
1757 }
Jack Palevich560814f2009-11-19 16:34:55 +08001758}
1759
1760/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1761static void
1762android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
1763 (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
Jack Palevich560814f2009-11-19 16:34:55 +08001764 jarray _lengthArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001765 jint _lengthBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001766 jarray _sizeArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001767 jint _sizeBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001768 jarray _typeArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001769 jint _typeBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001770 jint _lengthRemaining;
1771 GLsizei *length = (GLsizei *) 0;
1772 jint _sizeRemaining;
1773 GLint *size = (GLint *) 0;
1774 jint _typeRemaining;
1775 GLenum *type = (GLenum *) 0;
1776
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001777 length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
1778 size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
1779 type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
1780 if (length == NULL) {
1781 char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0);
1782 length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
1783 }
1784 if (size == NULL) {
1785 char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
1786 size = (GLint *) (_sizeBase + _sizeBufferOffset);
1787 }
1788 if (type == NULL) {
1789 char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
1790 type = (GLenum *) (_typeBase + _typeBufferOffset);
1791 }
Jack Palevich560814f2009-11-19 16:34:55 +08001792 glGetActiveAttrib(
1793 (GLuint)program,
1794 (GLuint)index,
1795 (GLsizei)bufsize,
1796 (GLsizei *)length,
1797 (GLint *)size,
1798 (GLenum *)type,
1799 (char *)name
1800 );
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001801 if (_typeArray) {
1802 releasePointer(_env, _typeArray, type, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08001803 }
1804 if (_sizeArray) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001805 releasePointer(_env, _sizeArray, size, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08001806 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001807 if (_lengthArray) {
1808 releasePointer(_env, _lengthArray, length, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08001809 }
1810}
1811
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07001812/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1813static jstring
1814android_glGetActiveAttrib1
1815 (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
1816 jint _exception = 0;
1817 const char * _exceptionType;
1818 const char * _exceptionMessage;
1819 GLint *size_base = (GLint *) 0;
1820 jint _sizeRemaining;
1821 GLint *size = (GLint *) 0;
1822 GLenum *type_base = (GLenum *) 0;
1823 jint _typeRemaining;
1824 GLenum *type = (GLenum *) 0;
1825
1826 jstring result = 0;
1827
1828 GLint len = 0;
1829 glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
1830 if (!len) {
1831 return _env->NewStringUTF("");
1832 }
1833 char* buf = (char*) malloc(len);
1834
1835 if (buf == NULL) {
1836 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
1837 return NULL;
1838 }
1839 if (!size_ref) {
1840 _exception = 1;
1841 _exceptionType = "java/lang/IllegalArgumentException";
1842 _exceptionMessage = "size == null";
1843 goto exit;
1844 }
1845 if (sizeOffset < 0) {
1846 _exception = 1;
1847 _exceptionType = "java/lang/IllegalArgumentException";
1848 _exceptionMessage = "sizeOffset < 0";
1849 goto exit;
1850 }
1851 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
1852 size_base = (GLint *)
1853 _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
1854 size = size_base + sizeOffset;
1855
1856 if (!type_ref) {
1857 _exception = 1;
1858 _exceptionType = "java/lang/IllegalArgumentException";
1859 _exceptionMessage = "type == null";
1860 goto exit;
1861 }
1862 if (typeOffset < 0) {
1863 _exception = 1;
1864 _exceptionType = "java/lang/IllegalArgumentException";
1865 _exceptionMessage = "typeOffset < 0";
1866 goto exit;
1867 }
1868 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
1869 type_base = (GLenum *)
1870 _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
1871 type = type_base + typeOffset;
1872
1873 glGetActiveAttrib(
1874 (GLuint)program,
1875 (GLuint)index,
1876 (GLsizei)len,
1877 NULL,
1878 (GLint *)size,
1879 (GLenum *)type,
1880 (char *)buf
1881 );
1882exit:
1883 if (type_base) {
1884 _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
1885 _exception ? JNI_ABORT: 0);
1886 }
1887 if (size_base) {
1888 _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
1889 _exception ? JNI_ABORT: 0);
1890 }
1891 if (_exception != 1) {
1892 result = _env->NewStringUTF(buf);
1893 }
1894 if (buf) {
1895 free(buf);
1896 }
1897 if (_exception) {
1898 jniThrowException(_env, _exceptionType, _exceptionMessage);
1899 }
1900 if (result == 0) {
1901 result = _env->NewStringUTF("");
1902 }
1903
1904 return result;
1905}
1906
1907/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1908static jstring
1909android_glGetActiveAttrib2
1910 (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
1911 jarray _sizeArray = (jarray) 0;
1912 jint _sizeBufferOffset = (jint) 0;
1913 jarray _typeArray = (jarray) 0;
1914 jint _typeBufferOffset = (jint) 0;
1915 jint _lengthRemaining;
1916 GLsizei *length = (GLsizei *) 0;
1917 jint _sizeRemaining;
1918 GLint *size = (GLint *) 0;
1919 jint _typeRemaining;
1920 GLenum *type = (GLenum *) 0;
1921
1922 jstring result = 0;
1923
1924 GLint len = 0;
1925 glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
1926 if (!len) {
1927 return _env->NewStringUTF("");
1928 }
1929 char* buf = (char*) malloc(len);
1930
1931 if (buf == NULL) {
1932 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
1933 return NULL;
1934 }
1935
1936 size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
1937 type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
1938 if (size == NULL) {
1939 char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
1940 size = (GLint *) (_sizeBase + _sizeBufferOffset);
1941 }
1942 if (type == NULL) {
1943 char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
1944 type = (GLenum *) (_typeBase + _typeBufferOffset);
1945 }
1946 glGetActiveAttrib(
1947 (GLuint)program,
1948 (GLuint)index,
1949 (GLsizei)len,
1950 NULL,
1951 (GLint *)size,
1952 (GLenum *)type,
1953 (char *)buf
1954 );
1955
1956 if (_typeArray) {
1957 releasePointer(_env, _typeArray, type, JNI_TRUE);
1958 }
1959 if (_sizeArray) {
1960 releasePointer(_env, _sizeArray, size, JNI_TRUE);
1961 }
1962 result = _env->NewStringUTF(buf);
1963 if (buf) {
1964 free(buf);
1965 }
1966 return result;
1967}
Jack Palevich560814f2009-11-19 16:34:55 +08001968/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1969static void
1970android_glGetActiveUniform__III_3II_3II_3II_3BI
1971 (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) {
1972 jint _exception = 0;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001973 const char * _exceptionType;
1974 const char * _exceptionMessage;
Jack Palevich560814f2009-11-19 16:34:55 +08001975 GLsizei *length_base = (GLsizei *) 0;
1976 jint _lengthRemaining;
1977 GLsizei *length = (GLsizei *) 0;
1978 GLint *size_base = (GLint *) 0;
1979 jint _sizeRemaining;
1980 GLint *size = (GLint *) 0;
1981 GLenum *type_base = (GLenum *) 0;
1982 jint _typeRemaining;
1983 GLenum *type = (GLenum *) 0;
1984 char *name_base = (char *) 0;
1985 jint _nameRemaining;
1986 char *name = (char *) 0;
1987
1988 if (!length_ref) {
1989 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001990 _exceptionType = "java/lang/IllegalArgumentException";
1991 _exceptionMessage = "length == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001992 goto exit;
1993 }
1994 if (lengthOffset < 0) {
1995 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001996 _exceptionType = "java/lang/IllegalArgumentException";
1997 _exceptionMessage = "lengthOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001998 goto exit;
1999 }
2000 _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
2001 length_base = (GLsizei *)
2002 _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
2003 length = length_base + lengthOffset;
2004
2005 if (!size_ref) {
2006 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002007 _exceptionType = "java/lang/IllegalArgumentException";
2008 _exceptionMessage = "size == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002009 goto exit;
2010 }
2011 if (sizeOffset < 0) {
2012 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002013 _exceptionType = "java/lang/IllegalArgumentException";
2014 _exceptionMessage = "sizeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002015 goto exit;
2016 }
2017 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2018 size_base = (GLint *)
2019 _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
2020 size = size_base + sizeOffset;
2021
2022 if (!type_ref) {
2023 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002024 _exceptionType = "java/lang/IllegalArgumentException";
2025 _exceptionMessage = "type == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002026 goto exit;
2027 }
2028 if (typeOffset < 0) {
2029 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002030 _exceptionType = "java/lang/IllegalArgumentException";
2031 _exceptionMessage = "typeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002032 goto exit;
2033 }
2034 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2035 type_base = (GLenum *)
2036 _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
2037 type = type_base + typeOffset;
2038
2039 if (!name_ref) {
2040 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002041 _exceptionType = "java/lang/IllegalArgumentException";
2042 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002043 goto exit;
2044 }
2045 if (nameOffset < 0) {
2046 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002047 _exceptionType = "java/lang/IllegalArgumentException";
2048 _exceptionMessage = "nameOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002049 goto exit;
2050 }
2051 _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
2052 name_base = (char *)
2053 _env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0);
2054 name = name_base + nameOffset;
2055
2056 glGetActiveUniform(
2057 (GLuint)program,
2058 (GLuint)index,
2059 (GLsizei)bufsize,
2060 (GLsizei *)length,
2061 (GLint *)size,
2062 (GLenum *)type,
2063 (char *)name
2064 );
2065
2066exit:
2067 if (name_base) {
2068 _env->ReleasePrimitiveArrayCritical(name_ref, name_base,
2069 _exception ? JNI_ABORT: 0);
2070 }
2071 if (type_base) {
2072 _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
2073 _exception ? JNI_ABORT: 0);
2074 }
2075 if (size_base) {
2076 _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
2077 _exception ? JNI_ABORT: 0);
2078 }
2079 if (length_base) {
2080 _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
2081 _exception ? JNI_ABORT: 0);
2082 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002083 if (_exception) {
2084 jniThrowException(_env, _exceptionType, _exceptionMessage);
2085 }
Jack Palevich560814f2009-11-19 16:34:55 +08002086}
2087
2088/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2089static void
2090android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
2091 (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
Jack Palevich560814f2009-11-19 16:34:55 +08002092 jarray _lengthArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002093 jint _lengthBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002094 jarray _sizeArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002095 jint _sizeBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002096 jarray _typeArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002097 jint _typeBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002098 jint _lengthRemaining;
2099 GLsizei *length = (GLsizei *) 0;
2100 jint _sizeRemaining;
2101 GLint *size = (GLint *) 0;
2102 jint _typeRemaining;
2103 GLenum *type = (GLenum *) 0;
2104
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002105 length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
2106 size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
2107 type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
2108 if (length == NULL) {
2109 char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0);
2110 length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
2111 }
2112 if (size == NULL) {
2113 char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
2114 size = (GLint *) (_sizeBase + _sizeBufferOffset);
2115 }
2116 if (type == NULL) {
2117 char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
2118 type = (GLenum *) (_typeBase + _typeBufferOffset);
2119 }
Jack Palevich560814f2009-11-19 16:34:55 +08002120 glGetActiveUniform(
2121 (GLuint)program,
2122 (GLuint)index,
2123 (GLsizei)bufsize,
2124 (GLsizei *)length,
2125 (GLint *)size,
2126 (GLenum *)type,
2127 (char *)name
2128 );
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002129 if (_typeArray) {
2130 releasePointer(_env, _typeArray, type, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08002131 }
2132 if (_sizeArray) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002133 releasePointer(_env, _sizeArray, size, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08002134 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002135 if (_lengthArray) {
2136 releasePointer(_env, _lengthArray, length, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08002137 }
2138}
2139
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002140/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2141static jstring
2142android_glGetActiveUniform1
2143 (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
2144 jint _exception = 0;
2145 const char * _exceptionType;
2146 const char * _exceptionMessage;
2147
2148 GLint *size_base = (GLint *) 0;
2149 jint _sizeRemaining;
2150 GLint *size = (GLint *) 0;
2151
2152 GLenum *type_base = (GLenum *) 0;
2153 jint _typeRemaining;
2154 GLenum *type = (GLenum *) 0;
2155
2156 jstring result = 0;
2157
2158 GLint len = 0;
2159 glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
2160 if (!len) {
2161 return _env->NewStringUTF("");
2162 }
2163 char* buf = (char*) malloc(len);
2164
2165 if (buf == NULL) {
2166 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2167 return NULL;
2168 }
2169
2170 if (!size_ref) {
2171 _exception = 1;
2172 _exceptionType = "java/lang/IllegalArgumentException";
2173 _exceptionMessage = "size == null";
2174 goto exit;
2175 }
2176 if (sizeOffset < 0) {
2177 _exception = 1;
2178 _exceptionType = "java/lang/IllegalArgumentException";
2179 _exceptionMessage = "sizeOffset < 0";
2180 goto exit;
2181 }
2182 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2183 size_base = (GLint *)
2184 _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
2185 size = size_base + sizeOffset;
2186
2187 if (!type_ref) {
2188 _exception = 1;
2189 _exceptionType = "java/lang/IllegalArgumentException";
2190 _exceptionMessage = "type == null";
2191 goto exit;
2192 }
2193 if (typeOffset < 0) {
2194 _exception = 1;
2195 _exceptionType = "java/lang/IllegalArgumentException";
2196 _exceptionMessage = "typeOffset < 0";
2197 goto exit;
2198 }
2199 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2200 type_base = (GLenum *)
2201 _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
2202 type = type_base + typeOffset;
2203
2204 glGetActiveUniform(
2205 (GLuint)program,
2206 (GLuint)index,
2207 (GLsizei)len,
2208 NULL,
2209 (GLint *)size,
2210 (GLenum *)type,
2211 (char *)buf
2212 );
2213
2214exit:
2215 if (type_base) {
2216 _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
2217 _exception ? JNI_ABORT: 0);
2218 }
2219 if (size_base) {
2220 _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
2221 _exception ? JNI_ABORT: 0);
2222 }
2223 if (_exception != 1) {
2224 result = _env->NewStringUTF(buf);
2225 }
2226 if (buf) {
2227 free(buf);
2228 }
2229 if (_exception) {
2230 jniThrowException(_env, _exceptionType, _exceptionMessage);
2231 }
2232 if (result == 0) {
2233 result = _env->NewStringUTF("");
2234 }
2235 return result;
2236}
2237
2238/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2239static jstring
2240android_glGetActiveUniform2
2241 (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
2242 jarray _sizeArray = (jarray) 0;
2243 jint _sizeBufferOffset = (jint) 0;
2244 jarray _typeArray = (jarray) 0;
2245 jint _typeBufferOffset = (jint) 0;
2246 jint _sizeRemaining;
2247 GLint *size = (GLint *) 0;
2248 jint _typeRemaining;
2249 GLenum *type = (GLenum *) 0;
2250
2251 jstring result = 0;
2252 GLint len = 0;
2253 glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
2254 if (!len) {
2255 return _env->NewStringUTF("");
2256 }
2257 char* buf = (char*) malloc(len);
2258
2259 if (buf == NULL) {
2260 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2261 return NULL;
2262 }
2263
2264 size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
2265 type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
2266
2267 if (size == NULL) {
2268 char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
2269 size = (GLint *) (_sizeBase + _sizeBufferOffset);
2270 }
2271 if (type == NULL) {
2272 char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
2273 type = (GLenum *) (_typeBase + _typeBufferOffset);
2274 }
2275 glGetActiveUniform(
2276 (GLuint)program,
2277 (GLuint)index,
2278 len,
2279 NULL,
2280 (GLint *)size,
2281 (GLenum *)type,
2282 (char *)buf
2283 );
2284
2285 if (_typeArray) {
2286 releasePointer(_env, _typeArray, type, JNI_TRUE);
2287 }
2288 if (_sizeArray) {
2289 releasePointer(_env, _sizeArray, size, JNI_TRUE);
2290 }
2291 result = _env->NewStringUTF(buf);
2292 if (buf) {
2293 free(buf);
2294 }
2295 return result;
2296}
Jack Palevich560814f2009-11-19 16:34:55 +08002297/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */
2298static void
2299android_glGetAttachedShaders__II_3II_3II
2300 (JNIEnv *_env, jobject _this, jint program, jint maxcount, jintArray count_ref, jint countOffset, jintArray shaders_ref, jint shadersOffset) {
2301 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002302 const char * _exceptionType = NULL;
2303 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002304 GLsizei *count_base = (GLsizei *) 0;
2305 jint _countRemaining;
2306 GLsizei *count = (GLsizei *) 0;
2307 GLuint *shaders_base = (GLuint *) 0;
2308 jint _shadersRemaining;
2309 GLuint *shaders = (GLuint *) 0;
2310
2311 if (!count_ref) {
2312 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002313 _exceptionType = "java/lang/IllegalArgumentException";
2314 _exceptionMessage = "count == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002315 goto exit;
2316 }
2317 if (countOffset < 0) {
2318 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002319 _exceptionType = "java/lang/IllegalArgumentException";
2320 _exceptionMessage = "countOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002321 goto exit;
2322 }
2323 _countRemaining = _env->GetArrayLength(count_ref) - countOffset;
Mathias Agopian15284de2013-02-23 03:12:30 -08002324 if (_countRemaining < 1) {
2325 _exception = 1;
2326 _exceptionType = "java/lang/IllegalArgumentException";
2327 _exceptionMessage = "length - countOffset < 1 < needed";
2328 goto exit;
2329 }
Jack Palevich560814f2009-11-19 16:34:55 +08002330 count_base = (GLsizei *)
2331 _env->GetPrimitiveArrayCritical(count_ref, (jboolean *)0);
2332 count = count_base + countOffset;
2333
2334 if (!shaders_ref) {
2335 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002336 _exceptionType = "java/lang/IllegalArgumentException";
2337 _exceptionMessage = "shaders == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002338 goto exit;
2339 }
2340 if (shadersOffset < 0) {
2341 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002342 _exceptionType = "java/lang/IllegalArgumentException";
2343 _exceptionMessage = "shadersOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002344 goto exit;
2345 }
2346 _shadersRemaining = _env->GetArrayLength(shaders_ref) - shadersOffset;
Mathias Agopian15284de2013-02-23 03:12:30 -08002347 if (_shadersRemaining < maxcount) {
2348 _exception = 1;
2349 _exceptionType = "java/lang/IllegalArgumentException";
2350 _exceptionMessage = "length - shadersOffset < maxcount < needed";
2351 goto exit;
2352 }
Jack Palevich560814f2009-11-19 16:34:55 +08002353 shaders_base = (GLuint *)
2354 _env->GetPrimitiveArrayCritical(shaders_ref, (jboolean *)0);
2355 shaders = shaders_base + shadersOffset;
2356
2357 glGetAttachedShaders(
2358 (GLuint)program,
2359 (GLsizei)maxcount,
2360 (GLsizei *)count,
2361 (GLuint *)shaders
2362 );
2363
2364exit:
2365 if (shaders_base) {
2366 _env->ReleasePrimitiveArrayCritical(shaders_ref, shaders_base,
2367 _exception ? JNI_ABORT: 0);
2368 }
2369 if (count_base) {
2370 _env->ReleasePrimitiveArrayCritical(count_ref, count_base,
2371 _exception ? JNI_ABORT: 0);
2372 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002373 if (_exception) {
2374 jniThrowException(_env, _exceptionType, _exceptionMessage);
2375 }
Jack Palevich560814f2009-11-19 16:34:55 +08002376}
2377
2378/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */
2379static void
2380android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
2381 (JNIEnv *_env, jobject _this, jint program, jint maxcount, jobject count_buf, jobject shaders_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08002382 jint _exception = 0;
2383 const char * _exceptionType = NULL;
2384 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002385 jarray _countArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002386 jint _countBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002387 jarray _shadersArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002388 jint _shadersBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002389 jint _countRemaining;
2390 GLsizei *count = (GLsizei *) 0;
2391 jint _shadersRemaining;
2392 GLuint *shaders = (GLuint *) 0;
2393
Mathias Agopian15284de2013-02-23 03:12:30 -08002394 if (count_buf) {
2395 count = (GLsizei *)getPointer(_env, count_buf, &_countArray, &_countRemaining, &_countBufferOffset);
2396 if (_countRemaining < 1) {
2397 _exception = 1;
2398 _exceptionType = "java/lang/IllegalArgumentException";
2399 _exceptionMessage = "remaining() < 1 < needed";
2400 goto exit;
2401 }
2402 }
2403 if (shaders_buf) {
2404 shaders = (GLuint *)getPointer(_env, shaders_buf, &_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
2405 if (_shadersRemaining < maxcount) {
2406 _exception = 1;
2407 _exceptionType = "java/lang/IllegalArgumentException";
2408 _exceptionMessage = "remaining() < maxcount < needed";
2409 goto exit;
2410 }
2411 }
2412 if (count_buf && count == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002413 char * _countBase = (char *)_env->GetPrimitiveArrayCritical(_countArray, (jboolean *) 0);
2414 count = (GLsizei *) (_countBase + _countBufferOffset);
2415 }
Mathias Agopian15284de2013-02-23 03:12:30 -08002416 if (shaders_buf && shaders == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002417 char * _shadersBase = (char *)_env->GetPrimitiveArrayCritical(_shadersArray, (jboolean *) 0);
2418 shaders = (GLuint *) (_shadersBase + _shadersBufferOffset);
2419 }
Jack Palevich560814f2009-11-19 16:34:55 +08002420 glGetAttachedShaders(
2421 (GLuint)program,
2422 (GLsizei)maxcount,
2423 (GLsizei *)count,
2424 (GLuint *)shaders
2425 );
Mathias Agopian15284de2013-02-23 03:12:30 -08002426
2427exit:
Jack Palevich560814f2009-11-19 16:34:55 +08002428 if (_shadersArray) {
Mathias Agopian15284de2013-02-23 03:12:30 -08002429 releasePointer(_env, _shadersArray, shaders, _exception ? JNI_FALSE : JNI_TRUE);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002430 }
2431 if (_countArray) {
Mathias Agopian15284de2013-02-23 03:12:30 -08002432 releasePointer(_env, _countArray, count, _exception ? JNI_FALSE : JNI_TRUE);
2433 }
2434 if (_exception) {
2435 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08002436 }
2437}
2438
Mathias Agopian89be00b2013-02-22 20:08:06 -08002439/* GLint glGetAttribLocation ( GLuint program, const char *name ) */
Jack Palevich560814f2009-11-19 16:34:55 +08002440static jint
2441android_glGetAttribLocation__ILjava_lang_String_2
2442 (JNIEnv *_env, jobject _this, jint program, jstring name) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002443 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002444 const char * _exceptionType = NULL;
2445 const char * _exceptionMessage = NULL;
Mathias Agopian89be00b2013-02-22 20:08:06 -08002446 GLint _returnValue = 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002447 const char* _nativename = 0;
2448
2449 if (!name) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002450 _exceptionType = "java/lang/IllegalArgumentException";
2451 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002452 goto exit;
2453 }
2454 _nativename = _env->GetStringUTFChars(name, 0);
2455
2456 _returnValue = glGetAttribLocation(
2457 (GLuint)program,
2458 (char *)_nativename
2459 );
2460
2461exit:
2462 if (_nativename) {
2463 _env->ReleaseStringUTFChars(name, _nativename);
2464 }
2465
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002466 if (_exception) {
2467 jniThrowException(_env, _exceptionType, _exceptionMessage);
2468 }
Jack Palevich560814f2009-11-19 16:34:55 +08002469 return _returnValue;
2470}
2471
2472/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
2473static void
2474android_glGetBooleanv__I_3ZI
2475 (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
Mathias Agopian15284de2013-02-23 03:12:30 -08002476 get<jbooleanArray, GLboolean, glGetBooleanv>(_env, _this, pname, params_ref, offset);
Jack Palevich560814f2009-11-19 16:34:55 +08002477}
2478
2479/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
2480static void
2481android_glGetBooleanv__ILjava_nio_IntBuffer_2
2482 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08002483 getarray<GLboolean, glGetBooleanv>(_env, _this, pname, params_buf);
Jack Palevich560814f2009-11-19 16:34:55 +08002484}
Jack Palevich560814f2009-11-19 16:34:55 +08002485/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2486static void
2487android_glGetBufferParameteriv__II_3II
2488 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Jack Palevich73108672011-03-28 14:49:12 -07002489 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002490 const char * _exceptionType = NULL;
2491 const char * _exceptionMessage = NULL;
Jack Palevich73108672011-03-28 14:49:12 -07002492 GLint *params_base = (GLint *) 0;
2493 jint _remaining;
2494 GLint *params = (GLint *) 0;
2495
2496 if (!params_ref) {
2497 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002498 _exceptionType = "java/lang/IllegalArgumentException";
2499 _exceptionMessage = "params == null";
Jack Palevich73108672011-03-28 14:49:12 -07002500 goto exit;
2501 }
2502 if (offset < 0) {
2503 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002504 _exceptionType = "java/lang/IllegalArgumentException";
2505 _exceptionMessage = "offset < 0";
Jack Palevich73108672011-03-28 14:49:12 -07002506 goto exit;
2507 }
2508 _remaining = _env->GetArrayLength(params_ref) - offset;
2509 if (_remaining < 1) {
2510 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002511 _exceptionType = "java/lang/IllegalArgumentException";
2512 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich73108672011-03-28 14:49:12 -07002513 goto exit;
2514 }
2515 params_base = (GLint *)
2516 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2517 params = params_base + offset;
2518
2519 glGetBufferParameteriv(
2520 (GLenum)target,
2521 (GLenum)pname,
2522 (GLint *)params
2523 );
2524
2525exit:
2526 if (params_base) {
2527 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2528 _exception ? JNI_ABORT: 0);
2529 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002530 if (_exception) {
2531 jniThrowException(_env, _exceptionType, _exceptionMessage);
2532 }
Jack Palevich560814f2009-11-19 16:34:55 +08002533}
2534
2535/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2536static void
2537android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
2538 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Jack Palevich73108672011-03-28 14:49:12 -07002539 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002540 const char * _exceptionType = NULL;
2541 const char * _exceptionMessage = NULL;
Jack Palevich73108672011-03-28 14:49:12 -07002542 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002543 jint _bufferOffset = (jint) 0;
Jack Palevich73108672011-03-28 14:49:12 -07002544 jint _remaining;
2545 GLint *params = (GLint *) 0;
2546
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002547 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich73108672011-03-28 14:49:12 -07002548 if (_remaining < 1) {
2549 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002550 _exceptionType = "java/lang/IllegalArgumentException";
2551 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich73108672011-03-28 14:49:12 -07002552 goto exit;
2553 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002554 if (params == NULL) {
2555 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2556 params = (GLint *) (_paramsBase + _bufferOffset);
2557 }
Jack Palevich73108672011-03-28 14:49:12 -07002558 glGetBufferParameteriv(
2559 (GLenum)target,
2560 (GLenum)pname,
2561 (GLint *)params
2562 );
2563
2564exit:
2565 if (_array) {
2566 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2567 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002568 if (_exception) {
2569 jniThrowException(_env, _exceptionType, _exceptionMessage);
2570 }
Jack Palevich560814f2009-11-19 16:34:55 +08002571}
2572
2573/* GLenum glGetError ( void ) */
2574static jint
2575android_glGetError__
2576 (JNIEnv *_env, jobject _this) {
2577 GLenum _returnValue;
2578 _returnValue = glGetError();
2579 return _returnValue;
2580}
2581
2582/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
2583static void
2584android_glGetFloatv__I_3FI
2585 (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
Mathias Agopian15284de2013-02-23 03:12:30 -08002586 get<jfloatArray, GLfloat, glGetFloatv>(_env, _this, pname, params_ref, offset);
Jack Palevich560814f2009-11-19 16:34:55 +08002587}
2588
2589/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
2590static void
2591android_glGetFloatv__ILjava_nio_FloatBuffer_2
2592 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08002593 getarray<GLfloat, glGetFloatv>(_env, _this, pname, params_buf);
Jack Palevich560814f2009-11-19 16:34:55 +08002594}
Jack Palevich560814f2009-11-19 16:34:55 +08002595/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
2596static void
2597android_glGetFramebufferAttachmentParameteriv__III_3II
2598 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jintArray params_ref, jint offset) {
2599 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002600 const char * _exceptionType = NULL;
2601 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002602 GLint *params_base = (GLint *) 0;
2603 jint _remaining;
2604 GLint *params = (GLint *) 0;
2605
2606 if (!params_ref) {
2607 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002608 _exceptionType = "java/lang/IllegalArgumentException";
2609 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002610 goto exit;
2611 }
2612 if (offset < 0) {
2613 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002614 _exceptionType = "java/lang/IllegalArgumentException";
2615 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002616 goto exit;
2617 }
2618 _remaining = _env->GetArrayLength(params_ref) - offset;
2619 params_base = (GLint *)
2620 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2621 params = params_base + offset;
2622
2623 glGetFramebufferAttachmentParameteriv(
2624 (GLenum)target,
2625 (GLenum)attachment,
2626 (GLenum)pname,
2627 (GLint *)params
2628 );
2629
2630exit:
2631 if (params_base) {
2632 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2633 _exception ? JNI_ABORT: 0);
2634 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002635 if (_exception) {
2636 jniThrowException(_env, _exceptionType, _exceptionMessage);
2637 }
Jack Palevich560814f2009-11-19 16:34:55 +08002638}
2639
2640/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
2641static void
2642android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2
2643 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) {
Jack Palevich560814f2009-11-19 16:34:55 +08002644 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002645 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002646 jint _remaining;
2647 GLint *params = (GLint *) 0;
2648
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002649 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
2650 if (params == NULL) {
2651 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2652 params = (GLint *) (_paramsBase + _bufferOffset);
2653 }
Jack Palevich560814f2009-11-19 16:34:55 +08002654 glGetFramebufferAttachmentParameteriv(
2655 (GLenum)target,
2656 (GLenum)attachment,
2657 (GLenum)pname,
2658 (GLint *)params
2659 );
2660 if (_array) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002661 releasePointer(_env, _array, params, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08002662 }
2663}
2664
2665/* void glGetIntegerv ( GLenum pname, GLint *params ) */
2666static void
2667android_glGetIntegerv__I_3II
2668 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
Mathias Agopian15284de2013-02-23 03:12:30 -08002669 get<jintArray, GLint, glGetIntegerv>(_env, _this, pname, params_ref, offset);
Jack Palevich560814f2009-11-19 16:34:55 +08002670}
2671
2672/* void glGetIntegerv ( GLenum pname, GLint *params ) */
2673static void
2674android_glGetIntegerv__ILjava_nio_IntBuffer_2
2675 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08002676 getarray<GLint, glGetIntegerv>(_env, _this, pname, params_buf);
Jack Palevich560814f2009-11-19 16:34:55 +08002677}
2678
2679/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2680static void
2681android_glGetProgramiv__II_3II
2682 (JNIEnv *_env, jobject _this, jint program, jint pname, jintArray params_ref, jint offset) {
2683 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002684 const char * _exceptionType = NULL;
2685 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002686 GLint *params_base = (GLint *) 0;
2687 jint _remaining;
2688 GLint *params = (GLint *) 0;
2689
2690 if (!params_ref) {
2691 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002692 _exceptionType = "java/lang/IllegalArgumentException";
2693 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002694 goto exit;
2695 }
2696 if (offset < 0) {
2697 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002698 _exceptionType = "java/lang/IllegalArgumentException";
2699 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002700 goto exit;
2701 }
2702 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08002703 if (_remaining < 1) {
2704 _exception = 1;
2705 _exceptionType = "java/lang/IllegalArgumentException";
2706 _exceptionMessage = "length - offset < 1 < needed";
2707 goto exit;
2708 }
Jack Palevich560814f2009-11-19 16:34:55 +08002709 params_base = (GLint *)
2710 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2711 params = params_base + offset;
2712
2713 glGetProgramiv(
2714 (GLuint)program,
2715 (GLenum)pname,
2716 (GLint *)params
2717 );
2718
2719exit:
2720 if (params_base) {
2721 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2722 _exception ? JNI_ABORT: 0);
2723 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002724 if (_exception) {
2725 jniThrowException(_env, _exceptionType, _exceptionMessage);
2726 }
Jack Palevich560814f2009-11-19 16:34:55 +08002727}
2728
2729/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2730static void
2731android_glGetProgramiv__IILjava_nio_IntBuffer_2
2732 (JNIEnv *_env, jobject _this, jint program, jint pname, jobject params_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08002733 jint _exception = 0;
2734 const char * _exceptionType = NULL;
2735 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002736 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002737 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002738 jint _remaining;
2739 GLint *params = (GLint *) 0;
2740
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002741 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08002742 if (_remaining < 1) {
2743 _exception = 1;
2744 _exceptionType = "java/lang/IllegalArgumentException";
2745 _exceptionMessage = "remaining() < 1 < needed";
2746 goto exit;
2747 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002748 if (params == NULL) {
2749 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2750 params = (GLint *) (_paramsBase + _bufferOffset);
2751 }
Jack Palevich560814f2009-11-19 16:34:55 +08002752 glGetProgramiv(
2753 (GLuint)program,
2754 (GLenum)pname,
2755 (GLint *)params
2756 );
Mathias Agopian15284de2013-02-23 03:12:30 -08002757
2758exit:
Jack Palevich560814f2009-11-19 16:34:55 +08002759 if (_array) {
Mathias Agopian15284de2013-02-23 03:12:30 -08002760 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2761 }
2762 if (_exception) {
2763 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08002764 }
2765}
2766
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002767#include <stdlib.h>
Jack Palevich560814f2009-11-19 16:34:55 +08002768
2769/* void glGetProgramInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002770static jstring android_glGetProgramInfoLog(JNIEnv *_env, jobject, jint shader) {
Jack Palevich560814f2009-11-19 16:34:55 +08002771 GLint infoLen = 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002772 glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002773 if (!infoLen) {
2774 return _env->NewStringUTF("");
Jack Palevich560814f2009-11-19 16:34:55 +08002775 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002776 char* buf = (char*) malloc(infoLen);
2777 if (buf == NULL) {
2778 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2779 return NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002780 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002781 glGetProgramInfoLog(shader, infoLen, NULL, buf);
2782 jstring result = _env->NewStringUTF(buf);
2783 free(buf);
2784 return result;
Jack Palevich560814f2009-11-19 16:34:55 +08002785}
2786/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2787static void
2788android_glGetRenderbufferParameteriv__II_3II
2789 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2790 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002791 const char * _exceptionType = NULL;
2792 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002793 GLint *params_base = (GLint *) 0;
2794 jint _remaining;
2795 GLint *params = (GLint *) 0;
2796
2797 if (!params_ref) {
2798 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002799 _exceptionType = "java/lang/IllegalArgumentException";
2800 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002801 goto exit;
2802 }
2803 if (offset < 0) {
2804 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002805 _exceptionType = "java/lang/IllegalArgumentException";
2806 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002807 goto exit;
2808 }
2809 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08002810 if (_remaining < 1) {
2811 _exception = 1;
2812 _exceptionType = "java/lang/IllegalArgumentException";
2813 _exceptionMessage = "length - offset < 1 < needed";
2814 goto exit;
2815 }
Jack Palevich560814f2009-11-19 16:34:55 +08002816 params_base = (GLint *)
2817 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2818 params = params_base + offset;
2819
2820 glGetRenderbufferParameteriv(
2821 (GLenum)target,
2822 (GLenum)pname,
2823 (GLint *)params
2824 );
2825
2826exit:
2827 if (params_base) {
2828 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2829 _exception ? JNI_ABORT: 0);
2830 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002831 if (_exception) {
2832 jniThrowException(_env, _exceptionType, _exceptionMessage);
2833 }
Jack Palevich560814f2009-11-19 16:34:55 +08002834}
2835
2836/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2837static void
2838android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2
2839 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08002840 jint _exception = 0;
2841 const char * _exceptionType = NULL;
2842 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002843 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002844 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002845 jint _remaining;
2846 GLint *params = (GLint *) 0;
2847
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002848 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08002849 if (_remaining < 1) {
2850 _exception = 1;
2851 _exceptionType = "java/lang/IllegalArgumentException";
2852 _exceptionMessage = "remaining() < 1 < needed";
2853 goto exit;
2854 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002855 if (params == NULL) {
2856 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2857 params = (GLint *) (_paramsBase + _bufferOffset);
2858 }
Jack Palevich560814f2009-11-19 16:34:55 +08002859 glGetRenderbufferParameteriv(
2860 (GLenum)target,
2861 (GLenum)pname,
2862 (GLint *)params
2863 );
Mathias Agopian15284de2013-02-23 03:12:30 -08002864
2865exit:
Jack Palevich560814f2009-11-19 16:34:55 +08002866 if (_array) {
Mathias Agopian15284de2013-02-23 03:12:30 -08002867 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2868 }
2869 if (_exception) {
2870 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08002871 }
2872}
2873
2874/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
2875static void
2876android_glGetShaderiv__II_3II
2877 (JNIEnv *_env, jobject _this, jint shader, jint pname, jintArray params_ref, jint offset) {
2878 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002879 const char * _exceptionType = NULL;
2880 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002881 GLint *params_base = (GLint *) 0;
2882 jint _remaining;
2883 GLint *params = (GLint *) 0;
2884
2885 if (!params_ref) {
2886 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002887 _exceptionType = "java/lang/IllegalArgumentException";
2888 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002889 goto exit;
2890 }
2891 if (offset < 0) {
2892 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002893 _exceptionType = "java/lang/IllegalArgumentException";
2894 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002895 goto exit;
2896 }
2897 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08002898 if (_remaining < 1) {
2899 _exception = 1;
2900 _exceptionType = "java/lang/IllegalArgumentException";
2901 _exceptionMessage = "length - offset < 1 < needed";
2902 goto exit;
2903 }
Jack Palevich560814f2009-11-19 16:34:55 +08002904 params_base = (GLint *)
2905 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2906 params = params_base + offset;
2907
2908 glGetShaderiv(
2909 (GLuint)shader,
2910 (GLenum)pname,
2911 (GLint *)params
2912 );
2913
2914exit:
2915 if (params_base) {
2916 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2917 _exception ? JNI_ABORT: 0);
2918 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002919 if (_exception) {
2920 jniThrowException(_env, _exceptionType, _exceptionMessage);
2921 }
Jack Palevich560814f2009-11-19 16:34:55 +08002922}
2923
2924/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
2925static void
2926android_glGetShaderiv__IILjava_nio_IntBuffer_2
2927 (JNIEnv *_env, jobject _this, jint shader, jint pname, jobject params_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08002928 jint _exception = 0;
2929 const char * _exceptionType = NULL;
2930 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002931 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002932 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002933 jint _remaining;
2934 GLint *params = (GLint *) 0;
2935
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002936 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08002937 if (_remaining < 1) {
2938 _exception = 1;
2939 _exceptionType = "java/lang/IllegalArgumentException";
2940 _exceptionMessage = "remaining() < 1 < needed";
2941 goto exit;
2942 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002943 if (params == NULL) {
2944 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2945 params = (GLint *) (_paramsBase + _bufferOffset);
2946 }
Jack Palevich560814f2009-11-19 16:34:55 +08002947 glGetShaderiv(
2948 (GLuint)shader,
2949 (GLenum)pname,
2950 (GLint *)params
2951 );
Mathias Agopian15284de2013-02-23 03:12:30 -08002952
2953exit:
Jack Palevich560814f2009-11-19 16:34:55 +08002954 if (_array) {
Mathias Agopian15284de2013-02-23 03:12:30 -08002955 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2956 }
2957 if (_exception) {
2958 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08002959 }
2960}
2961
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002962#include <stdlib.h>
Jack Palevich560814f2009-11-19 16:34:55 +08002963
2964/* void glGetShaderInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002965static jstring android_glGetShaderInfoLog(JNIEnv *_env, jobject, jint shader) {
Jack Palevich560814f2009-11-19 16:34:55 +08002966 GLint infoLen = 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002967 glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002968 if (!infoLen) {
2969 return _env->NewStringUTF("");
Jack Palevich560814f2009-11-19 16:34:55 +08002970 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002971 char* buf = (char*) malloc(infoLen);
2972 if (buf == NULL) {
2973 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2974 return NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002975 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002976 glGetShaderInfoLog(shader, infoLen, NULL, buf);
2977 jstring result = _env->NewStringUTF(buf);
2978 free(buf);
2979 return result;
Jack Palevich560814f2009-11-19 16:34:55 +08002980}
2981/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
2982static void
2983android_glGetShaderPrecisionFormat__II_3II_3II
2984 (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jintArray range_ref, jint rangeOffset, jintArray precision_ref, jint precisionOffset) {
2985 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002986 const char * _exceptionType = NULL;
2987 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002988 GLint *range_base = (GLint *) 0;
2989 jint _rangeRemaining;
2990 GLint *range = (GLint *) 0;
2991 GLint *precision_base = (GLint *) 0;
2992 jint _precisionRemaining;
2993 GLint *precision = (GLint *) 0;
2994
2995 if (!range_ref) {
2996 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002997 _exceptionType = "java/lang/IllegalArgumentException";
2998 _exceptionMessage = "range == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002999 goto exit;
3000 }
3001 if (rangeOffset < 0) {
3002 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003003 _exceptionType = "java/lang/IllegalArgumentException";
3004 _exceptionMessage = "rangeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003005 goto exit;
3006 }
3007 _rangeRemaining = _env->GetArrayLength(range_ref) - rangeOffset;
Mathias Agopian15284de2013-02-23 03:12:30 -08003008 if (_rangeRemaining < 1) {
3009 _exception = 1;
3010 _exceptionType = "java/lang/IllegalArgumentException";
3011 _exceptionMessage = "length - rangeOffset < 1 < needed";
3012 goto exit;
3013 }
Jack Palevich560814f2009-11-19 16:34:55 +08003014 range_base = (GLint *)
3015 _env->GetPrimitiveArrayCritical(range_ref, (jboolean *)0);
3016 range = range_base + rangeOffset;
3017
3018 if (!precision_ref) {
3019 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003020 _exceptionType = "java/lang/IllegalArgumentException";
3021 _exceptionMessage = "precision == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003022 goto exit;
3023 }
3024 if (precisionOffset < 0) {
3025 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003026 _exceptionType = "java/lang/IllegalArgumentException";
3027 _exceptionMessage = "precisionOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003028 goto exit;
3029 }
3030 _precisionRemaining = _env->GetArrayLength(precision_ref) - precisionOffset;
Mathias Agopian15284de2013-02-23 03:12:30 -08003031 if (_precisionRemaining < 1) {
3032 _exception = 1;
3033 _exceptionType = "java/lang/IllegalArgumentException";
3034 _exceptionMessage = "length - precisionOffset < 1 < needed";
3035 goto exit;
3036 }
Jack Palevich560814f2009-11-19 16:34:55 +08003037 precision_base = (GLint *)
3038 _env->GetPrimitiveArrayCritical(precision_ref, (jboolean *)0);
3039 precision = precision_base + precisionOffset;
3040
3041 glGetShaderPrecisionFormat(
3042 (GLenum)shadertype,
3043 (GLenum)precisiontype,
3044 (GLint *)range,
3045 (GLint *)precision
3046 );
3047
3048exit:
3049 if (precision_base) {
3050 _env->ReleasePrimitiveArrayCritical(precision_ref, precision_base,
3051 _exception ? JNI_ABORT: 0);
3052 }
3053 if (range_base) {
3054 _env->ReleasePrimitiveArrayCritical(range_ref, range_base,
3055 _exception ? JNI_ABORT: 0);
3056 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003057 if (_exception) {
3058 jniThrowException(_env, _exceptionType, _exceptionMessage);
3059 }
Jack Palevich560814f2009-11-19 16:34:55 +08003060}
3061
3062/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
3063static void
3064android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
3065 (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jobject range_buf, jobject precision_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08003066 jint _exception = 0;
3067 const char * _exceptionType = NULL;
3068 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003069 jarray _rangeArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003070 jint _rangeBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003071 jarray _precisionArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003072 jint _precisionBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003073 jint _rangeRemaining;
3074 GLint *range = (GLint *) 0;
3075 jint _precisionRemaining;
3076 GLint *precision = (GLint *) 0;
3077
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003078 range = (GLint *)getPointer(_env, range_buf, &_rangeArray, &_rangeRemaining, &_rangeBufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08003079 if (_rangeRemaining < 1) {
3080 _exception = 1;
3081 _exceptionType = "java/lang/IllegalArgumentException";
3082 _exceptionMessage = "remaining() < 1 < needed";
3083 goto exit;
3084 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003085 precision = (GLint *)getPointer(_env, precision_buf, &_precisionArray, &_precisionRemaining, &_precisionBufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08003086 if (_precisionRemaining < 1) {
3087 _exception = 1;
3088 _exceptionType = "java/lang/IllegalArgumentException";
3089 _exceptionMessage = "remaining() < 1 < needed";
3090 goto exit;
3091 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003092 if (range == NULL) {
3093 char * _rangeBase = (char *)_env->GetPrimitiveArrayCritical(_rangeArray, (jboolean *) 0);
3094 range = (GLint *) (_rangeBase + _rangeBufferOffset);
3095 }
3096 if (precision == NULL) {
3097 char * _precisionBase = (char *)_env->GetPrimitiveArrayCritical(_precisionArray, (jboolean *) 0);
3098 precision = (GLint *) (_precisionBase + _precisionBufferOffset);
3099 }
Jack Palevich560814f2009-11-19 16:34:55 +08003100 glGetShaderPrecisionFormat(
3101 (GLenum)shadertype,
3102 (GLenum)precisiontype,
3103 (GLint *)range,
3104 (GLint *)precision
3105 );
Mathias Agopian15284de2013-02-23 03:12:30 -08003106
3107exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003108 if (_precisionArray) {
Mathias Agopian15284de2013-02-23 03:12:30 -08003109 releasePointer(_env, _precisionArray, precision, _exception ? JNI_FALSE : JNI_TRUE);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003110 }
3111 if (_rangeArray) {
Mathias Agopian15284de2013-02-23 03:12:30 -08003112 releasePointer(_env, _rangeArray, range, _exception ? JNI_FALSE : JNI_TRUE);
3113 }
3114 if (_exception) {
3115 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003116 }
3117}
3118
3119/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3120static void
3121android_glGetShaderSource__II_3II_3BI
3122 (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jintArray length_ref, jint lengthOffset, jbyteArray source_ref, jint sourceOffset) {
3123 jint _exception = 0;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003124 const char * _exceptionType;
3125 const char * _exceptionMessage;
Jack Palevich560814f2009-11-19 16:34:55 +08003126 GLsizei *length_base = (GLsizei *) 0;
3127 jint _lengthRemaining;
3128 GLsizei *length = (GLsizei *) 0;
3129 char *source_base = (char *) 0;
3130 jint _sourceRemaining;
3131 char *source = (char *) 0;
3132
3133 if (!length_ref) {
3134 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003135 _exceptionType = "java/lang/IllegalArgumentException";
3136 _exceptionMessage = "length == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003137 goto exit;
3138 }
3139 if (lengthOffset < 0) {
3140 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003141 _exceptionType = "java/lang/IllegalArgumentException";
3142 _exceptionMessage = "lengthOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003143 goto exit;
3144 }
3145 _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
3146 length_base = (GLsizei *)
3147 _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
3148 length = length_base + lengthOffset;
3149
3150 if (!source_ref) {
3151 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003152 _exceptionType = "java/lang/IllegalArgumentException";
3153 _exceptionMessage = "source == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003154 goto exit;
3155 }
3156 if (sourceOffset < 0) {
3157 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003158 _exceptionType = "java/lang/IllegalArgumentException";
3159 _exceptionMessage = "sourceOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003160 goto exit;
3161 }
3162 _sourceRemaining = _env->GetArrayLength(source_ref) - sourceOffset;
3163 source_base = (char *)
3164 _env->GetPrimitiveArrayCritical(source_ref, (jboolean *)0);
3165 source = source_base + sourceOffset;
3166
3167 glGetShaderSource(
3168 (GLuint)shader,
3169 (GLsizei)bufsize,
3170 (GLsizei *)length,
3171 (char *)source
3172 );
3173
3174exit:
3175 if (source_base) {
3176 _env->ReleasePrimitiveArrayCritical(source_ref, source_base,
3177 _exception ? JNI_ABORT: 0);
3178 }
3179 if (length_base) {
3180 _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
3181 _exception ? JNI_ABORT: 0);
3182 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003183 if (_exception) {
3184 jniThrowException(_env, _exceptionType, _exceptionMessage);
3185 }
Jack Palevich560814f2009-11-19 16:34:55 +08003186}
3187
3188/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3189static void
3190android_glGetShaderSource__IILjava_nio_IntBuffer_2B
3191 (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jobject length_buf, jbyte source) {
Jack Palevich560814f2009-11-19 16:34:55 +08003192 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003193 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003194 jint _remaining;
3195 GLsizei *length = (GLsizei *) 0;
3196
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003197 length = (GLsizei *)getPointer(_env, length_buf, &_array, &_remaining, &_bufferOffset);
3198 if (length == NULL) {
3199 char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3200 length = (GLsizei *) (_lengthBase + _bufferOffset);
3201 }
Jack Palevich560814f2009-11-19 16:34:55 +08003202 glGetShaderSource(
3203 (GLuint)shader,
3204 (GLsizei)bufsize,
3205 (GLsizei *)length,
3206 (char *)source
3207 );
3208 if (_array) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003209 releasePointer(_env, _array, length, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08003210 }
3211}
3212
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07003213/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3214static jstring android_glGetShaderSource(JNIEnv *_env, jobject, jint shader) {
3215 GLint shaderLen = 0;
3216 glGetShaderiv((GLuint)shader, GL_SHADER_SOURCE_LENGTH, &shaderLen);
3217 if (!shaderLen) {
3218 return _env->NewStringUTF("");
3219 }
3220 char* buf = (char*) malloc(shaderLen);
3221 if (buf == NULL) {
3222 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
3223 return NULL;
3224 }
3225 glGetShaderSource(shader, shaderLen, NULL, buf);
3226 jstring result = _env->NewStringUTF(buf);
3227 free(buf);
3228 return result;
3229}
Jack Palevich560814f2009-11-19 16:34:55 +08003230/* const GLubyte * glGetString ( GLenum name ) */
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003231static jstring android_glGetString(JNIEnv* _env, jobject, jint name) {
3232 const char* chars = (const char*) glGetString((GLenum) name);
3233 return _env->NewStringUTF(chars);
Jack Palevich560814f2009-11-19 16:34:55 +08003234}
3235/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
3236static void
3237android_glGetTexParameterfv__II_3FI
3238 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
3239 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08003240 const char * _exceptionType = NULL;
3241 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003242 GLfloat *params_base = (GLfloat *) 0;
3243 jint _remaining;
3244 GLfloat *params = (GLfloat *) 0;
3245
3246 if (!params_ref) {
3247 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003248 _exceptionType = "java/lang/IllegalArgumentException";
3249 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003250 goto exit;
3251 }
3252 if (offset < 0) {
3253 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003254 _exceptionType = "java/lang/IllegalArgumentException";
3255 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003256 goto exit;
3257 }
3258 _remaining = _env->GetArrayLength(params_ref) - offset;
3259 if (_remaining < 1) {
3260 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003261 _exceptionType = "java/lang/IllegalArgumentException";
3262 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08003263 goto exit;
3264 }
3265 params_base = (GLfloat *)
3266 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3267 params = params_base + offset;
3268
3269 glGetTexParameterfv(
3270 (GLenum)target,
3271 (GLenum)pname,
3272 (GLfloat *)params
3273 );
3274
3275exit:
3276 if (params_base) {
3277 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3278 _exception ? JNI_ABORT: 0);
3279 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003280 if (_exception) {
3281 jniThrowException(_env, _exceptionType, _exceptionMessage);
3282 }
Jack Palevich560814f2009-11-19 16:34:55 +08003283}
3284
3285/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
3286static void
3287android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2
3288 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3289 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08003290 const char * _exceptionType = NULL;
3291 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003292 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003293 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003294 jint _remaining;
3295 GLfloat *params = (GLfloat *) 0;
3296
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003297 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08003298 if (_remaining < 1) {
3299 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003300 _exceptionType = "java/lang/IllegalArgumentException";
3301 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08003302 goto exit;
3303 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003304 if (params == NULL) {
3305 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3306 params = (GLfloat *) (_paramsBase + _bufferOffset);
3307 }
Jack Palevich560814f2009-11-19 16:34:55 +08003308 glGetTexParameterfv(
3309 (GLenum)target,
3310 (GLenum)pname,
3311 (GLfloat *)params
3312 );
3313
3314exit:
3315 if (_array) {
3316 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3317 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003318 if (_exception) {
3319 jniThrowException(_env, _exceptionType, _exceptionMessage);
3320 }
Jack Palevich560814f2009-11-19 16:34:55 +08003321}
3322
3323/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3324static void
3325android_glGetTexParameteriv__II_3II
3326 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
3327 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08003328 const char * _exceptionType = NULL;
3329 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003330 GLint *params_base = (GLint *) 0;
3331 jint _remaining;
3332 GLint *params = (GLint *) 0;
3333
3334 if (!params_ref) {
3335 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003336 _exceptionType = "java/lang/IllegalArgumentException";
3337 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003338 goto exit;
3339 }
3340 if (offset < 0) {
3341 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003342 _exceptionType = "java/lang/IllegalArgumentException";
3343 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003344 goto exit;
3345 }
3346 _remaining = _env->GetArrayLength(params_ref) - offset;
3347 if (_remaining < 1) {
3348 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003349 _exceptionType = "java/lang/IllegalArgumentException";
3350 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08003351 goto exit;
3352 }
3353 params_base = (GLint *)
3354 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3355 params = params_base + offset;
3356
3357 glGetTexParameteriv(
3358 (GLenum)target,
3359 (GLenum)pname,
3360 (GLint *)params
3361 );
3362
3363exit:
3364 if (params_base) {
3365 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3366 _exception ? JNI_ABORT: 0);
3367 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003368 if (_exception) {
3369 jniThrowException(_env, _exceptionType, _exceptionMessage);
3370 }
Jack Palevich560814f2009-11-19 16:34:55 +08003371}
3372
3373/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3374static void
3375android_glGetTexParameteriv__IILjava_nio_IntBuffer_2
3376 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3377 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08003378 const char * _exceptionType = NULL;
3379 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003380 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003381 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003382 jint _remaining;
3383 GLint *params = (GLint *) 0;
3384
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003385 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08003386 if (_remaining < 1) {
3387 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003388 _exceptionType = "java/lang/IllegalArgumentException";
3389 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08003390 goto exit;
3391 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003392 if (params == NULL) {
3393 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3394 params = (GLint *) (_paramsBase + _bufferOffset);
3395 }
Jack Palevich560814f2009-11-19 16:34:55 +08003396 glGetTexParameteriv(
3397 (GLenum)target,
3398 (GLenum)pname,
3399 (GLint *)params
3400 );
3401
3402exit:
3403 if (_array) {
3404 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3405 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003406 if (_exception) {
3407 jniThrowException(_env, _exceptionType, _exceptionMessage);
3408 }
Jack Palevich560814f2009-11-19 16:34:55 +08003409}
3410
3411/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3412static void
3413android_glGetUniformfv__II_3FI
3414 (JNIEnv *_env, jobject _this, jint program, jint location, jfloatArray params_ref, jint offset) {
3415 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08003416 const char * _exceptionType = NULL;
3417 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003418 GLfloat *params_base = (GLfloat *) 0;
3419 jint _remaining;
3420 GLfloat *params = (GLfloat *) 0;
3421
3422 if (!params_ref) {
3423 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003424 _exceptionType = "java/lang/IllegalArgumentException";
3425 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003426 goto exit;
3427 }
3428 if (offset < 0) {
3429 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003430 _exceptionType = "java/lang/IllegalArgumentException";
3431 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003432 goto exit;
3433 }
3434 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08003435 if (_remaining < 1) {
3436 _exception = 1;
3437 _exceptionType = "java/lang/IllegalArgumentException";
3438 _exceptionMessage = "length - offset < 1 < needed";
3439 goto exit;
3440 }
Jack Palevich560814f2009-11-19 16:34:55 +08003441 params_base = (GLfloat *)
3442 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3443 params = params_base + offset;
3444
3445 glGetUniformfv(
3446 (GLuint)program,
3447 (GLint)location,
3448 (GLfloat *)params
3449 );
3450
3451exit:
3452 if (params_base) {
3453 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3454 _exception ? JNI_ABORT: 0);
3455 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003456 if (_exception) {
3457 jniThrowException(_env, _exceptionType, _exceptionMessage);
3458 }
Jack Palevich560814f2009-11-19 16:34:55 +08003459}
3460
3461/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3462static void
3463android_glGetUniformfv__IILjava_nio_FloatBuffer_2
3464 (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08003465 jint _exception = 0;
3466 const char * _exceptionType = NULL;
3467 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003468 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003469 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003470 jint _remaining;
3471 GLfloat *params = (GLfloat *) 0;
3472
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003473 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08003474 if (_remaining < 1) {
3475 _exception = 1;
3476 _exceptionType = "java/lang/IllegalArgumentException";
3477 _exceptionMessage = "remaining() < 1 < needed";
3478 goto exit;
3479 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003480 if (params == NULL) {
3481 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3482 params = (GLfloat *) (_paramsBase + _bufferOffset);
3483 }
Jack Palevich560814f2009-11-19 16:34:55 +08003484 glGetUniformfv(
3485 (GLuint)program,
3486 (GLint)location,
3487 (GLfloat *)params
3488 );
Mathias Agopian15284de2013-02-23 03:12:30 -08003489
3490exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003491 if (_array) {
Mathias Agopian15284de2013-02-23 03:12:30 -08003492 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3493 }
3494 if (_exception) {
3495 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003496 }
3497}
3498
3499/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3500static void
3501android_glGetUniformiv__II_3II
3502 (JNIEnv *_env, jobject _this, jint program, jint location, jintArray params_ref, jint offset) {
3503 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08003504 const char * _exceptionType = NULL;
3505 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003506 GLint *params_base = (GLint *) 0;
3507 jint _remaining;
3508 GLint *params = (GLint *) 0;
3509
3510 if (!params_ref) {
3511 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003512 _exceptionType = "java/lang/IllegalArgumentException";
3513 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003514 goto exit;
3515 }
3516 if (offset < 0) {
3517 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003518 _exceptionType = "java/lang/IllegalArgumentException";
3519 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003520 goto exit;
3521 }
3522 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08003523 if (_remaining < 1) {
3524 _exception = 1;
3525 _exceptionType = "java/lang/IllegalArgumentException";
3526 _exceptionMessage = "length - offset < 1 < needed";
3527 goto exit;
3528 }
Jack Palevich560814f2009-11-19 16:34:55 +08003529 params_base = (GLint *)
3530 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3531 params = params_base + offset;
3532
3533 glGetUniformiv(
3534 (GLuint)program,
3535 (GLint)location,
3536 (GLint *)params
3537 );
3538
3539exit:
3540 if (params_base) {
3541 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3542 _exception ? JNI_ABORT: 0);
3543 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003544 if (_exception) {
3545 jniThrowException(_env, _exceptionType, _exceptionMessage);
3546 }
Jack Palevich560814f2009-11-19 16:34:55 +08003547}
3548
3549/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3550static void
3551android_glGetUniformiv__IILjava_nio_IntBuffer_2
3552 (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08003553 jint _exception = 0;
3554 const char * _exceptionType = NULL;
3555 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003556 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003557 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003558 jint _remaining;
3559 GLint *params = (GLint *) 0;
3560
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003561 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08003562 if (_remaining < 1) {
3563 _exception = 1;
3564 _exceptionType = "java/lang/IllegalArgumentException";
3565 _exceptionMessage = "remaining() < 1 < needed";
3566 goto exit;
3567 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003568 if (params == NULL) {
3569 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3570 params = (GLint *) (_paramsBase + _bufferOffset);
3571 }
Jack Palevich560814f2009-11-19 16:34:55 +08003572 glGetUniformiv(
3573 (GLuint)program,
3574 (GLint)location,
3575 (GLint *)params
3576 );
Mathias Agopian15284de2013-02-23 03:12:30 -08003577
3578exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003579 if (_array) {
Mathias Agopian15284de2013-02-23 03:12:30 -08003580 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3581 }
3582 if (_exception) {
3583 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003584 }
3585}
3586
Mathias Agopian89be00b2013-02-22 20:08:06 -08003587/* GLint glGetUniformLocation ( GLuint program, const char *name ) */
Jack Palevich560814f2009-11-19 16:34:55 +08003588static jint
3589android_glGetUniformLocation__ILjava_lang_String_2
3590 (JNIEnv *_env, jobject _this, jint program, jstring name) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003591 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08003592 const char * _exceptionType = NULL;
3593 const char * _exceptionMessage = NULL;
Mathias Agopian89be00b2013-02-22 20:08:06 -08003594 GLint _returnValue = 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003595 const char* _nativename = 0;
3596
3597 if (!name) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003598 _exceptionType = "java/lang/IllegalArgumentException";
3599 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003600 goto exit;
3601 }
3602 _nativename = _env->GetStringUTFChars(name, 0);
3603
3604 _returnValue = glGetUniformLocation(
3605 (GLuint)program,
3606 (char *)_nativename
3607 );
3608
3609exit:
3610 if (_nativename) {
3611 _env->ReleaseStringUTFChars(name, _nativename);
3612 }
3613
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003614 if (_exception) {
3615 jniThrowException(_env, _exceptionType, _exceptionMessage);
3616 }
Jack Palevich560814f2009-11-19 16:34:55 +08003617 return _returnValue;
3618}
3619
3620/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3621static void
3622android_glGetVertexAttribfv__II_3FI
3623 (JNIEnv *_env, jobject _this, jint index, jint pname, jfloatArray params_ref, jint offset) {
3624 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08003625 const char * _exceptionType = NULL;
3626 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003627 GLfloat *params_base = (GLfloat *) 0;
3628 jint _remaining;
3629 GLfloat *params = (GLfloat *) 0;
3630
3631 if (!params_ref) {
3632 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003633 _exceptionType = "java/lang/IllegalArgumentException";
3634 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003635 goto exit;
3636 }
3637 if (offset < 0) {
3638 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003639 _exceptionType = "java/lang/IllegalArgumentException";
3640 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003641 goto exit;
3642 }
3643 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08003644 int _needed;
3645 switch (pname) {
3646#if defined(GL_CURRENT_VERTEX_ATTRIB)
3647 case GL_CURRENT_VERTEX_ATTRIB:
3648#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3649 _needed = 4;
3650 break;
3651 default:
3652 _needed = 1;
3653 break;
3654 }
3655 if (_remaining < _needed) {
3656 _exception = 1;
3657 _exceptionType = "java/lang/IllegalArgumentException";
3658 _exceptionMessage = "length - offset < needed";
3659 goto exit;
3660 }
Jack Palevich560814f2009-11-19 16:34:55 +08003661 params_base = (GLfloat *)
3662 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3663 params = params_base + offset;
3664
3665 glGetVertexAttribfv(
3666 (GLuint)index,
3667 (GLenum)pname,
3668 (GLfloat *)params
3669 );
3670
3671exit:
3672 if (params_base) {
3673 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3674 _exception ? JNI_ABORT: 0);
3675 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003676 if (_exception) {
3677 jniThrowException(_env, _exceptionType, _exceptionMessage);
3678 }
Jack Palevich560814f2009-11-19 16:34:55 +08003679}
3680
3681/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3682static void
3683android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2
3684 (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08003685 jint _exception = 0;
3686 const char * _exceptionType = NULL;
3687 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003688 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003689 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003690 jint _remaining;
3691 GLfloat *params = (GLfloat *) 0;
3692
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003693 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08003694 int _needed;
3695 switch (pname) {
3696#if defined(GL_CURRENT_VERTEX_ATTRIB)
3697 case GL_CURRENT_VERTEX_ATTRIB:
3698#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3699 _needed = 4;
3700 break;
3701 default:
3702 _needed = 1;
3703 break;
3704 }
3705 if (_remaining < _needed) {
3706 _exception = 1;
3707 _exceptionType = "java/lang/IllegalArgumentException";
3708 _exceptionMessage = "remaining() < needed";
3709 goto exit;
3710 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003711 if (params == NULL) {
3712 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3713 params = (GLfloat *) (_paramsBase + _bufferOffset);
3714 }
Jack Palevich560814f2009-11-19 16:34:55 +08003715 glGetVertexAttribfv(
3716 (GLuint)index,
3717 (GLenum)pname,
3718 (GLfloat *)params
3719 );
Mathias Agopian15284de2013-02-23 03:12:30 -08003720
3721exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003722 if (_array) {
Mathias Agopian15284de2013-02-23 03:12:30 -08003723 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3724 }
3725 if (_exception) {
3726 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003727 }
3728}
3729
3730/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
3731static void
3732android_glGetVertexAttribiv__II_3II
3733 (JNIEnv *_env, jobject _this, jint index, jint pname, jintArray params_ref, jint offset) {
3734 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08003735 const char * _exceptionType = NULL;
3736 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003737 GLint *params_base = (GLint *) 0;
3738 jint _remaining;
3739 GLint *params = (GLint *) 0;
3740
3741 if (!params_ref) {
3742 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003743 _exceptionType = "java/lang/IllegalArgumentException";
3744 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003745 goto exit;
3746 }
3747 if (offset < 0) {
3748 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003749 _exceptionType = "java/lang/IllegalArgumentException";
3750 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003751 goto exit;
3752 }
3753 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08003754 int _needed;
3755 switch (pname) {
3756#if defined(GL_CURRENT_VERTEX_ATTRIB)
3757 case GL_CURRENT_VERTEX_ATTRIB:
3758#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3759 _needed = 4;
3760 break;
3761 default:
3762 _needed = 1;
3763 break;
3764 }
3765 if (_remaining < _needed) {
3766 _exception = 1;
3767 _exceptionType = "java/lang/IllegalArgumentException";
3768 _exceptionMessage = "length - offset < needed";
3769 goto exit;
3770 }
Jack Palevich560814f2009-11-19 16:34:55 +08003771 params_base = (GLint *)
3772 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3773 params = params_base + offset;
3774
3775 glGetVertexAttribiv(
3776 (GLuint)index,
3777 (GLenum)pname,
3778 (GLint *)params
3779 );
3780
3781exit:
3782 if (params_base) {
3783 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3784 _exception ? JNI_ABORT: 0);
3785 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003786 if (_exception) {
3787 jniThrowException(_env, _exceptionType, _exceptionMessage);
3788 }
Jack Palevich560814f2009-11-19 16:34:55 +08003789}
3790
3791/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
3792static void
3793android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2
3794 (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08003795 jint _exception = 0;
3796 const char * _exceptionType = NULL;
3797 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003798 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003799 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003800 jint _remaining;
3801 GLint *params = (GLint *) 0;
3802
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003803 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08003804 int _needed;
3805 switch (pname) {
3806#if defined(GL_CURRENT_VERTEX_ATTRIB)
3807 case GL_CURRENT_VERTEX_ATTRIB:
3808#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3809 _needed = 4;
3810 break;
3811 default:
3812 _needed = 1;
3813 break;
3814 }
3815 if (_remaining < _needed) {
3816 _exception = 1;
3817 _exceptionType = "java/lang/IllegalArgumentException";
3818 _exceptionMessage = "remaining() < needed";
3819 goto exit;
3820 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003821 if (params == NULL) {
3822 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3823 params = (GLint *) (_paramsBase + _bufferOffset);
3824 }
Jack Palevich560814f2009-11-19 16:34:55 +08003825 glGetVertexAttribiv(
3826 (GLuint)index,
3827 (GLenum)pname,
3828 (GLint *)params
3829 );
Mathias Agopian15284de2013-02-23 03:12:30 -08003830
3831exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003832 if (_array) {
Mathias Agopian15284de2013-02-23 03:12:30 -08003833 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3834 }
3835 if (_exception) {
3836 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003837 }
3838}
3839
3840/* void glHint ( GLenum target, GLenum mode ) */
3841static void
3842android_glHint__II
3843 (JNIEnv *_env, jobject _this, jint target, jint mode) {
3844 glHint(
3845 (GLenum)target,
3846 (GLenum)mode
3847 );
3848}
3849
3850/* GLboolean glIsBuffer ( GLuint buffer ) */
3851static jboolean
3852android_glIsBuffer__I
3853 (JNIEnv *_env, jobject _this, jint buffer) {
3854 GLboolean _returnValue;
3855 _returnValue = glIsBuffer(
3856 (GLuint)buffer
3857 );
3858 return _returnValue;
3859}
3860
3861/* GLboolean glIsEnabled ( GLenum cap ) */
3862static jboolean
3863android_glIsEnabled__I
3864 (JNIEnv *_env, jobject _this, jint cap) {
3865 GLboolean _returnValue;
3866 _returnValue = glIsEnabled(
3867 (GLenum)cap
3868 );
3869 return _returnValue;
3870}
3871
3872/* GLboolean glIsFramebuffer ( GLuint framebuffer ) */
3873static jboolean
3874android_glIsFramebuffer__I
3875 (JNIEnv *_env, jobject _this, jint framebuffer) {
3876 GLboolean _returnValue;
3877 _returnValue = glIsFramebuffer(
3878 (GLuint)framebuffer
3879 );
3880 return _returnValue;
3881}
3882
3883/* GLboolean glIsProgram ( GLuint program ) */
3884static jboolean
3885android_glIsProgram__I
3886 (JNIEnv *_env, jobject _this, jint program) {
3887 GLboolean _returnValue;
3888 _returnValue = glIsProgram(
3889 (GLuint)program
3890 );
3891 return _returnValue;
3892}
3893
3894/* GLboolean glIsRenderbuffer ( GLuint renderbuffer ) */
3895static jboolean
3896android_glIsRenderbuffer__I
3897 (JNIEnv *_env, jobject _this, jint renderbuffer) {
3898 GLboolean _returnValue;
3899 _returnValue = glIsRenderbuffer(
3900 (GLuint)renderbuffer
3901 );
3902 return _returnValue;
3903}
3904
3905/* GLboolean glIsShader ( GLuint shader ) */
3906static jboolean
3907android_glIsShader__I
3908 (JNIEnv *_env, jobject _this, jint shader) {
3909 GLboolean _returnValue;
3910 _returnValue = glIsShader(
3911 (GLuint)shader
3912 );
3913 return _returnValue;
3914}
3915
3916/* GLboolean glIsTexture ( GLuint texture ) */
3917static jboolean
3918android_glIsTexture__I
3919 (JNIEnv *_env, jobject _this, jint texture) {
3920 GLboolean _returnValue;
3921 _returnValue = glIsTexture(
3922 (GLuint)texture
3923 );
3924 return _returnValue;
3925}
3926
3927/* void glLineWidth ( GLfloat width ) */
3928static void
3929android_glLineWidth__F
3930 (JNIEnv *_env, jobject _this, jfloat width) {
3931 glLineWidth(
3932 (GLfloat)width
3933 );
3934}
3935
3936/* void glLinkProgram ( GLuint program ) */
3937static void
3938android_glLinkProgram__I
3939 (JNIEnv *_env, jobject _this, jint program) {
3940 glLinkProgram(
3941 (GLuint)program
3942 );
3943}
3944
3945/* void glPixelStorei ( GLenum pname, GLint param ) */
3946static void
3947android_glPixelStorei__II
3948 (JNIEnv *_env, jobject _this, jint pname, jint param) {
3949 glPixelStorei(
3950 (GLenum)pname,
3951 (GLint)param
3952 );
3953}
3954
3955/* void glPolygonOffset ( GLfloat factor, GLfloat units ) */
3956static void
3957android_glPolygonOffset__FF
3958 (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) {
3959 glPolygonOffset(
3960 (GLfloat)factor,
3961 (GLfloat)units
3962 );
3963}
3964
3965/* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */
3966static void
3967android_glReadPixels__IIIIIILjava_nio_Buffer_2
3968 (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 +08003969 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003970 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003971 jint _remaining;
3972 GLvoid *pixels = (GLvoid *) 0;
3973
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003974 pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
3975 if (pixels == NULL) {
3976 char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3977 pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
3978 }
Jack Palevich560814f2009-11-19 16:34:55 +08003979 glReadPixels(
3980 (GLint)x,
3981 (GLint)y,
3982 (GLsizei)width,
3983 (GLsizei)height,
3984 (GLenum)format,
3985 (GLenum)type,
3986 (GLvoid *)pixels
3987 );
3988 if (_array) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003989 releasePointer(_env, _array, pixels, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08003990 }
3991}
3992
3993/* void glReleaseShaderCompiler ( void ) */
3994static void
3995android_glReleaseShaderCompiler__
3996 (JNIEnv *_env, jobject _this) {
3997 glReleaseShaderCompiler();
3998}
3999
4000/* void glRenderbufferStorage ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) */
4001static void
4002android_glRenderbufferStorage__IIII
4003 (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint width, jint height) {
4004 glRenderbufferStorage(
4005 (GLenum)target,
4006 (GLenum)internalformat,
4007 (GLsizei)width,
4008 (GLsizei)height
4009 );
4010}
4011
4012/* void glSampleCoverage ( GLclampf value, GLboolean invert ) */
4013static void
4014android_glSampleCoverage__FZ
4015 (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) {
4016 glSampleCoverage(
4017 (GLclampf)value,
4018 (GLboolean)invert
4019 );
4020}
4021
4022/* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */
4023static void
4024android_glScissor__IIII
4025 (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
4026 glScissor(
4027 (GLint)x,
4028 (GLint)y,
4029 (GLsizei)width,
4030 (GLsizei)height
4031 );
4032}
4033
4034/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
4035static void
4036android_glShaderBinary__I_3IIILjava_nio_Buffer_2I
4037 (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 -07004038 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08004039 const char * _exceptionType = NULL;
4040 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004041 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004042 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004043 GLuint *shaders_base = (GLuint *) 0;
4044 jint _shadersRemaining;
4045 GLuint *shaders = (GLuint *) 0;
4046 jint _binaryRemaining;
4047 GLvoid *binary = (GLvoid *) 0;
4048
4049 if (!shaders_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004050 _exception = 1;
4051 _exceptionType = "java/lang/IllegalArgumentException";
4052 _exceptionMessage = "shaders == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004053 goto exit;
4054 }
4055 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004056 _exception = 1;
4057 _exceptionType = "java/lang/IllegalArgumentException";
4058 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004059 goto exit;
4060 }
4061 _shadersRemaining = _env->GetArrayLength(shaders_ref) - offset;
4062 shaders_base = (GLuint *)
4063 _env->GetPrimitiveArrayCritical(shaders_ref, (jboolean *)0);
4064 shaders = shaders_base + offset;
4065
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004066 binary = (GLvoid *)getPointer(_env, binary_buf, &_array, &_binaryRemaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08004067 if (_binaryRemaining < length) {
4068 _exception = 1;
4069 _exceptionType = "java/lang/IllegalArgumentException";
4070 _exceptionMessage = "remaining() < length < needed";
4071 goto exit;
4072 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004073 if (binary == NULL) {
4074 char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4075 binary = (GLvoid *) (_binaryBase + _bufferOffset);
4076 }
Jack Palevich560814f2009-11-19 16:34:55 +08004077 glShaderBinary(
4078 (GLsizei)n,
4079 (GLuint *)shaders,
4080 (GLenum)binaryformat,
4081 (GLvoid *)binary,
4082 (GLsizei)length
4083 );
4084
4085exit:
4086 if (_array) {
4087 releasePointer(_env, _array, binary, JNI_FALSE);
4088 }
4089 if (shaders_base) {
4090 _env->ReleasePrimitiveArrayCritical(shaders_ref, shaders_base,
4091 JNI_ABORT);
4092 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004093 if (_exception) {
4094 jniThrowException(_env, _exceptionType, _exceptionMessage);
4095 }
Jack Palevich560814f2009-11-19 16:34:55 +08004096}
4097
4098/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
4099static void
4100android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I
4101 (JNIEnv *_env, jobject _this, jint n, jobject shaders_buf, jint binaryformat, jobject binary_buf, jint length) {
Mathias Agopian15284de2013-02-23 03:12:30 -08004102 jint _exception = 0;
4103 const char * _exceptionType = NULL;
4104 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004105 jarray _shadersArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004106 jint _shadersBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004107 jarray _binaryArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004108 jint _binaryBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004109 jint _shadersRemaining;
4110 GLuint *shaders = (GLuint *) 0;
4111 jint _binaryRemaining;
4112 GLvoid *binary = (GLvoid *) 0;
4113
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004114 shaders = (GLuint *)getPointer(_env, shaders_buf, &_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
4115 binary = (GLvoid *)getPointer(_env, binary_buf, &_binaryArray, &_binaryRemaining, &_binaryBufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08004116 if (_binaryRemaining < length) {
4117 _exception = 1;
4118 _exceptionType = "java/lang/IllegalArgumentException";
4119 _exceptionMessage = "remaining() < length < needed";
4120 goto exit;
4121 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004122 if (shaders == NULL) {
4123 char * _shadersBase = (char *)_env->GetPrimitiveArrayCritical(_shadersArray, (jboolean *) 0);
4124 shaders = (GLuint *) (_shadersBase + _shadersBufferOffset);
4125 }
4126 if (binary == NULL) {
4127 char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_binaryArray, (jboolean *) 0);
4128 binary = (GLvoid *) (_binaryBase + _binaryBufferOffset);
4129 }
Jack Palevich560814f2009-11-19 16:34:55 +08004130 glShaderBinary(
4131 (GLsizei)n,
4132 (GLuint *)shaders,
4133 (GLenum)binaryformat,
4134 (GLvoid *)binary,
4135 (GLsizei)length
4136 );
Mathias Agopian15284de2013-02-23 03:12:30 -08004137
4138exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004139 if (_binaryArray) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004140 releasePointer(_env, _binaryArray, binary, JNI_FALSE);
4141 }
4142 if (_shadersArray) {
4143 releasePointer(_env, _shadersArray, shaders, JNI_FALSE);
Jack Palevich560814f2009-11-19 16:34:55 +08004144 }
Mathias Agopian15284de2013-02-23 03:12:30 -08004145 if (_exception) {
4146 jniThrowException(_env, _exceptionType, _exceptionMessage);
4147 }
Jack Palevich560814f2009-11-19 16:34:55 +08004148}
4149
4150
4151/* void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint * length ) */
4152static
4153void
4154android_glShaderSource
4155 (JNIEnv *_env, jobject _this, jint shader, jstring string) {
4156
4157 if (!string) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07004158 jniThrowException(_env, "java/lang/IllegalArgumentException", "string == null");
Jack Palevich560814f2009-11-19 16:34:55 +08004159 return;
4160 }
4161
4162 const char* nativeString = _env->GetStringUTFChars(string, 0);
4163 const char* strings[] = {nativeString};
4164 glShaderSource(shader, 1, strings, 0);
4165 _env->ReleaseStringUTFChars(string, nativeString);
4166}
4167/* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */
4168static void
4169android_glStencilFunc__III
4170 (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) {
4171 glStencilFunc(
4172 (GLenum)func,
4173 (GLint)ref,
4174 (GLuint)mask
4175 );
4176}
4177
4178/* void glStencilFuncSeparate ( GLenum face, GLenum func, GLint ref, GLuint mask ) */
4179static void
4180android_glStencilFuncSeparate__IIII
4181 (JNIEnv *_env, jobject _this, jint face, jint func, jint ref, jint mask) {
4182 glStencilFuncSeparate(
4183 (GLenum)face,
4184 (GLenum)func,
4185 (GLint)ref,
4186 (GLuint)mask
4187 );
4188}
4189
4190/* void glStencilMask ( GLuint mask ) */
4191static void
4192android_glStencilMask__I
4193 (JNIEnv *_env, jobject _this, jint mask) {
4194 glStencilMask(
4195 (GLuint)mask
4196 );
4197}
4198
4199/* void glStencilMaskSeparate ( GLenum face, GLuint mask ) */
4200static void
4201android_glStencilMaskSeparate__II
4202 (JNIEnv *_env, jobject _this, jint face, jint mask) {
4203 glStencilMaskSeparate(
4204 (GLenum)face,
4205 (GLuint)mask
4206 );
4207}
4208
4209/* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */
4210static void
4211android_glStencilOp__III
4212 (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) {
4213 glStencilOp(
4214 (GLenum)fail,
4215 (GLenum)zfail,
4216 (GLenum)zpass
4217 );
4218}
4219
4220/* void glStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) */
4221static void
4222android_glStencilOpSeparate__IIII
4223 (JNIEnv *_env, jobject _this, jint face, jint fail, jint zfail, jint zpass) {
4224 glStencilOpSeparate(
4225 (GLenum)face,
4226 (GLenum)fail,
4227 (GLenum)zfail,
4228 (GLenum)zpass
4229 );
4230}
4231
4232/* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */
4233static void
4234android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2
4235 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) {
4236 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004237 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004238 jint _remaining;
4239 GLvoid *pixels = (GLvoid *) 0;
4240
4241 if (pixels_buf) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004242 pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
4243 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -07004244 if (pixels_buf && pixels == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004245 char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4246 pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08004247 }
4248 glTexImage2D(
4249 (GLenum)target,
4250 (GLint)level,
4251 (GLint)internalformat,
4252 (GLsizei)width,
4253 (GLsizei)height,
4254 (GLint)border,
4255 (GLenum)format,
4256 (GLenum)type,
4257 (GLvoid *)pixels
4258 );
4259 if (_array) {
4260 releasePointer(_env, _array, pixels, JNI_FALSE);
4261 }
4262}
4263
4264/* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */
4265static void
4266android_glTexParameterf__IIF
4267 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
4268 glTexParameterf(
4269 (GLenum)target,
4270 (GLenum)pname,
4271 (GLfloat)param
4272 );
4273}
4274
4275/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
4276static void
4277android_glTexParameterfv__II_3FI
4278 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004279 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08004280 const char * _exceptionType = NULL;
4281 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004282 GLfloat *params_base = (GLfloat *) 0;
4283 jint _remaining;
4284 GLfloat *params = (GLfloat *) 0;
4285
4286 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004287 _exception = 1;
4288 _exceptionType = "java/lang/IllegalArgumentException";
4289 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004290 goto exit;
4291 }
4292 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004293 _exception = 1;
4294 _exceptionType = "java/lang/IllegalArgumentException";
4295 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004296 goto exit;
4297 }
4298 _remaining = _env->GetArrayLength(params_ref) - offset;
4299 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004300 _exception = 1;
4301 _exceptionType = "java/lang/IllegalArgumentException";
4302 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08004303 goto exit;
4304 }
4305 params_base = (GLfloat *)
4306 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
4307 params = params_base + offset;
4308
4309 glTexParameterfv(
4310 (GLenum)target,
4311 (GLenum)pname,
4312 (GLfloat *)params
4313 );
4314
4315exit:
4316 if (params_base) {
4317 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
4318 JNI_ABORT);
4319 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004320 if (_exception) {
4321 jniThrowException(_env, _exceptionType, _exceptionMessage);
4322 }
Jack Palevich560814f2009-11-19 16:34:55 +08004323}
4324
4325/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
4326static void
4327android_glTexParameterfv__IILjava_nio_FloatBuffer_2
4328 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004329 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08004330 const char * _exceptionType = NULL;
4331 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004332 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004333 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004334 jint _remaining;
4335 GLfloat *params = (GLfloat *) 0;
4336
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004337 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08004338 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004339 _exception = 1;
4340 _exceptionType = "java/lang/IllegalArgumentException";
4341 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08004342 goto exit;
4343 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004344 if (params == NULL) {
4345 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4346 params = (GLfloat *) (_paramsBase + _bufferOffset);
4347 }
Jack Palevich560814f2009-11-19 16:34:55 +08004348 glTexParameterfv(
4349 (GLenum)target,
4350 (GLenum)pname,
4351 (GLfloat *)params
4352 );
4353
4354exit:
4355 if (_array) {
4356 releasePointer(_env, _array, params, JNI_FALSE);
4357 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004358 if (_exception) {
4359 jniThrowException(_env, _exceptionType, _exceptionMessage);
4360 }
Jack Palevich560814f2009-11-19 16:34:55 +08004361}
4362
4363/* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */
4364static void
4365android_glTexParameteri__III
4366 (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
4367 glTexParameteri(
4368 (GLenum)target,
4369 (GLenum)pname,
4370 (GLint)param
4371 );
4372}
4373
4374/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
4375static void
4376android_glTexParameteriv__II_3II
4377 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004378 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08004379 const char * _exceptionType = NULL;
4380 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004381 GLint *params_base = (GLint *) 0;
4382 jint _remaining;
4383 GLint *params = (GLint *) 0;
4384
4385 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004386 _exception = 1;
4387 _exceptionType = "java/lang/IllegalArgumentException";
4388 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004389 goto exit;
4390 }
4391 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004392 _exception = 1;
4393 _exceptionType = "java/lang/IllegalArgumentException";
4394 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004395 goto exit;
4396 }
4397 _remaining = _env->GetArrayLength(params_ref) - offset;
4398 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004399 _exception = 1;
4400 _exceptionType = "java/lang/IllegalArgumentException";
4401 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08004402 goto exit;
4403 }
4404 params_base = (GLint *)
4405 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
4406 params = params_base + offset;
4407
4408 glTexParameteriv(
4409 (GLenum)target,
4410 (GLenum)pname,
4411 (GLint *)params
4412 );
4413
4414exit:
4415 if (params_base) {
4416 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
4417 JNI_ABORT);
4418 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004419 if (_exception) {
4420 jniThrowException(_env, _exceptionType, _exceptionMessage);
4421 }
Jack Palevich560814f2009-11-19 16:34:55 +08004422}
4423
4424/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
4425static void
4426android_glTexParameteriv__IILjava_nio_IntBuffer_2
4427 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004428 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08004429 const char * _exceptionType = NULL;
4430 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004431 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004432 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004433 jint _remaining;
4434 GLint *params = (GLint *) 0;
4435
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004436 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08004437 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004438 _exception = 1;
4439 _exceptionType = "java/lang/IllegalArgumentException";
4440 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08004441 goto exit;
4442 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004443 if (params == NULL) {
4444 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4445 params = (GLint *) (_paramsBase + _bufferOffset);
4446 }
Jack Palevich560814f2009-11-19 16:34:55 +08004447 glTexParameteriv(
4448 (GLenum)target,
4449 (GLenum)pname,
4450 (GLint *)params
4451 );
4452
4453exit:
4454 if (_array) {
4455 releasePointer(_env, _array, params, JNI_FALSE);
4456 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004457 if (_exception) {
4458 jniThrowException(_env, _exceptionType, _exceptionMessage);
4459 }
Jack Palevich560814f2009-11-19 16:34:55 +08004460}
4461
4462/* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */
4463static void
4464android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
4465 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) {
4466 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004467 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004468 jint _remaining;
4469 GLvoid *pixels = (GLvoid *) 0;
4470
4471 if (pixels_buf) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004472 pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
4473 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -07004474 if (pixels_buf && pixels == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004475 char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4476 pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08004477 }
4478 glTexSubImage2D(
4479 (GLenum)target,
4480 (GLint)level,
4481 (GLint)xoffset,
4482 (GLint)yoffset,
4483 (GLsizei)width,
4484 (GLsizei)height,
4485 (GLenum)format,
4486 (GLenum)type,
4487 (GLvoid *)pixels
4488 );
4489 if (_array) {
4490 releasePointer(_env, _array, pixels, JNI_FALSE);
4491 }
4492}
4493
4494/* void glUniform1f ( GLint location, GLfloat x ) */
4495static void
4496android_glUniform1f__IF
4497 (JNIEnv *_env, jobject _this, jint location, jfloat x) {
4498 glUniform1f(
4499 (GLint)location,
4500 (GLfloat)x
4501 );
4502}
4503
4504/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
4505static void
4506android_glUniform1fv__II_3FI
4507 (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004508 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08004509 const char * _exceptionType = NULL;
4510 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004511 GLfloat *v_base = (GLfloat *) 0;
4512 jint _remaining;
4513 GLfloat *v = (GLfloat *) 0;
4514
4515 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004516 _exception = 1;
4517 _exceptionType = "java/lang/IllegalArgumentException";
4518 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004519 goto exit;
4520 }
4521 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004522 _exception = 1;
4523 _exceptionType = "java/lang/IllegalArgumentException";
4524 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004525 goto exit;
4526 }
4527 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08004528 if (_remaining < count) {
4529 _exception = 1;
4530 _exceptionType = "java/lang/IllegalArgumentException";
4531 _exceptionMessage = "length - offset < count < needed";
4532 goto exit;
4533 }
Jack Palevich560814f2009-11-19 16:34:55 +08004534 v_base = (GLfloat *)
4535 _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4536 v = v_base + offset;
4537
4538 glUniform1fv(
4539 (GLint)location,
4540 (GLsizei)count,
4541 (GLfloat *)v
4542 );
4543
4544exit:
4545 if (v_base) {
4546 _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4547 JNI_ABORT);
4548 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004549 if (_exception) {
4550 jniThrowException(_env, _exceptionType, _exceptionMessage);
4551 }
Jack Palevich560814f2009-11-19 16:34:55 +08004552}
4553
4554/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
4555static void
4556android_glUniform1fv__IILjava_nio_FloatBuffer_2
4557 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08004558 jint _exception = 0;
4559 const char * _exceptionType = NULL;
4560 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004561 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004562 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004563 jint _remaining;
4564 GLfloat *v = (GLfloat *) 0;
4565
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004566 v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08004567 if (_remaining < count) {
4568 _exception = 1;
4569 _exceptionType = "java/lang/IllegalArgumentException";
4570 _exceptionMessage = "remaining() < count < needed";
4571 goto exit;
4572 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004573 if (v == NULL) {
4574 char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4575 v = (GLfloat *) (_vBase + _bufferOffset);
4576 }
Jack Palevich560814f2009-11-19 16:34:55 +08004577 glUniform1fv(
4578 (GLint)location,
4579 (GLsizei)count,
4580 (GLfloat *)v
4581 );
Mathias Agopian15284de2013-02-23 03:12:30 -08004582
4583exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004584 if (_array) {
4585 releasePointer(_env, _array, v, JNI_FALSE);
4586 }
Mathias Agopian15284de2013-02-23 03:12:30 -08004587 if (_exception) {
4588 jniThrowException(_env, _exceptionType, _exceptionMessage);
4589 }
Jack Palevich560814f2009-11-19 16:34:55 +08004590}
4591
4592/* void glUniform1i ( GLint location, GLint x ) */
4593static void
4594android_glUniform1i__II
4595 (JNIEnv *_env, jobject _this, jint location, jint x) {
4596 glUniform1i(
4597 (GLint)location,
4598 (GLint)x
4599 );
4600}
4601
4602/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
4603static void
4604android_glUniform1iv__II_3II
4605 (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004606 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08004607 const char * _exceptionType = NULL;
4608 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004609 GLint *v_base = (GLint *) 0;
4610 jint _remaining;
4611 GLint *v = (GLint *) 0;
4612
4613 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004614 _exception = 1;
4615 _exceptionType = "java/lang/IllegalArgumentException";
4616 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004617 goto exit;
4618 }
4619 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004620 _exception = 1;
4621 _exceptionType = "java/lang/IllegalArgumentException";
4622 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004623 goto exit;
4624 }
4625 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08004626 if (_remaining < count) {
4627 _exception = 1;
4628 _exceptionType = "java/lang/IllegalArgumentException";
4629 _exceptionMessage = "length - offset < count < needed";
4630 goto exit;
4631 }
Jack Palevich560814f2009-11-19 16:34:55 +08004632 v_base = (GLint *)
4633 _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4634 v = v_base + offset;
4635
4636 glUniform1iv(
4637 (GLint)location,
4638 (GLsizei)count,
4639 (GLint *)v
4640 );
4641
4642exit:
4643 if (v_base) {
4644 _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4645 JNI_ABORT);
4646 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004647 if (_exception) {
4648 jniThrowException(_env, _exceptionType, _exceptionMessage);
4649 }
Jack Palevich560814f2009-11-19 16:34:55 +08004650}
4651
4652/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
4653static void
4654android_glUniform1iv__IILjava_nio_IntBuffer_2
4655 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08004656 jint _exception = 0;
4657 const char * _exceptionType = NULL;
4658 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004659 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004660 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004661 jint _remaining;
4662 GLint *v = (GLint *) 0;
4663
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004664 v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08004665 if (_remaining < count) {
4666 _exception = 1;
4667 _exceptionType = "java/lang/IllegalArgumentException";
4668 _exceptionMessage = "remaining() < count < needed";
4669 goto exit;
4670 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004671 if (v == NULL) {
4672 char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4673 v = (GLint *) (_vBase + _bufferOffset);
4674 }
Jack Palevich560814f2009-11-19 16:34:55 +08004675 glUniform1iv(
4676 (GLint)location,
4677 (GLsizei)count,
4678 (GLint *)v
4679 );
Mathias Agopian15284de2013-02-23 03:12:30 -08004680
4681exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004682 if (_array) {
4683 releasePointer(_env, _array, v, JNI_FALSE);
4684 }
Mathias Agopian15284de2013-02-23 03:12:30 -08004685 if (_exception) {
4686 jniThrowException(_env, _exceptionType, _exceptionMessage);
4687 }
Jack Palevich560814f2009-11-19 16:34:55 +08004688}
4689
4690/* void glUniform2f ( GLint location, GLfloat x, GLfloat y ) */
4691static void
4692android_glUniform2f__IFF
4693 (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y) {
4694 glUniform2f(
4695 (GLint)location,
4696 (GLfloat)x,
4697 (GLfloat)y
4698 );
4699}
4700
4701/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
4702static void
4703android_glUniform2fv__II_3FI
4704 (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004705 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08004706 const char * _exceptionType = NULL;
4707 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004708 GLfloat *v_base = (GLfloat *) 0;
4709 jint _remaining;
4710 GLfloat *v = (GLfloat *) 0;
4711
4712 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004713 _exception = 1;
4714 _exceptionType = "java/lang/IllegalArgumentException";
4715 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004716 goto exit;
4717 }
4718 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004719 _exception = 1;
4720 _exceptionType = "java/lang/IllegalArgumentException";
4721 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004722 goto exit;
4723 }
4724 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08004725 if (_remaining < count*2) {
4726 _exception = 1;
4727 _exceptionType = "java/lang/IllegalArgumentException";
4728 _exceptionMessage = "length - offset < count*2 < needed";
4729 goto exit;
4730 }
Jack Palevich560814f2009-11-19 16:34:55 +08004731 v_base = (GLfloat *)
4732 _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4733 v = v_base + offset;
4734
4735 glUniform2fv(
4736 (GLint)location,
4737 (GLsizei)count,
4738 (GLfloat *)v
4739 );
4740
4741exit:
4742 if (v_base) {
4743 _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4744 JNI_ABORT);
4745 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004746 if (_exception) {
4747 jniThrowException(_env, _exceptionType, _exceptionMessage);
4748 }
Jack Palevich560814f2009-11-19 16:34:55 +08004749}
4750
4751/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
4752static void
4753android_glUniform2fv__IILjava_nio_FloatBuffer_2
4754 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08004755 jint _exception = 0;
4756 const char * _exceptionType = NULL;
4757 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004758 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004759 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004760 jint _remaining;
4761 GLfloat *v = (GLfloat *) 0;
4762
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004763 v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08004764 if (_remaining < count*2) {
4765 _exception = 1;
4766 _exceptionType = "java/lang/IllegalArgumentException";
4767 _exceptionMessage = "remaining() < count*2 < needed";
4768 goto exit;
4769 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004770 if (v == NULL) {
4771 char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4772 v = (GLfloat *) (_vBase + _bufferOffset);
4773 }
Jack Palevich560814f2009-11-19 16:34:55 +08004774 glUniform2fv(
4775 (GLint)location,
4776 (GLsizei)count,
4777 (GLfloat *)v
4778 );
Mathias Agopian15284de2013-02-23 03:12:30 -08004779
4780exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004781 if (_array) {
4782 releasePointer(_env, _array, v, JNI_FALSE);
4783 }
Mathias Agopian15284de2013-02-23 03:12:30 -08004784 if (_exception) {
4785 jniThrowException(_env, _exceptionType, _exceptionMessage);
4786 }
Jack Palevich560814f2009-11-19 16:34:55 +08004787}
4788
4789/* void glUniform2i ( GLint location, GLint x, GLint y ) */
4790static void
4791android_glUniform2i__III
4792 (JNIEnv *_env, jobject _this, jint location, jint x, jint y) {
4793 glUniform2i(
4794 (GLint)location,
4795 (GLint)x,
4796 (GLint)y
4797 );
4798}
4799
4800/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
4801static void
4802android_glUniform2iv__II_3II
4803 (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004804 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08004805 const char * _exceptionType = NULL;
4806 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004807 GLint *v_base = (GLint *) 0;
4808 jint _remaining;
4809 GLint *v = (GLint *) 0;
4810
4811 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004812 _exception = 1;
4813 _exceptionType = "java/lang/IllegalArgumentException";
4814 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004815 goto exit;
4816 }
4817 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004818 _exception = 1;
4819 _exceptionType = "java/lang/IllegalArgumentException";
4820 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004821 goto exit;
4822 }
4823 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08004824 if (_remaining < count*2) {
4825 _exception = 1;
4826 _exceptionType = "java/lang/IllegalArgumentException";
4827 _exceptionMessage = "length - offset < count*2 < needed";
4828 goto exit;
4829 }
Jack Palevich560814f2009-11-19 16:34:55 +08004830 v_base = (GLint *)
4831 _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4832 v = v_base + offset;
4833
4834 glUniform2iv(
4835 (GLint)location,
4836 (GLsizei)count,
4837 (GLint *)v
4838 );
4839
4840exit:
4841 if (v_base) {
4842 _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4843 JNI_ABORT);
4844 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004845 if (_exception) {
4846 jniThrowException(_env, _exceptionType, _exceptionMessage);
4847 }
Jack Palevich560814f2009-11-19 16:34:55 +08004848}
4849
4850/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
4851static void
4852android_glUniform2iv__IILjava_nio_IntBuffer_2
4853 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08004854 jint _exception = 0;
4855 const char * _exceptionType = NULL;
4856 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004857 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004858 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004859 jint _remaining;
4860 GLint *v = (GLint *) 0;
4861
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004862 v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08004863 if (_remaining < count*2) {
4864 _exception = 1;
4865 _exceptionType = "java/lang/IllegalArgumentException";
4866 _exceptionMessage = "remaining() < count*2 < needed";
4867 goto exit;
4868 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004869 if (v == NULL) {
4870 char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4871 v = (GLint *) (_vBase + _bufferOffset);
4872 }
Jack Palevich560814f2009-11-19 16:34:55 +08004873 glUniform2iv(
4874 (GLint)location,
4875 (GLsizei)count,
4876 (GLint *)v
4877 );
Mathias Agopian15284de2013-02-23 03:12:30 -08004878
4879exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004880 if (_array) {
4881 releasePointer(_env, _array, v, JNI_FALSE);
4882 }
Mathias Agopian15284de2013-02-23 03:12:30 -08004883 if (_exception) {
4884 jniThrowException(_env, _exceptionType, _exceptionMessage);
4885 }
Jack Palevich560814f2009-11-19 16:34:55 +08004886}
4887
4888/* void glUniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z ) */
4889static void
4890android_glUniform3f__IFFF
4891 (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z) {
4892 glUniform3f(
4893 (GLint)location,
4894 (GLfloat)x,
4895 (GLfloat)y,
4896 (GLfloat)z
4897 );
4898}
4899
4900/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
4901static void
4902android_glUniform3fv__II_3FI
4903 (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004904 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08004905 const char * _exceptionType = NULL;
4906 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004907 GLfloat *v_base = (GLfloat *) 0;
4908 jint _remaining;
4909 GLfloat *v = (GLfloat *) 0;
4910
4911 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004912 _exception = 1;
4913 _exceptionType = "java/lang/IllegalArgumentException";
4914 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004915 goto exit;
4916 }
4917 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004918 _exception = 1;
4919 _exceptionType = "java/lang/IllegalArgumentException";
4920 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004921 goto exit;
4922 }
4923 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08004924 if (_remaining < count*3) {
4925 _exception = 1;
4926 _exceptionType = "java/lang/IllegalArgumentException";
4927 _exceptionMessage = "length - offset < count*3 < needed";
4928 goto exit;
4929 }
Jack Palevich560814f2009-11-19 16:34:55 +08004930 v_base = (GLfloat *)
4931 _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4932 v = v_base + offset;
4933
4934 glUniform3fv(
4935 (GLint)location,
4936 (GLsizei)count,
4937 (GLfloat *)v
4938 );
4939
4940exit:
4941 if (v_base) {
4942 _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4943 JNI_ABORT);
4944 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004945 if (_exception) {
4946 jniThrowException(_env, _exceptionType, _exceptionMessage);
4947 }
Jack Palevich560814f2009-11-19 16:34:55 +08004948}
4949
4950/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
4951static void
4952android_glUniform3fv__IILjava_nio_FloatBuffer_2
4953 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08004954 jint _exception = 0;
4955 const char * _exceptionType = NULL;
4956 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004957 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004958 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004959 jint _remaining;
4960 GLfloat *v = (GLfloat *) 0;
4961
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004962 v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08004963 if (_remaining < count*3) {
4964 _exception = 1;
4965 _exceptionType = "java/lang/IllegalArgumentException";
4966 _exceptionMessage = "remaining() < count*3 < needed";
4967 goto exit;
4968 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004969 if (v == NULL) {
4970 char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4971 v = (GLfloat *) (_vBase + _bufferOffset);
4972 }
Jack Palevich560814f2009-11-19 16:34:55 +08004973 glUniform3fv(
4974 (GLint)location,
4975 (GLsizei)count,
4976 (GLfloat *)v
4977 );
Mathias Agopian15284de2013-02-23 03:12:30 -08004978
4979exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004980 if (_array) {
4981 releasePointer(_env, _array, v, JNI_FALSE);
4982 }
Mathias Agopian15284de2013-02-23 03:12:30 -08004983 if (_exception) {
4984 jniThrowException(_env, _exceptionType, _exceptionMessage);
4985 }
Jack Palevich560814f2009-11-19 16:34:55 +08004986}
4987
4988/* void glUniform3i ( GLint location, GLint x, GLint y, GLint z ) */
4989static void
4990android_glUniform3i__IIII
4991 (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z) {
4992 glUniform3i(
4993 (GLint)location,
4994 (GLint)x,
4995 (GLint)y,
4996 (GLint)z
4997 );
4998}
4999
5000/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
5001static void
5002android_glUniform3iv__II_3II
5003 (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005004 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08005005 const char * _exceptionType = NULL;
5006 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005007 GLint *v_base = (GLint *) 0;
5008 jint _remaining;
5009 GLint *v = (GLint *) 0;
5010
5011 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005012 _exception = 1;
5013 _exceptionType = "java/lang/IllegalArgumentException";
5014 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005015 goto exit;
5016 }
5017 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005018 _exception = 1;
5019 _exceptionType = "java/lang/IllegalArgumentException";
5020 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005021 goto exit;
5022 }
5023 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08005024 if (_remaining < count*3) {
5025 _exception = 1;
5026 _exceptionType = "java/lang/IllegalArgumentException";
5027 _exceptionMessage = "length - offset < count*3 < needed";
5028 goto exit;
5029 }
Jack Palevich560814f2009-11-19 16:34:55 +08005030 v_base = (GLint *)
5031 _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
5032 v = v_base + offset;
5033
5034 glUniform3iv(
5035 (GLint)location,
5036 (GLsizei)count,
5037 (GLint *)v
5038 );
5039
5040exit:
5041 if (v_base) {
5042 _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
5043 JNI_ABORT);
5044 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005045 if (_exception) {
5046 jniThrowException(_env, _exceptionType, _exceptionMessage);
5047 }
Jack Palevich560814f2009-11-19 16:34:55 +08005048}
5049
5050/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
5051static void
5052android_glUniform3iv__IILjava_nio_IntBuffer_2
5053 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08005054 jint _exception = 0;
5055 const char * _exceptionType = NULL;
5056 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005057 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005058 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005059 jint _remaining;
5060 GLint *v = (GLint *) 0;
5061
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005062 v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08005063 if (_remaining < count*3) {
5064 _exception = 1;
5065 _exceptionType = "java/lang/IllegalArgumentException";
5066 _exceptionMessage = "remaining() < count*3 < needed";
5067 goto exit;
5068 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005069 if (v == NULL) {
5070 char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5071 v = (GLint *) (_vBase + _bufferOffset);
5072 }
Jack Palevich560814f2009-11-19 16:34:55 +08005073 glUniform3iv(
5074 (GLint)location,
5075 (GLsizei)count,
5076 (GLint *)v
5077 );
Mathias Agopian15284de2013-02-23 03:12:30 -08005078
5079exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005080 if (_array) {
5081 releasePointer(_env, _array, v, JNI_FALSE);
5082 }
Mathias Agopian15284de2013-02-23 03:12:30 -08005083 if (_exception) {
5084 jniThrowException(_env, _exceptionType, _exceptionMessage);
5085 }
Jack Palevich560814f2009-11-19 16:34:55 +08005086}
5087
5088/* void glUniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
5089static void
5090android_glUniform4f__IFFFF
5091 (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z, jfloat w) {
5092 glUniform4f(
5093 (GLint)location,
5094 (GLfloat)x,
5095 (GLfloat)y,
5096 (GLfloat)z,
5097 (GLfloat)w
5098 );
5099}
5100
5101/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
5102static void
5103android_glUniform4fv__II_3FI
5104 (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005105 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08005106 const char * _exceptionType = NULL;
5107 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005108 GLfloat *v_base = (GLfloat *) 0;
5109 jint _remaining;
5110 GLfloat *v = (GLfloat *) 0;
5111
5112 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005113 _exception = 1;
5114 _exceptionType = "java/lang/IllegalArgumentException";
5115 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005116 goto exit;
5117 }
5118 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005119 _exception = 1;
5120 _exceptionType = "java/lang/IllegalArgumentException";
5121 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005122 goto exit;
5123 }
5124 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08005125 if (_remaining < count*4) {
5126 _exception = 1;
5127 _exceptionType = "java/lang/IllegalArgumentException";
5128 _exceptionMessage = "length - offset < count*4 < needed";
5129 goto exit;
5130 }
Jack Palevich560814f2009-11-19 16:34:55 +08005131 v_base = (GLfloat *)
5132 _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
5133 v = v_base + offset;
5134
5135 glUniform4fv(
5136 (GLint)location,
5137 (GLsizei)count,
5138 (GLfloat *)v
5139 );
5140
5141exit:
5142 if (v_base) {
5143 _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
5144 JNI_ABORT);
5145 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005146 if (_exception) {
5147 jniThrowException(_env, _exceptionType, _exceptionMessage);
5148 }
Jack Palevich560814f2009-11-19 16:34:55 +08005149}
5150
5151/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
5152static void
5153android_glUniform4fv__IILjava_nio_FloatBuffer_2
5154 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08005155 jint _exception = 0;
5156 const char * _exceptionType = NULL;
5157 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005158 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005159 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005160 jint _remaining;
5161 GLfloat *v = (GLfloat *) 0;
5162
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005163 v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08005164 if (_remaining < count*4) {
5165 _exception = 1;
5166 _exceptionType = "java/lang/IllegalArgumentException";
5167 _exceptionMessage = "remaining() < count*4 < needed";
5168 goto exit;
5169 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005170 if (v == NULL) {
5171 char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5172 v = (GLfloat *) (_vBase + _bufferOffset);
5173 }
Jack Palevich560814f2009-11-19 16:34:55 +08005174 glUniform4fv(
5175 (GLint)location,
5176 (GLsizei)count,
5177 (GLfloat *)v
5178 );
Mathias Agopian15284de2013-02-23 03:12:30 -08005179
5180exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005181 if (_array) {
5182 releasePointer(_env, _array, v, JNI_FALSE);
5183 }
Mathias Agopian15284de2013-02-23 03:12:30 -08005184 if (_exception) {
5185 jniThrowException(_env, _exceptionType, _exceptionMessage);
5186 }
Jack Palevich560814f2009-11-19 16:34:55 +08005187}
5188
5189/* void glUniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w ) */
5190static void
5191android_glUniform4i__IIIII
5192 (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z, jint w) {
5193 glUniform4i(
5194 (GLint)location,
5195 (GLint)x,
5196 (GLint)y,
5197 (GLint)z,
5198 (GLint)w
5199 );
5200}
5201
5202/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
5203static void
5204android_glUniform4iv__II_3II
5205 (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005206 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08005207 const char * _exceptionType = NULL;
5208 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005209 GLint *v_base = (GLint *) 0;
5210 jint _remaining;
5211 GLint *v = (GLint *) 0;
5212
5213 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005214 _exception = 1;
5215 _exceptionType = "java/lang/IllegalArgumentException";
5216 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005217 goto exit;
5218 }
5219 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005220 _exception = 1;
5221 _exceptionType = "java/lang/IllegalArgumentException";
5222 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005223 goto exit;
5224 }
5225 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08005226 if (_remaining < count*4) {
5227 _exception = 1;
5228 _exceptionType = "java/lang/IllegalArgumentException";
5229 _exceptionMessage = "length - offset < count*4 < needed";
5230 goto exit;
5231 }
Jack Palevich560814f2009-11-19 16:34:55 +08005232 v_base = (GLint *)
5233 _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
5234 v = v_base + offset;
5235
5236 glUniform4iv(
5237 (GLint)location,
5238 (GLsizei)count,
5239 (GLint *)v
5240 );
5241
5242exit:
5243 if (v_base) {
5244 _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
5245 JNI_ABORT);
5246 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005247 if (_exception) {
5248 jniThrowException(_env, _exceptionType, _exceptionMessage);
5249 }
Jack Palevich560814f2009-11-19 16:34:55 +08005250}
5251
5252/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
5253static void
5254android_glUniform4iv__IILjava_nio_IntBuffer_2
5255 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08005256 jint _exception = 0;
5257 const char * _exceptionType = NULL;
5258 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005259 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005260 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005261 jint _remaining;
5262 GLint *v = (GLint *) 0;
5263
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005264 v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08005265 if (_remaining < count*4) {
5266 _exception = 1;
5267 _exceptionType = "java/lang/IllegalArgumentException";
5268 _exceptionMessage = "remaining() < count*4 < needed";
5269 goto exit;
5270 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005271 if (v == NULL) {
5272 char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5273 v = (GLint *) (_vBase + _bufferOffset);
5274 }
Jack Palevich560814f2009-11-19 16:34:55 +08005275 glUniform4iv(
5276 (GLint)location,
5277 (GLsizei)count,
5278 (GLint *)v
5279 );
Mathias Agopian15284de2013-02-23 03:12:30 -08005280
5281exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005282 if (_array) {
5283 releasePointer(_env, _array, v, JNI_FALSE);
5284 }
Mathias Agopian15284de2013-02-23 03:12:30 -08005285 if (_exception) {
5286 jniThrowException(_env, _exceptionType, _exceptionMessage);
5287 }
Jack Palevich560814f2009-11-19 16:34:55 +08005288}
5289
5290/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5291static void
5292android_glUniformMatrix2fv__IIZ_3FI
5293 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005294 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08005295 const char * _exceptionType = NULL;
5296 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005297 GLfloat *value_base = (GLfloat *) 0;
5298 jint _remaining;
5299 GLfloat *value = (GLfloat *) 0;
5300
5301 if (!value_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005302 _exception = 1;
5303 _exceptionType = "java/lang/IllegalArgumentException";
5304 _exceptionMessage = "value == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005305 goto exit;
5306 }
5307 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005308 _exception = 1;
5309 _exceptionType = "java/lang/IllegalArgumentException";
5310 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005311 goto exit;
5312 }
5313 _remaining = _env->GetArrayLength(value_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08005314 if (_remaining < count*4) {
5315 _exception = 1;
5316 _exceptionType = "java/lang/IllegalArgumentException";
5317 _exceptionMessage = "length - offset < count*4 < needed";
5318 goto exit;
5319 }
Jack Palevich560814f2009-11-19 16:34:55 +08005320 value_base = (GLfloat *)
5321 _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
5322 value = value_base + offset;
5323
5324 glUniformMatrix2fv(
5325 (GLint)location,
5326 (GLsizei)count,
5327 (GLboolean)transpose,
5328 (GLfloat *)value
5329 );
5330
5331exit:
5332 if (value_base) {
5333 _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
5334 JNI_ABORT);
5335 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005336 if (_exception) {
5337 jniThrowException(_env, _exceptionType, _exceptionMessage);
5338 }
Jack Palevich560814f2009-11-19 16:34:55 +08005339}
5340
5341/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5342static void
5343android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2
5344 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08005345 jint _exception = 0;
5346 const char * _exceptionType = NULL;
5347 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005348 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005349 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005350 jint _remaining;
5351 GLfloat *value = (GLfloat *) 0;
5352
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005353 value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08005354 if (_remaining < count*4) {
5355 _exception = 1;
5356 _exceptionType = "java/lang/IllegalArgumentException";
5357 _exceptionMessage = "remaining() < count*4 < needed";
5358 goto exit;
5359 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005360 if (value == NULL) {
5361 char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5362 value = (GLfloat *) (_valueBase + _bufferOffset);
5363 }
Jack Palevich560814f2009-11-19 16:34:55 +08005364 glUniformMatrix2fv(
5365 (GLint)location,
5366 (GLsizei)count,
5367 (GLboolean)transpose,
5368 (GLfloat *)value
5369 );
Mathias Agopian15284de2013-02-23 03:12:30 -08005370
5371exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005372 if (_array) {
5373 releasePointer(_env, _array, value, JNI_FALSE);
5374 }
Mathias Agopian15284de2013-02-23 03:12:30 -08005375 if (_exception) {
5376 jniThrowException(_env, _exceptionType, _exceptionMessage);
5377 }
Jack Palevich560814f2009-11-19 16:34:55 +08005378}
5379
5380/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5381static void
5382android_glUniformMatrix3fv__IIZ_3FI
5383 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005384 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08005385 const char * _exceptionType = NULL;
5386 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005387 GLfloat *value_base = (GLfloat *) 0;
5388 jint _remaining;
5389 GLfloat *value = (GLfloat *) 0;
5390
5391 if (!value_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005392 _exception = 1;
5393 _exceptionType = "java/lang/IllegalArgumentException";
5394 _exceptionMessage = "value == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005395 goto exit;
5396 }
5397 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005398 _exception = 1;
5399 _exceptionType = "java/lang/IllegalArgumentException";
5400 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005401 goto exit;
5402 }
5403 _remaining = _env->GetArrayLength(value_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08005404 if (_remaining < count*9) {
5405 _exception = 1;
5406 _exceptionType = "java/lang/IllegalArgumentException";
5407 _exceptionMessage = "length - offset < count*9 < needed";
5408 goto exit;
5409 }
Jack Palevich560814f2009-11-19 16:34:55 +08005410 value_base = (GLfloat *)
5411 _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
5412 value = value_base + offset;
5413
5414 glUniformMatrix3fv(
5415 (GLint)location,
5416 (GLsizei)count,
5417 (GLboolean)transpose,
5418 (GLfloat *)value
5419 );
5420
5421exit:
5422 if (value_base) {
5423 _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
5424 JNI_ABORT);
5425 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005426 if (_exception) {
5427 jniThrowException(_env, _exceptionType, _exceptionMessage);
5428 }
Jack Palevich560814f2009-11-19 16:34:55 +08005429}
5430
5431/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5432static void
5433android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2
5434 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08005435 jint _exception = 0;
5436 const char * _exceptionType = NULL;
5437 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005438 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005439 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005440 jint _remaining;
5441 GLfloat *value = (GLfloat *) 0;
5442
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005443 value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08005444 if (_remaining < count*9) {
5445 _exception = 1;
5446 _exceptionType = "java/lang/IllegalArgumentException";
5447 _exceptionMessage = "remaining() < count*9 < needed";
5448 goto exit;
5449 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005450 if (value == NULL) {
5451 char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5452 value = (GLfloat *) (_valueBase + _bufferOffset);
5453 }
Jack Palevich560814f2009-11-19 16:34:55 +08005454 glUniformMatrix3fv(
5455 (GLint)location,
5456 (GLsizei)count,
5457 (GLboolean)transpose,
5458 (GLfloat *)value
5459 );
Mathias Agopian15284de2013-02-23 03:12:30 -08005460
5461exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005462 if (_array) {
5463 releasePointer(_env, _array, value, JNI_FALSE);
5464 }
Mathias Agopian15284de2013-02-23 03:12:30 -08005465 if (_exception) {
5466 jniThrowException(_env, _exceptionType, _exceptionMessage);
5467 }
Jack Palevich560814f2009-11-19 16:34:55 +08005468}
5469
5470/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5471static void
5472android_glUniformMatrix4fv__IIZ_3FI
5473 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005474 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08005475 const char * _exceptionType = NULL;
5476 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005477 GLfloat *value_base = (GLfloat *) 0;
5478 jint _remaining;
5479 GLfloat *value = (GLfloat *) 0;
5480
5481 if (!value_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005482 _exception = 1;
5483 _exceptionType = "java/lang/IllegalArgumentException";
5484 _exceptionMessage = "value == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005485 goto exit;
5486 }
5487 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005488 _exception = 1;
5489 _exceptionType = "java/lang/IllegalArgumentException";
5490 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005491 goto exit;
5492 }
5493 _remaining = _env->GetArrayLength(value_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08005494 if (_remaining < count*16) {
5495 _exception = 1;
5496 _exceptionType = "java/lang/IllegalArgumentException";
5497 _exceptionMessage = "length - offset < count*16 < needed";
5498 goto exit;
5499 }
Jack Palevich560814f2009-11-19 16:34:55 +08005500 value_base = (GLfloat *)
5501 _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
5502 value = value_base + offset;
5503
5504 glUniformMatrix4fv(
5505 (GLint)location,
5506 (GLsizei)count,
5507 (GLboolean)transpose,
5508 (GLfloat *)value
5509 );
5510
5511exit:
5512 if (value_base) {
5513 _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
5514 JNI_ABORT);
5515 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005516 if (_exception) {
5517 jniThrowException(_env, _exceptionType, _exceptionMessage);
5518 }
Jack Palevich560814f2009-11-19 16:34:55 +08005519}
5520
5521/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5522static void
5523android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2
5524 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08005525 jint _exception = 0;
5526 const char * _exceptionType = NULL;
5527 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005528 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005529 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005530 jint _remaining;
5531 GLfloat *value = (GLfloat *) 0;
5532
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005533 value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08005534 if (_remaining < count*16) {
5535 _exception = 1;
5536 _exceptionType = "java/lang/IllegalArgumentException";
5537 _exceptionMessage = "remaining() < count*16 < needed";
5538 goto exit;
5539 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005540 if (value == NULL) {
5541 char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5542 value = (GLfloat *) (_valueBase + _bufferOffset);
5543 }
Jack Palevich560814f2009-11-19 16:34:55 +08005544 glUniformMatrix4fv(
5545 (GLint)location,
5546 (GLsizei)count,
5547 (GLboolean)transpose,
5548 (GLfloat *)value
5549 );
Mathias Agopian15284de2013-02-23 03:12:30 -08005550
5551exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005552 if (_array) {
5553 releasePointer(_env, _array, value, JNI_FALSE);
5554 }
Mathias Agopian15284de2013-02-23 03:12:30 -08005555 if (_exception) {
5556 jniThrowException(_env, _exceptionType, _exceptionMessage);
5557 }
Jack Palevich560814f2009-11-19 16:34:55 +08005558}
5559
5560/* void glUseProgram ( GLuint program ) */
5561static void
5562android_glUseProgram__I
5563 (JNIEnv *_env, jobject _this, jint program) {
5564 glUseProgram(
5565 (GLuint)program
5566 );
5567}
5568
5569/* void glValidateProgram ( GLuint program ) */
5570static void
5571android_glValidateProgram__I
5572 (JNIEnv *_env, jobject _this, jint program) {
5573 glValidateProgram(
5574 (GLuint)program
5575 );
5576}
5577
5578/* void glVertexAttrib1f ( GLuint indx, GLfloat x ) */
5579static void
5580android_glVertexAttrib1f__IF
5581 (JNIEnv *_env, jobject _this, jint indx, jfloat x) {
5582 glVertexAttrib1f(
5583 (GLuint)indx,
5584 (GLfloat)x
5585 );
5586}
5587
5588/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
5589static void
5590android_glVertexAttrib1fv__I_3FI
5591 (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005592 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08005593 const char * _exceptionType = NULL;
5594 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005595 GLfloat *values_base = (GLfloat *) 0;
5596 jint _remaining;
5597 GLfloat *values = (GLfloat *) 0;
5598
5599 if (!values_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005600 _exception = 1;
5601 _exceptionType = "java/lang/IllegalArgumentException";
5602 _exceptionMessage = "values == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005603 goto exit;
5604 }
5605 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005606 _exception = 1;
5607 _exceptionType = "java/lang/IllegalArgumentException";
5608 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005609 goto exit;
5610 }
5611 _remaining = _env->GetArrayLength(values_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08005612 if (_remaining < 1) {
5613 _exception = 1;
5614 _exceptionType = "java/lang/IllegalArgumentException";
5615 _exceptionMessage = "length - offset < 1 < needed";
5616 goto exit;
5617 }
Jack Palevich560814f2009-11-19 16:34:55 +08005618 values_base = (GLfloat *)
5619 _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
5620 values = values_base + offset;
5621
5622 glVertexAttrib1fv(
5623 (GLuint)indx,
5624 (GLfloat *)values
5625 );
5626
5627exit:
5628 if (values_base) {
5629 _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
5630 JNI_ABORT);
5631 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005632 if (_exception) {
5633 jniThrowException(_env, _exceptionType, _exceptionMessage);
5634 }
Jack Palevich560814f2009-11-19 16:34:55 +08005635}
5636
5637/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
5638static void
5639android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2
5640 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08005641 jint _exception = 0;
5642 const char * _exceptionType = NULL;
5643 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005644 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005645 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005646 jint _remaining;
5647 GLfloat *values = (GLfloat *) 0;
5648
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005649 values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08005650 if (_remaining < 1) {
5651 _exception = 1;
5652 _exceptionType = "java/lang/IllegalArgumentException";
5653 _exceptionMessage = "remaining() < 1 < needed";
5654 goto exit;
5655 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005656 if (values == NULL) {
5657 char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5658 values = (GLfloat *) (_valuesBase + _bufferOffset);
5659 }
Jack Palevich560814f2009-11-19 16:34:55 +08005660 glVertexAttrib1fv(
5661 (GLuint)indx,
5662 (GLfloat *)values
5663 );
Mathias Agopian15284de2013-02-23 03:12:30 -08005664
5665exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005666 if (_array) {
5667 releasePointer(_env, _array, values, JNI_FALSE);
5668 }
Mathias Agopian15284de2013-02-23 03:12:30 -08005669 if (_exception) {
5670 jniThrowException(_env, _exceptionType, _exceptionMessage);
5671 }
Jack Palevich560814f2009-11-19 16:34:55 +08005672}
5673
5674/* void glVertexAttrib2f ( GLuint indx, GLfloat x, GLfloat y ) */
5675static void
5676android_glVertexAttrib2f__IFF
5677 (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y) {
5678 glVertexAttrib2f(
5679 (GLuint)indx,
5680 (GLfloat)x,
5681 (GLfloat)y
5682 );
5683}
5684
5685/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
5686static void
5687android_glVertexAttrib2fv__I_3FI
5688 (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005689 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08005690 const char * _exceptionType = NULL;
5691 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005692 GLfloat *values_base = (GLfloat *) 0;
5693 jint _remaining;
5694 GLfloat *values = (GLfloat *) 0;
5695
5696 if (!values_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005697 _exception = 1;
5698 _exceptionType = "java/lang/IllegalArgumentException";
5699 _exceptionMessage = "values == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005700 goto exit;
5701 }
5702 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005703 _exception = 1;
5704 _exceptionType = "java/lang/IllegalArgumentException";
5705 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005706 goto exit;
5707 }
5708 _remaining = _env->GetArrayLength(values_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08005709 if (_remaining < 2) {
5710 _exception = 1;
5711 _exceptionType = "java/lang/IllegalArgumentException";
5712 _exceptionMessage = "length - offset < 2 < needed";
5713 goto exit;
5714 }
Jack Palevich560814f2009-11-19 16:34:55 +08005715 values_base = (GLfloat *)
5716 _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
5717 values = values_base + offset;
5718
5719 glVertexAttrib2fv(
5720 (GLuint)indx,
5721 (GLfloat *)values
5722 );
5723
5724exit:
5725 if (values_base) {
5726 _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
5727 JNI_ABORT);
5728 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005729 if (_exception) {
5730 jniThrowException(_env, _exceptionType, _exceptionMessage);
5731 }
Jack Palevich560814f2009-11-19 16:34:55 +08005732}
5733
5734/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
5735static void
5736android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2
5737 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08005738 jint _exception = 0;
5739 const char * _exceptionType = NULL;
5740 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005741 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005742 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005743 jint _remaining;
5744 GLfloat *values = (GLfloat *) 0;
5745
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005746 values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08005747 if (_remaining < 2) {
5748 _exception = 1;
5749 _exceptionType = "java/lang/IllegalArgumentException";
5750 _exceptionMessage = "remaining() < 2 < needed";
5751 goto exit;
5752 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005753 if (values == NULL) {
5754 char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5755 values = (GLfloat *) (_valuesBase + _bufferOffset);
5756 }
Jack Palevich560814f2009-11-19 16:34:55 +08005757 glVertexAttrib2fv(
5758 (GLuint)indx,
5759 (GLfloat *)values
5760 );
Mathias Agopian15284de2013-02-23 03:12:30 -08005761
5762exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005763 if (_array) {
5764 releasePointer(_env, _array, values, JNI_FALSE);
5765 }
Mathias Agopian15284de2013-02-23 03:12:30 -08005766 if (_exception) {
5767 jniThrowException(_env, _exceptionType, _exceptionMessage);
5768 }
Jack Palevich560814f2009-11-19 16:34:55 +08005769}
5770
5771/* void glVertexAttrib3f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z ) */
5772static void
5773android_glVertexAttrib3f__IFFF
5774 (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z) {
5775 glVertexAttrib3f(
5776 (GLuint)indx,
5777 (GLfloat)x,
5778 (GLfloat)y,
5779 (GLfloat)z
5780 );
5781}
5782
5783/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
5784static void
5785android_glVertexAttrib3fv__I_3FI
5786 (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005787 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08005788 const char * _exceptionType = NULL;
5789 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005790 GLfloat *values_base = (GLfloat *) 0;
5791 jint _remaining;
5792 GLfloat *values = (GLfloat *) 0;
5793
5794 if (!values_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005795 _exception = 1;
5796 _exceptionType = "java/lang/IllegalArgumentException";
5797 _exceptionMessage = "values == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005798 goto exit;
5799 }
5800 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005801 _exception = 1;
5802 _exceptionType = "java/lang/IllegalArgumentException";
5803 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005804 goto exit;
5805 }
5806 _remaining = _env->GetArrayLength(values_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08005807 if (_remaining < 3) {
5808 _exception = 1;
5809 _exceptionType = "java/lang/IllegalArgumentException";
5810 _exceptionMessage = "length - offset < 3 < needed";
5811 goto exit;
5812 }
Jack Palevich560814f2009-11-19 16:34:55 +08005813 values_base = (GLfloat *)
5814 _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
5815 values = values_base + offset;
5816
5817 glVertexAttrib3fv(
5818 (GLuint)indx,
5819 (GLfloat *)values
5820 );
5821
5822exit:
5823 if (values_base) {
5824 _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
5825 JNI_ABORT);
5826 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005827 if (_exception) {
5828 jniThrowException(_env, _exceptionType, _exceptionMessage);
5829 }
Jack Palevich560814f2009-11-19 16:34:55 +08005830}
5831
5832/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
5833static void
5834android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2
5835 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08005836 jint _exception = 0;
5837 const char * _exceptionType = NULL;
5838 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005839 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005840 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005841 jint _remaining;
5842 GLfloat *values = (GLfloat *) 0;
5843
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005844 values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08005845 if (_remaining < 3) {
5846 _exception = 1;
5847 _exceptionType = "java/lang/IllegalArgumentException";
5848 _exceptionMessage = "remaining() < 3 < needed";
5849 goto exit;
5850 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005851 if (values == NULL) {
5852 char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5853 values = (GLfloat *) (_valuesBase + _bufferOffset);
5854 }
Jack Palevich560814f2009-11-19 16:34:55 +08005855 glVertexAttrib3fv(
5856 (GLuint)indx,
5857 (GLfloat *)values
5858 );
Mathias Agopian15284de2013-02-23 03:12:30 -08005859
5860exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005861 if (_array) {
5862 releasePointer(_env, _array, values, JNI_FALSE);
5863 }
Mathias Agopian15284de2013-02-23 03:12:30 -08005864 if (_exception) {
5865 jniThrowException(_env, _exceptionType, _exceptionMessage);
5866 }
Jack Palevich560814f2009-11-19 16:34:55 +08005867}
5868
5869/* void glVertexAttrib4f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
5870static void
5871android_glVertexAttrib4f__IFFFF
5872 (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z, jfloat w) {
5873 glVertexAttrib4f(
5874 (GLuint)indx,
5875 (GLfloat)x,
5876 (GLfloat)y,
5877 (GLfloat)z,
5878 (GLfloat)w
5879 );
5880}
5881
5882/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
5883static void
5884android_glVertexAttrib4fv__I_3FI
5885 (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005886 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08005887 const char * _exceptionType = NULL;
5888 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005889 GLfloat *values_base = (GLfloat *) 0;
5890 jint _remaining;
5891 GLfloat *values = (GLfloat *) 0;
5892
5893 if (!values_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005894 _exception = 1;
5895 _exceptionType = "java/lang/IllegalArgumentException";
5896 _exceptionMessage = "values == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005897 goto exit;
5898 }
5899 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005900 _exception = 1;
5901 _exceptionType = "java/lang/IllegalArgumentException";
5902 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005903 goto exit;
5904 }
5905 _remaining = _env->GetArrayLength(values_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -08005906 if (_remaining < 4) {
5907 _exception = 1;
5908 _exceptionType = "java/lang/IllegalArgumentException";
5909 _exceptionMessage = "length - offset < 4 < needed";
5910 goto exit;
5911 }
Jack Palevich560814f2009-11-19 16:34:55 +08005912 values_base = (GLfloat *)
5913 _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
5914 values = values_base + offset;
5915
5916 glVertexAttrib4fv(
5917 (GLuint)indx,
5918 (GLfloat *)values
5919 );
5920
5921exit:
5922 if (values_base) {
5923 _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
5924 JNI_ABORT);
5925 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005926 if (_exception) {
5927 jniThrowException(_env, _exceptionType, _exceptionMessage);
5928 }
Jack Palevich560814f2009-11-19 16:34:55 +08005929}
5930
5931/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
5932static void
5933android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2
5934 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08005935 jint _exception = 0;
5936 const char * _exceptionType = NULL;
5937 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005938 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005939 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005940 jint _remaining;
5941 GLfloat *values = (GLfloat *) 0;
5942
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005943 values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08005944 if (_remaining < 4) {
5945 _exception = 1;
5946 _exceptionType = "java/lang/IllegalArgumentException";
5947 _exceptionMessage = "remaining() < 4 < needed";
5948 goto exit;
5949 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005950 if (values == NULL) {
5951 char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5952 values = (GLfloat *) (_valuesBase + _bufferOffset);
5953 }
Jack Palevich560814f2009-11-19 16:34:55 +08005954 glVertexAttrib4fv(
5955 (GLuint)indx,
5956 (GLfloat *)values
5957 );
Mathias Agopian15284de2013-02-23 03:12:30 -08005958
5959exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005960 if (_array) {
5961 releasePointer(_env, _array, values, JNI_FALSE);
5962 }
Mathias Agopian15284de2013-02-23 03:12:30 -08005963 if (_exception) {
5964 jniThrowException(_env, _exceptionType, _exceptionMessage);
5965 }
Jack Palevich560814f2009-11-19 16:34:55 +08005966}
5967
Jack Palevich224107a2010-06-22 20:08:40 +08005968/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint offset ) */
5969static void
5970android_glVertexAttribPointer__IIIZII
5971 (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jint offset) {
5972 glVertexAttribPointer(
5973 (GLuint)indx,
5974 (GLint)size,
5975 (GLenum)type,
5976 (GLboolean)normalized,
5977 (GLsizei)stride,
5978 (const GLvoid *)offset
5979 );
5980}
5981
Jack Palevich560814f2009-11-19 16:34:55 +08005982/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr ) */
5983static void
5984android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I
5985 (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jobject ptr_buf, jint remaining) {
5986 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005987 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005988 jint _remaining;
5989 GLvoid *ptr = (GLvoid *) 0;
5990
5991 if (ptr_buf) {
5992 ptr = (GLvoid *) getDirectBufferPointer(_env, ptr_buf);
5993 if ( ! ptr ) {
5994 return;
5995 }
5996 }
5997 glVertexAttribPointerBounds(
5998 (GLuint)indx,
5999 (GLint)size,
6000 (GLenum)type,
6001 (GLboolean)normalized,
6002 (GLsizei)stride,
6003 (GLvoid *)ptr,
6004 (GLsizei)remaining
6005 );
6006}
6007
6008/* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */
6009static void
6010android_glViewport__IIII
6011 (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
6012 glViewport(
6013 (GLint)x,
6014 (GLint)y,
6015 (GLsizei)width,
6016 (GLsizei)height
6017 );
6018}
6019
6020static const char *classPathName = "android/opengl/GLES20";
6021
6022static JNINativeMethod methods[] = {
6023{"_nativeClassInit", "()V", (void*)nativeClassInit },
6024{"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I },
6025{"glAttachShader", "(II)V", (void *) android_glAttachShader__II },
6026{"glBindAttribLocation", "(IILjava/lang/String;)V", (void *) android_glBindAttribLocation__IILjava_lang_String_2 },
6027{"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II },
6028{"glBindFramebuffer", "(II)V", (void *) android_glBindFramebuffer__II },
6029{"glBindRenderbuffer", "(II)V", (void *) android_glBindRenderbuffer__II },
6030{"glBindTexture", "(II)V", (void *) android_glBindTexture__II },
6031{"glBlendColor", "(FFFF)V", (void *) android_glBlendColor__FFFF },
6032{"glBlendEquation", "(I)V", (void *) android_glBlendEquation__I },
6033{"glBlendEquationSeparate", "(II)V", (void *) android_glBlendEquationSeparate__II },
6034{"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II },
6035{"glBlendFuncSeparate", "(IIII)V", (void *) android_glBlendFuncSeparate__IIII },
6036{"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I },
6037{"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 },
6038{"glCheckFramebufferStatus", "(I)I", (void *) android_glCheckFramebufferStatus__I },
6039{"glClear", "(I)V", (void *) android_glClear__I },
6040{"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF },
6041{"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F },
6042{"glClearStencil", "(I)V", (void *) android_glClearStencil__I },
6043{"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ },
6044{"glCompileShader", "(I)V", (void *) android_glCompileShader__I },
6045{"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 },
6046{"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
6047{"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII },
6048{"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII },
6049{"glCreateProgram", "()I", (void *) android_glCreateProgram__ },
6050{"glCreateShader", "(I)I", (void *) android_glCreateShader__I },
6051{"glCullFace", "(I)V", (void *) android_glCullFace__I },
6052{"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II },
6053{"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 },
6054{"glDeleteFramebuffers", "(I[II)V", (void *) android_glDeleteFramebuffers__I_3II },
6055{"glDeleteFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2 },
6056{"glDeleteProgram", "(I)V", (void *) android_glDeleteProgram__I },
6057{"glDeleteRenderbuffers", "(I[II)V", (void *) android_glDeleteRenderbuffers__I_3II },
6058{"glDeleteRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2 },
6059{"glDeleteShader", "(I)V", (void *) android_glDeleteShader__I },
6060{"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II },
6061{"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 },
6062{"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I },
6063{"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z },
6064{"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF },
6065{"glDetachShader", "(II)V", (void *) android_glDetachShader__II },
6066{"glDisable", "(I)V", (void *) android_glDisable__I },
6067{"glDisableVertexAttribArray", "(I)V", (void *) android_glDisableVertexAttribArray__I },
6068{"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III },
Jack Palevich224107a2010-06-22 20:08:40 +08006069{"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII },
Jack Palevich560814f2009-11-19 16:34:55 +08006070{"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 },
6071{"glEnable", "(I)V", (void *) android_glEnable__I },
6072{"glEnableVertexAttribArray", "(I)V", (void *) android_glEnableVertexAttribArray__I },
6073{"glFinish", "()V", (void *) android_glFinish__ },
6074{"glFlush", "()V", (void *) android_glFlush__ },
6075{"glFramebufferRenderbuffer", "(IIII)V", (void *) android_glFramebufferRenderbuffer__IIII },
6076{"glFramebufferTexture2D", "(IIIII)V", (void *) android_glFramebufferTexture2D__IIIII },
6077{"glFrontFace", "(I)V", (void *) android_glFrontFace__I },
6078{"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II },
6079{"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 },
6080{"glGenerateMipmap", "(I)V", (void *) android_glGenerateMipmap__I },
6081{"glGenFramebuffers", "(I[II)V", (void *) android_glGenFramebuffers__I_3II },
6082{"glGenFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenFramebuffers__ILjava_nio_IntBuffer_2 },
6083{"glGenRenderbuffers", "(I[II)V", (void *) android_glGenRenderbuffers__I_3II },
6084{"glGenRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenRenderbuffers__ILjava_nio_IntBuffer_2 },
6085{"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II },
6086{"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 },
6087{"glGetActiveAttrib", "(III[II[II[II[BI)V", (void *) android_glGetActiveAttrib__III_3II_3II_3II_3BI },
6088{"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 -07006089{"glGetActiveAttrib", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveAttrib1 },
6090{"glGetActiveAttrib", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveAttrib2 },
Jack Palevich560814f2009-11-19 16:34:55 +08006091{"glGetActiveUniform", "(III[II[II[II[BI)V", (void *) android_glGetActiveUniform__III_3II_3II_3II_3BI },
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07006092{"glGetActiveUniform", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveUniform1 },
Jack Palevich560814f2009-11-19 16:34:55 +08006093{"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 -07006094{"glGetActiveUniform", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveUniform2 },
Jack Palevich560814f2009-11-19 16:34:55 +08006095{"glGetAttachedShaders", "(II[II[II)V", (void *) android_glGetAttachedShaders__II_3II_3II },
6096{"glGetAttachedShaders", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
6097{"glGetAttribLocation", "(ILjava/lang/String;)I", (void *) android_glGetAttribLocation__ILjava_lang_String_2 },
6098{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI },
6099{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 },
6100{"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II },
6101{"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 },
6102{"glGetError", "()I", (void *) android_glGetError__ },
6103{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI },
6104{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 },
6105{"glGetFramebufferAttachmentParameteriv", "(III[II)V", (void *) android_glGetFramebufferAttachmentParameteriv__III_3II },
6106{"glGetFramebufferAttachmentParameteriv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2 },
6107{"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II },
6108{"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 },
6109{"glGetProgramiv", "(II[II)V", (void *) android_glGetProgramiv__II_3II },
6110{"glGetProgramiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetProgramiv__IILjava_nio_IntBuffer_2 },
6111{"glGetProgramInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetProgramInfoLog },
6112{"glGetRenderbufferParameteriv", "(II[II)V", (void *) android_glGetRenderbufferParameteriv__II_3II },
6113{"glGetRenderbufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2 },
6114{"glGetShaderiv", "(II[II)V", (void *) android_glGetShaderiv__II_3II },
6115{"glGetShaderiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetShaderiv__IILjava_nio_IntBuffer_2 },
6116{"glGetShaderInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetShaderInfoLog },
6117{"glGetShaderPrecisionFormat", "(II[II[II)V", (void *) android_glGetShaderPrecisionFormat__II_3II_3II },
6118{"glGetShaderPrecisionFormat", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
6119{"glGetShaderSource", "(II[II[BI)V", (void *) android_glGetShaderSource__II_3II_3BI },
6120{"glGetShaderSource", "(IILjava/nio/IntBuffer;B)V", (void *) android_glGetShaderSource__IILjava_nio_IntBuffer_2B },
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07006121{"glGetShaderSource", "(I)Ljava/lang/String;", (void *) android_glGetShaderSource },
Jack Palevich560814f2009-11-19 16:34:55 +08006122{"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString },
6123{"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI },
6124{"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 },
6125{"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II },
6126{"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 },
6127{"glGetUniformfv", "(II[FI)V", (void *) android_glGetUniformfv__II_3FI },
6128{"glGetUniformfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetUniformfv__IILjava_nio_FloatBuffer_2 },
6129{"glGetUniformiv", "(II[II)V", (void *) android_glGetUniformiv__II_3II },
6130{"glGetUniformiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetUniformiv__IILjava_nio_IntBuffer_2 },
6131{"glGetUniformLocation", "(ILjava/lang/String;)I", (void *) android_glGetUniformLocation__ILjava_lang_String_2 },
6132{"glGetVertexAttribfv", "(II[FI)V", (void *) android_glGetVertexAttribfv__II_3FI },
6133{"glGetVertexAttribfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2 },
6134{"glGetVertexAttribiv", "(II[II)V", (void *) android_glGetVertexAttribiv__II_3II },
6135{"glGetVertexAttribiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2 },
6136{"glHint", "(II)V", (void *) android_glHint__II },
6137{"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I },
6138{"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I },
6139{"glIsFramebuffer", "(I)Z", (void *) android_glIsFramebuffer__I },
6140{"glIsProgram", "(I)Z", (void *) android_glIsProgram__I },
6141{"glIsRenderbuffer", "(I)Z", (void *) android_glIsRenderbuffer__I },
6142{"glIsShader", "(I)Z", (void *) android_glIsShader__I },
6143{"glIsTexture", "(I)Z", (void *) android_glIsTexture__I },
6144{"glLineWidth", "(F)V", (void *) android_glLineWidth__F },
6145{"glLinkProgram", "(I)V", (void *) android_glLinkProgram__I },
6146{"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II },
6147{"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF },
6148{"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 },
6149{"glReleaseShaderCompiler", "()V", (void *) android_glReleaseShaderCompiler__ },
6150{"glRenderbufferStorage", "(IIII)V", (void *) android_glRenderbufferStorage__IIII },
6151{"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ },
6152{"glScissor", "(IIII)V", (void *) android_glScissor__IIII },
6153{"glShaderBinary", "(I[IIILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__I_3IIILjava_nio_Buffer_2I },
6154{"glShaderBinary", "(ILjava/nio/IntBuffer;ILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I },
6155{"glShaderSource", "(ILjava/lang/String;)V", (void *) android_glShaderSource },
6156{"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III },
6157{"glStencilFuncSeparate", "(IIII)V", (void *) android_glStencilFuncSeparate__IIII },
6158{"glStencilMask", "(I)V", (void *) android_glStencilMask__I },
6159{"glStencilMaskSeparate", "(II)V", (void *) android_glStencilMaskSeparate__II },
6160{"glStencilOp", "(III)V", (void *) android_glStencilOp__III },
6161{"glStencilOpSeparate", "(IIII)V", (void *) android_glStencilOpSeparate__IIII },
6162{"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 },
6163{"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF },
6164{"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI },
6165{"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 },
6166{"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III },
6167{"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II },
6168{"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 },
6169{"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
6170{"glUniform1f", "(IF)V", (void *) android_glUniform1f__IF },
6171{"glUniform1fv", "(II[FI)V", (void *) android_glUniform1fv__II_3FI },
6172{"glUniform1fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform1fv__IILjava_nio_FloatBuffer_2 },
6173{"glUniform1i", "(II)V", (void *) android_glUniform1i__II },
6174{"glUniform1iv", "(II[II)V", (void *) android_glUniform1iv__II_3II },
6175{"glUniform1iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform1iv__IILjava_nio_IntBuffer_2 },
6176{"glUniform2f", "(IFF)V", (void *) android_glUniform2f__IFF },
6177{"glUniform2fv", "(II[FI)V", (void *) android_glUniform2fv__II_3FI },
6178{"glUniform2fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform2fv__IILjava_nio_FloatBuffer_2 },
6179{"glUniform2i", "(III)V", (void *) android_glUniform2i__III },
6180{"glUniform2iv", "(II[II)V", (void *) android_glUniform2iv__II_3II },
6181{"glUniform2iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform2iv__IILjava_nio_IntBuffer_2 },
6182{"glUniform3f", "(IFFF)V", (void *) android_glUniform3f__IFFF },
6183{"glUniform3fv", "(II[FI)V", (void *) android_glUniform3fv__II_3FI },
6184{"glUniform3fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform3fv__IILjava_nio_FloatBuffer_2 },
6185{"glUniform3i", "(IIII)V", (void *) android_glUniform3i__IIII },
6186{"glUniform3iv", "(II[II)V", (void *) android_glUniform3iv__II_3II },
6187{"glUniform3iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform3iv__IILjava_nio_IntBuffer_2 },
6188{"glUniform4f", "(IFFFF)V", (void *) android_glUniform4f__IFFFF },
6189{"glUniform4fv", "(II[FI)V", (void *) android_glUniform4fv__II_3FI },
6190{"glUniform4fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform4fv__IILjava_nio_FloatBuffer_2 },
6191{"glUniform4i", "(IIIII)V", (void *) android_glUniform4i__IIIII },
6192{"glUniform4iv", "(II[II)V", (void *) android_glUniform4iv__II_3II },
6193{"glUniform4iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform4iv__IILjava_nio_IntBuffer_2 },
6194{"glUniformMatrix2fv", "(IIZ[FI)V", (void *) android_glUniformMatrix2fv__IIZ_3FI },
6195{"glUniformMatrix2fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2 },
6196{"glUniformMatrix3fv", "(IIZ[FI)V", (void *) android_glUniformMatrix3fv__IIZ_3FI },
6197{"glUniformMatrix3fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2 },
6198{"glUniformMatrix4fv", "(IIZ[FI)V", (void *) android_glUniformMatrix4fv__IIZ_3FI },
6199{"glUniformMatrix4fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2 },
6200{"glUseProgram", "(I)V", (void *) android_glUseProgram__I },
6201{"glValidateProgram", "(I)V", (void *) android_glValidateProgram__I },
6202{"glVertexAttrib1f", "(IF)V", (void *) android_glVertexAttrib1f__IF },
6203{"glVertexAttrib1fv", "(I[FI)V", (void *) android_glVertexAttrib1fv__I_3FI },
6204{"glVertexAttrib1fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2 },
6205{"glVertexAttrib2f", "(IFF)V", (void *) android_glVertexAttrib2f__IFF },
6206{"glVertexAttrib2fv", "(I[FI)V", (void *) android_glVertexAttrib2fv__I_3FI },
6207{"glVertexAttrib2fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2 },
6208{"glVertexAttrib3f", "(IFFF)V", (void *) android_glVertexAttrib3f__IFFF },
6209{"glVertexAttrib3fv", "(I[FI)V", (void *) android_glVertexAttrib3fv__I_3FI },
6210{"glVertexAttrib3fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2 },
6211{"glVertexAttrib4f", "(IFFFF)V", (void *) android_glVertexAttrib4f__IFFFF },
6212{"glVertexAttrib4fv", "(I[FI)V", (void *) android_glVertexAttrib4fv__I_3FI },
6213{"glVertexAttrib4fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2 },
Jack Palevich224107a2010-06-22 20:08:40 +08006214{"glVertexAttribPointer", "(IIIZII)V", (void *) android_glVertexAttribPointer__IIIZII },
Jack Palevich560814f2009-11-19 16:34:55 +08006215{"glVertexAttribPointerBounds", "(IIIZILjava/nio/Buffer;I)V", (void *) android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I },
6216{"glViewport", "(IIII)V", (void *) android_glViewport__IIII },
6217};
6218
6219int register_android_opengl_jni_GLES20(JNIEnv *_env)
6220{
6221 int err;
6222 err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
6223 return err;
6224}