blob: d038f205149996de22f98afd9c1c6d8b266a3e2f [file] [log] [blame]
Jack Palevich27f80022009-04-15 19:13:17 -07001/*
2**
3** Copyright 2009, The Android Open Source Project
4**
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07005** Licensed under the Apache License, Version 2.0 (the "License");
6** you may not use this file except in compliance with the License.
7** You may obtain a copy of the License at
Jack Palevich27f80022009-04-15 19:13:17 -07008**
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07009** http://www.apache.org/licenses/LICENSE-2.0
Jack Palevich27f80022009-04-15 19:13:17 -070010**
Elliott Hughes24ce5fb2011-04-08 20:01:01 -070011** Unless required by applicable law or agreed to in writing, software
12** distributed under the License is distributed on an "AS IS" BASIS,
13** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14** See the License for the specific language governing permissions and
Jack Palevich27f80022009-04-15 19:13:17 -070015** limitations under the License.
16*/
17
18// This source file is automatically generated
19
Elliott Hughes24ce5fb2011-04-08 20:01:01 -070020#include "jni.h"
21#include "JNIHelp.h"
Jack Palevich27f80022009-04-15 19:13:17 -070022#include <android_runtime/AndroidRuntime.h>
23#include <utils/misc.h>
24
25#include <assert.h>
26#include <GLES/gl.h>
Jack Palevichbe509c92009-05-07 09:52:14 -070027#include <GLES/glext.h>
Jack Palevich27f80022009-04-15 19:13:17 -070028
Jack Palevichbe6eac82009-12-08 15:43:51 +080029/* special calls implemented in Android's GLES wrapper used to more
30 * efficiently bound-check passed arrays */
31extern "C" {
32GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, GLsizei stride,
33 const GLvoid *ptr, GLsizei count);
34}
35
Jack Palevich27f80022009-04-15 19:13:17 -070036static int initialized = 0;
37
38static jclass nioAccessClass;
39static jclass bufferClass;
Jack Palevich27f80022009-04-15 19:13:17 -070040static jmethodID getBasePointerID;
41static jmethodID getBaseArrayID;
42static jmethodID getBaseArrayOffsetID;
43static jfieldID positionID;
44static jfieldID limitID;
45static jfieldID elementSizeShiftID;
46
47/* Cache method IDs each time the class is loaded. */
48
49static void
Elliott Hughes24ce5fb2011-04-08 20:01:01 -070050nativeClassInit(JNIEnv *_env, jclass glImplClass)
Jack Palevich27f80022009-04-15 19:13:17 -070051{
52 jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
53 nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
54
55 jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
56 bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
57
58 getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
59 "getBasePointer", "(Ljava/nio/Buffer;)J");
60 getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
61 "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
62 getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
63 "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
64
65 positionID = _env->GetFieldID(bufferClass, "position", "I");
66 limitID = _env->GetFieldID(bufferClass, "limit", "I");
67 elementSizeShiftID =
68 _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
69}
70
71
Jack Palevich27f80022009-04-15 19:13:17 -070072static void *
73getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
74{
75 jint position;
76 jint limit;
77 jint elementSizeShift;
78 jlong pointer;
79 jint offset;
80 void *data;
81
82 position = _env->GetIntField(buffer, positionID);
83 limit = _env->GetIntField(buffer, limitID);
84 elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
85 *remaining = (limit - position) << elementSizeShift;
86 pointer = _env->CallStaticLongMethod(nioAccessClass,
87 getBasePointerID, buffer);
88 if (pointer != 0L) {
89 *array = NULL;
90 return (void *) (jint) pointer;
91 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -070092
Jack Palevich27f80022009-04-15 19:13:17 -070093 *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
94 getBaseArrayID, buffer);
95 offset = _env->CallStaticIntMethod(nioAccessClass,
96 getBaseArrayOffsetID, buffer);
97 data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0);
Elliott Hughes24ce5fb2011-04-08 20:01:01 -070098
Jack Palevich27f80022009-04-15 19:13:17 -070099 return (void *) ((char *) data + offset);
100}
101
102
103static void
104releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
105{
106 _env->ReleasePrimitiveArrayCritical(array, data,
107 commit ? 0 : JNI_ABORT);
108}
109
Jack Palevichbe6eac82009-12-08 15:43:51 +0800110static void *
111getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
112 char* buf = (char*) _env->GetDirectBufferAddress(buffer);
113 if (buf) {
114 jint position = _env->GetIntField(buffer, positionID);
115 jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
116 buf += position << elementSizeShift;
117 } else {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700118 jniThrowException(_env, "java/lang/IllegalArgumentException",
119 "Must use a native order direct Buffer");
Jack Palevichbe6eac82009-12-08 15:43:51 +0800120 }
121 return (void*) buf;
122}
123
Jack Palevich27f80022009-04-15 19:13:17 -0700124// --------------------------------------------------------------------------
Jack Palevich27f80022009-04-15 19:13:17 -0700125/* void glBindBuffer ( GLenum target, GLuint buffer ) */
126static void
127android_glBindBuffer__II
128 (JNIEnv *_env, jobject _this, jint target, jint buffer) {
129 glBindBuffer(
130 (GLenum)target,
131 (GLuint)buffer
132 );
133}
134
135/* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */
136static void
137android_glBufferData__IILjava_nio_Buffer_2I
138 (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) {
139 jarray _array = (jarray) 0;
140 jint _remaining;
141 GLvoid *data = (GLvoid *) 0;
142
143 if (data_buf) {
144 data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining);
Jack Palevichc620a522009-10-21 11:02:44 -0700145 if (_remaining < size) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700146 jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < size");
Jack Palevichc620a522009-10-21 11:02:44 -0700147 goto exit;
148 }
Jack Palevich27f80022009-04-15 19:13:17 -0700149 }
150 glBufferData(
151 (GLenum)target,
152 (GLsizeiptr)size,
153 (GLvoid *)data,
154 (GLenum)usage
155 );
Jack Palevichc620a522009-10-21 11:02:44 -0700156
157exit:
Jack Palevich27f80022009-04-15 19:13:17 -0700158 if (_array) {
159 releasePointer(_env, _array, data, JNI_FALSE);
160 }
161}
162
163/* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */
164static void
165android_glBufferSubData__IIILjava_nio_Buffer_2
166 (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) {
167 jarray _array = (jarray) 0;
168 jint _remaining;
169 GLvoid *data = (GLvoid *) 0;
170
171 data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining);
Jack Palevichc620a522009-10-21 11:02:44 -0700172 if (_remaining < size) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700173 jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < size");
Jack Palevichc620a522009-10-21 11:02:44 -0700174 goto exit;
175 }
Jack Palevich27f80022009-04-15 19:13:17 -0700176 glBufferSubData(
177 (GLenum)target,
178 (GLintptr)offset,
179 (GLsizeiptr)size,
180 (GLvoid *)data
181 );
Jack Palevichc620a522009-10-21 11:02:44 -0700182
183exit:
Jack Palevich27f80022009-04-15 19:13:17 -0700184 if (_array) {
185 releasePointer(_env, _array, data, JNI_FALSE);
186 }
187}
188
189/* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */
190static void
191android_glClipPlanef__I_3FI
192 (JNIEnv *_env, jobject _this, jint plane, jfloatArray equation_ref, jint offset) {
193 GLfloat *equation_base = (GLfloat *) 0;
194 jint _remaining;
195 GLfloat *equation = (GLfloat *) 0;
196
197 if (!equation_ref) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700198 jniThrowException(_env, "java/lang/IllegalArgumentException", "equation == null");
Jack Palevich27f80022009-04-15 19:13:17 -0700199 goto exit;
200 }
201 if (offset < 0) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700202 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -0700203 goto exit;
204 }
205 _remaining = _env->GetArrayLength(equation_ref) - offset;
206 equation_base = (GLfloat *)
207 _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0);
208 equation = equation_base + offset;
209
210 glClipPlanef(
211 (GLenum)plane,
212 (GLfloat *)equation
213 );
214
215exit:
216 if (equation_base) {
217 _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base,
218 JNI_ABORT);
219 }
220}
221
222/* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */
223static void
224android_glClipPlanef__ILjava_nio_FloatBuffer_2
225 (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
226 jarray _array = (jarray) 0;
227 jint _remaining;
228 GLfloat *equation = (GLfloat *) 0;
229
230 equation = (GLfloat *)getPointer(_env, equation_buf, &_array, &_remaining);
231 glClipPlanef(
232 (GLenum)plane,
233 (GLfloat *)equation
234 );
235 if (_array) {
236 releasePointer(_env, _array, equation, JNI_FALSE);
237 }
238}
239
240/* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */
241static void
242android_glClipPlanex__I_3II
243 (JNIEnv *_env, jobject _this, jint plane, jintArray equation_ref, jint offset) {
244 GLfixed *equation_base = (GLfixed *) 0;
245 jint _remaining;
246 GLfixed *equation = (GLfixed *) 0;
247
248 if (!equation_ref) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700249 jniThrowException(_env, "java/lang/IllegalArgumentException", "equation == null");
Jack Palevich27f80022009-04-15 19:13:17 -0700250 goto exit;
251 }
252 if (offset < 0) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700253 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -0700254 goto exit;
255 }
256 _remaining = _env->GetArrayLength(equation_ref) - offset;
257 equation_base = (GLfixed *)
258 _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0);
259 equation = equation_base + offset;
260
261 glClipPlanex(
262 (GLenum)plane,
263 (GLfixed *)equation
264 );
265
266exit:
267 if (equation_base) {
268 _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base,
269 JNI_ABORT);
270 }
271}
272
273/* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */
274static void
275android_glClipPlanex__ILjava_nio_IntBuffer_2
276 (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
277 jarray _array = (jarray) 0;
278 jint _remaining;
279 GLfixed *equation = (GLfixed *) 0;
280
281 equation = (GLfixed *)getPointer(_env, equation_buf, &_array, &_remaining);
282 glClipPlanex(
283 (GLenum)plane,
284 (GLfixed *)equation
285 );
286 if (_array) {
287 releasePointer(_env, _array, equation, JNI_FALSE);
288 }
289}
290
291/* void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) */
292static void
293android_glColor4ub__BBBB
294 (JNIEnv *_env, jobject _this, jbyte red, jbyte green, jbyte blue, jbyte alpha) {
295 glColor4ub(
296 (GLubyte)red,
297 (GLubyte)green,
298 (GLubyte)blue,
299 (GLubyte)alpha
300 );
301}
302
303/* void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
304static void
305android_glColorPointer__IIII
306 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
307 glColorPointer(
308 (GLint)size,
309 (GLenum)type,
310 (GLsizei)stride,
311 (const GLvoid *)offset
312 );
313}
314
315/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
316static void
317android_glDeleteBuffers__I_3II
318 (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
319 GLuint *buffers_base = (GLuint *) 0;
320 jint _remaining;
321 GLuint *buffers = (GLuint *) 0;
322
323 if (!buffers_ref) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700324 jniThrowException(_env, "java/lang/IllegalArgumentException", "buffers == null");
Jack Palevich27f80022009-04-15 19:13:17 -0700325 goto exit;
326 }
327 if (offset < 0) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700328 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -0700329 goto exit;
330 }
331 _remaining = _env->GetArrayLength(buffers_ref) - offset;
332 if (_remaining < n) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700333 jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n");
Jack Palevich27f80022009-04-15 19:13:17 -0700334 goto exit;
335 }
336 buffers_base = (GLuint *)
337 _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
338 buffers = buffers_base + offset;
339
340 glDeleteBuffers(
341 (GLsizei)n,
342 (GLuint *)buffers
343 );
344
345exit:
346 if (buffers_base) {
347 _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
348 JNI_ABORT);
349 }
350}
351
352/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
353static void
354android_glDeleteBuffers__ILjava_nio_IntBuffer_2
355 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
356 jarray _array = (jarray) 0;
357 jint _remaining;
358 GLuint *buffers = (GLuint *) 0;
359
360 buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining);
361 if (_remaining < n) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700362 jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n");
Jack Palevich27f80022009-04-15 19:13:17 -0700363 goto exit;
364 }
365 glDeleteBuffers(
366 (GLsizei)n,
367 (GLuint *)buffers
368 );
369
370exit:
371 if (_array) {
372 releasePointer(_env, _array, buffers, JNI_FALSE);
373 }
374}
375
376/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */
377static void
378android_glDrawElements__IIII
379 (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) {
380 glDrawElements(
381 (GLenum)mode,
382 (GLsizei)count,
383 (GLenum)type,
384 (const GLvoid *)offset
385 );
386}
387
388/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
389static void
390android_glGenBuffers__I_3II
391 (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
392 jint _exception = 0;
393 GLuint *buffers_base = (GLuint *) 0;
394 jint _remaining;
395 GLuint *buffers = (GLuint *) 0;
396
397 if (!buffers_ref) {
398 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700399 jniThrowException(_env, "java/lang/IllegalArgumentException", "buffers == null");
Jack Palevich27f80022009-04-15 19:13:17 -0700400 goto exit;
401 }
402 if (offset < 0) {
403 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700404 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -0700405 goto exit;
406 }
407 _remaining = _env->GetArrayLength(buffers_ref) - offset;
408 if (_remaining < n) {
409 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700410 jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n");
Jack Palevich27f80022009-04-15 19:13:17 -0700411 goto exit;
412 }
413 buffers_base = (GLuint *)
414 _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
415 buffers = buffers_base + offset;
416
417 glGenBuffers(
418 (GLsizei)n,
419 (GLuint *)buffers
420 );
421
422exit:
423 if (buffers_base) {
424 _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
425 _exception ? JNI_ABORT: 0);
426 }
427}
428
429/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
430static void
431android_glGenBuffers__ILjava_nio_IntBuffer_2
432 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
433 jint _exception = 0;
434 jarray _array = (jarray) 0;
435 jint _remaining;
436 GLuint *buffers = (GLuint *) 0;
437
438 buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining);
439 if (_remaining < n) {
440 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700441 jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n");
Jack Palevich27f80022009-04-15 19:13:17 -0700442 goto exit;
443 }
444 glGenBuffers(
445 (GLsizei)n,
446 (GLuint *)buffers
447 );
448
449exit:
450 if (_array) {
451 releasePointer(_env, _array, buffers, _exception ? JNI_FALSE : JNI_TRUE);
452 }
453}
454
455/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
456static void
457android_glGetBooleanv__I_3ZI
458 (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
459 jint _exception = 0;
460 GLboolean *params_base = (GLboolean *) 0;
461 jint _remaining;
462 GLboolean *params = (GLboolean *) 0;
463
464 if (!params_ref) {
465 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700466 jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null");
Jack Palevich27f80022009-04-15 19:13:17 -0700467 goto exit;
468 }
469 if (offset < 0) {
470 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700471 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -0700472 goto exit;
473 }
474 _remaining = _env->GetArrayLength(params_ref) - offset;
475 params_base = (GLboolean *)
476 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
477 params = params_base + offset;
478
479 glGetBooleanv(
480 (GLenum)pname,
481 (GLboolean *)params
482 );
483
484exit:
485 if (params_base) {
486 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
487 _exception ? JNI_ABORT: 0);
488 }
489}
490
491/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
492static void
493android_glGetBooleanv__ILjava_nio_IntBuffer_2
494 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
495 jint _exception = 0;
496 jarray _array = (jarray) 0;
497 jint _remaining;
498 GLboolean *params = (GLboolean *) 0;
499
500 params = (GLboolean *)getPointer(_env, params_buf, &_array, &_remaining);
501 glGetBooleanv(
502 (GLenum)pname,
503 (GLboolean *)params
504 );
505 if (_array) {
506 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
507 }
508}
509
510/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
511static void
512android_glGetBufferParameteriv__II_3II
513 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Jack Palevich73108672011-03-28 14:49:12 -0700514 jint _exception = 0;
515 GLint *params_base = (GLint *) 0;
516 jint _remaining;
517 GLint *params = (GLint *) 0;
518
519 if (!params_ref) {
520 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700521 jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null");
Jack Palevich73108672011-03-28 14:49:12 -0700522 goto exit;
523 }
524 if (offset < 0) {
525 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700526 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich73108672011-03-28 14:49:12 -0700527 goto exit;
528 }
529 _remaining = _env->GetArrayLength(params_ref) - offset;
530 if (_remaining < 1) {
531 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700532 jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1");
Jack Palevich73108672011-03-28 14:49:12 -0700533 goto exit;
534 }
535 params_base = (GLint *)
536 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
537 params = params_base + offset;
538
539 glGetBufferParameteriv(
540 (GLenum)target,
541 (GLenum)pname,
542 (GLint *)params
543 );
544
545exit:
546 if (params_base) {
547 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
548 _exception ? JNI_ABORT: 0);
549 }
Jack Palevich27f80022009-04-15 19:13:17 -0700550}
551
552/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
553static void
554android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
555 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Jack Palevich73108672011-03-28 14:49:12 -0700556 jint _exception = 0;
557 jarray _array = (jarray) 0;
558 jint _remaining;
559 GLint *params = (GLint *) 0;
560
561 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
562 if (_remaining < 1) {
563 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700564 jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1");
Jack Palevich73108672011-03-28 14:49:12 -0700565 goto exit;
566 }
567 glGetBufferParameteriv(
568 (GLenum)target,
569 (GLenum)pname,
570 (GLint *)params
571 );
572
573exit:
574 if (_array) {
575 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
576 }
Jack Palevich27f80022009-04-15 19:13:17 -0700577}
578
579/* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */
580static void
581android_glGetClipPlanef__I_3FI
582 (JNIEnv *_env, jobject _this, jint pname, jfloatArray eqn_ref, jint offset) {
583 jint _exception = 0;
584 GLfloat *eqn_base = (GLfloat *) 0;
585 jint _remaining;
586 GLfloat *eqn = (GLfloat *) 0;
587
588 if (!eqn_ref) {
589 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700590 jniThrowException(_env, "java/lang/IllegalArgumentException", "eqn == null");
Jack Palevich27f80022009-04-15 19:13:17 -0700591 goto exit;
592 }
593 if (offset < 0) {
594 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700595 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -0700596 goto exit;
597 }
598 _remaining = _env->GetArrayLength(eqn_ref) - offset;
599 eqn_base = (GLfloat *)
600 _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0);
601 eqn = eqn_base + offset;
602
603 glGetClipPlanef(
604 (GLenum)pname,
605 (GLfloat *)eqn
606 );
607
608exit:
609 if (eqn_base) {
610 _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base,
611 _exception ? JNI_ABORT: 0);
612 }
613}
614
615/* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */
616static void
617android_glGetClipPlanef__ILjava_nio_FloatBuffer_2
618 (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
619 jint _exception = 0;
620 jarray _array = (jarray) 0;
621 jint _remaining;
622 GLfloat *eqn = (GLfloat *) 0;
623
624 eqn = (GLfloat *)getPointer(_env, eqn_buf, &_array, &_remaining);
625 glGetClipPlanef(
626 (GLenum)pname,
627 (GLfloat *)eqn
628 );
629 if (_array) {
630 releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE);
631 }
632}
633
634/* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */
635static void
636android_glGetClipPlanex__I_3II
637 (JNIEnv *_env, jobject _this, jint pname, jintArray eqn_ref, jint offset) {
638 jint _exception = 0;
639 GLfixed *eqn_base = (GLfixed *) 0;
640 jint _remaining;
641 GLfixed *eqn = (GLfixed *) 0;
642
643 if (!eqn_ref) {
644 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700645 jniThrowException(_env, "java/lang/IllegalArgumentException", "eqn == null");
Jack Palevich27f80022009-04-15 19:13:17 -0700646 goto exit;
647 }
648 if (offset < 0) {
649 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700650 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -0700651 goto exit;
652 }
653 _remaining = _env->GetArrayLength(eqn_ref) - offset;
654 eqn_base = (GLfixed *)
655 _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0);
656 eqn = eqn_base + offset;
657
658 glGetClipPlanex(
659 (GLenum)pname,
660 (GLfixed *)eqn
661 );
662
663exit:
664 if (eqn_base) {
665 _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base,
666 _exception ? JNI_ABORT: 0);
667 }
668}
669
670/* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */
671static void
672android_glGetClipPlanex__ILjava_nio_IntBuffer_2
673 (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
674 jint _exception = 0;
675 jarray _array = (jarray) 0;
676 jint _remaining;
677 GLfixed *eqn = (GLfixed *) 0;
678
679 eqn = (GLfixed *)getPointer(_env, eqn_buf, &_array, &_remaining);
680 glGetClipPlanex(
681 (GLenum)pname,
682 (GLfixed *)eqn
683 );
684 if (_array) {
685 releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE);
686 }
687}
688
689/* void glGetFixedv ( GLenum pname, GLfixed *params ) */
690static void
691android_glGetFixedv__I_3II
692 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
693 jint _exception = 0;
694 GLfixed *params_base = (GLfixed *) 0;
695 jint _remaining;
696 GLfixed *params = (GLfixed *) 0;
697
698 if (!params_ref) {
699 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700700 jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null");
Jack Palevich27f80022009-04-15 19:13:17 -0700701 goto exit;
702 }
703 if (offset < 0) {
704 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700705 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -0700706 goto exit;
707 }
708 _remaining = _env->GetArrayLength(params_ref) - offset;
709 params_base = (GLfixed *)
710 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
711 params = params_base + offset;
712
713 glGetFixedv(
714 (GLenum)pname,
715 (GLfixed *)params
716 );
717
718exit:
719 if (params_base) {
720 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
721 _exception ? JNI_ABORT: 0);
722 }
723}
724
725/* void glGetFixedv ( GLenum pname, GLfixed *params ) */
726static void
727android_glGetFixedv__ILjava_nio_IntBuffer_2
728 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
729 jint _exception = 0;
730 jarray _array = (jarray) 0;
731 jint _remaining;
732 GLfixed *params = (GLfixed *) 0;
733
734 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
735 glGetFixedv(
736 (GLenum)pname,
737 (GLfixed *)params
738 );
739 if (_array) {
740 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
741 }
742}
743
744/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
745static void
746android_glGetFloatv__I_3FI
747 (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
748 jint _exception = 0;
749 GLfloat *params_base = (GLfloat *) 0;
750 jint _remaining;
751 GLfloat *params = (GLfloat *) 0;
752
753 if (!params_ref) {
754 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700755 jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null");
Jack Palevich27f80022009-04-15 19:13:17 -0700756 goto exit;
757 }
758 if (offset < 0) {
759 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700760 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -0700761 goto exit;
762 }
763 _remaining = _env->GetArrayLength(params_ref) - offset;
764 params_base = (GLfloat *)
765 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
766 params = params_base + offset;
767
768 glGetFloatv(
769 (GLenum)pname,
770 (GLfloat *)params
771 );
772
773exit:
774 if (params_base) {
775 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
776 _exception ? JNI_ABORT: 0);
777 }
778}
779
780/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
781static void
782android_glGetFloatv__ILjava_nio_FloatBuffer_2
783 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
784 jint _exception = 0;
785 jarray _array = (jarray) 0;
786 jint _remaining;
787 GLfloat *params = (GLfloat *) 0;
788
789 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
790 glGetFloatv(
791 (GLenum)pname,
792 (GLfloat *)params
793 );
794 if (_array) {
795 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
796 }
797}
798
799/* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */
800static void
801android_glGetLightfv__II_3FI
802 (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) {
803 jint _exception = 0;
804 GLfloat *params_base = (GLfloat *) 0;
805 jint _remaining;
806 GLfloat *params = (GLfloat *) 0;
807
808 if (!params_ref) {
809 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700810 jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null");
Jack Palevich27f80022009-04-15 19:13:17 -0700811 goto exit;
812 }
813 if (offset < 0) {
814 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700815 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -0700816 goto exit;
817 }
818 _remaining = _env->GetArrayLength(params_ref) - offset;
819 int _needed;
820 switch (pname) {
821#if defined(GL_SPOT_EXPONENT)
822 case GL_SPOT_EXPONENT:
823#endif // defined(GL_SPOT_EXPONENT)
824#if defined(GL_SPOT_CUTOFF)
825 case GL_SPOT_CUTOFF:
826#endif // defined(GL_SPOT_CUTOFF)
827#if defined(GL_CONSTANT_ATTENUATION)
828 case GL_CONSTANT_ATTENUATION:
829#endif // defined(GL_CONSTANT_ATTENUATION)
830#if defined(GL_LINEAR_ATTENUATION)
831 case GL_LINEAR_ATTENUATION:
832#endif // defined(GL_LINEAR_ATTENUATION)
833#if defined(GL_QUADRATIC_ATTENUATION)
834 case GL_QUADRATIC_ATTENUATION:
835#endif // defined(GL_QUADRATIC_ATTENUATION)
836 _needed = 1;
837 break;
838#if defined(GL_SPOT_DIRECTION)
839 case GL_SPOT_DIRECTION:
840#endif // defined(GL_SPOT_DIRECTION)
841 _needed = 3;
842 break;
843#if defined(GL_AMBIENT)
844 case GL_AMBIENT:
845#endif // defined(GL_AMBIENT)
846#if defined(GL_DIFFUSE)
847 case GL_DIFFUSE:
848#endif // defined(GL_DIFFUSE)
849#if defined(GL_SPECULAR)
850 case GL_SPECULAR:
851#endif // defined(GL_SPECULAR)
852#if defined(GL_EMISSION)
853 case GL_EMISSION:
854#endif // defined(GL_EMISSION)
855 _needed = 4;
856 break;
857 default:
858 _needed = 0;
859 break;
860 }
861 if (_remaining < _needed) {
862 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700863 jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed");
Jack Palevich27f80022009-04-15 19:13:17 -0700864 goto exit;
865 }
866 params_base = (GLfloat *)
867 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
868 params = params_base + offset;
869
870 glGetLightfv(
871 (GLenum)light,
872 (GLenum)pname,
873 (GLfloat *)params
874 );
875
876exit:
877 if (params_base) {
878 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
879 _exception ? JNI_ABORT: 0);
880 }
881}
882
883/* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */
884static void
885android_glGetLightfv__IILjava_nio_FloatBuffer_2
886 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
887 jint _exception = 0;
888 jarray _array = (jarray) 0;
889 jint _remaining;
890 GLfloat *params = (GLfloat *) 0;
891
892 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
893 int _needed;
894 switch (pname) {
895#if defined(GL_SPOT_EXPONENT)
896 case GL_SPOT_EXPONENT:
897#endif // defined(GL_SPOT_EXPONENT)
898#if defined(GL_SPOT_CUTOFF)
899 case GL_SPOT_CUTOFF:
900#endif // defined(GL_SPOT_CUTOFF)
901#if defined(GL_CONSTANT_ATTENUATION)
902 case GL_CONSTANT_ATTENUATION:
903#endif // defined(GL_CONSTANT_ATTENUATION)
904#if defined(GL_LINEAR_ATTENUATION)
905 case GL_LINEAR_ATTENUATION:
906#endif // defined(GL_LINEAR_ATTENUATION)
907#if defined(GL_QUADRATIC_ATTENUATION)
908 case GL_QUADRATIC_ATTENUATION:
909#endif // defined(GL_QUADRATIC_ATTENUATION)
910 _needed = 1;
911 break;
912#if defined(GL_SPOT_DIRECTION)
913 case GL_SPOT_DIRECTION:
914#endif // defined(GL_SPOT_DIRECTION)
915 _needed = 3;
916 break;
917#if defined(GL_AMBIENT)
918 case GL_AMBIENT:
919#endif // defined(GL_AMBIENT)
920#if defined(GL_DIFFUSE)
921 case GL_DIFFUSE:
922#endif // defined(GL_DIFFUSE)
923#if defined(GL_SPECULAR)
924 case GL_SPECULAR:
925#endif // defined(GL_SPECULAR)
926#if defined(GL_EMISSION)
927 case GL_EMISSION:
928#endif // defined(GL_EMISSION)
929 _needed = 4;
930 break;
931 default:
932 _needed = 0;
933 break;
934 }
935 if (_remaining < _needed) {
936 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700937 jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed");
Jack Palevich27f80022009-04-15 19:13:17 -0700938 goto exit;
939 }
940 glGetLightfv(
941 (GLenum)light,
942 (GLenum)pname,
943 (GLfloat *)params
944 );
945
946exit:
947 if (_array) {
948 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
949 }
950}
951
952/* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */
953static void
954android_glGetLightxv__II_3II
955 (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) {
956 jint _exception = 0;
957 GLfixed *params_base = (GLfixed *) 0;
958 jint _remaining;
959 GLfixed *params = (GLfixed *) 0;
960
961 if (!params_ref) {
962 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700963 jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null");
Jack Palevich27f80022009-04-15 19:13:17 -0700964 goto exit;
965 }
966 if (offset < 0) {
967 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700968 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -0700969 goto exit;
970 }
971 _remaining = _env->GetArrayLength(params_ref) - offset;
972 int _needed;
973 switch (pname) {
974#if defined(GL_SPOT_EXPONENT)
975 case GL_SPOT_EXPONENT:
976#endif // defined(GL_SPOT_EXPONENT)
977#if defined(GL_SPOT_CUTOFF)
978 case GL_SPOT_CUTOFF:
979#endif // defined(GL_SPOT_CUTOFF)
980#if defined(GL_CONSTANT_ATTENUATION)
981 case GL_CONSTANT_ATTENUATION:
982#endif // defined(GL_CONSTANT_ATTENUATION)
983#if defined(GL_LINEAR_ATTENUATION)
984 case GL_LINEAR_ATTENUATION:
985#endif // defined(GL_LINEAR_ATTENUATION)
986#if defined(GL_QUADRATIC_ATTENUATION)
987 case GL_QUADRATIC_ATTENUATION:
988#endif // defined(GL_QUADRATIC_ATTENUATION)
989 _needed = 1;
990 break;
991#if defined(GL_SPOT_DIRECTION)
992 case GL_SPOT_DIRECTION:
993#endif // defined(GL_SPOT_DIRECTION)
994 _needed = 3;
995 break;
996#if defined(GL_AMBIENT)
997 case GL_AMBIENT:
998#endif // defined(GL_AMBIENT)
999#if defined(GL_DIFFUSE)
1000 case GL_DIFFUSE:
1001#endif // defined(GL_DIFFUSE)
1002#if defined(GL_SPECULAR)
1003 case GL_SPECULAR:
1004#endif // defined(GL_SPECULAR)
1005#if defined(GL_EMISSION)
1006 case GL_EMISSION:
1007#endif // defined(GL_EMISSION)
1008 _needed = 4;
1009 break;
1010 default:
1011 _needed = 0;
1012 break;
1013 }
1014 if (_remaining < _needed) {
1015 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001016 jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed");
Jack Palevich27f80022009-04-15 19:13:17 -07001017 goto exit;
1018 }
1019 params_base = (GLfixed *)
1020 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1021 params = params_base + offset;
1022
1023 glGetLightxv(
1024 (GLenum)light,
1025 (GLenum)pname,
1026 (GLfixed *)params
1027 );
1028
1029exit:
1030 if (params_base) {
1031 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1032 _exception ? JNI_ABORT: 0);
1033 }
1034}
1035
1036/* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */
1037static void
1038android_glGetLightxv__IILjava_nio_IntBuffer_2
1039 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
1040 jint _exception = 0;
1041 jarray _array = (jarray) 0;
1042 jint _remaining;
1043 GLfixed *params = (GLfixed *) 0;
1044
1045 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
1046 int _needed;
1047 switch (pname) {
1048#if defined(GL_SPOT_EXPONENT)
1049 case GL_SPOT_EXPONENT:
1050#endif // defined(GL_SPOT_EXPONENT)
1051#if defined(GL_SPOT_CUTOFF)
1052 case GL_SPOT_CUTOFF:
1053#endif // defined(GL_SPOT_CUTOFF)
1054#if defined(GL_CONSTANT_ATTENUATION)
1055 case GL_CONSTANT_ATTENUATION:
1056#endif // defined(GL_CONSTANT_ATTENUATION)
1057#if defined(GL_LINEAR_ATTENUATION)
1058 case GL_LINEAR_ATTENUATION:
1059#endif // defined(GL_LINEAR_ATTENUATION)
1060#if defined(GL_QUADRATIC_ATTENUATION)
1061 case GL_QUADRATIC_ATTENUATION:
1062#endif // defined(GL_QUADRATIC_ATTENUATION)
1063 _needed = 1;
1064 break;
1065#if defined(GL_SPOT_DIRECTION)
1066 case GL_SPOT_DIRECTION:
1067#endif // defined(GL_SPOT_DIRECTION)
1068 _needed = 3;
1069 break;
1070#if defined(GL_AMBIENT)
1071 case GL_AMBIENT:
1072#endif // defined(GL_AMBIENT)
1073#if defined(GL_DIFFUSE)
1074 case GL_DIFFUSE:
1075#endif // defined(GL_DIFFUSE)
1076#if defined(GL_SPECULAR)
1077 case GL_SPECULAR:
1078#endif // defined(GL_SPECULAR)
1079#if defined(GL_EMISSION)
1080 case GL_EMISSION:
1081#endif // defined(GL_EMISSION)
1082 _needed = 4;
1083 break;
1084 default:
1085 _needed = 0;
1086 break;
1087 }
1088 if (_remaining < _needed) {
1089 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001090 jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed");
Jack Palevich27f80022009-04-15 19:13:17 -07001091 goto exit;
1092 }
1093 glGetLightxv(
1094 (GLenum)light,
1095 (GLenum)pname,
1096 (GLfixed *)params
1097 );
1098
1099exit:
1100 if (_array) {
1101 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1102 }
1103}
1104
1105/* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */
1106static void
1107android_glGetMaterialfv__II_3FI
1108 (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) {
1109 jint _exception = 0;
1110 GLfloat *params_base = (GLfloat *) 0;
1111 jint _remaining;
1112 GLfloat *params = (GLfloat *) 0;
1113
1114 if (!params_ref) {
1115 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001116 jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null");
Jack Palevich27f80022009-04-15 19:13:17 -07001117 goto exit;
1118 }
1119 if (offset < 0) {
1120 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001121 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -07001122 goto exit;
1123 }
1124 _remaining = _env->GetArrayLength(params_ref) - offset;
1125 int _needed;
1126 switch (pname) {
1127#if defined(GL_SHININESS)
1128 case GL_SHININESS:
1129#endif // defined(GL_SHININESS)
1130 _needed = 1;
1131 break;
1132#if defined(GL_AMBIENT)
1133 case GL_AMBIENT:
1134#endif // defined(GL_AMBIENT)
1135#if defined(GL_DIFFUSE)
1136 case GL_DIFFUSE:
1137#endif // defined(GL_DIFFUSE)
1138#if defined(GL_SPECULAR)
1139 case GL_SPECULAR:
1140#endif // defined(GL_SPECULAR)
1141#if defined(GL_EMISSION)
1142 case GL_EMISSION:
1143#endif // defined(GL_EMISSION)
1144#if defined(GL_AMBIENT_AND_DIFFUSE)
1145 case GL_AMBIENT_AND_DIFFUSE:
1146#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1147 _needed = 4;
1148 break;
1149 default:
1150 _needed = 0;
1151 break;
1152 }
1153 if (_remaining < _needed) {
1154 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001155 jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed");
Jack Palevich27f80022009-04-15 19:13:17 -07001156 goto exit;
1157 }
1158 params_base = (GLfloat *)
1159 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1160 params = params_base + offset;
1161
1162 glGetMaterialfv(
1163 (GLenum)face,
1164 (GLenum)pname,
1165 (GLfloat *)params
1166 );
1167
1168exit:
1169 if (params_base) {
1170 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1171 _exception ? JNI_ABORT: 0);
1172 }
1173}
1174
1175/* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */
1176static void
1177android_glGetMaterialfv__IILjava_nio_FloatBuffer_2
1178 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
1179 jint _exception = 0;
1180 jarray _array = (jarray) 0;
1181 jint _remaining;
1182 GLfloat *params = (GLfloat *) 0;
1183
1184 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
1185 int _needed;
1186 switch (pname) {
1187#if defined(GL_SHININESS)
1188 case GL_SHININESS:
1189#endif // defined(GL_SHININESS)
1190 _needed = 1;
1191 break;
1192#if defined(GL_AMBIENT)
1193 case GL_AMBIENT:
1194#endif // defined(GL_AMBIENT)
1195#if defined(GL_DIFFUSE)
1196 case GL_DIFFUSE:
1197#endif // defined(GL_DIFFUSE)
1198#if defined(GL_SPECULAR)
1199 case GL_SPECULAR:
1200#endif // defined(GL_SPECULAR)
1201#if defined(GL_EMISSION)
1202 case GL_EMISSION:
1203#endif // defined(GL_EMISSION)
1204#if defined(GL_AMBIENT_AND_DIFFUSE)
1205 case GL_AMBIENT_AND_DIFFUSE:
1206#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1207 _needed = 4;
1208 break;
1209 default:
1210 _needed = 0;
1211 break;
1212 }
1213 if (_remaining < _needed) {
1214 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001215 jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed");
Jack Palevich27f80022009-04-15 19:13:17 -07001216 goto exit;
1217 }
1218 glGetMaterialfv(
1219 (GLenum)face,
1220 (GLenum)pname,
1221 (GLfloat *)params
1222 );
1223
1224exit:
1225 if (_array) {
1226 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1227 }
1228}
1229
1230/* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */
1231static void
1232android_glGetMaterialxv__II_3II
1233 (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) {
1234 jint _exception = 0;
1235 GLfixed *params_base = (GLfixed *) 0;
1236 jint _remaining;
1237 GLfixed *params = (GLfixed *) 0;
1238
1239 if (!params_ref) {
1240 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001241 jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null");
Jack Palevich27f80022009-04-15 19:13:17 -07001242 goto exit;
1243 }
1244 if (offset < 0) {
1245 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001246 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -07001247 goto exit;
1248 }
1249 _remaining = _env->GetArrayLength(params_ref) - offset;
1250 int _needed;
1251 switch (pname) {
1252#if defined(GL_SHININESS)
1253 case GL_SHININESS:
1254#endif // defined(GL_SHININESS)
1255 _needed = 1;
1256 break;
1257#if defined(GL_AMBIENT)
1258 case GL_AMBIENT:
1259#endif // defined(GL_AMBIENT)
1260#if defined(GL_DIFFUSE)
1261 case GL_DIFFUSE:
1262#endif // defined(GL_DIFFUSE)
1263#if defined(GL_SPECULAR)
1264 case GL_SPECULAR:
1265#endif // defined(GL_SPECULAR)
1266#if defined(GL_EMISSION)
1267 case GL_EMISSION:
1268#endif // defined(GL_EMISSION)
1269#if defined(GL_AMBIENT_AND_DIFFUSE)
1270 case GL_AMBIENT_AND_DIFFUSE:
1271#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1272 _needed = 4;
1273 break;
1274 default:
1275 _needed = 0;
1276 break;
1277 }
1278 if (_remaining < _needed) {
1279 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001280 jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed");
Jack Palevich27f80022009-04-15 19:13:17 -07001281 goto exit;
1282 }
1283 params_base = (GLfixed *)
1284 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1285 params = params_base + offset;
1286
1287 glGetMaterialxv(
1288 (GLenum)face,
1289 (GLenum)pname,
1290 (GLfixed *)params
1291 );
1292
1293exit:
1294 if (params_base) {
1295 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1296 _exception ? JNI_ABORT: 0);
1297 }
1298}
1299
1300/* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */
1301static void
1302android_glGetMaterialxv__IILjava_nio_IntBuffer_2
1303 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
1304 jint _exception = 0;
1305 jarray _array = (jarray) 0;
1306 jint _remaining;
1307 GLfixed *params = (GLfixed *) 0;
1308
1309 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
1310 int _needed;
1311 switch (pname) {
1312#if defined(GL_SHININESS)
1313 case GL_SHININESS:
1314#endif // defined(GL_SHININESS)
1315 _needed = 1;
1316 break;
1317#if defined(GL_AMBIENT)
1318 case GL_AMBIENT:
1319#endif // defined(GL_AMBIENT)
1320#if defined(GL_DIFFUSE)
1321 case GL_DIFFUSE:
1322#endif // defined(GL_DIFFUSE)
1323#if defined(GL_SPECULAR)
1324 case GL_SPECULAR:
1325#endif // defined(GL_SPECULAR)
1326#if defined(GL_EMISSION)
1327 case GL_EMISSION:
1328#endif // defined(GL_EMISSION)
1329#if defined(GL_AMBIENT_AND_DIFFUSE)
1330 case GL_AMBIENT_AND_DIFFUSE:
1331#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1332 _needed = 4;
1333 break;
1334 default:
1335 _needed = 0;
1336 break;
1337 }
1338 if (_remaining < _needed) {
1339 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001340 jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed");
Jack Palevich27f80022009-04-15 19:13:17 -07001341 goto exit;
1342 }
1343 glGetMaterialxv(
1344 (GLenum)face,
1345 (GLenum)pname,
1346 (GLfixed *)params
1347 );
1348
1349exit:
1350 if (_array) {
1351 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1352 }
1353}
1354
1355/* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */
1356static void
1357android_glGetTexEnvfv__II_3FI
1358 (JNIEnv *_env, jobject _this, jint env, jint pname, jfloatArray params_ref, jint offset) {
1359 jint _exception = 0;
1360 GLfloat *params_base = (GLfloat *) 0;
1361 jint _remaining;
1362 GLfloat *params = (GLfloat *) 0;
1363
1364 if (!params_ref) {
1365 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001366 jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null");
Jack Palevich27f80022009-04-15 19:13:17 -07001367 goto exit;
1368 }
1369 if (offset < 0) {
1370 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001371 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -07001372 goto exit;
1373 }
1374 _remaining = _env->GetArrayLength(params_ref) - offset;
1375 int _needed;
1376 switch (pname) {
1377#if defined(GL_TEXTURE_ENV_MODE)
1378 case GL_TEXTURE_ENV_MODE:
1379#endif // defined(GL_TEXTURE_ENV_MODE)
1380#if defined(GL_COMBINE_RGB)
1381 case GL_COMBINE_RGB:
1382#endif // defined(GL_COMBINE_RGB)
1383#if defined(GL_COMBINE_ALPHA)
1384 case GL_COMBINE_ALPHA:
1385#endif // defined(GL_COMBINE_ALPHA)
1386 _needed = 1;
1387 break;
1388#if defined(GL_TEXTURE_ENV_COLOR)
1389 case GL_TEXTURE_ENV_COLOR:
1390#endif // defined(GL_TEXTURE_ENV_COLOR)
1391 _needed = 4;
1392 break;
1393 default:
1394 _needed = 0;
1395 break;
1396 }
1397 if (_remaining < _needed) {
1398 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001399 jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed");
Jack Palevich27f80022009-04-15 19:13:17 -07001400 goto exit;
1401 }
1402 params_base = (GLfloat *)
1403 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1404 params = params_base + offset;
1405
1406 glGetTexEnvfv(
1407 (GLenum)env,
1408 (GLenum)pname,
1409 (GLfloat *)params
1410 );
1411
1412exit:
1413 if (params_base) {
1414 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1415 _exception ? JNI_ABORT: 0);
1416 }
1417}
1418
1419/* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */
1420static void
1421android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2
1422 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
1423 jint _exception = 0;
1424 jarray _array = (jarray) 0;
1425 jint _remaining;
1426 GLfloat *params = (GLfloat *) 0;
1427
1428 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
1429 int _needed;
1430 switch (pname) {
1431#if defined(GL_TEXTURE_ENV_MODE)
1432 case GL_TEXTURE_ENV_MODE:
1433#endif // defined(GL_TEXTURE_ENV_MODE)
1434#if defined(GL_COMBINE_RGB)
1435 case GL_COMBINE_RGB:
1436#endif // defined(GL_COMBINE_RGB)
1437#if defined(GL_COMBINE_ALPHA)
1438 case GL_COMBINE_ALPHA:
1439#endif // defined(GL_COMBINE_ALPHA)
1440 _needed = 1;
1441 break;
1442#if defined(GL_TEXTURE_ENV_COLOR)
1443 case GL_TEXTURE_ENV_COLOR:
1444#endif // defined(GL_TEXTURE_ENV_COLOR)
1445 _needed = 4;
1446 break;
1447 default:
1448 _needed = 0;
1449 break;
1450 }
1451 if (_remaining < _needed) {
1452 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001453 jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed");
Jack Palevich27f80022009-04-15 19:13:17 -07001454 goto exit;
1455 }
1456 glGetTexEnvfv(
1457 (GLenum)env,
1458 (GLenum)pname,
1459 (GLfloat *)params
1460 );
1461
1462exit:
1463 if (_array) {
1464 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1465 }
1466}
1467
1468/* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */
1469static void
1470android_glGetTexEnviv__II_3II
1471 (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) {
1472 jint _exception = 0;
1473 GLint *params_base = (GLint *) 0;
1474 jint _remaining;
1475 GLint *params = (GLint *) 0;
1476
1477 if (!params_ref) {
1478 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001479 jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null");
Jack Palevich27f80022009-04-15 19:13:17 -07001480 goto exit;
1481 }
1482 if (offset < 0) {
1483 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001484 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -07001485 goto exit;
1486 }
1487 _remaining = _env->GetArrayLength(params_ref) - offset;
1488 int _needed;
1489 switch (pname) {
1490#if defined(GL_TEXTURE_ENV_MODE)
1491 case GL_TEXTURE_ENV_MODE:
1492#endif // defined(GL_TEXTURE_ENV_MODE)
1493#if defined(GL_COMBINE_RGB)
1494 case GL_COMBINE_RGB:
1495#endif // defined(GL_COMBINE_RGB)
1496#if defined(GL_COMBINE_ALPHA)
1497 case GL_COMBINE_ALPHA:
1498#endif // defined(GL_COMBINE_ALPHA)
1499 _needed = 1;
1500 break;
1501#if defined(GL_TEXTURE_ENV_COLOR)
1502 case GL_TEXTURE_ENV_COLOR:
1503#endif // defined(GL_TEXTURE_ENV_COLOR)
1504 _needed = 4;
1505 break;
1506 default:
1507 _needed = 0;
1508 break;
1509 }
1510 if (_remaining < _needed) {
1511 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001512 jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed");
Jack Palevich27f80022009-04-15 19:13:17 -07001513 goto exit;
1514 }
1515 params_base = (GLint *)
1516 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1517 params = params_base + offset;
1518
1519 glGetTexEnviv(
1520 (GLenum)env,
1521 (GLenum)pname,
1522 (GLint *)params
1523 );
1524
1525exit:
1526 if (params_base) {
1527 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1528 _exception ? JNI_ABORT: 0);
1529 }
1530}
1531
1532/* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */
1533static void
1534android_glGetTexEnviv__IILjava_nio_IntBuffer_2
1535 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
1536 jint _exception = 0;
1537 jarray _array = (jarray) 0;
1538 jint _remaining;
1539 GLint *params = (GLint *) 0;
1540
1541 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
1542 int _needed;
1543 switch (pname) {
1544#if defined(GL_TEXTURE_ENV_MODE)
1545 case GL_TEXTURE_ENV_MODE:
1546#endif // defined(GL_TEXTURE_ENV_MODE)
1547#if defined(GL_COMBINE_RGB)
1548 case GL_COMBINE_RGB:
1549#endif // defined(GL_COMBINE_RGB)
1550#if defined(GL_COMBINE_ALPHA)
1551 case GL_COMBINE_ALPHA:
1552#endif // defined(GL_COMBINE_ALPHA)
1553 _needed = 1;
1554 break;
1555#if defined(GL_TEXTURE_ENV_COLOR)
1556 case GL_TEXTURE_ENV_COLOR:
1557#endif // defined(GL_TEXTURE_ENV_COLOR)
1558 _needed = 4;
1559 break;
1560 default:
1561 _needed = 0;
1562 break;
1563 }
1564 if (_remaining < _needed) {
1565 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001566 jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed");
Jack Palevich27f80022009-04-15 19:13:17 -07001567 goto exit;
1568 }
1569 glGetTexEnviv(
1570 (GLenum)env,
1571 (GLenum)pname,
1572 (GLint *)params
1573 );
1574
1575exit:
1576 if (_array) {
1577 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1578 }
1579}
1580
1581/* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */
1582static void
1583android_glGetTexEnvxv__II_3II
1584 (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) {
1585 jint _exception = 0;
1586 GLfixed *params_base = (GLfixed *) 0;
1587 jint _remaining;
1588 GLfixed *params = (GLfixed *) 0;
1589
1590 if (!params_ref) {
1591 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001592 jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null");
Jack Palevich27f80022009-04-15 19:13:17 -07001593 goto exit;
1594 }
1595 if (offset < 0) {
1596 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001597 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -07001598 goto exit;
1599 }
1600 _remaining = _env->GetArrayLength(params_ref) - offset;
1601 int _needed;
1602 switch (pname) {
1603#if defined(GL_TEXTURE_ENV_MODE)
1604 case GL_TEXTURE_ENV_MODE:
1605#endif // defined(GL_TEXTURE_ENV_MODE)
1606#if defined(GL_COMBINE_RGB)
1607 case GL_COMBINE_RGB:
1608#endif // defined(GL_COMBINE_RGB)
1609#if defined(GL_COMBINE_ALPHA)
1610 case GL_COMBINE_ALPHA:
1611#endif // defined(GL_COMBINE_ALPHA)
1612 _needed = 1;
1613 break;
1614#if defined(GL_TEXTURE_ENV_COLOR)
1615 case GL_TEXTURE_ENV_COLOR:
1616#endif // defined(GL_TEXTURE_ENV_COLOR)
1617 _needed = 4;
1618 break;
1619 default:
1620 _needed = 0;
1621 break;
1622 }
1623 if (_remaining < _needed) {
1624 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001625 jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed");
Jack Palevich27f80022009-04-15 19:13:17 -07001626 goto exit;
1627 }
1628 params_base = (GLfixed *)
1629 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1630 params = params_base + offset;
1631
1632 glGetTexEnvxv(
1633 (GLenum)env,
1634 (GLenum)pname,
1635 (GLfixed *)params
1636 );
1637
1638exit:
1639 if (params_base) {
1640 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1641 _exception ? JNI_ABORT: 0);
1642 }
1643}
1644
1645/* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */
1646static void
1647android_glGetTexEnvxv__IILjava_nio_IntBuffer_2
1648 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
1649 jint _exception = 0;
1650 jarray _array = (jarray) 0;
1651 jint _remaining;
1652 GLfixed *params = (GLfixed *) 0;
1653
1654 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
1655 int _needed;
1656 switch (pname) {
1657#if defined(GL_TEXTURE_ENV_MODE)
1658 case GL_TEXTURE_ENV_MODE:
1659#endif // defined(GL_TEXTURE_ENV_MODE)
1660#if defined(GL_COMBINE_RGB)
1661 case GL_COMBINE_RGB:
1662#endif // defined(GL_COMBINE_RGB)
1663#if defined(GL_COMBINE_ALPHA)
1664 case GL_COMBINE_ALPHA:
1665#endif // defined(GL_COMBINE_ALPHA)
1666 _needed = 1;
1667 break;
1668#if defined(GL_TEXTURE_ENV_COLOR)
1669 case GL_TEXTURE_ENV_COLOR:
1670#endif // defined(GL_TEXTURE_ENV_COLOR)
1671 _needed = 4;
1672 break;
1673 default:
1674 _needed = 0;
1675 break;
1676 }
1677 if (_remaining < _needed) {
1678 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001679 jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed");
Jack Palevich27f80022009-04-15 19:13:17 -07001680 goto exit;
1681 }
1682 glGetTexEnvxv(
1683 (GLenum)env,
1684 (GLenum)pname,
1685 (GLfixed *)params
1686 );
1687
1688exit:
1689 if (_array) {
1690 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1691 }
1692}
1693
1694/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
1695static void
1696android_glGetTexParameterfv__II_3FI
1697 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
1698 jint _exception = 0;
1699 GLfloat *params_base = (GLfloat *) 0;
1700 jint _remaining;
1701 GLfloat *params = (GLfloat *) 0;
1702
1703 if (!params_ref) {
1704 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001705 jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null");
Jack Palevich27f80022009-04-15 19:13:17 -07001706 goto exit;
1707 }
1708 if (offset < 0) {
1709 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001710 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -07001711 goto exit;
1712 }
1713 _remaining = _env->GetArrayLength(params_ref) - offset;
1714 if (_remaining < 1) {
1715 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001716 jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1");
Jack Palevich27f80022009-04-15 19:13:17 -07001717 goto exit;
1718 }
1719 params_base = (GLfloat *)
1720 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1721 params = params_base + offset;
1722
1723 glGetTexParameterfv(
1724 (GLenum)target,
1725 (GLenum)pname,
1726 (GLfloat *)params
1727 );
1728
1729exit:
1730 if (params_base) {
1731 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1732 _exception ? JNI_ABORT: 0);
1733 }
1734}
1735
1736/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
1737static void
1738android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2
1739 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
1740 jint _exception = 0;
1741 jarray _array = (jarray) 0;
1742 jint _remaining;
1743 GLfloat *params = (GLfloat *) 0;
1744
1745 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
1746 if (_remaining < 1) {
1747 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001748 jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1");
Jack Palevich27f80022009-04-15 19:13:17 -07001749 goto exit;
1750 }
1751 glGetTexParameterfv(
1752 (GLenum)target,
1753 (GLenum)pname,
1754 (GLfloat *)params
1755 );
1756
1757exit:
1758 if (_array) {
1759 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1760 }
1761}
1762
1763/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
1764static void
1765android_glGetTexParameteriv__II_3II
1766 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
1767 jint _exception = 0;
1768 GLint *params_base = (GLint *) 0;
1769 jint _remaining;
1770 GLint *params = (GLint *) 0;
1771
1772 if (!params_ref) {
1773 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001774 jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null");
Jack Palevich27f80022009-04-15 19:13:17 -07001775 goto exit;
1776 }
1777 if (offset < 0) {
1778 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001779 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -07001780 goto exit;
1781 }
1782 _remaining = _env->GetArrayLength(params_ref) - offset;
1783 if (_remaining < 1) {
1784 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001785 jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1");
Jack Palevich27f80022009-04-15 19:13:17 -07001786 goto exit;
1787 }
1788 params_base = (GLint *)
1789 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1790 params = params_base + offset;
1791
1792 glGetTexParameteriv(
1793 (GLenum)target,
1794 (GLenum)pname,
1795 (GLint *)params
1796 );
1797
1798exit:
1799 if (params_base) {
1800 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1801 _exception ? JNI_ABORT: 0);
1802 }
1803}
1804
1805/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
1806static void
1807android_glGetTexParameteriv__IILjava_nio_IntBuffer_2
1808 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
1809 jint _exception = 0;
1810 jarray _array = (jarray) 0;
1811 jint _remaining;
1812 GLint *params = (GLint *) 0;
1813
1814 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
1815 if (_remaining < 1) {
1816 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001817 jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1");
Jack Palevich27f80022009-04-15 19:13:17 -07001818 goto exit;
1819 }
1820 glGetTexParameteriv(
1821 (GLenum)target,
1822 (GLenum)pname,
1823 (GLint *)params
1824 );
1825
1826exit:
1827 if (_array) {
1828 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1829 }
1830}
1831
1832/* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */
1833static void
1834android_glGetTexParameterxv__II_3II
1835 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
1836 jint _exception = 0;
1837 GLfixed *params_base = (GLfixed *) 0;
1838 jint _remaining;
1839 GLfixed *params = (GLfixed *) 0;
1840
1841 if (!params_ref) {
1842 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001843 jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null");
Jack Palevich27f80022009-04-15 19:13:17 -07001844 goto exit;
1845 }
1846 if (offset < 0) {
1847 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001848 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -07001849 goto exit;
1850 }
1851 _remaining = _env->GetArrayLength(params_ref) - offset;
1852 if (_remaining < 1) {
1853 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001854 jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1");
Jack Palevich27f80022009-04-15 19:13:17 -07001855 goto exit;
1856 }
1857 params_base = (GLfixed *)
1858 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1859 params = params_base + offset;
1860
1861 glGetTexParameterxv(
1862 (GLenum)target,
1863 (GLenum)pname,
1864 (GLfixed *)params
1865 );
1866
1867exit:
1868 if (params_base) {
1869 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1870 _exception ? JNI_ABORT: 0);
1871 }
1872}
1873
1874/* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */
1875static void
1876android_glGetTexParameterxv__IILjava_nio_IntBuffer_2
1877 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
1878 jint _exception = 0;
1879 jarray _array = (jarray) 0;
1880 jint _remaining;
1881 GLfixed *params = (GLfixed *) 0;
1882
1883 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
1884 if (_remaining < 1) {
1885 _exception = 1;
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001886 jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1");
Jack Palevich27f80022009-04-15 19:13:17 -07001887 goto exit;
1888 }
1889 glGetTexParameterxv(
1890 (GLenum)target,
1891 (GLenum)pname,
1892 (GLfixed *)params
1893 );
1894
1895exit:
1896 if (_array) {
1897 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1898 }
1899}
1900
1901/* GLboolean glIsBuffer ( GLuint buffer ) */
1902static jboolean
1903android_glIsBuffer__I
1904 (JNIEnv *_env, jobject _this, jint buffer) {
1905 GLboolean _returnValue;
1906 _returnValue = glIsBuffer(
1907 (GLuint)buffer
1908 );
1909 return _returnValue;
1910}
1911
1912/* GLboolean glIsEnabled ( GLenum cap ) */
1913static jboolean
1914android_glIsEnabled__I
1915 (JNIEnv *_env, jobject _this, jint cap) {
1916 GLboolean _returnValue;
1917 _returnValue = glIsEnabled(
1918 (GLenum)cap
1919 );
1920 return _returnValue;
1921}
1922
1923/* GLboolean glIsTexture ( GLuint texture ) */
1924static jboolean
1925android_glIsTexture__I
1926 (JNIEnv *_env, jobject _this, jint texture) {
1927 GLboolean _returnValue;
1928 _returnValue = glIsTexture(
1929 (GLuint)texture
1930 );
1931 return _returnValue;
1932}
1933
1934/* void glNormalPointer ( GLenum type, GLsizei stride, GLint offset ) */
1935static void
1936android_glNormalPointer__III
1937 (JNIEnv *_env, jobject _this, jint type, jint stride, jint offset) {
1938 glNormalPointer(
1939 (GLenum)type,
1940 (GLsizei)stride,
1941 (const GLvoid *)offset
1942 );
1943}
1944
1945/* void glPointParameterf ( GLenum pname, GLfloat param ) */
1946static void
1947android_glPointParameterf__IF
1948 (JNIEnv *_env, jobject _this, jint pname, jfloat param) {
1949 glPointParameterf(
1950 (GLenum)pname,
1951 (GLfloat)param
1952 );
1953}
1954
1955/* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */
1956static void
1957android_glPointParameterfv__I_3FI
1958 (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
1959 GLfloat *params_base = (GLfloat *) 0;
1960 jint _remaining;
1961 GLfloat *params = (GLfloat *) 0;
1962
1963 if (!params_ref) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001964 jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null");
Jack Palevich27f80022009-04-15 19:13:17 -07001965 goto exit;
1966 }
1967 if (offset < 0) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001968 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -07001969 goto exit;
1970 }
1971 _remaining = _env->GetArrayLength(params_ref) - offset;
1972 if (_remaining < 1) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001973 jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1");
Jack Palevich27f80022009-04-15 19:13:17 -07001974 goto exit;
1975 }
1976 params_base = (GLfloat *)
1977 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1978 params = params_base + offset;
1979
1980 glPointParameterfv(
1981 (GLenum)pname,
1982 (GLfloat *)params
1983 );
1984
1985exit:
1986 if (params_base) {
1987 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1988 JNI_ABORT);
1989 }
1990}
1991
1992/* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */
1993static void
1994android_glPointParameterfv__ILjava_nio_FloatBuffer_2
1995 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
1996 jarray _array = (jarray) 0;
1997 jint _remaining;
1998 GLfloat *params = (GLfloat *) 0;
1999
2000 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
2001 if (_remaining < 1) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002002 jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1");
Jack Palevich27f80022009-04-15 19:13:17 -07002003 goto exit;
2004 }
2005 glPointParameterfv(
2006 (GLenum)pname,
2007 (GLfloat *)params
2008 );
2009
2010exit:
2011 if (_array) {
2012 releasePointer(_env, _array, params, JNI_FALSE);
2013 }
2014}
2015
2016/* void glPointParameterx ( GLenum pname, GLfixed param ) */
2017static void
2018android_glPointParameterx__II
2019 (JNIEnv *_env, jobject _this, jint pname, jint param) {
2020 glPointParameterx(
2021 (GLenum)pname,
2022 (GLfixed)param
2023 );
2024}
2025
2026/* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */
2027static void
2028android_glPointParameterxv__I_3II
2029 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
2030 GLfixed *params_base = (GLfixed *) 0;
2031 jint _remaining;
2032 GLfixed *params = (GLfixed *) 0;
2033
2034 if (!params_ref) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002035 jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null");
Jack Palevich27f80022009-04-15 19:13:17 -07002036 goto exit;
2037 }
2038 if (offset < 0) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002039 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -07002040 goto exit;
2041 }
2042 _remaining = _env->GetArrayLength(params_ref) - offset;
2043 if (_remaining < 1) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002044 jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1");
Jack Palevich27f80022009-04-15 19:13:17 -07002045 goto exit;
2046 }
2047 params_base = (GLfixed *)
2048 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2049 params = params_base + offset;
2050
2051 glPointParameterxv(
2052 (GLenum)pname,
2053 (GLfixed *)params
2054 );
2055
2056exit:
2057 if (params_base) {
2058 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2059 JNI_ABORT);
2060 }
2061}
2062
2063/* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */
2064static void
2065android_glPointParameterxv__ILjava_nio_IntBuffer_2
2066 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
2067 jarray _array = (jarray) 0;
2068 jint _remaining;
2069 GLfixed *params = (GLfixed *) 0;
2070
2071 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
2072 if (_remaining < 1) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002073 jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1");
Jack Palevich27f80022009-04-15 19:13:17 -07002074 goto exit;
2075 }
2076 glPointParameterxv(
2077 (GLenum)pname,
2078 (GLfixed *)params
2079 );
2080
2081exit:
2082 if (_array) {
2083 releasePointer(_env, _array, params, JNI_FALSE);
2084 }
2085}
2086
2087/* void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) */
2088static void
Jack Palevichbe6eac82009-12-08 15:43:51 +08002089android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I
2090 (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) {
Jack Palevich27f80022009-04-15 19:13:17 -07002091 jarray _array = (jarray) 0;
2092 jint _remaining;
2093 GLvoid *pointer = (GLvoid *) 0;
2094
Jack Palevichbe6eac82009-12-08 15:43:51 +08002095 if (pointer_buf) {
2096 pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
2097 if ( ! pointer ) {
2098 return;
2099 }
2100 }
2101 glPointSizePointerOESBounds(
Jack Palevich27f80022009-04-15 19:13:17 -07002102 (GLenum)type,
2103 (GLsizei)stride,
Jack Palevichbe6eac82009-12-08 15:43:51 +08002104 (GLvoid *)pointer,
2105 (GLsizei)remaining
Jack Palevich27f80022009-04-15 19:13:17 -07002106 );
Jack Palevich27f80022009-04-15 19:13:17 -07002107}
2108
2109/* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
2110static void
2111android_glTexCoordPointer__IIII
2112 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
2113 glTexCoordPointer(
2114 (GLint)size,
2115 (GLenum)type,
2116 (GLsizei)stride,
2117 (const GLvoid *)offset
2118 );
2119}
2120
2121/* void glTexEnvi ( GLenum target, GLenum pname, GLint param ) */
2122static void
2123android_glTexEnvi__III
2124 (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
2125 glTexEnvi(
2126 (GLenum)target,
2127 (GLenum)pname,
2128 (GLint)param
2129 );
2130}
2131
2132/* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */
2133static void
2134android_glTexEnviv__II_3II
2135 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2136 GLint *params_base = (GLint *) 0;
2137 jint _remaining;
2138 GLint *params = (GLint *) 0;
2139
2140 if (!params_ref) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002141 jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null");
Jack Palevich27f80022009-04-15 19:13:17 -07002142 goto exit;
2143 }
2144 if (offset < 0) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002145 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -07002146 goto exit;
2147 }
2148 _remaining = _env->GetArrayLength(params_ref) - offset;
2149 int _needed;
2150 switch (pname) {
2151#if defined(GL_TEXTURE_ENV_MODE)
2152 case GL_TEXTURE_ENV_MODE:
2153#endif // defined(GL_TEXTURE_ENV_MODE)
2154#if defined(GL_COMBINE_RGB)
2155 case GL_COMBINE_RGB:
2156#endif // defined(GL_COMBINE_RGB)
2157#if defined(GL_COMBINE_ALPHA)
2158 case GL_COMBINE_ALPHA:
2159#endif // defined(GL_COMBINE_ALPHA)
2160 _needed = 1;
2161 break;
2162#if defined(GL_TEXTURE_ENV_COLOR)
2163 case GL_TEXTURE_ENV_COLOR:
2164#endif // defined(GL_TEXTURE_ENV_COLOR)
2165 _needed = 4;
2166 break;
2167 default:
2168 _needed = 0;
2169 break;
2170 }
2171 if (_remaining < _needed) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002172 jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed");
Jack Palevich27f80022009-04-15 19:13:17 -07002173 goto exit;
2174 }
2175 params_base = (GLint *)
2176 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2177 params = params_base + offset;
2178
2179 glTexEnviv(
2180 (GLenum)target,
2181 (GLenum)pname,
2182 (GLint *)params
2183 );
2184
2185exit:
2186 if (params_base) {
2187 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2188 JNI_ABORT);
2189 }
2190}
2191
2192/* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */
2193static void
2194android_glTexEnviv__IILjava_nio_IntBuffer_2
2195 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2196 jarray _array = (jarray) 0;
2197 jint _remaining;
2198 GLint *params = (GLint *) 0;
2199
2200 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
2201 int _needed;
2202 switch (pname) {
2203#if defined(GL_TEXTURE_ENV_MODE)
2204 case GL_TEXTURE_ENV_MODE:
2205#endif // defined(GL_TEXTURE_ENV_MODE)
2206#if defined(GL_COMBINE_RGB)
2207 case GL_COMBINE_RGB:
2208#endif // defined(GL_COMBINE_RGB)
2209#if defined(GL_COMBINE_ALPHA)
2210 case GL_COMBINE_ALPHA:
2211#endif // defined(GL_COMBINE_ALPHA)
2212 _needed = 1;
2213 break;
2214#if defined(GL_TEXTURE_ENV_COLOR)
2215 case GL_TEXTURE_ENV_COLOR:
2216#endif // defined(GL_TEXTURE_ENV_COLOR)
2217 _needed = 4;
2218 break;
2219 default:
2220 _needed = 0;
2221 break;
2222 }
2223 if (_remaining < _needed) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002224 jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed");
Jack Palevich27f80022009-04-15 19:13:17 -07002225 goto exit;
2226 }
2227 glTexEnviv(
2228 (GLenum)target,
2229 (GLenum)pname,
2230 (GLint *)params
2231 );
2232
2233exit:
2234 if (_array) {
2235 releasePointer(_env, _array, params, JNI_FALSE);
2236 }
2237}
2238
2239/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
2240static void
2241android_glTexParameterfv__II_3FI
2242 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
2243 GLfloat *params_base = (GLfloat *) 0;
2244 jint _remaining;
2245 GLfloat *params = (GLfloat *) 0;
2246
2247 if (!params_ref) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002248 jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null");
Jack Palevich27f80022009-04-15 19:13:17 -07002249 goto exit;
2250 }
2251 if (offset < 0) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002252 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -07002253 goto exit;
2254 }
2255 _remaining = _env->GetArrayLength(params_ref) - offset;
2256 if (_remaining < 1) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002257 jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1");
Jack Palevich27f80022009-04-15 19:13:17 -07002258 goto exit;
2259 }
2260 params_base = (GLfloat *)
2261 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2262 params = params_base + offset;
2263
2264 glTexParameterfv(
2265 (GLenum)target,
2266 (GLenum)pname,
2267 (GLfloat *)params
2268 );
2269
2270exit:
2271 if (params_base) {
2272 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2273 JNI_ABORT);
2274 }
2275}
2276
2277/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
2278static void
2279android_glTexParameterfv__IILjava_nio_FloatBuffer_2
2280 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2281 jarray _array = (jarray) 0;
2282 jint _remaining;
2283 GLfloat *params = (GLfloat *) 0;
2284
2285 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
2286 if (_remaining < 1) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002287 jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1");
Jack Palevich27f80022009-04-15 19:13:17 -07002288 goto exit;
2289 }
2290 glTexParameterfv(
2291 (GLenum)target,
2292 (GLenum)pname,
2293 (GLfloat *)params
2294 );
2295
2296exit:
2297 if (_array) {
2298 releasePointer(_env, _array, params, JNI_FALSE);
2299 }
2300}
2301
2302/* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */
2303static void
2304android_glTexParameteri__III
2305 (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
2306 glTexParameteri(
2307 (GLenum)target,
2308 (GLenum)pname,
2309 (GLint)param
2310 );
2311}
2312
2313/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
2314static void
2315android_glTexParameteriv__II_3II
2316 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2317 GLint *params_base = (GLint *) 0;
2318 jint _remaining;
2319 GLint *params = (GLint *) 0;
2320
2321 if (!params_ref) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002322 jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null");
Jack Palevich27f80022009-04-15 19:13:17 -07002323 goto exit;
2324 }
2325 if (offset < 0) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002326 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -07002327 goto exit;
2328 }
2329 _remaining = _env->GetArrayLength(params_ref) - offset;
2330 if (_remaining < 1) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002331 jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1");
Jack Palevich27f80022009-04-15 19:13:17 -07002332 goto exit;
2333 }
2334 params_base = (GLint *)
2335 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2336 params = params_base + offset;
2337
2338 glTexParameteriv(
2339 (GLenum)target,
2340 (GLenum)pname,
2341 (GLint *)params
2342 );
2343
2344exit:
2345 if (params_base) {
2346 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2347 JNI_ABORT);
2348 }
2349}
2350
2351/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
2352static void
2353android_glTexParameteriv__IILjava_nio_IntBuffer_2
2354 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2355 jarray _array = (jarray) 0;
2356 jint _remaining;
2357 GLint *params = (GLint *) 0;
2358
2359 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
2360 if (_remaining < 1) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002361 jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1");
Jack Palevich27f80022009-04-15 19:13:17 -07002362 goto exit;
2363 }
2364 glTexParameteriv(
2365 (GLenum)target,
2366 (GLenum)pname,
2367 (GLint *)params
2368 );
2369
2370exit:
2371 if (_array) {
2372 releasePointer(_env, _array, params, JNI_FALSE);
2373 }
2374}
2375
2376/* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */
2377static void
2378android_glTexParameterxv__II_3II
2379 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2380 GLfixed *params_base = (GLfixed *) 0;
2381 jint _remaining;
2382 GLfixed *params = (GLfixed *) 0;
2383
2384 if (!params_ref) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002385 jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null");
Jack Palevich27f80022009-04-15 19:13:17 -07002386 goto exit;
2387 }
2388 if (offset < 0) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002389 jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0");
Jack Palevich27f80022009-04-15 19:13:17 -07002390 goto exit;
2391 }
2392 _remaining = _env->GetArrayLength(params_ref) - offset;
2393 if (_remaining < 1) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002394 jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1");
Jack Palevich27f80022009-04-15 19:13:17 -07002395 goto exit;
2396 }
2397 params_base = (GLfixed *)
2398 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2399 params = params_base + offset;
2400
2401 glTexParameterxv(
2402 (GLenum)target,
2403 (GLenum)pname,
2404 (GLfixed *)params
2405 );
2406
2407exit:
2408 if (params_base) {
2409 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2410 JNI_ABORT);
2411 }
2412}
2413
2414/* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */
2415static void
2416android_glTexParameterxv__IILjava_nio_IntBuffer_2
2417 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2418 jarray _array = (jarray) 0;
2419 jint _remaining;
2420 GLfixed *params = (GLfixed *) 0;
2421
2422 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
2423 if (_remaining < 1) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002424 jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1");
Jack Palevich27f80022009-04-15 19:13:17 -07002425 goto exit;
2426 }
2427 glTexParameterxv(
2428 (GLenum)target,
2429 (GLenum)pname,
2430 (GLfixed *)params
2431 );
2432
2433exit:
2434 if (_array) {
2435 releasePointer(_env, _array, params, JNI_FALSE);
2436 }
2437}
2438
2439/* void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
2440static void
2441android_glVertexPointer__IIII
2442 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
2443 glVertexPointer(
2444 (GLint)size,
2445 (GLenum)type,
2446 (GLsizei)stride,
2447 (const GLvoid *)offset
2448 );
2449}
2450
2451static const char *classPathName = "android/opengl/GLES11";
2452
2453static JNINativeMethod methods[] = {
2454{"_nativeClassInit", "()V", (void*)nativeClassInit },
2455{"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II },
2456{"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I },
2457{"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 },
2458{"glClipPlanef", "(I[FI)V", (void *) android_glClipPlanef__I_3FI },
2459{"glClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glClipPlanef__ILjava_nio_FloatBuffer_2 },
2460{"glClipPlanex", "(I[II)V", (void *) android_glClipPlanex__I_3II },
2461{"glClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glClipPlanex__ILjava_nio_IntBuffer_2 },
2462{"glColor4ub", "(BBBB)V", (void *) android_glColor4ub__BBBB },
2463{"glColorPointer", "(IIII)V", (void *) android_glColorPointer__IIII },
2464{"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II },
2465{"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 },
2466{"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII },
2467{"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II },
2468{"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 },
2469{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI },
2470{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 },
2471{"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II },
2472{"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 },
2473{"glGetClipPlanef", "(I[FI)V", (void *) android_glGetClipPlanef__I_3FI },
2474{"glGetClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetClipPlanef__ILjava_nio_FloatBuffer_2 },
2475{"glGetClipPlanex", "(I[II)V", (void *) android_glGetClipPlanex__I_3II },
2476{"glGetClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetClipPlanex__ILjava_nio_IntBuffer_2 },
2477{"glGetFixedv", "(I[II)V", (void *) android_glGetFixedv__I_3II },
2478{"glGetFixedv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetFixedv__ILjava_nio_IntBuffer_2 },
2479{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI },
2480{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 },
2481{"glGetLightfv", "(II[FI)V", (void *) android_glGetLightfv__II_3FI },
2482{"glGetLightfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetLightfv__IILjava_nio_FloatBuffer_2 },
2483{"glGetLightxv", "(II[II)V", (void *) android_glGetLightxv__II_3II },
2484{"glGetLightxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetLightxv__IILjava_nio_IntBuffer_2 },
2485{"glGetMaterialfv", "(II[FI)V", (void *) android_glGetMaterialfv__II_3FI },
2486{"glGetMaterialfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetMaterialfv__IILjava_nio_FloatBuffer_2 },
2487{"glGetMaterialxv", "(II[II)V", (void *) android_glGetMaterialxv__II_3II },
2488{"glGetMaterialxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetMaterialxv__IILjava_nio_IntBuffer_2 },
2489{"glGetTexEnvfv", "(II[FI)V", (void *) android_glGetTexEnvfv__II_3FI },
2490{"glGetTexEnvfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2 },
2491{"glGetTexEnviv", "(II[II)V", (void *) android_glGetTexEnviv__II_3II },
2492{"glGetTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnviv__IILjava_nio_IntBuffer_2 },
2493{"glGetTexEnvxv", "(II[II)V", (void *) android_glGetTexEnvxv__II_3II },
2494{"glGetTexEnvxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnvxv__IILjava_nio_IntBuffer_2 },
2495{"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI },
2496{"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 },
2497{"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II },
2498{"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 },
2499{"glGetTexParameterxv", "(II[II)V", (void *) android_glGetTexParameterxv__II_3II },
2500{"glGetTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameterxv__IILjava_nio_IntBuffer_2 },
2501{"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I },
2502{"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I },
2503{"glIsTexture", "(I)Z", (void *) android_glIsTexture__I },
2504{"glNormalPointer", "(III)V", (void *) android_glNormalPointer__III },
2505{"glPointParameterf", "(IF)V", (void *) android_glPointParameterf__IF },
2506{"glPointParameterfv", "(I[FI)V", (void *) android_glPointParameterfv__I_3FI },
2507{"glPointParameterfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glPointParameterfv__ILjava_nio_FloatBuffer_2 },
2508{"glPointParameterx", "(II)V", (void *) android_glPointParameterx__II },
2509{"glPointParameterxv", "(I[II)V", (void *) android_glPointParameterxv__I_3II },
2510{"glPointParameterxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glPointParameterxv__ILjava_nio_IntBuffer_2 },
Jack Palevichbe6eac82009-12-08 15:43:51 +08002511{"glPointSizePointerOESBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I },
Jack Palevich27f80022009-04-15 19:13:17 -07002512{"glTexCoordPointer", "(IIII)V", (void *) android_glTexCoordPointer__IIII },
2513{"glTexEnvi", "(III)V", (void *) android_glTexEnvi__III },
2514{"glTexEnviv", "(II[II)V", (void *) android_glTexEnviv__II_3II },
2515{"glTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexEnviv__IILjava_nio_IntBuffer_2 },
2516{"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI },
2517{"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 },
2518{"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III },
2519{"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II },
2520{"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 },
2521{"glTexParameterxv", "(II[II)V", (void *) android_glTexParameterxv__II_3II },
2522{"glTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameterxv__IILjava_nio_IntBuffer_2 },
2523{"glVertexPointer", "(IIII)V", (void *) android_glVertexPointer__IIII },
2524};
2525
2526int register_android_opengl_jni_GLES11(JNIEnv *_env)
2527{
2528 int err;
2529 err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
2530 return err;
2531}