blob: 352f5bf3a08879d79b9a43b56425e50c1b86cd3b [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
Mathias Agopian15284de2013-02-23 03:12:30 -080020#include <GLES/gl.h>
21#include <GLES/glext.h>
22
Elliott Hughes24ce5fb2011-04-08 20:01:01 -070023#include "jni.h"
24#include "JNIHelp.h"
Jack Palevich27f80022009-04-15 19:13:17 -070025#include <android_runtime/AndroidRuntime.h>
26#include <utils/misc.h>
Jack Palevich27f80022009-04-15 19:13:17 -070027#include <assert.h>
Jack Palevichbe6eac82009-12-08 15:43:51 +080028
Jack Palevich27f80022009-04-15 19:13:17 -070029static int initialized = 0;
30
31static jclass nioAccessClass;
32static jclass bufferClass;
Jack Palevich27f80022009-04-15 19:13:17 -070033static jmethodID getBasePointerID;
34static jmethodID getBaseArrayID;
35static jmethodID getBaseArrayOffsetID;
36static jfieldID positionID;
37static jfieldID limitID;
38static jfieldID elementSizeShiftID;
39
Mathias Agopian15284de2013-02-23 03:12:30 -080040
41/* special calls implemented in Android's GLES wrapper used to more
42 * efficiently bound-check passed arrays */
43extern "C" {
44#ifdef GL_VERSION_ES_CM_1_1
45GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
46 const GLvoid *ptr, GLsizei count);
47GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
48 const GLvoid *pointer, GLsizei count);
49GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
50 GLsizei stride, const GLvoid *pointer, GLsizei count);
51GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
52 GLsizei stride, const GLvoid *pointer, GLsizei count);
53GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
54 GLsizei stride, const GLvoid *pointer, GLsizei count);
55GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
56 GLsizei stride, const GLvoid *pointer, GLsizei count);
57GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
58 GLsizei stride, const GLvoid *pointer, GLsizei count);
59#endif
60#ifdef GL_ES_VERSION_2_0
61static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type,
62 GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) {
63 glVertexAttribPointer(indx, size, type, normalized, stride, pointer);
64}
65#endif
66}
67
Jack Palevich27f80022009-04-15 19:13:17 -070068/* Cache method IDs each time the class is loaded. */
69
70static void
Elliott Hughes24ce5fb2011-04-08 20:01:01 -070071nativeClassInit(JNIEnv *_env, jclass glImplClass)
Jack Palevich27f80022009-04-15 19:13:17 -070072{
73 jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
74 nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
75
76 jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
77 bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
78
79 getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
80 "getBasePointer", "(Ljava/nio/Buffer;)J");
81 getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
82 "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
83 getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
84 "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
85
86 positionID = _env->GetFieldID(bufferClass, "position", "I");
87 limitID = _env->GetFieldID(bufferClass, "limit", "I");
88 elementSizeShiftID =
89 _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
90}
91
Jack Palevich27f80022009-04-15 19:13:17 -070092static void *
Thomas Tafertshofer17045a12012-07-12 13:55:55 -070093getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
Jack Palevich27f80022009-04-15 19:13:17 -070094{
95 jint position;
96 jint limit;
97 jint elementSizeShift;
98 jlong pointer;
Jack Palevich27f80022009-04-15 19:13:17 -070099
100 position = _env->GetIntField(buffer, positionID);
101 limit = _env->GetIntField(buffer, limitID);
102 elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
103 *remaining = (limit - position) << elementSizeShift;
104 pointer = _env->CallStaticLongMethod(nioAccessClass,
105 getBasePointerID, buffer);
106 if (pointer != 0L) {
107 *array = NULL;
108 return (void *) (jint) pointer;
109 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700110
Jack Palevich27f80022009-04-15 19:13:17 -0700111 *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
112 getBaseArrayID, buffer);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700113 *offset = _env->CallStaticIntMethod(nioAccessClass,
Jack Palevich27f80022009-04-15 19:13:17 -0700114 getBaseArrayOffsetID, buffer);
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700115
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700116 return NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700117}
118
Jack Palevich27f80022009-04-15 19:13:17 -0700119static void
120releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
121{
122 _env->ReleasePrimitiveArrayCritical(array, data,
Mathias Agopian15284de2013-02-23 03:12:30 -0800123 commit ? 0 : JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -0700124}
125
Jack Palevichbe6eac82009-12-08 15:43:51 +0800126static void *
127getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
128 char* buf = (char*) _env->GetDirectBufferAddress(buffer);
129 if (buf) {
130 jint position = _env->GetIntField(buffer, positionID);
131 jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
132 buf += position << elementSizeShift;
133 } else {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700134 jniThrowException(_env, "java/lang/IllegalArgumentException",
135 "Must use a native order direct Buffer");
Jack Palevichbe6eac82009-12-08 15:43:51 +0800136 }
137 return (void*) buf;
138}
139
Jack Palevich27f80022009-04-15 19:13:17 -0700140// --------------------------------------------------------------------------
Mathias Agopian15284de2013-02-23 03:12:30 -0800141
142/*
143 * returns the number of values glGet returns for a given pname.
144 *
145 * The code below is written such that pnames requiring only one values
146 * are the default (and are not explicitely tested for). This makes the
147 * checking code much shorter/readable/efficient.
148 *
149 * This means that unknown pnames (e.g.: extensions) will default to 1. If
150 * that unknown pname needs more than 1 value, then the validation check
151 * is incomplete and the app may crash if it passed the wrong number params.
152 */
153static int getNeededCount(GLint pname) {
154 int needed = 1;
155#ifdef GL_ES_VERSION_2_0
156 // GLES 2.x pnames
157 switch (pname) {
158 case GL_ALIASED_LINE_WIDTH_RANGE:
159 case GL_ALIASED_POINT_SIZE_RANGE:
160 needed = 2;
161 break;
162
163 case GL_BLEND_COLOR:
164 case GL_COLOR_CLEAR_VALUE:
165 case GL_COLOR_WRITEMASK:
166 case GL_SCISSOR_BOX:
167 case GL_VIEWPORT:
168 needed = 4;
169 break;
170
171 case GL_COMPRESSED_TEXTURE_FORMATS:
172 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
173 break;
174
175 case GL_SHADER_BINARY_FORMATS:
176 glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed);
177 break;
178 }
179#endif
180
181#ifdef GL_VERSION_ES_CM_1_1
182 // GLES 1.x pnames
183 switch (pname) {
184 case GL_ALIASED_LINE_WIDTH_RANGE:
185 case GL_ALIASED_POINT_SIZE_RANGE:
186 case GL_DEPTH_RANGE:
187 case GL_SMOOTH_LINE_WIDTH_RANGE:
188 case GL_SMOOTH_POINT_SIZE_RANGE:
189 needed = 2;
190 break;
191
192 case GL_CURRENT_NORMAL:
193 case GL_POINT_DISTANCE_ATTENUATION:
194 needed = 3;
195 break;
196
197 case GL_COLOR_CLEAR_VALUE:
198 case GL_COLOR_WRITEMASK:
199 case GL_CURRENT_COLOR:
200 case GL_CURRENT_TEXTURE_COORDS:
201 case GL_FOG_COLOR:
202 case GL_LIGHT_MODEL_AMBIENT:
203 case GL_SCISSOR_BOX:
204 case GL_VIEWPORT:
205 needed = 4;
206 break;
207
208 case GL_MODELVIEW_MATRIX:
209 case GL_PROJECTION_MATRIX:
210 case GL_TEXTURE_MATRIX:
211 needed = 16;
212 break;
213
214 case GL_COMPRESSED_TEXTURE_FORMATS:
215 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
216 break;
217 }
218#endif
219 return needed;
220}
221
222template <typename JTYPEARRAY, typename CTYPE, void GET(GLenum, CTYPE*)>
223static void
224get
225 (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
226 jint _exception = 0;
227 const char * _exceptionType;
228 const char * _exceptionMessage;
229 CTYPE *params_base = (CTYPE *) 0;
230 jint _remaining;
231 CTYPE *params = (CTYPE *) 0;
232 int _needed = 0;
233
234 if (!params_ref) {
235 _exception = 1;
236 _exceptionType = "java/lang/IllegalArgumentException";
237 _exceptionMessage = "params == null";
238 goto exit;
239 }
240 if (offset < 0) {
241 _exception = 1;
242 _exceptionType = "java/lang/IllegalArgumentException";
243 _exceptionMessage = "offset < 0";
244 goto exit;
245 }
246 _remaining = _env->GetArrayLength(params_ref) - offset;
247 _needed = getNeededCount(pname);
248 // if we didn't find this pname, we just assume the user passed
249 // an array of the right size -- this might happen with extensions
250 // or if we forget an enum here.
251 if (_remaining < _needed) {
252 _exception = 1;
253 _exceptionType = "java/lang/IllegalArgumentException";
254 _exceptionMessage = "length - offset < needed";
255 goto exit;
256 }
257 params_base = (CTYPE *)
258 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
259 params = params_base + offset;
260
261 GET(
262 (GLenum)pname,
263 (CTYPE *)params
264 );
265
266exit:
267 if (params_base) {
268 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
269 _exception ? JNI_ABORT: 0);
270 }
271 if (_exception) {
272 jniThrowException(_env, _exceptionType, _exceptionMessage);
273 }
274}
275
276
277template <typename CTYPE, void GET(GLenum, CTYPE*)>
278static void
279getarray
280 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
281 jint _exception = 0;
282 const char * _exceptionType;
283 const char * _exceptionMessage;
284 jarray _array = (jarray) 0;
285 jint _bufferOffset = (jint) 0;
286 jint _remaining;
287 CTYPE *params = (CTYPE *) 0;
288 int _needed = 0;
289
290 params = (CTYPE *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
291 _needed = getNeededCount(pname);
292 // if we didn't find this pname, we just assume the user passed
293 // an array of the right size -- this might happen with extensions
294 // or if we forget an enum here.
295 if (_needed>0 && _remaining < _needed) {
296 _exception = 1;
297 _exceptionType = "java/lang/IllegalArgumentException";
298 _exceptionMessage = "remaining() < needed";
299 goto exit;
300 }
301 if (params == NULL) {
302 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
303 params = (CTYPE *) (_paramsBase + _bufferOffset);
304 }
305 GET(
306 (GLenum)pname,
307 (CTYPE *)params
308 );
309
310exit:
311 if (_array) {
312 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
313 }
314 if (_exception) {
315 jniThrowException(_env, _exceptionType, _exceptionMessage);
316 }
317}
318
319// --------------------------------------------------------------------------
Jack Palevich27f80022009-04-15 19:13:17 -0700320/* void glBindBuffer ( GLenum target, GLuint buffer ) */
321static void
322android_glBindBuffer__II
323 (JNIEnv *_env, jobject _this, jint target, jint buffer) {
324 glBindBuffer(
325 (GLenum)target,
326 (GLuint)buffer
327 );
328}
329
330/* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */
331static void
332android_glBufferData__IILjava_nio_Buffer_2I
333 (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700334 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800335 const char * _exceptionType = NULL;
336 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700337 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700338 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700339 jint _remaining;
340 GLvoid *data = (GLvoid *) 0;
341
342 if (data_buf) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700343 data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevichc620a522009-10-21 11:02:44 -0700344 if (_remaining < size) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700345 _exception = 1;
346 _exceptionType = "java/lang/IllegalArgumentException";
347 _exceptionMessage = "remaining() < size < needed";
Jack Palevichc620a522009-10-21 11:02:44 -0700348 goto exit;
349 }
Jack Palevich27f80022009-04-15 19:13:17 -0700350 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -0700351 if (data_buf && data == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700352 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
353 data = (GLvoid *) (_dataBase + _bufferOffset);
354 }
Jack Palevich27f80022009-04-15 19:13:17 -0700355 glBufferData(
356 (GLenum)target,
357 (GLsizeiptr)size,
358 (GLvoid *)data,
359 (GLenum)usage
360 );
Jack Palevichc620a522009-10-21 11:02:44 -0700361
362exit:
Jack Palevich27f80022009-04-15 19:13:17 -0700363 if (_array) {
364 releasePointer(_env, _array, data, JNI_FALSE);
365 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700366 if (_exception) {
367 jniThrowException(_env, _exceptionType, _exceptionMessage);
368 }
Jack Palevich27f80022009-04-15 19:13:17 -0700369}
370
371/* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */
372static void
373android_glBufferSubData__IIILjava_nio_Buffer_2
374 (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700375 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800376 const char * _exceptionType = NULL;
377 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700378 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700379 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700380 jint _remaining;
381 GLvoid *data = (GLvoid *) 0;
382
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700383 data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevichc620a522009-10-21 11:02:44 -0700384 if (_remaining < size) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700385 _exception = 1;
386 _exceptionType = "java/lang/IllegalArgumentException";
387 _exceptionMessage = "remaining() < size < needed";
Jack Palevichc620a522009-10-21 11:02:44 -0700388 goto exit;
389 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700390 if (data == NULL) {
391 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
392 data = (GLvoid *) (_dataBase + _bufferOffset);
393 }
Jack Palevich27f80022009-04-15 19:13:17 -0700394 glBufferSubData(
395 (GLenum)target,
396 (GLintptr)offset,
397 (GLsizeiptr)size,
398 (GLvoid *)data
399 );
Jack Palevichc620a522009-10-21 11:02:44 -0700400
401exit:
Jack Palevich27f80022009-04-15 19:13:17 -0700402 if (_array) {
403 releasePointer(_env, _array, data, JNI_FALSE);
404 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700405 if (_exception) {
406 jniThrowException(_env, _exceptionType, _exceptionMessage);
407 }
Jack Palevich27f80022009-04-15 19:13:17 -0700408}
409
410/* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */
411static void
412android_glClipPlanef__I_3FI
413 (JNIEnv *_env, jobject _this, jint plane, jfloatArray equation_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700414 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800415 const char * _exceptionType = NULL;
416 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700417 GLfloat *equation_base = (GLfloat *) 0;
418 jint _remaining;
419 GLfloat *equation = (GLfloat *) 0;
420
421 if (!equation_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700422 _exception = 1;
423 _exceptionType = "java/lang/IllegalArgumentException";
424 _exceptionMessage = "equation == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700425 goto exit;
426 }
427 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700428 _exception = 1;
429 _exceptionType = "java/lang/IllegalArgumentException";
430 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700431 goto exit;
432 }
433 _remaining = _env->GetArrayLength(equation_ref) - offset;
434 equation_base = (GLfloat *)
435 _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0);
436 equation = equation_base + offset;
437
438 glClipPlanef(
439 (GLenum)plane,
440 (GLfloat *)equation
441 );
442
443exit:
444 if (equation_base) {
445 _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base,
446 JNI_ABORT);
447 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700448 if (_exception) {
449 jniThrowException(_env, _exceptionType, _exceptionMessage);
450 }
Jack Palevich27f80022009-04-15 19:13:17 -0700451}
452
453/* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */
454static void
455android_glClipPlanef__ILjava_nio_FloatBuffer_2
456 (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700457 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800458 const char * _exceptionType = NULL;
459 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700460 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700461 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700462 jint _remaining;
463 GLfloat *equation = (GLfloat *) 0;
464
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700465 equation = (GLfloat *)getPointer(_env, equation_buf, &_array, &_remaining, &_bufferOffset);
466 if (equation == NULL) {
467 char * _equationBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
468 equation = (GLfloat *) (_equationBase + _bufferOffset);
469 }
Jack Palevich27f80022009-04-15 19:13:17 -0700470 glClipPlanef(
471 (GLenum)plane,
472 (GLfloat *)equation
473 );
474 if (_array) {
475 releasePointer(_env, _array, equation, JNI_FALSE);
476 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700477 if (_exception) {
478 jniThrowException(_env, _exceptionType, _exceptionMessage);
479 }
Jack Palevich27f80022009-04-15 19:13:17 -0700480}
481
482/* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */
483static void
484android_glClipPlanex__I_3II
485 (JNIEnv *_env, jobject _this, jint plane, jintArray equation_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700486 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800487 const char * _exceptionType = NULL;
488 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700489 GLfixed *equation_base = (GLfixed *) 0;
490 jint _remaining;
491 GLfixed *equation = (GLfixed *) 0;
492
493 if (!equation_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700494 _exception = 1;
495 _exceptionType = "java/lang/IllegalArgumentException";
496 _exceptionMessage = "equation == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700497 goto exit;
498 }
499 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700500 _exception = 1;
501 _exceptionType = "java/lang/IllegalArgumentException";
502 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700503 goto exit;
504 }
505 _remaining = _env->GetArrayLength(equation_ref) - offset;
506 equation_base = (GLfixed *)
507 _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0);
508 equation = equation_base + offset;
509
510 glClipPlanex(
511 (GLenum)plane,
512 (GLfixed *)equation
513 );
514
515exit:
516 if (equation_base) {
517 _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base,
518 JNI_ABORT);
519 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700520 if (_exception) {
521 jniThrowException(_env, _exceptionType, _exceptionMessage);
522 }
Jack Palevich27f80022009-04-15 19:13:17 -0700523}
524
525/* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */
526static void
527android_glClipPlanex__ILjava_nio_IntBuffer_2
528 (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700529 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800530 const char * _exceptionType = NULL;
531 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700532 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700533 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700534 jint _remaining;
535 GLfixed *equation = (GLfixed *) 0;
536
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700537 equation = (GLfixed *)getPointer(_env, equation_buf, &_array, &_remaining, &_bufferOffset);
538 if (equation == NULL) {
539 char * _equationBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
540 equation = (GLfixed *) (_equationBase + _bufferOffset);
541 }
Jack Palevich27f80022009-04-15 19:13:17 -0700542 glClipPlanex(
543 (GLenum)plane,
544 (GLfixed *)equation
545 );
546 if (_array) {
547 releasePointer(_env, _array, equation, JNI_FALSE);
548 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700549 if (_exception) {
550 jniThrowException(_env, _exceptionType, _exceptionMessage);
551 }
Jack Palevich27f80022009-04-15 19:13:17 -0700552}
553
554/* void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) */
555static void
556android_glColor4ub__BBBB
557 (JNIEnv *_env, jobject _this, jbyte red, jbyte green, jbyte blue, jbyte alpha) {
558 glColor4ub(
559 (GLubyte)red,
560 (GLubyte)green,
561 (GLubyte)blue,
562 (GLubyte)alpha
563 );
564}
565
566/* void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
567static void
568android_glColorPointer__IIII
569 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
570 glColorPointer(
571 (GLint)size,
572 (GLenum)type,
573 (GLsizei)stride,
574 (const GLvoid *)offset
575 );
576}
577
578/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
579static void
580android_glDeleteBuffers__I_3II
581 (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700582 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800583 const char * _exceptionType = NULL;
584 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700585 GLuint *buffers_base = (GLuint *) 0;
586 jint _remaining;
587 GLuint *buffers = (GLuint *) 0;
588
589 if (!buffers_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700590 _exception = 1;
591 _exceptionType = "java/lang/IllegalArgumentException";
592 _exceptionMessage = "buffers == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700593 goto exit;
594 }
595 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700596 _exception = 1;
597 _exceptionType = "java/lang/IllegalArgumentException";
598 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700599 goto exit;
600 }
601 _remaining = _env->GetArrayLength(buffers_ref) - offset;
602 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700603 _exception = 1;
604 _exceptionType = "java/lang/IllegalArgumentException";
605 _exceptionMessage = "length - offset < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700606 goto exit;
607 }
608 buffers_base = (GLuint *)
609 _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
610 buffers = buffers_base + offset;
611
612 glDeleteBuffers(
613 (GLsizei)n,
614 (GLuint *)buffers
615 );
616
617exit:
618 if (buffers_base) {
619 _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
620 JNI_ABORT);
621 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700622 if (_exception) {
623 jniThrowException(_env, _exceptionType, _exceptionMessage);
624 }
Jack Palevich27f80022009-04-15 19:13:17 -0700625}
626
627/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
628static void
629android_glDeleteBuffers__ILjava_nio_IntBuffer_2
630 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700631 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800632 const char * _exceptionType = NULL;
633 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700634 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700635 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700636 jint _remaining;
637 GLuint *buffers = (GLuint *) 0;
638
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700639 buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -0700640 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700641 _exception = 1;
642 _exceptionType = "java/lang/IllegalArgumentException";
643 _exceptionMessage = "remaining() < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700644 goto exit;
645 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700646 if (buffers == NULL) {
647 char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
648 buffers = (GLuint *) (_buffersBase + _bufferOffset);
649 }
Jack Palevich27f80022009-04-15 19:13:17 -0700650 glDeleteBuffers(
651 (GLsizei)n,
652 (GLuint *)buffers
653 );
654
655exit:
656 if (_array) {
657 releasePointer(_env, _array, buffers, JNI_FALSE);
658 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700659 if (_exception) {
660 jniThrowException(_env, _exceptionType, _exceptionMessage);
661 }
Jack Palevich27f80022009-04-15 19:13:17 -0700662}
663
664/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */
665static void
666android_glDrawElements__IIII
667 (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700668 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800669 const char * _exceptionType = NULL;
670 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700671 glDrawElements(
672 (GLenum)mode,
673 (GLsizei)count,
674 (GLenum)type,
675 (const GLvoid *)offset
676 );
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700677 if (_exception) {
678 jniThrowException(_env, _exceptionType, _exceptionMessage);
679 }
Jack Palevich27f80022009-04-15 19:13:17 -0700680}
681
682/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
683static void
684android_glGenBuffers__I_3II
685 (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
686 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800687 const char * _exceptionType = NULL;
688 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700689 GLuint *buffers_base = (GLuint *) 0;
690 jint _remaining;
691 GLuint *buffers = (GLuint *) 0;
692
693 if (!buffers_ref) {
694 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700695 _exceptionType = "java/lang/IllegalArgumentException";
696 _exceptionMessage = "buffers == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700697 goto exit;
698 }
699 if (offset < 0) {
700 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700701 _exceptionType = "java/lang/IllegalArgumentException";
702 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700703 goto exit;
704 }
705 _remaining = _env->GetArrayLength(buffers_ref) - offset;
706 if (_remaining < n) {
707 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700708 _exceptionType = "java/lang/IllegalArgumentException";
709 _exceptionMessage = "length - offset < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700710 goto exit;
711 }
712 buffers_base = (GLuint *)
713 _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
714 buffers = buffers_base + offset;
715
716 glGenBuffers(
717 (GLsizei)n,
718 (GLuint *)buffers
719 );
720
721exit:
722 if (buffers_base) {
723 _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
724 _exception ? JNI_ABORT: 0);
725 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700726 if (_exception) {
727 jniThrowException(_env, _exceptionType, _exceptionMessage);
728 }
Jack Palevich27f80022009-04-15 19:13:17 -0700729}
730
731/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
732static void
733android_glGenBuffers__ILjava_nio_IntBuffer_2
734 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
735 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800736 const char * _exceptionType = NULL;
737 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700738 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700739 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700740 jint _remaining;
741 GLuint *buffers = (GLuint *) 0;
742
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700743 buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -0700744 if (_remaining < n) {
745 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700746 _exceptionType = "java/lang/IllegalArgumentException";
747 _exceptionMessage = "remaining() < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700748 goto exit;
749 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700750 if (buffers == NULL) {
751 char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
752 buffers = (GLuint *) (_buffersBase + _bufferOffset);
753 }
Jack Palevich27f80022009-04-15 19:13:17 -0700754 glGenBuffers(
755 (GLsizei)n,
756 (GLuint *)buffers
757 );
758
759exit:
760 if (_array) {
761 releasePointer(_env, _array, buffers, _exception ? JNI_FALSE : JNI_TRUE);
762 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700763 if (_exception) {
764 jniThrowException(_env, _exceptionType, _exceptionMessage);
765 }
Jack Palevich27f80022009-04-15 19:13:17 -0700766}
767
768/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
769static void
770android_glGetBooleanv__I_3ZI
771 (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
Mathias Agopian15284de2013-02-23 03:12:30 -0800772 get<jbooleanArray, GLboolean, glGetBooleanv>(_env, _this, pname, params_ref, offset);
Jack Palevich27f80022009-04-15 19:13:17 -0700773}
774
775/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
776static void
777android_glGetBooleanv__ILjava_nio_IntBuffer_2
778 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -0800779 getarray<GLboolean, glGetBooleanv>(_env, _this, pname, params_buf);
Jack Palevich27f80022009-04-15 19:13:17 -0700780}
Jack Palevich27f80022009-04-15 19:13:17 -0700781/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
782static void
783android_glGetBufferParameteriv__II_3II
784 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Jack Palevich73108672011-03-28 14:49:12 -0700785 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800786 const char * _exceptionType = NULL;
787 const char * _exceptionMessage = NULL;
Jack Palevich73108672011-03-28 14:49:12 -0700788 GLint *params_base = (GLint *) 0;
789 jint _remaining;
790 GLint *params = (GLint *) 0;
791
792 if (!params_ref) {
793 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700794 _exceptionType = "java/lang/IllegalArgumentException";
795 _exceptionMessage = "params == null";
Jack Palevich73108672011-03-28 14:49:12 -0700796 goto exit;
797 }
798 if (offset < 0) {
799 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700800 _exceptionType = "java/lang/IllegalArgumentException";
801 _exceptionMessage = "offset < 0";
Jack Palevich73108672011-03-28 14:49:12 -0700802 goto exit;
803 }
804 _remaining = _env->GetArrayLength(params_ref) - offset;
805 if (_remaining < 1) {
806 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700807 _exceptionType = "java/lang/IllegalArgumentException";
808 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich73108672011-03-28 14:49:12 -0700809 goto exit;
810 }
811 params_base = (GLint *)
812 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
813 params = params_base + offset;
814
815 glGetBufferParameteriv(
816 (GLenum)target,
817 (GLenum)pname,
818 (GLint *)params
819 );
820
821exit:
822 if (params_base) {
823 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
824 _exception ? JNI_ABORT: 0);
825 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700826 if (_exception) {
827 jniThrowException(_env, _exceptionType, _exceptionMessage);
828 }
Jack Palevich27f80022009-04-15 19:13:17 -0700829}
830
831/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
832static void
833android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
834 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Jack Palevich73108672011-03-28 14:49:12 -0700835 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800836 const char * _exceptionType = NULL;
837 const char * _exceptionMessage = NULL;
Jack Palevich73108672011-03-28 14:49:12 -0700838 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700839 jint _bufferOffset = (jint) 0;
Jack Palevich73108672011-03-28 14:49:12 -0700840 jint _remaining;
841 GLint *params = (GLint *) 0;
842
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700843 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich73108672011-03-28 14:49:12 -0700844 if (_remaining < 1) {
845 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700846 _exceptionType = "java/lang/IllegalArgumentException";
847 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich73108672011-03-28 14:49:12 -0700848 goto exit;
849 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700850 if (params == NULL) {
851 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
852 params = (GLint *) (_paramsBase + _bufferOffset);
853 }
Jack Palevich73108672011-03-28 14:49:12 -0700854 glGetBufferParameteriv(
855 (GLenum)target,
856 (GLenum)pname,
857 (GLint *)params
858 );
859
860exit:
861 if (_array) {
862 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
863 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700864 if (_exception) {
865 jniThrowException(_env, _exceptionType, _exceptionMessage);
866 }
Jack Palevich27f80022009-04-15 19:13:17 -0700867}
868
869/* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */
870static void
871android_glGetClipPlanef__I_3FI
872 (JNIEnv *_env, jobject _this, jint pname, jfloatArray eqn_ref, jint offset) {
873 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800874 const char * _exceptionType = NULL;
875 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700876 GLfloat *eqn_base = (GLfloat *) 0;
877 jint _remaining;
878 GLfloat *eqn = (GLfloat *) 0;
879
880 if (!eqn_ref) {
881 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700882 _exceptionType = "java/lang/IllegalArgumentException";
883 _exceptionMessage = "eqn == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700884 goto exit;
885 }
886 if (offset < 0) {
887 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700888 _exceptionType = "java/lang/IllegalArgumentException";
889 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700890 goto exit;
891 }
892 _remaining = _env->GetArrayLength(eqn_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -0800893 if (_remaining < 4) {
894 _exception = 1;
895 _exceptionType = "java/lang/IllegalArgumentException";
896 _exceptionMessage = "length - offset < 4 < needed";
897 goto exit;
898 }
Jack Palevich27f80022009-04-15 19:13:17 -0700899 eqn_base = (GLfloat *)
900 _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0);
901 eqn = eqn_base + offset;
902
903 glGetClipPlanef(
904 (GLenum)pname,
905 (GLfloat *)eqn
906 );
907
908exit:
909 if (eqn_base) {
910 _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base,
911 _exception ? JNI_ABORT: 0);
912 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700913 if (_exception) {
914 jniThrowException(_env, _exceptionType, _exceptionMessage);
915 }
Jack Palevich27f80022009-04-15 19:13:17 -0700916}
917
918/* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */
919static void
920android_glGetClipPlanef__ILjava_nio_FloatBuffer_2
921 (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -0800922 jint _exception = 0;
923 const char * _exceptionType = NULL;
924 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700925 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700926 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700927 jint _remaining;
928 GLfloat *eqn = (GLfloat *) 0;
929
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700930 eqn = (GLfloat *)getPointer(_env, eqn_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -0800931 if (_remaining < 4) {
932 _exception = 1;
933 _exceptionType = "java/lang/IllegalArgumentException";
934 _exceptionMessage = "remaining() < 4 < needed";
935 goto exit;
936 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700937 if (eqn == NULL) {
938 char * _eqnBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
939 eqn = (GLfloat *) (_eqnBase + _bufferOffset);
940 }
Jack Palevich27f80022009-04-15 19:13:17 -0700941 glGetClipPlanef(
942 (GLenum)pname,
943 (GLfloat *)eqn
944 );
Mathias Agopian15284de2013-02-23 03:12:30 -0800945
946exit:
Jack Palevich27f80022009-04-15 19:13:17 -0700947 if (_array) {
Mathias Agopian15284de2013-02-23 03:12:30 -0800948 releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE);
949 }
950 if (_exception) {
951 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich27f80022009-04-15 19:13:17 -0700952 }
953}
954
955/* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */
956static void
957android_glGetClipPlanex__I_3II
958 (JNIEnv *_env, jobject _this, jint pname, jintArray eqn_ref, jint offset) {
959 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800960 const char * _exceptionType = NULL;
961 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700962 GLfixed *eqn_base = (GLfixed *) 0;
963 jint _remaining;
964 GLfixed *eqn = (GLfixed *) 0;
965
966 if (!eqn_ref) {
967 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700968 _exceptionType = "java/lang/IllegalArgumentException";
969 _exceptionMessage = "eqn == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700970 goto exit;
971 }
972 if (offset < 0) {
973 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700974 _exceptionType = "java/lang/IllegalArgumentException";
975 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700976 goto exit;
977 }
978 _remaining = _env->GetArrayLength(eqn_ref) - offset;
Mathias Agopian15284de2013-02-23 03:12:30 -0800979 if (_remaining < 4) {
980 _exception = 1;
981 _exceptionType = "java/lang/IllegalArgumentException";
982 _exceptionMessage = "length - offset < 4 < needed";
983 goto exit;
984 }
Jack Palevich27f80022009-04-15 19:13:17 -0700985 eqn_base = (GLfixed *)
986 _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0);
987 eqn = eqn_base + offset;
988
989 glGetClipPlanex(
990 (GLenum)pname,
991 (GLfixed *)eqn
992 );
993
994exit:
995 if (eqn_base) {
996 _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base,
997 _exception ? JNI_ABORT: 0);
998 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700999 if (_exception) {
1000 jniThrowException(_env, _exceptionType, _exceptionMessage);
1001 }
Jack Palevich27f80022009-04-15 19:13:17 -07001002}
1003
1004/* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */
1005static void
1006android_glGetClipPlanex__ILjava_nio_IntBuffer_2
1007 (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08001008 jint _exception = 0;
1009 const char * _exceptionType = NULL;
1010 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001011 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001012 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001013 jint _remaining;
1014 GLfixed *eqn = (GLfixed *) 0;
1015
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001016 eqn = (GLfixed *)getPointer(_env, eqn_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian15284de2013-02-23 03:12:30 -08001017 if (_remaining < 4) {
1018 _exception = 1;
1019 _exceptionType = "java/lang/IllegalArgumentException";
1020 _exceptionMessage = "remaining() < 4 < needed";
1021 goto exit;
1022 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001023 if (eqn == NULL) {
1024 char * _eqnBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1025 eqn = (GLfixed *) (_eqnBase + _bufferOffset);
1026 }
Jack Palevich27f80022009-04-15 19:13:17 -07001027 glGetClipPlanex(
1028 (GLenum)pname,
1029 (GLfixed *)eqn
1030 );
Mathias Agopian15284de2013-02-23 03:12:30 -08001031
1032exit:
Jack Palevich27f80022009-04-15 19:13:17 -07001033 if (_array) {
Mathias Agopian15284de2013-02-23 03:12:30 -08001034 releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE);
1035 }
1036 if (_exception) {
1037 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich27f80022009-04-15 19:13:17 -07001038 }
1039}
1040
1041/* void glGetFixedv ( GLenum pname, GLfixed *params ) */
1042static void
1043android_glGetFixedv__I_3II
1044 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
1045 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001046 const char * _exceptionType = NULL;
1047 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001048 GLfixed *params_base = (GLfixed *) 0;
1049 jint _remaining;
1050 GLfixed *params = (GLfixed *) 0;
1051
1052 if (!params_ref) {
1053 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001054 _exceptionType = "java/lang/IllegalArgumentException";
1055 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001056 goto exit;
1057 }
1058 if (offset < 0) {
1059 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001060 _exceptionType = "java/lang/IllegalArgumentException";
1061 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001062 goto exit;
1063 }
1064 _remaining = _env->GetArrayLength(params_ref) - offset;
1065 params_base = (GLfixed *)
1066 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1067 params = params_base + offset;
1068
1069 glGetFixedv(
1070 (GLenum)pname,
1071 (GLfixed *)params
1072 );
1073
1074exit:
1075 if (params_base) {
1076 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1077 _exception ? JNI_ABORT: 0);
1078 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001079 if (_exception) {
1080 jniThrowException(_env, _exceptionType, _exceptionMessage);
1081 }
Jack Palevich27f80022009-04-15 19:13:17 -07001082}
1083
1084/* void glGetFixedv ( GLenum pname, GLfixed *params ) */
1085static void
1086android_glGetFixedv__ILjava_nio_IntBuffer_2
1087 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Jack Palevich27f80022009-04-15 19:13:17 -07001088 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001089 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001090 jint _remaining;
1091 GLfixed *params = (GLfixed *) 0;
1092
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001093 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
1094 if (params == NULL) {
1095 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1096 params = (GLfixed *) (_paramsBase + _bufferOffset);
1097 }
Jack Palevich27f80022009-04-15 19:13:17 -07001098 glGetFixedv(
1099 (GLenum)pname,
1100 (GLfixed *)params
1101 );
1102 if (_array) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001103 releasePointer(_env, _array, params, JNI_TRUE);
Jack Palevich27f80022009-04-15 19:13:17 -07001104 }
1105}
1106
1107/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
1108static void
1109android_glGetFloatv__I_3FI
1110 (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
Mathias Agopian15284de2013-02-23 03:12:30 -08001111 get<jfloatArray, GLfloat, glGetFloatv>(_env, _this, pname, params_ref, offset);
Jack Palevich27f80022009-04-15 19:13:17 -07001112}
1113
1114/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
1115static void
1116android_glGetFloatv__ILjava_nio_FloatBuffer_2
1117 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Mathias Agopian15284de2013-02-23 03:12:30 -08001118 getarray<GLfloat, glGetFloatv>(_env, _this, pname, params_buf);
Jack Palevich27f80022009-04-15 19:13:17 -07001119}
Jack Palevich27f80022009-04-15 19:13:17 -07001120/* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */
1121static void
1122android_glGetLightfv__II_3FI
1123 (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) {
1124 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001125 const char * _exceptionType = NULL;
1126 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001127 GLfloat *params_base = (GLfloat *) 0;
1128 jint _remaining;
1129 GLfloat *params = (GLfloat *) 0;
1130
1131 if (!params_ref) {
1132 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001133 _exceptionType = "java/lang/IllegalArgumentException";
1134 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001135 goto exit;
1136 }
1137 if (offset < 0) {
1138 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001139 _exceptionType = "java/lang/IllegalArgumentException";
1140 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001141 goto exit;
1142 }
1143 _remaining = _env->GetArrayLength(params_ref) - offset;
1144 int _needed;
1145 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001146#if defined(GL_SPOT_DIRECTION)
1147 case GL_SPOT_DIRECTION:
1148#endif // defined(GL_SPOT_DIRECTION)
1149 _needed = 3;
1150 break;
1151#if defined(GL_AMBIENT)
1152 case GL_AMBIENT:
1153#endif // defined(GL_AMBIENT)
1154#if defined(GL_DIFFUSE)
1155 case GL_DIFFUSE:
1156#endif // defined(GL_DIFFUSE)
1157#if defined(GL_SPECULAR)
1158 case GL_SPECULAR:
1159#endif // defined(GL_SPECULAR)
1160#if defined(GL_EMISSION)
1161 case GL_EMISSION:
1162#endif // defined(GL_EMISSION)
1163 _needed = 4;
1164 break;
1165 default:
Mathias Agopian15284de2013-02-23 03:12:30 -08001166 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001167 break;
1168 }
1169 if (_remaining < _needed) {
1170 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001171 _exceptionType = "java/lang/IllegalArgumentException";
1172 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001173 goto exit;
1174 }
1175 params_base = (GLfloat *)
1176 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1177 params = params_base + offset;
1178
1179 glGetLightfv(
1180 (GLenum)light,
1181 (GLenum)pname,
1182 (GLfloat *)params
1183 );
1184
1185exit:
1186 if (params_base) {
1187 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1188 _exception ? JNI_ABORT: 0);
1189 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001190 if (_exception) {
1191 jniThrowException(_env, _exceptionType, _exceptionMessage);
1192 }
Jack Palevich27f80022009-04-15 19:13:17 -07001193}
1194
1195/* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */
1196static void
1197android_glGetLightfv__IILjava_nio_FloatBuffer_2
1198 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
1199 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001200 const char * _exceptionType = NULL;
1201 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001202 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001203 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001204 jint _remaining;
1205 GLfloat *params = (GLfloat *) 0;
1206
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001207 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001208 int _needed;
1209 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001210#if defined(GL_SPOT_DIRECTION)
1211 case GL_SPOT_DIRECTION:
1212#endif // defined(GL_SPOT_DIRECTION)
1213 _needed = 3;
1214 break;
1215#if defined(GL_AMBIENT)
1216 case GL_AMBIENT:
1217#endif // defined(GL_AMBIENT)
1218#if defined(GL_DIFFUSE)
1219 case GL_DIFFUSE:
1220#endif // defined(GL_DIFFUSE)
1221#if defined(GL_SPECULAR)
1222 case GL_SPECULAR:
1223#endif // defined(GL_SPECULAR)
1224#if defined(GL_EMISSION)
1225 case GL_EMISSION:
1226#endif // defined(GL_EMISSION)
1227 _needed = 4;
1228 break;
1229 default:
Mathias Agopian15284de2013-02-23 03:12:30 -08001230 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001231 break;
1232 }
1233 if (_remaining < _needed) {
1234 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001235 _exceptionType = "java/lang/IllegalArgumentException";
1236 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001237 goto exit;
1238 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001239 if (params == NULL) {
1240 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1241 params = (GLfloat *) (_paramsBase + _bufferOffset);
1242 }
Jack Palevich27f80022009-04-15 19:13:17 -07001243 glGetLightfv(
1244 (GLenum)light,
1245 (GLenum)pname,
1246 (GLfloat *)params
1247 );
1248
1249exit:
1250 if (_array) {
1251 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1252 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001253 if (_exception) {
1254 jniThrowException(_env, _exceptionType, _exceptionMessage);
1255 }
Jack Palevich27f80022009-04-15 19:13:17 -07001256}
1257
1258/* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */
1259static void
1260android_glGetLightxv__II_3II
1261 (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) {
1262 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001263 const char * _exceptionType = NULL;
1264 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001265 GLfixed *params_base = (GLfixed *) 0;
1266 jint _remaining;
1267 GLfixed *params = (GLfixed *) 0;
1268
1269 if (!params_ref) {
1270 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001271 _exceptionType = "java/lang/IllegalArgumentException";
1272 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001273 goto exit;
1274 }
1275 if (offset < 0) {
1276 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001277 _exceptionType = "java/lang/IllegalArgumentException";
1278 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001279 goto exit;
1280 }
1281 _remaining = _env->GetArrayLength(params_ref) - offset;
1282 int _needed;
1283 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001284#if defined(GL_SPOT_DIRECTION)
1285 case GL_SPOT_DIRECTION:
1286#endif // defined(GL_SPOT_DIRECTION)
1287 _needed = 3;
1288 break;
1289#if defined(GL_AMBIENT)
1290 case GL_AMBIENT:
1291#endif // defined(GL_AMBIENT)
1292#if defined(GL_DIFFUSE)
1293 case GL_DIFFUSE:
1294#endif // defined(GL_DIFFUSE)
1295#if defined(GL_SPECULAR)
1296 case GL_SPECULAR:
1297#endif // defined(GL_SPECULAR)
1298#if defined(GL_EMISSION)
1299 case GL_EMISSION:
1300#endif // defined(GL_EMISSION)
1301 _needed = 4;
1302 break;
1303 default:
Mathias Agopian15284de2013-02-23 03:12:30 -08001304 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001305 break;
1306 }
1307 if (_remaining < _needed) {
1308 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001309 _exceptionType = "java/lang/IllegalArgumentException";
1310 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001311 goto exit;
1312 }
1313 params_base = (GLfixed *)
1314 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1315 params = params_base + offset;
1316
1317 glGetLightxv(
1318 (GLenum)light,
1319 (GLenum)pname,
1320 (GLfixed *)params
1321 );
1322
1323exit:
1324 if (params_base) {
1325 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1326 _exception ? JNI_ABORT: 0);
1327 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001328 if (_exception) {
1329 jniThrowException(_env, _exceptionType, _exceptionMessage);
1330 }
Jack Palevich27f80022009-04-15 19:13:17 -07001331}
1332
1333/* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */
1334static void
1335android_glGetLightxv__IILjava_nio_IntBuffer_2
1336 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
1337 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001338 const char * _exceptionType = NULL;
1339 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001340 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001341 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001342 jint _remaining;
1343 GLfixed *params = (GLfixed *) 0;
1344
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001345 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001346 int _needed;
1347 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001348#if defined(GL_SPOT_DIRECTION)
1349 case GL_SPOT_DIRECTION:
1350#endif // defined(GL_SPOT_DIRECTION)
1351 _needed = 3;
1352 break;
1353#if defined(GL_AMBIENT)
1354 case GL_AMBIENT:
1355#endif // defined(GL_AMBIENT)
1356#if defined(GL_DIFFUSE)
1357 case GL_DIFFUSE:
1358#endif // defined(GL_DIFFUSE)
1359#if defined(GL_SPECULAR)
1360 case GL_SPECULAR:
1361#endif // defined(GL_SPECULAR)
1362#if defined(GL_EMISSION)
1363 case GL_EMISSION:
1364#endif // defined(GL_EMISSION)
1365 _needed = 4;
1366 break;
1367 default:
Mathias Agopian15284de2013-02-23 03:12:30 -08001368 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001369 break;
1370 }
1371 if (_remaining < _needed) {
1372 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001373 _exceptionType = "java/lang/IllegalArgumentException";
1374 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001375 goto exit;
1376 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001377 if (params == NULL) {
1378 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1379 params = (GLfixed *) (_paramsBase + _bufferOffset);
1380 }
Jack Palevich27f80022009-04-15 19:13:17 -07001381 glGetLightxv(
1382 (GLenum)light,
1383 (GLenum)pname,
1384 (GLfixed *)params
1385 );
1386
1387exit:
1388 if (_array) {
1389 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1390 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001391 if (_exception) {
1392 jniThrowException(_env, _exceptionType, _exceptionMessage);
1393 }
Jack Palevich27f80022009-04-15 19:13:17 -07001394}
1395
1396/* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */
1397static void
1398android_glGetMaterialfv__II_3FI
1399 (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) {
1400 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001401 const char * _exceptionType = NULL;
1402 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001403 GLfloat *params_base = (GLfloat *) 0;
1404 jint _remaining;
1405 GLfloat *params = (GLfloat *) 0;
1406
1407 if (!params_ref) {
1408 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001409 _exceptionType = "java/lang/IllegalArgumentException";
1410 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001411 goto exit;
1412 }
1413 if (offset < 0) {
1414 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001415 _exceptionType = "java/lang/IllegalArgumentException";
1416 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001417 goto exit;
1418 }
1419 _remaining = _env->GetArrayLength(params_ref) - offset;
1420 int _needed;
1421 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001422#if defined(GL_AMBIENT)
1423 case GL_AMBIENT:
1424#endif // defined(GL_AMBIENT)
1425#if defined(GL_DIFFUSE)
1426 case GL_DIFFUSE:
1427#endif // defined(GL_DIFFUSE)
1428#if defined(GL_SPECULAR)
1429 case GL_SPECULAR:
1430#endif // defined(GL_SPECULAR)
1431#if defined(GL_EMISSION)
1432 case GL_EMISSION:
1433#endif // defined(GL_EMISSION)
1434#if defined(GL_AMBIENT_AND_DIFFUSE)
1435 case GL_AMBIENT_AND_DIFFUSE:
1436#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1437 _needed = 4;
1438 break;
1439 default:
Mathias Agopian15284de2013-02-23 03:12:30 -08001440 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001441 break;
1442 }
1443 if (_remaining < _needed) {
1444 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001445 _exceptionType = "java/lang/IllegalArgumentException";
1446 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001447 goto exit;
1448 }
1449 params_base = (GLfloat *)
1450 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1451 params = params_base + offset;
1452
1453 glGetMaterialfv(
1454 (GLenum)face,
1455 (GLenum)pname,
1456 (GLfloat *)params
1457 );
1458
1459exit:
1460 if (params_base) {
1461 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1462 _exception ? JNI_ABORT: 0);
1463 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001464 if (_exception) {
1465 jniThrowException(_env, _exceptionType, _exceptionMessage);
1466 }
Jack Palevich27f80022009-04-15 19:13:17 -07001467}
1468
1469/* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */
1470static void
1471android_glGetMaterialfv__IILjava_nio_FloatBuffer_2
1472 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
1473 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001474 const char * _exceptionType = NULL;
1475 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001476 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001477 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001478 jint _remaining;
1479 GLfloat *params = (GLfloat *) 0;
1480
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001481 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001482 int _needed;
1483 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001484#if defined(GL_AMBIENT)
1485 case GL_AMBIENT:
1486#endif // defined(GL_AMBIENT)
1487#if defined(GL_DIFFUSE)
1488 case GL_DIFFUSE:
1489#endif // defined(GL_DIFFUSE)
1490#if defined(GL_SPECULAR)
1491 case GL_SPECULAR:
1492#endif // defined(GL_SPECULAR)
1493#if defined(GL_EMISSION)
1494 case GL_EMISSION:
1495#endif // defined(GL_EMISSION)
1496#if defined(GL_AMBIENT_AND_DIFFUSE)
1497 case GL_AMBIENT_AND_DIFFUSE:
1498#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1499 _needed = 4;
1500 break;
1501 default:
Mathias Agopian15284de2013-02-23 03:12:30 -08001502 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001503 break;
1504 }
1505 if (_remaining < _needed) {
1506 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001507 _exceptionType = "java/lang/IllegalArgumentException";
1508 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001509 goto exit;
1510 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001511 if (params == NULL) {
1512 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1513 params = (GLfloat *) (_paramsBase + _bufferOffset);
1514 }
Jack Palevich27f80022009-04-15 19:13:17 -07001515 glGetMaterialfv(
1516 (GLenum)face,
1517 (GLenum)pname,
1518 (GLfloat *)params
1519 );
1520
1521exit:
1522 if (_array) {
1523 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1524 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001525 if (_exception) {
1526 jniThrowException(_env, _exceptionType, _exceptionMessage);
1527 }
Jack Palevich27f80022009-04-15 19:13:17 -07001528}
1529
1530/* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */
1531static void
1532android_glGetMaterialxv__II_3II
1533 (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) {
1534 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001535 const char * _exceptionType = NULL;
1536 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001537 GLfixed *params_base = (GLfixed *) 0;
1538 jint _remaining;
1539 GLfixed *params = (GLfixed *) 0;
1540
1541 if (!params_ref) {
1542 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001543 _exceptionType = "java/lang/IllegalArgumentException";
1544 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001545 goto exit;
1546 }
1547 if (offset < 0) {
1548 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001549 _exceptionType = "java/lang/IllegalArgumentException";
1550 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001551 goto exit;
1552 }
1553 _remaining = _env->GetArrayLength(params_ref) - offset;
1554 int _needed;
1555 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001556#if defined(GL_AMBIENT)
1557 case GL_AMBIENT:
1558#endif // defined(GL_AMBIENT)
1559#if defined(GL_DIFFUSE)
1560 case GL_DIFFUSE:
1561#endif // defined(GL_DIFFUSE)
1562#if defined(GL_SPECULAR)
1563 case GL_SPECULAR:
1564#endif // defined(GL_SPECULAR)
1565#if defined(GL_EMISSION)
1566 case GL_EMISSION:
1567#endif // defined(GL_EMISSION)
1568#if defined(GL_AMBIENT_AND_DIFFUSE)
1569 case GL_AMBIENT_AND_DIFFUSE:
1570#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1571 _needed = 4;
1572 break;
1573 default:
Mathias Agopian15284de2013-02-23 03:12:30 -08001574 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001575 break;
1576 }
1577 if (_remaining < _needed) {
1578 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001579 _exceptionType = "java/lang/IllegalArgumentException";
1580 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001581 goto exit;
1582 }
1583 params_base = (GLfixed *)
1584 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1585 params = params_base + offset;
1586
1587 glGetMaterialxv(
1588 (GLenum)face,
1589 (GLenum)pname,
1590 (GLfixed *)params
1591 );
1592
1593exit:
1594 if (params_base) {
1595 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1596 _exception ? JNI_ABORT: 0);
1597 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001598 if (_exception) {
1599 jniThrowException(_env, _exceptionType, _exceptionMessage);
1600 }
Jack Palevich27f80022009-04-15 19:13:17 -07001601}
1602
1603/* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */
1604static void
1605android_glGetMaterialxv__IILjava_nio_IntBuffer_2
1606 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
1607 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001608 const char * _exceptionType = NULL;
1609 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001610 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001611 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001612 jint _remaining;
1613 GLfixed *params = (GLfixed *) 0;
1614
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001615 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001616 int _needed;
1617 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001618#if defined(GL_AMBIENT)
1619 case GL_AMBIENT:
1620#endif // defined(GL_AMBIENT)
1621#if defined(GL_DIFFUSE)
1622 case GL_DIFFUSE:
1623#endif // defined(GL_DIFFUSE)
1624#if defined(GL_SPECULAR)
1625 case GL_SPECULAR:
1626#endif // defined(GL_SPECULAR)
1627#if defined(GL_EMISSION)
1628 case GL_EMISSION:
1629#endif // defined(GL_EMISSION)
1630#if defined(GL_AMBIENT_AND_DIFFUSE)
1631 case GL_AMBIENT_AND_DIFFUSE:
1632#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1633 _needed = 4;
1634 break;
1635 default:
Mathias Agopian15284de2013-02-23 03:12:30 -08001636 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001637 break;
1638 }
1639 if (_remaining < _needed) {
1640 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001641 _exceptionType = "java/lang/IllegalArgumentException";
1642 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001643 goto exit;
1644 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001645 if (params == NULL) {
1646 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1647 params = (GLfixed *) (_paramsBase + _bufferOffset);
1648 }
Jack Palevich27f80022009-04-15 19:13:17 -07001649 glGetMaterialxv(
1650 (GLenum)face,
1651 (GLenum)pname,
1652 (GLfixed *)params
1653 );
1654
1655exit:
1656 if (_array) {
1657 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1658 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001659 if (_exception) {
1660 jniThrowException(_env, _exceptionType, _exceptionMessage);
1661 }
Jack Palevich27f80022009-04-15 19:13:17 -07001662}
1663
1664/* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */
1665static void
1666android_glGetTexEnvfv__II_3FI
1667 (JNIEnv *_env, jobject _this, jint env, jint pname, jfloatArray params_ref, jint offset) {
1668 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001669 const char * _exceptionType = NULL;
1670 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001671 GLfloat *params_base = (GLfloat *) 0;
1672 jint _remaining;
1673 GLfloat *params = (GLfloat *) 0;
1674
1675 if (!params_ref) {
1676 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001677 _exceptionType = "java/lang/IllegalArgumentException";
1678 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001679 goto exit;
1680 }
1681 if (offset < 0) {
1682 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001683 _exceptionType = "java/lang/IllegalArgumentException";
1684 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001685 goto exit;
1686 }
1687 _remaining = _env->GetArrayLength(params_ref) - offset;
1688 int _needed;
1689 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001690#if defined(GL_TEXTURE_ENV_COLOR)
1691 case GL_TEXTURE_ENV_COLOR:
1692#endif // defined(GL_TEXTURE_ENV_COLOR)
1693 _needed = 4;
1694 break;
1695 default:
Mathias Agopian15284de2013-02-23 03:12:30 -08001696 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001697 break;
1698 }
1699 if (_remaining < _needed) {
1700 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001701 _exceptionType = "java/lang/IllegalArgumentException";
1702 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001703 goto exit;
1704 }
1705 params_base = (GLfloat *)
1706 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1707 params = params_base + offset;
1708
1709 glGetTexEnvfv(
1710 (GLenum)env,
1711 (GLenum)pname,
1712 (GLfloat *)params
1713 );
1714
1715exit:
1716 if (params_base) {
1717 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1718 _exception ? JNI_ABORT: 0);
1719 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001720 if (_exception) {
1721 jniThrowException(_env, _exceptionType, _exceptionMessage);
1722 }
Jack Palevich27f80022009-04-15 19:13:17 -07001723}
1724
1725/* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */
1726static void
1727android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2
1728 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
1729 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001730 const char * _exceptionType = NULL;
1731 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001732 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001733 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001734 jint _remaining;
1735 GLfloat *params = (GLfloat *) 0;
1736
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001737 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001738 int _needed;
1739 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001740#if defined(GL_TEXTURE_ENV_COLOR)
1741 case GL_TEXTURE_ENV_COLOR:
1742#endif // defined(GL_TEXTURE_ENV_COLOR)
1743 _needed = 4;
1744 break;
1745 default:
Mathias Agopian15284de2013-02-23 03:12:30 -08001746 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001747 break;
1748 }
1749 if (_remaining < _needed) {
1750 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001751 _exceptionType = "java/lang/IllegalArgumentException";
1752 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001753 goto exit;
1754 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001755 if (params == NULL) {
1756 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1757 params = (GLfloat *) (_paramsBase + _bufferOffset);
1758 }
Jack Palevich27f80022009-04-15 19:13:17 -07001759 glGetTexEnvfv(
1760 (GLenum)env,
1761 (GLenum)pname,
1762 (GLfloat *)params
1763 );
1764
1765exit:
1766 if (_array) {
1767 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1768 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001769 if (_exception) {
1770 jniThrowException(_env, _exceptionType, _exceptionMessage);
1771 }
Jack Palevich27f80022009-04-15 19:13:17 -07001772}
1773
1774/* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */
1775static void
1776android_glGetTexEnviv__II_3II
1777 (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) {
1778 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001779 const char * _exceptionType = NULL;
1780 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001781 GLint *params_base = (GLint *) 0;
1782 jint _remaining;
1783 GLint *params = (GLint *) 0;
1784
1785 if (!params_ref) {
1786 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001787 _exceptionType = "java/lang/IllegalArgumentException";
1788 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001789 goto exit;
1790 }
1791 if (offset < 0) {
1792 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001793 _exceptionType = "java/lang/IllegalArgumentException";
1794 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001795 goto exit;
1796 }
1797 _remaining = _env->GetArrayLength(params_ref) - offset;
1798 int _needed;
1799 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001800#if defined(GL_TEXTURE_ENV_COLOR)
1801 case GL_TEXTURE_ENV_COLOR:
1802#endif // defined(GL_TEXTURE_ENV_COLOR)
1803 _needed = 4;
1804 break;
1805 default:
Mathias Agopian15284de2013-02-23 03:12:30 -08001806 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001807 break;
1808 }
1809 if (_remaining < _needed) {
1810 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001811 _exceptionType = "java/lang/IllegalArgumentException";
1812 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001813 goto exit;
1814 }
1815 params_base = (GLint *)
1816 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1817 params = params_base + offset;
1818
1819 glGetTexEnviv(
1820 (GLenum)env,
1821 (GLenum)pname,
1822 (GLint *)params
1823 );
1824
1825exit:
1826 if (params_base) {
1827 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1828 _exception ? JNI_ABORT: 0);
1829 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001830 if (_exception) {
1831 jniThrowException(_env, _exceptionType, _exceptionMessage);
1832 }
Jack Palevich27f80022009-04-15 19:13:17 -07001833}
1834
1835/* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */
1836static void
1837android_glGetTexEnviv__IILjava_nio_IntBuffer_2
1838 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
1839 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001840 const char * _exceptionType = NULL;
1841 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001842 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001843 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001844 jint _remaining;
1845 GLint *params = (GLint *) 0;
1846
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001847 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001848 int _needed;
1849 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001850#if defined(GL_TEXTURE_ENV_COLOR)
1851 case GL_TEXTURE_ENV_COLOR:
1852#endif // defined(GL_TEXTURE_ENV_COLOR)
1853 _needed = 4;
1854 break;
1855 default:
Mathias Agopian15284de2013-02-23 03:12:30 -08001856 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001857 break;
1858 }
1859 if (_remaining < _needed) {
1860 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001861 _exceptionType = "java/lang/IllegalArgumentException";
1862 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001863 goto exit;
1864 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001865 if (params == NULL) {
1866 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1867 params = (GLint *) (_paramsBase + _bufferOffset);
1868 }
Jack Palevich27f80022009-04-15 19:13:17 -07001869 glGetTexEnviv(
1870 (GLenum)env,
1871 (GLenum)pname,
1872 (GLint *)params
1873 );
1874
1875exit:
1876 if (_array) {
1877 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1878 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001879 if (_exception) {
1880 jniThrowException(_env, _exceptionType, _exceptionMessage);
1881 }
Jack Palevich27f80022009-04-15 19:13:17 -07001882}
1883
1884/* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */
1885static void
1886android_glGetTexEnvxv__II_3II
1887 (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) {
1888 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001889 const char * _exceptionType = NULL;
1890 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001891 GLfixed *params_base = (GLfixed *) 0;
1892 jint _remaining;
1893 GLfixed *params = (GLfixed *) 0;
1894
1895 if (!params_ref) {
1896 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001897 _exceptionType = "java/lang/IllegalArgumentException";
1898 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001899 goto exit;
1900 }
1901 if (offset < 0) {
1902 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001903 _exceptionType = "java/lang/IllegalArgumentException";
1904 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001905 goto exit;
1906 }
1907 _remaining = _env->GetArrayLength(params_ref) - offset;
1908 int _needed;
1909 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001910#if defined(GL_TEXTURE_ENV_COLOR)
1911 case GL_TEXTURE_ENV_COLOR:
1912#endif // defined(GL_TEXTURE_ENV_COLOR)
1913 _needed = 4;
1914 break;
1915 default:
Mathias Agopian15284de2013-02-23 03:12:30 -08001916 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001917 break;
1918 }
1919 if (_remaining < _needed) {
1920 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001921 _exceptionType = "java/lang/IllegalArgumentException";
1922 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001923 goto exit;
1924 }
1925 params_base = (GLfixed *)
1926 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1927 params = params_base + offset;
1928
1929 glGetTexEnvxv(
1930 (GLenum)env,
1931 (GLenum)pname,
1932 (GLfixed *)params
1933 );
1934
1935exit:
1936 if (params_base) {
1937 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1938 _exception ? JNI_ABORT: 0);
1939 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001940 if (_exception) {
1941 jniThrowException(_env, _exceptionType, _exceptionMessage);
1942 }
Jack Palevich27f80022009-04-15 19:13:17 -07001943}
1944
1945/* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */
1946static void
1947android_glGetTexEnvxv__IILjava_nio_IntBuffer_2
1948 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
1949 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001950 const char * _exceptionType = NULL;
1951 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001952 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001953 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001954 jint _remaining;
1955 GLfixed *params = (GLfixed *) 0;
1956
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001957 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001958 int _needed;
1959 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001960#if defined(GL_TEXTURE_ENV_COLOR)
1961 case GL_TEXTURE_ENV_COLOR:
1962#endif // defined(GL_TEXTURE_ENV_COLOR)
1963 _needed = 4;
1964 break;
1965 default:
Mathias Agopian15284de2013-02-23 03:12:30 -08001966 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001967 break;
1968 }
1969 if (_remaining < _needed) {
1970 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001971 _exceptionType = "java/lang/IllegalArgumentException";
1972 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001973 goto exit;
1974 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001975 if (params == NULL) {
1976 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1977 params = (GLfixed *) (_paramsBase + _bufferOffset);
1978 }
Jack Palevich27f80022009-04-15 19:13:17 -07001979 glGetTexEnvxv(
1980 (GLenum)env,
1981 (GLenum)pname,
1982 (GLfixed *)params
1983 );
1984
1985exit:
1986 if (_array) {
1987 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1988 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001989 if (_exception) {
1990 jniThrowException(_env, _exceptionType, _exceptionMessage);
1991 }
Jack Palevich27f80022009-04-15 19:13:17 -07001992}
1993
1994/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
1995static void
1996android_glGetTexParameterfv__II_3FI
1997 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
1998 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001999 const char * _exceptionType = NULL;
2000 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002001 GLfloat *params_base = (GLfloat *) 0;
2002 jint _remaining;
2003 GLfloat *params = (GLfloat *) 0;
2004
2005 if (!params_ref) {
2006 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002007 _exceptionType = "java/lang/IllegalArgumentException";
2008 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002009 goto exit;
2010 }
2011 if (offset < 0) {
2012 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002013 _exceptionType = "java/lang/IllegalArgumentException";
2014 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002015 goto exit;
2016 }
2017 _remaining = _env->GetArrayLength(params_ref) - offset;
2018 if (_remaining < 1) {
2019 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002020 _exceptionType = "java/lang/IllegalArgumentException";
2021 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002022 goto exit;
2023 }
2024 params_base = (GLfloat *)
2025 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2026 params = params_base + offset;
2027
2028 glGetTexParameterfv(
2029 (GLenum)target,
2030 (GLenum)pname,
2031 (GLfloat *)params
2032 );
2033
2034exit:
2035 if (params_base) {
2036 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2037 _exception ? JNI_ABORT: 0);
2038 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002039 if (_exception) {
2040 jniThrowException(_env, _exceptionType, _exceptionMessage);
2041 }
Jack Palevich27f80022009-04-15 19:13:17 -07002042}
2043
2044/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
2045static void
2046android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2
2047 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2048 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002049 const char * _exceptionType = NULL;
2050 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002051 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002052 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002053 jint _remaining;
2054 GLfloat *params = (GLfloat *) 0;
2055
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002056 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002057 if (_remaining < 1) {
2058 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002059 _exceptionType = "java/lang/IllegalArgumentException";
2060 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002061 goto exit;
2062 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002063 if (params == NULL) {
2064 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2065 params = (GLfloat *) (_paramsBase + _bufferOffset);
2066 }
Jack Palevich27f80022009-04-15 19:13:17 -07002067 glGetTexParameterfv(
2068 (GLenum)target,
2069 (GLenum)pname,
2070 (GLfloat *)params
2071 );
2072
2073exit:
2074 if (_array) {
2075 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2076 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002077 if (_exception) {
2078 jniThrowException(_env, _exceptionType, _exceptionMessage);
2079 }
Jack Palevich27f80022009-04-15 19:13:17 -07002080}
2081
2082/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2083static void
2084android_glGetTexParameteriv__II_3II
2085 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2086 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002087 const char * _exceptionType = NULL;
2088 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002089 GLint *params_base = (GLint *) 0;
2090 jint _remaining;
2091 GLint *params = (GLint *) 0;
2092
2093 if (!params_ref) {
2094 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002095 _exceptionType = "java/lang/IllegalArgumentException";
2096 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002097 goto exit;
2098 }
2099 if (offset < 0) {
2100 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002101 _exceptionType = "java/lang/IllegalArgumentException";
2102 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002103 goto exit;
2104 }
2105 _remaining = _env->GetArrayLength(params_ref) - offset;
2106 if (_remaining < 1) {
2107 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002108 _exceptionType = "java/lang/IllegalArgumentException";
2109 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002110 goto exit;
2111 }
2112 params_base = (GLint *)
2113 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2114 params = params_base + offset;
2115
2116 glGetTexParameteriv(
2117 (GLenum)target,
2118 (GLenum)pname,
2119 (GLint *)params
2120 );
2121
2122exit:
2123 if (params_base) {
2124 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2125 _exception ? JNI_ABORT: 0);
2126 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002127 if (_exception) {
2128 jniThrowException(_env, _exceptionType, _exceptionMessage);
2129 }
Jack Palevich27f80022009-04-15 19:13:17 -07002130}
2131
2132/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2133static void
2134android_glGetTexParameteriv__IILjava_nio_IntBuffer_2
2135 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2136 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002137 const char * _exceptionType = NULL;
2138 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002139 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002140 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002141 jint _remaining;
2142 GLint *params = (GLint *) 0;
2143
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002144 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002145 if (_remaining < 1) {
2146 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002147 _exceptionType = "java/lang/IllegalArgumentException";
2148 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002149 goto exit;
2150 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002151 if (params == NULL) {
2152 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2153 params = (GLint *) (_paramsBase + _bufferOffset);
2154 }
Jack Palevich27f80022009-04-15 19:13:17 -07002155 glGetTexParameteriv(
2156 (GLenum)target,
2157 (GLenum)pname,
2158 (GLint *)params
2159 );
2160
2161exit:
2162 if (_array) {
2163 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2164 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002165 if (_exception) {
2166 jniThrowException(_env, _exceptionType, _exceptionMessage);
2167 }
Jack Palevich27f80022009-04-15 19:13:17 -07002168}
2169
2170/* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */
2171static void
2172android_glGetTexParameterxv__II_3II
2173 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2174 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002175 const char * _exceptionType = NULL;
2176 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002177 GLfixed *params_base = (GLfixed *) 0;
2178 jint _remaining;
2179 GLfixed *params = (GLfixed *) 0;
2180
2181 if (!params_ref) {
2182 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002183 _exceptionType = "java/lang/IllegalArgumentException";
2184 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002185 goto exit;
2186 }
2187 if (offset < 0) {
2188 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002189 _exceptionType = "java/lang/IllegalArgumentException";
2190 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002191 goto exit;
2192 }
2193 _remaining = _env->GetArrayLength(params_ref) - offset;
2194 if (_remaining < 1) {
2195 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002196 _exceptionType = "java/lang/IllegalArgumentException";
2197 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002198 goto exit;
2199 }
2200 params_base = (GLfixed *)
2201 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2202 params = params_base + offset;
2203
2204 glGetTexParameterxv(
2205 (GLenum)target,
2206 (GLenum)pname,
2207 (GLfixed *)params
2208 );
2209
2210exit:
2211 if (params_base) {
2212 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2213 _exception ? JNI_ABORT: 0);
2214 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002215 if (_exception) {
2216 jniThrowException(_env, _exceptionType, _exceptionMessage);
2217 }
Jack Palevich27f80022009-04-15 19:13:17 -07002218}
2219
2220/* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */
2221static void
2222android_glGetTexParameterxv__IILjava_nio_IntBuffer_2
2223 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2224 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002225 const char * _exceptionType = NULL;
2226 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002227 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002228 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002229 jint _remaining;
2230 GLfixed *params = (GLfixed *) 0;
2231
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002232 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002233 if (_remaining < 1) {
2234 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002235 _exceptionType = "java/lang/IllegalArgumentException";
2236 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002237 goto exit;
2238 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002239 if (params == NULL) {
2240 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2241 params = (GLfixed *) (_paramsBase + _bufferOffset);
2242 }
Jack Palevich27f80022009-04-15 19:13:17 -07002243 glGetTexParameterxv(
2244 (GLenum)target,
2245 (GLenum)pname,
2246 (GLfixed *)params
2247 );
2248
2249exit:
2250 if (_array) {
2251 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2252 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002253 if (_exception) {
2254 jniThrowException(_env, _exceptionType, _exceptionMessage);
2255 }
Jack Palevich27f80022009-04-15 19:13:17 -07002256}
2257
2258/* GLboolean glIsBuffer ( GLuint buffer ) */
2259static jboolean
2260android_glIsBuffer__I
2261 (JNIEnv *_env, jobject _this, jint buffer) {
2262 GLboolean _returnValue;
2263 _returnValue = glIsBuffer(
2264 (GLuint)buffer
2265 );
2266 return _returnValue;
2267}
2268
2269/* GLboolean glIsEnabled ( GLenum cap ) */
2270static jboolean
2271android_glIsEnabled__I
2272 (JNIEnv *_env, jobject _this, jint cap) {
2273 GLboolean _returnValue;
2274 _returnValue = glIsEnabled(
2275 (GLenum)cap
2276 );
2277 return _returnValue;
2278}
2279
2280/* GLboolean glIsTexture ( GLuint texture ) */
2281static jboolean
2282android_glIsTexture__I
2283 (JNIEnv *_env, jobject _this, jint texture) {
2284 GLboolean _returnValue;
2285 _returnValue = glIsTexture(
2286 (GLuint)texture
2287 );
2288 return _returnValue;
2289}
2290
2291/* void glNormalPointer ( GLenum type, GLsizei stride, GLint offset ) */
2292static void
2293android_glNormalPointer__III
2294 (JNIEnv *_env, jobject _this, jint type, jint stride, jint offset) {
2295 glNormalPointer(
2296 (GLenum)type,
2297 (GLsizei)stride,
2298 (const GLvoid *)offset
2299 );
2300}
2301
2302/* void glPointParameterf ( GLenum pname, GLfloat param ) */
2303static void
2304android_glPointParameterf__IF
2305 (JNIEnv *_env, jobject _this, jint pname, jfloat param) {
2306 glPointParameterf(
2307 (GLenum)pname,
2308 (GLfloat)param
2309 );
2310}
2311
2312/* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */
2313static void
2314android_glPointParameterfv__I_3FI
2315 (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002316 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002317 const char * _exceptionType = NULL;
2318 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002319 GLfloat *params_base = (GLfloat *) 0;
2320 jint _remaining;
2321 GLfloat *params = (GLfloat *) 0;
2322
2323 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002324 _exception = 1;
2325 _exceptionType = "java/lang/IllegalArgumentException";
2326 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002327 goto exit;
2328 }
2329 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002330 _exception = 1;
2331 _exceptionType = "java/lang/IllegalArgumentException";
2332 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002333 goto exit;
2334 }
2335 _remaining = _env->GetArrayLength(params_ref) - offset;
2336 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002337 _exception = 1;
2338 _exceptionType = "java/lang/IllegalArgumentException";
2339 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002340 goto exit;
2341 }
2342 params_base = (GLfloat *)
2343 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2344 params = params_base + offset;
2345
2346 glPointParameterfv(
2347 (GLenum)pname,
2348 (GLfloat *)params
2349 );
2350
2351exit:
2352 if (params_base) {
2353 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2354 JNI_ABORT);
2355 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002356 if (_exception) {
2357 jniThrowException(_env, _exceptionType, _exceptionMessage);
2358 }
Jack Palevich27f80022009-04-15 19:13:17 -07002359}
2360
2361/* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */
2362static void
2363android_glPointParameterfv__ILjava_nio_FloatBuffer_2
2364 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002365 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002366 const char * _exceptionType = NULL;
2367 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002368 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002369 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002370 jint _remaining;
2371 GLfloat *params = (GLfloat *) 0;
2372
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002373 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002374 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002375 _exception = 1;
2376 _exceptionType = "java/lang/IllegalArgumentException";
2377 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002378 goto exit;
2379 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002380 if (params == NULL) {
2381 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2382 params = (GLfloat *) (_paramsBase + _bufferOffset);
2383 }
Jack Palevich27f80022009-04-15 19:13:17 -07002384 glPointParameterfv(
2385 (GLenum)pname,
2386 (GLfloat *)params
2387 );
2388
2389exit:
2390 if (_array) {
2391 releasePointer(_env, _array, params, JNI_FALSE);
2392 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002393 if (_exception) {
2394 jniThrowException(_env, _exceptionType, _exceptionMessage);
2395 }
Jack Palevich27f80022009-04-15 19:13:17 -07002396}
2397
2398/* void glPointParameterx ( GLenum pname, GLfixed param ) */
2399static void
2400android_glPointParameterx__II
2401 (JNIEnv *_env, jobject _this, jint pname, jint param) {
2402 glPointParameterx(
2403 (GLenum)pname,
2404 (GLfixed)param
2405 );
2406}
2407
2408/* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */
2409static void
2410android_glPointParameterxv__I_3II
2411 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002412 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002413 const char * _exceptionType = NULL;
2414 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002415 GLfixed *params_base = (GLfixed *) 0;
2416 jint _remaining;
2417 GLfixed *params = (GLfixed *) 0;
2418
2419 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002420 _exception = 1;
2421 _exceptionType = "java/lang/IllegalArgumentException";
2422 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002423 goto exit;
2424 }
2425 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002426 _exception = 1;
2427 _exceptionType = "java/lang/IllegalArgumentException";
2428 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002429 goto exit;
2430 }
2431 _remaining = _env->GetArrayLength(params_ref) - offset;
2432 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002433 _exception = 1;
2434 _exceptionType = "java/lang/IllegalArgumentException";
2435 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002436 goto exit;
2437 }
2438 params_base = (GLfixed *)
2439 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2440 params = params_base + offset;
2441
2442 glPointParameterxv(
2443 (GLenum)pname,
2444 (GLfixed *)params
2445 );
2446
2447exit:
2448 if (params_base) {
2449 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2450 JNI_ABORT);
2451 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002452 if (_exception) {
2453 jniThrowException(_env, _exceptionType, _exceptionMessage);
2454 }
Jack Palevich27f80022009-04-15 19:13:17 -07002455}
2456
2457/* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */
2458static void
2459android_glPointParameterxv__ILjava_nio_IntBuffer_2
2460 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002461 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002462 const char * _exceptionType = NULL;
2463 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002464 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002465 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002466 jint _remaining;
2467 GLfixed *params = (GLfixed *) 0;
2468
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002469 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002470 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002471 _exception = 1;
2472 _exceptionType = "java/lang/IllegalArgumentException";
2473 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002474 goto exit;
2475 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002476 if (params == NULL) {
2477 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2478 params = (GLfixed *) (_paramsBase + _bufferOffset);
2479 }
Jack Palevich27f80022009-04-15 19:13:17 -07002480 glPointParameterxv(
2481 (GLenum)pname,
2482 (GLfixed *)params
2483 );
2484
2485exit:
2486 if (_array) {
2487 releasePointer(_env, _array, params, JNI_FALSE);
2488 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002489 if (_exception) {
2490 jniThrowException(_env, _exceptionType, _exceptionMessage);
2491 }
Jack Palevich27f80022009-04-15 19:13:17 -07002492}
2493
2494/* void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) */
2495static void
Jack Palevichbe6eac82009-12-08 15:43:51 +08002496android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I
2497 (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) {
Jack Palevich27f80022009-04-15 19:13:17 -07002498 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002499 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002500 jint _remaining;
2501 GLvoid *pointer = (GLvoid *) 0;
2502
Jack Palevichbe6eac82009-12-08 15:43:51 +08002503 if (pointer_buf) {
2504 pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
2505 if ( ! pointer ) {
2506 return;
2507 }
2508 }
2509 glPointSizePointerOESBounds(
Jack Palevich27f80022009-04-15 19:13:17 -07002510 (GLenum)type,
2511 (GLsizei)stride,
Jack Palevichbe6eac82009-12-08 15:43:51 +08002512 (GLvoid *)pointer,
2513 (GLsizei)remaining
Jack Palevich27f80022009-04-15 19:13:17 -07002514 );
Jack Palevich27f80022009-04-15 19:13:17 -07002515}
2516
2517/* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
2518static void
2519android_glTexCoordPointer__IIII
2520 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
2521 glTexCoordPointer(
2522 (GLint)size,
2523 (GLenum)type,
2524 (GLsizei)stride,
2525 (const GLvoid *)offset
2526 );
2527}
2528
2529/* void glTexEnvi ( GLenum target, GLenum pname, GLint param ) */
2530static void
2531android_glTexEnvi__III
2532 (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
2533 glTexEnvi(
2534 (GLenum)target,
2535 (GLenum)pname,
2536 (GLint)param
2537 );
2538}
2539
2540/* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */
2541static void
2542android_glTexEnviv__II_3II
2543 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002544 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002545 const char * _exceptionType = NULL;
2546 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002547 GLint *params_base = (GLint *) 0;
2548 jint _remaining;
2549 GLint *params = (GLint *) 0;
2550
2551 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002552 _exception = 1;
2553 _exceptionType = "java/lang/IllegalArgumentException";
2554 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002555 goto exit;
2556 }
2557 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002558 _exception = 1;
2559 _exceptionType = "java/lang/IllegalArgumentException";
2560 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002561 goto exit;
2562 }
2563 _remaining = _env->GetArrayLength(params_ref) - offset;
2564 int _needed;
2565 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002566#if defined(GL_TEXTURE_ENV_COLOR)
2567 case GL_TEXTURE_ENV_COLOR:
2568#endif // defined(GL_TEXTURE_ENV_COLOR)
2569 _needed = 4;
2570 break;
2571 default:
Mathias Agopian15284de2013-02-23 03:12:30 -08002572 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002573 break;
2574 }
2575 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002576 _exception = 1;
2577 _exceptionType = "java/lang/IllegalArgumentException";
2578 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002579 goto exit;
2580 }
2581 params_base = (GLint *)
2582 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2583 params = params_base + offset;
2584
2585 glTexEnviv(
2586 (GLenum)target,
2587 (GLenum)pname,
2588 (GLint *)params
2589 );
2590
2591exit:
2592 if (params_base) {
2593 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2594 JNI_ABORT);
2595 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002596 if (_exception) {
2597 jniThrowException(_env, _exceptionType, _exceptionMessage);
2598 }
Jack Palevich27f80022009-04-15 19:13:17 -07002599}
2600
2601/* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */
2602static void
2603android_glTexEnviv__IILjava_nio_IntBuffer_2
2604 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002605 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002606 const char * _exceptionType = NULL;
2607 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002608 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002609 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002610 jint _remaining;
2611 GLint *params = (GLint *) 0;
2612
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002613 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002614 int _needed;
2615 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002616#if defined(GL_TEXTURE_ENV_COLOR)
2617 case GL_TEXTURE_ENV_COLOR:
2618#endif // defined(GL_TEXTURE_ENV_COLOR)
2619 _needed = 4;
2620 break;
2621 default:
Mathias Agopian15284de2013-02-23 03:12:30 -08002622 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002623 break;
2624 }
2625 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002626 _exception = 1;
2627 _exceptionType = "java/lang/IllegalArgumentException";
2628 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002629 goto exit;
2630 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002631 if (params == NULL) {
2632 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2633 params = (GLint *) (_paramsBase + _bufferOffset);
2634 }
Jack Palevich27f80022009-04-15 19:13:17 -07002635 glTexEnviv(
2636 (GLenum)target,
2637 (GLenum)pname,
2638 (GLint *)params
2639 );
2640
2641exit:
2642 if (_array) {
2643 releasePointer(_env, _array, params, JNI_FALSE);
2644 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002645 if (_exception) {
2646 jniThrowException(_env, _exceptionType, _exceptionMessage);
2647 }
Jack Palevich27f80022009-04-15 19:13:17 -07002648}
2649
2650/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
2651static void
2652android_glTexParameterfv__II_3FI
2653 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002654 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002655 const char * _exceptionType = NULL;
2656 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002657 GLfloat *params_base = (GLfloat *) 0;
2658 jint _remaining;
2659 GLfloat *params = (GLfloat *) 0;
2660
2661 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002662 _exception = 1;
2663 _exceptionType = "java/lang/IllegalArgumentException";
2664 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002665 goto exit;
2666 }
2667 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002668 _exception = 1;
2669 _exceptionType = "java/lang/IllegalArgumentException";
2670 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002671 goto exit;
2672 }
2673 _remaining = _env->GetArrayLength(params_ref) - offset;
2674 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002675 _exception = 1;
2676 _exceptionType = "java/lang/IllegalArgumentException";
2677 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002678 goto exit;
2679 }
2680 params_base = (GLfloat *)
2681 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2682 params = params_base + offset;
2683
2684 glTexParameterfv(
2685 (GLenum)target,
2686 (GLenum)pname,
2687 (GLfloat *)params
2688 );
2689
2690exit:
2691 if (params_base) {
2692 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2693 JNI_ABORT);
2694 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002695 if (_exception) {
2696 jniThrowException(_env, _exceptionType, _exceptionMessage);
2697 }
Jack Palevich27f80022009-04-15 19:13:17 -07002698}
2699
2700/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
2701static void
2702android_glTexParameterfv__IILjava_nio_FloatBuffer_2
2703 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002704 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002705 const char * _exceptionType = NULL;
2706 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002707 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002708 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002709 jint _remaining;
2710 GLfloat *params = (GLfloat *) 0;
2711
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002712 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002713 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002714 _exception = 1;
2715 _exceptionType = "java/lang/IllegalArgumentException";
2716 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002717 goto exit;
2718 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002719 if (params == NULL) {
2720 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2721 params = (GLfloat *) (_paramsBase + _bufferOffset);
2722 }
Jack Palevich27f80022009-04-15 19:13:17 -07002723 glTexParameterfv(
2724 (GLenum)target,
2725 (GLenum)pname,
2726 (GLfloat *)params
2727 );
2728
2729exit:
2730 if (_array) {
2731 releasePointer(_env, _array, params, JNI_FALSE);
2732 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002733 if (_exception) {
2734 jniThrowException(_env, _exceptionType, _exceptionMessage);
2735 }
Jack Palevich27f80022009-04-15 19:13:17 -07002736}
2737
2738/* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */
2739static void
2740android_glTexParameteri__III
2741 (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
2742 glTexParameteri(
2743 (GLenum)target,
2744 (GLenum)pname,
2745 (GLint)param
2746 );
2747}
2748
2749/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
2750static void
2751android_glTexParameteriv__II_3II
2752 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002753 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002754 const char * _exceptionType = NULL;
2755 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002756 GLint *params_base = (GLint *) 0;
2757 jint _remaining;
2758 GLint *params = (GLint *) 0;
2759
2760 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002761 _exception = 1;
2762 _exceptionType = "java/lang/IllegalArgumentException";
2763 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002764 goto exit;
2765 }
2766 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002767 _exception = 1;
2768 _exceptionType = "java/lang/IllegalArgumentException";
2769 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002770 goto exit;
2771 }
2772 _remaining = _env->GetArrayLength(params_ref) - offset;
2773 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002774 _exception = 1;
2775 _exceptionType = "java/lang/IllegalArgumentException";
2776 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002777 goto exit;
2778 }
2779 params_base = (GLint *)
2780 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2781 params = params_base + offset;
2782
2783 glTexParameteriv(
2784 (GLenum)target,
2785 (GLenum)pname,
2786 (GLint *)params
2787 );
2788
2789exit:
2790 if (params_base) {
2791 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2792 JNI_ABORT);
2793 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002794 if (_exception) {
2795 jniThrowException(_env, _exceptionType, _exceptionMessage);
2796 }
Jack Palevich27f80022009-04-15 19:13:17 -07002797}
2798
2799/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
2800static void
2801android_glTexParameteriv__IILjava_nio_IntBuffer_2
2802 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002803 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002804 const char * _exceptionType = NULL;
2805 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002806 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002807 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002808 jint _remaining;
2809 GLint *params = (GLint *) 0;
2810
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002811 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002812 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002813 _exception = 1;
2814 _exceptionType = "java/lang/IllegalArgumentException";
2815 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002816 goto exit;
2817 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002818 if (params == NULL) {
2819 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2820 params = (GLint *) (_paramsBase + _bufferOffset);
2821 }
Jack Palevich27f80022009-04-15 19:13:17 -07002822 glTexParameteriv(
2823 (GLenum)target,
2824 (GLenum)pname,
2825 (GLint *)params
2826 );
2827
2828exit:
2829 if (_array) {
2830 releasePointer(_env, _array, params, JNI_FALSE);
2831 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002832 if (_exception) {
2833 jniThrowException(_env, _exceptionType, _exceptionMessage);
2834 }
Jack Palevich27f80022009-04-15 19:13:17 -07002835}
2836
2837/* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */
2838static void
2839android_glTexParameterxv__II_3II
2840 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002841 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002842 const char * _exceptionType = NULL;
2843 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002844 GLfixed *params_base = (GLfixed *) 0;
2845 jint _remaining;
2846 GLfixed *params = (GLfixed *) 0;
2847
2848 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002849 _exception = 1;
2850 _exceptionType = "java/lang/IllegalArgumentException";
2851 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002852 goto exit;
2853 }
2854 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002855 _exception = 1;
2856 _exceptionType = "java/lang/IllegalArgumentException";
2857 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002858 goto exit;
2859 }
2860 _remaining = _env->GetArrayLength(params_ref) - offset;
2861 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002862 _exception = 1;
2863 _exceptionType = "java/lang/IllegalArgumentException";
2864 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002865 goto exit;
2866 }
2867 params_base = (GLfixed *)
2868 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2869 params = params_base + offset;
2870
2871 glTexParameterxv(
2872 (GLenum)target,
2873 (GLenum)pname,
2874 (GLfixed *)params
2875 );
2876
2877exit:
2878 if (params_base) {
2879 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2880 JNI_ABORT);
2881 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002882 if (_exception) {
2883 jniThrowException(_env, _exceptionType, _exceptionMessage);
2884 }
Jack Palevich27f80022009-04-15 19:13:17 -07002885}
2886
2887/* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */
2888static void
2889android_glTexParameterxv__IILjava_nio_IntBuffer_2
2890 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002891 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08002892 const char * _exceptionType = NULL;
2893 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002894 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002895 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002896 jint _remaining;
2897 GLfixed *params = (GLfixed *) 0;
2898
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002899 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002900 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002901 _exception = 1;
2902 _exceptionType = "java/lang/IllegalArgumentException";
2903 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002904 goto exit;
2905 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002906 if (params == NULL) {
2907 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2908 params = (GLfixed *) (_paramsBase + _bufferOffset);
2909 }
Jack Palevich27f80022009-04-15 19:13:17 -07002910 glTexParameterxv(
2911 (GLenum)target,
2912 (GLenum)pname,
2913 (GLfixed *)params
2914 );
2915
2916exit:
2917 if (_array) {
2918 releasePointer(_env, _array, params, JNI_FALSE);
2919 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002920 if (_exception) {
2921 jniThrowException(_env, _exceptionType, _exceptionMessage);
2922 }
Jack Palevich27f80022009-04-15 19:13:17 -07002923}
2924
2925/* void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
2926static void
2927android_glVertexPointer__IIII
2928 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
2929 glVertexPointer(
2930 (GLint)size,
2931 (GLenum)type,
2932 (GLsizei)stride,
2933 (const GLvoid *)offset
2934 );
2935}
2936
2937static const char *classPathName = "android/opengl/GLES11";
2938
2939static JNINativeMethod methods[] = {
2940{"_nativeClassInit", "()V", (void*)nativeClassInit },
2941{"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II },
2942{"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I },
2943{"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 },
2944{"glClipPlanef", "(I[FI)V", (void *) android_glClipPlanef__I_3FI },
2945{"glClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glClipPlanef__ILjava_nio_FloatBuffer_2 },
2946{"glClipPlanex", "(I[II)V", (void *) android_glClipPlanex__I_3II },
2947{"glClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glClipPlanex__ILjava_nio_IntBuffer_2 },
2948{"glColor4ub", "(BBBB)V", (void *) android_glColor4ub__BBBB },
2949{"glColorPointer", "(IIII)V", (void *) android_glColorPointer__IIII },
2950{"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II },
2951{"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 },
2952{"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII },
2953{"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II },
2954{"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 },
2955{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI },
2956{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 },
2957{"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II },
2958{"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 },
2959{"glGetClipPlanef", "(I[FI)V", (void *) android_glGetClipPlanef__I_3FI },
2960{"glGetClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetClipPlanef__ILjava_nio_FloatBuffer_2 },
2961{"glGetClipPlanex", "(I[II)V", (void *) android_glGetClipPlanex__I_3II },
2962{"glGetClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetClipPlanex__ILjava_nio_IntBuffer_2 },
2963{"glGetFixedv", "(I[II)V", (void *) android_glGetFixedv__I_3II },
2964{"glGetFixedv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetFixedv__ILjava_nio_IntBuffer_2 },
2965{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI },
2966{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 },
2967{"glGetLightfv", "(II[FI)V", (void *) android_glGetLightfv__II_3FI },
2968{"glGetLightfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetLightfv__IILjava_nio_FloatBuffer_2 },
2969{"glGetLightxv", "(II[II)V", (void *) android_glGetLightxv__II_3II },
2970{"glGetLightxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetLightxv__IILjava_nio_IntBuffer_2 },
2971{"glGetMaterialfv", "(II[FI)V", (void *) android_glGetMaterialfv__II_3FI },
2972{"glGetMaterialfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetMaterialfv__IILjava_nio_FloatBuffer_2 },
2973{"glGetMaterialxv", "(II[II)V", (void *) android_glGetMaterialxv__II_3II },
2974{"glGetMaterialxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetMaterialxv__IILjava_nio_IntBuffer_2 },
2975{"glGetTexEnvfv", "(II[FI)V", (void *) android_glGetTexEnvfv__II_3FI },
2976{"glGetTexEnvfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2 },
2977{"glGetTexEnviv", "(II[II)V", (void *) android_glGetTexEnviv__II_3II },
2978{"glGetTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnviv__IILjava_nio_IntBuffer_2 },
2979{"glGetTexEnvxv", "(II[II)V", (void *) android_glGetTexEnvxv__II_3II },
2980{"glGetTexEnvxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnvxv__IILjava_nio_IntBuffer_2 },
2981{"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI },
2982{"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 },
2983{"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II },
2984{"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 },
2985{"glGetTexParameterxv", "(II[II)V", (void *) android_glGetTexParameterxv__II_3II },
2986{"glGetTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameterxv__IILjava_nio_IntBuffer_2 },
2987{"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I },
2988{"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I },
2989{"glIsTexture", "(I)Z", (void *) android_glIsTexture__I },
2990{"glNormalPointer", "(III)V", (void *) android_glNormalPointer__III },
2991{"glPointParameterf", "(IF)V", (void *) android_glPointParameterf__IF },
2992{"glPointParameterfv", "(I[FI)V", (void *) android_glPointParameterfv__I_3FI },
2993{"glPointParameterfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glPointParameterfv__ILjava_nio_FloatBuffer_2 },
2994{"glPointParameterx", "(II)V", (void *) android_glPointParameterx__II },
2995{"glPointParameterxv", "(I[II)V", (void *) android_glPointParameterxv__I_3II },
2996{"glPointParameterxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glPointParameterxv__ILjava_nio_IntBuffer_2 },
Jack Palevichbe6eac82009-12-08 15:43:51 +08002997{"glPointSizePointerOESBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I },
Jack Palevich27f80022009-04-15 19:13:17 -07002998{"glTexCoordPointer", "(IIII)V", (void *) android_glTexCoordPointer__IIII },
2999{"glTexEnvi", "(III)V", (void *) android_glTexEnvi__III },
3000{"glTexEnviv", "(II[II)V", (void *) android_glTexEnviv__II_3II },
3001{"glTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexEnviv__IILjava_nio_IntBuffer_2 },
3002{"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI },
3003{"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 },
3004{"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III },
3005{"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II },
3006{"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 },
3007{"glTexParameterxv", "(II[II)V", (void *) android_glTexParameterxv__II_3II },
3008{"glTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameterxv__IILjava_nio_IntBuffer_2 },
3009{"glVertexPointer", "(IIII)V", (void *) android_glVertexPointer__IIII },
3010};
3011
3012int register_android_opengl_jni_GLES11(JNIEnv *_env)
3013{
3014 int err;
3015 err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
3016 return err;
3017}