blob: 871e84d19f8539a96703d9457789b71acf238bab [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 Agopian2ad04772013-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 Agopian2ad04772013-02-23 03:12:30 -080040
41/* special calls implemented in Android's GLES wrapper used to more
42 * efficiently bound-check passed arrays */
43extern "C" {
44#ifdef GL_VERSION_ES_CM_1_1
45GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
46 const GLvoid *ptr, GLsizei count);
47GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
48 const GLvoid *pointer, GLsizei count);
49GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
50 GLsizei stride, const GLvoid *pointer, GLsizei count);
51GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
52 GLsizei stride, const GLvoid *pointer, GLsizei count);
53GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
54 GLsizei stride, const GLvoid *pointer, GLsizei count);
55GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
56 GLsizei stride, const GLvoid *pointer, GLsizei count);
57GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
58 GLsizei stride, const GLvoid *pointer, GLsizei count);
59#endif
60#ifdef GL_ES_VERSION_2_0
61static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type,
62 GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) {
63 glVertexAttribPointer(indx, size, type, normalized, stride, pointer);
64}
65#endif
Andy McFaddencee51982013-04-25 16:08:31 -070066#ifdef GL_ES_VERSION_3_0
67static void glVertexAttribIPointerBounds(GLuint indx, GLint size, GLenum type,
68 GLsizei stride, const GLvoid *pointer, GLsizei count) {
69 glVertexAttribIPointer(indx, size, type, stride, pointer);
70}
71#endif
Mathias Agopian2ad04772013-02-23 03:12:30 -080072}
73
Jack Palevich27f80022009-04-15 19:13:17 -070074/* Cache method IDs each time the class is loaded. */
75
76static void
Elliott Hughes24ce5fb2011-04-08 20:01:01 -070077nativeClassInit(JNIEnv *_env, jclass glImplClass)
Jack Palevich27f80022009-04-15 19:13:17 -070078{
79 jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
80 nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
81
82 jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
83 bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
84
85 getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
86 "getBasePointer", "(Ljava/nio/Buffer;)J");
87 getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
88 "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
89 getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
90 "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
91
92 positionID = _env->GetFieldID(bufferClass, "position", "I");
93 limitID = _env->GetFieldID(bufferClass, "limit", "I");
94 elementSizeShiftID =
95 _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
96}
97
Jack Palevich27f80022009-04-15 19:13:17 -070098static void *
Thomas Tafertshofer17045a12012-07-12 13:55:55 -070099getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
Jack Palevich27f80022009-04-15 19:13:17 -0700100{
101 jint position;
102 jint limit;
103 jint elementSizeShift;
104 jlong pointer;
Jack Palevich27f80022009-04-15 19:13:17 -0700105
106 position = _env->GetIntField(buffer, positionID);
107 limit = _env->GetIntField(buffer, limitID);
108 elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
109 *remaining = (limit - position) << elementSizeShift;
110 pointer = _env->CallStaticLongMethod(nioAccessClass,
111 getBasePointerID, buffer);
112 if (pointer != 0L) {
113 *array = NULL;
114 return (void *) (jint) pointer;
115 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700116
Jack Palevich27f80022009-04-15 19:13:17 -0700117 *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
118 getBaseArrayID, buffer);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700119 *offset = _env->CallStaticIntMethod(nioAccessClass,
Jack Palevich27f80022009-04-15 19:13:17 -0700120 getBaseArrayOffsetID, buffer);
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700121
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700122 return NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700123}
124
Jack Palevich27f80022009-04-15 19:13:17 -0700125static void
126releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
127{
128 _env->ReleasePrimitiveArrayCritical(array, data,
Mathias Agopian2ad04772013-02-23 03:12:30 -0800129 commit ? 0 : JNI_ABORT);
Jack Palevich27f80022009-04-15 19:13:17 -0700130}
131
Jack Palevichbe6eac82009-12-08 15:43:51 +0800132static void *
133getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
134 char* buf = (char*) _env->GetDirectBufferAddress(buffer);
135 if (buf) {
136 jint position = _env->GetIntField(buffer, positionID);
137 jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
138 buf += position << elementSizeShift;
139 } else {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700140 jniThrowException(_env, "java/lang/IllegalArgumentException",
141 "Must use a native order direct Buffer");
Jack Palevichbe6eac82009-12-08 15:43:51 +0800142 }
143 return (void*) buf;
144}
145
Jack Palevich27f80022009-04-15 19:13:17 -0700146// --------------------------------------------------------------------------
Mathias Agopian2ad04772013-02-23 03:12:30 -0800147
148/*
149 * returns the number of values glGet returns for a given pname.
150 *
151 * The code below is written such that pnames requiring only one values
152 * are the default (and are not explicitely tested for). This makes the
153 * checking code much shorter/readable/efficient.
154 *
155 * This means that unknown pnames (e.g.: extensions) will default to 1. If
156 * that unknown pname needs more than 1 value, then the validation check
157 * is incomplete and the app may crash if it passed the wrong number params.
158 */
159static int getNeededCount(GLint pname) {
160 int needed = 1;
161#ifdef GL_ES_VERSION_2_0
162 // GLES 2.x pnames
163 switch (pname) {
164 case GL_ALIASED_LINE_WIDTH_RANGE:
165 case GL_ALIASED_POINT_SIZE_RANGE:
166 needed = 2;
167 break;
168
169 case GL_BLEND_COLOR:
170 case GL_COLOR_CLEAR_VALUE:
171 case GL_COLOR_WRITEMASK:
172 case GL_SCISSOR_BOX:
173 case GL_VIEWPORT:
174 needed = 4;
175 break;
176
177 case GL_COMPRESSED_TEXTURE_FORMATS:
178 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
179 break;
180
181 case GL_SHADER_BINARY_FORMATS:
182 glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed);
183 break;
184 }
185#endif
186
187#ifdef GL_VERSION_ES_CM_1_1
188 // GLES 1.x pnames
189 switch (pname) {
190 case GL_ALIASED_LINE_WIDTH_RANGE:
191 case GL_ALIASED_POINT_SIZE_RANGE:
192 case GL_DEPTH_RANGE:
193 case GL_SMOOTH_LINE_WIDTH_RANGE:
194 case GL_SMOOTH_POINT_SIZE_RANGE:
195 needed = 2;
196 break;
197
198 case GL_CURRENT_NORMAL:
199 case GL_POINT_DISTANCE_ATTENUATION:
200 needed = 3;
201 break;
202
203 case GL_COLOR_CLEAR_VALUE:
204 case GL_COLOR_WRITEMASK:
205 case GL_CURRENT_COLOR:
206 case GL_CURRENT_TEXTURE_COORDS:
207 case GL_FOG_COLOR:
208 case GL_LIGHT_MODEL_AMBIENT:
209 case GL_SCISSOR_BOX:
210 case GL_VIEWPORT:
211 needed = 4;
212 break;
213
214 case GL_MODELVIEW_MATRIX:
215 case GL_PROJECTION_MATRIX:
216 case GL_TEXTURE_MATRIX:
217 needed = 16;
218 break;
219
220 case GL_COMPRESSED_TEXTURE_FORMATS:
221 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
222 break;
223 }
224#endif
225 return needed;
226}
227
228template <typename JTYPEARRAY, typename CTYPE, void GET(GLenum, CTYPE*)>
229static void
230get
231 (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
232 jint _exception = 0;
233 const char * _exceptionType;
234 const char * _exceptionMessage;
235 CTYPE *params_base = (CTYPE *) 0;
236 jint _remaining;
237 CTYPE *params = (CTYPE *) 0;
238 int _needed = 0;
239
240 if (!params_ref) {
241 _exception = 1;
242 _exceptionType = "java/lang/IllegalArgumentException";
243 _exceptionMessage = "params == null";
244 goto exit;
245 }
246 if (offset < 0) {
247 _exception = 1;
248 _exceptionType = "java/lang/IllegalArgumentException";
249 _exceptionMessage = "offset < 0";
250 goto exit;
251 }
252 _remaining = _env->GetArrayLength(params_ref) - offset;
253 _needed = getNeededCount(pname);
254 // if we didn't find this pname, we just assume the user passed
255 // an array of the right size -- this might happen with extensions
256 // or if we forget an enum here.
257 if (_remaining < _needed) {
258 _exception = 1;
259 _exceptionType = "java/lang/IllegalArgumentException";
260 _exceptionMessage = "length - offset < needed";
261 goto exit;
262 }
263 params_base = (CTYPE *)
264 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
265 params = params_base + offset;
266
267 GET(
268 (GLenum)pname,
269 (CTYPE *)params
270 );
271
272exit:
273 if (params_base) {
274 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
275 _exception ? JNI_ABORT: 0);
276 }
277 if (_exception) {
278 jniThrowException(_env, _exceptionType, _exceptionMessage);
279 }
280}
281
282
283template <typename CTYPE, void GET(GLenum, CTYPE*)>
284static void
285getarray
286 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
287 jint _exception = 0;
288 const char * _exceptionType;
289 const char * _exceptionMessage;
290 jarray _array = (jarray) 0;
291 jint _bufferOffset = (jint) 0;
292 jint _remaining;
293 CTYPE *params = (CTYPE *) 0;
294 int _needed = 0;
295
296 params = (CTYPE *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Andy McFaddencee51982013-04-25 16:08:31 -0700297 _remaining /= sizeof(CTYPE); // convert from bytes to item count
Mathias Agopian2ad04772013-02-23 03:12:30 -0800298 _needed = getNeededCount(pname);
299 // if we didn't find this pname, we just assume the user passed
300 // an array of the right size -- this might happen with extensions
301 // or if we forget an enum here.
302 if (_needed>0 && _remaining < _needed) {
303 _exception = 1;
304 _exceptionType = "java/lang/IllegalArgumentException";
305 _exceptionMessage = "remaining() < needed";
306 goto exit;
307 }
308 if (params == NULL) {
309 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
310 params = (CTYPE *) (_paramsBase + _bufferOffset);
311 }
312 GET(
313 (GLenum)pname,
314 (CTYPE *)params
315 );
316
317exit:
318 if (_array) {
319 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
320 }
321 if (_exception) {
322 jniThrowException(_env, _exceptionType, _exceptionMessage);
323 }
324}
325
326// --------------------------------------------------------------------------
Jack Palevich27f80022009-04-15 19:13:17 -0700327/* void glBindBuffer ( GLenum target, GLuint buffer ) */
328static void
329android_glBindBuffer__II
330 (JNIEnv *_env, jobject _this, jint target, jint buffer) {
331 glBindBuffer(
332 (GLenum)target,
333 (GLuint)buffer
334 );
335}
336
337/* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */
338static void
339android_glBufferData__IILjava_nio_Buffer_2I
340 (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700341 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800342 const char * _exceptionType = NULL;
343 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700344 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700345 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700346 jint _remaining;
347 GLvoid *data = (GLvoid *) 0;
348
349 if (data_buf) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700350 data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevichc620a522009-10-21 11:02:44 -0700351 if (_remaining < size) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700352 _exception = 1;
353 _exceptionType = "java/lang/IllegalArgumentException";
354 _exceptionMessage = "remaining() < size < needed";
Jack Palevichc620a522009-10-21 11:02:44 -0700355 goto exit;
356 }
Jack Palevich27f80022009-04-15 19:13:17 -0700357 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -0700358 if (data_buf && data == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700359 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
360 data = (GLvoid *) (_dataBase + _bufferOffset);
361 }
Jack Palevich27f80022009-04-15 19:13:17 -0700362 glBufferData(
363 (GLenum)target,
364 (GLsizeiptr)size,
365 (GLvoid *)data,
366 (GLenum)usage
367 );
Jack Palevichc620a522009-10-21 11:02:44 -0700368
369exit:
Jack Palevich27f80022009-04-15 19:13:17 -0700370 if (_array) {
371 releasePointer(_env, _array, data, JNI_FALSE);
372 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700373 if (_exception) {
374 jniThrowException(_env, _exceptionType, _exceptionMessage);
375 }
Jack Palevich27f80022009-04-15 19:13:17 -0700376}
377
378/* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */
379static void
380android_glBufferSubData__IIILjava_nio_Buffer_2
381 (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700382 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800383 const char * _exceptionType = NULL;
384 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700385 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700386 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700387 jint _remaining;
388 GLvoid *data = (GLvoid *) 0;
389
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700390 data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevichc620a522009-10-21 11:02:44 -0700391 if (_remaining < size) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700392 _exception = 1;
393 _exceptionType = "java/lang/IllegalArgumentException";
394 _exceptionMessage = "remaining() < size < needed";
Jack Palevichc620a522009-10-21 11:02:44 -0700395 goto exit;
396 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700397 if (data == NULL) {
398 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
399 data = (GLvoid *) (_dataBase + _bufferOffset);
400 }
Jack Palevich27f80022009-04-15 19:13:17 -0700401 glBufferSubData(
402 (GLenum)target,
403 (GLintptr)offset,
404 (GLsizeiptr)size,
405 (GLvoid *)data
406 );
Jack Palevichc620a522009-10-21 11:02:44 -0700407
408exit:
Jack Palevich27f80022009-04-15 19:13:17 -0700409 if (_array) {
410 releasePointer(_env, _array, data, JNI_FALSE);
411 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700412 if (_exception) {
413 jniThrowException(_env, _exceptionType, _exceptionMessage);
414 }
Jack Palevich27f80022009-04-15 19:13:17 -0700415}
416
417/* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */
418static void
419android_glClipPlanef__I_3FI
420 (JNIEnv *_env, jobject _this, jint plane, jfloatArray equation_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700421 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800422 const char * _exceptionType = NULL;
423 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700424 GLfloat *equation_base = (GLfloat *) 0;
425 jint _remaining;
426 GLfloat *equation = (GLfloat *) 0;
427
428 if (!equation_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700429 _exception = 1;
430 _exceptionType = "java/lang/IllegalArgumentException";
431 _exceptionMessage = "equation == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700432 goto exit;
433 }
434 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700435 _exception = 1;
436 _exceptionType = "java/lang/IllegalArgumentException";
437 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700438 goto exit;
439 }
440 _remaining = _env->GetArrayLength(equation_ref) - offset;
441 equation_base = (GLfloat *)
442 _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0);
443 equation = equation_base + offset;
444
445 glClipPlanef(
446 (GLenum)plane,
447 (GLfloat *)equation
448 );
449
450exit:
451 if (equation_base) {
452 _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base,
453 JNI_ABORT);
454 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700455 if (_exception) {
456 jniThrowException(_env, _exceptionType, _exceptionMessage);
457 }
Jack Palevich27f80022009-04-15 19:13:17 -0700458}
459
460/* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */
461static void
462android_glClipPlanef__ILjava_nio_FloatBuffer_2
463 (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700464 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800465 const char * _exceptionType = NULL;
466 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700467 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700468 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700469 jint _remaining;
470 GLfloat *equation = (GLfloat *) 0;
471
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700472 equation = (GLfloat *)getPointer(_env, equation_buf, &_array, &_remaining, &_bufferOffset);
473 if (equation == NULL) {
474 char * _equationBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
475 equation = (GLfloat *) (_equationBase + _bufferOffset);
476 }
Jack Palevich27f80022009-04-15 19:13:17 -0700477 glClipPlanef(
478 (GLenum)plane,
479 (GLfloat *)equation
480 );
481 if (_array) {
482 releasePointer(_env, _array, equation, JNI_FALSE);
483 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700484 if (_exception) {
485 jniThrowException(_env, _exceptionType, _exceptionMessage);
486 }
Jack Palevich27f80022009-04-15 19:13:17 -0700487}
488
489/* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */
490static void
491android_glClipPlanex__I_3II
492 (JNIEnv *_env, jobject _this, jint plane, jintArray equation_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700493 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800494 const char * _exceptionType = NULL;
495 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700496 GLfixed *equation_base = (GLfixed *) 0;
497 jint _remaining;
498 GLfixed *equation = (GLfixed *) 0;
499
500 if (!equation_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700501 _exception = 1;
502 _exceptionType = "java/lang/IllegalArgumentException";
503 _exceptionMessage = "equation == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700504 goto exit;
505 }
506 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700507 _exception = 1;
508 _exceptionType = "java/lang/IllegalArgumentException";
509 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700510 goto exit;
511 }
512 _remaining = _env->GetArrayLength(equation_ref) - offset;
513 equation_base = (GLfixed *)
514 _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0);
515 equation = equation_base + offset;
516
517 glClipPlanex(
518 (GLenum)plane,
519 (GLfixed *)equation
520 );
521
522exit:
523 if (equation_base) {
524 _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base,
525 JNI_ABORT);
526 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700527 if (_exception) {
528 jniThrowException(_env, _exceptionType, _exceptionMessage);
529 }
Jack Palevich27f80022009-04-15 19:13:17 -0700530}
531
532/* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */
533static void
534android_glClipPlanex__ILjava_nio_IntBuffer_2
535 (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700536 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800537 const char * _exceptionType = NULL;
538 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700539 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700540 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700541 jint _remaining;
542 GLfixed *equation = (GLfixed *) 0;
543
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700544 equation = (GLfixed *)getPointer(_env, equation_buf, &_array, &_remaining, &_bufferOffset);
545 if (equation == NULL) {
546 char * _equationBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
547 equation = (GLfixed *) (_equationBase + _bufferOffset);
548 }
Jack Palevich27f80022009-04-15 19:13:17 -0700549 glClipPlanex(
550 (GLenum)plane,
551 (GLfixed *)equation
552 );
553 if (_array) {
554 releasePointer(_env, _array, equation, JNI_FALSE);
555 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700556 if (_exception) {
557 jniThrowException(_env, _exceptionType, _exceptionMessage);
558 }
Jack Palevich27f80022009-04-15 19:13:17 -0700559}
560
561/* void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) */
562static void
563android_glColor4ub__BBBB
564 (JNIEnv *_env, jobject _this, jbyte red, jbyte green, jbyte blue, jbyte alpha) {
565 glColor4ub(
566 (GLubyte)red,
567 (GLubyte)green,
568 (GLubyte)blue,
569 (GLubyte)alpha
570 );
571}
572
573/* void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
574static void
575android_glColorPointer__IIII
576 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
577 glColorPointer(
578 (GLint)size,
579 (GLenum)type,
580 (GLsizei)stride,
Andy McFaddencee51982013-04-25 16:08:31 -0700581 (GLvoid *)offset
Jack Palevich27f80022009-04-15 19:13:17 -0700582 );
583}
584
585/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
586static void
587android_glDeleteBuffers__I_3II
588 (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700589 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800590 const char * _exceptionType = NULL;
591 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700592 GLuint *buffers_base = (GLuint *) 0;
593 jint _remaining;
594 GLuint *buffers = (GLuint *) 0;
595
596 if (!buffers_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700597 _exception = 1;
598 _exceptionType = "java/lang/IllegalArgumentException";
599 _exceptionMessage = "buffers == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700600 goto exit;
601 }
602 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700603 _exception = 1;
604 _exceptionType = "java/lang/IllegalArgumentException";
605 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700606 goto exit;
607 }
608 _remaining = _env->GetArrayLength(buffers_ref) - offset;
609 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700610 _exception = 1;
611 _exceptionType = "java/lang/IllegalArgumentException";
612 _exceptionMessage = "length - offset < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700613 goto exit;
614 }
615 buffers_base = (GLuint *)
616 _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
617 buffers = buffers_base + offset;
618
619 glDeleteBuffers(
620 (GLsizei)n,
621 (GLuint *)buffers
622 );
623
624exit:
625 if (buffers_base) {
626 _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
627 JNI_ABORT);
628 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700629 if (_exception) {
630 jniThrowException(_env, _exceptionType, _exceptionMessage);
631 }
Jack Palevich27f80022009-04-15 19:13:17 -0700632}
633
634/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
635static void
636android_glDeleteBuffers__ILjava_nio_IntBuffer_2
637 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700638 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800639 const char * _exceptionType = NULL;
640 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700641 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700642 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700643 jint _remaining;
644 GLuint *buffers = (GLuint *) 0;
645
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700646 buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -0700647 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700648 _exception = 1;
649 _exceptionType = "java/lang/IllegalArgumentException";
650 _exceptionMessage = "remaining() < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700651 goto exit;
652 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700653 if (buffers == NULL) {
654 char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
655 buffers = (GLuint *) (_buffersBase + _bufferOffset);
656 }
Jack Palevich27f80022009-04-15 19:13:17 -0700657 glDeleteBuffers(
658 (GLsizei)n,
659 (GLuint *)buffers
660 );
661
662exit:
663 if (_array) {
664 releasePointer(_env, _array, buffers, JNI_FALSE);
665 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700666 if (_exception) {
667 jniThrowException(_env, _exceptionType, _exceptionMessage);
668 }
Jack Palevich27f80022009-04-15 19:13:17 -0700669}
670
671/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */
672static void
673android_glDrawElements__IIII
674 (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700675 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800676 const char * _exceptionType = NULL;
677 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700678 glDrawElements(
679 (GLenum)mode,
680 (GLsizei)count,
681 (GLenum)type,
Andy McFaddencee51982013-04-25 16:08:31 -0700682 (GLvoid *)offset
Jack Palevich27f80022009-04-15 19:13:17 -0700683 );
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700684 if (_exception) {
685 jniThrowException(_env, _exceptionType, _exceptionMessage);
686 }
Jack Palevich27f80022009-04-15 19:13:17 -0700687}
688
689/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
690static void
691android_glGenBuffers__I_3II
692 (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
693 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800694 const char * _exceptionType = NULL;
695 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700696 GLuint *buffers_base = (GLuint *) 0;
697 jint _remaining;
698 GLuint *buffers = (GLuint *) 0;
699
700 if (!buffers_ref) {
701 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700702 _exceptionType = "java/lang/IllegalArgumentException";
703 _exceptionMessage = "buffers == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700704 goto exit;
705 }
706 if (offset < 0) {
707 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700708 _exceptionType = "java/lang/IllegalArgumentException";
709 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700710 goto exit;
711 }
712 _remaining = _env->GetArrayLength(buffers_ref) - offset;
713 if (_remaining < n) {
714 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700715 _exceptionType = "java/lang/IllegalArgumentException";
716 _exceptionMessage = "length - offset < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700717 goto exit;
718 }
719 buffers_base = (GLuint *)
720 _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
721 buffers = buffers_base + offset;
722
723 glGenBuffers(
724 (GLsizei)n,
725 (GLuint *)buffers
726 );
727
728exit:
729 if (buffers_base) {
730 _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
731 _exception ? JNI_ABORT: 0);
732 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700733 if (_exception) {
734 jniThrowException(_env, _exceptionType, _exceptionMessage);
735 }
Jack Palevich27f80022009-04-15 19:13:17 -0700736}
737
738/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
739static void
740android_glGenBuffers__ILjava_nio_IntBuffer_2
741 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
742 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800743 const char * _exceptionType = NULL;
744 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700745 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700746 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700747 jint _remaining;
748 GLuint *buffers = (GLuint *) 0;
749
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700750 buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -0700751 if (_remaining < n) {
752 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700753 _exceptionType = "java/lang/IllegalArgumentException";
754 _exceptionMessage = "remaining() < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700755 goto exit;
756 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700757 if (buffers == NULL) {
758 char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
759 buffers = (GLuint *) (_buffersBase + _bufferOffset);
760 }
Jack Palevich27f80022009-04-15 19:13:17 -0700761 glGenBuffers(
762 (GLsizei)n,
763 (GLuint *)buffers
764 );
765
766exit:
767 if (_array) {
768 releasePointer(_env, _array, buffers, _exception ? JNI_FALSE : JNI_TRUE);
769 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700770 if (_exception) {
771 jniThrowException(_env, _exceptionType, _exceptionMessage);
772 }
Jack Palevich27f80022009-04-15 19:13:17 -0700773}
774
775/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
776static void
777android_glGetBooleanv__I_3ZI
778 (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
Mathias Agopian2ad04772013-02-23 03:12:30 -0800779 get<jbooleanArray, GLboolean, glGetBooleanv>(_env, _this, pname, params_ref, offset);
Jack Palevich27f80022009-04-15 19:13:17 -0700780}
781
782/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
783static void
784android_glGetBooleanv__ILjava_nio_IntBuffer_2
785 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -0800786 getarray<GLboolean, glGetBooleanv>(_env, _this, pname, params_buf);
Jack Palevich27f80022009-04-15 19:13:17 -0700787}
Jack Palevich27f80022009-04-15 19:13:17 -0700788/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
789static void
790android_glGetBufferParameteriv__II_3II
791 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Jack Palevich73108672011-03-28 14:49:12 -0700792 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800793 const char * _exceptionType = NULL;
794 const char * _exceptionMessage = NULL;
Jack Palevich73108672011-03-28 14:49:12 -0700795 GLint *params_base = (GLint *) 0;
796 jint _remaining;
797 GLint *params = (GLint *) 0;
798
799 if (!params_ref) {
800 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700801 _exceptionType = "java/lang/IllegalArgumentException";
802 _exceptionMessage = "params == null";
Jack Palevich73108672011-03-28 14:49:12 -0700803 goto exit;
804 }
805 if (offset < 0) {
806 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700807 _exceptionType = "java/lang/IllegalArgumentException";
808 _exceptionMessage = "offset < 0";
Jack Palevich73108672011-03-28 14:49:12 -0700809 goto exit;
810 }
811 _remaining = _env->GetArrayLength(params_ref) - offset;
812 if (_remaining < 1) {
813 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700814 _exceptionType = "java/lang/IllegalArgumentException";
815 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich73108672011-03-28 14:49:12 -0700816 goto exit;
817 }
818 params_base = (GLint *)
819 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
820 params = params_base + offset;
821
822 glGetBufferParameteriv(
823 (GLenum)target,
824 (GLenum)pname,
825 (GLint *)params
826 );
827
828exit:
829 if (params_base) {
830 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
831 _exception ? JNI_ABORT: 0);
832 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700833 if (_exception) {
834 jniThrowException(_env, _exceptionType, _exceptionMessage);
835 }
Jack Palevich27f80022009-04-15 19:13:17 -0700836}
837
838/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
839static void
840android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
841 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Jack Palevich73108672011-03-28 14:49:12 -0700842 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800843 const char * _exceptionType = NULL;
844 const char * _exceptionMessage = NULL;
Jack Palevich73108672011-03-28 14:49:12 -0700845 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700846 jint _bufferOffset = (jint) 0;
Jack Palevich73108672011-03-28 14:49:12 -0700847 jint _remaining;
848 GLint *params = (GLint *) 0;
849
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700850 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich73108672011-03-28 14:49:12 -0700851 if (_remaining < 1) {
852 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700853 _exceptionType = "java/lang/IllegalArgumentException";
854 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich73108672011-03-28 14:49:12 -0700855 goto exit;
856 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700857 if (params == NULL) {
858 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
859 params = (GLint *) (_paramsBase + _bufferOffset);
860 }
Jack Palevich73108672011-03-28 14:49:12 -0700861 glGetBufferParameteriv(
862 (GLenum)target,
863 (GLenum)pname,
864 (GLint *)params
865 );
866
867exit:
868 if (_array) {
869 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
870 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700871 if (_exception) {
872 jniThrowException(_env, _exceptionType, _exceptionMessage);
873 }
Jack Palevich27f80022009-04-15 19:13:17 -0700874}
875
876/* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */
877static void
878android_glGetClipPlanef__I_3FI
879 (JNIEnv *_env, jobject _this, jint pname, jfloatArray eqn_ref, jint offset) {
880 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800881 const char * _exceptionType = NULL;
882 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700883 GLfloat *eqn_base = (GLfloat *) 0;
884 jint _remaining;
885 GLfloat *eqn = (GLfloat *) 0;
886
887 if (!eqn_ref) {
888 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700889 _exceptionType = "java/lang/IllegalArgumentException";
890 _exceptionMessage = "eqn == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700891 goto exit;
892 }
893 if (offset < 0) {
894 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700895 _exceptionType = "java/lang/IllegalArgumentException";
896 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700897 goto exit;
898 }
899 _remaining = _env->GetArrayLength(eqn_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800900 if (_remaining < 4) {
901 _exception = 1;
902 _exceptionType = "java/lang/IllegalArgumentException";
903 _exceptionMessage = "length - offset < 4 < needed";
904 goto exit;
905 }
Jack Palevich27f80022009-04-15 19:13:17 -0700906 eqn_base = (GLfloat *)
907 _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0);
908 eqn = eqn_base + offset;
909
910 glGetClipPlanef(
911 (GLenum)pname,
912 (GLfloat *)eqn
913 );
914
915exit:
916 if (eqn_base) {
917 _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base,
918 _exception ? JNI_ABORT: 0);
919 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700920 if (_exception) {
921 jniThrowException(_env, _exceptionType, _exceptionMessage);
922 }
Jack Palevich27f80022009-04-15 19:13:17 -0700923}
924
925/* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */
926static void
927android_glGetClipPlanef__ILjava_nio_FloatBuffer_2
928 (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -0800929 jint _exception = 0;
930 const char * _exceptionType = NULL;
931 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700932 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700933 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700934 jint _remaining;
935 GLfloat *eqn = (GLfloat *) 0;
936
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700937 eqn = (GLfloat *)getPointer(_env, eqn_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800938 if (_remaining < 4) {
939 _exception = 1;
940 _exceptionType = "java/lang/IllegalArgumentException";
941 _exceptionMessage = "remaining() < 4 < needed";
942 goto exit;
943 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700944 if (eqn == NULL) {
945 char * _eqnBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
946 eqn = (GLfloat *) (_eqnBase + _bufferOffset);
947 }
Jack Palevich27f80022009-04-15 19:13:17 -0700948 glGetClipPlanef(
949 (GLenum)pname,
950 (GLfloat *)eqn
951 );
Mathias Agopian2ad04772013-02-23 03:12:30 -0800952
953exit:
Jack Palevich27f80022009-04-15 19:13:17 -0700954 if (_array) {
Mathias Agopian2ad04772013-02-23 03:12:30 -0800955 releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE);
956 }
957 if (_exception) {
958 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich27f80022009-04-15 19:13:17 -0700959 }
960}
961
962/* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */
963static void
964android_glGetClipPlanex__I_3II
965 (JNIEnv *_env, jobject _this, jint pname, jintArray eqn_ref, jint offset) {
966 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800967 const char * _exceptionType = NULL;
968 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700969 GLfixed *eqn_base = (GLfixed *) 0;
970 jint _remaining;
971 GLfixed *eqn = (GLfixed *) 0;
972
973 if (!eqn_ref) {
974 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700975 _exceptionType = "java/lang/IllegalArgumentException";
976 _exceptionMessage = "eqn == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700977 goto exit;
978 }
979 if (offset < 0) {
980 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700981 _exceptionType = "java/lang/IllegalArgumentException";
982 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700983 goto exit;
984 }
985 _remaining = _env->GetArrayLength(eqn_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800986 if (_remaining < 4) {
987 _exception = 1;
988 _exceptionType = "java/lang/IllegalArgumentException";
989 _exceptionMessage = "length - offset < 4 < needed";
990 goto exit;
991 }
Jack Palevich27f80022009-04-15 19:13:17 -0700992 eqn_base = (GLfixed *)
993 _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0);
994 eqn = eqn_base + offset;
995
996 glGetClipPlanex(
997 (GLenum)pname,
998 (GLfixed *)eqn
999 );
1000
1001exit:
1002 if (eqn_base) {
1003 _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base,
1004 _exception ? JNI_ABORT: 0);
1005 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001006 if (_exception) {
1007 jniThrowException(_env, _exceptionType, _exceptionMessage);
1008 }
Jack Palevich27f80022009-04-15 19:13:17 -07001009}
1010
1011/* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */
1012static void
1013android_glGetClipPlanex__ILjava_nio_IntBuffer_2
1014 (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001015 jint _exception = 0;
1016 const char * _exceptionType = NULL;
1017 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001018 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001019 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001020 jint _remaining;
1021 GLfixed *eqn = (GLfixed *) 0;
1022
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001023 eqn = (GLfixed *)getPointer(_env, eqn_buf, &_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001024 if (_remaining < 4) {
1025 _exception = 1;
1026 _exceptionType = "java/lang/IllegalArgumentException";
1027 _exceptionMessage = "remaining() < 4 < needed";
1028 goto exit;
1029 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001030 if (eqn == NULL) {
1031 char * _eqnBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1032 eqn = (GLfixed *) (_eqnBase + _bufferOffset);
1033 }
Jack Palevich27f80022009-04-15 19:13:17 -07001034 glGetClipPlanex(
1035 (GLenum)pname,
1036 (GLfixed *)eqn
1037 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08001038
1039exit:
Jack Palevich27f80022009-04-15 19:13:17 -07001040 if (_array) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001041 releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE);
1042 }
1043 if (_exception) {
1044 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich27f80022009-04-15 19:13:17 -07001045 }
1046}
1047
1048/* void glGetFixedv ( GLenum pname, GLfixed *params ) */
1049static void
1050android_glGetFixedv__I_3II
1051 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
1052 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001053 const char * _exceptionType = NULL;
1054 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001055 GLfixed *params_base = (GLfixed *) 0;
1056 jint _remaining;
1057 GLfixed *params = (GLfixed *) 0;
1058
1059 if (!params_ref) {
1060 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001061 _exceptionType = "java/lang/IllegalArgumentException";
1062 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001063 goto exit;
1064 }
1065 if (offset < 0) {
1066 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001067 _exceptionType = "java/lang/IllegalArgumentException";
1068 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001069 goto exit;
1070 }
1071 _remaining = _env->GetArrayLength(params_ref) - offset;
1072 params_base = (GLfixed *)
1073 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1074 params = params_base + offset;
1075
1076 glGetFixedv(
1077 (GLenum)pname,
1078 (GLfixed *)params
1079 );
1080
1081exit:
1082 if (params_base) {
1083 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1084 _exception ? JNI_ABORT: 0);
1085 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001086 if (_exception) {
1087 jniThrowException(_env, _exceptionType, _exceptionMessage);
1088 }
Jack Palevich27f80022009-04-15 19:13:17 -07001089}
1090
1091/* void glGetFixedv ( GLenum pname, GLfixed *params ) */
1092static void
1093android_glGetFixedv__ILjava_nio_IntBuffer_2
1094 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Jack Palevich27f80022009-04-15 19:13:17 -07001095 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001096 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001097 jint _remaining;
1098 GLfixed *params = (GLfixed *) 0;
1099
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001100 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
1101 if (params == NULL) {
1102 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1103 params = (GLfixed *) (_paramsBase + _bufferOffset);
1104 }
Jack Palevich27f80022009-04-15 19:13:17 -07001105 glGetFixedv(
1106 (GLenum)pname,
1107 (GLfixed *)params
1108 );
1109 if (_array) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001110 releasePointer(_env, _array, params, JNI_TRUE);
Jack Palevich27f80022009-04-15 19:13:17 -07001111 }
1112}
1113
1114/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
1115static void
1116android_glGetFloatv__I_3FI
1117 (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001118 get<jfloatArray, GLfloat, glGetFloatv>(_env, _this, pname, params_ref, offset);
Jack Palevich27f80022009-04-15 19:13:17 -07001119}
1120
1121/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
1122static void
1123android_glGetFloatv__ILjava_nio_FloatBuffer_2
1124 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001125 getarray<GLfloat, glGetFloatv>(_env, _this, pname, params_buf);
Jack Palevich27f80022009-04-15 19:13:17 -07001126}
Jack Palevich27f80022009-04-15 19:13:17 -07001127/* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */
1128static void
1129android_glGetLightfv__II_3FI
1130 (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) {
1131 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001132 const char * _exceptionType = NULL;
1133 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001134 GLfloat *params_base = (GLfloat *) 0;
1135 jint _remaining;
1136 GLfloat *params = (GLfloat *) 0;
1137
1138 if (!params_ref) {
1139 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001140 _exceptionType = "java/lang/IllegalArgumentException";
1141 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001142 goto exit;
1143 }
1144 if (offset < 0) {
1145 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001146 _exceptionType = "java/lang/IllegalArgumentException";
1147 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001148 goto exit;
1149 }
1150 _remaining = _env->GetArrayLength(params_ref) - offset;
1151 int _needed;
1152 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001153#if defined(GL_SPOT_DIRECTION)
1154 case GL_SPOT_DIRECTION:
1155#endif // defined(GL_SPOT_DIRECTION)
1156 _needed = 3;
1157 break;
1158#if defined(GL_AMBIENT)
1159 case GL_AMBIENT:
1160#endif // defined(GL_AMBIENT)
1161#if defined(GL_DIFFUSE)
1162 case GL_DIFFUSE:
1163#endif // defined(GL_DIFFUSE)
1164#if defined(GL_SPECULAR)
1165 case GL_SPECULAR:
1166#endif // defined(GL_SPECULAR)
1167#if defined(GL_EMISSION)
1168 case GL_EMISSION:
1169#endif // defined(GL_EMISSION)
1170 _needed = 4;
1171 break;
1172 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001173 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001174 break;
1175 }
1176 if (_remaining < _needed) {
1177 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001178 _exceptionType = "java/lang/IllegalArgumentException";
1179 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001180 goto exit;
1181 }
1182 params_base = (GLfloat *)
1183 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1184 params = params_base + offset;
1185
1186 glGetLightfv(
1187 (GLenum)light,
1188 (GLenum)pname,
1189 (GLfloat *)params
1190 );
1191
1192exit:
1193 if (params_base) {
1194 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1195 _exception ? JNI_ABORT: 0);
1196 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001197 if (_exception) {
1198 jniThrowException(_env, _exceptionType, _exceptionMessage);
1199 }
Jack Palevich27f80022009-04-15 19:13:17 -07001200}
1201
1202/* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */
1203static void
1204android_glGetLightfv__IILjava_nio_FloatBuffer_2
1205 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
1206 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001207 const char * _exceptionType = NULL;
1208 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001209 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001210 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001211 jint _remaining;
1212 GLfloat *params = (GLfloat *) 0;
1213
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001214 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001215 int _needed;
1216 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001217#if defined(GL_SPOT_DIRECTION)
1218 case GL_SPOT_DIRECTION:
1219#endif // defined(GL_SPOT_DIRECTION)
1220 _needed = 3;
1221 break;
1222#if defined(GL_AMBIENT)
1223 case GL_AMBIENT:
1224#endif // defined(GL_AMBIENT)
1225#if defined(GL_DIFFUSE)
1226 case GL_DIFFUSE:
1227#endif // defined(GL_DIFFUSE)
1228#if defined(GL_SPECULAR)
1229 case GL_SPECULAR:
1230#endif // defined(GL_SPECULAR)
1231#if defined(GL_EMISSION)
1232 case GL_EMISSION:
1233#endif // defined(GL_EMISSION)
1234 _needed = 4;
1235 break;
1236 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001237 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001238 break;
1239 }
1240 if (_remaining < _needed) {
1241 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001242 _exceptionType = "java/lang/IllegalArgumentException";
1243 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001244 goto exit;
1245 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001246 if (params == NULL) {
1247 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1248 params = (GLfloat *) (_paramsBase + _bufferOffset);
1249 }
Jack Palevich27f80022009-04-15 19:13:17 -07001250 glGetLightfv(
1251 (GLenum)light,
1252 (GLenum)pname,
1253 (GLfloat *)params
1254 );
1255
1256exit:
1257 if (_array) {
1258 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1259 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001260 if (_exception) {
1261 jniThrowException(_env, _exceptionType, _exceptionMessage);
1262 }
Jack Palevich27f80022009-04-15 19:13:17 -07001263}
1264
1265/* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */
1266static void
1267android_glGetLightxv__II_3II
1268 (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) {
1269 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001270 const char * _exceptionType = NULL;
1271 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001272 GLfixed *params_base = (GLfixed *) 0;
1273 jint _remaining;
1274 GLfixed *params = (GLfixed *) 0;
1275
1276 if (!params_ref) {
1277 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001278 _exceptionType = "java/lang/IllegalArgumentException";
1279 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001280 goto exit;
1281 }
1282 if (offset < 0) {
1283 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001284 _exceptionType = "java/lang/IllegalArgumentException";
1285 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001286 goto exit;
1287 }
1288 _remaining = _env->GetArrayLength(params_ref) - offset;
1289 int _needed;
1290 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001291#if defined(GL_SPOT_DIRECTION)
1292 case GL_SPOT_DIRECTION:
1293#endif // defined(GL_SPOT_DIRECTION)
1294 _needed = 3;
1295 break;
1296#if defined(GL_AMBIENT)
1297 case GL_AMBIENT:
1298#endif // defined(GL_AMBIENT)
1299#if defined(GL_DIFFUSE)
1300 case GL_DIFFUSE:
1301#endif // defined(GL_DIFFUSE)
1302#if defined(GL_SPECULAR)
1303 case GL_SPECULAR:
1304#endif // defined(GL_SPECULAR)
1305#if defined(GL_EMISSION)
1306 case GL_EMISSION:
1307#endif // defined(GL_EMISSION)
1308 _needed = 4;
1309 break;
1310 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001311 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001312 break;
1313 }
1314 if (_remaining < _needed) {
1315 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001316 _exceptionType = "java/lang/IllegalArgumentException";
1317 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001318 goto exit;
1319 }
1320 params_base = (GLfixed *)
1321 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1322 params = params_base + offset;
1323
1324 glGetLightxv(
1325 (GLenum)light,
1326 (GLenum)pname,
1327 (GLfixed *)params
1328 );
1329
1330exit:
1331 if (params_base) {
1332 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1333 _exception ? JNI_ABORT: 0);
1334 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001335 if (_exception) {
1336 jniThrowException(_env, _exceptionType, _exceptionMessage);
1337 }
Jack Palevich27f80022009-04-15 19:13:17 -07001338}
1339
1340/* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */
1341static void
1342android_glGetLightxv__IILjava_nio_IntBuffer_2
1343 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
1344 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001345 const char * _exceptionType = NULL;
1346 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001347 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001348 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001349 jint _remaining;
1350 GLfixed *params = (GLfixed *) 0;
1351
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001352 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001353 int _needed;
1354 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001355#if defined(GL_SPOT_DIRECTION)
1356 case GL_SPOT_DIRECTION:
1357#endif // defined(GL_SPOT_DIRECTION)
1358 _needed = 3;
1359 break;
1360#if defined(GL_AMBIENT)
1361 case GL_AMBIENT:
1362#endif // defined(GL_AMBIENT)
1363#if defined(GL_DIFFUSE)
1364 case GL_DIFFUSE:
1365#endif // defined(GL_DIFFUSE)
1366#if defined(GL_SPECULAR)
1367 case GL_SPECULAR:
1368#endif // defined(GL_SPECULAR)
1369#if defined(GL_EMISSION)
1370 case GL_EMISSION:
1371#endif // defined(GL_EMISSION)
1372 _needed = 4;
1373 break;
1374 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001375 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001376 break;
1377 }
1378 if (_remaining < _needed) {
1379 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001380 _exceptionType = "java/lang/IllegalArgumentException";
1381 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001382 goto exit;
1383 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001384 if (params == NULL) {
1385 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1386 params = (GLfixed *) (_paramsBase + _bufferOffset);
1387 }
Jack Palevich27f80022009-04-15 19:13:17 -07001388 glGetLightxv(
1389 (GLenum)light,
1390 (GLenum)pname,
1391 (GLfixed *)params
1392 );
1393
1394exit:
1395 if (_array) {
1396 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1397 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001398 if (_exception) {
1399 jniThrowException(_env, _exceptionType, _exceptionMessage);
1400 }
Jack Palevich27f80022009-04-15 19:13:17 -07001401}
1402
1403/* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */
1404static void
1405android_glGetMaterialfv__II_3FI
1406 (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) {
1407 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001408 const char * _exceptionType = NULL;
1409 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001410 GLfloat *params_base = (GLfloat *) 0;
1411 jint _remaining;
1412 GLfloat *params = (GLfloat *) 0;
1413
1414 if (!params_ref) {
1415 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001416 _exceptionType = "java/lang/IllegalArgumentException";
1417 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001418 goto exit;
1419 }
1420 if (offset < 0) {
1421 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001422 _exceptionType = "java/lang/IllegalArgumentException";
1423 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001424 goto exit;
1425 }
1426 _remaining = _env->GetArrayLength(params_ref) - offset;
1427 int _needed;
1428 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001429#if defined(GL_AMBIENT)
1430 case GL_AMBIENT:
1431#endif // defined(GL_AMBIENT)
1432#if defined(GL_DIFFUSE)
1433 case GL_DIFFUSE:
1434#endif // defined(GL_DIFFUSE)
1435#if defined(GL_SPECULAR)
1436 case GL_SPECULAR:
1437#endif // defined(GL_SPECULAR)
1438#if defined(GL_EMISSION)
1439 case GL_EMISSION:
1440#endif // defined(GL_EMISSION)
1441#if defined(GL_AMBIENT_AND_DIFFUSE)
1442 case GL_AMBIENT_AND_DIFFUSE:
1443#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1444 _needed = 4;
1445 break;
1446 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001447 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001448 break;
1449 }
1450 if (_remaining < _needed) {
1451 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001452 _exceptionType = "java/lang/IllegalArgumentException";
1453 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001454 goto exit;
1455 }
1456 params_base = (GLfloat *)
1457 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1458 params = params_base + offset;
1459
1460 glGetMaterialfv(
1461 (GLenum)face,
1462 (GLenum)pname,
1463 (GLfloat *)params
1464 );
1465
1466exit:
1467 if (params_base) {
1468 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1469 _exception ? JNI_ABORT: 0);
1470 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001471 if (_exception) {
1472 jniThrowException(_env, _exceptionType, _exceptionMessage);
1473 }
Jack Palevich27f80022009-04-15 19:13:17 -07001474}
1475
1476/* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */
1477static void
1478android_glGetMaterialfv__IILjava_nio_FloatBuffer_2
1479 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
1480 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001481 const char * _exceptionType = NULL;
1482 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001483 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001484 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001485 jint _remaining;
1486 GLfloat *params = (GLfloat *) 0;
1487
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001488 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001489 int _needed;
1490 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001491#if defined(GL_AMBIENT)
1492 case GL_AMBIENT:
1493#endif // defined(GL_AMBIENT)
1494#if defined(GL_DIFFUSE)
1495 case GL_DIFFUSE:
1496#endif // defined(GL_DIFFUSE)
1497#if defined(GL_SPECULAR)
1498 case GL_SPECULAR:
1499#endif // defined(GL_SPECULAR)
1500#if defined(GL_EMISSION)
1501 case GL_EMISSION:
1502#endif // defined(GL_EMISSION)
1503#if defined(GL_AMBIENT_AND_DIFFUSE)
1504 case GL_AMBIENT_AND_DIFFUSE:
1505#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1506 _needed = 4;
1507 break;
1508 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001509 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001510 break;
1511 }
1512 if (_remaining < _needed) {
1513 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001514 _exceptionType = "java/lang/IllegalArgumentException";
1515 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001516 goto exit;
1517 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001518 if (params == NULL) {
1519 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1520 params = (GLfloat *) (_paramsBase + _bufferOffset);
1521 }
Jack Palevich27f80022009-04-15 19:13:17 -07001522 glGetMaterialfv(
1523 (GLenum)face,
1524 (GLenum)pname,
1525 (GLfloat *)params
1526 );
1527
1528exit:
1529 if (_array) {
1530 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1531 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001532 if (_exception) {
1533 jniThrowException(_env, _exceptionType, _exceptionMessage);
1534 }
Jack Palevich27f80022009-04-15 19:13:17 -07001535}
1536
1537/* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */
1538static void
1539android_glGetMaterialxv__II_3II
1540 (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) {
1541 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001542 const char * _exceptionType = NULL;
1543 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001544 GLfixed *params_base = (GLfixed *) 0;
1545 jint _remaining;
1546 GLfixed *params = (GLfixed *) 0;
1547
1548 if (!params_ref) {
1549 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001550 _exceptionType = "java/lang/IllegalArgumentException";
1551 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001552 goto exit;
1553 }
1554 if (offset < 0) {
1555 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001556 _exceptionType = "java/lang/IllegalArgumentException";
1557 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001558 goto exit;
1559 }
1560 _remaining = _env->GetArrayLength(params_ref) - offset;
1561 int _needed;
1562 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001563#if defined(GL_AMBIENT)
1564 case GL_AMBIENT:
1565#endif // defined(GL_AMBIENT)
1566#if defined(GL_DIFFUSE)
1567 case GL_DIFFUSE:
1568#endif // defined(GL_DIFFUSE)
1569#if defined(GL_SPECULAR)
1570 case GL_SPECULAR:
1571#endif // defined(GL_SPECULAR)
1572#if defined(GL_EMISSION)
1573 case GL_EMISSION:
1574#endif // defined(GL_EMISSION)
1575#if defined(GL_AMBIENT_AND_DIFFUSE)
1576 case GL_AMBIENT_AND_DIFFUSE:
1577#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1578 _needed = 4;
1579 break;
1580 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001581 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001582 break;
1583 }
1584 if (_remaining < _needed) {
1585 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001586 _exceptionType = "java/lang/IllegalArgumentException";
1587 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001588 goto exit;
1589 }
1590 params_base = (GLfixed *)
1591 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1592 params = params_base + offset;
1593
1594 glGetMaterialxv(
1595 (GLenum)face,
1596 (GLenum)pname,
1597 (GLfixed *)params
1598 );
1599
1600exit:
1601 if (params_base) {
1602 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1603 _exception ? JNI_ABORT: 0);
1604 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001605 if (_exception) {
1606 jniThrowException(_env, _exceptionType, _exceptionMessage);
1607 }
Jack Palevich27f80022009-04-15 19:13:17 -07001608}
1609
1610/* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */
1611static void
1612android_glGetMaterialxv__IILjava_nio_IntBuffer_2
1613 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
1614 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001615 const char * _exceptionType = NULL;
1616 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001617 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001618 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001619 jint _remaining;
1620 GLfixed *params = (GLfixed *) 0;
1621
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001622 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001623 int _needed;
1624 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001625#if defined(GL_AMBIENT)
1626 case GL_AMBIENT:
1627#endif // defined(GL_AMBIENT)
1628#if defined(GL_DIFFUSE)
1629 case GL_DIFFUSE:
1630#endif // defined(GL_DIFFUSE)
1631#if defined(GL_SPECULAR)
1632 case GL_SPECULAR:
1633#endif // defined(GL_SPECULAR)
1634#if defined(GL_EMISSION)
1635 case GL_EMISSION:
1636#endif // defined(GL_EMISSION)
1637#if defined(GL_AMBIENT_AND_DIFFUSE)
1638 case GL_AMBIENT_AND_DIFFUSE:
1639#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1640 _needed = 4;
1641 break;
1642 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001643 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001644 break;
1645 }
1646 if (_remaining < _needed) {
1647 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001648 _exceptionType = "java/lang/IllegalArgumentException";
1649 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001650 goto exit;
1651 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001652 if (params == NULL) {
1653 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1654 params = (GLfixed *) (_paramsBase + _bufferOffset);
1655 }
Jack Palevich27f80022009-04-15 19:13:17 -07001656 glGetMaterialxv(
1657 (GLenum)face,
1658 (GLenum)pname,
1659 (GLfixed *)params
1660 );
1661
1662exit:
1663 if (_array) {
1664 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1665 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001666 if (_exception) {
1667 jniThrowException(_env, _exceptionType, _exceptionMessage);
1668 }
Jack Palevich27f80022009-04-15 19:13:17 -07001669}
1670
1671/* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */
1672static void
1673android_glGetTexEnvfv__II_3FI
1674 (JNIEnv *_env, jobject _this, jint env, jint pname, jfloatArray params_ref, jint offset) {
1675 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001676 const char * _exceptionType = NULL;
1677 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001678 GLfloat *params_base = (GLfloat *) 0;
1679 jint _remaining;
1680 GLfloat *params = (GLfloat *) 0;
1681
1682 if (!params_ref) {
1683 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001684 _exceptionType = "java/lang/IllegalArgumentException";
1685 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001686 goto exit;
1687 }
1688 if (offset < 0) {
1689 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001690 _exceptionType = "java/lang/IllegalArgumentException";
1691 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001692 goto exit;
1693 }
1694 _remaining = _env->GetArrayLength(params_ref) - offset;
1695 int _needed;
1696 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001697#if defined(GL_TEXTURE_ENV_COLOR)
1698 case GL_TEXTURE_ENV_COLOR:
1699#endif // defined(GL_TEXTURE_ENV_COLOR)
1700 _needed = 4;
1701 break;
1702 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001703 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001704 break;
1705 }
1706 if (_remaining < _needed) {
1707 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001708 _exceptionType = "java/lang/IllegalArgumentException";
1709 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001710 goto exit;
1711 }
1712 params_base = (GLfloat *)
1713 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1714 params = params_base + offset;
1715
1716 glGetTexEnvfv(
1717 (GLenum)env,
1718 (GLenum)pname,
1719 (GLfloat *)params
1720 );
1721
1722exit:
1723 if (params_base) {
1724 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1725 _exception ? JNI_ABORT: 0);
1726 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001727 if (_exception) {
1728 jniThrowException(_env, _exceptionType, _exceptionMessage);
1729 }
Jack Palevich27f80022009-04-15 19:13:17 -07001730}
1731
1732/* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */
1733static void
1734android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2
1735 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
1736 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001737 const char * _exceptionType = NULL;
1738 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001739 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001740 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001741 jint _remaining;
1742 GLfloat *params = (GLfloat *) 0;
1743
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001744 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001745 int _needed;
1746 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001747#if defined(GL_TEXTURE_ENV_COLOR)
1748 case GL_TEXTURE_ENV_COLOR:
1749#endif // defined(GL_TEXTURE_ENV_COLOR)
1750 _needed = 4;
1751 break;
1752 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001753 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001754 break;
1755 }
1756 if (_remaining < _needed) {
1757 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001758 _exceptionType = "java/lang/IllegalArgumentException";
1759 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001760 goto exit;
1761 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001762 if (params == NULL) {
1763 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1764 params = (GLfloat *) (_paramsBase + _bufferOffset);
1765 }
Jack Palevich27f80022009-04-15 19:13:17 -07001766 glGetTexEnvfv(
1767 (GLenum)env,
1768 (GLenum)pname,
1769 (GLfloat *)params
1770 );
1771
1772exit:
1773 if (_array) {
1774 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1775 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001776 if (_exception) {
1777 jniThrowException(_env, _exceptionType, _exceptionMessage);
1778 }
Jack Palevich27f80022009-04-15 19:13:17 -07001779}
1780
1781/* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */
1782static void
1783android_glGetTexEnviv__II_3II
1784 (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) {
1785 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001786 const char * _exceptionType = NULL;
1787 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001788 GLint *params_base = (GLint *) 0;
1789 jint _remaining;
1790 GLint *params = (GLint *) 0;
1791
1792 if (!params_ref) {
1793 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001794 _exceptionType = "java/lang/IllegalArgumentException";
1795 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001796 goto exit;
1797 }
1798 if (offset < 0) {
1799 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001800 _exceptionType = "java/lang/IllegalArgumentException";
1801 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001802 goto exit;
1803 }
1804 _remaining = _env->GetArrayLength(params_ref) - offset;
1805 int _needed;
1806 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001807#if defined(GL_TEXTURE_ENV_COLOR)
1808 case GL_TEXTURE_ENV_COLOR:
1809#endif // defined(GL_TEXTURE_ENV_COLOR)
1810 _needed = 4;
1811 break;
1812 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001813 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001814 break;
1815 }
1816 if (_remaining < _needed) {
1817 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001818 _exceptionType = "java/lang/IllegalArgumentException";
1819 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001820 goto exit;
1821 }
1822 params_base = (GLint *)
1823 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1824 params = params_base + offset;
1825
1826 glGetTexEnviv(
1827 (GLenum)env,
1828 (GLenum)pname,
1829 (GLint *)params
1830 );
1831
1832exit:
1833 if (params_base) {
1834 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1835 _exception ? JNI_ABORT: 0);
1836 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001837 if (_exception) {
1838 jniThrowException(_env, _exceptionType, _exceptionMessage);
1839 }
Jack Palevich27f80022009-04-15 19:13:17 -07001840}
1841
1842/* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */
1843static void
1844android_glGetTexEnviv__IILjava_nio_IntBuffer_2
1845 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
1846 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001847 const char * _exceptionType = NULL;
1848 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001849 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001850 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001851 jint _remaining;
1852 GLint *params = (GLint *) 0;
1853
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001854 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001855 int _needed;
1856 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001857#if defined(GL_TEXTURE_ENV_COLOR)
1858 case GL_TEXTURE_ENV_COLOR:
1859#endif // defined(GL_TEXTURE_ENV_COLOR)
1860 _needed = 4;
1861 break;
1862 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001863 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001864 break;
1865 }
1866 if (_remaining < _needed) {
1867 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001868 _exceptionType = "java/lang/IllegalArgumentException";
1869 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001870 goto exit;
1871 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001872 if (params == NULL) {
1873 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1874 params = (GLint *) (_paramsBase + _bufferOffset);
1875 }
Jack Palevich27f80022009-04-15 19:13:17 -07001876 glGetTexEnviv(
1877 (GLenum)env,
1878 (GLenum)pname,
1879 (GLint *)params
1880 );
1881
1882exit:
1883 if (_array) {
1884 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1885 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001886 if (_exception) {
1887 jniThrowException(_env, _exceptionType, _exceptionMessage);
1888 }
Jack Palevich27f80022009-04-15 19:13:17 -07001889}
1890
1891/* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */
1892static void
1893android_glGetTexEnvxv__II_3II
1894 (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) {
1895 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001896 const char * _exceptionType = NULL;
1897 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001898 GLfixed *params_base = (GLfixed *) 0;
1899 jint _remaining;
1900 GLfixed *params = (GLfixed *) 0;
1901
1902 if (!params_ref) {
1903 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001904 _exceptionType = "java/lang/IllegalArgumentException";
1905 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001906 goto exit;
1907 }
1908 if (offset < 0) {
1909 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001910 _exceptionType = "java/lang/IllegalArgumentException";
1911 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001912 goto exit;
1913 }
1914 _remaining = _env->GetArrayLength(params_ref) - offset;
1915 int _needed;
1916 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001917#if defined(GL_TEXTURE_ENV_COLOR)
1918 case GL_TEXTURE_ENV_COLOR:
1919#endif // defined(GL_TEXTURE_ENV_COLOR)
1920 _needed = 4;
1921 break;
1922 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001923 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001924 break;
1925 }
1926 if (_remaining < _needed) {
1927 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001928 _exceptionType = "java/lang/IllegalArgumentException";
1929 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001930 goto exit;
1931 }
1932 params_base = (GLfixed *)
1933 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1934 params = params_base + offset;
1935
1936 glGetTexEnvxv(
1937 (GLenum)env,
1938 (GLenum)pname,
1939 (GLfixed *)params
1940 );
1941
1942exit:
1943 if (params_base) {
1944 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1945 _exception ? JNI_ABORT: 0);
1946 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001947 if (_exception) {
1948 jniThrowException(_env, _exceptionType, _exceptionMessage);
1949 }
Jack Palevich27f80022009-04-15 19:13:17 -07001950}
1951
1952/* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */
1953static void
1954android_glGetTexEnvxv__IILjava_nio_IntBuffer_2
1955 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
1956 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001957 const char * _exceptionType = NULL;
1958 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001959 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001960 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001961 jint _remaining;
1962 GLfixed *params = (GLfixed *) 0;
1963
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001964 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001965 int _needed;
1966 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001967#if defined(GL_TEXTURE_ENV_COLOR)
1968 case GL_TEXTURE_ENV_COLOR:
1969#endif // defined(GL_TEXTURE_ENV_COLOR)
1970 _needed = 4;
1971 break;
1972 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001973 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001974 break;
1975 }
1976 if (_remaining < _needed) {
1977 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001978 _exceptionType = "java/lang/IllegalArgumentException";
1979 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001980 goto exit;
1981 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001982 if (params == NULL) {
1983 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1984 params = (GLfixed *) (_paramsBase + _bufferOffset);
1985 }
Jack Palevich27f80022009-04-15 19:13:17 -07001986 glGetTexEnvxv(
1987 (GLenum)env,
1988 (GLenum)pname,
1989 (GLfixed *)params
1990 );
1991
1992exit:
1993 if (_array) {
1994 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
1995 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001996 if (_exception) {
1997 jniThrowException(_env, _exceptionType, _exceptionMessage);
1998 }
Jack Palevich27f80022009-04-15 19:13:17 -07001999}
2000
2001/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
2002static void
2003android_glGetTexParameterfv__II_3FI
2004 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
2005 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002006 const char * _exceptionType = NULL;
2007 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002008 GLfloat *params_base = (GLfloat *) 0;
2009 jint _remaining;
2010 GLfloat *params = (GLfloat *) 0;
2011
2012 if (!params_ref) {
2013 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002014 _exceptionType = "java/lang/IllegalArgumentException";
2015 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002016 goto exit;
2017 }
2018 if (offset < 0) {
2019 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002020 _exceptionType = "java/lang/IllegalArgumentException";
2021 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002022 goto exit;
2023 }
2024 _remaining = _env->GetArrayLength(params_ref) - offset;
2025 if (_remaining < 1) {
2026 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002027 _exceptionType = "java/lang/IllegalArgumentException";
2028 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002029 goto exit;
2030 }
2031 params_base = (GLfloat *)
2032 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2033 params = params_base + offset;
2034
2035 glGetTexParameterfv(
2036 (GLenum)target,
2037 (GLenum)pname,
2038 (GLfloat *)params
2039 );
2040
2041exit:
2042 if (params_base) {
2043 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2044 _exception ? JNI_ABORT: 0);
2045 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002046 if (_exception) {
2047 jniThrowException(_env, _exceptionType, _exceptionMessage);
2048 }
Jack Palevich27f80022009-04-15 19:13:17 -07002049}
2050
2051/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
2052static void
2053android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2
2054 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2055 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002056 const char * _exceptionType = NULL;
2057 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002058 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002059 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002060 jint _remaining;
2061 GLfloat *params = (GLfloat *) 0;
2062
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002063 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002064 if (_remaining < 1) {
2065 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002066 _exceptionType = "java/lang/IllegalArgumentException";
2067 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002068 goto exit;
2069 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002070 if (params == NULL) {
2071 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2072 params = (GLfloat *) (_paramsBase + _bufferOffset);
2073 }
Jack Palevich27f80022009-04-15 19:13:17 -07002074 glGetTexParameterfv(
2075 (GLenum)target,
2076 (GLenum)pname,
2077 (GLfloat *)params
2078 );
2079
2080exit:
2081 if (_array) {
2082 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2083 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002084 if (_exception) {
2085 jniThrowException(_env, _exceptionType, _exceptionMessage);
2086 }
Jack Palevich27f80022009-04-15 19:13:17 -07002087}
2088
2089/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2090static void
2091android_glGetTexParameteriv__II_3II
2092 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2093 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002094 const char * _exceptionType = NULL;
2095 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002096 GLint *params_base = (GLint *) 0;
2097 jint _remaining;
2098 GLint *params = (GLint *) 0;
2099
2100 if (!params_ref) {
2101 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002102 _exceptionType = "java/lang/IllegalArgumentException";
2103 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002104 goto exit;
2105 }
2106 if (offset < 0) {
2107 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002108 _exceptionType = "java/lang/IllegalArgumentException";
2109 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002110 goto exit;
2111 }
2112 _remaining = _env->GetArrayLength(params_ref) - offset;
2113 if (_remaining < 1) {
2114 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002115 _exceptionType = "java/lang/IllegalArgumentException";
2116 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002117 goto exit;
2118 }
2119 params_base = (GLint *)
2120 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2121 params = params_base + offset;
2122
2123 glGetTexParameteriv(
2124 (GLenum)target,
2125 (GLenum)pname,
2126 (GLint *)params
2127 );
2128
2129exit:
2130 if (params_base) {
2131 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2132 _exception ? JNI_ABORT: 0);
2133 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002134 if (_exception) {
2135 jniThrowException(_env, _exceptionType, _exceptionMessage);
2136 }
Jack Palevich27f80022009-04-15 19:13:17 -07002137}
2138
2139/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2140static void
2141android_glGetTexParameteriv__IILjava_nio_IntBuffer_2
2142 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2143 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002144 const char * _exceptionType = NULL;
2145 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002146 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002147 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002148 jint _remaining;
2149 GLint *params = (GLint *) 0;
2150
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002151 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002152 if (_remaining < 1) {
2153 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002154 _exceptionType = "java/lang/IllegalArgumentException";
2155 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002156 goto exit;
2157 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002158 if (params == NULL) {
2159 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2160 params = (GLint *) (_paramsBase + _bufferOffset);
2161 }
Jack Palevich27f80022009-04-15 19:13:17 -07002162 glGetTexParameteriv(
2163 (GLenum)target,
2164 (GLenum)pname,
2165 (GLint *)params
2166 );
2167
2168exit:
2169 if (_array) {
2170 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2171 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002172 if (_exception) {
2173 jniThrowException(_env, _exceptionType, _exceptionMessage);
2174 }
Jack Palevich27f80022009-04-15 19:13:17 -07002175}
2176
2177/* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */
2178static void
2179android_glGetTexParameterxv__II_3II
2180 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2181 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002182 const char * _exceptionType = NULL;
2183 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002184 GLfixed *params_base = (GLfixed *) 0;
2185 jint _remaining;
2186 GLfixed *params = (GLfixed *) 0;
2187
2188 if (!params_ref) {
2189 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002190 _exceptionType = "java/lang/IllegalArgumentException";
2191 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002192 goto exit;
2193 }
2194 if (offset < 0) {
2195 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002196 _exceptionType = "java/lang/IllegalArgumentException";
2197 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002198 goto exit;
2199 }
2200 _remaining = _env->GetArrayLength(params_ref) - offset;
2201 if (_remaining < 1) {
2202 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002203 _exceptionType = "java/lang/IllegalArgumentException";
2204 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002205 goto exit;
2206 }
2207 params_base = (GLfixed *)
2208 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2209 params = params_base + offset;
2210
2211 glGetTexParameterxv(
2212 (GLenum)target,
2213 (GLenum)pname,
2214 (GLfixed *)params
2215 );
2216
2217exit:
2218 if (params_base) {
2219 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2220 _exception ? JNI_ABORT: 0);
2221 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002222 if (_exception) {
2223 jniThrowException(_env, _exceptionType, _exceptionMessage);
2224 }
Jack Palevich27f80022009-04-15 19:13:17 -07002225}
2226
2227/* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */
2228static void
2229android_glGetTexParameterxv__IILjava_nio_IntBuffer_2
2230 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
2231 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002232 const char * _exceptionType = NULL;
2233 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002234 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002235 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002236 jint _remaining;
2237 GLfixed *params = (GLfixed *) 0;
2238
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002239 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002240 if (_remaining < 1) {
2241 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002242 _exceptionType = "java/lang/IllegalArgumentException";
2243 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002244 goto exit;
2245 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002246 if (params == NULL) {
2247 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2248 params = (GLfixed *) (_paramsBase + _bufferOffset);
2249 }
Jack Palevich27f80022009-04-15 19:13:17 -07002250 glGetTexParameterxv(
2251 (GLenum)target,
2252 (GLenum)pname,
2253 (GLfixed *)params
2254 );
2255
2256exit:
2257 if (_array) {
2258 releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
2259 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002260 if (_exception) {
2261 jniThrowException(_env, _exceptionType, _exceptionMessage);
2262 }
Jack Palevich27f80022009-04-15 19:13:17 -07002263}
2264
2265/* GLboolean glIsBuffer ( GLuint buffer ) */
2266static jboolean
2267android_glIsBuffer__I
2268 (JNIEnv *_env, jobject _this, jint buffer) {
2269 GLboolean _returnValue;
2270 _returnValue = glIsBuffer(
2271 (GLuint)buffer
2272 );
Andy McFaddencee51982013-04-25 16:08:31 -07002273 return (jboolean)_returnValue;
Jack Palevich27f80022009-04-15 19:13:17 -07002274}
2275
2276/* GLboolean glIsEnabled ( GLenum cap ) */
2277static jboolean
2278android_glIsEnabled__I
2279 (JNIEnv *_env, jobject _this, jint cap) {
2280 GLboolean _returnValue;
2281 _returnValue = glIsEnabled(
2282 (GLenum)cap
2283 );
Andy McFaddencee51982013-04-25 16:08:31 -07002284 return (jboolean)_returnValue;
Jack Palevich27f80022009-04-15 19:13:17 -07002285}
2286
2287/* GLboolean glIsTexture ( GLuint texture ) */
2288static jboolean
2289android_glIsTexture__I
2290 (JNIEnv *_env, jobject _this, jint texture) {
2291 GLboolean _returnValue;
2292 _returnValue = glIsTexture(
2293 (GLuint)texture
2294 );
Andy McFaddencee51982013-04-25 16:08:31 -07002295 return (jboolean)_returnValue;
Jack Palevich27f80022009-04-15 19:13:17 -07002296}
2297
2298/* void glNormalPointer ( GLenum type, GLsizei stride, GLint offset ) */
2299static void
2300android_glNormalPointer__III
2301 (JNIEnv *_env, jobject _this, jint type, jint stride, jint offset) {
2302 glNormalPointer(
2303 (GLenum)type,
2304 (GLsizei)stride,
Andy McFaddencee51982013-04-25 16:08:31 -07002305 (GLvoid *)offset
Jack Palevich27f80022009-04-15 19:13:17 -07002306 );
2307}
2308
2309/* void glPointParameterf ( GLenum pname, GLfloat param ) */
2310static void
2311android_glPointParameterf__IF
2312 (JNIEnv *_env, jobject _this, jint pname, jfloat param) {
2313 glPointParameterf(
2314 (GLenum)pname,
2315 (GLfloat)param
2316 );
2317}
2318
2319/* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */
2320static void
2321android_glPointParameterfv__I_3FI
2322 (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002323 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002324 const char * _exceptionType = NULL;
2325 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002326 GLfloat *params_base = (GLfloat *) 0;
2327 jint _remaining;
2328 GLfloat *params = (GLfloat *) 0;
2329
2330 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002331 _exception = 1;
2332 _exceptionType = "java/lang/IllegalArgumentException";
2333 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002334 goto exit;
2335 }
2336 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002337 _exception = 1;
2338 _exceptionType = "java/lang/IllegalArgumentException";
2339 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002340 goto exit;
2341 }
2342 _remaining = _env->GetArrayLength(params_ref) - offset;
2343 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002344 _exception = 1;
2345 _exceptionType = "java/lang/IllegalArgumentException";
2346 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002347 goto exit;
2348 }
2349 params_base = (GLfloat *)
2350 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2351 params = params_base + offset;
2352
2353 glPointParameterfv(
2354 (GLenum)pname,
2355 (GLfloat *)params
2356 );
2357
2358exit:
2359 if (params_base) {
2360 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2361 JNI_ABORT);
2362 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002363 if (_exception) {
2364 jniThrowException(_env, _exceptionType, _exceptionMessage);
2365 }
Jack Palevich27f80022009-04-15 19:13:17 -07002366}
2367
2368/* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */
2369static void
2370android_glPointParameterfv__ILjava_nio_FloatBuffer_2
2371 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002372 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002373 const char * _exceptionType = NULL;
2374 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002375 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002376 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002377 jint _remaining;
2378 GLfloat *params = (GLfloat *) 0;
2379
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002380 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002381 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002382 _exception = 1;
2383 _exceptionType = "java/lang/IllegalArgumentException";
2384 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002385 goto exit;
2386 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002387 if (params == NULL) {
2388 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2389 params = (GLfloat *) (_paramsBase + _bufferOffset);
2390 }
Jack Palevich27f80022009-04-15 19:13:17 -07002391 glPointParameterfv(
2392 (GLenum)pname,
2393 (GLfloat *)params
2394 );
2395
2396exit:
2397 if (_array) {
2398 releasePointer(_env, _array, params, JNI_FALSE);
2399 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002400 if (_exception) {
2401 jniThrowException(_env, _exceptionType, _exceptionMessage);
2402 }
Jack Palevich27f80022009-04-15 19:13:17 -07002403}
2404
2405/* void glPointParameterx ( GLenum pname, GLfixed param ) */
2406static void
2407android_glPointParameterx__II
2408 (JNIEnv *_env, jobject _this, jint pname, jint param) {
2409 glPointParameterx(
2410 (GLenum)pname,
2411 (GLfixed)param
2412 );
2413}
2414
2415/* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */
2416static void
2417android_glPointParameterxv__I_3II
2418 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002419 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002420 const char * _exceptionType = NULL;
2421 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002422 GLfixed *params_base = (GLfixed *) 0;
2423 jint _remaining;
2424 GLfixed *params = (GLfixed *) 0;
2425
2426 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002427 _exception = 1;
2428 _exceptionType = "java/lang/IllegalArgumentException";
2429 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002430 goto exit;
2431 }
2432 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002433 _exception = 1;
2434 _exceptionType = "java/lang/IllegalArgumentException";
2435 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002436 goto exit;
2437 }
2438 _remaining = _env->GetArrayLength(params_ref) - offset;
2439 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002440 _exception = 1;
2441 _exceptionType = "java/lang/IllegalArgumentException";
2442 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002443 goto exit;
2444 }
2445 params_base = (GLfixed *)
2446 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2447 params = params_base + offset;
2448
2449 glPointParameterxv(
2450 (GLenum)pname,
2451 (GLfixed *)params
2452 );
2453
2454exit:
2455 if (params_base) {
2456 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2457 JNI_ABORT);
2458 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002459 if (_exception) {
2460 jniThrowException(_env, _exceptionType, _exceptionMessage);
2461 }
Jack Palevich27f80022009-04-15 19:13:17 -07002462}
2463
2464/* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */
2465static void
2466android_glPointParameterxv__ILjava_nio_IntBuffer_2
2467 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002468 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002469 const char * _exceptionType = NULL;
2470 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002471 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002472 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002473 jint _remaining;
2474 GLfixed *params = (GLfixed *) 0;
2475
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002476 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002477 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002478 _exception = 1;
2479 _exceptionType = "java/lang/IllegalArgumentException";
2480 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002481 goto exit;
2482 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002483 if (params == NULL) {
2484 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2485 params = (GLfixed *) (_paramsBase + _bufferOffset);
2486 }
Jack Palevich27f80022009-04-15 19:13:17 -07002487 glPointParameterxv(
2488 (GLenum)pname,
2489 (GLfixed *)params
2490 );
2491
2492exit:
2493 if (_array) {
2494 releasePointer(_env, _array, params, JNI_FALSE);
2495 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002496 if (_exception) {
2497 jniThrowException(_env, _exceptionType, _exceptionMessage);
2498 }
Jack Palevich27f80022009-04-15 19:13:17 -07002499}
2500
2501/* void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) */
2502static void
Jack Palevichbe6eac82009-12-08 15:43:51 +08002503android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I
2504 (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) {
Jack Palevich27f80022009-04-15 19:13:17 -07002505 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002506 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002507 jint _remaining;
2508 GLvoid *pointer = (GLvoid *) 0;
2509
Jack Palevichbe6eac82009-12-08 15:43:51 +08002510 if (pointer_buf) {
2511 pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
2512 if ( ! pointer ) {
2513 return;
2514 }
2515 }
2516 glPointSizePointerOESBounds(
Jack Palevich27f80022009-04-15 19:13:17 -07002517 (GLenum)type,
2518 (GLsizei)stride,
Jack Palevichbe6eac82009-12-08 15:43:51 +08002519 (GLvoid *)pointer,
2520 (GLsizei)remaining
Jack Palevich27f80022009-04-15 19:13:17 -07002521 );
Jack Palevich27f80022009-04-15 19:13:17 -07002522}
2523
2524/* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
2525static void
2526android_glTexCoordPointer__IIII
2527 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
2528 glTexCoordPointer(
2529 (GLint)size,
2530 (GLenum)type,
2531 (GLsizei)stride,
Andy McFaddencee51982013-04-25 16:08:31 -07002532 (GLvoid *)offset
Jack Palevich27f80022009-04-15 19:13:17 -07002533 );
2534}
2535
2536/* void glTexEnvi ( GLenum target, GLenum pname, GLint param ) */
2537static void
2538android_glTexEnvi__III
2539 (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
2540 glTexEnvi(
2541 (GLenum)target,
2542 (GLenum)pname,
2543 (GLint)param
2544 );
2545}
2546
2547/* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */
2548static void
2549android_glTexEnviv__II_3II
2550 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002551 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002552 const char * _exceptionType = NULL;
2553 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002554 GLint *params_base = (GLint *) 0;
2555 jint _remaining;
2556 GLint *params = (GLint *) 0;
2557
2558 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002559 _exception = 1;
2560 _exceptionType = "java/lang/IllegalArgumentException";
2561 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002562 goto exit;
2563 }
2564 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002565 _exception = 1;
2566 _exceptionType = "java/lang/IllegalArgumentException";
2567 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002568 goto exit;
2569 }
2570 _remaining = _env->GetArrayLength(params_ref) - offset;
2571 int _needed;
2572 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002573#if defined(GL_TEXTURE_ENV_COLOR)
2574 case GL_TEXTURE_ENV_COLOR:
2575#endif // defined(GL_TEXTURE_ENV_COLOR)
2576 _needed = 4;
2577 break;
2578 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002579 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002580 break;
2581 }
2582 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002583 _exception = 1;
2584 _exceptionType = "java/lang/IllegalArgumentException";
2585 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002586 goto exit;
2587 }
2588 params_base = (GLint *)
2589 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2590 params = params_base + offset;
2591
2592 glTexEnviv(
2593 (GLenum)target,
2594 (GLenum)pname,
2595 (GLint *)params
2596 );
2597
2598exit:
2599 if (params_base) {
2600 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2601 JNI_ABORT);
2602 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002603 if (_exception) {
2604 jniThrowException(_env, _exceptionType, _exceptionMessage);
2605 }
Jack Palevich27f80022009-04-15 19:13:17 -07002606}
2607
2608/* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */
2609static void
2610android_glTexEnviv__IILjava_nio_IntBuffer_2
2611 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002612 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002613 const char * _exceptionType = NULL;
2614 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002615 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002616 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002617 jint _remaining;
2618 GLint *params = (GLint *) 0;
2619
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002620 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002621 int _needed;
2622 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002623#if defined(GL_TEXTURE_ENV_COLOR)
2624 case GL_TEXTURE_ENV_COLOR:
2625#endif // defined(GL_TEXTURE_ENV_COLOR)
2626 _needed = 4;
2627 break;
2628 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002629 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002630 break;
2631 }
2632 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002633 _exception = 1;
2634 _exceptionType = "java/lang/IllegalArgumentException";
2635 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002636 goto exit;
2637 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002638 if (params == NULL) {
2639 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2640 params = (GLint *) (_paramsBase + _bufferOffset);
2641 }
Jack Palevich27f80022009-04-15 19:13:17 -07002642 glTexEnviv(
2643 (GLenum)target,
2644 (GLenum)pname,
2645 (GLint *)params
2646 );
2647
2648exit:
2649 if (_array) {
2650 releasePointer(_env, _array, params, JNI_FALSE);
2651 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002652 if (_exception) {
2653 jniThrowException(_env, _exceptionType, _exceptionMessage);
2654 }
Jack Palevich27f80022009-04-15 19:13:17 -07002655}
2656
2657/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
2658static void
2659android_glTexParameterfv__II_3FI
2660 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002661 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002662 const char * _exceptionType = NULL;
2663 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002664 GLfloat *params_base = (GLfloat *) 0;
2665 jint _remaining;
2666 GLfloat *params = (GLfloat *) 0;
2667
2668 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002669 _exception = 1;
2670 _exceptionType = "java/lang/IllegalArgumentException";
2671 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002672 goto exit;
2673 }
2674 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002675 _exception = 1;
2676 _exceptionType = "java/lang/IllegalArgumentException";
2677 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002678 goto exit;
2679 }
2680 _remaining = _env->GetArrayLength(params_ref) - offset;
2681 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002682 _exception = 1;
2683 _exceptionType = "java/lang/IllegalArgumentException";
2684 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002685 goto exit;
2686 }
2687 params_base = (GLfloat *)
2688 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2689 params = params_base + offset;
2690
2691 glTexParameterfv(
2692 (GLenum)target,
2693 (GLenum)pname,
2694 (GLfloat *)params
2695 );
2696
2697exit:
2698 if (params_base) {
2699 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2700 JNI_ABORT);
2701 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002702 if (_exception) {
2703 jniThrowException(_env, _exceptionType, _exceptionMessage);
2704 }
Jack Palevich27f80022009-04-15 19:13:17 -07002705}
2706
2707/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
2708static void
2709android_glTexParameterfv__IILjava_nio_FloatBuffer_2
2710 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002711 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002712 const char * _exceptionType = NULL;
2713 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002714 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002715 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002716 jint _remaining;
2717 GLfloat *params = (GLfloat *) 0;
2718
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002719 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002720 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002721 _exception = 1;
2722 _exceptionType = "java/lang/IllegalArgumentException";
2723 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002724 goto exit;
2725 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002726 if (params == NULL) {
2727 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2728 params = (GLfloat *) (_paramsBase + _bufferOffset);
2729 }
Jack Palevich27f80022009-04-15 19:13:17 -07002730 glTexParameterfv(
2731 (GLenum)target,
2732 (GLenum)pname,
2733 (GLfloat *)params
2734 );
2735
2736exit:
2737 if (_array) {
2738 releasePointer(_env, _array, params, JNI_FALSE);
2739 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002740 if (_exception) {
2741 jniThrowException(_env, _exceptionType, _exceptionMessage);
2742 }
Jack Palevich27f80022009-04-15 19:13:17 -07002743}
2744
2745/* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */
2746static void
2747android_glTexParameteri__III
2748 (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
2749 glTexParameteri(
2750 (GLenum)target,
2751 (GLenum)pname,
2752 (GLint)param
2753 );
2754}
2755
2756/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
2757static void
2758android_glTexParameteriv__II_3II
2759 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002760 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002761 const char * _exceptionType = NULL;
2762 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002763 GLint *params_base = (GLint *) 0;
2764 jint _remaining;
2765 GLint *params = (GLint *) 0;
2766
2767 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002768 _exception = 1;
2769 _exceptionType = "java/lang/IllegalArgumentException";
2770 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002771 goto exit;
2772 }
2773 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002774 _exception = 1;
2775 _exceptionType = "java/lang/IllegalArgumentException";
2776 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002777 goto exit;
2778 }
2779 _remaining = _env->GetArrayLength(params_ref) - offset;
2780 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002781 _exception = 1;
2782 _exceptionType = "java/lang/IllegalArgumentException";
2783 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002784 goto exit;
2785 }
2786 params_base = (GLint *)
2787 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2788 params = params_base + offset;
2789
2790 glTexParameteriv(
2791 (GLenum)target,
2792 (GLenum)pname,
2793 (GLint *)params
2794 );
2795
2796exit:
2797 if (params_base) {
2798 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2799 JNI_ABORT);
2800 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002801 if (_exception) {
2802 jniThrowException(_env, _exceptionType, _exceptionMessage);
2803 }
Jack Palevich27f80022009-04-15 19:13:17 -07002804}
2805
2806/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
2807static void
2808android_glTexParameteriv__IILjava_nio_IntBuffer_2
2809 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002810 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002811 const char * _exceptionType = NULL;
2812 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002813 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002814 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002815 jint _remaining;
2816 GLint *params = (GLint *) 0;
2817
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002818 params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002819 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002820 _exception = 1;
2821 _exceptionType = "java/lang/IllegalArgumentException";
2822 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002823 goto exit;
2824 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002825 if (params == NULL) {
2826 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2827 params = (GLint *) (_paramsBase + _bufferOffset);
2828 }
Jack Palevich27f80022009-04-15 19:13:17 -07002829 glTexParameteriv(
2830 (GLenum)target,
2831 (GLenum)pname,
2832 (GLint *)params
2833 );
2834
2835exit:
2836 if (_array) {
2837 releasePointer(_env, _array, params, JNI_FALSE);
2838 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002839 if (_exception) {
2840 jniThrowException(_env, _exceptionType, _exceptionMessage);
2841 }
Jack Palevich27f80022009-04-15 19:13:17 -07002842}
2843
2844/* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */
2845static void
2846android_glTexParameterxv__II_3II
2847 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002848 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002849 const char * _exceptionType = NULL;
2850 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002851 GLfixed *params_base = (GLfixed *) 0;
2852 jint _remaining;
2853 GLfixed *params = (GLfixed *) 0;
2854
2855 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002856 _exception = 1;
2857 _exceptionType = "java/lang/IllegalArgumentException";
2858 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002859 goto exit;
2860 }
2861 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002862 _exception = 1;
2863 _exceptionType = "java/lang/IllegalArgumentException";
2864 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002865 goto exit;
2866 }
2867 _remaining = _env->GetArrayLength(params_ref) - offset;
2868 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002869 _exception = 1;
2870 _exceptionType = "java/lang/IllegalArgumentException";
2871 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002872 goto exit;
2873 }
2874 params_base = (GLfixed *)
2875 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2876 params = params_base + offset;
2877
2878 glTexParameterxv(
2879 (GLenum)target,
2880 (GLenum)pname,
2881 (GLfixed *)params
2882 );
2883
2884exit:
2885 if (params_base) {
2886 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2887 JNI_ABORT);
2888 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002889 if (_exception) {
2890 jniThrowException(_env, _exceptionType, _exceptionMessage);
2891 }
Jack Palevich27f80022009-04-15 19:13:17 -07002892}
2893
2894/* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */
2895static void
2896android_glTexParameterxv__IILjava_nio_IntBuffer_2
2897 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002898 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002899 const char * _exceptionType = NULL;
2900 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002901 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002902 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002903 jint _remaining;
2904 GLfixed *params = (GLfixed *) 0;
2905
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002906 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002907 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002908 _exception = 1;
2909 _exceptionType = "java/lang/IllegalArgumentException";
2910 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002911 goto exit;
2912 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002913 if (params == NULL) {
2914 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2915 params = (GLfixed *) (_paramsBase + _bufferOffset);
2916 }
Jack Palevich27f80022009-04-15 19:13:17 -07002917 glTexParameterxv(
2918 (GLenum)target,
2919 (GLenum)pname,
2920 (GLfixed *)params
2921 );
2922
2923exit:
2924 if (_array) {
2925 releasePointer(_env, _array, params, JNI_FALSE);
2926 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002927 if (_exception) {
2928 jniThrowException(_env, _exceptionType, _exceptionMessage);
2929 }
Jack Palevich27f80022009-04-15 19:13:17 -07002930}
2931
2932/* void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
2933static void
2934android_glVertexPointer__IIII
2935 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
2936 glVertexPointer(
2937 (GLint)size,
2938 (GLenum)type,
2939 (GLsizei)stride,
Andy McFaddencee51982013-04-25 16:08:31 -07002940 (GLvoid *)offset
Jack Palevich27f80022009-04-15 19:13:17 -07002941 );
2942}
2943
2944static const char *classPathName = "android/opengl/GLES11";
2945
2946static JNINativeMethod methods[] = {
2947{"_nativeClassInit", "()V", (void*)nativeClassInit },
2948{"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II },
2949{"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I },
2950{"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 },
2951{"glClipPlanef", "(I[FI)V", (void *) android_glClipPlanef__I_3FI },
2952{"glClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glClipPlanef__ILjava_nio_FloatBuffer_2 },
2953{"glClipPlanex", "(I[II)V", (void *) android_glClipPlanex__I_3II },
2954{"glClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glClipPlanex__ILjava_nio_IntBuffer_2 },
2955{"glColor4ub", "(BBBB)V", (void *) android_glColor4ub__BBBB },
2956{"glColorPointer", "(IIII)V", (void *) android_glColorPointer__IIII },
2957{"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II },
2958{"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 },
2959{"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII },
2960{"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II },
2961{"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 },
2962{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI },
2963{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 },
2964{"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II },
2965{"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 },
2966{"glGetClipPlanef", "(I[FI)V", (void *) android_glGetClipPlanef__I_3FI },
2967{"glGetClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetClipPlanef__ILjava_nio_FloatBuffer_2 },
2968{"glGetClipPlanex", "(I[II)V", (void *) android_glGetClipPlanex__I_3II },
2969{"glGetClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetClipPlanex__ILjava_nio_IntBuffer_2 },
2970{"glGetFixedv", "(I[II)V", (void *) android_glGetFixedv__I_3II },
2971{"glGetFixedv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetFixedv__ILjava_nio_IntBuffer_2 },
2972{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI },
2973{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 },
2974{"glGetLightfv", "(II[FI)V", (void *) android_glGetLightfv__II_3FI },
2975{"glGetLightfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetLightfv__IILjava_nio_FloatBuffer_2 },
2976{"glGetLightxv", "(II[II)V", (void *) android_glGetLightxv__II_3II },
2977{"glGetLightxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetLightxv__IILjava_nio_IntBuffer_2 },
2978{"glGetMaterialfv", "(II[FI)V", (void *) android_glGetMaterialfv__II_3FI },
2979{"glGetMaterialfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetMaterialfv__IILjava_nio_FloatBuffer_2 },
2980{"glGetMaterialxv", "(II[II)V", (void *) android_glGetMaterialxv__II_3II },
2981{"glGetMaterialxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetMaterialxv__IILjava_nio_IntBuffer_2 },
2982{"glGetTexEnvfv", "(II[FI)V", (void *) android_glGetTexEnvfv__II_3FI },
2983{"glGetTexEnvfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2 },
2984{"glGetTexEnviv", "(II[II)V", (void *) android_glGetTexEnviv__II_3II },
2985{"glGetTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnviv__IILjava_nio_IntBuffer_2 },
2986{"glGetTexEnvxv", "(II[II)V", (void *) android_glGetTexEnvxv__II_3II },
2987{"glGetTexEnvxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnvxv__IILjava_nio_IntBuffer_2 },
2988{"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI },
2989{"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 },
2990{"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II },
2991{"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 },
2992{"glGetTexParameterxv", "(II[II)V", (void *) android_glGetTexParameterxv__II_3II },
2993{"glGetTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameterxv__IILjava_nio_IntBuffer_2 },
2994{"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I },
2995{"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I },
2996{"glIsTexture", "(I)Z", (void *) android_glIsTexture__I },
2997{"glNormalPointer", "(III)V", (void *) android_glNormalPointer__III },
2998{"glPointParameterf", "(IF)V", (void *) android_glPointParameterf__IF },
2999{"glPointParameterfv", "(I[FI)V", (void *) android_glPointParameterfv__I_3FI },
3000{"glPointParameterfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glPointParameterfv__ILjava_nio_FloatBuffer_2 },
3001{"glPointParameterx", "(II)V", (void *) android_glPointParameterx__II },
3002{"glPointParameterxv", "(I[II)V", (void *) android_glPointParameterxv__I_3II },
3003{"glPointParameterxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glPointParameterxv__ILjava_nio_IntBuffer_2 },
Jack Palevichbe6eac82009-12-08 15:43:51 +08003004{"glPointSizePointerOESBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I },
Jack Palevich27f80022009-04-15 19:13:17 -07003005{"glTexCoordPointer", "(IIII)V", (void *) android_glTexCoordPointer__IIII },
3006{"glTexEnvi", "(III)V", (void *) android_glTexEnvi__III },
3007{"glTexEnviv", "(II[II)V", (void *) android_glTexEnviv__II_3II },
3008{"glTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexEnviv__IILjava_nio_IntBuffer_2 },
3009{"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI },
3010{"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 },
3011{"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III },
3012{"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II },
3013{"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 },
3014{"glTexParameterxv", "(II[II)V", (void *) android_glTexParameterxv__II_3II },
3015{"glTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameterxv__IILjava_nio_IntBuffer_2 },
3016{"glVertexPointer", "(IIII)V", (void *) android_glVertexPointer__IIII },
3017};
3018
3019int register_android_opengl_jni_GLES11(JNIEnv *_env)
3020{
3021 int err;
3022 err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
3023 return err;
3024}