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