blob: cc34e9932f9cc983bbfb04f657879c8010f2db45 [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>
Mathias Agopian8331f722009-05-08 15:35:17 -070028
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 Palevich16e79722009-05-15 18:13:34 -0700132static 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 Palevich16e79722009-05-15 18:13:34 -0700142 }
143 return (void*) buf;
144}
145
Mathias Agopian2ad04772013-02-23 03:12:30 -0800146// --------------------------------------------------------------------------
147
148/*
149 * returns the number of values glGet returns for a given pname.
150 *
151 * The code below is written such that pnames requiring only one values
152 * are the default (and are not explicitely tested for). This makes the
153 * checking code much shorter/readable/efficient.
154 *
155 * This means that unknown pnames (e.g.: extensions) will default to 1. If
156 * that unknown pname needs more than 1 value, then the validation check
157 * is incomplete and the app may crash if it passed the wrong number params.
158 */
159static int getNeededCount(GLint pname) {
160 int needed = 1;
161#ifdef GL_ES_VERSION_2_0
162 // GLES 2.x pnames
163 switch (pname) {
164 case GL_ALIASED_LINE_WIDTH_RANGE:
165 case GL_ALIASED_POINT_SIZE_RANGE:
166 needed = 2;
167 break;
168
169 case GL_BLEND_COLOR:
170 case GL_COLOR_CLEAR_VALUE:
171 case GL_COLOR_WRITEMASK:
172 case GL_SCISSOR_BOX:
173 case GL_VIEWPORT:
174 needed = 4;
175 break;
176
177 case GL_COMPRESSED_TEXTURE_FORMATS:
178 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
179 break;
180
181 case GL_SHADER_BINARY_FORMATS:
182 glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed);
183 break;
184 }
185#endif
186
187#ifdef GL_VERSION_ES_CM_1_1
188 // GLES 1.x pnames
189 switch (pname) {
190 case GL_ALIASED_LINE_WIDTH_RANGE:
191 case GL_ALIASED_POINT_SIZE_RANGE:
192 case GL_DEPTH_RANGE:
193 case GL_SMOOTH_LINE_WIDTH_RANGE:
194 case GL_SMOOTH_POINT_SIZE_RANGE:
195 needed = 2;
196 break;
197
198 case GL_CURRENT_NORMAL:
199 case GL_POINT_DISTANCE_ATTENUATION:
200 needed = 3;
201 break;
202
203 case GL_COLOR_CLEAR_VALUE:
204 case GL_COLOR_WRITEMASK:
205 case GL_CURRENT_COLOR:
206 case GL_CURRENT_TEXTURE_COORDS:
207 case GL_FOG_COLOR:
208 case GL_LIGHT_MODEL_AMBIENT:
209 case GL_SCISSOR_BOX:
210 case GL_VIEWPORT:
211 needed = 4;
212 break;
213
214 case GL_MODELVIEW_MATRIX:
215 case GL_PROJECTION_MATRIX:
216 case GL_TEXTURE_MATRIX:
217 needed = 16;
218 break;
219
220 case GL_COMPRESSED_TEXTURE_FORMATS:
221 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
222 break;
223 }
224#endif
225 return needed;
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 }
Jack Palevichbe509c92009-05-07 09:52:14 -0700324}
325
Jack Palevich27f80022009-04-15 19:13:17 -0700326// --------------------------------------------------------------------------
Jack Palevich27f80022009-04-15 19:13:17 -0700327/* void glActiveTexture ( GLenum texture ) */
328static void
329android_glActiveTexture__I
330 (JNIEnv *_env, jobject _this, jint texture) {
331 glActiveTexture(
332 (GLenum)texture
333 );
334}
335
336/* void glAlphaFunc ( GLenum func, GLclampf ref ) */
337static void
338android_glAlphaFunc__IF
339 (JNIEnv *_env, jobject _this, jint func, jfloat ref) {
340 glAlphaFunc(
341 (GLenum)func,
342 (GLclampf)ref
343 );
344}
345
346/* void glAlphaFuncx ( GLenum func, GLclampx ref ) */
347static void
348android_glAlphaFuncx__II
349 (JNIEnv *_env, jobject _this, jint func, jint ref) {
350 glAlphaFuncx(
351 (GLenum)func,
352 (GLclampx)ref
353 );
354}
355
356/* void glBindTexture ( GLenum target, GLuint texture ) */
357static void
358android_glBindTexture__II
359 (JNIEnv *_env, jobject _this, jint target, jint texture) {
360 glBindTexture(
361 (GLenum)target,
362 (GLuint)texture
363 );
364}
365
366/* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */
367static void
368android_glBlendFunc__II
369 (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) {
370 glBlendFunc(
371 (GLenum)sfactor,
372 (GLenum)dfactor
373 );
374}
375
376/* void glClear ( GLbitfield mask ) */
377static void
378android_glClear__I
379 (JNIEnv *_env, jobject _this, jint mask) {
380 glClear(
381 (GLbitfield)mask
382 );
383}
384
385/* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
386static void
387android_glClearColor__FFFF
388 (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
389 glClearColor(
390 (GLclampf)red,
391 (GLclampf)green,
392 (GLclampf)blue,
393 (GLclampf)alpha
394 );
395}
396
397/* void glClearColorx ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha ) */
398static void
399android_glClearColorx__IIII
400 (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) {
401 glClearColorx(
402 (GLclampx)red,
403 (GLclampx)green,
404 (GLclampx)blue,
405 (GLclampx)alpha
406 );
407}
408
409/* void glClearDepthf ( GLclampf depth ) */
410static void
411android_glClearDepthf__F
412 (JNIEnv *_env, jobject _this, jfloat depth) {
413 glClearDepthf(
414 (GLclampf)depth
415 );
416}
417
418/* void glClearDepthx ( GLclampx depth ) */
419static void
420android_glClearDepthx__I
421 (JNIEnv *_env, jobject _this, jint depth) {
422 glClearDepthx(
423 (GLclampx)depth
424 );
425}
426
427/* void glClearStencil ( GLint s ) */
428static void
429android_glClearStencil__I
430 (JNIEnv *_env, jobject _this, jint s) {
431 glClearStencil(
432 (GLint)s
433 );
434}
435
436/* void glClientActiveTexture ( GLenum texture ) */
437static void
438android_glClientActiveTexture__I
439 (JNIEnv *_env, jobject _this, jint texture) {
440 glClientActiveTexture(
441 (GLenum)texture
442 );
443}
444
445/* void glColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) */
446static void
447android_glColor4f__FFFF
448 (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
449 glColor4f(
450 (GLfloat)red,
451 (GLfloat)green,
452 (GLfloat)blue,
453 (GLfloat)alpha
454 );
455}
456
457/* void glColor4x ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha ) */
458static void
459android_glColor4x__IIII
460 (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) {
461 glColor4x(
462 (GLfixed)red,
463 (GLfixed)green,
464 (GLfixed)blue,
465 (GLfixed)alpha
466 );
467}
468
469/* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */
470static void
471android_glColorMask__ZZZZ
472 (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) {
473 glColorMask(
474 (GLboolean)red,
475 (GLboolean)green,
476 (GLboolean)blue,
477 (GLboolean)alpha
478 );
479}
480
481/* void glColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
482static void
483android_glColorPointerBounds__IIILjava_nio_Buffer_2I
484 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
485 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700486 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700487 jint _remaining;
488 GLvoid *pointer = (GLvoid *) 0;
489
Jack Paleviche20ea782009-05-07 18:28:29 -0700490 if (pointer_buf) {
Jack Palevich16e79722009-05-15 18:13:34 -0700491 pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
Jack Paleviche20ea782009-05-07 18:28:29 -0700492 if ( ! pointer ) {
Jack Paleviche20ea782009-05-07 18:28:29 -0700493 return;
494 }
495 }
Jack Palevich27f80022009-04-15 19:13:17 -0700496 glColorPointerBounds(
497 (GLint)size,
498 (GLenum)type,
499 (GLsizei)stride,
500 (GLvoid *)pointer,
501 (GLsizei)remaining
502 );
Jack Palevich27f80022009-04-15 19:13:17 -0700503}
504
505/* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */
506static void
507android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2
508 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) {
509 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700510 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700511 jint _remaining;
512 GLvoid *data = (GLvoid *) 0;
513
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700514 data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
515 if (data == NULL) {
516 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
517 data = (GLvoid *) (_dataBase + _bufferOffset);
518 }
Jack Palevich27f80022009-04-15 19:13:17 -0700519 glCompressedTexImage2D(
520 (GLenum)target,
521 (GLint)level,
522 (GLenum)internalformat,
523 (GLsizei)width,
524 (GLsizei)height,
525 (GLint)border,
526 (GLsizei)imageSize,
527 (GLvoid *)data
528 );
529 if (_array) {
530 releasePointer(_env, _array, data, JNI_FALSE);
531 }
532}
533
534/* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */
535static void
536android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
537 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) {
538 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700539 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700540 jint _remaining;
541 GLvoid *data = (GLvoid *) 0;
542
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700543 data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
544 if (data == NULL) {
545 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
546 data = (GLvoid *) (_dataBase + _bufferOffset);
547 }
Jack Palevich27f80022009-04-15 19:13:17 -0700548 glCompressedTexSubImage2D(
549 (GLenum)target,
550 (GLint)level,
551 (GLint)xoffset,
552 (GLint)yoffset,
553 (GLsizei)width,
554 (GLsizei)height,
555 (GLenum)format,
556 (GLsizei)imageSize,
557 (GLvoid *)data
558 );
559 if (_array) {
560 releasePointer(_env, _array, data, JNI_FALSE);
561 }
562}
563
564/* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */
565static void
566android_glCopyTexImage2D__IIIIIIII
567 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) {
568 glCopyTexImage2D(
569 (GLenum)target,
570 (GLint)level,
571 (GLenum)internalformat,
572 (GLint)x,
573 (GLint)y,
574 (GLsizei)width,
575 (GLsizei)height,
576 (GLint)border
577 );
578}
579
580/* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */
581static void
582android_glCopyTexSubImage2D__IIIIIIII
583 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) {
584 glCopyTexSubImage2D(
585 (GLenum)target,
586 (GLint)level,
587 (GLint)xoffset,
588 (GLint)yoffset,
589 (GLint)x,
590 (GLint)y,
591 (GLsizei)width,
592 (GLsizei)height
593 );
594}
595
596/* void glCullFace ( GLenum mode ) */
597static void
598android_glCullFace__I
599 (JNIEnv *_env, jobject _this, jint mode) {
600 glCullFace(
601 (GLenum)mode
602 );
603}
604
605/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
606static void
607android_glDeleteTextures__I_3II
608 (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700609 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800610 const char * _exceptionType = NULL;
611 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700612 GLuint *textures_base = (GLuint *) 0;
613 jint _remaining;
614 GLuint *textures = (GLuint *) 0;
615
616 if (!textures_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700617 _exception = 1;
618 _exceptionType = "java/lang/IllegalArgumentException";
619 _exceptionMessage = "textures == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700620 goto exit;
621 }
622 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700623 _exception = 1;
624 _exceptionType = "java/lang/IllegalArgumentException";
625 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700626 goto exit;
627 }
628 _remaining = _env->GetArrayLength(textures_ref) - offset;
629 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700630 _exception = 1;
631 _exceptionType = "java/lang/IllegalArgumentException";
632 _exceptionMessage = "length - offset < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700633 goto exit;
634 }
635 textures_base = (GLuint *)
636 _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
637 textures = textures_base + offset;
638
639 glDeleteTextures(
640 (GLsizei)n,
641 (GLuint *)textures
642 );
643
644exit:
645 if (textures_base) {
646 _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
647 JNI_ABORT);
648 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700649 if (_exception) {
650 jniThrowException(_env, _exceptionType, _exceptionMessage);
651 }
Jack Palevich27f80022009-04-15 19:13:17 -0700652}
653
654/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
655static void
656android_glDeleteTextures__ILjava_nio_IntBuffer_2
657 (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700658 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800659 const char * _exceptionType = NULL;
660 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700661 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700662 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700663 jint _remaining;
664 GLuint *textures = (GLuint *) 0;
665
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700666 textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -0700667 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700668 _exception = 1;
669 _exceptionType = "java/lang/IllegalArgumentException";
670 _exceptionMessage = "remaining() < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700671 goto exit;
672 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700673 if (textures == NULL) {
674 char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
675 textures = (GLuint *) (_texturesBase + _bufferOffset);
676 }
Jack Palevich27f80022009-04-15 19:13:17 -0700677 glDeleteTextures(
678 (GLsizei)n,
679 (GLuint *)textures
680 );
681
682exit:
683 if (_array) {
684 releasePointer(_env, _array, textures, JNI_FALSE);
685 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700686 if (_exception) {
687 jniThrowException(_env, _exceptionType, _exceptionMessage);
688 }
Jack Palevich27f80022009-04-15 19:13:17 -0700689}
690
691/* void glDepthFunc ( GLenum func ) */
692static void
693android_glDepthFunc__I
694 (JNIEnv *_env, jobject _this, jint func) {
695 glDepthFunc(
696 (GLenum)func
697 );
698}
699
700/* void glDepthMask ( GLboolean flag ) */
701static void
702android_glDepthMask__Z
703 (JNIEnv *_env, jobject _this, jboolean flag) {
704 glDepthMask(
705 (GLboolean)flag
706 );
707}
708
709/* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */
710static void
711android_glDepthRangef__FF
712 (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) {
713 glDepthRangef(
714 (GLclampf)zNear,
715 (GLclampf)zFar
716 );
717}
718
719/* void glDepthRangex ( GLclampx zNear, GLclampx zFar ) */
720static void
721android_glDepthRangex__II
722 (JNIEnv *_env, jobject _this, jint zNear, jint zFar) {
723 glDepthRangex(
724 (GLclampx)zNear,
725 (GLclampx)zFar
726 );
727}
728
729/* void glDisable ( GLenum cap ) */
730static void
731android_glDisable__I
732 (JNIEnv *_env, jobject _this, jint cap) {
733 glDisable(
734 (GLenum)cap
735 );
736}
737
738/* void glDisableClientState ( GLenum array ) */
739static void
740android_glDisableClientState__I
741 (JNIEnv *_env, jobject _this, jint array) {
742 glDisableClientState(
743 (GLenum)array
744 );
745}
746
747/* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */
748static void
749android_glDrawArrays__III
750 (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) {
751 glDrawArrays(
752 (GLenum)mode,
753 (GLint)first,
754 (GLsizei)count
755 );
756}
757
758/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */
759static void
760android_glDrawElements__IIILjava_nio_Buffer_2
761 (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700762 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800763 const char * _exceptionType = NULL;
764 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700765 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700766 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700767 jint _remaining;
768 GLvoid *indices = (GLvoid *) 0;
769
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700770 indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -0700771 if (_remaining < count) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700772 _exception = 1;
773 _exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
774 _exceptionMessage = "remaining() < count < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700775 goto exit;
776 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700777 if (indices == NULL) {
778 char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
779 indices = (GLvoid *) (_indicesBase + _bufferOffset);
780 }
Jack Palevich27f80022009-04-15 19:13:17 -0700781 glDrawElements(
782 (GLenum)mode,
783 (GLsizei)count,
784 (GLenum)type,
785 (GLvoid *)indices
786 );
787
788exit:
789 if (_array) {
790 releasePointer(_env, _array, indices, JNI_FALSE);
791 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700792 if (_exception) {
793 jniThrowException(_env, _exceptionType, _exceptionMessage);
794 }
Jack Palevich27f80022009-04-15 19:13:17 -0700795}
796
797/* void glEnable ( GLenum cap ) */
798static void
799android_glEnable__I
800 (JNIEnv *_env, jobject _this, jint cap) {
801 glEnable(
802 (GLenum)cap
803 );
804}
805
806/* void glEnableClientState ( GLenum array ) */
807static void
808android_glEnableClientState__I
809 (JNIEnv *_env, jobject _this, jint array) {
810 glEnableClientState(
811 (GLenum)array
812 );
813}
814
815/* void glFinish ( void ) */
816static void
817android_glFinish__
818 (JNIEnv *_env, jobject _this) {
819 glFinish();
820}
821
822/* void glFlush ( void ) */
823static void
824android_glFlush__
825 (JNIEnv *_env, jobject _this) {
826 glFlush();
827}
828
829/* void glFogf ( GLenum pname, GLfloat param ) */
830static void
831android_glFogf__IF
832 (JNIEnv *_env, jobject _this, jint pname, jfloat param) {
833 glFogf(
834 (GLenum)pname,
835 (GLfloat)param
836 );
837}
838
839/* void glFogfv ( GLenum pname, const GLfloat *params ) */
840static void
841android_glFogfv__I_3FI
842 (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700843 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800844 const char * _exceptionType = NULL;
845 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700846 GLfloat *params_base = (GLfloat *) 0;
847 jint _remaining;
848 GLfloat *params = (GLfloat *) 0;
849
850 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700851 _exception = 1;
852 _exceptionType = "java/lang/IllegalArgumentException";
853 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700854 goto exit;
855 }
856 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700857 _exception = 1;
858 _exceptionType = "java/lang/IllegalArgumentException";
859 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700860 goto exit;
861 }
862 _remaining = _env->GetArrayLength(params_ref) - offset;
863 int _needed;
864 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -0700865#if defined(GL_FOG_COLOR)
866 case GL_FOG_COLOR:
867#endif // defined(GL_FOG_COLOR)
868 _needed = 4;
869 break;
870 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -0800871 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -0700872 break;
873 }
874 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700875 _exception = 1;
876 _exceptionType = "java/lang/IllegalArgumentException";
877 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700878 goto exit;
879 }
880 params_base = (GLfloat *)
881 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
882 params = params_base + offset;
883
884 glFogfv(
885 (GLenum)pname,
886 (GLfloat *)params
887 );
888
889exit:
890 if (params_base) {
891 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
892 JNI_ABORT);
893 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700894 if (_exception) {
895 jniThrowException(_env, _exceptionType, _exceptionMessage);
896 }
Jack Palevich27f80022009-04-15 19:13:17 -0700897}
898
899/* void glFogfv ( GLenum pname, const GLfloat *params ) */
900static void
901android_glFogfv__ILjava_nio_FloatBuffer_2
902 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700903 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800904 const char * _exceptionType = NULL;
905 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700906 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700907 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -0700908 jint _remaining;
909 GLfloat *params = (GLfloat *) 0;
910
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700911 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -0700912 int _needed;
913 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -0700914#if defined(GL_FOG_COLOR)
915 case GL_FOG_COLOR:
916#endif // defined(GL_FOG_COLOR)
917 _needed = 4;
918 break;
919 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -0800920 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -0700921 break;
922 }
923 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700924 _exception = 1;
925 _exceptionType = "java/lang/IllegalArgumentException";
926 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700927 goto exit;
928 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700929 if (params == NULL) {
930 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
931 params = (GLfloat *) (_paramsBase + _bufferOffset);
932 }
Jack Palevich27f80022009-04-15 19:13:17 -0700933 glFogfv(
934 (GLenum)pname,
935 (GLfloat *)params
936 );
937
938exit:
939 if (_array) {
940 releasePointer(_env, _array, params, JNI_FALSE);
941 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700942 if (_exception) {
943 jniThrowException(_env, _exceptionType, _exceptionMessage);
944 }
Jack Palevich27f80022009-04-15 19:13:17 -0700945}
946
947/* void glFogx ( GLenum pname, GLfixed param ) */
948static void
949android_glFogx__II
950 (JNIEnv *_env, jobject _this, jint pname, jint param) {
951 glFogx(
952 (GLenum)pname,
953 (GLfixed)param
954 );
955}
956
957/* void glFogxv ( GLenum pname, const GLfixed *params ) */
958static void
959android_glFogxv__I_3II
960 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700961 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800962 const char * _exceptionType = NULL;
963 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -0700964 GLfixed *params_base = (GLfixed *) 0;
965 jint _remaining;
966 GLfixed *params = (GLfixed *) 0;
967
968 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700969 _exception = 1;
970 _exceptionType = "java/lang/IllegalArgumentException";
971 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -0700972 goto exit;
973 }
974 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700975 _exception = 1;
976 _exceptionType = "java/lang/IllegalArgumentException";
977 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -0700978 goto exit;
979 }
980 _remaining = _env->GetArrayLength(params_ref) - offset;
981 int _needed;
982 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -0700983#if defined(GL_FOG_COLOR)
984 case GL_FOG_COLOR:
985#endif // defined(GL_FOG_COLOR)
986 _needed = 4;
987 break;
988 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -0800989 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -0700990 break;
991 }
992 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700993 _exception = 1;
994 _exceptionType = "java/lang/IllegalArgumentException";
995 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -0700996 goto exit;
997 }
998 params_base = (GLfixed *)
999 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1000 params = params_base + offset;
1001
1002 glFogxv(
1003 (GLenum)pname,
1004 (GLfixed *)params
1005 );
1006
1007exit:
1008 if (params_base) {
1009 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1010 JNI_ABORT);
1011 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001012 if (_exception) {
1013 jniThrowException(_env, _exceptionType, _exceptionMessage);
1014 }
Jack Palevich27f80022009-04-15 19:13:17 -07001015}
1016
1017/* void glFogxv ( GLenum pname, const GLfixed *params ) */
1018static void
1019android_glFogxv__ILjava_nio_IntBuffer_2
1020 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001021 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001022 const char * _exceptionType = NULL;
1023 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001024 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001025 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001026 jint _remaining;
1027 GLfixed *params = (GLfixed *) 0;
1028
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001029 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001030 int _needed;
1031 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001032#if defined(GL_FOG_COLOR)
1033 case GL_FOG_COLOR:
1034#endif // defined(GL_FOG_COLOR)
1035 _needed = 4;
1036 break;
1037 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001038 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001039 break;
1040 }
1041 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001042 _exception = 1;
1043 _exceptionType = "java/lang/IllegalArgumentException";
1044 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001045 goto exit;
1046 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001047 if (params == NULL) {
1048 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1049 params = (GLfixed *) (_paramsBase + _bufferOffset);
1050 }
Jack Palevich27f80022009-04-15 19:13:17 -07001051 glFogxv(
1052 (GLenum)pname,
1053 (GLfixed *)params
1054 );
1055
1056exit:
1057 if (_array) {
1058 releasePointer(_env, _array, params, JNI_FALSE);
1059 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001060 if (_exception) {
1061 jniThrowException(_env, _exceptionType, _exceptionMessage);
1062 }
Jack Palevich27f80022009-04-15 19:13:17 -07001063}
1064
1065/* void glFrontFace ( GLenum mode ) */
1066static void
1067android_glFrontFace__I
1068 (JNIEnv *_env, jobject _this, jint mode) {
1069 glFrontFace(
1070 (GLenum)mode
1071 );
1072}
1073
1074/* void glFrustumf ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */
1075static void
1076android_glFrustumf__FFFFFF
1077 (JNIEnv *_env, jobject _this, jfloat left, jfloat right, jfloat bottom, jfloat top, jfloat zNear, jfloat zFar) {
1078 glFrustumf(
1079 (GLfloat)left,
1080 (GLfloat)right,
1081 (GLfloat)bottom,
1082 (GLfloat)top,
1083 (GLfloat)zNear,
1084 (GLfloat)zFar
1085 );
1086}
1087
1088/* void glFrustumx ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) */
1089static void
1090android_glFrustumx__IIIIII
1091 (JNIEnv *_env, jobject _this, jint left, jint right, jint bottom, jint top, jint zNear, jint zFar) {
1092 glFrustumx(
1093 (GLfixed)left,
1094 (GLfixed)right,
1095 (GLfixed)bottom,
1096 (GLfixed)top,
1097 (GLfixed)zNear,
1098 (GLfixed)zFar
1099 );
1100}
1101
1102/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1103static void
1104android_glGenTextures__I_3II
1105 (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
1106 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001107 const char * _exceptionType = NULL;
1108 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001109 GLuint *textures_base = (GLuint *) 0;
1110 jint _remaining;
1111 GLuint *textures = (GLuint *) 0;
1112
1113 if (!textures_ref) {
1114 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001115 _exceptionType = "java/lang/IllegalArgumentException";
1116 _exceptionMessage = "textures == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001117 goto exit;
1118 }
1119 if (offset < 0) {
1120 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001121 _exceptionType = "java/lang/IllegalArgumentException";
1122 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001123 goto exit;
1124 }
1125 _remaining = _env->GetArrayLength(textures_ref) - offset;
1126 if (_remaining < n) {
1127 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001128 _exceptionType = "java/lang/IllegalArgumentException";
1129 _exceptionMessage = "length - offset < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001130 goto exit;
1131 }
1132 textures_base = (GLuint *)
1133 _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
1134 textures = textures_base + offset;
1135
1136 glGenTextures(
1137 (GLsizei)n,
1138 (GLuint *)textures
1139 );
1140
1141exit:
1142 if (textures_base) {
1143 _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
1144 _exception ? JNI_ABORT: 0);
1145 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001146 if (_exception) {
1147 jniThrowException(_env, _exceptionType, _exceptionMessage);
1148 }
Jack Palevich27f80022009-04-15 19:13:17 -07001149}
1150
1151/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1152static void
1153android_glGenTextures__ILjava_nio_IntBuffer_2
1154 (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
1155 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001156 const char * _exceptionType = NULL;
1157 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001158 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001159 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001160 jint _remaining;
1161 GLuint *textures = (GLuint *) 0;
1162
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001163 textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001164 if (_remaining < n) {
1165 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001166 _exceptionType = "java/lang/IllegalArgumentException";
1167 _exceptionMessage = "remaining() < n < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001168 goto exit;
1169 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001170 if (textures == NULL) {
1171 char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1172 textures = (GLuint *) (_texturesBase + _bufferOffset);
1173 }
Jack Palevich27f80022009-04-15 19:13:17 -07001174 glGenTextures(
1175 (GLsizei)n,
1176 (GLuint *)textures
1177 );
1178
1179exit:
1180 if (_array) {
1181 releasePointer(_env, _array, textures, _exception ? JNI_FALSE : JNI_TRUE);
1182 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001183 if (_exception) {
1184 jniThrowException(_env, _exceptionType, _exceptionMessage);
1185 }
Jack Palevich27f80022009-04-15 19:13:17 -07001186}
1187
1188/* GLenum glGetError ( void ) */
1189static jint
1190android_glGetError__
1191 (JNIEnv *_env, jobject _this) {
1192 GLenum _returnValue;
1193 _returnValue = glGetError();
Andy McFaddencee51982013-04-25 16:08:31 -07001194 return (jint)_returnValue;
Jack Palevich27f80022009-04-15 19:13:17 -07001195}
1196
1197/* void glGetIntegerv ( GLenum pname, GLint *params ) */
1198static void
1199android_glGetIntegerv__I_3II
1200 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001201 get<jintArray, GLint, glGetIntegerv>(_env, _this, pname, params_ref, offset);
Jack Palevich27f80022009-04-15 19:13:17 -07001202}
1203
1204/* void glGetIntegerv ( GLenum pname, GLint *params ) */
1205static void
1206android_glGetIntegerv__ILjava_nio_IntBuffer_2
1207 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001208 getarray<GLint, glGetIntegerv>(_env, _this, pname, params_buf);
Jack Palevich27f80022009-04-15 19:13:17 -07001209}
1210
Jack Palevich27f80022009-04-15 19:13:17 -07001211/* const GLubyte * glGetString ( GLenum name ) */
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07001212static jstring android_glGetString(JNIEnv* _env, jobject, jint name) {
1213 const char* chars = (const char*) glGetString((GLenum) name);
1214 return _env->NewStringUTF(chars);
Jack Palevich27f80022009-04-15 19:13:17 -07001215}
1216/* void glHint ( GLenum target, GLenum mode ) */
1217static void
1218android_glHint__II
1219 (JNIEnv *_env, jobject _this, jint target, jint mode) {
1220 glHint(
1221 (GLenum)target,
1222 (GLenum)mode
1223 );
1224}
1225
1226/* void glLightModelf ( GLenum pname, GLfloat param ) */
1227static void
1228android_glLightModelf__IF
1229 (JNIEnv *_env, jobject _this, jint pname, jfloat param) {
1230 glLightModelf(
1231 (GLenum)pname,
1232 (GLfloat)param
1233 );
1234}
1235
1236/* void glLightModelfv ( GLenum pname, const GLfloat *params ) */
1237static void
1238android_glLightModelfv__I_3FI
1239 (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001240 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001241 const char * _exceptionType = NULL;
1242 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001243 GLfloat *params_base = (GLfloat *) 0;
1244 jint _remaining;
1245 GLfloat *params = (GLfloat *) 0;
1246
1247 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001248 _exception = 1;
1249 _exceptionType = "java/lang/IllegalArgumentException";
1250 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001251 goto exit;
1252 }
1253 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001254 _exception = 1;
1255 _exceptionType = "java/lang/IllegalArgumentException";
1256 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001257 goto exit;
1258 }
1259 _remaining = _env->GetArrayLength(params_ref) - offset;
1260 int _needed;
1261 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001262#if defined(GL_LIGHT_MODEL_AMBIENT)
1263 case GL_LIGHT_MODEL_AMBIENT:
1264#endif // defined(GL_LIGHT_MODEL_AMBIENT)
1265 _needed = 4;
1266 break;
1267 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001268 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001269 break;
1270 }
1271 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001272 _exception = 1;
1273 _exceptionType = "java/lang/IllegalArgumentException";
1274 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001275 goto exit;
1276 }
1277 params_base = (GLfloat *)
1278 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1279 params = params_base + offset;
1280
1281 glLightModelfv(
1282 (GLenum)pname,
1283 (GLfloat *)params
1284 );
1285
1286exit:
1287 if (params_base) {
1288 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1289 JNI_ABORT);
1290 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001291 if (_exception) {
1292 jniThrowException(_env, _exceptionType, _exceptionMessage);
1293 }
Jack Palevich27f80022009-04-15 19:13:17 -07001294}
1295
1296/* void glLightModelfv ( GLenum pname, const GLfloat *params ) */
1297static void
1298android_glLightModelfv__ILjava_nio_FloatBuffer_2
1299 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001300 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001301 const char * _exceptionType = NULL;
1302 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001303 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001304 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001305 jint _remaining;
1306 GLfloat *params = (GLfloat *) 0;
1307
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001308 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001309 int _needed;
1310 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001311#if defined(GL_LIGHT_MODEL_AMBIENT)
1312 case GL_LIGHT_MODEL_AMBIENT:
1313#endif // defined(GL_LIGHT_MODEL_AMBIENT)
1314 _needed = 4;
1315 break;
1316 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001317 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001318 break;
1319 }
1320 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001321 _exception = 1;
1322 _exceptionType = "java/lang/IllegalArgumentException";
1323 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001324 goto exit;
1325 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001326 if (params == NULL) {
1327 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1328 params = (GLfloat *) (_paramsBase + _bufferOffset);
1329 }
Jack Palevich27f80022009-04-15 19:13:17 -07001330 glLightModelfv(
1331 (GLenum)pname,
1332 (GLfloat *)params
1333 );
1334
1335exit:
1336 if (_array) {
1337 releasePointer(_env, _array, params, JNI_FALSE);
1338 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001339 if (_exception) {
1340 jniThrowException(_env, _exceptionType, _exceptionMessage);
1341 }
Jack Palevich27f80022009-04-15 19:13:17 -07001342}
1343
1344/* void glLightModelx ( GLenum pname, GLfixed param ) */
1345static void
1346android_glLightModelx__II
1347 (JNIEnv *_env, jobject _this, jint pname, jint param) {
1348 glLightModelx(
1349 (GLenum)pname,
1350 (GLfixed)param
1351 );
1352}
1353
1354/* void glLightModelxv ( GLenum pname, const GLfixed *params ) */
1355static void
1356android_glLightModelxv__I_3II
1357 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001358 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001359 const char * _exceptionType = NULL;
1360 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001361 GLfixed *params_base = (GLfixed *) 0;
1362 jint _remaining;
1363 GLfixed *params = (GLfixed *) 0;
1364
1365 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001366 _exception = 1;
1367 _exceptionType = "java/lang/IllegalArgumentException";
1368 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001369 goto exit;
1370 }
1371 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001372 _exception = 1;
1373 _exceptionType = "java/lang/IllegalArgumentException";
1374 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001375 goto exit;
1376 }
1377 _remaining = _env->GetArrayLength(params_ref) - offset;
1378 int _needed;
1379 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001380#if defined(GL_LIGHT_MODEL_AMBIENT)
1381 case GL_LIGHT_MODEL_AMBIENT:
1382#endif // defined(GL_LIGHT_MODEL_AMBIENT)
1383 _needed = 4;
1384 break;
1385 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001386 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001387 break;
1388 }
1389 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001390 _exception = 1;
1391 _exceptionType = "java/lang/IllegalArgumentException";
1392 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001393 goto exit;
1394 }
1395 params_base = (GLfixed *)
1396 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1397 params = params_base + offset;
1398
1399 glLightModelxv(
1400 (GLenum)pname,
1401 (GLfixed *)params
1402 );
1403
1404exit:
1405 if (params_base) {
1406 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1407 JNI_ABORT);
1408 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001409 if (_exception) {
1410 jniThrowException(_env, _exceptionType, _exceptionMessage);
1411 }
Jack Palevich27f80022009-04-15 19:13:17 -07001412}
1413
1414/* void glLightModelxv ( GLenum pname, const GLfixed *params ) */
1415static void
1416android_glLightModelxv__ILjava_nio_IntBuffer_2
1417 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001418 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001419 const char * _exceptionType = NULL;
1420 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001421 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001422 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001423 jint _remaining;
1424 GLfixed *params = (GLfixed *) 0;
1425
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001426 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001427 int _needed;
1428 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001429#if defined(GL_LIGHT_MODEL_AMBIENT)
1430 case GL_LIGHT_MODEL_AMBIENT:
1431#endif // defined(GL_LIGHT_MODEL_AMBIENT)
1432 _needed = 4;
1433 break;
1434 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001435 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001436 break;
1437 }
1438 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001439 _exception = 1;
1440 _exceptionType = "java/lang/IllegalArgumentException";
1441 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001442 goto exit;
1443 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001444 if (params == NULL) {
1445 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1446 params = (GLfixed *) (_paramsBase + _bufferOffset);
1447 }
Jack Palevich27f80022009-04-15 19:13:17 -07001448 glLightModelxv(
1449 (GLenum)pname,
1450 (GLfixed *)params
1451 );
1452
1453exit:
1454 if (_array) {
1455 releasePointer(_env, _array, params, JNI_FALSE);
1456 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001457 if (_exception) {
1458 jniThrowException(_env, _exceptionType, _exceptionMessage);
1459 }
Jack Palevich27f80022009-04-15 19:13:17 -07001460}
1461
1462/* void glLightf ( GLenum light, GLenum pname, GLfloat param ) */
1463static void
1464android_glLightf__IIF
1465 (JNIEnv *_env, jobject _this, jint light, jint pname, jfloat param) {
1466 glLightf(
1467 (GLenum)light,
1468 (GLenum)pname,
1469 (GLfloat)param
1470 );
1471}
1472
1473/* void glLightfv ( GLenum light, GLenum pname, const GLfloat *params ) */
1474static void
1475android_glLightfv__II_3FI
1476 (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001477 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001478 const char * _exceptionType = NULL;
1479 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001480 GLfloat *params_base = (GLfloat *) 0;
1481 jint _remaining;
1482 GLfloat *params = (GLfloat *) 0;
1483
1484 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001485 _exception = 1;
1486 _exceptionType = "java/lang/IllegalArgumentException";
1487 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001488 goto exit;
1489 }
1490 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001491 _exception = 1;
1492 _exceptionType = "java/lang/IllegalArgumentException";
1493 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001494 goto exit;
1495 }
1496 _remaining = _env->GetArrayLength(params_ref) - offset;
1497 int _needed;
1498 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001499#if defined(GL_SPOT_DIRECTION)
1500 case GL_SPOT_DIRECTION:
1501#endif // defined(GL_SPOT_DIRECTION)
1502 _needed = 3;
1503 break;
1504#if defined(GL_AMBIENT)
1505 case GL_AMBIENT:
1506#endif // defined(GL_AMBIENT)
1507#if defined(GL_DIFFUSE)
1508 case GL_DIFFUSE:
1509#endif // defined(GL_DIFFUSE)
1510#if defined(GL_SPECULAR)
1511 case GL_SPECULAR:
1512#endif // defined(GL_SPECULAR)
1513#if defined(GL_EMISSION)
1514 case GL_EMISSION:
1515#endif // defined(GL_EMISSION)
1516 _needed = 4;
1517 break;
1518 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001519 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001520 break;
1521 }
1522 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001523 _exception = 1;
1524 _exceptionType = "java/lang/IllegalArgumentException";
1525 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001526 goto exit;
1527 }
1528 params_base = (GLfloat *)
1529 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1530 params = params_base + offset;
1531
1532 glLightfv(
1533 (GLenum)light,
1534 (GLenum)pname,
1535 (GLfloat *)params
1536 );
1537
1538exit:
1539 if (params_base) {
1540 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1541 JNI_ABORT);
1542 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001543 if (_exception) {
1544 jniThrowException(_env, _exceptionType, _exceptionMessage);
1545 }
Jack Palevich27f80022009-04-15 19:13:17 -07001546}
1547
1548/* void glLightfv ( GLenum light, GLenum pname, const GLfloat *params ) */
1549static void
1550android_glLightfv__IILjava_nio_FloatBuffer_2
1551 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001552 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001553 const char * _exceptionType = NULL;
1554 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001555 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001556 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001557 jint _remaining;
1558 GLfloat *params = (GLfloat *) 0;
1559
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001560 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001561 int _needed;
1562 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001563#if defined(GL_SPOT_DIRECTION)
1564 case GL_SPOT_DIRECTION:
1565#endif // defined(GL_SPOT_DIRECTION)
1566 _needed = 3;
1567 break;
1568#if defined(GL_AMBIENT)
1569 case GL_AMBIENT:
1570#endif // defined(GL_AMBIENT)
1571#if defined(GL_DIFFUSE)
1572 case GL_DIFFUSE:
1573#endif // defined(GL_DIFFUSE)
1574#if defined(GL_SPECULAR)
1575 case GL_SPECULAR:
1576#endif // defined(GL_SPECULAR)
1577#if defined(GL_EMISSION)
1578 case GL_EMISSION:
1579#endif // defined(GL_EMISSION)
1580 _needed = 4;
1581 break;
1582 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001583 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001584 break;
1585 }
1586 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001587 _exception = 1;
1588 _exceptionType = "java/lang/IllegalArgumentException";
1589 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001590 goto exit;
1591 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001592 if (params == NULL) {
1593 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1594 params = (GLfloat *) (_paramsBase + _bufferOffset);
1595 }
Jack Palevich27f80022009-04-15 19:13:17 -07001596 glLightfv(
1597 (GLenum)light,
1598 (GLenum)pname,
1599 (GLfloat *)params
1600 );
1601
1602exit:
1603 if (_array) {
1604 releasePointer(_env, _array, params, JNI_FALSE);
1605 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001606 if (_exception) {
1607 jniThrowException(_env, _exceptionType, _exceptionMessage);
1608 }
Jack Palevich27f80022009-04-15 19:13:17 -07001609}
1610
1611/* void glLightx ( GLenum light, GLenum pname, GLfixed param ) */
1612static void
1613android_glLightx__III
1614 (JNIEnv *_env, jobject _this, jint light, jint pname, jint param) {
1615 glLightx(
1616 (GLenum)light,
1617 (GLenum)pname,
1618 (GLfixed)param
1619 );
1620}
1621
1622/* void glLightxv ( GLenum light, GLenum pname, const GLfixed *params ) */
1623static void
1624android_glLightxv__II_3II
1625 (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001626 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001627 const char * _exceptionType = NULL;
1628 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001629 GLfixed *params_base = (GLfixed *) 0;
1630 jint _remaining;
1631 GLfixed *params = (GLfixed *) 0;
1632
1633 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001634 _exception = 1;
1635 _exceptionType = "java/lang/IllegalArgumentException";
1636 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001637 goto exit;
1638 }
1639 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001640 _exception = 1;
1641 _exceptionType = "java/lang/IllegalArgumentException";
1642 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001643 goto exit;
1644 }
1645 _remaining = _env->GetArrayLength(params_ref) - offset;
1646 int _needed;
1647 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001648#if defined(GL_SPOT_DIRECTION)
1649 case GL_SPOT_DIRECTION:
1650#endif // defined(GL_SPOT_DIRECTION)
1651 _needed = 3;
1652 break;
1653#if defined(GL_AMBIENT)
1654 case GL_AMBIENT:
1655#endif // defined(GL_AMBIENT)
1656#if defined(GL_DIFFUSE)
1657 case GL_DIFFUSE:
1658#endif // defined(GL_DIFFUSE)
1659#if defined(GL_SPECULAR)
1660 case GL_SPECULAR:
1661#endif // defined(GL_SPECULAR)
1662#if defined(GL_EMISSION)
1663 case GL_EMISSION:
1664#endif // defined(GL_EMISSION)
1665 _needed = 4;
1666 break;
1667 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001668 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001669 break;
1670 }
1671 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001672 _exception = 1;
1673 _exceptionType = "java/lang/IllegalArgumentException";
1674 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001675 goto exit;
1676 }
1677 params_base = (GLfixed *)
1678 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1679 params = params_base + offset;
1680
1681 glLightxv(
1682 (GLenum)light,
1683 (GLenum)pname,
1684 (GLfixed *)params
1685 );
1686
1687exit:
1688 if (params_base) {
1689 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1690 JNI_ABORT);
1691 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001692 if (_exception) {
1693 jniThrowException(_env, _exceptionType, _exceptionMessage);
1694 }
Jack Palevich27f80022009-04-15 19:13:17 -07001695}
1696
1697/* void glLightxv ( GLenum light, GLenum pname, const GLfixed *params ) */
1698static void
1699android_glLightxv__IILjava_nio_IntBuffer_2
1700 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001701 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001702 const char * _exceptionType = NULL;
1703 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001704 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001705 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001706 jint _remaining;
1707 GLfixed *params = (GLfixed *) 0;
1708
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001709 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07001710 int _needed;
1711 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001712#if defined(GL_SPOT_DIRECTION)
1713 case GL_SPOT_DIRECTION:
1714#endif // defined(GL_SPOT_DIRECTION)
1715 _needed = 3;
1716 break;
1717#if defined(GL_AMBIENT)
1718 case GL_AMBIENT:
1719#endif // defined(GL_AMBIENT)
1720#if defined(GL_DIFFUSE)
1721 case GL_DIFFUSE:
1722#endif // defined(GL_DIFFUSE)
1723#if defined(GL_SPECULAR)
1724 case GL_SPECULAR:
1725#endif // defined(GL_SPECULAR)
1726#if defined(GL_EMISSION)
1727 case GL_EMISSION:
1728#endif // defined(GL_EMISSION)
1729 _needed = 4;
1730 break;
1731 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001732 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001733 break;
1734 }
1735 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001736 _exception = 1;
1737 _exceptionType = "java/lang/IllegalArgumentException";
1738 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001739 goto exit;
1740 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001741 if (params == NULL) {
1742 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1743 params = (GLfixed *) (_paramsBase + _bufferOffset);
1744 }
Jack Palevich27f80022009-04-15 19:13:17 -07001745 glLightxv(
1746 (GLenum)light,
1747 (GLenum)pname,
1748 (GLfixed *)params
1749 );
1750
1751exit:
1752 if (_array) {
1753 releasePointer(_env, _array, params, JNI_FALSE);
1754 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001755 if (_exception) {
1756 jniThrowException(_env, _exceptionType, _exceptionMessage);
1757 }
Jack Palevich27f80022009-04-15 19:13:17 -07001758}
1759
1760/* void glLineWidth ( GLfloat width ) */
1761static void
1762android_glLineWidth__F
1763 (JNIEnv *_env, jobject _this, jfloat width) {
1764 glLineWidth(
1765 (GLfloat)width
1766 );
1767}
1768
1769/* void glLineWidthx ( GLfixed width ) */
1770static void
1771android_glLineWidthx__I
1772 (JNIEnv *_env, jobject _this, jint width) {
1773 glLineWidthx(
1774 (GLfixed)width
1775 );
1776}
1777
1778/* void glLoadIdentity ( void ) */
1779static void
1780android_glLoadIdentity__
1781 (JNIEnv *_env, jobject _this) {
1782 glLoadIdentity();
1783}
1784
1785/* void glLoadMatrixf ( const GLfloat *m ) */
1786static void
1787android_glLoadMatrixf___3FI
1788 (JNIEnv *_env, jobject _this, jfloatArray m_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001789 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001790 const char * _exceptionType = NULL;
1791 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001792 GLfloat *m_base = (GLfloat *) 0;
1793 jint _remaining;
1794 GLfloat *m = (GLfloat *) 0;
1795
1796 if (!m_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001797 _exception = 1;
1798 _exceptionType = "java/lang/IllegalArgumentException";
1799 _exceptionMessage = "m == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001800 goto exit;
1801 }
1802 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001803 _exception = 1;
1804 _exceptionType = "java/lang/IllegalArgumentException";
1805 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001806 goto exit;
1807 }
1808 _remaining = _env->GetArrayLength(m_ref) - offset;
1809 m_base = (GLfloat *)
1810 _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
1811 m = m_base + offset;
1812
1813 glLoadMatrixf(
1814 (GLfloat *)m
1815 );
1816
1817exit:
1818 if (m_base) {
1819 _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
1820 JNI_ABORT);
1821 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001822 if (_exception) {
1823 jniThrowException(_env, _exceptionType, _exceptionMessage);
1824 }
Jack Palevich27f80022009-04-15 19:13:17 -07001825}
1826
1827/* void glLoadMatrixf ( const GLfloat *m ) */
1828static void
1829android_glLoadMatrixf__Ljava_nio_FloatBuffer_2
1830 (JNIEnv *_env, jobject _this, jobject m_buf) {
1831 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001832 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001833 jint _remaining;
1834 GLfloat *m = (GLfloat *) 0;
1835
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001836 m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset);
1837 if (m == NULL) {
1838 char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1839 m = (GLfloat *) (_mBase + _bufferOffset);
1840 }
Jack Palevich27f80022009-04-15 19:13:17 -07001841 glLoadMatrixf(
1842 (GLfloat *)m
1843 );
1844 if (_array) {
1845 releasePointer(_env, _array, m, JNI_FALSE);
1846 }
1847}
1848
1849/* void glLoadMatrixx ( const GLfixed *m ) */
1850static void
1851android_glLoadMatrixx___3II
1852 (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001853 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001854 const char * _exceptionType = NULL;
1855 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001856 GLfixed *m_base = (GLfixed *) 0;
1857 jint _remaining;
1858 GLfixed *m = (GLfixed *) 0;
1859
1860 if (!m_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001861 _exception = 1;
1862 _exceptionType = "java/lang/IllegalArgumentException";
1863 _exceptionMessage = "m == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001864 goto exit;
1865 }
1866 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001867 _exception = 1;
1868 _exceptionType = "java/lang/IllegalArgumentException";
1869 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001870 goto exit;
1871 }
1872 _remaining = _env->GetArrayLength(m_ref) - offset;
1873 m_base = (GLfixed *)
1874 _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
1875 m = m_base + offset;
1876
1877 glLoadMatrixx(
1878 (GLfixed *)m
1879 );
1880
1881exit:
1882 if (m_base) {
1883 _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
1884 JNI_ABORT);
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 glLoadMatrixx ( const GLfixed *m ) */
1892static void
1893android_glLoadMatrixx__Ljava_nio_IntBuffer_2
1894 (JNIEnv *_env, jobject _this, jobject m_buf) {
1895 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001896 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07001897 jint _remaining;
1898 GLfixed *m = (GLfixed *) 0;
1899
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001900 m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset);
1901 if (m == NULL) {
1902 char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1903 m = (GLfixed *) (_mBase + _bufferOffset);
1904 }
Jack Palevich27f80022009-04-15 19:13:17 -07001905 glLoadMatrixx(
1906 (GLfixed *)m
1907 );
1908 if (_array) {
1909 releasePointer(_env, _array, m, JNI_FALSE);
1910 }
1911}
1912
1913/* void glLogicOp ( GLenum opcode ) */
1914static void
1915android_glLogicOp__I
1916 (JNIEnv *_env, jobject _this, jint opcode) {
1917 glLogicOp(
1918 (GLenum)opcode
1919 );
1920}
1921
1922/* void glMaterialf ( GLenum face, GLenum pname, GLfloat param ) */
1923static void
1924android_glMaterialf__IIF
1925 (JNIEnv *_env, jobject _this, jint face, jint pname, jfloat param) {
1926 glMaterialf(
1927 (GLenum)face,
1928 (GLenum)pname,
1929 (GLfloat)param
1930 );
1931}
1932
1933/* void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) */
1934static void
1935android_glMaterialfv__II_3FI
1936 (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001937 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001938 const char * _exceptionType = NULL;
1939 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07001940 GLfloat *params_base = (GLfloat *) 0;
1941 jint _remaining;
1942 GLfloat *params = (GLfloat *) 0;
1943
1944 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001945 _exception = 1;
1946 _exceptionType = "java/lang/IllegalArgumentException";
1947 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07001948 goto exit;
1949 }
1950 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001951 _exception = 1;
1952 _exceptionType = "java/lang/IllegalArgumentException";
1953 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07001954 goto exit;
1955 }
1956 _remaining = _env->GetArrayLength(params_ref) - offset;
1957 int _needed;
1958 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07001959#if defined(GL_AMBIENT)
1960 case GL_AMBIENT:
1961#endif // defined(GL_AMBIENT)
1962#if defined(GL_DIFFUSE)
1963 case GL_DIFFUSE:
1964#endif // defined(GL_DIFFUSE)
1965#if defined(GL_SPECULAR)
1966 case GL_SPECULAR:
1967#endif // defined(GL_SPECULAR)
1968#if defined(GL_EMISSION)
1969 case GL_EMISSION:
1970#endif // defined(GL_EMISSION)
1971#if defined(GL_AMBIENT_AND_DIFFUSE)
1972 case GL_AMBIENT_AND_DIFFUSE:
1973#endif // defined(GL_AMBIENT_AND_DIFFUSE)
1974 _needed = 4;
1975 break;
1976 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08001977 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07001978 break;
1979 }
1980 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001981 _exception = 1;
1982 _exceptionType = "java/lang/IllegalArgumentException";
1983 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07001984 goto exit;
1985 }
1986 params_base = (GLfloat *)
1987 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
1988 params = params_base + offset;
1989
1990 glMaterialfv(
1991 (GLenum)face,
1992 (GLenum)pname,
1993 (GLfloat *)params
1994 );
1995
1996exit:
1997 if (params_base) {
1998 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
1999 JNI_ABORT);
2000 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002001 if (_exception) {
2002 jniThrowException(_env, _exceptionType, _exceptionMessage);
2003 }
Jack Palevich27f80022009-04-15 19:13:17 -07002004}
2005
2006/* void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) */
2007static void
2008android_glMaterialfv__IILjava_nio_FloatBuffer_2
2009 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002010 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002011 const char * _exceptionType = NULL;
2012 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002013 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002014 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002015 jint _remaining;
2016 GLfloat *params = (GLfloat *) 0;
2017
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002018 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002019 int _needed;
2020 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002021#if defined(GL_AMBIENT)
2022 case GL_AMBIENT:
2023#endif // defined(GL_AMBIENT)
2024#if defined(GL_DIFFUSE)
2025 case GL_DIFFUSE:
2026#endif // defined(GL_DIFFUSE)
2027#if defined(GL_SPECULAR)
2028 case GL_SPECULAR:
2029#endif // defined(GL_SPECULAR)
2030#if defined(GL_EMISSION)
2031 case GL_EMISSION:
2032#endif // defined(GL_EMISSION)
2033#if defined(GL_AMBIENT_AND_DIFFUSE)
2034 case GL_AMBIENT_AND_DIFFUSE:
2035#endif // defined(GL_AMBIENT_AND_DIFFUSE)
2036 _needed = 4;
2037 break;
2038 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002039 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002040 break;
2041 }
2042 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002043 _exception = 1;
2044 _exceptionType = "java/lang/IllegalArgumentException";
2045 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002046 goto exit;
2047 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002048 if (params == NULL) {
2049 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2050 params = (GLfloat *) (_paramsBase + _bufferOffset);
2051 }
Jack Palevich27f80022009-04-15 19:13:17 -07002052 glMaterialfv(
2053 (GLenum)face,
2054 (GLenum)pname,
2055 (GLfloat *)params
2056 );
2057
2058exit:
2059 if (_array) {
2060 releasePointer(_env, _array, params, JNI_FALSE);
2061 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002062 if (_exception) {
2063 jniThrowException(_env, _exceptionType, _exceptionMessage);
2064 }
Jack Palevich27f80022009-04-15 19:13:17 -07002065}
2066
2067/* void glMaterialx ( GLenum face, GLenum pname, GLfixed param ) */
2068static void
2069android_glMaterialx__III
2070 (JNIEnv *_env, jobject _this, jint face, jint pname, jint param) {
2071 glMaterialx(
2072 (GLenum)face,
2073 (GLenum)pname,
2074 (GLfixed)param
2075 );
2076}
2077
2078/* void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params ) */
2079static void
2080android_glMaterialxv__II_3II
2081 (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002082 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002083 const char * _exceptionType = NULL;
2084 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002085 GLfixed *params_base = (GLfixed *) 0;
2086 jint _remaining;
2087 GLfixed *params = (GLfixed *) 0;
2088
2089 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002090 _exception = 1;
2091 _exceptionType = "java/lang/IllegalArgumentException";
2092 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002093 goto exit;
2094 }
2095 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002096 _exception = 1;
2097 _exceptionType = "java/lang/IllegalArgumentException";
2098 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002099 goto exit;
2100 }
2101 _remaining = _env->GetArrayLength(params_ref) - offset;
2102 int _needed;
2103 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002104#if defined(GL_AMBIENT)
2105 case GL_AMBIENT:
2106#endif // defined(GL_AMBIENT)
2107#if defined(GL_DIFFUSE)
2108 case GL_DIFFUSE:
2109#endif // defined(GL_DIFFUSE)
2110#if defined(GL_SPECULAR)
2111 case GL_SPECULAR:
2112#endif // defined(GL_SPECULAR)
2113#if defined(GL_EMISSION)
2114 case GL_EMISSION:
2115#endif // defined(GL_EMISSION)
2116#if defined(GL_AMBIENT_AND_DIFFUSE)
2117 case GL_AMBIENT_AND_DIFFUSE:
2118#endif // defined(GL_AMBIENT_AND_DIFFUSE)
2119 _needed = 4;
2120 break;
2121 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002122 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002123 break;
2124 }
2125 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002126 _exception = 1;
2127 _exceptionType = "java/lang/IllegalArgumentException";
2128 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002129 goto exit;
2130 }
2131 params_base = (GLfixed *)
2132 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2133 params = params_base + offset;
2134
2135 glMaterialxv(
2136 (GLenum)face,
2137 (GLenum)pname,
2138 (GLfixed *)params
2139 );
2140
2141exit:
2142 if (params_base) {
2143 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2144 JNI_ABORT);
2145 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002146 if (_exception) {
2147 jniThrowException(_env, _exceptionType, _exceptionMessage);
2148 }
Jack Palevich27f80022009-04-15 19:13:17 -07002149}
2150
2151/* void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params ) */
2152static void
2153android_glMaterialxv__IILjava_nio_IntBuffer_2
2154 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002155 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002156 const char * _exceptionType = NULL;
2157 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002158 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002159 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002160 jint _remaining;
2161 GLfixed *params = (GLfixed *) 0;
2162
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002163 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002164 int _needed;
2165 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002166#if defined(GL_AMBIENT)
2167 case GL_AMBIENT:
2168#endif // defined(GL_AMBIENT)
2169#if defined(GL_DIFFUSE)
2170 case GL_DIFFUSE:
2171#endif // defined(GL_DIFFUSE)
2172#if defined(GL_SPECULAR)
2173 case GL_SPECULAR:
2174#endif // defined(GL_SPECULAR)
2175#if defined(GL_EMISSION)
2176 case GL_EMISSION:
2177#endif // defined(GL_EMISSION)
2178#if defined(GL_AMBIENT_AND_DIFFUSE)
2179 case GL_AMBIENT_AND_DIFFUSE:
2180#endif // defined(GL_AMBIENT_AND_DIFFUSE)
2181 _needed = 4;
2182 break;
2183 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002184 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002185 break;
2186 }
2187 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002188 _exception = 1;
2189 _exceptionType = "java/lang/IllegalArgumentException";
2190 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002191 goto exit;
2192 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002193 if (params == NULL) {
2194 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2195 params = (GLfixed *) (_paramsBase + _bufferOffset);
2196 }
Jack Palevich27f80022009-04-15 19:13:17 -07002197 glMaterialxv(
2198 (GLenum)face,
2199 (GLenum)pname,
2200 (GLfixed *)params
2201 );
2202
2203exit:
2204 if (_array) {
2205 releasePointer(_env, _array, params, JNI_FALSE);
2206 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002207 if (_exception) {
2208 jniThrowException(_env, _exceptionType, _exceptionMessage);
2209 }
Jack Palevich27f80022009-04-15 19:13:17 -07002210}
2211
2212/* void glMatrixMode ( GLenum mode ) */
2213static void
2214android_glMatrixMode__I
2215 (JNIEnv *_env, jobject _this, jint mode) {
2216 glMatrixMode(
2217 (GLenum)mode
2218 );
2219}
2220
2221/* void glMultMatrixf ( const GLfloat *m ) */
2222static void
2223android_glMultMatrixf___3FI
2224 (JNIEnv *_env, jobject _this, jfloatArray m_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002225 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002226 const char * _exceptionType = NULL;
2227 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002228 GLfloat *m_base = (GLfloat *) 0;
2229 jint _remaining;
2230 GLfloat *m = (GLfloat *) 0;
2231
2232 if (!m_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002233 _exception = 1;
2234 _exceptionType = "java/lang/IllegalArgumentException";
2235 _exceptionMessage = "m == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002236 goto exit;
2237 }
2238 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002239 _exception = 1;
2240 _exceptionType = "java/lang/IllegalArgumentException";
2241 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002242 goto exit;
2243 }
2244 _remaining = _env->GetArrayLength(m_ref) - offset;
2245 m_base = (GLfloat *)
2246 _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
2247 m = m_base + offset;
2248
2249 glMultMatrixf(
2250 (GLfloat *)m
2251 );
2252
2253exit:
2254 if (m_base) {
2255 _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
2256 JNI_ABORT);
2257 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002258 if (_exception) {
2259 jniThrowException(_env, _exceptionType, _exceptionMessage);
2260 }
Jack Palevich27f80022009-04-15 19:13:17 -07002261}
2262
2263/* void glMultMatrixf ( const GLfloat *m ) */
2264static void
2265android_glMultMatrixf__Ljava_nio_FloatBuffer_2
2266 (JNIEnv *_env, jobject _this, jobject m_buf) {
2267 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002268 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002269 jint _remaining;
2270 GLfloat *m = (GLfloat *) 0;
2271
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002272 m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset);
2273 if (m == NULL) {
2274 char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2275 m = (GLfloat *) (_mBase + _bufferOffset);
2276 }
Jack Palevich27f80022009-04-15 19:13:17 -07002277 glMultMatrixf(
2278 (GLfloat *)m
2279 );
2280 if (_array) {
2281 releasePointer(_env, _array, m, JNI_FALSE);
2282 }
2283}
2284
2285/* void glMultMatrixx ( const GLfixed *m ) */
2286static void
2287android_glMultMatrixx___3II
2288 (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002289 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002290 const char * _exceptionType = NULL;
2291 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002292 GLfixed *m_base = (GLfixed *) 0;
2293 jint _remaining;
2294 GLfixed *m = (GLfixed *) 0;
2295
2296 if (!m_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002297 _exception = 1;
2298 _exceptionType = "java/lang/IllegalArgumentException";
2299 _exceptionMessage = "m == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002300 goto exit;
2301 }
2302 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002303 _exception = 1;
2304 _exceptionType = "java/lang/IllegalArgumentException";
2305 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002306 goto exit;
2307 }
2308 _remaining = _env->GetArrayLength(m_ref) - offset;
2309 m_base = (GLfixed *)
2310 _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
2311 m = m_base + offset;
2312
2313 glMultMatrixx(
2314 (GLfixed *)m
2315 );
2316
2317exit:
2318 if (m_base) {
2319 _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
2320 JNI_ABORT);
2321 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002322 if (_exception) {
2323 jniThrowException(_env, _exceptionType, _exceptionMessage);
2324 }
Jack Palevich27f80022009-04-15 19:13:17 -07002325}
2326
2327/* void glMultMatrixx ( const GLfixed *m ) */
2328static void
2329android_glMultMatrixx__Ljava_nio_IntBuffer_2
2330 (JNIEnv *_env, jobject _this, jobject m_buf) {
2331 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002332 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002333 jint _remaining;
2334 GLfixed *m = (GLfixed *) 0;
2335
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002336 m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset);
2337 if (m == NULL) {
2338 char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2339 m = (GLfixed *) (_mBase + _bufferOffset);
2340 }
Jack Palevich27f80022009-04-15 19:13:17 -07002341 glMultMatrixx(
2342 (GLfixed *)m
2343 );
2344 if (_array) {
2345 releasePointer(_env, _array, m, JNI_FALSE);
2346 }
2347}
2348
2349/* void glMultiTexCoord4f ( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ) */
2350static void
2351android_glMultiTexCoord4f__IFFFF
2352 (JNIEnv *_env, jobject _this, jint target, jfloat s, jfloat t, jfloat r, jfloat q) {
2353 glMultiTexCoord4f(
2354 (GLenum)target,
2355 (GLfloat)s,
2356 (GLfloat)t,
2357 (GLfloat)r,
2358 (GLfloat)q
2359 );
2360}
2361
2362/* void glMultiTexCoord4x ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q ) */
2363static void
2364android_glMultiTexCoord4x__IIIII
2365 (JNIEnv *_env, jobject _this, jint target, jint s, jint t, jint r, jint q) {
2366 glMultiTexCoord4x(
2367 (GLenum)target,
2368 (GLfixed)s,
2369 (GLfixed)t,
2370 (GLfixed)r,
2371 (GLfixed)q
2372 );
2373}
2374
2375/* void glNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz ) */
2376static void
2377android_glNormal3f__FFF
2378 (JNIEnv *_env, jobject _this, jfloat nx, jfloat ny, jfloat nz) {
2379 glNormal3f(
2380 (GLfloat)nx,
2381 (GLfloat)ny,
2382 (GLfloat)nz
2383 );
2384}
2385
2386/* void glNormal3x ( GLfixed nx, GLfixed ny, GLfixed nz ) */
2387static void
2388android_glNormal3x__III
2389 (JNIEnv *_env, jobject _this, jint nx, jint ny, jint nz) {
2390 glNormal3x(
2391 (GLfixed)nx,
2392 (GLfixed)ny,
2393 (GLfixed)nz
2394 );
2395}
2396
2397/* void glNormalPointer ( GLenum type, GLsizei stride, const GLvoid *pointer ) */
2398static void
2399android_glNormalPointerBounds__IILjava_nio_Buffer_2I
2400 (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) {
2401 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002402 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002403 jint _remaining;
2404 GLvoid *pointer = (GLvoid *) 0;
2405
Jack Paleviche20ea782009-05-07 18:28:29 -07002406 if (pointer_buf) {
Jack Palevich16e79722009-05-15 18:13:34 -07002407 pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
Jack Paleviche20ea782009-05-07 18:28:29 -07002408 if ( ! pointer ) {
Jack Paleviche20ea782009-05-07 18:28:29 -07002409 return;
2410 }
2411 }
Jack Palevich27f80022009-04-15 19:13:17 -07002412 glNormalPointerBounds(
2413 (GLenum)type,
2414 (GLsizei)stride,
2415 (GLvoid *)pointer,
2416 (GLsizei)remaining
2417 );
Jack Palevich27f80022009-04-15 19:13:17 -07002418}
2419
2420/* void glOrthof ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */
2421static void
2422android_glOrthof__FFFFFF
2423 (JNIEnv *_env, jobject _this, jfloat left, jfloat right, jfloat bottom, jfloat top, jfloat zNear, jfloat zFar) {
2424 glOrthof(
2425 (GLfloat)left,
2426 (GLfloat)right,
2427 (GLfloat)bottom,
2428 (GLfloat)top,
2429 (GLfloat)zNear,
2430 (GLfloat)zFar
2431 );
2432}
2433
2434/* void glOrthox ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) */
2435static void
2436android_glOrthox__IIIIII
2437 (JNIEnv *_env, jobject _this, jint left, jint right, jint bottom, jint top, jint zNear, jint zFar) {
2438 glOrthox(
2439 (GLfixed)left,
2440 (GLfixed)right,
2441 (GLfixed)bottom,
2442 (GLfixed)top,
2443 (GLfixed)zNear,
2444 (GLfixed)zFar
2445 );
2446}
2447
2448/* void glPixelStorei ( GLenum pname, GLint param ) */
2449static void
2450android_glPixelStorei__II
2451 (JNIEnv *_env, jobject _this, jint pname, jint param) {
2452 glPixelStorei(
2453 (GLenum)pname,
2454 (GLint)param
2455 );
2456}
2457
2458/* void glPointSize ( GLfloat size ) */
2459static void
2460android_glPointSize__F
2461 (JNIEnv *_env, jobject _this, jfloat size) {
2462 glPointSize(
2463 (GLfloat)size
2464 );
2465}
2466
2467/* void glPointSizex ( GLfixed size ) */
2468static void
2469android_glPointSizex__I
2470 (JNIEnv *_env, jobject _this, jint size) {
2471 glPointSizex(
2472 (GLfixed)size
2473 );
2474}
2475
2476/* void glPolygonOffset ( GLfloat factor, GLfloat units ) */
2477static void
2478android_glPolygonOffset__FF
2479 (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) {
2480 glPolygonOffset(
2481 (GLfloat)factor,
2482 (GLfloat)units
2483 );
2484}
2485
2486/* void glPolygonOffsetx ( GLfixed factor, GLfixed units ) */
2487static void
2488android_glPolygonOffsetx__II
2489 (JNIEnv *_env, jobject _this, jint factor, jint units) {
2490 glPolygonOffsetx(
2491 (GLfixed)factor,
2492 (GLfixed)units
2493 );
2494}
2495
2496/* void glPopMatrix ( void ) */
2497static void
2498android_glPopMatrix__
2499 (JNIEnv *_env, jobject _this) {
2500 glPopMatrix();
2501}
2502
2503/* void glPushMatrix ( void ) */
2504static void
2505android_glPushMatrix__
2506 (JNIEnv *_env, jobject _this) {
2507 glPushMatrix();
2508}
2509
2510/* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */
2511static void
2512android_glReadPixels__IIIIIILjava_nio_Buffer_2
2513 (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) {
Jack Palevich27f80022009-04-15 19:13:17 -07002514 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002515 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002516 jint _remaining;
2517 GLvoid *pixels = (GLvoid *) 0;
2518
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002519 pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
2520 if (pixels == NULL) {
2521 char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2522 pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
2523 }
Jack Palevich27f80022009-04-15 19:13:17 -07002524 glReadPixels(
2525 (GLint)x,
2526 (GLint)y,
2527 (GLsizei)width,
2528 (GLsizei)height,
2529 (GLenum)format,
2530 (GLenum)type,
2531 (GLvoid *)pixels
2532 );
2533 if (_array) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002534 releasePointer(_env, _array, pixels, JNI_TRUE);
Jack Palevich27f80022009-04-15 19:13:17 -07002535 }
2536}
2537
2538/* void glRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) */
2539static void
2540android_glRotatef__FFFF
2541 (JNIEnv *_env, jobject _this, jfloat angle, jfloat x, jfloat y, jfloat z) {
2542 glRotatef(
2543 (GLfloat)angle,
2544 (GLfloat)x,
2545 (GLfloat)y,
2546 (GLfloat)z
2547 );
2548}
2549
2550/* void glRotatex ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z ) */
2551static void
2552android_glRotatex__IIII
2553 (JNIEnv *_env, jobject _this, jint angle, jint x, jint y, jint z) {
2554 glRotatex(
2555 (GLfixed)angle,
2556 (GLfixed)x,
2557 (GLfixed)y,
2558 (GLfixed)z
2559 );
2560}
2561
2562/* void glSampleCoverage ( GLclampf value, GLboolean invert ) */
2563static void
2564android_glSampleCoverage__FZ
2565 (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) {
2566 glSampleCoverage(
2567 (GLclampf)value,
2568 (GLboolean)invert
2569 );
2570}
2571
2572/* void glSampleCoveragex ( GLclampx value, GLboolean invert ) */
2573static void
2574android_glSampleCoveragex__IZ
2575 (JNIEnv *_env, jobject _this, jint value, jboolean invert) {
2576 glSampleCoveragex(
2577 (GLclampx)value,
2578 (GLboolean)invert
2579 );
2580}
2581
2582/* void glScalef ( GLfloat x, GLfloat y, GLfloat z ) */
2583static void
2584android_glScalef__FFF
2585 (JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat z) {
2586 glScalef(
2587 (GLfloat)x,
2588 (GLfloat)y,
2589 (GLfloat)z
2590 );
2591}
2592
2593/* void glScalex ( GLfixed x, GLfixed y, GLfixed z ) */
2594static void
2595android_glScalex__III
2596 (JNIEnv *_env, jobject _this, jint x, jint y, jint z) {
2597 glScalex(
2598 (GLfixed)x,
2599 (GLfixed)y,
2600 (GLfixed)z
2601 );
2602}
2603
2604/* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */
2605static void
2606android_glScissor__IIII
2607 (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
2608 glScissor(
2609 (GLint)x,
2610 (GLint)y,
2611 (GLsizei)width,
2612 (GLsizei)height
2613 );
2614}
2615
2616/* void glShadeModel ( GLenum mode ) */
2617static void
2618android_glShadeModel__I
2619 (JNIEnv *_env, jobject _this, jint mode) {
2620 glShadeModel(
2621 (GLenum)mode
2622 );
2623}
2624
2625/* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */
2626static void
2627android_glStencilFunc__III
2628 (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) {
2629 glStencilFunc(
2630 (GLenum)func,
2631 (GLint)ref,
2632 (GLuint)mask
2633 );
2634}
2635
2636/* void glStencilMask ( GLuint mask ) */
2637static void
2638android_glStencilMask__I
2639 (JNIEnv *_env, jobject _this, jint mask) {
2640 glStencilMask(
2641 (GLuint)mask
2642 );
2643}
2644
2645/* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */
2646static void
2647android_glStencilOp__III
2648 (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) {
2649 glStencilOp(
2650 (GLenum)fail,
2651 (GLenum)zfail,
2652 (GLenum)zpass
2653 );
2654}
2655
2656/* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
2657static void
2658android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I
2659 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
2660 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002661 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002662 jint _remaining;
2663 GLvoid *pointer = (GLvoid *) 0;
2664
Jack Paleviche20ea782009-05-07 18:28:29 -07002665 if (pointer_buf) {
Jack Palevich16e79722009-05-15 18:13:34 -07002666 pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
Jack Paleviche20ea782009-05-07 18:28:29 -07002667 if ( ! pointer ) {
Jack Paleviche20ea782009-05-07 18:28:29 -07002668 return;
2669 }
2670 }
Jack Palevich27f80022009-04-15 19:13:17 -07002671 glTexCoordPointerBounds(
2672 (GLint)size,
2673 (GLenum)type,
2674 (GLsizei)stride,
2675 (GLvoid *)pointer,
2676 (GLsizei)remaining
2677 );
Jack Palevich27f80022009-04-15 19:13:17 -07002678}
2679
2680/* void glTexEnvf ( GLenum target, GLenum pname, GLfloat param ) */
2681static void
2682android_glTexEnvf__IIF
2683 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
2684 glTexEnvf(
2685 (GLenum)target,
2686 (GLenum)pname,
2687 (GLfloat)param
2688 );
2689}
2690
2691/* void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) */
2692static void
2693android_glTexEnvfv__II_3FI
2694 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002695 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002696 const char * _exceptionType = NULL;
2697 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002698 GLfloat *params_base = (GLfloat *) 0;
2699 jint _remaining;
2700 GLfloat *params = (GLfloat *) 0;
2701
2702 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002703 _exception = 1;
2704 _exceptionType = "java/lang/IllegalArgumentException";
2705 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002706 goto exit;
2707 }
2708 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002709 _exception = 1;
2710 _exceptionType = "java/lang/IllegalArgumentException";
2711 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002712 goto exit;
2713 }
2714 _remaining = _env->GetArrayLength(params_ref) - offset;
2715 int _needed;
2716 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002717#if defined(GL_TEXTURE_ENV_COLOR)
2718 case GL_TEXTURE_ENV_COLOR:
2719#endif // defined(GL_TEXTURE_ENV_COLOR)
2720 _needed = 4;
2721 break;
2722 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002723 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002724 break;
2725 }
2726 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002727 _exception = 1;
2728 _exceptionType = "java/lang/IllegalArgumentException";
2729 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002730 goto exit;
2731 }
2732 params_base = (GLfloat *)
2733 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2734 params = params_base + offset;
2735
2736 glTexEnvfv(
2737 (GLenum)target,
2738 (GLenum)pname,
2739 (GLfloat *)params
2740 );
2741
2742exit:
2743 if (params_base) {
2744 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2745 JNI_ABORT);
2746 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002747 if (_exception) {
2748 jniThrowException(_env, _exceptionType, _exceptionMessage);
2749 }
Jack Palevich27f80022009-04-15 19:13:17 -07002750}
2751
2752/* void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) */
2753static void
2754android_glTexEnvfv__IILjava_nio_FloatBuffer_2
2755 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002756 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002757 const char * _exceptionType = NULL;
2758 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002759 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002760 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002761 jint _remaining;
2762 GLfloat *params = (GLfloat *) 0;
2763
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002764 params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002765 int _needed;
2766 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002767#if defined(GL_TEXTURE_ENV_COLOR)
2768 case GL_TEXTURE_ENV_COLOR:
2769#endif // defined(GL_TEXTURE_ENV_COLOR)
2770 _needed = 4;
2771 break;
2772 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002773 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002774 break;
2775 }
2776 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002777 _exception = 1;
2778 _exceptionType = "java/lang/IllegalArgumentException";
2779 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002780 goto exit;
2781 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002782 if (params == NULL) {
2783 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2784 params = (GLfloat *) (_paramsBase + _bufferOffset);
2785 }
Jack Palevich27f80022009-04-15 19:13:17 -07002786 glTexEnvfv(
2787 (GLenum)target,
2788 (GLenum)pname,
2789 (GLfloat *)params
2790 );
2791
2792exit:
2793 if (_array) {
2794 releasePointer(_env, _array, params, JNI_FALSE);
2795 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002796 if (_exception) {
2797 jniThrowException(_env, _exceptionType, _exceptionMessage);
2798 }
Jack Palevich27f80022009-04-15 19:13:17 -07002799}
2800
2801/* void glTexEnvx ( GLenum target, GLenum pname, GLfixed param ) */
2802static void
2803android_glTexEnvx__III
2804 (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
2805 glTexEnvx(
2806 (GLenum)target,
2807 (GLenum)pname,
2808 (GLfixed)param
2809 );
2810}
2811
2812/* void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params ) */
2813static void
2814android_glTexEnvxv__II_3II
2815 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002816 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002817 const char * _exceptionType = NULL;
2818 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002819 GLfixed *params_base = (GLfixed *) 0;
2820 jint _remaining;
2821 GLfixed *params = (GLfixed *) 0;
2822
2823 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002824 _exception = 1;
2825 _exceptionType = "java/lang/IllegalArgumentException";
2826 _exceptionMessage = "params == null";
Jack Palevich27f80022009-04-15 19:13:17 -07002827 goto exit;
2828 }
2829 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002830 _exception = 1;
2831 _exceptionType = "java/lang/IllegalArgumentException";
2832 _exceptionMessage = "offset < 0";
Jack Palevich27f80022009-04-15 19:13:17 -07002833 goto exit;
2834 }
2835 _remaining = _env->GetArrayLength(params_ref) - offset;
2836 int _needed;
2837 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002838#if defined(GL_TEXTURE_ENV_COLOR)
2839 case GL_TEXTURE_ENV_COLOR:
2840#endif // defined(GL_TEXTURE_ENV_COLOR)
2841 _needed = 4;
2842 break;
2843 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002844 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002845 break;
2846 }
2847 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002848 _exception = 1;
2849 _exceptionType = "java/lang/IllegalArgumentException";
2850 _exceptionMessage = "length - offset < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002851 goto exit;
2852 }
2853 params_base = (GLfixed *)
2854 _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2855 params = params_base + offset;
2856
2857 glTexEnvxv(
2858 (GLenum)target,
2859 (GLenum)pname,
2860 (GLfixed *)params
2861 );
2862
2863exit:
2864 if (params_base) {
2865 _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2866 JNI_ABORT);
2867 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002868 if (_exception) {
2869 jniThrowException(_env, _exceptionType, _exceptionMessage);
2870 }
Jack Palevich27f80022009-04-15 19:13:17 -07002871}
2872
2873/* void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params ) */
2874static void
2875android_glTexEnvxv__IILjava_nio_IntBuffer_2
2876 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002877 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002878 const char * _exceptionType = NULL;
2879 const char * _exceptionMessage = NULL;
Jack Palevich27f80022009-04-15 19:13:17 -07002880 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002881 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002882 jint _remaining;
2883 GLfixed *params = (GLfixed *) 0;
2884
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002885 params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002886 int _needed;
2887 switch (pname) {
Jack Palevich27f80022009-04-15 19:13:17 -07002888#if defined(GL_TEXTURE_ENV_COLOR)
2889 case GL_TEXTURE_ENV_COLOR:
2890#endif // defined(GL_TEXTURE_ENV_COLOR)
2891 _needed = 4;
2892 break;
2893 default:
Mathias Agopian2ad04772013-02-23 03:12:30 -08002894 _needed = 1;
Jack Palevich27f80022009-04-15 19:13:17 -07002895 break;
2896 }
2897 if (_remaining < _needed) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002898 _exception = 1;
2899 _exceptionType = "java/lang/IllegalArgumentException";
2900 _exceptionMessage = "remaining() < needed";
Jack Palevich27f80022009-04-15 19:13:17 -07002901 goto exit;
2902 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002903 if (params == NULL) {
2904 char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2905 params = (GLfixed *) (_paramsBase + _bufferOffset);
2906 }
Jack Palevich27f80022009-04-15 19:13:17 -07002907 glTexEnvxv(
2908 (GLenum)target,
2909 (GLenum)pname,
2910 (GLfixed *)params
2911 );
2912
2913exit:
2914 if (_array) {
2915 releasePointer(_env, _array, params, JNI_FALSE);
2916 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002917 if (_exception) {
2918 jniThrowException(_env, _exceptionType, _exceptionMessage);
2919 }
Jack Palevich27f80022009-04-15 19:13:17 -07002920}
2921
2922/* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */
2923static void
2924android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2
2925 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) {
2926 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002927 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002928 jint _remaining;
2929 GLvoid *pixels = (GLvoid *) 0;
2930
2931 if (pixels_buf) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002932 pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
2933 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -07002934 if (pixels_buf && pixels == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002935 char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2936 pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002937 }
2938 glTexImage2D(
2939 (GLenum)target,
2940 (GLint)level,
2941 (GLint)internalformat,
2942 (GLsizei)width,
2943 (GLsizei)height,
2944 (GLint)border,
2945 (GLenum)format,
2946 (GLenum)type,
2947 (GLvoid *)pixels
2948 );
2949 if (_array) {
2950 releasePointer(_env, _array, pixels, JNI_FALSE);
2951 }
2952}
2953
2954/* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */
2955static void
2956android_glTexParameterf__IIF
2957 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
2958 glTexParameterf(
2959 (GLenum)target,
2960 (GLenum)pname,
2961 (GLfloat)param
2962 );
2963}
2964
2965/* void glTexParameterx ( GLenum target, GLenum pname, GLfixed param ) */
2966static void
2967android_glTexParameterx__III
2968 (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
2969 glTexParameterx(
2970 (GLenum)target,
2971 (GLenum)pname,
2972 (GLfixed)param
2973 );
2974}
2975
2976/* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */
2977static void
2978android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
2979 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) {
2980 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002981 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07002982 jint _remaining;
2983 GLvoid *pixels = (GLvoid *) 0;
2984
2985 if (pixels_buf) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002986 pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
2987 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -07002988 if (pixels_buf && pixels == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002989 char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
2990 pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
Jack Palevich27f80022009-04-15 19:13:17 -07002991 }
2992 glTexSubImage2D(
2993 (GLenum)target,
2994 (GLint)level,
2995 (GLint)xoffset,
2996 (GLint)yoffset,
2997 (GLsizei)width,
2998 (GLsizei)height,
2999 (GLenum)format,
3000 (GLenum)type,
3001 (GLvoid *)pixels
3002 );
3003 if (_array) {
3004 releasePointer(_env, _array, pixels, JNI_FALSE);
3005 }
3006}
3007
3008/* void glTranslatef ( GLfloat x, GLfloat y, GLfloat z ) */
3009static void
3010android_glTranslatef__FFF
3011 (JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat z) {
3012 glTranslatef(
3013 (GLfloat)x,
3014 (GLfloat)y,
3015 (GLfloat)z
3016 );
3017}
3018
3019/* void glTranslatex ( GLfixed x, GLfixed y, GLfixed z ) */
3020static void
3021android_glTranslatex__III
3022 (JNIEnv *_env, jobject _this, jint x, jint y, jint z) {
3023 glTranslatex(
3024 (GLfixed)x,
3025 (GLfixed)y,
3026 (GLfixed)z
3027 );
3028}
3029
3030/* void glVertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
3031static void
3032android_glVertexPointerBounds__IIILjava_nio_Buffer_2I
3033 (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
3034 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003035 jint _bufferOffset = (jint) 0;
Jack Palevich27f80022009-04-15 19:13:17 -07003036 jint _remaining;
3037 GLvoid *pointer = (GLvoid *) 0;
3038
Jack Paleviche20ea782009-05-07 18:28:29 -07003039 if (pointer_buf) {
Jack Palevich16e79722009-05-15 18:13:34 -07003040 pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
Jack Paleviche20ea782009-05-07 18:28:29 -07003041 if ( ! pointer ) {
Jack Paleviche20ea782009-05-07 18:28:29 -07003042 return;
3043 }
3044 }
Jack Palevich27f80022009-04-15 19:13:17 -07003045 glVertexPointerBounds(
3046 (GLint)size,
3047 (GLenum)type,
3048 (GLsizei)stride,
3049 (GLvoid *)pointer,
3050 (GLsizei)remaining
3051 );
Jack Palevich27f80022009-04-15 19:13:17 -07003052}
3053
3054/* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */
3055static void
3056android_glViewport__IIII
3057 (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
3058 glViewport(
3059 (GLint)x,
3060 (GLint)y,
3061 (GLsizei)width,
3062 (GLsizei)height
3063 );
3064}
3065
3066static const char *classPathName = "android/opengl/GLES10";
3067
3068static JNINativeMethod methods[] = {
3069{"_nativeClassInit", "()V", (void*)nativeClassInit },
3070{"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I },
3071{"glAlphaFunc", "(IF)V", (void *) android_glAlphaFunc__IF },
3072{"glAlphaFuncx", "(II)V", (void *) android_glAlphaFuncx__II },
3073{"glBindTexture", "(II)V", (void *) android_glBindTexture__II },
3074{"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II },
3075{"glClear", "(I)V", (void *) android_glClear__I },
3076{"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF },
3077{"glClearColorx", "(IIII)V", (void *) android_glClearColorx__IIII },
3078{"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F },
3079{"glClearDepthx", "(I)V", (void *) android_glClearDepthx__I },
3080{"glClearStencil", "(I)V", (void *) android_glClearStencil__I },
3081{"glClientActiveTexture", "(I)V", (void *) android_glClientActiveTexture__I },
3082{"glColor4f", "(FFFF)V", (void *) android_glColor4f__FFFF },
3083{"glColor4x", "(IIII)V", (void *) android_glColor4x__IIII },
3084{"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ },
3085{"glColorPointerBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glColorPointerBounds__IIILjava_nio_Buffer_2I },
3086{"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 },
3087{"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
3088{"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII },
3089{"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII },
3090{"glCullFace", "(I)V", (void *) android_glCullFace__I },
3091{"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II },
3092{"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 },
3093{"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I },
3094{"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z },
3095{"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF },
3096{"glDepthRangex", "(II)V", (void *) android_glDepthRangex__II },
3097{"glDisable", "(I)V", (void *) android_glDisable__I },
3098{"glDisableClientState", "(I)V", (void *) android_glDisableClientState__I },
3099{"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III },
3100{"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 },
3101{"glEnable", "(I)V", (void *) android_glEnable__I },
3102{"glEnableClientState", "(I)V", (void *) android_glEnableClientState__I },
3103{"glFinish", "()V", (void *) android_glFinish__ },
3104{"glFlush", "()V", (void *) android_glFlush__ },
3105{"glFogf", "(IF)V", (void *) android_glFogf__IF },
3106{"glFogfv", "(I[FI)V", (void *) android_glFogfv__I_3FI },
3107{"glFogfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glFogfv__ILjava_nio_FloatBuffer_2 },
3108{"glFogx", "(II)V", (void *) android_glFogx__II },
3109{"glFogxv", "(I[II)V", (void *) android_glFogxv__I_3II },
3110{"glFogxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glFogxv__ILjava_nio_IntBuffer_2 },
3111{"glFrontFace", "(I)V", (void *) android_glFrontFace__I },
3112{"glFrustumf", "(FFFFFF)V", (void *) android_glFrustumf__FFFFFF },
3113{"glFrustumx", "(IIIIII)V", (void *) android_glFrustumx__IIIIII },
3114{"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II },
3115{"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 },
3116{"glGetError", "()I", (void *) android_glGetError__ },
3117{"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II },
3118{"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 },
Jack Palevicha3795852009-04-24 10:35:11 -07003119{"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString },
Jack Palevich27f80022009-04-15 19:13:17 -07003120{"glHint", "(II)V", (void *) android_glHint__II },
3121{"glLightModelf", "(IF)V", (void *) android_glLightModelf__IF },
3122{"glLightModelfv", "(I[FI)V", (void *) android_glLightModelfv__I_3FI },
3123{"glLightModelfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glLightModelfv__ILjava_nio_FloatBuffer_2 },
3124{"glLightModelx", "(II)V", (void *) android_glLightModelx__II },
3125{"glLightModelxv", "(I[II)V", (void *) android_glLightModelxv__I_3II },
3126{"glLightModelxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glLightModelxv__ILjava_nio_IntBuffer_2 },
3127{"glLightf", "(IIF)V", (void *) android_glLightf__IIF },
3128{"glLightfv", "(II[FI)V", (void *) android_glLightfv__II_3FI },
3129{"glLightfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glLightfv__IILjava_nio_FloatBuffer_2 },
3130{"glLightx", "(III)V", (void *) android_glLightx__III },
3131{"glLightxv", "(II[II)V", (void *) android_glLightxv__II_3II },
3132{"glLightxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glLightxv__IILjava_nio_IntBuffer_2 },
3133{"glLineWidth", "(F)V", (void *) android_glLineWidth__F },
3134{"glLineWidthx", "(I)V", (void *) android_glLineWidthx__I },
3135{"glLoadIdentity", "()V", (void *) android_glLoadIdentity__ },
3136{"glLoadMatrixf", "([FI)V", (void *) android_glLoadMatrixf___3FI },
3137{"glLoadMatrixf", "(Ljava/nio/FloatBuffer;)V", (void *) android_glLoadMatrixf__Ljava_nio_FloatBuffer_2 },
3138{"glLoadMatrixx", "([II)V", (void *) android_glLoadMatrixx___3II },
3139{"glLoadMatrixx", "(Ljava/nio/IntBuffer;)V", (void *) android_glLoadMatrixx__Ljava_nio_IntBuffer_2 },
3140{"glLogicOp", "(I)V", (void *) android_glLogicOp__I },
3141{"glMaterialf", "(IIF)V", (void *) android_glMaterialf__IIF },
3142{"glMaterialfv", "(II[FI)V", (void *) android_glMaterialfv__II_3FI },
3143{"glMaterialfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glMaterialfv__IILjava_nio_FloatBuffer_2 },
3144{"glMaterialx", "(III)V", (void *) android_glMaterialx__III },
3145{"glMaterialxv", "(II[II)V", (void *) android_glMaterialxv__II_3II },
3146{"glMaterialxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glMaterialxv__IILjava_nio_IntBuffer_2 },
3147{"glMatrixMode", "(I)V", (void *) android_glMatrixMode__I },
3148{"glMultMatrixf", "([FI)V", (void *) android_glMultMatrixf___3FI },
3149{"glMultMatrixf", "(Ljava/nio/FloatBuffer;)V", (void *) android_glMultMatrixf__Ljava_nio_FloatBuffer_2 },
3150{"glMultMatrixx", "([II)V", (void *) android_glMultMatrixx___3II },
3151{"glMultMatrixx", "(Ljava/nio/IntBuffer;)V", (void *) android_glMultMatrixx__Ljava_nio_IntBuffer_2 },
3152{"glMultiTexCoord4f", "(IFFFF)V", (void *) android_glMultiTexCoord4f__IFFFF },
3153{"glMultiTexCoord4x", "(IIIII)V", (void *) android_glMultiTexCoord4x__IIIII },
3154{"glNormal3f", "(FFF)V", (void *) android_glNormal3f__FFF },
3155{"glNormal3x", "(III)V", (void *) android_glNormal3x__III },
3156{"glNormalPointerBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glNormalPointerBounds__IILjava_nio_Buffer_2I },
3157{"glOrthof", "(FFFFFF)V", (void *) android_glOrthof__FFFFFF },
3158{"glOrthox", "(IIIIII)V", (void *) android_glOrthox__IIIIII },
3159{"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II },
3160{"glPointSize", "(F)V", (void *) android_glPointSize__F },
3161{"glPointSizex", "(I)V", (void *) android_glPointSizex__I },
3162{"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF },
3163{"glPolygonOffsetx", "(II)V", (void *) android_glPolygonOffsetx__II },
3164{"glPopMatrix", "()V", (void *) android_glPopMatrix__ },
3165{"glPushMatrix", "()V", (void *) android_glPushMatrix__ },
3166{"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 },
3167{"glRotatef", "(FFFF)V", (void *) android_glRotatef__FFFF },
3168{"glRotatex", "(IIII)V", (void *) android_glRotatex__IIII },
3169{"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ },
3170{"glSampleCoveragex", "(IZ)V", (void *) android_glSampleCoveragex__IZ },
3171{"glScalef", "(FFF)V", (void *) android_glScalef__FFF },
3172{"glScalex", "(III)V", (void *) android_glScalex__III },
3173{"glScissor", "(IIII)V", (void *) android_glScissor__IIII },
3174{"glShadeModel", "(I)V", (void *) android_glShadeModel__I },
3175{"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III },
3176{"glStencilMask", "(I)V", (void *) android_glStencilMask__I },
3177{"glStencilOp", "(III)V", (void *) android_glStencilOp__III },
3178{"glTexCoordPointerBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I },
3179{"glTexEnvf", "(IIF)V", (void *) android_glTexEnvf__IIF },
3180{"glTexEnvfv", "(II[FI)V", (void *) android_glTexEnvfv__II_3FI },
3181{"glTexEnvfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexEnvfv__IILjava_nio_FloatBuffer_2 },
3182{"glTexEnvx", "(III)V", (void *) android_glTexEnvx__III },
3183{"glTexEnvxv", "(II[II)V", (void *) android_glTexEnvxv__II_3II },
3184{"glTexEnvxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexEnvxv__IILjava_nio_IntBuffer_2 },
3185{"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 },
3186{"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF },
3187{"glTexParameterx", "(III)V", (void *) android_glTexParameterx__III },
3188{"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
3189{"glTranslatef", "(FFF)V", (void *) android_glTranslatef__FFF },
3190{"glTranslatex", "(III)V", (void *) android_glTranslatex__III },
3191{"glVertexPointerBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glVertexPointerBounds__IIILjava_nio_Buffer_2I },
3192{"glViewport", "(IIII)V", (void *) android_glViewport__IIII },
3193};
3194
3195int register_android_opengl_jni_GLES10(JNIEnv *_env)
3196{
3197 int err;
3198 err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
3199 return err;
3200}