blob: 9bc69aebb8b375b1ebdcb52098dc778a69aaeab6 [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 Agopian2ad04772013-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 Agopian2ad04772013-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
Andy McFaddencee51982013-04-25 16:08:31 -070066#ifdef GL_ES_VERSION_3_0
67static void glVertexAttribIPointerBounds(GLuint indx, GLint size, GLenum type,
68 GLsizei stride, const GLvoid *pointer, GLsizei count) {
69 glVertexAttribIPointer(indx, size, type, stride, pointer);
70}
71#endif
Mathias Agopian2ad04772013-02-23 03:12:30 -080072}
73
Jack Palevich560814f2009-11-19 16:34:55 +080074/* Cache method IDs each time the class is loaded. */
75
76static void
Elliott Hughes24ce5fb2011-04-08 20:01:01 -070077nativeClassInit(JNIEnv *_env, jclass glImplClass)
Jack Palevich560814f2009-11-19 16:34:55 +080078{
79 jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
80 nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
81
82 jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
83 bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
84
85 getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
86 "getBasePointer", "(Ljava/nio/Buffer;)J");
87 getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
88 "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
89 getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
90 "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
91
92 positionID = _env->GetFieldID(bufferClass, "position", "I");
93 limitID = _env->GetFieldID(bufferClass, "limit", "I");
94 elementSizeShiftID =
95 _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
96}
97
Jack Palevich560814f2009-11-19 16:34:55 +080098static void *
Thomas Tafertshofer17045a12012-07-12 13:55:55 -070099getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
Jack Palevich560814f2009-11-19 16:34:55 +0800100{
101 jint position;
102 jint limit;
103 jint elementSizeShift;
104 jlong pointer;
Jack Palevich560814f2009-11-19 16:34:55 +0800105
106 position = _env->GetIntField(buffer, positionID);
107 limit = _env->GetIntField(buffer, limitID);
108 elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
109 *remaining = (limit - position) << elementSizeShift;
110 pointer = _env->CallStaticLongMethod(nioAccessClass,
111 getBasePointerID, buffer);
112 if (pointer != 0L) {
113 *array = NULL;
114 return (void *) (jint) pointer;
115 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700116
Jack Palevich560814f2009-11-19 16:34:55 +0800117 *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
118 getBaseArrayID, buffer);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700119 *offset = _env->CallStaticIntMethod(nioAccessClass,
Jack Palevich560814f2009-11-19 16:34:55 +0800120 getBaseArrayOffsetID, buffer);
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700121
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700122 return NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800123}
124
Jack Palevich560814f2009-11-19 16:34:55 +0800125static void
126releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
127{
128 _env->ReleasePrimitiveArrayCritical(array, data,
Mathias Agopian2ad04772013-02-23 03:12:30 -0800129 commit ? 0 : JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +0800130}
131
132static void *
133getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
134 char* buf = (char*) _env->GetDirectBufferAddress(buffer);
135 if (buf) {
136 jint position = _env->GetIntField(buffer, positionID);
137 jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
138 buf += position << elementSizeShift;
139 } else {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700140 jniThrowException(_env, "java/lang/IllegalArgumentException",
141 "Must use a native order direct Buffer");
Jack Palevich560814f2009-11-19 16:34:55 +0800142 }
143 return (void*) buf;
144}
145
Mathias Agopian2ad04772013-02-23 03:12:30 -0800146// --------------------------------------------------------------------------
147
148/*
149 * returns the number of values glGet returns for a given pname.
150 *
151 * The code below is written such that pnames requiring only one values
152 * are the default (and are not explicitely tested for). This makes the
153 * checking code much shorter/readable/efficient.
154 *
155 * This means that unknown pnames (e.g.: extensions) will default to 1. If
156 * that unknown pname needs more than 1 value, then the validation check
157 * is incomplete and the app may crash if it passed the wrong number params.
158 */
159static int getNeededCount(GLint pname) {
160 int needed = 1;
161#ifdef GL_ES_VERSION_2_0
162 // GLES 2.x pnames
163 switch (pname) {
164 case GL_ALIASED_LINE_WIDTH_RANGE:
165 case GL_ALIASED_POINT_SIZE_RANGE:
166 needed = 2;
167 break;
168
169 case GL_BLEND_COLOR:
170 case GL_COLOR_CLEAR_VALUE:
171 case GL_COLOR_WRITEMASK:
172 case GL_SCISSOR_BOX:
173 case GL_VIEWPORT:
174 needed = 4;
175 break;
176
177 case GL_COMPRESSED_TEXTURE_FORMATS:
178 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
179 break;
180
181 case GL_SHADER_BINARY_FORMATS:
182 glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed);
183 break;
184 }
185#endif
186
187#ifdef GL_VERSION_ES_CM_1_1
188 // GLES 1.x pnames
189 switch (pname) {
190 case GL_ALIASED_LINE_WIDTH_RANGE:
191 case GL_ALIASED_POINT_SIZE_RANGE:
192 case GL_DEPTH_RANGE:
193 case GL_SMOOTH_LINE_WIDTH_RANGE:
194 case GL_SMOOTH_POINT_SIZE_RANGE:
195 needed = 2;
196 break;
197
198 case GL_CURRENT_NORMAL:
199 case GL_POINT_DISTANCE_ATTENUATION:
200 needed = 3;
201 break;
202
203 case GL_COLOR_CLEAR_VALUE:
204 case GL_COLOR_WRITEMASK:
205 case GL_CURRENT_COLOR:
206 case GL_CURRENT_TEXTURE_COORDS:
207 case GL_FOG_COLOR:
208 case GL_LIGHT_MODEL_AMBIENT:
209 case GL_SCISSOR_BOX:
210 case GL_VIEWPORT:
211 needed = 4;
212 break;
213
214 case GL_MODELVIEW_MATRIX:
215 case GL_PROJECTION_MATRIX:
216 case GL_TEXTURE_MATRIX:
217 needed = 16;
218 break;
219
220 case GL_COMPRESSED_TEXTURE_FORMATS:
221 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
222 break;
223 }
224#endif
225 return needed;
Jack Palevich560814f2009-11-19 16:34:55 +0800226}
227
Mathias Agopian2ad04772013-02-23 03:12:30 -0800228template <typename JTYPEARRAY, typename CTYPE, void GET(GLenum, CTYPE*)>
229static void
230get
231 (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
232 jint _exception = 0;
233 const char * _exceptionType;
234 const char * _exceptionMessage;
235 CTYPE *params_base = (CTYPE *) 0;
236 jint _remaining;
237 CTYPE *params = (CTYPE *) 0;
238 int _needed = 0;
239
240 if (!params_ref) {
241 _exception = 1;
242 _exceptionType = "java/lang/IllegalArgumentException";
243 _exceptionMessage = "params == null";
244 goto exit;
245 }
246 if (offset < 0) {
247 _exception = 1;
248 _exceptionType = "java/lang/IllegalArgumentException";
249 _exceptionMessage = "offset < 0";
250 goto exit;
251 }
252 _remaining = _env->GetArrayLength(params_ref) - offset;
253 _needed = getNeededCount(pname);
254 // if we didn't find this pname, we just assume the user passed
255 // an array of the right size -- this might happen with extensions
256 // or if we forget an enum here.
257 if (_remaining < _needed) {
258 _exception = 1;
259 _exceptionType = "java/lang/IllegalArgumentException";
260 _exceptionMessage = "length - offset < needed";
261 goto exit;
262 }
263 params_base = (CTYPE *)
264 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
265 params = params_base + offset;
266
267 GET(
268 (GLenum)pname,
269 (CTYPE *)params
270 );
271
272exit:
273 if (params_base) {
274 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
275 _exception ? JNI_ABORT: 0);
276 }
277 if (_exception) {
278 jniThrowException(_env, _exceptionType, _exceptionMessage);
279 }
280}
281
282
283template <typename CTYPE, void GET(GLenum, CTYPE*)>
284static void
285getarray
286 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
287 jint _exception = 0;
288 const char * _exceptionType;
289 const char * _exceptionMessage;
290 jarray _array = (jarray) 0;
291 jint _bufferOffset = (jint) 0;
292 jint _remaining;
293 CTYPE *params = (CTYPE *) 0;
294 int _needed = 0;
295
296 params = (CTYPE *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Andy McFaddencee51982013-04-25 16:08:31 -0700297 _remaining /= sizeof(CTYPE); // convert from bytes to item count
Mathias Agopian2ad04772013-02-23 03:12:30 -0800298 _needed = getNeededCount(pname);
299 // if we didn't find this pname, we just assume the user passed
300 // an array of the right size -- this might happen with extensions
301 // or if we forget an enum here.
302 if (_needed>0 && _remaining < _needed) {
303 _exception = 1;
304 _exceptionType = "java/lang/IllegalArgumentException";
305 _exceptionMessage = "remaining() < needed";
306 goto exit;
307 }
308 if (params == NULL) {
309 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
310 params = (CTYPE *) (_paramsBase + _bufferOffset);
311 }
312 GET(
313 (GLenum)pname,
314 (CTYPE *)params
315 );
316
317exit:
318 if (_array) {
319 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
320 }
321 if (_exception) {
322 jniThrowException(_env, _exceptionType, _exceptionMessage);
323 }
Jack Palevich560814f2009-11-19 16:34:55 +0800324}
325
326// --------------------------------------------------------------------------
Jack Palevich560814f2009-11-19 16:34:55 +0800327/* void glActiveTexture ( GLenum texture ) */
328static void
329android_glActiveTexture__I
330 (JNIEnv *_env, jobject _this, jint texture) {
331 glActiveTexture(
332 (GLenum)texture
333 );
334}
335
336/* void glAttachShader ( GLuint program, GLuint shader ) */
337static void
338android_glAttachShader__II
339 (JNIEnv *_env, jobject _this, jint program, jint shader) {
340 glAttachShader(
341 (GLuint)program,
342 (GLuint)shader
343 );
344}
345
346/* void glBindAttribLocation ( GLuint program, GLuint index, const char *name ) */
347static void
348android_glBindAttribLocation__IILjava_lang_String_2
349 (JNIEnv *_env, jobject _this, jint program, jint index, jstring name) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700350 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800351 const char * _exceptionType = NULL;
352 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800353 const char* _nativename = 0;
354
355 if (!name) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700356 _exceptionType = "java/lang/IllegalArgumentException";
357 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +0800358 goto exit;
359 }
360 _nativename = _env->GetStringUTFChars(name, 0);
361
362 glBindAttribLocation(
363 (GLuint)program,
364 (GLuint)index,
365 (char *)_nativename
366 );
367
368exit:
369 if (_nativename) {
370 _env->ReleaseStringUTFChars(name, _nativename);
371 }
372
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700373 if (_exception) {
374 jniThrowException(_env, _exceptionType, _exceptionMessage);
375 }
Jack Palevich560814f2009-11-19 16:34:55 +0800376}
377
378/* void glBindBuffer ( GLenum target, GLuint buffer ) */
379static void
380android_glBindBuffer__II
381 (JNIEnv *_env, jobject _this, jint target, jint buffer) {
382 glBindBuffer(
383 (GLenum)target,
384 (GLuint)buffer
385 );
386}
387
388/* void glBindFramebuffer ( GLenum target, GLuint framebuffer ) */
389static void
390android_glBindFramebuffer__II
391 (JNIEnv *_env, jobject _this, jint target, jint framebuffer) {
392 glBindFramebuffer(
393 (GLenum)target,
394 (GLuint)framebuffer
395 );
396}
397
398/* void glBindRenderbuffer ( GLenum target, GLuint renderbuffer ) */
399static void
400android_glBindRenderbuffer__II
401 (JNIEnv *_env, jobject _this, jint target, jint renderbuffer) {
402 glBindRenderbuffer(
403 (GLenum)target,
404 (GLuint)renderbuffer
405 );
406}
407
408/* void glBindTexture ( GLenum target, GLuint texture ) */
409static void
410android_glBindTexture__II
411 (JNIEnv *_env, jobject _this, jint target, jint texture) {
412 glBindTexture(
413 (GLenum)target,
414 (GLuint)texture
415 );
416}
417
418/* void glBlendColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
419static void
420android_glBlendColor__FFFF
421 (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
422 glBlendColor(
423 (GLclampf)red,
424 (GLclampf)green,
425 (GLclampf)blue,
426 (GLclampf)alpha
427 );
428}
429
430/* void glBlendEquation ( GLenum mode ) */
431static void
432android_glBlendEquation__I
433 (JNIEnv *_env, jobject _this, jint mode) {
Jack Palevich73108672011-03-28 14:49:12 -0700434 glBlendEquation(
435 (GLenum)mode
436 );
Jack Palevich560814f2009-11-19 16:34:55 +0800437}
438
439/* void glBlendEquationSeparate ( GLenum modeRGB, GLenum modeAlpha ) */
440static void
441android_glBlendEquationSeparate__II
442 (JNIEnv *_env, jobject _this, jint modeRGB, jint modeAlpha) {
Jack Palevich73108672011-03-28 14:49:12 -0700443 glBlendEquationSeparate(
444 (GLenum)modeRGB,
445 (GLenum)modeAlpha
446 );
Jack Palevich560814f2009-11-19 16:34:55 +0800447}
448
449/* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */
450static void
451android_glBlendFunc__II
452 (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) {
453 glBlendFunc(
454 (GLenum)sfactor,
455 (GLenum)dfactor
456 );
457}
458
459/* void glBlendFuncSeparate ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) */
460static void
461android_glBlendFuncSeparate__IIII
462 (JNIEnv *_env, jobject _this, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) {
Jack Palevich73108672011-03-28 14:49:12 -0700463 glBlendFuncSeparate(
464 (GLenum)srcRGB,
465 (GLenum)dstRGB,
466 (GLenum)srcAlpha,
467 (GLenum)dstAlpha
468 );
Jack Palevich560814f2009-11-19 16:34:55 +0800469}
470
471/* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */
472static void
473android_glBufferData__IILjava_nio_Buffer_2I
474 (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700475 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800476 const char * _exceptionType = NULL;
477 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800478 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700479 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800480 jint _remaining;
481 GLvoid *data = (GLvoid *) 0;
482
483 if (data_buf) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700484 data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +0800485 if (_remaining < size) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700486 _exception = 1;
487 _exceptionType = "java/lang/IllegalArgumentException";
488 _exceptionMessage = "remaining() < size < needed";
Jack Palevich560814f2009-11-19 16:34:55 +0800489 goto exit;
490 }
491 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -0700492 if (data_buf && data == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700493 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
494 data = (GLvoid *) (_dataBase + _bufferOffset);
495 }
Jack Palevich560814f2009-11-19 16:34:55 +0800496 glBufferData(
497 (GLenum)target,
498 (GLsizeiptr)size,
499 (GLvoid *)data,
500 (GLenum)usage
501 );
502
503exit:
504 if (_array) {
505 releasePointer(_env, _array, data, JNI_FALSE);
506 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700507 if (_exception) {
508 jniThrowException(_env, _exceptionType, _exceptionMessage);
509 }
Jack Palevich560814f2009-11-19 16:34:55 +0800510}
511
512/* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */
513static void
514android_glBufferSubData__IIILjava_nio_Buffer_2
515 (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700516 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800517 const char * _exceptionType = NULL;
518 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800519 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700520 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800521 jint _remaining;
522 GLvoid *data = (GLvoid *) 0;
523
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700524 data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +0800525 if (_remaining < size) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700526 _exception = 1;
527 _exceptionType = "java/lang/IllegalArgumentException";
528 _exceptionMessage = "remaining() < size < needed";
Jack Palevich560814f2009-11-19 16:34:55 +0800529 goto exit;
530 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700531 if (data == NULL) {
532 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
533 data = (GLvoid *) (_dataBase + _bufferOffset);
534 }
Jack Palevich560814f2009-11-19 16:34:55 +0800535 glBufferSubData(
536 (GLenum)target,
537 (GLintptr)offset,
538 (GLsizeiptr)size,
539 (GLvoid *)data
540 );
541
542exit:
543 if (_array) {
544 releasePointer(_env, _array, data, JNI_FALSE);
545 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700546 if (_exception) {
547 jniThrowException(_env, _exceptionType, _exceptionMessage);
548 }
Jack Palevich560814f2009-11-19 16:34:55 +0800549}
550
551/* GLenum glCheckFramebufferStatus ( GLenum target ) */
552static jint
553android_glCheckFramebufferStatus__I
554 (JNIEnv *_env, jobject _this, jint target) {
555 GLenum _returnValue;
556 _returnValue = glCheckFramebufferStatus(
557 (GLenum)target
558 );
Andy McFaddencee51982013-04-25 16:08:31 -0700559 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +0800560}
561
562/* void glClear ( GLbitfield mask ) */
563static void
564android_glClear__I
565 (JNIEnv *_env, jobject _this, jint mask) {
566 glClear(
567 (GLbitfield)mask
568 );
569}
570
571/* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
572static void
573android_glClearColor__FFFF
574 (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
575 glClearColor(
576 (GLclampf)red,
577 (GLclampf)green,
578 (GLclampf)blue,
579 (GLclampf)alpha
580 );
581}
582
583/* void glClearDepthf ( GLclampf depth ) */
584static void
585android_glClearDepthf__F
586 (JNIEnv *_env, jobject _this, jfloat depth) {
587 glClearDepthf(
588 (GLclampf)depth
589 );
590}
591
592/* void glClearStencil ( GLint s ) */
593static void
594android_glClearStencil__I
595 (JNIEnv *_env, jobject _this, jint s) {
596 glClearStencil(
597 (GLint)s
598 );
599}
600
601/* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */
602static void
603android_glColorMask__ZZZZ
604 (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) {
605 glColorMask(
606 (GLboolean)red,
607 (GLboolean)green,
608 (GLboolean)blue,
609 (GLboolean)alpha
610 );
611}
612
613/* void glCompileShader ( GLuint shader ) */
614static void
615android_glCompileShader__I
616 (JNIEnv *_env, jobject _this, jint shader) {
617 glCompileShader(
618 (GLuint)shader
619 );
620}
621
622/* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */
623static void
624android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2
625 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) {
626 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700627 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800628 jint _remaining;
629 GLvoid *data = (GLvoid *) 0;
630
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700631 data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
632 if (data == NULL) {
633 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
634 data = (GLvoid *) (_dataBase + _bufferOffset);
635 }
Jack Palevich560814f2009-11-19 16:34:55 +0800636 glCompressedTexImage2D(
637 (GLenum)target,
638 (GLint)level,
639 (GLenum)internalformat,
640 (GLsizei)width,
641 (GLsizei)height,
642 (GLint)border,
643 (GLsizei)imageSize,
644 (GLvoid *)data
645 );
646 if (_array) {
647 releasePointer(_env, _array, data, JNI_FALSE);
648 }
649}
650
651/* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */
652static void
653android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
654 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) {
655 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700656 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800657 jint _remaining;
658 GLvoid *data = (GLvoid *) 0;
659
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700660 data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
661 if (data == NULL) {
662 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
663 data = (GLvoid *) (_dataBase + _bufferOffset);
664 }
Jack Palevich560814f2009-11-19 16:34:55 +0800665 glCompressedTexSubImage2D(
666 (GLenum)target,
667 (GLint)level,
668 (GLint)xoffset,
669 (GLint)yoffset,
670 (GLsizei)width,
671 (GLsizei)height,
672 (GLenum)format,
673 (GLsizei)imageSize,
674 (GLvoid *)data
675 );
676 if (_array) {
677 releasePointer(_env, _array, data, JNI_FALSE);
678 }
679}
680
681/* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */
682static void
683android_glCopyTexImage2D__IIIIIIII
684 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) {
685 glCopyTexImage2D(
686 (GLenum)target,
687 (GLint)level,
688 (GLenum)internalformat,
689 (GLint)x,
690 (GLint)y,
691 (GLsizei)width,
692 (GLsizei)height,
693 (GLint)border
694 );
695}
696
697/* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */
698static void
699android_glCopyTexSubImage2D__IIIIIIII
700 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) {
701 glCopyTexSubImage2D(
702 (GLenum)target,
703 (GLint)level,
704 (GLint)xoffset,
705 (GLint)yoffset,
706 (GLint)x,
707 (GLint)y,
708 (GLsizei)width,
709 (GLsizei)height
710 );
711}
712
713/* GLuint glCreateProgram ( void ) */
714static jint
715android_glCreateProgram__
716 (JNIEnv *_env, jobject _this) {
717 GLuint _returnValue;
718 _returnValue = glCreateProgram();
Andy McFaddencee51982013-04-25 16:08:31 -0700719 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +0800720}
721
722/* GLuint glCreateShader ( GLenum type ) */
723static jint
724android_glCreateShader__I
725 (JNIEnv *_env, jobject _this, jint type) {
726 GLuint _returnValue;
727 _returnValue = glCreateShader(
728 (GLenum)type
729 );
Andy McFaddencee51982013-04-25 16:08:31 -0700730 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +0800731}
732
733/* void glCullFace ( GLenum mode ) */
734static void
735android_glCullFace__I
736 (JNIEnv *_env, jobject _this, jint mode) {
737 glCullFace(
738 (GLenum)mode
739 );
740}
741
742/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
743static void
744android_glDeleteBuffers__I_3II
745 (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700746 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800747 const char * _exceptionType = NULL;
748 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800749 GLuint *buffers_base = (GLuint *) 0;
750 jint _remaining;
751 GLuint *buffers = (GLuint *) 0;
752
753 if (!buffers_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700754 _exception = 1;
755 _exceptionType = "java/lang/IllegalArgumentException";
756 _exceptionMessage = "buffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +0800757 goto exit;
758 }
759 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700760 _exception = 1;
761 _exceptionType = "java/lang/IllegalArgumentException";
762 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +0800763 goto exit;
764 }
765 _remaining = _env->GetArrayLength(buffers_ref) - offset;
766 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700767 _exception = 1;
768 _exceptionType = "java/lang/IllegalArgumentException";
769 _exceptionMessage = "length - offset < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +0800770 goto exit;
771 }
772 buffers_base = (GLuint *)
773 _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
774 buffers = buffers_base + offset;
775
776 glDeleteBuffers(
777 (GLsizei)n,
778 (GLuint *)buffers
779 );
780
781exit:
782 if (buffers_base) {
783 _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
784 JNI_ABORT);
785 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700786 if (_exception) {
787 jniThrowException(_env, _exceptionType, _exceptionMessage);
788 }
Jack Palevich560814f2009-11-19 16:34:55 +0800789}
790
791/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
792static void
793android_glDeleteBuffers__ILjava_nio_IntBuffer_2
794 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700795 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800796 const char * _exceptionType = NULL;
797 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800798 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700799 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800800 jint _remaining;
801 GLuint *buffers = (GLuint *) 0;
802
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700803 buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +0800804 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700805 _exception = 1;
806 _exceptionType = "java/lang/IllegalArgumentException";
807 _exceptionMessage = "remaining() < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +0800808 goto exit;
809 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700810 if (buffers == NULL) {
811 char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
812 buffers = (GLuint *) (_buffersBase + _bufferOffset);
813 }
Jack Palevich560814f2009-11-19 16:34:55 +0800814 glDeleteBuffers(
815 (GLsizei)n,
816 (GLuint *)buffers
817 );
818
819exit:
820 if (_array) {
821 releasePointer(_env, _array, buffers, JNI_FALSE);
822 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700823 if (_exception) {
824 jniThrowException(_env, _exceptionType, _exceptionMessage);
825 }
Jack Palevich560814f2009-11-19 16:34:55 +0800826}
827
828/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */
829static void
830android_glDeleteFramebuffers__I_3II
831 (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700832 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800833 const char * _exceptionType = NULL;
834 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800835 GLuint *framebuffers_base = (GLuint *) 0;
836 jint _remaining;
837 GLuint *framebuffers = (GLuint *) 0;
838
839 if (!framebuffers_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700840 _exception = 1;
841 _exceptionType = "java/lang/IllegalArgumentException";
842 _exceptionMessage = "framebuffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +0800843 goto exit;
844 }
845 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700846 _exception = 1;
847 _exceptionType = "java/lang/IllegalArgumentException";
848 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +0800849 goto exit;
850 }
851 _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800852 if (_remaining < n) {
853 _exception = 1;
854 _exceptionType = "java/lang/IllegalArgumentException";
855 _exceptionMessage = "length - offset < n < needed";
856 goto exit;
857 }
Jack Palevich560814f2009-11-19 16:34:55 +0800858 framebuffers_base = (GLuint *)
859 _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0);
860 framebuffers = framebuffers_base + offset;
861
862 glDeleteFramebuffers(
863 (GLsizei)n,
864 (GLuint *)framebuffers
865 );
866
867exit:
868 if (framebuffers_base) {
869 _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base,
870 JNI_ABORT);
871 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700872 if (_exception) {
873 jniThrowException(_env, _exceptionType, _exceptionMessage);
874 }
Jack Palevich560814f2009-11-19 16:34:55 +0800875}
876
877/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */
878static void
879android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2
880 (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -0800881 jint _exception = 0;
882 const char * _exceptionType = NULL;
883 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800884 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700885 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800886 jint _remaining;
887 GLuint *framebuffers = (GLuint *) 0;
888
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700889 framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800890 if (_remaining < n) {
891 _exception = 1;
892 _exceptionType = "java/lang/IllegalArgumentException";
893 _exceptionMessage = "remaining() < n < needed";
894 goto exit;
895 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700896 if (framebuffers == NULL) {
897 char * _framebuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
898 framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
899 }
Jack Palevich560814f2009-11-19 16:34:55 +0800900 glDeleteFramebuffers(
901 (GLsizei)n,
902 (GLuint *)framebuffers
903 );
Mathias Agopian2ad04772013-02-23 03:12:30 -0800904
905exit:
Jack Palevich560814f2009-11-19 16:34:55 +0800906 if (_array) {
907 releasePointer(_env, _array, framebuffers, JNI_FALSE);
908 }
Mathias Agopian2ad04772013-02-23 03:12:30 -0800909 if (_exception) {
910 jniThrowException(_env, _exceptionType, _exceptionMessage);
911 }
Jack Palevich560814f2009-11-19 16:34:55 +0800912}
913
914/* void glDeleteProgram ( GLuint program ) */
915static void
916android_glDeleteProgram__I
917 (JNIEnv *_env, jobject _this, jint program) {
918 glDeleteProgram(
919 (GLuint)program
920 );
921}
922
923/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */
924static void
925android_glDeleteRenderbuffers__I_3II
926 (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700927 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800928 const char * _exceptionType = NULL;
929 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800930 GLuint *renderbuffers_base = (GLuint *) 0;
931 jint _remaining;
932 GLuint *renderbuffers = (GLuint *) 0;
933
934 if (!renderbuffers_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700935 _exception = 1;
936 _exceptionType = "java/lang/IllegalArgumentException";
937 _exceptionMessage = "renderbuffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +0800938 goto exit;
939 }
940 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700941 _exception = 1;
942 _exceptionType = "java/lang/IllegalArgumentException";
943 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +0800944 goto exit;
945 }
946 _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800947 if (_remaining < n) {
948 _exception = 1;
949 _exceptionType = "java/lang/IllegalArgumentException";
950 _exceptionMessage = "length - offset < n < needed";
951 goto exit;
952 }
Jack Palevich560814f2009-11-19 16:34:55 +0800953 renderbuffers_base = (GLuint *)
954 _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0);
955 renderbuffers = renderbuffers_base + offset;
956
957 glDeleteRenderbuffers(
958 (GLsizei)n,
959 (GLuint *)renderbuffers
960 );
961
962exit:
963 if (renderbuffers_base) {
964 _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base,
965 JNI_ABORT);
966 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700967 if (_exception) {
968 jniThrowException(_env, _exceptionType, _exceptionMessage);
969 }
Jack Palevich560814f2009-11-19 16:34:55 +0800970}
971
972/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */
973static void
974android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2
975 (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -0800976 jint _exception = 0;
977 const char * _exceptionType = NULL;
978 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800979 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700980 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800981 jint _remaining;
982 GLuint *renderbuffers = (GLuint *) 0;
983
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700984 renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800985 if (_remaining < n) {
986 _exception = 1;
987 _exceptionType = "java/lang/IllegalArgumentException";
988 _exceptionMessage = "remaining() < n < needed";
989 goto exit;
990 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700991 if (renderbuffers == NULL) {
992 char * _renderbuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
993 renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
994 }
Jack Palevich560814f2009-11-19 16:34:55 +0800995 glDeleteRenderbuffers(
996 (GLsizei)n,
997 (GLuint *)renderbuffers
998 );
Mathias Agopian2ad04772013-02-23 03:12:30 -0800999
1000exit:
Jack Palevich560814f2009-11-19 16:34:55 +08001001 if (_array) {
1002 releasePointer(_env, _array, renderbuffers, JNI_FALSE);
1003 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08001004 if (_exception) {
1005 jniThrowException(_env, _exceptionType, _exceptionMessage);
1006 }
Jack Palevich560814f2009-11-19 16:34:55 +08001007}
1008
1009/* void glDeleteShader ( GLuint shader ) */
1010static void
1011android_glDeleteShader__I
1012 (JNIEnv *_env, jobject _this, jint shader) {
1013 glDeleteShader(
1014 (GLuint)shader
1015 );
1016}
1017
1018/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
1019static void
1020android_glDeleteTextures__I_3II
1021 (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001022 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001023 const char * _exceptionType = NULL;
1024 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001025 GLuint *textures_base = (GLuint *) 0;
1026 jint _remaining;
1027 GLuint *textures = (GLuint *) 0;
1028
1029 if (!textures_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001030 _exception = 1;
1031 _exceptionType = "java/lang/IllegalArgumentException";
1032 _exceptionMessage = "textures == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001033 goto exit;
1034 }
1035 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001036 _exception = 1;
1037 _exceptionType = "java/lang/IllegalArgumentException";
1038 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001039 goto exit;
1040 }
1041 _remaining = _env->GetArrayLength(textures_ref) - offset;
1042 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001043 _exception = 1;
1044 _exceptionType = "java/lang/IllegalArgumentException";
1045 _exceptionMessage = "length - offset < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001046 goto exit;
1047 }
1048 textures_base = (GLuint *)
1049 _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
1050 textures = textures_base + offset;
1051
1052 glDeleteTextures(
1053 (GLsizei)n,
1054 (GLuint *)textures
1055 );
1056
1057exit:
1058 if (textures_base) {
1059 _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
1060 JNI_ABORT);
1061 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001062 if (_exception) {
1063 jniThrowException(_env, _exceptionType, _exceptionMessage);
1064 }
Jack Palevich560814f2009-11-19 16:34:55 +08001065}
1066
1067/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
1068static void
1069android_glDeleteTextures__ILjava_nio_IntBuffer_2
1070 (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001071 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001072 const char * _exceptionType = NULL;
1073 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001074 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001075 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001076 jint _remaining;
1077 GLuint *textures = (GLuint *) 0;
1078
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001079 textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08001080 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001081 _exception = 1;
1082 _exceptionType = "java/lang/IllegalArgumentException";
1083 _exceptionMessage = "remaining() < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001084 goto exit;
1085 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001086 if (textures == NULL) {
1087 char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1088 textures = (GLuint *) (_texturesBase + _bufferOffset);
1089 }
Jack Palevich560814f2009-11-19 16:34:55 +08001090 glDeleteTextures(
1091 (GLsizei)n,
1092 (GLuint *)textures
1093 );
1094
1095exit:
1096 if (_array) {
1097 releasePointer(_env, _array, textures, JNI_FALSE);
1098 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001099 if (_exception) {
1100 jniThrowException(_env, _exceptionType, _exceptionMessage);
1101 }
Jack Palevich560814f2009-11-19 16:34:55 +08001102}
1103
1104/* void glDepthFunc ( GLenum func ) */
1105static void
1106android_glDepthFunc__I
1107 (JNIEnv *_env, jobject _this, jint func) {
1108 glDepthFunc(
1109 (GLenum)func
1110 );
1111}
1112
1113/* void glDepthMask ( GLboolean flag ) */
1114static void
1115android_glDepthMask__Z
1116 (JNIEnv *_env, jobject _this, jboolean flag) {
1117 glDepthMask(
1118 (GLboolean)flag
1119 );
1120}
1121
1122/* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */
1123static void
1124android_glDepthRangef__FF
1125 (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) {
1126 glDepthRangef(
1127 (GLclampf)zNear,
1128 (GLclampf)zFar
1129 );
1130}
1131
1132/* void glDetachShader ( GLuint program, GLuint shader ) */
1133static void
1134android_glDetachShader__II
1135 (JNIEnv *_env, jobject _this, jint program, jint shader) {
1136 glDetachShader(
1137 (GLuint)program,
1138 (GLuint)shader
1139 );
1140}
1141
1142/* void glDisable ( GLenum cap ) */
1143static void
1144android_glDisable__I
1145 (JNIEnv *_env, jobject _this, jint cap) {
1146 glDisable(
1147 (GLenum)cap
1148 );
1149}
1150
1151/* void glDisableVertexAttribArray ( GLuint index ) */
1152static void
1153android_glDisableVertexAttribArray__I
1154 (JNIEnv *_env, jobject _this, jint index) {
1155 glDisableVertexAttribArray(
1156 (GLuint)index
1157 );
1158}
1159
1160/* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */
1161static void
1162android_glDrawArrays__III
1163 (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) {
1164 glDrawArrays(
1165 (GLenum)mode,
1166 (GLint)first,
1167 (GLsizei)count
1168 );
1169}
1170
Jack Palevich224107a2010-06-22 20:08:40 +08001171/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */
1172static void
1173android_glDrawElements__IIII
1174 (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001175 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001176 const char * _exceptionType = NULL;
1177 const char * _exceptionMessage = NULL;
Jack Palevich224107a2010-06-22 20:08:40 +08001178 glDrawElements(
1179 (GLenum)mode,
1180 (GLsizei)count,
1181 (GLenum)type,
Andy McFaddencee51982013-04-25 16:08:31 -07001182 (GLvoid *)offset
Jack Palevich224107a2010-06-22 20:08:40 +08001183 );
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001184 if (_exception) {
1185 jniThrowException(_env, _exceptionType, _exceptionMessage);
1186 }
Jack Palevich224107a2010-06-22 20:08:40 +08001187}
1188
Jack Palevich560814f2009-11-19 16:34:55 +08001189/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */
1190static void
1191android_glDrawElements__IIILjava_nio_Buffer_2
1192 (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001193 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001194 const char * _exceptionType = NULL;
1195 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001196 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001197 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001198 jint _remaining;
1199 GLvoid *indices = (GLvoid *) 0;
1200
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001201 indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08001202 if (_remaining < count) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001203 _exception = 1;
1204 _exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
1205 _exceptionMessage = "remaining() < count < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001206 goto exit;
1207 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001208 if (indices == NULL) {
1209 char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1210 indices = (GLvoid *) (_indicesBase + _bufferOffset);
1211 }
Jack Palevich560814f2009-11-19 16:34:55 +08001212 glDrawElements(
1213 (GLenum)mode,
1214 (GLsizei)count,
1215 (GLenum)type,
1216 (GLvoid *)indices
1217 );
1218
1219exit:
1220 if (_array) {
1221 releasePointer(_env, _array, indices, JNI_FALSE);
1222 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001223 if (_exception) {
1224 jniThrowException(_env, _exceptionType, _exceptionMessage);
1225 }
Jack Palevich560814f2009-11-19 16:34:55 +08001226}
1227
1228/* void glEnable ( GLenum cap ) */
1229static void
1230android_glEnable__I
1231 (JNIEnv *_env, jobject _this, jint cap) {
1232 glEnable(
1233 (GLenum)cap
1234 );
1235}
1236
1237/* void glEnableVertexAttribArray ( GLuint index ) */
1238static void
1239android_glEnableVertexAttribArray__I
1240 (JNIEnv *_env, jobject _this, jint index) {
1241 glEnableVertexAttribArray(
1242 (GLuint)index
1243 );
1244}
1245
1246/* void glFinish ( void ) */
1247static void
1248android_glFinish__
1249 (JNIEnv *_env, jobject _this) {
1250 glFinish();
1251}
1252
1253/* void glFlush ( void ) */
1254static void
1255android_glFlush__
1256 (JNIEnv *_env, jobject _this) {
1257 glFlush();
1258}
1259
1260/* void glFramebufferRenderbuffer ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) */
1261static void
1262android_glFramebufferRenderbuffer__IIII
1263 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint renderbuffertarget, jint renderbuffer) {
1264 glFramebufferRenderbuffer(
1265 (GLenum)target,
1266 (GLenum)attachment,
1267 (GLenum)renderbuffertarget,
1268 (GLuint)renderbuffer
1269 );
1270}
1271
1272/* void glFramebufferTexture2D ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) */
1273static void
1274android_glFramebufferTexture2D__IIIII
1275 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint textarget, jint texture, jint level) {
1276 glFramebufferTexture2D(
1277 (GLenum)target,
1278 (GLenum)attachment,
1279 (GLenum)textarget,
1280 (GLuint)texture,
1281 (GLint)level
1282 );
1283}
1284
1285/* void glFrontFace ( GLenum mode ) */
1286static void
1287android_glFrontFace__I
1288 (JNIEnv *_env, jobject _this, jint mode) {
1289 glFrontFace(
1290 (GLenum)mode
1291 );
1292}
1293
1294/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
1295static void
1296android_glGenBuffers__I_3II
1297 (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
1298 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001299 const char * _exceptionType = NULL;
1300 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001301 GLuint *buffers_base = (GLuint *) 0;
1302 jint _remaining;
1303 GLuint *buffers = (GLuint *) 0;
1304
1305 if (!buffers_ref) {
1306 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001307 _exceptionType = "java/lang/IllegalArgumentException";
1308 _exceptionMessage = "buffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001309 goto exit;
1310 }
1311 if (offset < 0) {
1312 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001313 _exceptionType = "java/lang/IllegalArgumentException";
1314 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001315 goto exit;
1316 }
1317 _remaining = _env->GetArrayLength(buffers_ref) - offset;
1318 if (_remaining < n) {
1319 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001320 _exceptionType = "java/lang/IllegalArgumentException";
1321 _exceptionMessage = "length - offset < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001322 goto exit;
1323 }
1324 buffers_base = (GLuint *)
1325 _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
1326 buffers = buffers_base + offset;
1327
1328 glGenBuffers(
1329 (GLsizei)n,
1330 (GLuint *)buffers
1331 );
1332
1333exit:
1334 if (buffers_base) {
1335 _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
1336 _exception ? JNI_ABORT: 0);
1337 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001338 if (_exception) {
1339 jniThrowException(_env, _exceptionType, _exceptionMessage);
1340 }
Jack Palevich560814f2009-11-19 16:34:55 +08001341}
1342
1343/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
1344static void
1345android_glGenBuffers__ILjava_nio_IntBuffer_2
1346 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
1347 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001348 const char * _exceptionType = NULL;
1349 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001350 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001351 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001352 jint _remaining;
1353 GLuint *buffers = (GLuint *) 0;
1354
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001355 buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08001356 if (_remaining < n) {
1357 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001358 _exceptionType = "java/lang/IllegalArgumentException";
1359 _exceptionMessage = "remaining() < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001360 goto exit;
1361 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001362 if (buffers == NULL) {
1363 char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1364 buffers = (GLuint *) (_buffersBase + _bufferOffset);
1365 }
Jack Palevich560814f2009-11-19 16:34:55 +08001366 glGenBuffers(
1367 (GLsizei)n,
1368 (GLuint *)buffers
1369 );
1370
1371exit:
1372 if (_array) {
1373 releasePointer(_env, _array, buffers, _exception ? JNI_FALSE : JNI_TRUE);
1374 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001375 if (_exception) {
1376 jniThrowException(_env, _exceptionType, _exceptionMessage);
1377 }
Jack Palevich560814f2009-11-19 16:34:55 +08001378}
1379
1380/* void glGenerateMipmap ( GLenum target ) */
1381static void
1382android_glGenerateMipmap__I
1383 (JNIEnv *_env, jobject _this, jint target) {
1384 glGenerateMipmap(
1385 (GLenum)target
1386 );
1387}
1388
1389/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */
1390static void
1391android_glGenFramebuffers__I_3II
1392 (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
1393 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001394 const char * _exceptionType = NULL;
1395 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001396 GLuint *framebuffers_base = (GLuint *) 0;
1397 jint _remaining;
1398 GLuint *framebuffers = (GLuint *) 0;
1399
1400 if (!framebuffers_ref) {
1401 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001402 _exceptionType = "java/lang/IllegalArgumentException";
1403 _exceptionMessage = "framebuffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001404 goto exit;
1405 }
1406 if (offset < 0) {
1407 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001408 _exceptionType = "java/lang/IllegalArgumentException";
1409 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001410 goto exit;
1411 }
1412 _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001413 if (_remaining < n) {
1414 _exception = 1;
1415 _exceptionType = "java/lang/IllegalArgumentException";
1416 _exceptionMessage = "length - offset < n < needed";
1417 goto exit;
1418 }
Jack Palevich560814f2009-11-19 16:34:55 +08001419 framebuffers_base = (GLuint *)
1420 _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0);
1421 framebuffers = framebuffers_base + offset;
1422
1423 glGenFramebuffers(
1424 (GLsizei)n,
1425 (GLuint *)framebuffers
1426 );
1427
1428exit:
1429 if (framebuffers_base) {
1430 _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base,
1431 _exception ? JNI_ABORT: 0);
1432 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001433 if (_exception) {
1434 jniThrowException(_env, _exceptionType, _exceptionMessage);
1435 }
Jack Palevich560814f2009-11-19 16:34:55 +08001436}
1437
1438/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */
1439static void
1440android_glGenFramebuffers__ILjava_nio_IntBuffer_2
1441 (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001442 jint _exception = 0;
1443 const char * _exceptionType = NULL;
1444 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001445 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001446 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001447 jint _remaining;
1448 GLuint *framebuffers = (GLuint *) 0;
1449
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001450 framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001451 if (_remaining < n) {
1452 _exception = 1;
1453 _exceptionType = "java/lang/IllegalArgumentException";
1454 _exceptionMessage = "remaining() < n < needed";
1455 goto exit;
1456 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001457 if (framebuffers == NULL) {
1458 char * _framebuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1459 framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
1460 }
Jack Palevich560814f2009-11-19 16:34:55 +08001461 glGenFramebuffers(
1462 (GLsizei)n,
1463 (GLuint *)framebuffers
1464 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08001465
1466exit:
Jack Palevich560814f2009-11-19 16:34:55 +08001467 if (_array) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001468 releasePointer(_env, _array, framebuffers, _exception ? JNI_FALSE : JNI_TRUE);
1469 }
1470 if (_exception) {
1471 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08001472 }
1473}
1474
1475/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */
1476static void
1477android_glGenRenderbuffers__I_3II
1478 (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
1479 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001480 const char * _exceptionType = NULL;
1481 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001482 GLuint *renderbuffers_base = (GLuint *) 0;
1483 jint _remaining;
1484 GLuint *renderbuffers = (GLuint *) 0;
1485
1486 if (!renderbuffers_ref) {
1487 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001488 _exceptionType = "java/lang/IllegalArgumentException";
1489 _exceptionMessage = "renderbuffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001490 goto exit;
1491 }
1492 if (offset < 0) {
1493 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001494 _exceptionType = "java/lang/IllegalArgumentException";
1495 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001496 goto exit;
1497 }
1498 _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001499 if (_remaining < n) {
1500 _exception = 1;
1501 _exceptionType = "java/lang/IllegalArgumentException";
1502 _exceptionMessage = "length - offset < n < needed";
1503 goto exit;
1504 }
Jack Palevich560814f2009-11-19 16:34:55 +08001505 renderbuffers_base = (GLuint *)
1506 _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0);
1507 renderbuffers = renderbuffers_base + offset;
1508
1509 glGenRenderbuffers(
1510 (GLsizei)n,
1511 (GLuint *)renderbuffers
1512 );
1513
1514exit:
1515 if (renderbuffers_base) {
1516 _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base,
1517 _exception ? JNI_ABORT: 0);
1518 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001519 if (_exception) {
1520 jniThrowException(_env, _exceptionType, _exceptionMessage);
1521 }
Jack Palevich560814f2009-11-19 16:34:55 +08001522}
1523
1524/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */
1525static void
1526android_glGenRenderbuffers__ILjava_nio_IntBuffer_2
1527 (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001528 jint _exception = 0;
1529 const char * _exceptionType = NULL;
1530 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001531 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001532 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001533 jint _remaining;
1534 GLuint *renderbuffers = (GLuint *) 0;
1535
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001536 renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001537 if (_remaining < n) {
1538 _exception = 1;
1539 _exceptionType = "java/lang/IllegalArgumentException";
1540 _exceptionMessage = "remaining() < n < needed";
1541 goto exit;
1542 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001543 if (renderbuffers == NULL) {
1544 char * _renderbuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1545 renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
1546 }
Jack Palevich560814f2009-11-19 16:34:55 +08001547 glGenRenderbuffers(
1548 (GLsizei)n,
1549 (GLuint *)renderbuffers
1550 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08001551
1552exit:
Jack Palevich560814f2009-11-19 16:34:55 +08001553 if (_array) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001554 releasePointer(_env, _array, renderbuffers, _exception ? JNI_FALSE : JNI_TRUE);
1555 }
1556 if (_exception) {
1557 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08001558 }
1559}
1560
1561/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1562static void
1563android_glGenTextures__I_3II
1564 (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
1565 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001566 const char * _exceptionType = NULL;
1567 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001568 GLuint *textures_base = (GLuint *) 0;
1569 jint _remaining;
1570 GLuint *textures = (GLuint *) 0;
1571
1572 if (!textures_ref) {
1573 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001574 _exceptionType = "java/lang/IllegalArgumentException";
1575 _exceptionMessage = "textures == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001576 goto exit;
1577 }
1578 if (offset < 0) {
1579 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001580 _exceptionType = "java/lang/IllegalArgumentException";
1581 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001582 goto exit;
1583 }
1584 _remaining = _env->GetArrayLength(textures_ref) - offset;
1585 if (_remaining < n) {
1586 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001587 _exceptionType = "java/lang/IllegalArgumentException";
1588 _exceptionMessage = "length - offset < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001589 goto exit;
1590 }
1591 textures_base = (GLuint *)
1592 _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
1593 textures = textures_base + offset;
1594
1595 glGenTextures(
1596 (GLsizei)n,
1597 (GLuint *)textures
1598 );
1599
1600exit:
1601 if (textures_base) {
1602 _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
1603 _exception ? JNI_ABORT: 0);
1604 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001605 if (_exception) {
1606 jniThrowException(_env, _exceptionType, _exceptionMessage);
1607 }
Jack Palevich560814f2009-11-19 16:34:55 +08001608}
1609
1610/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1611static void
1612android_glGenTextures__ILjava_nio_IntBuffer_2
1613 (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
1614 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001615 const char * _exceptionType = NULL;
1616 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001617 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001618 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001619 jint _remaining;
1620 GLuint *textures = (GLuint *) 0;
1621
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001622 textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08001623 if (_remaining < n) {
1624 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001625 _exceptionType = "java/lang/IllegalArgumentException";
1626 _exceptionMessage = "remaining() < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001627 goto exit;
1628 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001629 if (textures == NULL) {
1630 char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1631 textures = (GLuint *) (_texturesBase + _bufferOffset);
1632 }
Jack Palevich560814f2009-11-19 16:34:55 +08001633 glGenTextures(
1634 (GLsizei)n,
1635 (GLuint *)textures
1636 );
1637
1638exit:
1639 if (_array) {
1640 releasePointer(_env, _array, textures, _exception ? JNI_FALSE : JNI_TRUE);
1641 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001642 if (_exception) {
1643 jniThrowException(_env, _exceptionType, _exceptionMessage);
1644 }
Jack Palevich560814f2009-11-19 16:34:55 +08001645}
1646
1647/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1648static void
1649android_glGetActiveAttrib__III_3II_3II_3II_3BI
1650 (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) {
1651 jint _exception = 0;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001652 const char * _exceptionType;
1653 const char * _exceptionMessage;
Jack Palevich560814f2009-11-19 16:34:55 +08001654 GLsizei *length_base = (GLsizei *) 0;
1655 jint _lengthRemaining;
1656 GLsizei *length = (GLsizei *) 0;
1657 GLint *size_base = (GLint *) 0;
1658 jint _sizeRemaining;
1659 GLint *size = (GLint *) 0;
1660 GLenum *type_base = (GLenum *) 0;
1661 jint _typeRemaining;
1662 GLenum *type = (GLenum *) 0;
1663 char *name_base = (char *) 0;
1664 jint _nameRemaining;
1665 char *name = (char *) 0;
1666
1667 if (!length_ref) {
1668 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001669 _exceptionType = "java/lang/IllegalArgumentException";
1670 _exceptionMessage = "length == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001671 goto exit;
1672 }
1673 if (lengthOffset < 0) {
1674 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001675 _exceptionType = "java/lang/IllegalArgumentException";
1676 _exceptionMessage = "lengthOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001677 goto exit;
1678 }
1679 _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
1680 length_base = (GLsizei *)
1681 _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
1682 length = length_base + lengthOffset;
1683
1684 if (!size_ref) {
1685 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001686 _exceptionType = "java/lang/IllegalArgumentException";
1687 _exceptionMessage = "size == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001688 goto exit;
1689 }
1690 if (sizeOffset < 0) {
1691 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001692 _exceptionType = "java/lang/IllegalArgumentException";
1693 _exceptionMessage = "sizeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001694 goto exit;
1695 }
1696 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
1697 size_base = (GLint *)
1698 _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
1699 size = size_base + sizeOffset;
1700
1701 if (!type_ref) {
1702 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001703 _exceptionType = "java/lang/IllegalArgumentException";
1704 _exceptionMessage = "type == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001705 goto exit;
1706 }
1707 if (typeOffset < 0) {
1708 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001709 _exceptionType = "java/lang/IllegalArgumentException";
1710 _exceptionMessage = "typeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001711 goto exit;
1712 }
1713 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
1714 type_base = (GLenum *)
1715 _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
1716 type = type_base + typeOffset;
1717
1718 if (!name_ref) {
1719 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001720 _exceptionType = "java/lang/IllegalArgumentException";
1721 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001722 goto exit;
1723 }
1724 if (nameOffset < 0) {
1725 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001726 _exceptionType = "java/lang/IllegalArgumentException";
1727 _exceptionMessage = "nameOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001728 goto exit;
1729 }
1730 _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
1731 name_base = (char *)
1732 _env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0);
1733 name = name_base + nameOffset;
1734
1735 glGetActiveAttrib(
1736 (GLuint)program,
1737 (GLuint)index,
1738 (GLsizei)bufsize,
1739 (GLsizei *)length,
1740 (GLint *)size,
1741 (GLenum *)type,
1742 (char *)name
1743 );
1744
1745exit:
1746 if (name_base) {
1747 _env->ReleasePrimitiveArrayCritical(name_ref, name_base,
1748 _exception ? JNI_ABORT: 0);
1749 }
1750 if (type_base) {
1751 _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
1752 _exception ? JNI_ABORT: 0);
1753 }
1754 if (size_base) {
1755 _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
1756 _exception ? JNI_ABORT: 0);
1757 }
1758 if (length_base) {
1759 _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
1760 _exception ? JNI_ABORT: 0);
1761 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001762 if (_exception) {
1763 jniThrowException(_env, _exceptionType, _exceptionMessage);
1764 }
Jack Palevich560814f2009-11-19 16:34:55 +08001765}
1766
1767/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1768static void
1769android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
1770 (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 +08001771 jarray _lengthArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001772 jint _lengthBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001773 jarray _sizeArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001774 jint _sizeBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001775 jarray _typeArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001776 jint _typeBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001777 jint _lengthRemaining;
1778 GLsizei *length = (GLsizei *) 0;
1779 jint _sizeRemaining;
1780 GLint *size = (GLint *) 0;
1781 jint _typeRemaining;
1782 GLenum *type = (GLenum *) 0;
1783
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001784 length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
1785 size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
1786 type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
1787 if (length == NULL) {
1788 char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0);
1789 length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
1790 }
1791 if (size == NULL) {
1792 char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
1793 size = (GLint *) (_sizeBase + _sizeBufferOffset);
1794 }
1795 if (type == NULL) {
1796 char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
1797 type = (GLenum *) (_typeBase + _typeBufferOffset);
1798 }
Jack Palevich560814f2009-11-19 16:34:55 +08001799 glGetActiveAttrib(
1800 (GLuint)program,
1801 (GLuint)index,
1802 (GLsizei)bufsize,
1803 (GLsizei *)length,
1804 (GLint *)size,
1805 (GLenum *)type,
1806 (char *)name
1807 );
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001808 if (_typeArray) {
1809 releasePointer(_env, _typeArray, type, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08001810 }
1811 if (_sizeArray) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001812 releasePointer(_env, _sizeArray, size, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08001813 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001814 if (_lengthArray) {
1815 releasePointer(_env, _lengthArray, length, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08001816 }
1817}
1818
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07001819/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1820static jstring
1821android_glGetActiveAttrib1
1822 (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
1823 jint _exception = 0;
1824 const char * _exceptionType;
1825 const char * _exceptionMessage;
1826 GLint *size_base = (GLint *) 0;
1827 jint _sizeRemaining;
1828 GLint *size = (GLint *) 0;
1829 GLenum *type_base = (GLenum *) 0;
1830 jint _typeRemaining;
1831 GLenum *type = (GLenum *) 0;
1832
1833 jstring result = 0;
1834
1835 GLint len = 0;
1836 glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
1837 if (!len) {
1838 return _env->NewStringUTF("");
1839 }
1840 char* buf = (char*) malloc(len);
1841
1842 if (buf == NULL) {
1843 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
1844 return NULL;
1845 }
1846 if (!size_ref) {
1847 _exception = 1;
1848 _exceptionType = "java/lang/IllegalArgumentException";
1849 _exceptionMessage = "size == null";
1850 goto exit;
1851 }
1852 if (sizeOffset < 0) {
1853 _exception = 1;
1854 _exceptionType = "java/lang/IllegalArgumentException";
1855 _exceptionMessage = "sizeOffset < 0";
1856 goto exit;
1857 }
1858 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
1859 size_base = (GLint *)
1860 _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
1861 size = size_base + sizeOffset;
1862
1863 if (!type_ref) {
1864 _exception = 1;
1865 _exceptionType = "java/lang/IllegalArgumentException";
1866 _exceptionMessage = "type == null";
1867 goto exit;
1868 }
1869 if (typeOffset < 0) {
1870 _exception = 1;
1871 _exceptionType = "java/lang/IllegalArgumentException";
1872 _exceptionMessage = "typeOffset < 0";
1873 goto exit;
1874 }
1875 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
1876 type_base = (GLenum *)
1877 _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
1878 type = type_base + typeOffset;
1879
1880 glGetActiveAttrib(
1881 (GLuint)program,
1882 (GLuint)index,
1883 (GLsizei)len,
1884 NULL,
1885 (GLint *)size,
1886 (GLenum *)type,
1887 (char *)buf
1888 );
1889exit:
1890 if (type_base) {
1891 _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
1892 _exception ? JNI_ABORT: 0);
1893 }
1894 if (size_base) {
1895 _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
1896 _exception ? JNI_ABORT: 0);
1897 }
1898 if (_exception != 1) {
1899 result = _env->NewStringUTF(buf);
1900 }
1901 if (buf) {
1902 free(buf);
1903 }
1904 if (_exception) {
1905 jniThrowException(_env, _exceptionType, _exceptionMessage);
1906 }
1907 if (result == 0) {
1908 result = _env->NewStringUTF("");
1909 }
1910
1911 return result;
1912}
1913
1914/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1915static jstring
1916android_glGetActiveAttrib2
1917 (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
1918 jarray _sizeArray = (jarray) 0;
1919 jint _sizeBufferOffset = (jint) 0;
1920 jarray _typeArray = (jarray) 0;
1921 jint _typeBufferOffset = (jint) 0;
1922 jint _lengthRemaining;
1923 GLsizei *length = (GLsizei *) 0;
1924 jint _sizeRemaining;
1925 GLint *size = (GLint *) 0;
1926 jint _typeRemaining;
1927 GLenum *type = (GLenum *) 0;
1928
1929 jstring result = 0;
1930
1931 GLint len = 0;
1932 glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
1933 if (!len) {
1934 return _env->NewStringUTF("");
1935 }
1936 char* buf = (char*) malloc(len);
1937
1938 if (buf == NULL) {
1939 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
1940 return NULL;
1941 }
1942
1943 size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
1944 type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
1945 if (size == NULL) {
1946 char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
1947 size = (GLint *) (_sizeBase + _sizeBufferOffset);
1948 }
1949 if (type == NULL) {
1950 char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
1951 type = (GLenum *) (_typeBase + _typeBufferOffset);
1952 }
1953 glGetActiveAttrib(
1954 (GLuint)program,
1955 (GLuint)index,
1956 (GLsizei)len,
1957 NULL,
1958 (GLint *)size,
1959 (GLenum *)type,
1960 (char *)buf
1961 );
1962
1963 if (_typeArray) {
1964 releasePointer(_env, _typeArray, type, JNI_TRUE);
1965 }
1966 if (_sizeArray) {
1967 releasePointer(_env, _sizeArray, size, JNI_TRUE);
1968 }
1969 result = _env->NewStringUTF(buf);
1970 if (buf) {
1971 free(buf);
1972 }
1973 return result;
1974}
Jack Palevich560814f2009-11-19 16:34:55 +08001975/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1976static void
1977android_glGetActiveUniform__III_3II_3II_3II_3BI
1978 (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) {
1979 jint _exception = 0;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001980 const char * _exceptionType;
1981 const char * _exceptionMessage;
Jack Palevich560814f2009-11-19 16:34:55 +08001982 GLsizei *length_base = (GLsizei *) 0;
1983 jint _lengthRemaining;
1984 GLsizei *length = (GLsizei *) 0;
1985 GLint *size_base = (GLint *) 0;
1986 jint _sizeRemaining;
1987 GLint *size = (GLint *) 0;
1988 GLenum *type_base = (GLenum *) 0;
1989 jint _typeRemaining;
1990 GLenum *type = (GLenum *) 0;
1991 char *name_base = (char *) 0;
1992 jint _nameRemaining;
1993 char *name = (char *) 0;
1994
1995 if (!length_ref) {
1996 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001997 _exceptionType = "java/lang/IllegalArgumentException";
1998 _exceptionMessage = "length == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001999 goto exit;
2000 }
2001 if (lengthOffset < 0) {
2002 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002003 _exceptionType = "java/lang/IllegalArgumentException";
2004 _exceptionMessage = "lengthOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002005 goto exit;
2006 }
2007 _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
2008 length_base = (GLsizei *)
2009 _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
2010 length = length_base + lengthOffset;
2011
2012 if (!size_ref) {
2013 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002014 _exceptionType = "java/lang/IllegalArgumentException";
2015 _exceptionMessage = "size == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002016 goto exit;
2017 }
2018 if (sizeOffset < 0) {
2019 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002020 _exceptionType = "java/lang/IllegalArgumentException";
2021 _exceptionMessage = "sizeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002022 goto exit;
2023 }
2024 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2025 size_base = (GLint *)
2026 _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
2027 size = size_base + sizeOffset;
2028
2029 if (!type_ref) {
2030 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002031 _exceptionType = "java/lang/IllegalArgumentException";
2032 _exceptionMessage = "type == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002033 goto exit;
2034 }
2035 if (typeOffset < 0) {
2036 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002037 _exceptionType = "java/lang/IllegalArgumentException";
2038 _exceptionMessage = "typeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002039 goto exit;
2040 }
2041 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2042 type_base = (GLenum *)
2043 _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
2044 type = type_base + typeOffset;
2045
2046 if (!name_ref) {
2047 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002048 _exceptionType = "java/lang/IllegalArgumentException";
2049 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002050 goto exit;
2051 }
2052 if (nameOffset < 0) {
2053 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002054 _exceptionType = "java/lang/IllegalArgumentException";
2055 _exceptionMessage = "nameOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002056 goto exit;
2057 }
2058 _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
2059 name_base = (char *)
2060 _env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0);
2061 name = name_base + nameOffset;
2062
2063 glGetActiveUniform(
2064 (GLuint)program,
2065 (GLuint)index,
2066 (GLsizei)bufsize,
2067 (GLsizei *)length,
2068 (GLint *)size,
2069 (GLenum *)type,
2070 (char *)name
2071 );
2072
2073exit:
2074 if (name_base) {
2075 _env->ReleasePrimitiveArrayCritical(name_ref, name_base,
2076 _exception ? JNI_ABORT: 0);
2077 }
2078 if (type_base) {
2079 _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
2080 _exception ? JNI_ABORT: 0);
2081 }
2082 if (size_base) {
2083 _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
2084 _exception ? JNI_ABORT: 0);
2085 }
2086 if (length_base) {
2087 _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
2088 _exception ? JNI_ABORT: 0);
2089 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002090 if (_exception) {
2091 jniThrowException(_env, _exceptionType, _exceptionMessage);
2092 }
Jack Palevich560814f2009-11-19 16:34:55 +08002093}
2094
2095/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2096static void
2097android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
2098 (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 +08002099 jarray _lengthArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002100 jint _lengthBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002101 jarray _sizeArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002102 jint _sizeBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002103 jarray _typeArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002104 jint _typeBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002105 jint _lengthRemaining;
2106 GLsizei *length = (GLsizei *) 0;
2107 jint _sizeRemaining;
2108 GLint *size = (GLint *) 0;
2109 jint _typeRemaining;
2110 GLenum *type = (GLenum *) 0;
2111
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002112 length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
2113 size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
2114 type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
2115 if (length == NULL) {
2116 char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0);
2117 length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
2118 }
2119 if (size == NULL) {
2120 char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
2121 size = (GLint *) (_sizeBase + _sizeBufferOffset);
2122 }
2123 if (type == NULL) {
2124 char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
2125 type = (GLenum *) (_typeBase + _typeBufferOffset);
2126 }
Jack Palevich560814f2009-11-19 16:34:55 +08002127 glGetActiveUniform(
2128 (GLuint)program,
2129 (GLuint)index,
2130 (GLsizei)bufsize,
2131 (GLsizei *)length,
2132 (GLint *)size,
2133 (GLenum *)type,
2134 (char *)name
2135 );
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002136 if (_typeArray) {
2137 releasePointer(_env, _typeArray, type, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08002138 }
2139 if (_sizeArray) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002140 releasePointer(_env, _sizeArray, size, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08002141 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002142 if (_lengthArray) {
2143 releasePointer(_env, _lengthArray, length, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08002144 }
2145}
2146
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002147/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2148static jstring
2149android_glGetActiveUniform1
2150 (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
2151 jint _exception = 0;
2152 const char * _exceptionType;
2153 const char * _exceptionMessage;
2154
2155 GLint *size_base = (GLint *) 0;
2156 jint _sizeRemaining;
2157 GLint *size = (GLint *) 0;
2158
2159 GLenum *type_base = (GLenum *) 0;
2160 jint _typeRemaining;
2161 GLenum *type = (GLenum *) 0;
2162
2163 jstring result = 0;
2164
2165 GLint len = 0;
2166 glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
2167 if (!len) {
2168 return _env->NewStringUTF("");
2169 }
2170 char* buf = (char*) malloc(len);
2171
2172 if (buf == NULL) {
2173 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2174 return NULL;
2175 }
2176
2177 if (!size_ref) {
2178 _exception = 1;
2179 _exceptionType = "java/lang/IllegalArgumentException";
2180 _exceptionMessage = "size == null";
2181 goto exit;
2182 }
2183 if (sizeOffset < 0) {
2184 _exception = 1;
2185 _exceptionType = "java/lang/IllegalArgumentException";
2186 _exceptionMessage = "sizeOffset < 0";
2187 goto exit;
2188 }
2189 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2190 size_base = (GLint *)
2191 _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
2192 size = size_base + sizeOffset;
2193
2194 if (!type_ref) {
2195 _exception = 1;
2196 _exceptionType = "java/lang/IllegalArgumentException";
2197 _exceptionMessage = "type == null";
2198 goto exit;
2199 }
2200 if (typeOffset < 0) {
2201 _exception = 1;
2202 _exceptionType = "java/lang/IllegalArgumentException";
2203 _exceptionMessage = "typeOffset < 0";
2204 goto exit;
2205 }
2206 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2207 type_base = (GLenum *)
2208 _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
2209 type = type_base + typeOffset;
2210
2211 glGetActiveUniform(
2212 (GLuint)program,
2213 (GLuint)index,
2214 (GLsizei)len,
2215 NULL,
2216 (GLint *)size,
2217 (GLenum *)type,
2218 (char *)buf
2219 );
2220
2221exit:
2222 if (type_base) {
2223 _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
2224 _exception ? JNI_ABORT: 0);
2225 }
2226 if (size_base) {
2227 _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
2228 _exception ? JNI_ABORT: 0);
2229 }
2230 if (_exception != 1) {
2231 result = _env->NewStringUTF(buf);
2232 }
2233 if (buf) {
2234 free(buf);
2235 }
2236 if (_exception) {
2237 jniThrowException(_env, _exceptionType, _exceptionMessage);
2238 }
2239 if (result == 0) {
2240 result = _env->NewStringUTF("");
2241 }
2242 return result;
2243}
2244
2245/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2246static jstring
2247android_glGetActiveUniform2
2248 (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
2249 jarray _sizeArray = (jarray) 0;
2250 jint _sizeBufferOffset = (jint) 0;
2251 jarray _typeArray = (jarray) 0;
2252 jint _typeBufferOffset = (jint) 0;
2253 jint _sizeRemaining;
2254 GLint *size = (GLint *) 0;
2255 jint _typeRemaining;
2256 GLenum *type = (GLenum *) 0;
2257
2258 jstring result = 0;
2259 GLint len = 0;
2260 glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
2261 if (!len) {
2262 return _env->NewStringUTF("");
2263 }
2264 char* buf = (char*) malloc(len);
2265
2266 if (buf == NULL) {
2267 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2268 return NULL;
2269 }
2270
2271 size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
2272 type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
2273
2274 if (size == NULL) {
2275 char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
2276 size = (GLint *) (_sizeBase + _sizeBufferOffset);
2277 }
2278 if (type == NULL) {
2279 char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
2280 type = (GLenum *) (_typeBase + _typeBufferOffset);
2281 }
2282 glGetActiveUniform(
2283 (GLuint)program,
2284 (GLuint)index,
2285 len,
2286 NULL,
2287 (GLint *)size,
2288 (GLenum *)type,
2289 (char *)buf
2290 );
2291
2292 if (_typeArray) {
2293 releasePointer(_env, _typeArray, type, JNI_TRUE);
2294 }
2295 if (_sizeArray) {
2296 releasePointer(_env, _sizeArray, size, JNI_TRUE);
2297 }
2298 result = _env->NewStringUTF(buf);
2299 if (buf) {
2300 free(buf);
2301 }
2302 return result;
2303}
Jack Palevich560814f2009-11-19 16:34:55 +08002304/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */
2305static void
2306android_glGetAttachedShaders__II_3II_3II
2307 (JNIEnv *_env, jobject _this, jint program, jint maxcount, jintArray count_ref, jint countOffset, jintArray shaders_ref, jint shadersOffset) {
2308 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002309 const char * _exceptionType = NULL;
2310 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002311 GLsizei *count_base = (GLsizei *) 0;
2312 jint _countRemaining;
2313 GLsizei *count = (GLsizei *) 0;
2314 GLuint *shaders_base = (GLuint *) 0;
2315 jint _shadersRemaining;
2316 GLuint *shaders = (GLuint *) 0;
2317
2318 if (!count_ref) {
2319 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002320 _exceptionType = "java/lang/IllegalArgumentException";
2321 _exceptionMessage = "count == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002322 goto exit;
2323 }
2324 if (countOffset < 0) {
2325 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002326 _exceptionType = "java/lang/IllegalArgumentException";
2327 _exceptionMessage = "countOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002328 goto exit;
2329 }
2330 _countRemaining = _env->GetArrayLength(count_ref) - countOffset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002331 if (_countRemaining < 1) {
2332 _exception = 1;
2333 _exceptionType = "java/lang/IllegalArgumentException";
2334 _exceptionMessage = "length - countOffset < 1 < needed";
2335 goto exit;
2336 }
Jack Palevich560814f2009-11-19 16:34:55 +08002337 count_base = (GLsizei *)
2338 _env->GetPrimitiveArrayCritical(count_ref, (jboolean *)0);
2339 count = count_base + countOffset;
2340
2341 if (!shaders_ref) {
2342 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002343 _exceptionType = "java/lang/IllegalArgumentException";
2344 _exceptionMessage = "shaders == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002345 goto exit;
2346 }
2347 if (shadersOffset < 0) {
2348 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002349 _exceptionType = "java/lang/IllegalArgumentException";
2350 _exceptionMessage = "shadersOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002351 goto exit;
2352 }
2353 _shadersRemaining = _env->GetArrayLength(shaders_ref) - shadersOffset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002354 if (_shadersRemaining < maxcount) {
2355 _exception = 1;
2356 _exceptionType = "java/lang/IllegalArgumentException";
2357 _exceptionMessage = "length - shadersOffset < maxcount < needed";
2358 goto exit;
2359 }
Jack Palevich560814f2009-11-19 16:34:55 +08002360 shaders_base = (GLuint *)
2361 _env->GetPrimitiveArrayCritical(shaders_ref, (jboolean *)0);
2362 shaders = shaders_base + shadersOffset;
2363
2364 glGetAttachedShaders(
2365 (GLuint)program,
2366 (GLsizei)maxcount,
2367 (GLsizei *)count,
2368 (GLuint *)shaders
2369 );
2370
2371exit:
2372 if (shaders_base) {
2373 _env->ReleasePrimitiveArrayCritical(shaders_ref, shaders_base,
2374 _exception ? JNI_ABORT: 0);
2375 }
2376 if (count_base) {
2377 _env->ReleasePrimitiveArrayCritical(count_ref, count_base,
2378 _exception ? JNI_ABORT: 0);
2379 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002380 if (_exception) {
2381 jniThrowException(_env, _exceptionType, _exceptionMessage);
2382 }
Jack Palevich560814f2009-11-19 16:34:55 +08002383}
2384
2385/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */
2386static void
2387android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
2388 (JNIEnv *_env, jobject _this, jint program, jint maxcount, jobject count_buf, jobject shaders_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002389 jint _exception = 0;
2390 const char * _exceptionType = NULL;
2391 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002392 jarray _countArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002393 jint _countBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002394 jarray _shadersArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002395 jint _shadersBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002396 jint _countRemaining;
2397 GLsizei *count = (GLsizei *) 0;
2398 jint _shadersRemaining;
2399 GLuint *shaders = (GLuint *) 0;
2400
Mathias Agopian2ad04772013-02-23 03:12:30 -08002401 if (count_buf) {
2402 count = (GLsizei *)getPointer(_env, count_buf, &_countArray, &_countRemaining, &_countBufferOffset);
2403 if (_countRemaining < 1) {
2404 _exception = 1;
2405 _exceptionType = "java/lang/IllegalArgumentException";
2406 _exceptionMessage = "remaining() < 1 < needed";
2407 goto exit;
2408 }
2409 }
2410 if (shaders_buf) {
2411 shaders = (GLuint *)getPointer(_env, shaders_buf, &_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
2412 if (_shadersRemaining < maxcount) {
2413 _exception = 1;
2414 _exceptionType = "java/lang/IllegalArgumentException";
2415 _exceptionMessage = "remaining() < maxcount < needed";
2416 goto exit;
2417 }
2418 }
2419 if (count_buf && count == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002420 char * _countBase = (char *)_env->GetPrimitiveArrayCritical(_countArray, (jboolean *) 0);
2421 count = (GLsizei *) (_countBase + _countBufferOffset);
2422 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08002423 if (shaders_buf && shaders == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002424 char * _shadersBase = (char *)_env->GetPrimitiveArrayCritical(_shadersArray, (jboolean *) 0);
2425 shaders = (GLuint *) (_shadersBase + _shadersBufferOffset);
2426 }
Jack Palevich560814f2009-11-19 16:34:55 +08002427 glGetAttachedShaders(
2428 (GLuint)program,
2429 (GLsizei)maxcount,
2430 (GLsizei *)count,
2431 (GLuint *)shaders
2432 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08002433
2434exit:
Jack Palevich560814f2009-11-19 16:34:55 +08002435 if (_shadersArray) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002436 releasePointer(_env, _shadersArray, shaders, _exception ? JNI_FALSE : JNI_TRUE);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002437 }
2438 if (_countArray) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002439 releasePointer(_env, _countArray, count, _exception ? JNI_FALSE : JNI_TRUE);
2440 }
2441 if (_exception) {
2442 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08002443 }
2444}
2445
Mathias Agopian89be00b2013-02-22 20:08:06 -08002446/* GLint glGetAttribLocation ( GLuint program, const char *name ) */
Jack Palevich560814f2009-11-19 16:34:55 +08002447static jint
2448android_glGetAttribLocation__ILjava_lang_String_2
2449 (JNIEnv *_env, jobject _this, jint program, jstring name) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002450 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002451 const char * _exceptionType = NULL;
2452 const char * _exceptionMessage = NULL;
Mathias Agopian89be00b2013-02-22 20:08:06 -08002453 GLint _returnValue = 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002454 const char* _nativename = 0;
2455
2456 if (!name) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002457 _exceptionType = "java/lang/IllegalArgumentException";
2458 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002459 goto exit;
2460 }
2461 _nativename = _env->GetStringUTFChars(name, 0);
2462
2463 _returnValue = glGetAttribLocation(
2464 (GLuint)program,
2465 (char *)_nativename
2466 );
2467
2468exit:
2469 if (_nativename) {
2470 _env->ReleaseStringUTFChars(name, _nativename);
2471 }
2472
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002473 if (_exception) {
2474 jniThrowException(_env, _exceptionType, _exceptionMessage);
2475 }
Andy McFaddencee51982013-04-25 16:08:31 -07002476 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08002477}
2478
2479/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
2480static void
2481android_glGetBooleanv__I_3ZI
2482 (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002483 get<jbooleanArray, GLboolean, glGetBooleanv>(_env, _this, pname, params_ref, offset);
Jack Palevich560814f2009-11-19 16:34:55 +08002484}
2485
2486/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
2487static void
2488android_glGetBooleanv__ILjava_nio_IntBuffer_2
2489 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002490 getarray<GLboolean, glGetBooleanv>(_env, _this, pname, params_buf);
Jack Palevich560814f2009-11-19 16:34:55 +08002491}
Jack Palevich560814f2009-11-19 16:34:55 +08002492/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2493static void
2494android_glGetBufferParameteriv__II_3II
2495 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Jack Palevich73108672011-03-28 14:49:12 -07002496 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002497 const char * _exceptionType = NULL;
2498 const char * _exceptionMessage = NULL;
Jack Palevich73108672011-03-28 14:49:12 -07002499 GLint *params_base = (GLint *) 0;
2500 jint _remaining;
2501 GLint *params = (GLint *) 0;
2502
2503 if (!params_ref) {
2504 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002505 _exceptionType = "java/lang/IllegalArgumentException";
2506 _exceptionMessage = "params == null";
Jack Palevich73108672011-03-28 14:49:12 -07002507 goto exit;
2508 }
2509 if (offset < 0) {
2510 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002511 _exceptionType = "java/lang/IllegalArgumentException";
2512 _exceptionMessage = "offset < 0";
Jack Palevich73108672011-03-28 14:49:12 -07002513 goto exit;
2514 }
2515 _remaining = _env->GetArrayLength(params_ref) - offset;
2516 if (_remaining < 1) {
2517 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002518 _exceptionType = "java/lang/IllegalArgumentException";
2519 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich73108672011-03-28 14:49:12 -07002520 goto exit;
2521 }
2522 params_base = (GLint *)
2523 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2524 params = params_base + offset;
2525
2526 glGetBufferParameteriv(
2527 (GLenum)target,
2528 (GLenum)pname,
2529 (GLint *)params
2530 );
2531
2532exit:
2533 if (params_base) {
2534 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2535 _exception ? JNI_ABORT: 0);
2536 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002537 if (_exception) {
2538 jniThrowException(_env, _exceptionType, _exceptionMessage);
2539 }
Jack Palevich560814f2009-11-19 16:34:55 +08002540}
2541
2542/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2543static void
2544android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
2545 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Jack Palevich73108672011-03-28 14:49:12 -07002546 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002547 const char * _exceptionType = NULL;
2548 const char * _exceptionMessage = NULL;
Jack Palevich73108672011-03-28 14:49:12 -07002549 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002550 jint _bufferOffset = (jint) 0;
Jack Palevich73108672011-03-28 14:49:12 -07002551 jint _remaining;
2552 GLint *params = (GLint *) 0;
2553
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002554 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich73108672011-03-28 14:49:12 -07002555 if (_remaining < 1) {
2556 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002557 _exceptionType = "java/lang/IllegalArgumentException";
2558 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich73108672011-03-28 14:49:12 -07002559 goto exit;
2560 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002561 if (params == NULL) {
2562 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2563 params = (GLint *) (_paramsBase + _bufferOffset);
2564 }
Jack Palevich73108672011-03-28 14:49:12 -07002565 glGetBufferParameteriv(
2566 (GLenum)target,
2567 (GLenum)pname,
2568 (GLint *)params
2569 );
2570
2571exit:
2572 if (_array) {
2573 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2574 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002575 if (_exception) {
2576 jniThrowException(_env, _exceptionType, _exceptionMessage);
2577 }
Jack Palevich560814f2009-11-19 16:34:55 +08002578}
2579
2580/* GLenum glGetError ( void ) */
2581static jint
2582android_glGetError__
2583 (JNIEnv *_env, jobject _this) {
2584 GLenum _returnValue;
2585 _returnValue = glGetError();
Andy McFaddencee51982013-04-25 16:08:31 -07002586 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08002587}
2588
2589/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
2590static void
2591android_glGetFloatv__I_3FI
2592 (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002593 get<jfloatArray, GLfloat, glGetFloatv>(_env, _this, pname, params_ref, offset);
Jack Palevich560814f2009-11-19 16:34:55 +08002594}
2595
2596/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
2597static void
2598android_glGetFloatv__ILjava_nio_FloatBuffer_2
2599 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002600 getarray<GLfloat, glGetFloatv>(_env, _this, pname, params_buf);
Jack Palevich560814f2009-11-19 16:34:55 +08002601}
Jack Palevich560814f2009-11-19 16:34:55 +08002602/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
2603static void
2604android_glGetFramebufferAttachmentParameteriv__III_3II
2605 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jintArray params_ref, jint offset) {
2606 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002607 const char * _exceptionType = NULL;
2608 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002609 GLint *params_base = (GLint *) 0;
2610 jint _remaining;
2611 GLint *params = (GLint *) 0;
2612
2613 if (!params_ref) {
2614 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002615 _exceptionType = "java/lang/IllegalArgumentException";
2616 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002617 goto exit;
2618 }
2619 if (offset < 0) {
2620 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002621 _exceptionType = "java/lang/IllegalArgumentException";
2622 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002623 goto exit;
2624 }
2625 _remaining = _env->GetArrayLength(params_ref) - offset;
2626 params_base = (GLint *)
2627 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2628 params = params_base + offset;
2629
2630 glGetFramebufferAttachmentParameteriv(
2631 (GLenum)target,
2632 (GLenum)attachment,
2633 (GLenum)pname,
2634 (GLint *)params
2635 );
2636
2637exit:
2638 if (params_base) {
2639 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2640 _exception ? JNI_ABORT: 0);
2641 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002642 if (_exception) {
2643 jniThrowException(_env, _exceptionType, _exceptionMessage);
2644 }
Jack Palevich560814f2009-11-19 16:34:55 +08002645}
2646
2647/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
2648static void
2649android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2
2650 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) {
Jack Palevich560814f2009-11-19 16:34:55 +08002651 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002652 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002653 jint _remaining;
2654 GLint *params = (GLint *) 0;
2655
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002656 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
2657 if (params == NULL) {
2658 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2659 params = (GLint *) (_paramsBase + _bufferOffset);
2660 }
Jack Palevich560814f2009-11-19 16:34:55 +08002661 glGetFramebufferAttachmentParameteriv(
2662 (GLenum)target,
2663 (GLenum)attachment,
2664 (GLenum)pname,
2665 (GLint *)params
2666 );
2667 if (_array) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002668 releasePointer(_env, _array, params, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08002669 }
2670}
2671
2672/* void glGetIntegerv ( GLenum pname, GLint *params ) */
2673static void
2674android_glGetIntegerv__I_3II
2675 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002676 get<jintArray, GLint, glGetIntegerv>(_env, _this, pname, params_ref, offset);
Jack Palevich560814f2009-11-19 16:34:55 +08002677}
2678
2679/* void glGetIntegerv ( GLenum pname, GLint *params ) */
2680static void
2681android_glGetIntegerv__ILjava_nio_IntBuffer_2
2682 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002683 getarray<GLint, glGetIntegerv>(_env, _this, pname, params_buf);
Jack Palevich560814f2009-11-19 16:34:55 +08002684}
2685
2686/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2687static void
2688android_glGetProgramiv__II_3II
2689 (JNIEnv *_env, jobject _this, jint program, jint pname, jintArray params_ref, jint offset) {
2690 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002691 const char * _exceptionType = NULL;
2692 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002693 GLint *params_base = (GLint *) 0;
2694 jint _remaining;
2695 GLint *params = (GLint *) 0;
2696
2697 if (!params_ref) {
2698 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002699 _exceptionType = "java/lang/IllegalArgumentException";
2700 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002701 goto exit;
2702 }
2703 if (offset < 0) {
2704 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002705 _exceptionType = "java/lang/IllegalArgumentException";
2706 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002707 goto exit;
2708 }
2709 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002710 if (_remaining < 1) {
2711 _exception = 1;
2712 _exceptionType = "java/lang/IllegalArgumentException";
2713 _exceptionMessage = "length - offset < 1 < needed";
2714 goto exit;
2715 }
Jack Palevich560814f2009-11-19 16:34:55 +08002716 params_base = (GLint *)
2717 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2718 params = params_base + offset;
2719
2720 glGetProgramiv(
2721 (GLuint)program,
2722 (GLenum)pname,
2723 (GLint *)params
2724 );
2725
2726exit:
2727 if (params_base) {
2728 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2729 _exception ? JNI_ABORT: 0);
2730 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002731 if (_exception) {
2732 jniThrowException(_env, _exceptionType, _exceptionMessage);
2733 }
Jack Palevich560814f2009-11-19 16:34:55 +08002734}
2735
2736/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2737static void
2738android_glGetProgramiv__IILjava_nio_IntBuffer_2
2739 (JNIEnv *_env, jobject _this, jint program, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002740 jint _exception = 0;
2741 const char * _exceptionType = NULL;
2742 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002743 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002744 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002745 jint _remaining;
2746 GLint *params = (GLint *) 0;
2747
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002748 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08002749 if (_remaining < 1) {
2750 _exception = 1;
2751 _exceptionType = "java/lang/IllegalArgumentException";
2752 _exceptionMessage = "remaining() < 1 < needed";
2753 goto exit;
2754 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002755 if (params == NULL) {
2756 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2757 params = (GLint *) (_paramsBase + _bufferOffset);
2758 }
Jack Palevich560814f2009-11-19 16:34:55 +08002759 glGetProgramiv(
2760 (GLuint)program,
2761 (GLenum)pname,
2762 (GLint *)params
2763 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08002764
2765exit:
Jack Palevich560814f2009-11-19 16:34:55 +08002766 if (_array) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002767 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2768 }
2769 if (_exception) {
2770 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08002771 }
2772}
2773
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002774#include <stdlib.h>
Jack Palevich560814f2009-11-19 16:34:55 +08002775
2776/* void glGetProgramInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002777static jstring android_glGetProgramInfoLog(JNIEnv *_env, jobject, jint shader) {
Jack Palevich560814f2009-11-19 16:34:55 +08002778 GLint infoLen = 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002779 glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002780 if (!infoLen) {
2781 return _env->NewStringUTF("");
Jack Palevich560814f2009-11-19 16:34:55 +08002782 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002783 char* buf = (char*) malloc(infoLen);
2784 if (buf == NULL) {
2785 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2786 return NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002787 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002788 glGetProgramInfoLog(shader, infoLen, NULL, buf);
2789 jstring result = _env->NewStringUTF(buf);
2790 free(buf);
2791 return result;
Jack Palevich560814f2009-11-19 16:34:55 +08002792}
2793/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2794static void
2795android_glGetRenderbufferParameteriv__II_3II
2796 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2797 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002798 const char * _exceptionType = NULL;
2799 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002800 GLint *params_base = (GLint *) 0;
2801 jint _remaining;
2802 GLint *params = (GLint *) 0;
2803
2804 if (!params_ref) {
2805 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002806 _exceptionType = "java/lang/IllegalArgumentException";
2807 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002808 goto exit;
2809 }
2810 if (offset < 0) {
2811 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002812 _exceptionType = "java/lang/IllegalArgumentException";
2813 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002814 goto exit;
2815 }
2816 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002817 if (_remaining < 1) {
2818 _exception = 1;
2819 _exceptionType = "java/lang/IllegalArgumentException";
2820 _exceptionMessage = "length - offset < 1 < needed";
2821 goto exit;
2822 }
Jack Palevich560814f2009-11-19 16:34:55 +08002823 params_base = (GLint *)
2824 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2825 params = params_base + offset;
2826
2827 glGetRenderbufferParameteriv(
2828 (GLenum)target,
2829 (GLenum)pname,
2830 (GLint *)params
2831 );
2832
2833exit:
2834 if (params_base) {
2835 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2836 _exception ? JNI_ABORT: 0);
2837 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002838 if (_exception) {
2839 jniThrowException(_env, _exceptionType, _exceptionMessage);
2840 }
Jack Palevich560814f2009-11-19 16:34:55 +08002841}
2842
2843/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2844static void
2845android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2
2846 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002847 jint _exception = 0;
2848 const char * _exceptionType = NULL;
2849 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002850 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002851 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002852 jint _remaining;
2853 GLint *params = (GLint *) 0;
2854
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002855 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08002856 if (_remaining < 1) {
2857 _exception = 1;
2858 _exceptionType = "java/lang/IllegalArgumentException";
2859 _exceptionMessage = "remaining() < 1 < needed";
2860 goto exit;
2861 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002862 if (params == NULL) {
2863 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2864 params = (GLint *) (_paramsBase + _bufferOffset);
2865 }
Jack Palevich560814f2009-11-19 16:34:55 +08002866 glGetRenderbufferParameteriv(
2867 (GLenum)target,
2868 (GLenum)pname,
2869 (GLint *)params
2870 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08002871
2872exit:
Jack Palevich560814f2009-11-19 16:34:55 +08002873 if (_array) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002874 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2875 }
2876 if (_exception) {
2877 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08002878 }
2879}
2880
2881/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
2882static void
2883android_glGetShaderiv__II_3II
2884 (JNIEnv *_env, jobject _this, jint shader, jint pname, jintArray params_ref, jint offset) {
2885 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002886 const char * _exceptionType = NULL;
2887 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002888 GLint *params_base = (GLint *) 0;
2889 jint _remaining;
2890 GLint *params = (GLint *) 0;
2891
2892 if (!params_ref) {
2893 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002894 _exceptionType = "java/lang/IllegalArgumentException";
2895 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002896 goto exit;
2897 }
2898 if (offset < 0) {
2899 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002900 _exceptionType = "java/lang/IllegalArgumentException";
2901 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002902 goto exit;
2903 }
2904 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002905 if (_remaining < 1) {
2906 _exception = 1;
2907 _exceptionType = "java/lang/IllegalArgumentException";
2908 _exceptionMessage = "length - offset < 1 < needed";
2909 goto exit;
2910 }
Jack Palevich560814f2009-11-19 16:34:55 +08002911 params_base = (GLint *)
2912 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2913 params = params_base + offset;
2914
2915 glGetShaderiv(
2916 (GLuint)shader,
2917 (GLenum)pname,
2918 (GLint *)params
2919 );
2920
2921exit:
2922 if (params_base) {
2923 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2924 _exception ? JNI_ABORT: 0);
2925 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002926 if (_exception) {
2927 jniThrowException(_env, _exceptionType, _exceptionMessage);
2928 }
Jack Palevich560814f2009-11-19 16:34:55 +08002929}
2930
2931/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
2932static void
2933android_glGetShaderiv__IILjava_nio_IntBuffer_2
2934 (JNIEnv *_env, jobject _this, jint shader, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002935 jint _exception = 0;
2936 const char * _exceptionType = NULL;
2937 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002938 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002939 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002940 jint _remaining;
2941 GLint *params = (GLint *) 0;
2942
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002943 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08002944 if (_remaining < 1) {
2945 _exception = 1;
2946 _exceptionType = "java/lang/IllegalArgumentException";
2947 _exceptionMessage = "remaining() < 1 < needed";
2948 goto exit;
2949 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002950 if (params == NULL) {
2951 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2952 params = (GLint *) (_paramsBase + _bufferOffset);
2953 }
Jack Palevich560814f2009-11-19 16:34:55 +08002954 glGetShaderiv(
2955 (GLuint)shader,
2956 (GLenum)pname,
2957 (GLint *)params
2958 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08002959
2960exit:
Jack Palevich560814f2009-11-19 16:34:55 +08002961 if (_array) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002962 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2963 }
2964 if (_exception) {
2965 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08002966 }
2967}
2968
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002969#include <stdlib.h>
Jack Palevich560814f2009-11-19 16:34:55 +08002970
2971/* void glGetShaderInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002972static jstring android_glGetShaderInfoLog(JNIEnv *_env, jobject, jint shader) {
Jack Palevich560814f2009-11-19 16:34:55 +08002973 GLint infoLen = 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002974 glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002975 if (!infoLen) {
2976 return _env->NewStringUTF("");
Jack Palevich560814f2009-11-19 16:34:55 +08002977 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002978 char* buf = (char*) malloc(infoLen);
2979 if (buf == NULL) {
2980 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2981 return NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002982 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002983 glGetShaderInfoLog(shader, infoLen, NULL, buf);
2984 jstring result = _env->NewStringUTF(buf);
2985 free(buf);
2986 return result;
Jack Palevich560814f2009-11-19 16:34:55 +08002987}
2988/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
2989static void
2990android_glGetShaderPrecisionFormat__II_3II_3II
2991 (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jintArray range_ref, jint rangeOffset, jintArray precision_ref, jint precisionOffset) {
2992 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002993 const char * _exceptionType = NULL;
2994 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002995 GLint *range_base = (GLint *) 0;
2996 jint _rangeRemaining;
2997 GLint *range = (GLint *) 0;
2998 GLint *precision_base = (GLint *) 0;
2999 jint _precisionRemaining;
3000 GLint *precision = (GLint *) 0;
3001
3002 if (!range_ref) {
3003 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003004 _exceptionType = "java/lang/IllegalArgumentException";
3005 _exceptionMessage = "range == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003006 goto exit;
3007 }
3008 if (rangeOffset < 0) {
3009 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003010 _exceptionType = "java/lang/IllegalArgumentException";
3011 _exceptionMessage = "rangeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003012 goto exit;
3013 }
3014 _rangeRemaining = _env->GetArrayLength(range_ref) - rangeOffset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003015 if (_rangeRemaining < 1) {
3016 _exception = 1;
3017 _exceptionType = "java/lang/IllegalArgumentException";
3018 _exceptionMessage = "length - rangeOffset < 1 < needed";
3019 goto exit;
3020 }
Jack Palevich560814f2009-11-19 16:34:55 +08003021 range_base = (GLint *)
3022 _env->GetPrimitiveArrayCritical(range_ref, (jboolean *)0);
3023 range = range_base + rangeOffset;
3024
3025 if (!precision_ref) {
3026 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003027 _exceptionType = "java/lang/IllegalArgumentException";
3028 _exceptionMessage = "precision == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003029 goto exit;
3030 }
3031 if (precisionOffset < 0) {
3032 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003033 _exceptionType = "java/lang/IllegalArgumentException";
3034 _exceptionMessage = "precisionOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003035 goto exit;
3036 }
3037 _precisionRemaining = _env->GetArrayLength(precision_ref) - precisionOffset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003038 if (_precisionRemaining < 1) {
3039 _exception = 1;
3040 _exceptionType = "java/lang/IllegalArgumentException";
3041 _exceptionMessage = "length - precisionOffset < 1 < needed";
3042 goto exit;
3043 }
Jack Palevich560814f2009-11-19 16:34:55 +08003044 precision_base = (GLint *)
3045 _env->GetPrimitiveArrayCritical(precision_ref, (jboolean *)0);
3046 precision = precision_base + precisionOffset;
3047
3048 glGetShaderPrecisionFormat(
3049 (GLenum)shadertype,
3050 (GLenum)precisiontype,
3051 (GLint *)range,
3052 (GLint *)precision
3053 );
3054
3055exit:
3056 if (precision_base) {
3057 _env->ReleasePrimitiveArrayCritical(precision_ref, precision_base,
3058 _exception ? JNI_ABORT: 0);
3059 }
3060 if (range_base) {
3061 _env->ReleasePrimitiveArrayCritical(range_ref, range_base,
3062 _exception ? JNI_ABORT: 0);
3063 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003064 if (_exception) {
3065 jniThrowException(_env, _exceptionType, _exceptionMessage);
3066 }
Jack Palevich560814f2009-11-19 16:34:55 +08003067}
3068
3069/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
3070static void
3071android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
3072 (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jobject range_buf, jobject precision_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003073 jint _exception = 0;
3074 const char * _exceptionType = NULL;
3075 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003076 jarray _rangeArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003077 jint _rangeBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003078 jarray _precisionArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003079 jint _precisionBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003080 jint _rangeRemaining;
3081 GLint *range = (GLint *) 0;
3082 jint _precisionRemaining;
3083 GLint *precision = (GLint *) 0;
3084
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003085 range = (GLint *)getPointer(_env, range_buf, &_rangeArray, &_rangeRemaining, &_rangeBufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003086 if (_rangeRemaining < 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 precision = (GLint *)getPointer(_env, precision_buf, &_precisionArray, &_precisionRemaining, &_precisionBufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003093 if (_precisionRemaining < 1) {
3094 _exception = 1;
3095 _exceptionType = "java/lang/IllegalArgumentException";
3096 _exceptionMessage = "remaining() < 1 < needed";
3097 goto exit;
3098 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003099 if (range == NULL) {
3100 char * _rangeBase = (char *)_env->GetPrimitiveArrayCritical(_rangeArray, (jboolean *) 0);
3101 range = (GLint *) (_rangeBase + _rangeBufferOffset);
3102 }
3103 if (precision == NULL) {
3104 char * _precisionBase = (char *)_env->GetPrimitiveArrayCritical(_precisionArray, (jboolean *) 0);
3105 precision = (GLint *) (_precisionBase + _precisionBufferOffset);
3106 }
Jack Palevich560814f2009-11-19 16:34:55 +08003107 glGetShaderPrecisionFormat(
3108 (GLenum)shadertype,
3109 (GLenum)precisiontype,
3110 (GLint *)range,
3111 (GLint *)precision
3112 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003113
3114exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003115 if (_precisionArray) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003116 releasePointer(_env, _precisionArray, precision, _exception ? JNI_FALSE : JNI_TRUE);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003117 }
3118 if (_rangeArray) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003119 releasePointer(_env, _rangeArray, range, _exception ? JNI_FALSE : JNI_TRUE);
3120 }
3121 if (_exception) {
3122 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003123 }
3124}
3125
3126/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3127static void
3128android_glGetShaderSource__II_3II_3BI
3129 (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jintArray length_ref, jint lengthOffset, jbyteArray source_ref, jint sourceOffset) {
3130 jint _exception = 0;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003131 const char * _exceptionType;
3132 const char * _exceptionMessage;
Jack Palevich560814f2009-11-19 16:34:55 +08003133 GLsizei *length_base = (GLsizei *) 0;
3134 jint _lengthRemaining;
3135 GLsizei *length = (GLsizei *) 0;
3136 char *source_base = (char *) 0;
3137 jint _sourceRemaining;
3138 char *source = (char *) 0;
3139
3140 if (!length_ref) {
3141 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003142 _exceptionType = "java/lang/IllegalArgumentException";
3143 _exceptionMessage = "length == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003144 goto exit;
3145 }
3146 if (lengthOffset < 0) {
3147 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003148 _exceptionType = "java/lang/IllegalArgumentException";
3149 _exceptionMessage = "lengthOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003150 goto exit;
3151 }
3152 _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
3153 length_base = (GLsizei *)
3154 _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
3155 length = length_base + lengthOffset;
3156
3157 if (!source_ref) {
3158 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003159 _exceptionType = "java/lang/IllegalArgumentException";
3160 _exceptionMessage = "source == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003161 goto exit;
3162 }
3163 if (sourceOffset < 0) {
3164 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003165 _exceptionType = "java/lang/IllegalArgumentException";
3166 _exceptionMessage = "sourceOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003167 goto exit;
3168 }
3169 _sourceRemaining = _env->GetArrayLength(source_ref) - sourceOffset;
3170 source_base = (char *)
3171 _env->GetPrimitiveArrayCritical(source_ref, (jboolean *)0);
3172 source = source_base + sourceOffset;
3173
3174 glGetShaderSource(
3175 (GLuint)shader,
3176 (GLsizei)bufsize,
3177 (GLsizei *)length,
3178 (char *)source
3179 );
3180
3181exit:
3182 if (source_base) {
3183 _env->ReleasePrimitiveArrayCritical(source_ref, source_base,
3184 _exception ? JNI_ABORT: 0);
3185 }
3186 if (length_base) {
3187 _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
3188 _exception ? JNI_ABORT: 0);
3189 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003190 if (_exception) {
3191 jniThrowException(_env, _exceptionType, _exceptionMessage);
3192 }
Jack Palevich560814f2009-11-19 16:34:55 +08003193}
3194
3195/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3196static void
3197android_glGetShaderSource__IILjava_nio_IntBuffer_2B
3198 (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jobject length_buf, jbyte source) {
Jack Palevich560814f2009-11-19 16:34:55 +08003199 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003200 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003201 jint _remaining;
3202 GLsizei *length = (GLsizei *) 0;
3203
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003204 length = (GLsizei *)getPointer(_env, length_buf, &_array, &_remaining, &_bufferOffset);
3205 if (length == NULL) {
3206 char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3207 length = (GLsizei *) (_lengthBase + _bufferOffset);
3208 }
Jack Palevich560814f2009-11-19 16:34:55 +08003209 glGetShaderSource(
3210 (GLuint)shader,
3211 (GLsizei)bufsize,
3212 (GLsizei *)length,
3213 (char *)source
3214 );
3215 if (_array) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003216 releasePointer(_env, _array, length, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08003217 }
3218}
3219
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07003220/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3221static jstring android_glGetShaderSource(JNIEnv *_env, jobject, jint shader) {
3222 GLint shaderLen = 0;
3223 glGetShaderiv((GLuint)shader, GL_SHADER_SOURCE_LENGTH, &shaderLen);
3224 if (!shaderLen) {
3225 return _env->NewStringUTF("");
3226 }
3227 char* buf = (char*) malloc(shaderLen);
3228 if (buf == NULL) {
3229 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
3230 return NULL;
3231 }
3232 glGetShaderSource(shader, shaderLen, NULL, buf);
3233 jstring result = _env->NewStringUTF(buf);
3234 free(buf);
3235 return result;
3236}
Jack Palevich560814f2009-11-19 16:34:55 +08003237/* const GLubyte * glGetString ( GLenum name ) */
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003238static jstring android_glGetString(JNIEnv* _env, jobject, jint name) {
3239 const char* chars = (const char*) glGetString((GLenum) name);
3240 return _env->NewStringUTF(chars);
Jack Palevich560814f2009-11-19 16:34:55 +08003241}
3242/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
3243static void
3244android_glGetTexParameterfv__II_3FI
3245 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
3246 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003247 const char * _exceptionType = NULL;
3248 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003249 GLfloat *params_base = (GLfloat *) 0;
3250 jint _remaining;
3251 GLfloat *params = (GLfloat *) 0;
3252
3253 if (!params_ref) {
3254 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003255 _exceptionType = "java/lang/IllegalArgumentException";
3256 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003257 goto exit;
3258 }
3259 if (offset < 0) {
3260 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003261 _exceptionType = "java/lang/IllegalArgumentException";
3262 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003263 goto exit;
3264 }
3265 _remaining = _env->GetArrayLength(params_ref) - offset;
3266 if (_remaining < 1) {
3267 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003268 _exceptionType = "java/lang/IllegalArgumentException";
3269 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08003270 goto exit;
3271 }
3272 params_base = (GLfloat *)
3273 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3274 params = params_base + offset;
3275
3276 glGetTexParameterfv(
3277 (GLenum)target,
3278 (GLenum)pname,
3279 (GLfloat *)params
3280 );
3281
3282exit:
3283 if (params_base) {
3284 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3285 _exception ? JNI_ABORT: 0);
3286 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003287 if (_exception) {
3288 jniThrowException(_env, _exceptionType, _exceptionMessage);
3289 }
Jack Palevich560814f2009-11-19 16:34:55 +08003290}
3291
3292/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
3293static void
3294android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2
3295 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3296 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003297 const char * _exceptionType = NULL;
3298 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003299 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003300 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003301 jint _remaining;
3302 GLfloat *params = (GLfloat *) 0;
3303
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003304 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08003305 if (_remaining < 1) {
3306 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003307 _exceptionType = "java/lang/IllegalArgumentException";
3308 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08003309 goto exit;
3310 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003311 if (params == NULL) {
3312 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3313 params = (GLfloat *) (_paramsBase + _bufferOffset);
3314 }
Jack Palevich560814f2009-11-19 16:34:55 +08003315 glGetTexParameterfv(
3316 (GLenum)target,
3317 (GLenum)pname,
3318 (GLfloat *)params
3319 );
3320
3321exit:
3322 if (_array) {
3323 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3324 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003325 if (_exception) {
3326 jniThrowException(_env, _exceptionType, _exceptionMessage);
3327 }
Jack Palevich560814f2009-11-19 16:34:55 +08003328}
3329
3330/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3331static void
3332android_glGetTexParameteriv__II_3II
3333 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
3334 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003335 const char * _exceptionType = NULL;
3336 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003337 GLint *params_base = (GLint *) 0;
3338 jint _remaining;
3339 GLint *params = (GLint *) 0;
3340
3341 if (!params_ref) {
3342 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003343 _exceptionType = "java/lang/IllegalArgumentException";
3344 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003345 goto exit;
3346 }
3347 if (offset < 0) {
3348 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003349 _exceptionType = "java/lang/IllegalArgumentException";
3350 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003351 goto exit;
3352 }
3353 _remaining = _env->GetArrayLength(params_ref) - offset;
3354 if (_remaining < 1) {
3355 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003356 _exceptionType = "java/lang/IllegalArgumentException";
3357 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08003358 goto exit;
3359 }
3360 params_base = (GLint *)
3361 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3362 params = params_base + offset;
3363
3364 glGetTexParameteriv(
3365 (GLenum)target,
3366 (GLenum)pname,
3367 (GLint *)params
3368 );
3369
3370exit:
3371 if (params_base) {
3372 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3373 _exception ? JNI_ABORT: 0);
3374 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003375 if (_exception) {
3376 jniThrowException(_env, _exceptionType, _exceptionMessage);
3377 }
Jack Palevich560814f2009-11-19 16:34:55 +08003378}
3379
3380/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3381static void
3382android_glGetTexParameteriv__IILjava_nio_IntBuffer_2
3383 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3384 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003385 const char * _exceptionType = NULL;
3386 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003387 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003388 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003389 jint _remaining;
3390 GLint *params = (GLint *) 0;
3391
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003392 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08003393 if (_remaining < 1) {
3394 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003395 _exceptionType = "java/lang/IllegalArgumentException";
3396 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08003397 goto exit;
3398 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003399 if (params == NULL) {
3400 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3401 params = (GLint *) (_paramsBase + _bufferOffset);
3402 }
Jack Palevich560814f2009-11-19 16:34:55 +08003403 glGetTexParameteriv(
3404 (GLenum)target,
3405 (GLenum)pname,
3406 (GLint *)params
3407 );
3408
3409exit:
3410 if (_array) {
3411 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3412 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003413 if (_exception) {
3414 jniThrowException(_env, _exceptionType, _exceptionMessage);
3415 }
Jack Palevich560814f2009-11-19 16:34:55 +08003416}
3417
3418/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3419static void
3420android_glGetUniformfv__II_3FI
3421 (JNIEnv *_env, jobject _this, jint program, jint location, jfloatArray params_ref, jint offset) {
3422 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003423 const char * _exceptionType = NULL;
3424 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003425 GLfloat *params_base = (GLfloat *) 0;
3426 jint _remaining;
3427 GLfloat *params = (GLfloat *) 0;
3428
3429 if (!params_ref) {
3430 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003431 _exceptionType = "java/lang/IllegalArgumentException";
3432 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003433 goto exit;
3434 }
3435 if (offset < 0) {
3436 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003437 _exceptionType = "java/lang/IllegalArgumentException";
3438 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003439 goto exit;
3440 }
3441 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003442 if (_remaining < 1) {
3443 _exception = 1;
3444 _exceptionType = "java/lang/IllegalArgumentException";
3445 _exceptionMessage = "length - offset < 1 < needed";
3446 goto exit;
3447 }
Jack Palevich560814f2009-11-19 16:34:55 +08003448 params_base = (GLfloat *)
3449 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3450 params = params_base + offset;
3451
3452 glGetUniformfv(
3453 (GLuint)program,
3454 (GLint)location,
3455 (GLfloat *)params
3456 );
3457
3458exit:
3459 if (params_base) {
3460 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3461 _exception ? JNI_ABORT: 0);
3462 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003463 if (_exception) {
3464 jniThrowException(_env, _exceptionType, _exceptionMessage);
3465 }
Jack Palevich560814f2009-11-19 16:34:55 +08003466}
3467
3468/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3469static void
3470android_glGetUniformfv__IILjava_nio_FloatBuffer_2
3471 (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003472 jint _exception = 0;
3473 const char * _exceptionType = NULL;
3474 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003475 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003476 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003477 jint _remaining;
3478 GLfloat *params = (GLfloat *) 0;
3479
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003480 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003481 if (_remaining < 1) {
3482 _exception = 1;
3483 _exceptionType = "java/lang/IllegalArgumentException";
3484 _exceptionMessage = "remaining() < 1 < needed";
3485 goto exit;
3486 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003487 if (params == NULL) {
3488 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3489 params = (GLfloat *) (_paramsBase + _bufferOffset);
3490 }
Jack Palevich560814f2009-11-19 16:34:55 +08003491 glGetUniformfv(
3492 (GLuint)program,
3493 (GLint)location,
3494 (GLfloat *)params
3495 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003496
3497exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003498 if (_array) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003499 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3500 }
3501 if (_exception) {
3502 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003503 }
3504}
3505
3506/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3507static void
3508android_glGetUniformiv__II_3II
3509 (JNIEnv *_env, jobject _this, jint program, jint location, jintArray params_ref, jint offset) {
3510 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003511 const char * _exceptionType = NULL;
3512 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003513 GLint *params_base = (GLint *) 0;
3514 jint _remaining;
3515 GLint *params = (GLint *) 0;
3516
3517 if (!params_ref) {
3518 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003519 _exceptionType = "java/lang/IllegalArgumentException";
3520 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003521 goto exit;
3522 }
3523 if (offset < 0) {
3524 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003525 _exceptionType = "java/lang/IllegalArgumentException";
3526 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003527 goto exit;
3528 }
3529 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003530 if (_remaining < 1) {
3531 _exception = 1;
3532 _exceptionType = "java/lang/IllegalArgumentException";
3533 _exceptionMessage = "length - offset < 1 < needed";
3534 goto exit;
3535 }
Jack Palevich560814f2009-11-19 16:34:55 +08003536 params_base = (GLint *)
3537 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3538 params = params_base + offset;
3539
3540 glGetUniformiv(
3541 (GLuint)program,
3542 (GLint)location,
3543 (GLint *)params
3544 );
3545
3546exit:
3547 if (params_base) {
3548 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3549 _exception ? JNI_ABORT: 0);
3550 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003551 if (_exception) {
3552 jniThrowException(_env, _exceptionType, _exceptionMessage);
3553 }
Jack Palevich560814f2009-11-19 16:34:55 +08003554}
3555
3556/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3557static void
3558android_glGetUniformiv__IILjava_nio_IntBuffer_2
3559 (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003560 jint _exception = 0;
3561 const char * _exceptionType = NULL;
3562 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003563 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003564 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003565 jint _remaining;
3566 GLint *params = (GLint *) 0;
3567
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003568 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003569 if (_remaining < 1) {
3570 _exception = 1;
3571 _exceptionType = "java/lang/IllegalArgumentException";
3572 _exceptionMessage = "remaining() < 1 < needed";
3573 goto exit;
3574 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003575 if (params == NULL) {
3576 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3577 params = (GLint *) (_paramsBase + _bufferOffset);
3578 }
Jack Palevich560814f2009-11-19 16:34:55 +08003579 glGetUniformiv(
3580 (GLuint)program,
3581 (GLint)location,
3582 (GLint *)params
3583 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003584
3585exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003586 if (_array) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003587 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3588 }
3589 if (_exception) {
3590 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003591 }
3592}
3593
Mathias Agopian89be00b2013-02-22 20:08:06 -08003594/* GLint glGetUniformLocation ( GLuint program, const char *name ) */
Jack Palevich560814f2009-11-19 16:34:55 +08003595static jint
3596android_glGetUniformLocation__ILjava_lang_String_2
3597 (JNIEnv *_env, jobject _this, jint program, jstring name) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003598 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003599 const char * _exceptionType = NULL;
3600 const char * _exceptionMessage = NULL;
Mathias Agopian89be00b2013-02-22 20:08:06 -08003601 GLint _returnValue = 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003602 const char* _nativename = 0;
3603
3604 if (!name) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003605 _exceptionType = "java/lang/IllegalArgumentException";
3606 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003607 goto exit;
3608 }
3609 _nativename = _env->GetStringUTFChars(name, 0);
3610
3611 _returnValue = glGetUniformLocation(
3612 (GLuint)program,
3613 (char *)_nativename
3614 );
3615
3616exit:
3617 if (_nativename) {
3618 _env->ReleaseStringUTFChars(name, _nativename);
3619 }
3620
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003621 if (_exception) {
3622 jniThrowException(_env, _exceptionType, _exceptionMessage);
3623 }
Andy McFaddencee51982013-04-25 16:08:31 -07003624 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08003625}
3626
3627/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3628static void
3629android_glGetVertexAttribfv__II_3FI
3630 (JNIEnv *_env, jobject _this, jint index, jint pname, jfloatArray params_ref, jint offset) {
3631 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003632 const char * _exceptionType = NULL;
3633 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003634 GLfloat *params_base = (GLfloat *) 0;
3635 jint _remaining;
3636 GLfloat *params = (GLfloat *) 0;
3637
3638 if (!params_ref) {
3639 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003640 _exceptionType = "java/lang/IllegalArgumentException";
3641 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003642 goto exit;
3643 }
3644 if (offset < 0) {
3645 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003646 _exceptionType = "java/lang/IllegalArgumentException";
3647 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003648 goto exit;
3649 }
3650 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003651 int _needed;
3652 switch (pname) {
3653#if defined(GL_CURRENT_VERTEX_ATTRIB)
3654 case GL_CURRENT_VERTEX_ATTRIB:
3655#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3656 _needed = 4;
3657 break;
3658 default:
3659 _needed = 1;
3660 break;
3661 }
3662 if (_remaining < _needed) {
3663 _exception = 1;
3664 _exceptionType = "java/lang/IllegalArgumentException";
3665 _exceptionMessage = "length - offset < needed";
3666 goto exit;
3667 }
Jack Palevich560814f2009-11-19 16:34:55 +08003668 params_base = (GLfloat *)
3669 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3670 params = params_base + offset;
3671
3672 glGetVertexAttribfv(
3673 (GLuint)index,
3674 (GLenum)pname,
3675 (GLfloat *)params
3676 );
3677
3678exit:
3679 if (params_base) {
3680 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3681 _exception ? JNI_ABORT: 0);
3682 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003683 if (_exception) {
3684 jniThrowException(_env, _exceptionType, _exceptionMessage);
3685 }
Jack Palevich560814f2009-11-19 16:34:55 +08003686}
3687
3688/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3689static void
3690android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2
3691 (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003692 jint _exception = 0;
3693 const char * _exceptionType = NULL;
3694 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003695 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003696 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003697 jint _remaining;
3698 GLfloat *params = (GLfloat *) 0;
3699
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003700 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003701 int _needed;
3702 switch (pname) {
3703#if defined(GL_CURRENT_VERTEX_ATTRIB)
3704 case GL_CURRENT_VERTEX_ATTRIB:
3705#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3706 _needed = 4;
3707 break;
3708 default:
3709 _needed = 1;
3710 break;
3711 }
3712 if (_remaining < _needed) {
3713 _exception = 1;
3714 _exceptionType = "java/lang/IllegalArgumentException";
3715 _exceptionMessage = "remaining() < needed";
3716 goto exit;
3717 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003718 if (params == NULL) {
3719 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3720 params = (GLfloat *) (_paramsBase + _bufferOffset);
3721 }
Jack Palevich560814f2009-11-19 16:34:55 +08003722 glGetVertexAttribfv(
3723 (GLuint)index,
3724 (GLenum)pname,
3725 (GLfloat *)params
3726 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003727
3728exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003729 if (_array) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003730 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3731 }
3732 if (_exception) {
3733 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003734 }
3735}
3736
3737/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
3738static void
3739android_glGetVertexAttribiv__II_3II
3740 (JNIEnv *_env, jobject _this, jint index, jint pname, jintArray params_ref, jint offset) {
3741 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003742 const char * _exceptionType = NULL;
3743 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003744 GLint *params_base = (GLint *) 0;
3745 jint _remaining;
3746 GLint *params = (GLint *) 0;
3747
3748 if (!params_ref) {
3749 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003750 _exceptionType = "java/lang/IllegalArgumentException";
3751 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003752 goto exit;
3753 }
3754 if (offset < 0) {
3755 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003756 _exceptionType = "java/lang/IllegalArgumentException";
3757 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003758 goto exit;
3759 }
3760 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003761 int _needed;
3762 switch (pname) {
3763#if defined(GL_CURRENT_VERTEX_ATTRIB)
3764 case GL_CURRENT_VERTEX_ATTRIB:
3765#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3766 _needed = 4;
3767 break;
3768 default:
3769 _needed = 1;
3770 break;
3771 }
3772 if (_remaining < _needed) {
3773 _exception = 1;
3774 _exceptionType = "java/lang/IllegalArgumentException";
3775 _exceptionMessage = "length - offset < needed";
3776 goto exit;
3777 }
Jack Palevich560814f2009-11-19 16:34:55 +08003778 params_base = (GLint *)
3779 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3780 params = params_base + offset;
3781
3782 glGetVertexAttribiv(
3783 (GLuint)index,
3784 (GLenum)pname,
3785 (GLint *)params
3786 );
3787
3788exit:
3789 if (params_base) {
3790 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3791 _exception ? JNI_ABORT: 0);
3792 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003793 if (_exception) {
3794 jniThrowException(_env, _exceptionType, _exceptionMessage);
3795 }
Jack Palevich560814f2009-11-19 16:34:55 +08003796}
3797
3798/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
3799static void
3800android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2
3801 (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003802 jint _exception = 0;
3803 const char * _exceptionType = NULL;
3804 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003805 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003806 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003807 jint _remaining;
3808 GLint *params = (GLint *) 0;
3809
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003810 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003811 int _needed;
3812 switch (pname) {
3813#if defined(GL_CURRENT_VERTEX_ATTRIB)
3814 case GL_CURRENT_VERTEX_ATTRIB:
3815#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3816 _needed = 4;
3817 break;
3818 default:
3819 _needed = 1;
3820 break;
3821 }
3822 if (_remaining < _needed) {
3823 _exception = 1;
3824 _exceptionType = "java/lang/IllegalArgumentException";
3825 _exceptionMessage = "remaining() < needed";
3826 goto exit;
3827 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003828 if (params == NULL) {
3829 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3830 params = (GLint *) (_paramsBase + _bufferOffset);
3831 }
Jack Palevich560814f2009-11-19 16:34:55 +08003832 glGetVertexAttribiv(
3833 (GLuint)index,
3834 (GLenum)pname,
3835 (GLint *)params
3836 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003837
3838exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003839 if (_array) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003840 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3841 }
3842 if (_exception) {
3843 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003844 }
3845}
3846
3847/* void glHint ( GLenum target, GLenum mode ) */
3848static void
3849android_glHint__II
3850 (JNIEnv *_env, jobject _this, jint target, jint mode) {
3851 glHint(
3852 (GLenum)target,
3853 (GLenum)mode
3854 );
3855}
3856
3857/* GLboolean glIsBuffer ( GLuint buffer ) */
3858static jboolean
3859android_glIsBuffer__I
3860 (JNIEnv *_env, jobject _this, jint buffer) {
3861 GLboolean _returnValue;
3862 _returnValue = glIsBuffer(
3863 (GLuint)buffer
3864 );
Andy McFaddencee51982013-04-25 16:08:31 -07003865 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08003866}
3867
3868/* GLboolean glIsEnabled ( GLenum cap ) */
3869static jboolean
3870android_glIsEnabled__I
3871 (JNIEnv *_env, jobject _this, jint cap) {
3872 GLboolean _returnValue;
3873 _returnValue = glIsEnabled(
3874 (GLenum)cap
3875 );
Andy McFaddencee51982013-04-25 16:08:31 -07003876 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08003877}
3878
3879/* GLboolean glIsFramebuffer ( GLuint framebuffer ) */
3880static jboolean
3881android_glIsFramebuffer__I
3882 (JNIEnv *_env, jobject _this, jint framebuffer) {
3883 GLboolean _returnValue;
3884 _returnValue = glIsFramebuffer(
3885 (GLuint)framebuffer
3886 );
Andy McFaddencee51982013-04-25 16:08:31 -07003887 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08003888}
3889
3890/* GLboolean glIsProgram ( GLuint program ) */
3891static jboolean
3892android_glIsProgram__I
3893 (JNIEnv *_env, jobject _this, jint program) {
3894 GLboolean _returnValue;
3895 _returnValue = glIsProgram(
3896 (GLuint)program
3897 );
Andy McFaddencee51982013-04-25 16:08:31 -07003898 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08003899}
3900
3901/* GLboolean glIsRenderbuffer ( GLuint renderbuffer ) */
3902static jboolean
3903android_glIsRenderbuffer__I
3904 (JNIEnv *_env, jobject _this, jint renderbuffer) {
3905 GLboolean _returnValue;
3906 _returnValue = glIsRenderbuffer(
3907 (GLuint)renderbuffer
3908 );
Andy McFaddencee51982013-04-25 16:08:31 -07003909 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08003910}
3911
3912/* GLboolean glIsShader ( GLuint shader ) */
3913static jboolean
3914android_glIsShader__I
3915 (JNIEnv *_env, jobject _this, jint shader) {
3916 GLboolean _returnValue;
3917 _returnValue = glIsShader(
3918 (GLuint)shader
3919 );
Andy McFaddencee51982013-04-25 16:08:31 -07003920 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08003921}
3922
3923/* GLboolean glIsTexture ( GLuint texture ) */
3924static jboolean
3925android_glIsTexture__I
3926 (JNIEnv *_env, jobject _this, jint texture) {
3927 GLboolean _returnValue;
3928 _returnValue = glIsTexture(
3929 (GLuint)texture
3930 );
Andy McFaddencee51982013-04-25 16:08:31 -07003931 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08003932}
3933
3934/* void glLineWidth ( GLfloat width ) */
3935static void
3936android_glLineWidth__F
3937 (JNIEnv *_env, jobject _this, jfloat width) {
3938 glLineWidth(
3939 (GLfloat)width
3940 );
3941}
3942
3943/* void glLinkProgram ( GLuint program ) */
3944static void
3945android_glLinkProgram__I
3946 (JNIEnv *_env, jobject _this, jint program) {
3947 glLinkProgram(
3948 (GLuint)program
3949 );
3950}
3951
3952/* void glPixelStorei ( GLenum pname, GLint param ) */
3953static void
3954android_glPixelStorei__II
3955 (JNIEnv *_env, jobject _this, jint pname, jint param) {
3956 glPixelStorei(
3957 (GLenum)pname,
3958 (GLint)param
3959 );
3960}
3961
3962/* void glPolygonOffset ( GLfloat factor, GLfloat units ) */
3963static void
3964android_glPolygonOffset__FF
3965 (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) {
3966 glPolygonOffset(
3967 (GLfloat)factor,
3968 (GLfloat)units
3969 );
3970}
3971
3972/* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */
3973static void
3974android_glReadPixels__IIIIIILjava_nio_Buffer_2
3975 (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 +08003976 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003977 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003978 jint _remaining;
3979 GLvoid *pixels = (GLvoid *) 0;
3980
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003981 pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
3982 if (pixels == NULL) {
3983 char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
3984 pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
3985 }
Jack Palevich560814f2009-11-19 16:34:55 +08003986 glReadPixels(
3987 (GLint)x,
3988 (GLint)y,
3989 (GLsizei)width,
3990 (GLsizei)height,
3991 (GLenum)format,
3992 (GLenum)type,
3993 (GLvoid *)pixels
3994 );
3995 if (_array) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003996 releasePointer(_env, _array, pixels, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08003997 }
3998}
3999
4000/* void glReleaseShaderCompiler ( void ) */
4001static void
4002android_glReleaseShaderCompiler__
4003 (JNIEnv *_env, jobject _this) {
4004 glReleaseShaderCompiler();
4005}
4006
4007/* void glRenderbufferStorage ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) */
4008static void
4009android_glRenderbufferStorage__IIII
4010 (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint width, jint height) {
4011 glRenderbufferStorage(
4012 (GLenum)target,
4013 (GLenum)internalformat,
4014 (GLsizei)width,
4015 (GLsizei)height
4016 );
4017}
4018
4019/* void glSampleCoverage ( GLclampf value, GLboolean invert ) */
4020static void
4021android_glSampleCoverage__FZ
4022 (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) {
4023 glSampleCoverage(
4024 (GLclampf)value,
4025 (GLboolean)invert
4026 );
4027}
4028
4029/* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */
4030static void
4031android_glScissor__IIII
4032 (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
4033 glScissor(
4034 (GLint)x,
4035 (GLint)y,
4036 (GLsizei)width,
4037 (GLsizei)height
4038 );
4039}
4040
4041/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
4042static void
4043android_glShaderBinary__I_3IIILjava_nio_Buffer_2I
4044 (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 -07004045 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004046 const char * _exceptionType = NULL;
4047 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004048 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004049 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004050 GLuint *shaders_base = (GLuint *) 0;
4051 jint _shadersRemaining;
4052 GLuint *shaders = (GLuint *) 0;
4053 jint _binaryRemaining;
4054 GLvoid *binary = (GLvoid *) 0;
4055
4056 if (!shaders_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004057 _exception = 1;
4058 _exceptionType = "java/lang/IllegalArgumentException";
4059 _exceptionMessage = "shaders == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004060 goto exit;
4061 }
4062 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004063 _exception = 1;
4064 _exceptionType = "java/lang/IllegalArgumentException";
4065 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004066 goto exit;
4067 }
4068 _shadersRemaining = _env->GetArrayLength(shaders_ref) - offset;
4069 shaders_base = (GLuint *)
4070 _env->GetPrimitiveArrayCritical(shaders_ref, (jboolean *)0);
4071 shaders = shaders_base + offset;
4072
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004073 binary = (GLvoid *)getPointer(_env, binary_buf, &_array, &_binaryRemaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004074 if (_binaryRemaining < length) {
4075 _exception = 1;
4076 _exceptionType = "java/lang/IllegalArgumentException";
4077 _exceptionMessage = "remaining() < length < needed";
4078 goto exit;
4079 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004080 if (binary == NULL) {
4081 char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4082 binary = (GLvoid *) (_binaryBase + _bufferOffset);
4083 }
Jack Palevich560814f2009-11-19 16:34:55 +08004084 glShaderBinary(
4085 (GLsizei)n,
4086 (GLuint *)shaders,
4087 (GLenum)binaryformat,
4088 (GLvoid *)binary,
4089 (GLsizei)length
4090 );
4091
4092exit:
4093 if (_array) {
4094 releasePointer(_env, _array, binary, JNI_FALSE);
4095 }
4096 if (shaders_base) {
4097 _env->ReleasePrimitiveArrayCritical(shaders_ref, shaders_base,
4098 JNI_ABORT);
4099 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004100 if (_exception) {
4101 jniThrowException(_env, _exceptionType, _exceptionMessage);
4102 }
Jack Palevich560814f2009-11-19 16:34:55 +08004103}
4104
4105/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
4106static void
4107android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I
4108 (JNIEnv *_env, jobject _this, jint n, jobject shaders_buf, jint binaryformat, jobject binary_buf, jint length) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08004109 jint _exception = 0;
4110 const char * _exceptionType = NULL;
4111 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004112 jarray _shadersArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004113 jint _shadersBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004114 jarray _binaryArray = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004115 jint _binaryBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004116 jint _shadersRemaining;
4117 GLuint *shaders = (GLuint *) 0;
4118 jint _binaryRemaining;
4119 GLvoid *binary = (GLvoid *) 0;
4120
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004121 shaders = (GLuint *)getPointer(_env, shaders_buf, &_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
4122 binary = (GLvoid *)getPointer(_env, binary_buf, &_binaryArray, &_binaryRemaining, &_binaryBufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004123 if (_binaryRemaining < length) {
4124 _exception = 1;
4125 _exceptionType = "java/lang/IllegalArgumentException";
4126 _exceptionMessage = "remaining() < length < needed";
4127 goto exit;
4128 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004129 if (shaders == NULL) {
4130 char * _shadersBase = (char *)_env->GetPrimitiveArrayCritical(_shadersArray, (jboolean *) 0);
4131 shaders = (GLuint *) (_shadersBase + _shadersBufferOffset);
4132 }
4133 if (binary == NULL) {
4134 char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_binaryArray, (jboolean *) 0);
4135 binary = (GLvoid *) (_binaryBase + _binaryBufferOffset);
4136 }
Jack Palevich560814f2009-11-19 16:34:55 +08004137 glShaderBinary(
4138 (GLsizei)n,
4139 (GLuint *)shaders,
4140 (GLenum)binaryformat,
4141 (GLvoid *)binary,
4142 (GLsizei)length
4143 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08004144
4145exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004146 if (_binaryArray) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004147 releasePointer(_env, _binaryArray, binary, JNI_FALSE);
4148 }
4149 if (_shadersArray) {
4150 releasePointer(_env, _shadersArray, shaders, JNI_FALSE);
Jack Palevich560814f2009-11-19 16:34:55 +08004151 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08004152 if (_exception) {
4153 jniThrowException(_env, _exceptionType, _exceptionMessage);
4154 }
Jack Palevich560814f2009-11-19 16:34:55 +08004155}
4156
4157
4158/* void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint * length ) */
4159static
4160void
4161android_glShaderSource
4162 (JNIEnv *_env, jobject _this, jint shader, jstring string) {
4163
4164 if (!string) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07004165 jniThrowException(_env, "java/lang/IllegalArgumentException", "string == null");
Jack Palevich560814f2009-11-19 16:34:55 +08004166 return;
4167 }
4168
4169 const char* nativeString = _env->GetStringUTFChars(string, 0);
4170 const char* strings[] = {nativeString};
4171 glShaderSource(shader, 1, strings, 0);
4172 _env->ReleaseStringUTFChars(string, nativeString);
4173}
4174/* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */
4175static void
4176android_glStencilFunc__III
4177 (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) {
4178 glStencilFunc(
4179 (GLenum)func,
4180 (GLint)ref,
4181 (GLuint)mask
4182 );
4183}
4184
4185/* void glStencilFuncSeparate ( GLenum face, GLenum func, GLint ref, GLuint mask ) */
4186static void
4187android_glStencilFuncSeparate__IIII
4188 (JNIEnv *_env, jobject _this, jint face, jint func, jint ref, jint mask) {
4189 glStencilFuncSeparate(
4190 (GLenum)face,
4191 (GLenum)func,
4192 (GLint)ref,
4193 (GLuint)mask
4194 );
4195}
4196
4197/* void glStencilMask ( GLuint mask ) */
4198static void
4199android_glStencilMask__I
4200 (JNIEnv *_env, jobject _this, jint mask) {
4201 glStencilMask(
4202 (GLuint)mask
4203 );
4204}
4205
4206/* void glStencilMaskSeparate ( GLenum face, GLuint mask ) */
4207static void
4208android_glStencilMaskSeparate__II
4209 (JNIEnv *_env, jobject _this, jint face, jint mask) {
4210 glStencilMaskSeparate(
4211 (GLenum)face,
4212 (GLuint)mask
4213 );
4214}
4215
4216/* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */
4217static void
4218android_glStencilOp__III
4219 (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) {
4220 glStencilOp(
4221 (GLenum)fail,
4222 (GLenum)zfail,
4223 (GLenum)zpass
4224 );
4225}
4226
4227/* void glStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) */
4228static void
4229android_glStencilOpSeparate__IIII
4230 (JNIEnv *_env, jobject _this, jint face, jint fail, jint zfail, jint zpass) {
4231 glStencilOpSeparate(
4232 (GLenum)face,
4233 (GLenum)fail,
4234 (GLenum)zfail,
4235 (GLenum)zpass
4236 );
4237}
4238
4239/* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */
4240static void
4241android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2
4242 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) {
4243 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004244 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004245 jint _remaining;
4246 GLvoid *pixels = (GLvoid *) 0;
4247
4248 if (pixels_buf) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004249 pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
4250 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -07004251 if (pixels_buf && pixels == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004252 char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4253 pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08004254 }
4255 glTexImage2D(
4256 (GLenum)target,
4257 (GLint)level,
4258 (GLint)internalformat,
4259 (GLsizei)width,
4260 (GLsizei)height,
4261 (GLint)border,
4262 (GLenum)format,
4263 (GLenum)type,
4264 (GLvoid *)pixels
4265 );
4266 if (_array) {
4267 releasePointer(_env, _array, pixels, JNI_FALSE);
4268 }
4269}
4270
4271/* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */
4272static void
4273android_glTexParameterf__IIF
4274 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
4275 glTexParameterf(
4276 (GLenum)target,
4277 (GLenum)pname,
4278 (GLfloat)param
4279 );
4280}
4281
4282/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
4283static void
4284android_glTexParameterfv__II_3FI
4285 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004286 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004287 const char * _exceptionType = NULL;
4288 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004289 GLfloat *params_base = (GLfloat *) 0;
4290 jint _remaining;
4291 GLfloat *params = (GLfloat *) 0;
4292
4293 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004294 _exception = 1;
4295 _exceptionType = "java/lang/IllegalArgumentException";
4296 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004297 goto exit;
4298 }
4299 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004300 _exception = 1;
4301 _exceptionType = "java/lang/IllegalArgumentException";
4302 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004303 goto exit;
4304 }
4305 _remaining = _env->GetArrayLength(params_ref) - offset;
4306 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004307 _exception = 1;
4308 _exceptionType = "java/lang/IllegalArgumentException";
4309 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08004310 goto exit;
4311 }
4312 params_base = (GLfloat *)
4313 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
4314 params = params_base + offset;
4315
4316 glTexParameterfv(
4317 (GLenum)target,
4318 (GLenum)pname,
4319 (GLfloat *)params
4320 );
4321
4322exit:
4323 if (params_base) {
4324 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
4325 JNI_ABORT);
4326 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004327 if (_exception) {
4328 jniThrowException(_env, _exceptionType, _exceptionMessage);
4329 }
Jack Palevich560814f2009-11-19 16:34:55 +08004330}
4331
4332/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
4333static void
4334android_glTexParameterfv__IILjava_nio_FloatBuffer_2
4335 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004336 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004337 const char * _exceptionType = NULL;
4338 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004339 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004340 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004341 jint _remaining;
4342 GLfloat *params = (GLfloat *) 0;
4343
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004344 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08004345 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004346 _exception = 1;
4347 _exceptionType = "java/lang/IllegalArgumentException";
4348 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08004349 goto exit;
4350 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004351 if (params == NULL) {
4352 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4353 params = (GLfloat *) (_paramsBase + _bufferOffset);
4354 }
Jack Palevich560814f2009-11-19 16:34:55 +08004355 glTexParameterfv(
4356 (GLenum)target,
4357 (GLenum)pname,
4358 (GLfloat *)params
4359 );
4360
4361exit:
4362 if (_array) {
4363 releasePointer(_env, _array, params, JNI_FALSE);
4364 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004365 if (_exception) {
4366 jniThrowException(_env, _exceptionType, _exceptionMessage);
4367 }
Jack Palevich560814f2009-11-19 16:34:55 +08004368}
4369
4370/* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */
4371static void
4372android_glTexParameteri__III
4373 (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
4374 glTexParameteri(
4375 (GLenum)target,
4376 (GLenum)pname,
4377 (GLint)param
4378 );
4379}
4380
4381/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
4382static void
4383android_glTexParameteriv__II_3II
4384 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004385 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004386 const char * _exceptionType = NULL;
4387 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004388 GLint *params_base = (GLint *) 0;
4389 jint _remaining;
4390 GLint *params = (GLint *) 0;
4391
4392 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004393 _exception = 1;
4394 _exceptionType = "java/lang/IllegalArgumentException";
4395 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004396 goto exit;
4397 }
4398 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004399 _exception = 1;
4400 _exceptionType = "java/lang/IllegalArgumentException";
4401 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004402 goto exit;
4403 }
4404 _remaining = _env->GetArrayLength(params_ref) - offset;
4405 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004406 _exception = 1;
4407 _exceptionType = "java/lang/IllegalArgumentException";
4408 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08004409 goto exit;
4410 }
4411 params_base = (GLint *)
4412 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
4413 params = params_base + offset;
4414
4415 glTexParameteriv(
4416 (GLenum)target,
4417 (GLenum)pname,
4418 (GLint *)params
4419 );
4420
4421exit:
4422 if (params_base) {
4423 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
4424 JNI_ABORT);
4425 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004426 if (_exception) {
4427 jniThrowException(_env, _exceptionType, _exceptionMessage);
4428 }
Jack Palevich560814f2009-11-19 16:34:55 +08004429}
4430
4431/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
4432static void
4433android_glTexParameteriv__IILjava_nio_IntBuffer_2
4434 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004435 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004436 const char * _exceptionType = NULL;
4437 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004438 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004439 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004440 jint _remaining;
4441 GLint *params = (GLint *) 0;
4442
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004443 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08004444 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004445 _exception = 1;
4446 _exceptionType = "java/lang/IllegalArgumentException";
4447 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08004448 goto exit;
4449 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004450 if (params == NULL) {
4451 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4452 params = (GLint *) (_paramsBase + _bufferOffset);
4453 }
Jack Palevich560814f2009-11-19 16:34:55 +08004454 glTexParameteriv(
4455 (GLenum)target,
4456 (GLenum)pname,
4457 (GLint *)params
4458 );
4459
4460exit:
4461 if (_array) {
4462 releasePointer(_env, _array, params, JNI_FALSE);
4463 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004464 if (_exception) {
4465 jniThrowException(_env, _exceptionType, _exceptionMessage);
4466 }
Jack Palevich560814f2009-11-19 16:34:55 +08004467}
4468
4469/* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */
4470static void
4471android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
4472 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) {
4473 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004474 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004475 jint _remaining;
4476 GLvoid *pixels = (GLvoid *) 0;
4477
4478 if (pixels_buf) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004479 pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
4480 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -07004481 if (pixels_buf && pixels == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004482 char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4483 pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08004484 }
4485 glTexSubImage2D(
4486 (GLenum)target,
4487 (GLint)level,
4488 (GLint)xoffset,
4489 (GLint)yoffset,
4490 (GLsizei)width,
4491 (GLsizei)height,
4492 (GLenum)format,
4493 (GLenum)type,
4494 (GLvoid *)pixels
4495 );
4496 if (_array) {
4497 releasePointer(_env, _array, pixels, JNI_FALSE);
4498 }
4499}
4500
4501/* void glUniform1f ( GLint location, GLfloat x ) */
4502static void
4503android_glUniform1f__IF
4504 (JNIEnv *_env, jobject _this, jint location, jfloat x) {
4505 glUniform1f(
4506 (GLint)location,
4507 (GLfloat)x
4508 );
4509}
4510
4511/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
4512static void
4513android_glUniform1fv__II_3FI
4514 (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004515 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004516 const char * _exceptionType = NULL;
4517 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004518 GLfloat *v_base = (GLfloat *) 0;
4519 jint _remaining;
4520 GLfloat *v = (GLfloat *) 0;
4521
4522 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004523 _exception = 1;
4524 _exceptionType = "java/lang/IllegalArgumentException";
4525 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004526 goto exit;
4527 }
4528 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004529 _exception = 1;
4530 _exceptionType = "java/lang/IllegalArgumentException";
4531 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004532 goto exit;
4533 }
4534 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004535 if (_remaining < count) {
4536 _exception = 1;
4537 _exceptionType = "java/lang/IllegalArgumentException";
4538 _exceptionMessage = "length - offset < count < needed";
4539 goto exit;
4540 }
Jack Palevich560814f2009-11-19 16:34:55 +08004541 v_base = (GLfloat *)
4542 _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4543 v = v_base + offset;
4544
4545 glUniform1fv(
4546 (GLint)location,
4547 (GLsizei)count,
4548 (GLfloat *)v
4549 );
4550
4551exit:
4552 if (v_base) {
4553 _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4554 JNI_ABORT);
4555 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004556 if (_exception) {
4557 jniThrowException(_env, _exceptionType, _exceptionMessage);
4558 }
Jack Palevich560814f2009-11-19 16:34:55 +08004559}
4560
4561/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
4562static void
4563android_glUniform1fv__IILjava_nio_FloatBuffer_2
4564 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08004565 jint _exception = 0;
4566 const char * _exceptionType = NULL;
4567 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004568 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004569 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004570 jint _remaining;
4571 GLfloat *v = (GLfloat *) 0;
4572
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004573 v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004574 if (_remaining < count) {
4575 _exception = 1;
4576 _exceptionType = "java/lang/IllegalArgumentException";
4577 _exceptionMessage = "remaining() < count < needed";
4578 goto exit;
4579 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004580 if (v == NULL) {
4581 char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4582 v = (GLfloat *) (_vBase + _bufferOffset);
4583 }
Jack Palevich560814f2009-11-19 16:34:55 +08004584 glUniform1fv(
4585 (GLint)location,
4586 (GLsizei)count,
4587 (GLfloat *)v
4588 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08004589
4590exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004591 if (_array) {
4592 releasePointer(_env, _array, v, JNI_FALSE);
4593 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08004594 if (_exception) {
4595 jniThrowException(_env, _exceptionType, _exceptionMessage);
4596 }
Jack Palevich560814f2009-11-19 16:34:55 +08004597}
4598
4599/* void glUniform1i ( GLint location, GLint x ) */
4600static void
4601android_glUniform1i__II
4602 (JNIEnv *_env, jobject _this, jint location, jint x) {
4603 glUniform1i(
4604 (GLint)location,
4605 (GLint)x
4606 );
4607}
4608
4609/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
4610static void
4611android_glUniform1iv__II_3II
4612 (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004613 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004614 const char * _exceptionType = NULL;
4615 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004616 GLint *v_base = (GLint *) 0;
4617 jint _remaining;
4618 GLint *v = (GLint *) 0;
4619
4620 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004621 _exception = 1;
4622 _exceptionType = "java/lang/IllegalArgumentException";
4623 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004624 goto exit;
4625 }
4626 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004627 _exception = 1;
4628 _exceptionType = "java/lang/IllegalArgumentException";
4629 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004630 goto exit;
4631 }
4632 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004633 if (_remaining < count) {
4634 _exception = 1;
4635 _exceptionType = "java/lang/IllegalArgumentException";
4636 _exceptionMessage = "length - offset < count < needed";
4637 goto exit;
4638 }
Jack Palevich560814f2009-11-19 16:34:55 +08004639 v_base = (GLint *)
4640 _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4641 v = v_base + offset;
4642
4643 glUniform1iv(
4644 (GLint)location,
4645 (GLsizei)count,
4646 (GLint *)v
4647 );
4648
4649exit:
4650 if (v_base) {
4651 _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4652 JNI_ABORT);
4653 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004654 if (_exception) {
4655 jniThrowException(_env, _exceptionType, _exceptionMessage);
4656 }
Jack Palevich560814f2009-11-19 16:34:55 +08004657}
4658
4659/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
4660static void
4661android_glUniform1iv__IILjava_nio_IntBuffer_2
4662 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08004663 jint _exception = 0;
4664 const char * _exceptionType = NULL;
4665 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004666 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004667 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004668 jint _remaining;
4669 GLint *v = (GLint *) 0;
4670
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004671 v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004672 if (_remaining < count) {
4673 _exception = 1;
4674 _exceptionType = "java/lang/IllegalArgumentException";
4675 _exceptionMessage = "remaining() < count < needed";
4676 goto exit;
4677 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004678 if (v == NULL) {
4679 char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4680 v = (GLint *) (_vBase + _bufferOffset);
4681 }
Jack Palevich560814f2009-11-19 16:34:55 +08004682 glUniform1iv(
4683 (GLint)location,
4684 (GLsizei)count,
4685 (GLint *)v
4686 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08004687
4688exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004689 if (_array) {
4690 releasePointer(_env, _array, v, JNI_FALSE);
4691 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08004692 if (_exception) {
4693 jniThrowException(_env, _exceptionType, _exceptionMessage);
4694 }
Jack Palevich560814f2009-11-19 16:34:55 +08004695}
4696
4697/* void glUniform2f ( GLint location, GLfloat x, GLfloat y ) */
4698static void
4699android_glUniform2f__IFF
4700 (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y) {
4701 glUniform2f(
4702 (GLint)location,
4703 (GLfloat)x,
4704 (GLfloat)y
4705 );
4706}
4707
4708/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
4709static void
4710android_glUniform2fv__II_3FI
4711 (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004712 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004713 const char * _exceptionType = NULL;
4714 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004715 GLfloat *v_base = (GLfloat *) 0;
4716 jint _remaining;
4717 GLfloat *v = (GLfloat *) 0;
4718
4719 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004720 _exception = 1;
4721 _exceptionType = "java/lang/IllegalArgumentException";
4722 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004723 goto exit;
4724 }
4725 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004726 _exception = 1;
4727 _exceptionType = "java/lang/IllegalArgumentException";
4728 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004729 goto exit;
4730 }
4731 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004732 if (_remaining < count*2) {
4733 _exception = 1;
4734 _exceptionType = "java/lang/IllegalArgumentException";
4735 _exceptionMessage = "length - offset < count*2 < needed";
4736 goto exit;
4737 }
Jack Palevich560814f2009-11-19 16:34:55 +08004738 v_base = (GLfloat *)
4739 _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4740 v = v_base + offset;
4741
4742 glUniform2fv(
4743 (GLint)location,
4744 (GLsizei)count,
4745 (GLfloat *)v
4746 );
4747
4748exit:
4749 if (v_base) {
4750 _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4751 JNI_ABORT);
4752 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004753 if (_exception) {
4754 jniThrowException(_env, _exceptionType, _exceptionMessage);
4755 }
Jack Palevich560814f2009-11-19 16:34:55 +08004756}
4757
4758/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
4759static void
4760android_glUniform2fv__IILjava_nio_FloatBuffer_2
4761 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08004762 jint _exception = 0;
4763 const char * _exceptionType = NULL;
4764 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004765 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004766 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004767 jint _remaining;
4768 GLfloat *v = (GLfloat *) 0;
4769
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004770 v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004771 if (_remaining < count*2) {
4772 _exception = 1;
4773 _exceptionType = "java/lang/IllegalArgumentException";
4774 _exceptionMessage = "remaining() < count*2 < needed";
4775 goto exit;
4776 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004777 if (v == NULL) {
4778 char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4779 v = (GLfloat *) (_vBase + _bufferOffset);
4780 }
Jack Palevich560814f2009-11-19 16:34:55 +08004781 glUniform2fv(
4782 (GLint)location,
4783 (GLsizei)count,
4784 (GLfloat *)v
4785 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08004786
4787exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004788 if (_array) {
4789 releasePointer(_env, _array, v, JNI_FALSE);
4790 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08004791 if (_exception) {
4792 jniThrowException(_env, _exceptionType, _exceptionMessage);
4793 }
Jack Palevich560814f2009-11-19 16:34:55 +08004794}
4795
4796/* void glUniform2i ( GLint location, GLint x, GLint y ) */
4797static void
4798android_glUniform2i__III
4799 (JNIEnv *_env, jobject _this, jint location, jint x, jint y) {
4800 glUniform2i(
4801 (GLint)location,
4802 (GLint)x,
4803 (GLint)y
4804 );
4805}
4806
4807/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
4808static void
4809android_glUniform2iv__II_3II
4810 (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004811 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004812 const char * _exceptionType = NULL;
4813 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004814 GLint *v_base = (GLint *) 0;
4815 jint _remaining;
4816 GLint *v = (GLint *) 0;
4817
4818 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004819 _exception = 1;
4820 _exceptionType = "java/lang/IllegalArgumentException";
4821 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004822 goto exit;
4823 }
4824 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004825 _exception = 1;
4826 _exceptionType = "java/lang/IllegalArgumentException";
4827 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004828 goto exit;
4829 }
4830 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004831 if (_remaining < count*2) {
4832 _exception = 1;
4833 _exceptionType = "java/lang/IllegalArgumentException";
4834 _exceptionMessage = "length - offset < count*2 < needed";
4835 goto exit;
4836 }
Jack Palevich560814f2009-11-19 16:34:55 +08004837 v_base = (GLint *)
4838 _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4839 v = v_base + offset;
4840
4841 glUniform2iv(
4842 (GLint)location,
4843 (GLsizei)count,
4844 (GLint *)v
4845 );
4846
4847exit:
4848 if (v_base) {
4849 _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4850 JNI_ABORT);
4851 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004852 if (_exception) {
4853 jniThrowException(_env, _exceptionType, _exceptionMessage);
4854 }
Jack Palevich560814f2009-11-19 16:34:55 +08004855}
4856
4857/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
4858static void
4859android_glUniform2iv__IILjava_nio_IntBuffer_2
4860 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08004861 jint _exception = 0;
4862 const char * _exceptionType = NULL;
4863 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004864 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004865 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004866 jint _remaining;
4867 GLint *v = (GLint *) 0;
4868
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004869 v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004870 if (_remaining < count*2) {
4871 _exception = 1;
4872 _exceptionType = "java/lang/IllegalArgumentException";
4873 _exceptionMessage = "remaining() < count*2 < needed";
4874 goto exit;
4875 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004876 if (v == NULL) {
4877 char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4878 v = (GLint *) (_vBase + _bufferOffset);
4879 }
Jack Palevich560814f2009-11-19 16:34:55 +08004880 glUniform2iv(
4881 (GLint)location,
4882 (GLsizei)count,
4883 (GLint *)v
4884 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08004885
4886exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004887 if (_array) {
4888 releasePointer(_env, _array, v, JNI_FALSE);
4889 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08004890 if (_exception) {
4891 jniThrowException(_env, _exceptionType, _exceptionMessage);
4892 }
Jack Palevich560814f2009-11-19 16:34:55 +08004893}
4894
4895/* void glUniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z ) */
4896static void
4897android_glUniform3f__IFFF
4898 (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z) {
4899 glUniform3f(
4900 (GLint)location,
4901 (GLfloat)x,
4902 (GLfloat)y,
4903 (GLfloat)z
4904 );
4905}
4906
4907/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
4908static void
4909android_glUniform3fv__II_3FI
4910 (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004911 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004912 const char * _exceptionType = NULL;
4913 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004914 GLfloat *v_base = (GLfloat *) 0;
4915 jint _remaining;
4916 GLfloat *v = (GLfloat *) 0;
4917
4918 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004919 _exception = 1;
4920 _exceptionType = "java/lang/IllegalArgumentException";
4921 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004922 goto exit;
4923 }
4924 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004925 _exception = 1;
4926 _exceptionType = "java/lang/IllegalArgumentException";
4927 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004928 goto exit;
4929 }
4930 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004931 if (_remaining < count*3) {
4932 _exception = 1;
4933 _exceptionType = "java/lang/IllegalArgumentException";
4934 _exceptionMessage = "length - offset < count*3 < needed";
4935 goto exit;
4936 }
Jack Palevich560814f2009-11-19 16:34:55 +08004937 v_base = (GLfloat *)
4938 _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4939 v = v_base + offset;
4940
4941 glUniform3fv(
4942 (GLint)location,
4943 (GLsizei)count,
4944 (GLfloat *)v
4945 );
4946
4947exit:
4948 if (v_base) {
4949 _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4950 JNI_ABORT);
4951 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004952 if (_exception) {
4953 jniThrowException(_env, _exceptionType, _exceptionMessage);
4954 }
Jack Palevich560814f2009-11-19 16:34:55 +08004955}
4956
4957/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
4958static void
4959android_glUniform3fv__IILjava_nio_FloatBuffer_2
4960 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08004961 jint _exception = 0;
4962 const char * _exceptionType = NULL;
4963 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004964 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004965 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004966 jint _remaining;
4967 GLfloat *v = (GLfloat *) 0;
4968
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004969 v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004970 if (_remaining < count*3) {
4971 _exception = 1;
4972 _exceptionType = "java/lang/IllegalArgumentException";
4973 _exceptionMessage = "remaining() < count*3 < needed";
4974 goto exit;
4975 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004976 if (v == NULL) {
4977 char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4978 v = (GLfloat *) (_vBase + _bufferOffset);
4979 }
Jack Palevich560814f2009-11-19 16:34:55 +08004980 glUniform3fv(
4981 (GLint)location,
4982 (GLsizei)count,
4983 (GLfloat *)v
4984 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08004985
4986exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004987 if (_array) {
4988 releasePointer(_env, _array, v, JNI_FALSE);
4989 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08004990 if (_exception) {
4991 jniThrowException(_env, _exceptionType, _exceptionMessage);
4992 }
Jack Palevich560814f2009-11-19 16:34:55 +08004993}
4994
4995/* void glUniform3i ( GLint location, GLint x, GLint y, GLint z ) */
4996static void
4997android_glUniform3i__IIII
4998 (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z) {
4999 glUniform3i(
5000 (GLint)location,
5001 (GLint)x,
5002 (GLint)y,
5003 (GLint)z
5004 );
5005}
5006
5007/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
5008static void
5009android_glUniform3iv__II_3II
5010 (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005011 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005012 const char * _exceptionType = NULL;
5013 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005014 GLint *v_base = (GLint *) 0;
5015 jint _remaining;
5016 GLint *v = (GLint *) 0;
5017
5018 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005019 _exception = 1;
5020 _exceptionType = "java/lang/IllegalArgumentException";
5021 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005022 goto exit;
5023 }
5024 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005025 _exception = 1;
5026 _exceptionType = "java/lang/IllegalArgumentException";
5027 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005028 goto exit;
5029 }
5030 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005031 if (_remaining < count*3) {
5032 _exception = 1;
5033 _exceptionType = "java/lang/IllegalArgumentException";
5034 _exceptionMessage = "length - offset < count*3 < needed";
5035 goto exit;
5036 }
Jack Palevich560814f2009-11-19 16:34:55 +08005037 v_base = (GLint *)
5038 _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
5039 v = v_base + offset;
5040
5041 glUniform3iv(
5042 (GLint)location,
5043 (GLsizei)count,
5044 (GLint *)v
5045 );
5046
5047exit:
5048 if (v_base) {
5049 _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
5050 JNI_ABORT);
5051 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005052 if (_exception) {
5053 jniThrowException(_env, _exceptionType, _exceptionMessage);
5054 }
Jack Palevich560814f2009-11-19 16:34:55 +08005055}
5056
5057/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
5058static void
5059android_glUniform3iv__IILjava_nio_IntBuffer_2
5060 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005061 jint _exception = 0;
5062 const char * _exceptionType = NULL;
5063 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005064 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005065 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005066 jint _remaining;
5067 GLint *v = (GLint *) 0;
5068
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005069 v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005070 if (_remaining < count*3) {
5071 _exception = 1;
5072 _exceptionType = "java/lang/IllegalArgumentException";
5073 _exceptionMessage = "remaining() < count*3 < needed";
5074 goto exit;
5075 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005076 if (v == NULL) {
5077 char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5078 v = (GLint *) (_vBase + _bufferOffset);
5079 }
Jack Palevich560814f2009-11-19 16:34:55 +08005080 glUniform3iv(
5081 (GLint)location,
5082 (GLsizei)count,
5083 (GLint *)v
5084 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005085
5086exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005087 if (_array) {
5088 releasePointer(_env, _array, v, JNI_FALSE);
5089 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005090 if (_exception) {
5091 jniThrowException(_env, _exceptionType, _exceptionMessage);
5092 }
Jack Palevich560814f2009-11-19 16:34:55 +08005093}
5094
5095/* void glUniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
5096static void
5097android_glUniform4f__IFFFF
5098 (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z, jfloat w) {
5099 glUniform4f(
5100 (GLint)location,
5101 (GLfloat)x,
5102 (GLfloat)y,
5103 (GLfloat)z,
5104 (GLfloat)w
5105 );
5106}
5107
5108/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
5109static void
5110android_glUniform4fv__II_3FI
5111 (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005112 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005113 const char * _exceptionType = NULL;
5114 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005115 GLfloat *v_base = (GLfloat *) 0;
5116 jint _remaining;
5117 GLfloat *v = (GLfloat *) 0;
5118
5119 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005120 _exception = 1;
5121 _exceptionType = "java/lang/IllegalArgumentException";
5122 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005123 goto exit;
5124 }
5125 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005126 _exception = 1;
5127 _exceptionType = "java/lang/IllegalArgumentException";
5128 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005129 goto exit;
5130 }
5131 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005132 if (_remaining < count*4) {
5133 _exception = 1;
5134 _exceptionType = "java/lang/IllegalArgumentException";
5135 _exceptionMessage = "length - offset < count*4 < needed";
5136 goto exit;
5137 }
Jack Palevich560814f2009-11-19 16:34:55 +08005138 v_base = (GLfloat *)
5139 _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
5140 v = v_base + offset;
5141
5142 glUniform4fv(
5143 (GLint)location,
5144 (GLsizei)count,
5145 (GLfloat *)v
5146 );
5147
5148exit:
5149 if (v_base) {
5150 _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
5151 JNI_ABORT);
5152 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005153 if (_exception) {
5154 jniThrowException(_env, _exceptionType, _exceptionMessage);
5155 }
Jack Palevich560814f2009-11-19 16:34:55 +08005156}
5157
5158/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
5159static void
5160android_glUniform4fv__IILjava_nio_FloatBuffer_2
5161 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005162 jint _exception = 0;
5163 const char * _exceptionType = NULL;
5164 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005165 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005166 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005167 jint _remaining;
5168 GLfloat *v = (GLfloat *) 0;
5169
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005170 v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005171 if (_remaining < count*4) {
5172 _exception = 1;
5173 _exceptionType = "java/lang/IllegalArgumentException";
5174 _exceptionMessage = "remaining() < count*4 < needed";
5175 goto exit;
5176 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005177 if (v == NULL) {
5178 char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5179 v = (GLfloat *) (_vBase + _bufferOffset);
5180 }
Jack Palevich560814f2009-11-19 16:34:55 +08005181 glUniform4fv(
5182 (GLint)location,
5183 (GLsizei)count,
5184 (GLfloat *)v
5185 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005186
5187exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005188 if (_array) {
5189 releasePointer(_env, _array, v, JNI_FALSE);
5190 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005191 if (_exception) {
5192 jniThrowException(_env, _exceptionType, _exceptionMessage);
5193 }
Jack Palevich560814f2009-11-19 16:34:55 +08005194}
5195
5196/* void glUniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w ) */
5197static void
5198android_glUniform4i__IIIII
5199 (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z, jint w) {
5200 glUniform4i(
5201 (GLint)location,
5202 (GLint)x,
5203 (GLint)y,
5204 (GLint)z,
5205 (GLint)w
5206 );
5207}
5208
5209/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
5210static void
5211android_glUniform4iv__II_3II
5212 (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005213 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005214 const char * _exceptionType = NULL;
5215 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005216 GLint *v_base = (GLint *) 0;
5217 jint _remaining;
5218 GLint *v = (GLint *) 0;
5219
5220 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005221 _exception = 1;
5222 _exceptionType = "java/lang/IllegalArgumentException";
5223 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005224 goto exit;
5225 }
5226 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005227 _exception = 1;
5228 _exceptionType = "java/lang/IllegalArgumentException";
5229 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005230 goto exit;
5231 }
5232 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005233 if (_remaining < count*4) {
5234 _exception = 1;
5235 _exceptionType = "java/lang/IllegalArgumentException";
5236 _exceptionMessage = "length - offset < count*4 < needed";
5237 goto exit;
5238 }
Jack Palevich560814f2009-11-19 16:34:55 +08005239 v_base = (GLint *)
5240 _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
5241 v = v_base + offset;
5242
5243 glUniform4iv(
5244 (GLint)location,
5245 (GLsizei)count,
5246 (GLint *)v
5247 );
5248
5249exit:
5250 if (v_base) {
5251 _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
5252 JNI_ABORT);
5253 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005254 if (_exception) {
5255 jniThrowException(_env, _exceptionType, _exceptionMessage);
5256 }
Jack Palevich560814f2009-11-19 16:34:55 +08005257}
5258
5259/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
5260static void
5261android_glUniform4iv__IILjava_nio_IntBuffer_2
5262 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005263 jint _exception = 0;
5264 const char * _exceptionType = NULL;
5265 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005266 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005267 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005268 jint _remaining;
5269 GLint *v = (GLint *) 0;
5270
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005271 v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005272 if (_remaining < count*4) {
5273 _exception = 1;
5274 _exceptionType = "java/lang/IllegalArgumentException";
5275 _exceptionMessage = "remaining() < count*4 < needed";
5276 goto exit;
5277 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005278 if (v == NULL) {
5279 char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5280 v = (GLint *) (_vBase + _bufferOffset);
5281 }
Jack Palevich560814f2009-11-19 16:34:55 +08005282 glUniform4iv(
5283 (GLint)location,
5284 (GLsizei)count,
5285 (GLint *)v
5286 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005287
5288exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005289 if (_array) {
5290 releasePointer(_env, _array, v, JNI_FALSE);
5291 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005292 if (_exception) {
5293 jniThrowException(_env, _exceptionType, _exceptionMessage);
5294 }
Jack Palevich560814f2009-11-19 16:34:55 +08005295}
5296
5297/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5298static void
5299android_glUniformMatrix2fv__IIZ_3FI
5300 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005301 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005302 const char * _exceptionType = NULL;
5303 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005304 GLfloat *value_base = (GLfloat *) 0;
5305 jint _remaining;
5306 GLfloat *value = (GLfloat *) 0;
5307
5308 if (!value_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005309 _exception = 1;
5310 _exceptionType = "java/lang/IllegalArgumentException";
5311 _exceptionMessage = "value == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005312 goto exit;
5313 }
5314 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005315 _exception = 1;
5316 _exceptionType = "java/lang/IllegalArgumentException";
5317 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005318 goto exit;
5319 }
5320 _remaining = _env->GetArrayLength(value_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005321 if (_remaining < count*4) {
5322 _exception = 1;
5323 _exceptionType = "java/lang/IllegalArgumentException";
5324 _exceptionMessage = "length - offset < count*4 < needed";
5325 goto exit;
5326 }
Jack Palevich560814f2009-11-19 16:34:55 +08005327 value_base = (GLfloat *)
5328 _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
5329 value = value_base + offset;
5330
5331 glUniformMatrix2fv(
5332 (GLint)location,
5333 (GLsizei)count,
5334 (GLboolean)transpose,
5335 (GLfloat *)value
5336 );
5337
5338exit:
5339 if (value_base) {
5340 _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
5341 JNI_ABORT);
5342 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005343 if (_exception) {
5344 jniThrowException(_env, _exceptionType, _exceptionMessage);
5345 }
Jack Palevich560814f2009-11-19 16:34:55 +08005346}
5347
5348/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5349static void
5350android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2
5351 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005352 jint _exception = 0;
5353 const char * _exceptionType = NULL;
5354 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005355 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005356 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005357 jint _remaining;
5358 GLfloat *value = (GLfloat *) 0;
5359
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005360 value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005361 if (_remaining < count*4) {
5362 _exception = 1;
5363 _exceptionType = "java/lang/IllegalArgumentException";
5364 _exceptionMessage = "remaining() < count*4 < needed";
5365 goto exit;
5366 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005367 if (value == NULL) {
5368 char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5369 value = (GLfloat *) (_valueBase + _bufferOffset);
5370 }
Jack Palevich560814f2009-11-19 16:34:55 +08005371 glUniformMatrix2fv(
5372 (GLint)location,
5373 (GLsizei)count,
5374 (GLboolean)transpose,
5375 (GLfloat *)value
5376 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005377
5378exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005379 if (_array) {
5380 releasePointer(_env, _array, value, JNI_FALSE);
5381 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005382 if (_exception) {
5383 jniThrowException(_env, _exceptionType, _exceptionMessage);
5384 }
Jack Palevich560814f2009-11-19 16:34:55 +08005385}
5386
5387/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5388static void
5389android_glUniformMatrix3fv__IIZ_3FI
5390 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005391 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005392 const char * _exceptionType = NULL;
5393 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005394 GLfloat *value_base = (GLfloat *) 0;
5395 jint _remaining;
5396 GLfloat *value = (GLfloat *) 0;
5397
5398 if (!value_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005399 _exception = 1;
5400 _exceptionType = "java/lang/IllegalArgumentException";
5401 _exceptionMessage = "value == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005402 goto exit;
5403 }
5404 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005405 _exception = 1;
5406 _exceptionType = "java/lang/IllegalArgumentException";
5407 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005408 goto exit;
5409 }
5410 _remaining = _env->GetArrayLength(value_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005411 if (_remaining < count*9) {
5412 _exception = 1;
5413 _exceptionType = "java/lang/IllegalArgumentException";
5414 _exceptionMessage = "length - offset < count*9 < needed";
5415 goto exit;
5416 }
Jack Palevich560814f2009-11-19 16:34:55 +08005417 value_base = (GLfloat *)
5418 _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
5419 value = value_base + offset;
5420
5421 glUniformMatrix3fv(
5422 (GLint)location,
5423 (GLsizei)count,
5424 (GLboolean)transpose,
5425 (GLfloat *)value
5426 );
5427
5428exit:
5429 if (value_base) {
5430 _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
5431 JNI_ABORT);
5432 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005433 if (_exception) {
5434 jniThrowException(_env, _exceptionType, _exceptionMessage);
5435 }
Jack Palevich560814f2009-11-19 16:34:55 +08005436}
5437
5438/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5439static void
5440android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2
5441 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005442 jint _exception = 0;
5443 const char * _exceptionType = NULL;
5444 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005445 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005446 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005447 jint _remaining;
5448 GLfloat *value = (GLfloat *) 0;
5449
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005450 value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005451 if (_remaining < count*9) {
5452 _exception = 1;
5453 _exceptionType = "java/lang/IllegalArgumentException";
5454 _exceptionMessage = "remaining() < count*9 < needed";
5455 goto exit;
5456 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005457 if (value == NULL) {
5458 char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5459 value = (GLfloat *) (_valueBase + _bufferOffset);
5460 }
Jack Palevich560814f2009-11-19 16:34:55 +08005461 glUniformMatrix3fv(
5462 (GLint)location,
5463 (GLsizei)count,
5464 (GLboolean)transpose,
5465 (GLfloat *)value
5466 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005467
5468exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005469 if (_array) {
5470 releasePointer(_env, _array, value, JNI_FALSE);
5471 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005472 if (_exception) {
5473 jniThrowException(_env, _exceptionType, _exceptionMessage);
5474 }
Jack Palevich560814f2009-11-19 16:34:55 +08005475}
5476
5477/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5478static void
5479android_glUniformMatrix4fv__IIZ_3FI
5480 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005481 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005482 const char * _exceptionType = NULL;
5483 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005484 GLfloat *value_base = (GLfloat *) 0;
5485 jint _remaining;
5486 GLfloat *value = (GLfloat *) 0;
5487
5488 if (!value_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005489 _exception = 1;
5490 _exceptionType = "java/lang/IllegalArgumentException";
5491 _exceptionMessage = "value == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005492 goto exit;
5493 }
5494 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005495 _exception = 1;
5496 _exceptionType = "java/lang/IllegalArgumentException";
5497 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005498 goto exit;
5499 }
5500 _remaining = _env->GetArrayLength(value_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005501 if (_remaining < count*16) {
5502 _exception = 1;
5503 _exceptionType = "java/lang/IllegalArgumentException";
5504 _exceptionMessage = "length - offset < count*16 < needed";
5505 goto exit;
5506 }
Jack Palevich560814f2009-11-19 16:34:55 +08005507 value_base = (GLfloat *)
5508 _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
5509 value = value_base + offset;
5510
5511 glUniformMatrix4fv(
5512 (GLint)location,
5513 (GLsizei)count,
5514 (GLboolean)transpose,
5515 (GLfloat *)value
5516 );
5517
5518exit:
5519 if (value_base) {
5520 _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
5521 JNI_ABORT);
5522 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005523 if (_exception) {
5524 jniThrowException(_env, _exceptionType, _exceptionMessage);
5525 }
Jack Palevich560814f2009-11-19 16:34:55 +08005526}
5527
5528/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5529static void
5530android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2
5531 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005532 jint _exception = 0;
5533 const char * _exceptionType = NULL;
5534 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005535 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005536 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005537 jint _remaining;
5538 GLfloat *value = (GLfloat *) 0;
5539
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005540 value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005541 if (_remaining < count*16) {
5542 _exception = 1;
5543 _exceptionType = "java/lang/IllegalArgumentException";
5544 _exceptionMessage = "remaining() < count*16 < needed";
5545 goto exit;
5546 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005547 if (value == NULL) {
5548 char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5549 value = (GLfloat *) (_valueBase + _bufferOffset);
5550 }
Jack Palevich560814f2009-11-19 16:34:55 +08005551 glUniformMatrix4fv(
5552 (GLint)location,
5553 (GLsizei)count,
5554 (GLboolean)transpose,
5555 (GLfloat *)value
5556 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005557
5558exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005559 if (_array) {
5560 releasePointer(_env, _array, value, JNI_FALSE);
5561 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005562 if (_exception) {
5563 jniThrowException(_env, _exceptionType, _exceptionMessage);
5564 }
Jack Palevich560814f2009-11-19 16:34:55 +08005565}
5566
5567/* void glUseProgram ( GLuint program ) */
5568static void
5569android_glUseProgram__I
5570 (JNIEnv *_env, jobject _this, jint program) {
5571 glUseProgram(
5572 (GLuint)program
5573 );
5574}
5575
5576/* void glValidateProgram ( GLuint program ) */
5577static void
5578android_glValidateProgram__I
5579 (JNIEnv *_env, jobject _this, jint program) {
5580 glValidateProgram(
5581 (GLuint)program
5582 );
5583}
5584
5585/* void glVertexAttrib1f ( GLuint indx, GLfloat x ) */
5586static void
5587android_glVertexAttrib1f__IF
5588 (JNIEnv *_env, jobject _this, jint indx, jfloat x) {
5589 glVertexAttrib1f(
5590 (GLuint)indx,
5591 (GLfloat)x
5592 );
5593}
5594
5595/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
5596static void
5597android_glVertexAttrib1fv__I_3FI
5598 (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005599 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005600 const char * _exceptionType = NULL;
5601 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005602 GLfloat *values_base = (GLfloat *) 0;
5603 jint _remaining;
5604 GLfloat *values = (GLfloat *) 0;
5605
5606 if (!values_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005607 _exception = 1;
5608 _exceptionType = "java/lang/IllegalArgumentException";
5609 _exceptionMessage = "values == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005610 goto exit;
5611 }
5612 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005613 _exception = 1;
5614 _exceptionType = "java/lang/IllegalArgumentException";
5615 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005616 goto exit;
5617 }
5618 _remaining = _env->GetArrayLength(values_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005619 if (_remaining < 1) {
5620 _exception = 1;
5621 _exceptionType = "java/lang/IllegalArgumentException";
5622 _exceptionMessage = "length - offset < 1 < needed";
5623 goto exit;
5624 }
Jack Palevich560814f2009-11-19 16:34:55 +08005625 values_base = (GLfloat *)
5626 _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
5627 values = values_base + offset;
5628
5629 glVertexAttrib1fv(
5630 (GLuint)indx,
5631 (GLfloat *)values
5632 );
5633
5634exit:
5635 if (values_base) {
5636 _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
5637 JNI_ABORT);
5638 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005639 if (_exception) {
5640 jniThrowException(_env, _exceptionType, _exceptionMessage);
5641 }
Jack Palevich560814f2009-11-19 16:34:55 +08005642}
5643
5644/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
5645static void
5646android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2
5647 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005648 jint _exception = 0;
5649 const char * _exceptionType = NULL;
5650 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005651 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005652 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005653 jint _remaining;
5654 GLfloat *values = (GLfloat *) 0;
5655
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005656 values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005657 if (_remaining < 1) {
5658 _exception = 1;
5659 _exceptionType = "java/lang/IllegalArgumentException";
5660 _exceptionMessage = "remaining() < 1 < needed";
5661 goto exit;
5662 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005663 if (values == NULL) {
5664 char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5665 values = (GLfloat *) (_valuesBase + _bufferOffset);
5666 }
Jack Palevich560814f2009-11-19 16:34:55 +08005667 glVertexAttrib1fv(
5668 (GLuint)indx,
5669 (GLfloat *)values
5670 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005671
5672exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005673 if (_array) {
5674 releasePointer(_env, _array, values, JNI_FALSE);
5675 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005676 if (_exception) {
5677 jniThrowException(_env, _exceptionType, _exceptionMessage);
5678 }
Jack Palevich560814f2009-11-19 16:34:55 +08005679}
5680
5681/* void glVertexAttrib2f ( GLuint indx, GLfloat x, GLfloat y ) */
5682static void
5683android_glVertexAttrib2f__IFF
5684 (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y) {
5685 glVertexAttrib2f(
5686 (GLuint)indx,
5687 (GLfloat)x,
5688 (GLfloat)y
5689 );
5690}
5691
5692/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
5693static void
5694android_glVertexAttrib2fv__I_3FI
5695 (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005696 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005697 const char * _exceptionType = NULL;
5698 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005699 GLfloat *values_base = (GLfloat *) 0;
5700 jint _remaining;
5701 GLfloat *values = (GLfloat *) 0;
5702
5703 if (!values_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005704 _exception = 1;
5705 _exceptionType = "java/lang/IllegalArgumentException";
5706 _exceptionMessage = "values == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005707 goto exit;
5708 }
5709 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005710 _exception = 1;
5711 _exceptionType = "java/lang/IllegalArgumentException";
5712 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005713 goto exit;
5714 }
5715 _remaining = _env->GetArrayLength(values_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005716 if (_remaining < 2) {
5717 _exception = 1;
5718 _exceptionType = "java/lang/IllegalArgumentException";
5719 _exceptionMessage = "length - offset < 2 < needed";
5720 goto exit;
5721 }
Jack Palevich560814f2009-11-19 16:34:55 +08005722 values_base = (GLfloat *)
5723 _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
5724 values = values_base + offset;
5725
5726 glVertexAttrib2fv(
5727 (GLuint)indx,
5728 (GLfloat *)values
5729 );
5730
5731exit:
5732 if (values_base) {
5733 _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
5734 JNI_ABORT);
5735 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005736 if (_exception) {
5737 jniThrowException(_env, _exceptionType, _exceptionMessage);
5738 }
Jack Palevich560814f2009-11-19 16:34:55 +08005739}
5740
5741/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
5742static void
5743android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2
5744 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005745 jint _exception = 0;
5746 const char * _exceptionType = NULL;
5747 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005748 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005749 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005750 jint _remaining;
5751 GLfloat *values = (GLfloat *) 0;
5752
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005753 values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005754 if (_remaining < 2) {
5755 _exception = 1;
5756 _exceptionType = "java/lang/IllegalArgumentException";
5757 _exceptionMessage = "remaining() < 2 < needed";
5758 goto exit;
5759 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005760 if (values == NULL) {
5761 char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5762 values = (GLfloat *) (_valuesBase + _bufferOffset);
5763 }
Jack Palevich560814f2009-11-19 16:34:55 +08005764 glVertexAttrib2fv(
5765 (GLuint)indx,
5766 (GLfloat *)values
5767 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005768
5769exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005770 if (_array) {
5771 releasePointer(_env, _array, values, JNI_FALSE);
5772 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005773 if (_exception) {
5774 jniThrowException(_env, _exceptionType, _exceptionMessage);
5775 }
Jack Palevich560814f2009-11-19 16:34:55 +08005776}
5777
5778/* void glVertexAttrib3f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z ) */
5779static void
5780android_glVertexAttrib3f__IFFF
5781 (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z) {
5782 glVertexAttrib3f(
5783 (GLuint)indx,
5784 (GLfloat)x,
5785 (GLfloat)y,
5786 (GLfloat)z
5787 );
5788}
5789
5790/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
5791static void
5792android_glVertexAttrib3fv__I_3FI
5793 (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005794 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005795 const char * _exceptionType = NULL;
5796 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005797 GLfloat *values_base = (GLfloat *) 0;
5798 jint _remaining;
5799 GLfloat *values = (GLfloat *) 0;
5800
5801 if (!values_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005802 _exception = 1;
5803 _exceptionType = "java/lang/IllegalArgumentException";
5804 _exceptionMessage = "values == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005805 goto exit;
5806 }
5807 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005808 _exception = 1;
5809 _exceptionType = "java/lang/IllegalArgumentException";
5810 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005811 goto exit;
5812 }
5813 _remaining = _env->GetArrayLength(values_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005814 if (_remaining < 3) {
5815 _exception = 1;
5816 _exceptionType = "java/lang/IllegalArgumentException";
5817 _exceptionMessage = "length - offset < 3 < needed";
5818 goto exit;
5819 }
Jack Palevich560814f2009-11-19 16:34:55 +08005820 values_base = (GLfloat *)
5821 _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
5822 values = values_base + offset;
5823
5824 glVertexAttrib3fv(
5825 (GLuint)indx,
5826 (GLfloat *)values
5827 );
5828
5829exit:
5830 if (values_base) {
5831 _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
5832 JNI_ABORT);
5833 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005834 if (_exception) {
5835 jniThrowException(_env, _exceptionType, _exceptionMessage);
5836 }
Jack Palevich560814f2009-11-19 16:34:55 +08005837}
5838
5839/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
5840static void
5841android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2
5842 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005843 jint _exception = 0;
5844 const char * _exceptionType = NULL;
5845 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005846 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005847 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005848 jint _remaining;
5849 GLfloat *values = (GLfloat *) 0;
5850
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005851 values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005852 if (_remaining < 3) {
5853 _exception = 1;
5854 _exceptionType = "java/lang/IllegalArgumentException";
5855 _exceptionMessage = "remaining() < 3 < needed";
5856 goto exit;
5857 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005858 if (values == NULL) {
5859 char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5860 values = (GLfloat *) (_valuesBase + _bufferOffset);
5861 }
Jack Palevich560814f2009-11-19 16:34:55 +08005862 glVertexAttrib3fv(
5863 (GLuint)indx,
5864 (GLfloat *)values
5865 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005866
5867exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005868 if (_array) {
5869 releasePointer(_env, _array, values, JNI_FALSE);
5870 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005871 if (_exception) {
5872 jniThrowException(_env, _exceptionType, _exceptionMessage);
5873 }
Jack Palevich560814f2009-11-19 16:34:55 +08005874}
5875
5876/* void glVertexAttrib4f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
5877static void
5878android_glVertexAttrib4f__IFFFF
5879 (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z, jfloat w) {
5880 glVertexAttrib4f(
5881 (GLuint)indx,
5882 (GLfloat)x,
5883 (GLfloat)y,
5884 (GLfloat)z,
5885 (GLfloat)w
5886 );
5887}
5888
5889/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
5890static void
5891android_glVertexAttrib4fv__I_3FI
5892 (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005893 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005894 const char * _exceptionType = NULL;
5895 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005896 GLfloat *values_base = (GLfloat *) 0;
5897 jint _remaining;
5898 GLfloat *values = (GLfloat *) 0;
5899
5900 if (!values_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005901 _exception = 1;
5902 _exceptionType = "java/lang/IllegalArgumentException";
5903 _exceptionMessage = "values == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005904 goto exit;
5905 }
5906 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005907 _exception = 1;
5908 _exceptionType = "java/lang/IllegalArgumentException";
5909 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005910 goto exit;
5911 }
5912 _remaining = _env->GetArrayLength(values_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005913 if (_remaining < 4) {
5914 _exception = 1;
5915 _exceptionType = "java/lang/IllegalArgumentException";
5916 _exceptionMessage = "length - offset < 4 < needed";
5917 goto exit;
5918 }
Jack Palevich560814f2009-11-19 16:34:55 +08005919 values_base = (GLfloat *)
5920 _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
5921 values = values_base + offset;
5922
5923 glVertexAttrib4fv(
5924 (GLuint)indx,
5925 (GLfloat *)values
5926 );
5927
5928exit:
5929 if (values_base) {
5930 _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
5931 JNI_ABORT);
5932 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005933 if (_exception) {
5934 jniThrowException(_env, _exceptionType, _exceptionMessage);
5935 }
Jack Palevich560814f2009-11-19 16:34:55 +08005936}
5937
5938/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
5939static void
5940android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2
5941 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005942 jint _exception = 0;
5943 const char * _exceptionType = NULL;
5944 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005945 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005946 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005947 jint _remaining;
5948 GLfloat *values = (GLfloat *) 0;
5949
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005950 values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005951 if (_remaining < 4) {
5952 _exception = 1;
5953 _exceptionType = "java/lang/IllegalArgumentException";
5954 _exceptionMessage = "remaining() < 4 < needed";
5955 goto exit;
5956 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005957 if (values == NULL) {
5958 char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
5959 values = (GLfloat *) (_valuesBase + _bufferOffset);
5960 }
Jack Palevich560814f2009-11-19 16:34:55 +08005961 glVertexAttrib4fv(
5962 (GLuint)indx,
5963 (GLfloat *)values
5964 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005965
5966exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005967 if (_array) {
5968 releasePointer(_env, _array, values, JNI_FALSE);
5969 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005970 if (_exception) {
5971 jniThrowException(_env, _exceptionType, _exceptionMessage);
5972 }
Jack Palevich560814f2009-11-19 16:34:55 +08005973}
5974
Jack Palevich224107a2010-06-22 20:08:40 +08005975/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint offset ) */
5976static void
5977android_glVertexAttribPointer__IIIZII
5978 (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jint offset) {
5979 glVertexAttribPointer(
5980 (GLuint)indx,
5981 (GLint)size,
5982 (GLenum)type,
5983 (GLboolean)normalized,
5984 (GLsizei)stride,
Andy McFaddencee51982013-04-25 16:08:31 -07005985 (GLvoid *)offset
Jack Palevich224107a2010-06-22 20:08:40 +08005986 );
5987}
5988
Jack Palevich560814f2009-11-19 16:34:55 +08005989/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr ) */
5990static void
5991android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I
5992 (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jobject ptr_buf, jint remaining) {
5993 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005994 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005995 jint _remaining;
5996 GLvoid *ptr = (GLvoid *) 0;
5997
5998 if (ptr_buf) {
5999 ptr = (GLvoid *) getDirectBufferPointer(_env, ptr_buf);
6000 if ( ! ptr ) {
6001 return;
6002 }
6003 }
6004 glVertexAttribPointerBounds(
6005 (GLuint)indx,
6006 (GLint)size,
6007 (GLenum)type,
6008 (GLboolean)normalized,
6009 (GLsizei)stride,
6010 (GLvoid *)ptr,
6011 (GLsizei)remaining
6012 );
6013}
6014
6015/* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */
6016static void
6017android_glViewport__IIII
6018 (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
6019 glViewport(
6020 (GLint)x,
6021 (GLint)y,
6022 (GLsizei)width,
6023 (GLsizei)height
6024 );
6025}
6026
6027static const char *classPathName = "android/opengl/GLES20";
6028
6029static JNINativeMethod methods[] = {
6030{"_nativeClassInit", "()V", (void*)nativeClassInit },
6031{"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I },
6032{"glAttachShader", "(II)V", (void *) android_glAttachShader__II },
6033{"glBindAttribLocation", "(IILjava/lang/String;)V", (void *) android_glBindAttribLocation__IILjava_lang_String_2 },
6034{"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II },
6035{"glBindFramebuffer", "(II)V", (void *) android_glBindFramebuffer__II },
6036{"glBindRenderbuffer", "(II)V", (void *) android_glBindRenderbuffer__II },
6037{"glBindTexture", "(II)V", (void *) android_glBindTexture__II },
6038{"glBlendColor", "(FFFF)V", (void *) android_glBlendColor__FFFF },
6039{"glBlendEquation", "(I)V", (void *) android_glBlendEquation__I },
6040{"glBlendEquationSeparate", "(II)V", (void *) android_glBlendEquationSeparate__II },
6041{"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II },
6042{"glBlendFuncSeparate", "(IIII)V", (void *) android_glBlendFuncSeparate__IIII },
6043{"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I },
6044{"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 },
6045{"glCheckFramebufferStatus", "(I)I", (void *) android_glCheckFramebufferStatus__I },
6046{"glClear", "(I)V", (void *) android_glClear__I },
6047{"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF },
6048{"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F },
6049{"glClearStencil", "(I)V", (void *) android_glClearStencil__I },
6050{"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ },
6051{"glCompileShader", "(I)V", (void *) android_glCompileShader__I },
6052{"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 },
6053{"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
6054{"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII },
6055{"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII },
6056{"glCreateProgram", "()I", (void *) android_glCreateProgram__ },
6057{"glCreateShader", "(I)I", (void *) android_glCreateShader__I },
6058{"glCullFace", "(I)V", (void *) android_glCullFace__I },
6059{"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II },
6060{"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 },
6061{"glDeleteFramebuffers", "(I[II)V", (void *) android_glDeleteFramebuffers__I_3II },
6062{"glDeleteFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2 },
6063{"glDeleteProgram", "(I)V", (void *) android_glDeleteProgram__I },
6064{"glDeleteRenderbuffers", "(I[II)V", (void *) android_glDeleteRenderbuffers__I_3II },
6065{"glDeleteRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2 },
6066{"glDeleteShader", "(I)V", (void *) android_glDeleteShader__I },
6067{"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II },
6068{"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 },
6069{"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I },
6070{"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z },
6071{"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF },
6072{"glDetachShader", "(II)V", (void *) android_glDetachShader__II },
6073{"glDisable", "(I)V", (void *) android_glDisable__I },
6074{"glDisableVertexAttribArray", "(I)V", (void *) android_glDisableVertexAttribArray__I },
6075{"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III },
Jack Palevich224107a2010-06-22 20:08:40 +08006076{"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII },
Jack Palevich560814f2009-11-19 16:34:55 +08006077{"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 },
6078{"glEnable", "(I)V", (void *) android_glEnable__I },
6079{"glEnableVertexAttribArray", "(I)V", (void *) android_glEnableVertexAttribArray__I },
6080{"glFinish", "()V", (void *) android_glFinish__ },
6081{"glFlush", "()V", (void *) android_glFlush__ },
6082{"glFramebufferRenderbuffer", "(IIII)V", (void *) android_glFramebufferRenderbuffer__IIII },
6083{"glFramebufferTexture2D", "(IIIII)V", (void *) android_glFramebufferTexture2D__IIIII },
6084{"glFrontFace", "(I)V", (void *) android_glFrontFace__I },
6085{"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II },
6086{"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 },
6087{"glGenerateMipmap", "(I)V", (void *) android_glGenerateMipmap__I },
6088{"glGenFramebuffers", "(I[II)V", (void *) android_glGenFramebuffers__I_3II },
6089{"glGenFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenFramebuffers__ILjava_nio_IntBuffer_2 },
6090{"glGenRenderbuffers", "(I[II)V", (void *) android_glGenRenderbuffers__I_3II },
6091{"glGenRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenRenderbuffers__ILjava_nio_IntBuffer_2 },
6092{"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II },
6093{"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 },
6094{"glGetActiveAttrib", "(III[II[II[II[BI)V", (void *) android_glGetActiveAttrib__III_3II_3II_3II_3BI },
6095{"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 -07006096{"glGetActiveAttrib", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveAttrib1 },
6097{"glGetActiveAttrib", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveAttrib2 },
Jack Palevich560814f2009-11-19 16:34:55 +08006098{"glGetActiveUniform", "(III[II[II[II[BI)V", (void *) android_glGetActiveUniform__III_3II_3II_3II_3BI },
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07006099{"glGetActiveUniform", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveUniform1 },
Jack Palevich560814f2009-11-19 16:34:55 +08006100{"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 -07006101{"glGetActiveUniform", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveUniform2 },
Jack Palevich560814f2009-11-19 16:34:55 +08006102{"glGetAttachedShaders", "(II[II[II)V", (void *) android_glGetAttachedShaders__II_3II_3II },
6103{"glGetAttachedShaders", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
6104{"glGetAttribLocation", "(ILjava/lang/String;)I", (void *) android_glGetAttribLocation__ILjava_lang_String_2 },
6105{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI },
6106{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 },
6107{"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II },
6108{"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 },
6109{"glGetError", "()I", (void *) android_glGetError__ },
6110{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI },
6111{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 },
6112{"glGetFramebufferAttachmentParameteriv", "(III[II)V", (void *) android_glGetFramebufferAttachmentParameteriv__III_3II },
6113{"glGetFramebufferAttachmentParameteriv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2 },
6114{"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II },
6115{"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 },
6116{"glGetProgramiv", "(II[II)V", (void *) android_glGetProgramiv__II_3II },
6117{"glGetProgramiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetProgramiv__IILjava_nio_IntBuffer_2 },
6118{"glGetProgramInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetProgramInfoLog },
6119{"glGetRenderbufferParameteriv", "(II[II)V", (void *) android_glGetRenderbufferParameteriv__II_3II },
6120{"glGetRenderbufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2 },
6121{"glGetShaderiv", "(II[II)V", (void *) android_glGetShaderiv__II_3II },
6122{"glGetShaderiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetShaderiv__IILjava_nio_IntBuffer_2 },
6123{"glGetShaderInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetShaderInfoLog },
6124{"glGetShaderPrecisionFormat", "(II[II[II)V", (void *) android_glGetShaderPrecisionFormat__II_3II_3II },
6125{"glGetShaderPrecisionFormat", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
6126{"glGetShaderSource", "(II[II[BI)V", (void *) android_glGetShaderSource__II_3II_3BI },
6127{"glGetShaderSource", "(IILjava/nio/IntBuffer;B)V", (void *) android_glGetShaderSource__IILjava_nio_IntBuffer_2B },
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07006128{"glGetShaderSource", "(I)Ljava/lang/String;", (void *) android_glGetShaderSource },
Jack Palevich560814f2009-11-19 16:34:55 +08006129{"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString },
6130{"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI },
6131{"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 },
6132{"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II },
6133{"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 },
6134{"glGetUniformfv", "(II[FI)V", (void *) android_glGetUniformfv__II_3FI },
6135{"glGetUniformfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetUniformfv__IILjava_nio_FloatBuffer_2 },
6136{"glGetUniformiv", "(II[II)V", (void *) android_glGetUniformiv__II_3II },
6137{"glGetUniformiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetUniformiv__IILjava_nio_IntBuffer_2 },
6138{"glGetUniformLocation", "(ILjava/lang/String;)I", (void *) android_glGetUniformLocation__ILjava_lang_String_2 },
6139{"glGetVertexAttribfv", "(II[FI)V", (void *) android_glGetVertexAttribfv__II_3FI },
6140{"glGetVertexAttribfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2 },
6141{"glGetVertexAttribiv", "(II[II)V", (void *) android_glGetVertexAttribiv__II_3II },
6142{"glGetVertexAttribiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2 },
6143{"glHint", "(II)V", (void *) android_glHint__II },
6144{"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I },
6145{"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I },
6146{"glIsFramebuffer", "(I)Z", (void *) android_glIsFramebuffer__I },
6147{"glIsProgram", "(I)Z", (void *) android_glIsProgram__I },
6148{"glIsRenderbuffer", "(I)Z", (void *) android_glIsRenderbuffer__I },
6149{"glIsShader", "(I)Z", (void *) android_glIsShader__I },
6150{"glIsTexture", "(I)Z", (void *) android_glIsTexture__I },
6151{"glLineWidth", "(F)V", (void *) android_glLineWidth__F },
6152{"glLinkProgram", "(I)V", (void *) android_glLinkProgram__I },
6153{"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II },
6154{"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF },
6155{"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 },
6156{"glReleaseShaderCompiler", "()V", (void *) android_glReleaseShaderCompiler__ },
6157{"glRenderbufferStorage", "(IIII)V", (void *) android_glRenderbufferStorage__IIII },
6158{"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ },
6159{"glScissor", "(IIII)V", (void *) android_glScissor__IIII },
6160{"glShaderBinary", "(I[IIILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__I_3IIILjava_nio_Buffer_2I },
6161{"glShaderBinary", "(ILjava/nio/IntBuffer;ILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I },
6162{"glShaderSource", "(ILjava/lang/String;)V", (void *) android_glShaderSource },
6163{"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III },
6164{"glStencilFuncSeparate", "(IIII)V", (void *) android_glStencilFuncSeparate__IIII },
6165{"glStencilMask", "(I)V", (void *) android_glStencilMask__I },
6166{"glStencilMaskSeparate", "(II)V", (void *) android_glStencilMaskSeparate__II },
6167{"glStencilOp", "(III)V", (void *) android_glStencilOp__III },
6168{"glStencilOpSeparate", "(IIII)V", (void *) android_glStencilOpSeparate__IIII },
6169{"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 },
6170{"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF },
6171{"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI },
6172{"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 },
6173{"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III },
6174{"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II },
6175{"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 },
6176{"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
6177{"glUniform1f", "(IF)V", (void *) android_glUniform1f__IF },
6178{"glUniform1fv", "(II[FI)V", (void *) android_glUniform1fv__II_3FI },
6179{"glUniform1fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform1fv__IILjava_nio_FloatBuffer_2 },
6180{"glUniform1i", "(II)V", (void *) android_glUniform1i__II },
6181{"glUniform1iv", "(II[II)V", (void *) android_glUniform1iv__II_3II },
6182{"glUniform1iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform1iv__IILjava_nio_IntBuffer_2 },
6183{"glUniform2f", "(IFF)V", (void *) android_glUniform2f__IFF },
6184{"glUniform2fv", "(II[FI)V", (void *) android_glUniform2fv__II_3FI },
6185{"glUniform2fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform2fv__IILjava_nio_FloatBuffer_2 },
6186{"glUniform2i", "(III)V", (void *) android_glUniform2i__III },
6187{"glUniform2iv", "(II[II)V", (void *) android_glUniform2iv__II_3II },
6188{"glUniform2iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform2iv__IILjava_nio_IntBuffer_2 },
6189{"glUniform3f", "(IFFF)V", (void *) android_glUniform3f__IFFF },
6190{"glUniform3fv", "(II[FI)V", (void *) android_glUniform3fv__II_3FI },
6191{"glUniform3fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform3fv__IILjava_nio_FloatBuffer_2 },
6192{"glUniform3i", "(IIII)V", (void *) android_glUniform3i__IIII },
6193{"glUniform3iv", "(II[II)V", (void *) android_glUniform3iv__II_3II },
6194{"glUniform3iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform3iv__IILjava_nio_IntBuffer_2 },
6195{"glUniform4f", "(IFFFF)V", (void *) android_glUniform4f__IFFFF },
6196{"glUniform4fv", "(II[FI)V", (void *) android_glUniform4fv__II_3FI },
6197{"glUniform4fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform4fv__IILjava_nio_FloatBuffer_2 },
6198{"glUniform4i", "(IIIII)V", (void *) android_glUniform4i__IIIII },
6199{"glUniform4iv", "(II[II)V", (void *) android_glUniform4iv__II_3II },
6200{"glUniform4iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform4iv__IILjava_nio_IntBuffer_2 },
6201{"glUniformMatrix2fv", "(IIZ[FI)V", (void *) android_glUniformMatrix2fv__IIZ_3FI },
6202{"glUniformMatrix2fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2 },
6203{"glUniformMatrix3fv", "(IIZ[FI)V", (void *) android_glUniformMatrix3fv__IIZ_3FI },
6204{"glUniformMatrix3fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2 },
6205{"glUniformMatrix4fv", "(IIZ[FI)V", (void *) android_glUniformMatrix4fv__IIZ_3FI },
6206{"glUniformMatrix4fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2 },
6207{"glUseProgram", "(I)V", (void *) android_glUseProgram__I },
6208{"glValidateProgram", "(I)V", (void *) android_glValidateProgram__I },
6209{"glVertexAttrib1f", "(IF)V", (void *) android_glVertexAttrib1f__IF },
6210{"glVertexAttrib1fv", "(I[FI)V", (void *) android_glVertexAttrib1fv__I_3FI },
6211{"glVertexAttrib1fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2 },
6212{"glVertexAttrib2f", "(IFF)V", (void *) android_glVertexAttrib2f__IFF },
6213{"glVertexAttrib2fv", "(I[FI)V", (void *) android_glVertexAttrib2fv__I_3FI },
6214{"glVertexAttrib2fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2 },
6215{"glVertexAttrib3f", "(IFFF)V", (void *) android_glVertexAttrib3f__IFFF },
6216{"glVertexAttrib3fv", "(I[FI)V", (void *) android_glVertexAttrib3fv__I_3FI },
6217{"glVertexAttrib3fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2 },
6218{"glVertexAttrib4f", "(IFFFF)V", (void *) android_glVertexAttrib4f__IFFFF },
6219{"glVertexAttrib4fv", "(I[FI)V", (void *) android_glVertexAttrib4fv__I_3FI },
6220{"glVertexAttrib4fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2 },
Jack Palevich224107a2010-06-22 20:08:40 +08006221{"glVertexAttribPointer", "(IIIZII)V", (void *) android_glVertexAttribPointer__IIIZII },
Jack Palevich560814f2009-11-19 16:34:55 +08006222{"glVertexAttribPointerBounds", "(IIIZILjava/nio/Buffer;I)V", (void *) android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I },
6223{"glViewport", "(IIII)V", (void *) android_glViewport__IIII },
6224};
6225
6226int register_android_opengl_jni_GLES20(JNIEnv *_env)
6227{
6228 int err;
6229 err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
6230 return err;
6231}