Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1 | /* |
| 2 | ** |
| 3 | ** Copyright 2009, The Android Open Source Project |
| 4 | ** |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 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 |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 8 | ** |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 9 | ** http://www.apache.org/licenses/LICENSE-2.0 |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 10 | ** |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 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 |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | // This source file is automatically generated |
| 19 | |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 20 | #include <GLES/gl.h> |
| 21 | #include <GLES/glext.h> |
| 22 | |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 23 | #include "jni.h" |
| 24 | #include "JNIHelp.h" |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 25 | #include <android_runtime/AndroidRuntime.h> |
| 26 | #include <utils/misc.h> |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 27 | #include <assert.h> |
Mathias Agopian | 8331f72 | 2009-05-08 15:35:17 -0700 | [diff] [blame] | 28 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 29 | static int initialized = 0; |
| 30 | |
| 31 | static jclass nioAccessClass; |
| 32 | static jclass bufferClass; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 33 | static jmethodID getBasePointerID; |
| 34 | static jmethodID getBaseArrayID; |
| 35 | static jmethodID getBaseArrayOffsetID; |
| 36 | static jfieldID positionID; |
| 37 | static jfieldID limitID; |
| 38 | static jfieldID elementSizeShiftID; |
| 39 | |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 40 | |
| 41 | /* special calls implemented in Android's GLES wrapper used to more |
| 42 | * efficiently bound-check passed arrays */ |
| 43 | extern "C" { |
| 44 | #ifdef GL_VERSION_ES_CM_1_1 |
| 45 | GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride, |
| 46 | const GLvoid *ptr, GLsizei count); |
| 47 | GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride, |
| 48 | const GLvoid *pointer, GLsizei count); |
| 49 | GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type, |
| 50 | GLsizei stride, const GLvoid *pointer, GLsizei count); |
| 51 | GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type, |
| 52 | GLsizei stride, const GLvoid *pointer, GLsizei count); |
| 53 | GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, |
| 54 | GLsizei stride, const GLvoid *pointer, GLsizei count); |
| 55 | GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, |
| 56 | GLsizei stride, const GLvoid *pointer, GLsizei count); |
| 57 | GL_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 |
| 61 | static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type, |
| 62 | GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) { |
| 63 | glVertexAttribPointer(indx, size, type, normalized, stride, pointer); |
| 64 | } |
| 65 | #endif |
| 66 | } |
| 67 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 68 | /* Cache method IDs each time the class is loaded. */ |
| 69 | |
| 70 | static void |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 71 | nativeClassInit(JNIEnv *_env, jclass glImplClass) |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 72 | { |
| 73 | jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); |
| 74 | nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); |
| 75 | |
| 76 | jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); |
| 77 | bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); |
| 78 | |
| 79 | getBasePointerID = _env->GetStaticMethodID(nioAccessClass, |
| 80 | "getBasePointer", "(Ljava/nio/Buffer;)J"); |
| 81 | getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, |
| 82 | "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); |
| 83 | getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, |
| 84 | "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); |
| 85 | |
| 86 | positionID = _env->GetFieldID(bufferClass, "position", "I"); |
| 87 | limitID = _env->GetFieldID(bufferClass, "limit", "I"); |
| 88 | elementSizeShiftID = |
| 89 | _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); |
| 90 | } |
| 91 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 92 | static void * |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 93 | getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset) |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 94 | { |
| 95 | jint position; |
| 96 | jint limit; |
| 97 | jint elementSizeShift; |
| 98 | jlong pointer; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 99 | |
| 100 | position = _env->GetIntField(buffer, positionID); |
| 101 | limit = _env->GetIntField(buffer, limitID); |
| 102 | elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); |
| 103 | *remaining = (limit - position) << elementSizeShift; |
| 104 | pointer = _env->CallStaticLongMethod(nioAccessClass, |
| 105 | getBasePointerID, buffer); |
| 106 | if (pointer != 0L) { |
| 107 | *array = NULL; |
| 108 | return (void *) (jint) pointer; |
| 109 | } |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 110 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 111 | *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, |
| 112 | getBaseArrayID, buffer); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 113 | *offset = _env->CallStaticIntMethod(nioAccessClass, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 114 | getBaseArrayOffsetID, buffer); |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 115 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 116 | return NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 117 | } |
| 118 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 119 | static void |
| 120 | releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) |
| 121 | { |
| 122 | _env->ReleasePrimitiveArrayCritical(array, data, |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 123 | commit ? 0 : JNI_ABORT); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 124 | } |
| 125 | |
Jack Palevich | 16e7972 | 2009-05-15 18:13:34 -0700 | [diff] [blame] | 126 | static void * |
| 127 | getDirectBufferPointer(JNIEnv *_env, jobject buffer) { |
| 128 | char* buf = (char*) _env->GetDirectBufferAddress(buffer); |
| 129 | if (buf) { |
| 130 | jint position = _env->GetIntField(buffer, positionID); |
| 131 | jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); |
| 132 | buf += position << elementSizeShift; |
| 133 | } else { |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 134 | jniThrowException(_env, "java/lang/IllegalArgumentException", |
| 135 | "Must use a native order direct Buffer"); |
Jack Palevich | 16e7972 | 2009-05-15 18:13:34 -0700 | [diff] [blame] | 136 | } |
| 137 | return (void*) buf; |
| 138 | } |
| 139 | |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 140 | // -------------------------------------------------------------------------- |
| 141 | |
| 142 | /* |
| 143 | * returns the number of values glGet returns for a given pname. |
| 144 | * |
| 145 | * The code below is written such that pnames requiring only one values |
| 146 | * are the default (and are not explicitely tested for). This makes the |
| 147 | * checking code much shorter/readable/efficient. |
| 148 | * |
| 149 | * This means that unknown pnames (e.g.: extensions) will default to 1. If |
| 150 | * that unknown pname needs more than 1 value, then the validation check |
| 151 | * is incomplete and the app may crash if it passed the wrong number params. |
| 152 | */ |
| 153 | static int getNeededCount(GLint pname) { |
| 154 | int needed = 1; |
| 155 | #ifdef GL_ES_VERSION_2_0 |
| 156 | // GLES 2.x pnames |
| 157 | switch (pname) { |
| 158 | case GL_ALIASED_LINE_WIDTH_RANGE: |
| 159 | case GL_ALIASED_POINT_SIZE_RANGE: |
| 160 | needed = 2; |
| 161 | break; |
| 162 | |
| 163 | case GL_BLEND_COLOR: |
| 164 | case GL_COLOR_CLEAR_VALUE: |
| 165 | case GL_COLOR_WRITEMASK: |
| 166 | case GL_SCISSOR_BOX: |
| 167 | case GL_VIEWPORT: |
| 168 | needed = 4; |
| 169 | break; |
| 170 | |
| 171 | case GL_COMPRESSED_TEXTURE_FORMATS: |
| 172 | glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed); |
| 173 | break; |
| 174 | |
| 175 | case GL_SHADER_BINARY_FORMATS: |
| 176 | glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed); |
| 177 | break; |
| 178 | } |
| 179 | #endif |
| 180 | |
| 181 | #ifdef GL_VERSION_ES_CM_1_1 |
| 182 | // GLES 1.x pnames |
| 183 | switch (pname) { |
| 184 | case GL_ALIASED_LINE_WIDTH_RANGE: |
| 185 | case GL_ALIASED_POINT_SIZE_RANGE: |
| 186 | case GL_DEPTH_RANGE: |
| 187 | case GL_SMOOTH_LINE_WIDTH_RANGE: |
| 188 | case GL_SMOOTH_POINT_SIZE_RANGE: |
| 189 | needed = 2; |
| 190 | break; |
| 191 | |
| 192 | case GL_CURRENT_NORMAL: |
| 193 | case GL_POINT_DISTANCE_ATTENUATION: |
| 194 | needed = 3; |
| 195 | break; |
| 196 | |
| 197 | case GL_COLOR_CLEAR_VALUE: |
| 198 | case GL_COLOR_WRITEMASK: |
| 199 | case GL_CURRENT_COLOR: |
| 200 | case GL_CURRENT_TEXTURE_COORDS: |
| 201 | case GL_FOG_COLOR: |
| 202 | case GL_LIGHT_MODEL_AMBIENT: |
| 203 | case GL_SCISSOR_BOX: |
| 204 | case GL_VIEWPORT: |
| 205 | needed = 4; |
| 206 | break; |
| 207 | |
| 208 | case GL_MODELVIEW_MATRIX: |
| 209 | case GL_PROJECTION_MATRIX: |
| 210 | case GL_TEXTURE_MATRIX: |
| 211 | needed = 16; |
| 212 | break; |
| 213 | |
| 214 | case GL_COMPRESSED_TEXTURE_FORMATS: |
| 215 | glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed); |
| 216 | break; |
| 217 | } |
| 218 | #endif |
| 219 | return needed; |
| 220 | } |
| 221 | |
| 222 | template <typename JTYPEARRAY, typename CTYPE, void GET(GLenum, CTYPE*)> |
| 223 | static void |
| 224 | get |
| 225 | (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) { |
| 226 | jint _exception = 0; |
| 227 | const char * _exceptionType; |
| 228 | const char * _exceptionMessage; |
| 229 | CTYPE *params_base = (CTYPE *) 0; |
| 230 | jint _remaining; |
| 231 | CTYPE *params = (CTYPE *) 0; |
| 232 | int _needed = 0; |
| 233 | |
| 234 | if (!params_ref) { |
| 235 | _exception = 1; |
| 236 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 237 | _exceptionMessage = "params == null"; |
| 238 | goto exit; |
| 239 | } |
| 240 | if (offset < 0) { |
| 241 | _exception = 1; |
| 242 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 243 | _exceptionMessage = "offset < 0"; |
| 244 | goto exit; |
| 245 | } |
| 246 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 247 | _needed = getNeededCount(pname); |
| 248 | // if we didn't find this pname, we just assume the user passed |
| 249 | // an array of the right size -- this might happen with extensions |
| 250 | // or if we forget an enum here. |
| 251 | if (_remaining < _needed) { |
| 252 | _exception = 1; |
| 253 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 254 | _exceptionMessage = "length - offset < needed"; |
| 255 | goto exit; |
| 256 | } |
| 257 | params_base = (CTYPE *) |
| 258 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 259 | params = params_base + offset; |
| 260 | |
| 261 | GET( |
| 262 | (GLenum)pname, |
| 263 | (CTYPE *)params |
| 264 | ); |
| 265 | |
| 266 | exit: |
| 267 | if (params_base) { |
| 268 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 269 | _exception ? JNI_ABORT: 0); |
| 270 | } |
| 271 | if (_exception) { |
| 272 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | |
| 277 | template <typename CTYPE, void GET(GLenum, CTYPE*)> |
| 278 | static void |
| 279 | getarray |
| 280 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
| 281 | jint _exception = 0; |
| 282 | const char * _exceptionType; |
| 283 | const char * _exceptionMessage; |
| 284 | jarray _array = (jarray) 0; |
| 285 | jint _bufferOffset = (jint) 0; |
| 286 | jint _remaining; |
| 287 | CTYPE *params = (CTYPE *) 0; |
| 288 | int _needed = 0; |
| 289 | |
| 290 | params = (CTYPE *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
| 291 | _needed = getNeededCount(pname); |
| 292 | // if we didn't find this pname, we just assume the user passed |
| 293 | // an array of the right size -- this might happen with extensions |
| 294 | // or if we forget an enum here. |
| 295 | if (_needed>0 && _remaining < _needed) { |
| 296 | _exception = 1; |
| 297 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 298 | _exceptionMessage = "remaining() < needed"; |
| 299 | goto exit; |
| 300 | } |
| 301 | if (params == NULL) { |
| 302 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 303 | params = (CTYPE *) (_paramsBase + _bufferOffset); |
| 304 | } |
| 305 | GET( |
| 306 | (GLenum)pname, |
| 307 | (CTYPE *)params |
| 308 | ); |
| 309 | |
| 310 | exit: |
| 311 | if (_array) { |
| 312 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 313 | } |
| 314 | if (_exception) { |
| 315 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 316 | } |
Jack Palevich | be509c9 | 2009-05-07 09:52:14 -0700 | [diff] [blame] | 317 | } |
| 318 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 319 | // -------------------------------------------------------------------------- |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 320 | /* void glActiveTexture ( GLenum texture ) */ |
| 321 | static void |
| 322 | android_glActiveTexture__I |
| 323 | (JNIEnv *_env, jobject _this, jint texture) { |
| 324 | glActiveTexture( |
| 325 | (GLenum)texture |
| 326 | ); |
| 327 | } |
| 328 | |
| 329 | /* void glAlphaFunc ( GLenum func, GLclampf ref ) */ |
| 330 | static void |
| 331 | android_glAlphaFunc__IF |
| 332 | (JNIEnv *_env, jobject _this, jint func, jfloat ref) { |
| 333 | glAlphaFunc( |
| 334 | (GLenum)func, |
| 335 | (GLclampf)ref |
| 336 | ); |
| 337 | } |
| 338 | |
| 339 | /* void glAlphaFuncx ( GLenum func, GLclampx ref ) */ |
| 340 | static void |
| 341 | android_glAlphaFuncx__II |
| 342 | (JNIEnv *_env, jobject _this, jint func, jint ref) { |
| 343 | glAlphaFuncx( |
| 344 | (GLenum)func, |
| 345 | (GLclampx)ref |
| 346 | ); |
| 347 | } |
| 348 | |
| 349 | /* void glBindTexture ( GLenum target, GLuint texture ) */ |
| 350 | static void |
| 351 | android_glBindTexture__II |
| 352 | (JNIEnv *_env, jobject _this, jint target, jint texture) { |
| 353 | glBindTexture( |
| 354 | (GLenum)target, |
| 355 | (GLuint)texture |
| 356 | ); |
| 357 | } |
| 358 | |
| 359 | /* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */ |
| 360 | static void |
| 361 | android_glBlendFunc__II |
| 362 | (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) { |
| 363 | glBlendFunc( |
| 364 | (GLenum)sfactor, |
| 365 | (GLenum)dfactor |
| 366 | ); |
| 367 | } |
| 368 | |
| 369 | /* void glClear ( GLbitfield mask ) */ |
| 370 | static void |
| 371 | android_glClear__I |
| 372 | (JNIEnv *_env, jobject _this, jint mask) { |
| 373 | glClear( |
| 374 | (GLbitfield)mask |
| 375 | ); |
| 376 | } |
| 377 | |
| 378 | /* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */ |
| 379 | static void |
| 380 | android_glClearColor__FFFF |
| 381 | (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) { |
| 382 | glClearColor( |
| 383 | (GLclampf)red, |
| 384 | (GLclampf)green, |
| 385 | (GLclampf)blue, |
| 386 | (GLclampf)alpha |
| 387 | ); |
| 388 | } |
| 389 | |
| 390 | /* void glClearColorx ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha ) */ |
| 391 | static void |
| 392 | android_glClearColorx__IIII |
| 393 | (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) { |
| 394 | glClearColorx( |
| 395 | (GLclampx)red, |
| 396 | (GLclampx)green, |
| 397 | (GLclampx)blue, |
| 398 | (GLclampx)alpha |
| 399 | ); |
| 400 | } |
| 401 | |
| 402 | /* void glClearDepthf ( GLclampf depth ) */ |
| 403 | static void |
| 404 | android_glClearDepthf__F |
| 405 | (JNIEnv *_env, jobject _this, jfloat depth) { |
| 406 | glClearDepthf( |
| 407 | (GLclampf)depth |
| 408 | ); |
| 409 | } |
| 410 | |
| 411 | /* void glClearDepthx ( GLclampx depth ) */ |
| 412 | static void |
| 413 | android_glClearDepthx__I |
| 414 | (JNIEnv *_env, jobject _this, jint depth) { |
| 415 | glClearDepthx( |
| 416 | (GLclampx)depth |
| 417 | ); |
| 418 | } |
| 419 | |
| 420 | /* void glClearStencil ( GLint s ) */ |
| 421 | static void |
| 422 | android_glClearStencil__I |
| 423 | (JNIEnv *_env, jobject _this, jint s) { |
| 424 | glClearStencil( |
| 425 | (GLint)s |
| 426 | ); |
| 427 | } |
| 428 | |
| 429 | /* void glClientActiveTexture ( GLenum texture ) */ |
| 430 | static void |
| 431 | android_glClientActiveTexture__I |
| 432 | (JNIEnv *_env, jobject _this, jint texture) { |
| 433 | glClientActiveTexture( |
| 434 | (GLenum)texture |
| 435 | ); |
| 436 | } |
| 437 | |
| 438 | /* void glColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) */ |
| 439 | static void |
| 440 | android_glColor4f__FFFF |
| 441 | (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) { |
| 442 | glColor4f( |
| 443 | (GLfloat)red, |
| 444 | (GLfloat)green, |
| 445 | (GLfloat)blue, |
| 446 | (GLfloat)alpha |
| 447 | ); |
| 448 | } |
| 449 | |
| 450 | /* void glColor4x ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha ) */ |
| 451 | static void |
| 452 | android_glColor4x__IIII |
| 453 | (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) { |
| 454 | glColor4x( |
| 455 | (GLfixed)red, |
| 456 | (GLfixed)green, |
| 457 | (GLfixed)blue, |
| 458 | (GLfixed)alpha |
| 459 | ); |
| 460 | } |
| 461 | |
| 462 | /* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */ |
| 463 | static void |
| 464 | android_glColorMask__ZZZZ |
| 465 | (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) { |
| 466 | glColorMask( |
| 467 | (GLboolean)red, |
| 468 | (GLboolean)green, |
| 469 | (GLboolean)blue, |
| 470 | (GLboolean)alpha |
| 471 | ); |
| 472 | } |
| 473 | |
| 474 | /* void glColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */ |
| 475 | static void |
| 476 | android_glColorPointerBounds__IIILjava_nio_Buffer_2I |
| 477 | (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) { |
| 478 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 479 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 480 | jint _remaining; |
| 481 | GLvoid *pointer = (GLvoid *) 0; |
| 482 | |
Jack Palevich | e20ea78 | 2009-05-07 18:28:29 -0700 | [diff] [blame] | 483 | if (pointer_buf) { |
Jack Palevich | 16e7972 | 2009-05-15 18:13:34 -0700 | [diff] [blame] | 484 | pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf); |
Jack Palevich | e20ea78 | 2009-05-07 18:28:29 -0700 | [diff] [blame] | 485 | if ( ! pointer ) { |
Jack Palevich | e20ea78 | 2009-05-07 18:28:29 -0700 | [diff] [blame] | 486 | return; |
| 487 | } |
| 488 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 489 | glColorPointerBounds( |
| 490 | (GLint)size, |
| 491 | (GLenum)type, |
| 492 | (GLsizei)stride, |
| 493 | (GLvoid *)pointer, |
| 494 | (GLsizei)remaining |
| 495 | ); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 496 | } |
| 497 | |
| 498 | /* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */ |
| 499 | static void |
| 500 | android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 |
| 501 | (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) { |
| 502 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 503 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 504 | jint _remaining; |
| 505 | GLvoid *data = (GLvoid *) 0; |
| 506 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 507 | data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset); |
| 508 | if (data == NULL) { |
| 509 | char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 510 | data = (GLvoid *) (_dataBase + _bufferOffset); |
| 511 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 512 | glCompressedTexImage2D( |
| 513 | (GLenum)target, |
| 514 | (GLint)level, |
| 515 | (GLenum)internalformat, |
| 516 | (GLsizei)width, |
| 517 | (GLsizei)height, |
| 518 | (GLint)border, |
| 519 | (GLsizei)imageSize, |
| 520 | (GLvoid *)data |
| 521 | ); |
| 522 | if (_array) { |
| 523 | releasePointer(_env, _array, data, JNI_FALSE); |
| 524 | } |
| 525 | } |
| 526 | |
| 527 | /* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */ |
| 528 | static void |
| 529 | android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 |
| 530 | (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) { |
| 531 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 532 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 533 | jint _remaining; |
| 534 | GLvoid *data = (GLvoid *) 0; |
| 535 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 536 | data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset); |
| 537 | if (data == NULL) { |
| 538 | char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 539 | data = (GLvoid *) (_dataBase + _bufferOffset); |
| 540 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 541 | glCompressedTexSubImage2D( |
| 542 | (GLenum)target, |
| 543 | (GLint)level, |
| 544 | (GLint)xoffset, |
| 545 | (GLint)yoffset, |
| 546 | (GLsizei)width, |
| 547 | (GLsizei)height, |
| 548 | (GLenum)format, |
| 549 | (GLsizei)imageSize, |
| 550 | (GLvoid *)data |
| 551 | ); |
| 552 | if (_array) { |
| 553 | releasePointer(_env, _array, data, JNI_FALSE); |
| 554 | } |
| 555 | } |
| 556 | |
| 557 | /* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */ |
| 558 | static void |
| 559 | android_glCopyTexImage2D__IIIIIIII |
| 560 | (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) { |
| 561 | glCopyTexImage2D( |
| 562 | (GLenum)target, |
| 563 | (GLint)level, |
| 564 | (GLenum)internalformat, |
| 565 | (GLint)x, |
| 566 | (GLint)y, |
| 567 | (GLsizei)width, |
| 568 | (GLsizei)height, |
| 569 | (GLint)border |
| 570 | ); |
| 571 | } |
| 572 | |
| 573 | /* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */ |
| 574 | static void |
| 575 | android_glCopyTexSubImage2D__IIIIIIII |
| 576 | (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) { |
| 577 | glCopyTexSubImage2D( |
| 578 | (GLenum)target, |
| 579 | (GLint)level, |
| 580 | (GLint)xoffset, |
| 581 | (GLint)yoffset, |
| 582 | (GLint)x, |
| 583 | (GLint)y, |
| 584 | (GLsizei)width, |
| 585 | (GLsizei)height |
| 586 | ); |
| 587 | } |
| 588 | |
| 589 | /* void glCullFace ( GLenum mode ) */ |
| 590 | static void |
| 591 | android_glCullFace__I |
| 592 | (JNIEnv *_env, jobject _this, jint mode) { |
| 593 | glCullFace( |
| 594 | (GLenum)mode |
| 595 | ); |
| 596 | } |
| 597 | |
| 598 | /* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */ |
| 599 | static void |
| 600 | android_glDeleteTextures__I_3II |
| 601 | (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 602 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 603 | const char * _exceptionType = NULL; |
| 604 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 605 | GLuint *textures_base = (GLuint *) 0; |
| 606 | jint _remaining; |
| 607 | GLuint *textures = (GLuint *) 0; |
| 608 | |
| 609 | if (!textures_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 610 | _exception = 1; |
| 611 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 612 | _exceptionMessage = "textures == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 613 | goto exit; |
| 614 | } |
| 615 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 616 | _exception = 1; |
| 617 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 618 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 619 | goto exit; |
| 620 | } |
| 621 | _remaining = _env->GetArrayLength(textures_ref) - offset; |
| 622 | if (_remaining < n) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 623 | _exception = 1; |
| 624 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 625 | _exceptionMessage = "length - offset < n < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 626 | goto exit; |
| 627 | } |
| 628 | textures_base = (GLuint *) |
| 629 | _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0); |
| 630 | textures = textures_base + offset; |
| 631 | |
| 632 | glDeleteTextures( |
| 633 | (GLsizei)n, |
| 634 | (GLuint *)textures |
| 635 | ); |
| 636 | |
| 637 | exit: |
| 638 | if (textures_base) { |
| 639 | _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base, |
| 640 | JNI_ABORT); |
| 641 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 642 | if (_exception) { |
| 643 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 644 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 645 | } |
| 646 | |
| 647 | /* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */ |
| 648 | static void |
| 649 | android_glDeleteTextures__ILjava_nio_IntBuffer_2 |
| 650 | (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 651 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 652 | const char * _exceptionType = NULL; |
| 653 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 654 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 655 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 656 | jint _remaining; |
| 657 | GLuint *textures = (GLuint *) 0; |
| 658 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 659 | textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 660 | if (_remaining < n) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 661 | _exception = 1; |
| 662 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 663 | _exceptionMessage = "remaining() < n < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 664 | goto exit; |
| 665 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 666 | if (textures == NULL) { |
| 667 | char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 668 | textures = (GLuint *) (_texturesBase + _bufferOffset); |
| 669 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 670 | glDeleteTextures( |
| 671 | (GLsizei)n, |
| 672 | (GLuint *)textures |
| 673 | ); |
| 674 | |
| 675 | exit: |
| 676 | if (_array) { |
| 677 | releasePointer(_env, _array, textures, JNI_FALSE); |
| 678 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 679 | if (_exception) { |
| 680 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 681 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 682 | } |
| 683 | |
| 684 | /* void glDepthFunc ( GLenum func ) */ |
| 685 | static void |
| 686 | android_glDepthFunc__I |
| 687 | (JNIEnv *_env, jobject _this, jint func) { |
| 688 | glDepthFunc( |
| 689 | (GLenum)func |
| 690 | ); |
| 691 | } |
| 692 | |
| 693 | /* void glDepthMask ( GLboolean flag ) */ |
| 694 | static void |
| 695 | android_glDepthMask__Z |
| 696 | (JNIEnv *_env, jobject _this, jboolean flag) { |
| 697 | glDepthMask( |
| 698 | (GLboolean)flag |
| 699 | ); |
| 700 | } |
| 701 | |
| 702 | /* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */ |
| 703 | static void |
| 704 | android_glDepthRangef__FF |
| 705 | (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) { |
| 706 | glDepthRangef( |
| 707 | (GLclampf)zNear, |
| 708 | (GLclampf)zFar |
| 709 | ); |
| 710 | } |
| 711 | |
| 712 | /* void glDepthRangex ( GLclampx zNear, GLclampx zFar ) */ |
| 713 | static void |
| 714 | android_glDepthRangex__II |
| 715 | (JNIEnv *_env, jobject _this, jint zNear, jint zFar) { |
| 716 | glDepthRangex( |
| 717 | (GLclampx)zNear, |
| 718 | (GLclampx)zFar |
| 719 | ); |
| 720 | } |
| 721 | |
| 722 | /* void glDisable ( GLenum cap ) */ |
| 723 | static void |
| 724 | android_glDisable__I |
| 725 | (JNIEnv *_env, jobject _this, jint cap) { |
| 726 | glDisable( |
| 727 | (GLenum)cap |
| 728 | ); |
| 729 | } |
| 730 | |
| 731 | /* void glDisableClientState ( GLenum array ) */ |
| 732 | static void |
| 733 | android_glDisableClientState__I |
| 734 | (JNIEnv *_env, jobject _this, jint array) { |
| 735 | glDisableClientState( |
| 736 | (GLenum)array |
| 737 | ); |
| 738 | } |
| 739 | |
| 740 | /* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */ |
| 741 | static void |
| 742 | android_glDrawArrays__III |
| 743 | (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) { |
| 744 | glDrawArrays( |
| 745 | (GLenum)mode, |
| 746 | (GLint)first, |
| 747 | (GLsizei)count |
| 748 | ); |
| 749 | } |
| 750 | |
| 751 | /* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */ |
| 752 | static void |
| 753 | android_glDrawElements__IIILjava_nio_Buffer_2 |
| 754 | (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 755 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 756 | const char * _exceptionType = NULL; |
| 757 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 758 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 759 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 760 | jint _remaining; |
| 761 | GLvoid *indices = (GLvoid *) 0; |
| 762 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 763 | indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 764 | if (_remaining < count) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 765 | _exception = 1; |
| 766 | _exceptionType = "java/lang/ArrayIndexOutOfBoundsException"; |
| 767 | _exceptionMessage = "remaining() < count < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 768 | goto exit; |
| 769 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 770 | if (indices == NULL) { |
| 771 | char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 772 | indices = (GLvoid *) (_indicesBase + _bufferOffset); |
| 773 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 774 | glDrawElements( |
| 775 | (GLenum)mode, |
| 776 | (GLsizei)count, |
| 777 | (GLenum)type, |
| 778 | (GLvoid *)indices |
| 779 | ); |
| 780 | |
| 781 | exit: |
| 782 | if (_array) { |
| 783 | releasePointer(_env, _array, indices, JNI_FALSE); |
| 784 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 785 | if (_exception) { |
| 786 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 787 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 788 | } |
| 789 | |
| 790 | /* void glEnable ( GLenum cap ) */ |
| 791 | static void |
| 792 | android_glEnable__I |
| 793 | (JNIEnv *_env, jobject _this, jint cap) { |
| 794 | glEnable( |
| 795 | (GLenum)cap |
| 796 | ); |
| 797 | } |
| 798 | |
| 799 | /* void glEnableClientState ( GLenum array ) */ |
| 800 | static void |
| 801 | android_glEnableClientState__I |
| 802 | (JNIEnv *_env, jobject _this, jint array) { |
| 803 | glEnableClientState( |
| 804 | (GLenum)array |
| 805 | ); |
| 806 | } |
| 807 | |
| 808 | /* void glFinish ( void ) */ |
| 809 | static void |
| 810 | android_glFinish__ |
| 811 | (JNIEnv *_env, jobject _this) { |
| 812 | glFinish(); |
| 813 | } |
| 814 | |
| 815 | /* void glFlush ( void ) */ |
| 816 | static void |
| 817 | android_glFlush__ |
| 818 | (JNIEnv *_env, jobject _this) { |
| 819 | glFlush(); |
| 820 | } |
| 821 | |
| 822 | /* void glFogf ( GLenum pname, GLfloat param ) */ |
| 823 | static void |
| 824 | android_glFogf__IF |
| 825 | (JNIEnv *_env, jobject _this, jint pname, jfloat param) { |
| 826 | glFogf( |
| 827 | (GLenum)pname, |
| 828 | (GLfloat)param |
| 829 | ); |
| 830 | } |
| 831 | |
| 832 | /* void glFogfv ( GLenum pname, const GLfloat *params ) */ |
| 833 | static void |
| 834 | android_glFogfv__I_3FI |
| 835 | (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 836 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 837 | const char * _exceptionType = NULL; |
| 838 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 839 | GLfloat *params_base = (GLfloat *) 0; |
| 840 | jint _remaining; |
| 841 | GLfloat *params = (GLfloat *) 0; |
| 842 | |
| 843 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 844 | _exception = 1; |
| 845 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 846 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 847 | goto exit; |
| 848 | } |
| 849 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 850 | _exception = 1; |
| 851 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 852 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 853 | goto exit; |
| 854 | } |
| 855 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 856 | int _needed; |
| 857 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 858 | #if defined(GL_FOG_COLOR) |
| 859 | case GL_FOG_COLOR: |
| 860 | #endif // defined(GL_FOG_COLOR) |
| 861 | _needed = 4; |
| 862 | break; |
| 863 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 864 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 865 | break; |
| 866 | } |
| 867 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 868 | _exception = 1; |
| 869 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 870 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 871 | goto exit; |
| 872 | } |
| 873 | params_base = (GLfloat *) |
| 874 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 875 | params = params_base + offset; |
| 876 | |
| 877 | glFogfv( |
| 878 | (GLenum)pname, |
| 879 | (GLfloat *)params |
| 880 | ); |
| 881 | |
| 882 | exit: |
| 883 | if (params_base) { |
| 884 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 885 | JNI_ABORT); |
| 886 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 887 | if (_exception) { |
| 888 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 889 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 890 | } |
| 891 | |
| 892 | /* void glFogfv ( GLenum pname, const GLfloat *params ) */ |
| 893 | static void |
| 894 | android_glFogfv__ILjava_nio_FloatBuffer_2 |
| 895 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 896 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 897 | const char * _exceptionType = NULL; |
| 898 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 899 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 900 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 901 | jint _remaining; |
| 902 | GLfloat *params = (GLfloat *) 0; |
| 903 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 904 | params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 905 | int _needed; |
| 906 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 907 | #if defined(GL_FOG_COLOR) |
| 908 | case GL_FOG_COLOR: |
| 909 | #endif // defined(GL_FOG_COLOR) |
| 910 | _needed = 4; |
| 911 | break; |
| 912 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 913 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 914 | break; |
| 915 | } |
| 916 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 917 | _exception = 1; |
| 918 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 919 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 920 | goto exit; |
| 921 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 922 | if (params == NULL) { |
| 923 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 924 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 925 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 926 | glFogfv( |
| 927 | (GLenum)pname, |
| 928 | (GLfloat *)params |
| 929 | ); |
| 930 | |
| 931 | exit: |
| 932 | if (_array) { |
| 933 | releasePointer(_env, _array, params, JNI_FALSE); |
| 934 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 935 | if (_exception) { |
| 936 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 937 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 938 | } |
| 939 | |
| 940 | /* void glFogx ( GLenum pname, GLfixed param ) */ |
| 941 | static void |
| 942 | android_glFogx__II |
| 943 | (JNIEnv *_env, jobject _this, jint pname, jint param) { |
| 944 | glFogx( |
| 945 | (GLenum)pname, |
| 946 | (GLfixed)param |
| 947 | ); |
| 948 | } |
| 949 | |
| 950 | /* void glFogxv ( GLenum pname, const GLfixed *params ) */ |
| 951 | static void |
| 952 | android_glFogxv__I_3II |
| 953 | (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 954 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 955 | const char * _exceptionType = NULL; |
| 956 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 957 | GLfixed *params_base = (GLfixed *) 0; |
| 958 | jint _remaining; |
| 959 | GLfixed *params = (GLfixed *) 0; |
| 960 | |
| 961 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 962 | _exception = 1; |
| 963 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 964 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 965 | goto exit; |
| 966 | } |
| 967 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 968 | _exception = 1; |
| 969 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 970 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 971 | goto exit; |
| 972 | } |
| 973 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 974 | int _needed; |
| 975 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 976 | #if defined(GL_FOG_COLOR) |
| 977 | case GL_FOG_COLOR: |
| 978 | #endif // defined(GL_FOG_COLOR) |
| 979 | _needed = 4; |
| 980 | break; |
| 981 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 982 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 983 | break; |
| 984 | } |
| 985 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 986 | _exception = 1; |
| 987 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 988 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 989 | goto exit; |
| 990 | } |
| 991 | params_base = (GLfixed *) |
| 992 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 993 | params = params_base + offset; |
| 994 | |
| 995 | glFogxv( |
| 996 | (GLenum)pname, |
| 997 | (GLfixed *)params |
| 998 | ); |
| 999 | |
| 1000 | exit: |
| 1001 | if (params_base) { |
| 1002 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 1003 | JNI_ABORT); |
| 1004 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1005 | if (_exception) { |
| 1006 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1007 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1008 | } |
| 1009 | |
| 1010 | /* void glFogxv ( GLenum pname, const GLfixed *params ) */ |
| 1011 | static void |
| 1012 | android_glFogxv__ILjava_nio_IntBuffer_2 |
| 1013 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1014 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1015 | const char * _exceptionType = NULL; |
| 1016 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1017 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1018 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1019 | jint _remaining; |
| 1020 | GLfixed *params = (GLfixed *) 0; |
| 1021 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1022 | params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1023 | int _needed; |
| 1024 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1025 | #if defined(GL_FOG_COLOR) |
| 1026 | case GL_FOG_COLOR: |
| 1027 | #endif // defined(GL_FOG_COLOR) |
| 1028 | _needed = 4; |
| 1029 | break; |
| 1030 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1031 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1032 | break; |
| 1033 | } |
| 1034 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1035 | _exception = 1; |
| 1036 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1037 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1038 | goto exit; |
| 1039 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1040 | if (params == NULL) { |
| 1041 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1042 | params = (GLfixed *) (_paramsBase + _bufferOffset); |
| 1043 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1044 | glFogxv( |
| 1045 | (GLenum)pname, |
| 1046 | (GLfixed *)params |
| 1047 | ); |
| 1048 | |
| 1049 | exit: |
| 1050 | if (_array) { |
| 1051 | releasePointer(_env, _array, params, JNI_FALSE); |
| 1052 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1053 | if (_exception) { |
| 1054 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1055 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1056 | } |
| 1057 | |
| 1058 | /* void glFrontFace ( GLenum mode ) */ |
| 1059 | static void |
| 1060 | android_glFrontFace__I |
| 1061 | (JNIEnv *_env, jobject _this, jint mode) { |
| 1062 | glFrontFace( |
| 1063 | (GLenum)mode |
| 1064 | ); |
| 1065 | } |
| 1066 | |
| 1067 | /* void glFrustumf ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */ |
| 1068 | static void |
| 1069 | android_glFrustumf__FFFFFF |
| 1070 | (JNIEnv *_env, jobject _this, jfloat left, jfloat right, jfloat bottom, jfloat top, jfloat zNear, jfloat zFar) { |
| 1071 | glFrustumf( |
| 1072 | (GLfloat)left, |
| 1073 | (GLfloat)right, |
| 1074 | (GLfloat)bottom, |
| 1075 | (GLfloat)top, |
| 1076 | (GLfloat)zNear, |
| 1077 | (GLfloat)zFar |
| 1078 | ); |
| 1079 | } |
| 1080 | |
| 1081 | /* void glFrustumx ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) */ |
| 1082 | static void |
| 1083 | android_glFrustumx__IIIIII |
| 1084 | (JNIEnv *_env, jobject _this, jint left, jint right, jint bottom, jint top, jint zNear, jint zFar) { |
| 1085 | glFrustumx( |
| 1086 | (GLfixed)left, |
| 1087 | (GLfixed)right, |
| 1088 | (GLfixed)bottom, |
| 1089 | (GLfixed)top, |
| 1090 | (GLfixed)zNear, |
| 1091 | (GLfixed)zFar |
| 1092 | ); |
| 1093 | } |
| 1094 | |
| 1095 | /* void glGenTextures ( GLsizei n, GLuint *textures ) */ |
| 1096 | static void |
| 1097 | android_glGenTextures__I_3II |
| 1098 | (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) { |
| 1099 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1100 | const char * _exceptionType = NULL; |
| 1101 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1102 | GLuint *textures_base = (GLuint *) 0; |
| 1103 | jint _remaining; |
| 1104 | GLuint *textures = (GLuint *) 0; |
| 1105 | |
| 1106 | if (!textures_ref) { |
| 1107 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1108 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1109 | _exceptionMessage = "textures == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1110 | goto exit; |
| 1111 | } |
| 1112 | if (offset < 0) { |
| 1113 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1114 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1115 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1116 | goto exit; |
| 1117 | } |
| 1118 | _remaining = _env->GetArrayLength(textures_ref) - offset; |
| 1119 | if (_remaining < n) { |
| 1120 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1121 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1122 | _exceptionMessage = "length - offset < n < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1123 | goto exit; |
| 1124 | } |
| 1125 | textures_base = (GLuint *) |
| 1126 | _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0); |
| 1127 | textures = textures_base + offset; |
| 1128 | |
| 1129 | glGenTextures( |
| 1130 | (GLsizei)n, |
| 1131 | (GLuint *)textures |
| 1132 | ); |
| 1133 | |
| 1134 | exit: |
| 1135 | if (textures_base) { |
| 1136 | _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base, |
| 1137 | _exception ? JNI_ABORT: 0); |
| 1138 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1139 | if (_exception) { |
| 1140 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1141 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1142 | } |
| 1143 | |
| 1144 | /* void glGenTextures ( GLsizei n, GLuint *textures ) */ |
| 1145 | static void |
| 1146 | android_glGenTextures__ILjava_nio_IntBuffer_2 |
| 1147 | (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) { |
| 1148 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1149 | const char * _exceptionType = NULL; |
| 1150 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1151 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1152 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1153 | jint _remaining; |
| 1154 | GLuint *textures = (GLuint *) 0; |
| 1155 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1156 | textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1157 | if (_remaining < n) { |
| 1158 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1159 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1160 | _exceptionMessage = "remaining() < n < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1161 | goto exit; |
| 1162 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1163 | if (textures == NULL) { |
| 1164 | char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1165 | textures = (GLuint *) (_texturesBase + _bufferOffset); |
| 1166 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1167 | glGenTextures( |
| 1168 | (GLsizei)n, |
| 1169 | (GLuint *)textures |
| 1170 | ); |
| 1171 | |
| 1172 | exit: |
| 1173 | if (_array) { |
| 1174 | releasePointer(_env, _array, textures, _exception ? JNI_FALSE : JNI_TRUE); |
| 1175 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1176 | if (_exception) { |
| 1177 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1178 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1179 | } |
| 1180 | |
| 1181 | /* GLenum glGetError ( void ) */ |
| 1182 | static jint |
| 1183 | android_glGetError__ |
| 1184 | (JNIEnv *_env, jobject _this) { |
| 1185 | GLenum _returnValue; |
| 1186 | _returnValue = glGetError(); |
| 1187 | return _returnValue; |
| 1188 | } |
| 1189 | |
| 1190 | /* void glGetIntegerv ( GLenum pname, GLint *params ) */ |
| 1191 | static void |
| 1192 | android_glGetIntegerv__I_3II |
| 1193 | (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1194 | get<jintArray, GLint, glGetIntegerv>(_env, _this, pname, params_ref, offset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1195 | } |
| 1196 | |
| 1197 | /* void glGetIntegerv ( GLenum pname, GLint *params ) */ |
| 1198 | static void |
| 1199 | android_glGetIntegerv__ILjava_nio_IntBuffer_2 |
| 1200 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1201 | getarray<GLint, glGetIntegerv>(_env, _this, pname, params_buf); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1202 | } |
| 1203 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1204 | /* const GLubyte * glGetString ( GLenum name ) */ |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 1205 | static jstring android_glGetString(JNIEnv* _env, jobject, jint name) { |
| 1206 | const char* chars = (const char*) glGetString((GLenum) name); |
| 1207 | return _env->NewStringUTF(chars); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1208 | } |
| 1209 | /* void glHint ( GLenum target, GLenum mode ) */ |
| 1210 | static void |
| 1211 | android_glHint__II |
| 1212 | (JNIEnv *_env, jobject _this, jint target, jint mode) { |
| 1213 | glHint( |
| 1214 | (GLenum)target, |
| 1215 | (GLenum)mode |
| 1216 | ); |
| 1217 | } |
| 1218 | |
| 1219 | /* void glLightModelf ( GLenum pname, GLfloat param ) */ |
| 1220 | static void |
| 1221 | android_glLightModelf__IF |
| 1222 | (JNIEnv *_env, jobject _this, jint pname, jfloat param) { |
| 1223 | glLightModelf( |
| 1224 | (GLenum)pname, |
| 1225 | (GLfloat)param |
| 1226 | ); |
| 1227 | } |
| 1228 | |
| 1229 | /* void glLightModelfv ( GLenum pname, const GLfloat *params ) */ |
| 1230 | static void |
| 1231 | android_glLightModelfv__I_3FI |
| 1232 | (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1233 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1234 | const char * _exceptionType = NULL; |
| 1235 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1236 | GLfloat *params_base = (GLfloat *) 0; |
| 1237 | jint _remaining; |
| 1238 | GLfloat *params = (GLfloat *) 0; |
| 1239 | |
| 1240 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1241 | _exception = 1; |
| 1242 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1243 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1244 | goto exit; |
| 1245 | } |
| 1246 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1247 | _exception = 1; |
| 1248 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1249 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1250 | goto exit; |
| 1251 | } |
| 1252 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 1253 | int _needed; |
| 1254 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1255 | #if defined(GL_LIGHT_MODEL_AMBIENT) |
| 1256 | case GL_LIGHT_MODEL_AMBIENT: |
| 1257 | #endif // defined(GL_LIGHT_MODEL_AMBIENT) |
| 1258 | _needed = 4; |
| 1259 | break; |
| 1260 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1261 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1262 | break; |
| 1263 | } |
| 1264 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1265 | _exception = 1; |
| 1266 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1267 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1268 | goto exit; |
| 1269 | } |
| 1270 | params_base = (GLfloat *) |
| 1271 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 1272 | params = params_base + offset; |
| 1273 | |
| 1274 | glLightModelfv( |
| 1275 | (GLenum)pname, |
| 1276 | (GLfloat *)params |
| 1277 | ); |
| 1278 | |
| 1279 | exit: |
| 1280 | if (params_base) { |
| 1281 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 1282 | JNI_ABORT); |
| 1283 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1284 | if (_exception) { |
| 1285 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1286 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1287 | } |
| 1288 | |
| 1289 | /* void glLightModelfv ( GLenum pname, const GLfloat *params ) */ |
| 1290 | static void |
| 1291 | android_glLightModelfv__ILjava_nio_FloatBuffer_2 |
| 1292 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1293 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1294 | const char * _exceptionType = NULL; |
| 1295 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1296 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1297 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1298 | jint _remaining; |
| 1299 | GLfloat *params = (GLfloat *) 0; |
| 1300 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1301 | params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1302 | int _needed; |
| 1303 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1304 | #if defined(GL_LIGHT_MODEL_AMBIENT) |
| 1305 | case GL_LIGHT_MODEL_AMBIENT: |
| 1306 | #endif // defined(GL_LIGHT_MODEL_AMBIENT) |
| 1307 | _needed = 4; |
| 1308 | break; |
| 1309 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1310 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1311 | break; |
| 1312 | } |
| 1313 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1314 | _exception = 1; |
| 1315 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1316 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1317 | goto exit; |
| 1318 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1319 | if (params == NULL) { |
| 1320 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1321 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 1322 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1323 | glLightModelfv( |
| 1324 | (GLenum)pname, |
| 1325 | (GLfloat *)params |
| 1326 | ); |
| 1327 | |
| 1328 | exit: |
| 1329 | if (_array) { |
| 1330 | releasePointer(_env, _array, params, JNI_FALSE); |
| 1331 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1332 | if (_exception) { |
| 1333 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1334 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1335 | } |
| 1336 | |
| 1337 | /* void glLightModelx ( GLenum pname, GLfixed param ) */ |
| 1338 | static void |
| 1339 | android_glLightModelx__II |
| 1340 | (JNIEnv *_env, jobject _this, jint pname, jint param) { |
| 1341 | glLightModelx( |
| 1342 | (GLenum)pname, |
| 1343 | (GLfixed)param |
| 1344 | ); |
| 1345 | } |
| 1346 | |
| 1347 | /* void glLightModelxv ( GLenum pname, const GLfixed *params ) */ |
| 1348 | static void |
| 1349 | android_glLightModelxv__I_3II |
| 1350 | (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1351 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1352 | const char * _exceptionType = NULL; |
| 1353 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1354 | GLfixed *params_base = (GLfixed *) 0; |
| 1355 | jint _remaining; |
| 1356 | GLfixed *params = (GLfixed *) 0; |
| 1357 | |
| 1358 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1359 | _exception = 1; |
| 1360 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1361 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1362 | goto exit; |
| 1363 | } |
| 1364 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1365 | _exception = 1; |
| 1366 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1367 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1368 | goto exit; |
| 1369 | } |
| 1370 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 1371 | int _needed; |
| 1372 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1373 | #if defined(GL_LIGHT_MODEL_AMBIENT) |
| 1374 | case GL_LIGHT_MODEL_AMBIENT: |
| 1375 | #endif // defined(GL_LIGHT_MODEL_AMBIENT) |
| 1376 | _needed = 4; |
| 1377 | break; |
| 1378 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1379 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1380 | break; |
| 1381 | } |
| 1382 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1383 | _exception = 1; |
| 1384 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1385 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1386 | goto exit; |
| 1387 | } |
| 1388 | params_base = (GLfixed *) |
| 1389 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 1390 | params = params_base + offset; |
| 1391 | |
| 1392 | glLightModelxv( |
| 1393 | (GLenum)pname, |
| 1394 | (GLfixed *)params |
| 1395 | ); |
| 1396 | |
| 1397 | exit: |
| 1398 | if (params_base) { |
| 1399 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 1400 | JNI_ABORT); |
| 1401 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1402 | if (_exception) { |
| 1403 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1404 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1405 | } |
| 1406 | |
| 1407 | /* void glLightModelxv ( GLenum pname, const GLfixed *params ) */ |
| 1408 | static void |
| 1409 | android_glLightModelxv__ILjava_nio_IntBuffer_2 |
| 1410 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1411 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1412 | const char * _exceptionType = NULL; |
| 1413 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1414 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1415 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1416 | jint _remaining; |
| 1417 | GLfixed *params = (GLfixed *) 0; |
| 1418 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1419 | params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1420 | int _needed; |
| 1421 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1422 | #if defined(GL_LIGHT_MODEL_AMBIENT) |
| 1423 | case GL_LIGHT_MODEL_AMBIENT: |
| 1424 | #endif // defined(GL_LIGHT_MODEL_AMBIENT) |
| 1425 | _needed = 4; |
| 1426 | break; |
| 1427 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1428 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1429 | break; |
| 1430 | } |
| 1431 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1432 | _exception = 1; |
| 1433 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1434 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1435 | goto exit; |
| 1436 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1437 | if (params == NULL) { |
| 1438 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1439 | params = (GLfixed *) (_paramsBase + _bufferOffset); |
| 1440 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1441 | glLightModelxv( |
| 1442 | (GLenum)pname, |
| 1443 | (GLfixed *)params |
| 1444 | ); |
| 1445 | |
| 1446 | exit: |
| 1447 | if (_array) { |
| 1448 | releasePointer(_env, _array, params, JNI_FALSE); |
| 1449 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1450 | if (_exception) { |
| 1451 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1452 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1453 | } |
| 1454 | |
| 1455 | /* void glLightf ( GLenum light, GLenum pname, GLfloat param ) */ |
| 1456 | static void |
| 1457 | android_glLightf__IIF |
| 1458 | (JNIEnv *_env, jobject _this, jint light, jint pname, jfloat param) { |
| 1459 | glLightf( |
| 1460 | (GLenum)light, |
| 1461 | (GLenum)pname, |
| 1462 | (GLfloat)param |
| 1463 | ); |
| 1464 | } |
| 1465 | |
| 1466 | /* void glLightfv ( GLenum light, GLenum pname, const GLfloat *params ) */ |
| 1467 | static void |
| 1468 | android_glLightfv__II_3FI |
| 1469 | (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1470 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1471 | const char * _exceptionType = NULL; |
| 1472 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1473 | GLfloat *params_base = (GLfloat *) 0; |
| 1474 | jint _remaining; |
| 1475 | GLfloat *params = (GLfloat *) 0; |
| 1476 | |
| 1477 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1478 | _exception = 1; |
| 1479 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1480 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1481 | goto exit; |
| 1482 | } |
| 1483 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1484 | _exception = 1; |
| 1485 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1486 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1487 | goto exit; |
| 1488 | } |
| 1489 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 1490 | int _needed; |
| 1491 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1492 | #if defined(GL_SPOT_DIRECTION) |
| 1493 | case GL_SPOT_DIRECTION: |
| 1494 | #endif // defined(GL_SPOT_DIRECTION) |
| 1495 | _needed = 3; |
| 1496 | break; |
| 1497 | #if defined(GL_AMBIENT) |
| 1498 | case GL_AMBIENT: |
| 1499 | #endif // defined(GL_AMBIENT) |
| 1500 | #if defined(GL_DIFFUSE) |
| 1501 | case GL_DIFFUSE: |
| 1502 | #endif // defined(GL_DIFFUSE) |
| 1503 | #if defined(GL_SPECULAR) |
| 1504 | case GL_SPECULAR: |
| 1505 | #endif // defined(GL_SPECULAR) |
| 1506 | #if defined(GL_EMISSION) |
| 1507 | case GL_EMISSION: |
| 1508 | #endif // defined(GL_EMISSION) |
| 1509 | _needed = 4; |
| 1510 | break; |
| 1511 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1512 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1513 | break; |
| 1514 | } |
| 1515 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1516 | _exception = 1; |
| 1517 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1518 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1519 | goto exit; |
| 1520 | } |
| 1521 | params_base = (GLfloat *) |
| 1522 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 1523 | params = params_base + offset; |
| 1524 | |
| 1525 | glLightfv( |
| 1526 | (GLenum)light, |
| 1527 | (GLenum)pname, |
| 1528 | (GLfloat *)params |
| 1529 | ); |
| 1530 | |
| 1531 | exit: |
| 1532 | if (params_base) { |
| 1533 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 1534 | JNI_ABORT); |
| 1535 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1536 | if (_exception) { |
| 1537 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1538 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1539 | } |
| 1540 | |
| 1541 | /* void glLightfv ( GLenum light, GLenum pname, const GLfloat *params ) */ |
| 1542 | static void |
| 1543 | android_glLightfv__IILjava_nio_FloatBuffer_2 |
| 1544 | (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1545 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1546 | const char * _exceptionType = NULL; |
| 1547 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1548 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1549 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1550 | jint _remaining; |
| 1551 | GLfloat *params = (GLfloat *) 0; |
| 1552 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1553 | params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1554 | int _needed; |
| 1555 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1556 | #if defined(GL_SPOT_DIRECTION) |
| 1557 | case GL_SPOT_DIRECTION: |
| 1558 | #endif // defined(GL_SPOT_DIRECTION) |
| 1559 | _needed = 3; |
| 1560 | break; |
| 1561 | #if defined(GL_AMBIENT) |
| 1562 | case GL_AMBIENT: |
| 1563 | #endif // defined(GL_AMBIENT) |
| 1564 | #if defined(GL_DIFFUSE) |
| 1565 | case GL_DIFFUSE: |
| 1566 | #endif // defined(GL_DIFFUSE) |
| 1567 | #if defined(GL_SPECULAR) |
| 1568 | case GL_SPECULAR: |
| 1569 | #endif // defined(GL_SPECULAR) |
| 1570 | #if defined(GL_EMISSION) |
| 1571 | case GL_EMISSION: |
| 1572 | #endif // defined(GL_EMISSION) |
| 1573 | _needed = 4; |
| 1574 | break; |
| 1575 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1576 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1577 | break; |
| 1578 | } |
| 1579 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1580 | _exception = 1; |
| 1581 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1582 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1583 | goto exit; |
| 1584 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1585 | if (params == NULL) { |
| 1586 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1587 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 1588 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1589 | glLightfv( |
| 1590 | (GLenum)light, |
| 1591 | (GLenum)pname, |
| 1592 | (GLfloat *)params |
| 1593 | ); |
| 1594 | |
| 1595 | exit: |
| 1596 | if (_array) { |
| 1597 | releasePointer(_env, _array, params, JNI_FALSE); |
| 1598 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1599 | if (_exception) { |
| 1600 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1601 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1602 | } |
| 1603 | |
| 1604 | /* void glLightx ( GLenum light, GLenum pname, GLfixed param ) */ |
| 1605 | static void |
| 1606 | android_glLightx__III |
| 1607 | (JNIEnv *_env, jobject _this, jint light, jint pname, jint param) { |
| 1608 | glLightx( |
| 1609 | (GLenum)light, |
| 1610 | (GLenum)pname, |
| 1611 | (GLfixed)param |
| 1612 | ); |
| 1613 | } |
| 1614 | |
| 1615 | /* void glLightxv ( GLenum light, GLenum pname, const GLfixed *params ) */ |
| 1616 | static void |
| 1617 | android_glLightxv__II_3II |
| 1618 | (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1619 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1620 | const char * _exceptionType = NULL; |
| 1621 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1622 | GLfixed *params_base = (GLfixed *) 0; |
| 1623 | jint _remaining; |
| 1624 | GLfixed *params = (GLfixed *) 0; |
| 1625 | |
| 1626 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1627 | _exception = 1; |
| 1628 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1629 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1630 | goto exit; |
| 1631 | } |
| 1632 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1633 | _exception = 1; |
| 1634 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1635 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1636 | goto exit; |
| 1637 | } |
| 1638 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 1639 | int _needed; |
| 1640 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1641 | #if defined(GL_SPOT_DIRECTION) |
| 1642 | case GL_SPOT_DIRECTION: |
| 1643 | #endif // defined(GL_SPOT_DIRECTION) |
| 1644 | _needed = 3; |
| 1645 | break; |
| 1646 | #if defined(GL_AMBIENT) |
| 1647 | case GL_AMBIENT: |
| 1648 | #endif // defined(GL_AMBIENT) |
| 1649 | #if defined(GL_DIFFUSE) |
| 1650 | case GL_DIFFUSE: |
| 1651 | #endif // defined(GL_DIFFUSE) |
| 1652 | #if defined(GL_SPECULAR) |
| 1653 | case GL_SPECULAR: |
| 1654 | #endif // defined(GL_SPECULAR) |
| 1655 | #if defined(GL_EMISSION) |
| 1656 | case GL_EMISSION: |
| 1657 | #endif // defined(GL_EMISSION) |
| 1658 | _needed = 4; |
| 1659 | break; |
| 1660 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1661 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1662 | break; |
| 1663 | } |
| 1664 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1665 | _exception = 1; |
| 1666 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1667 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1668 | goto exit; |
| 1669 | } |
| 1670 | params_base = (GLfixed *) |
| 1671 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 1672 | params = params_base + offset; |
| 1673 | |
| 1674 | glLightxv( |
| 1675 | (GLenum)light, |
| 1676 | (GLenum)pname, |
| 1677 | (GLfixed *)params |
| 1678 | ); |
| 1679 | |
| 1680 | exit: |
| 1681 | if (params_base) { |
| 1682 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 1683 | JNI_ABORT); |
| 1684 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1685 | if (_exception) { |
| 1686 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1687 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1688 | } |
| 1689 | |
| 1690 | /* void glLightxv ( GLenum light, GLenum pname, const GLfixed *params ) */ |
| 1691 | static void |
| 1692 | android_glLightxv__IILjava_nio_IntBuffer_2 |
| 1693 | (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1694 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1695 | const char * _exceptionType = NULL; |
| 1696 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1697 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1698 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1699 | jint _remaining; |
| 1700 | GLfixed *params = (GLfixed *) 0; |
| 1701 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1702 | params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1703 | int _needed; |
| 1704 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1705 | #if defined(GL_SPOT_DIRECTION) |
| 1706 | case GL_SPOT_DIRECTION: |
| 1707 | #endif // defined(GL_SPOT_DIRECTION) |
| 1708 | _needed = 3; |
| 1709 | break; |
| 1710 | #if defined(GL_AMBIENT) |
| 1711 | case GL_AMBIENT: |
| 1712 | #endif // defined(GL_AMBIENT) |
| 1713 | #if defined(GL_DIFFUSE) |
| 1714 | case GL_DIFFUSE: |
| 1715 | #endif // defined(GL_DIFFUSE) |
| 1716 | #if defined(GL_SPECULAR) |
| 1717 | case GL_SPECULAR: |
| 1718 | #endif // defined(GL_SPECULAR) |
| 1719 | #if defined(GL_EMISSION) |
| 1720 | case GL_EMISSION: |
| 1721 | #endif // defined(GL_EMISSION) |
| 1722 | _needed = 4; |
| 1723 | break; |
| 1724 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1725 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1726 | break; |
| 1727 | } |
| 1728 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1729 | _exception = 1; |
| 1730 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1731 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1732 | goto exit; |
| 1733 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1734 | if (params == NULL) { |
| 1735 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1736 | params = (GLfixed *) (_paramsBase + _bufferOffset); |
| 1737 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1738 | glLightxv( |
| 1739 | (GLenum)light, |
| 1740 | (GLenum)pname, |
| 1741 | (GLfixed *)params |
| 1742 | ); |
| 1743 | |
| 1744 | exit: |
| 1745 | if (_array) { |
| 1746 | releasePointer(_env, _array, params, JNI_FALSE); |
| 1747 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1748 | if (_exception) { |
| 1749 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1750 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1751 | } |
| 1752 | |
| 1753 | /* void glLineWidth ( GLfloat width ) */ |
| 1754 | static void |
| 1755 | android_glLineWidth__F |
| 1756 | (JNIEnv *_env, jobject _this, jfloat width) { |
| 1757 | glLineWidth( |
| 1758 | (GLfloat)width |
| 1759 | ); |
| 1760 | } |
| 1761 | |
| 1762 | /* void glLineWidthx ( GLfixed width ) */ |
| 1763 | static void |
| 1764 | android_glLineWidthx__I |
| 1765 | (JNIEnv *_env, jobject _this, jint width) { |
| 1766 | glLineWidthx( |
| 1767 | (GLfixed)width |
| 1768 | ); |
| 1769 | } |
| 1770 | |
| 1771 | /* void glLoadIdentity ( void ) */ |
| 1772 | static void |
| 1773 | android_glLoadIdentity__ |
| 1774 | (JNIEnv *_env, jobject _this) { |
| 1775 | glLoadIdentity(); |
| 1776 | } |
| 1777 | |
| 1778 | /* void glLoadMatrixf ( const GLfloat *m ) */ |
| 1779 | static void |
| 1780 | android_glLoadMatrixf___3FI |
| 1781 | (JNIEnv *_env, jobject _this, jfloatArray m_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1782 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1783 | const char * _exceptionType = NULL; |
| 1784 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1785 | GLfloat *m_base = (GLfloat *) 0; |
| 1786 | jint _remaining; |
| 1787 | GLfloat *m = (GLfloat *) 0; |
| 1788 | |
| 1789 | if (!m_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1790 | _exception = 1; |
| 1791 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1792 | _exceptionMessage = "m == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1793 | goto exit; |
| 1794 | } |
| 1795 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1796 | _exception = 1; |
| 1797 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1798 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1799 | goto exit; |
| 1800 | } |
| 1801 | _remaining = _env->GetArrayLength(m_ref) - offset; |
| 1802 | m_base = (GLfloat *) |
| 1803 | _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0); |
| 1804 | m = m_base + offset; |
| 1805 | |
| 1806 | glLoadMatrixf( |
| 1807 | (GLfloat *)m |
| 1808 | ); |
| 1809 | |
| 1810 | exit: |
| 1811 | if (m_base) { |
| 1812 | _env->ReleasePrimitiveArrayCritical(m_ref, m_base, |
| 1813 | JNI_ABORT); |
| 1814 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1815 | if (_exception) { |
| 1816 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1817 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1818 | } |
| 1819 | |
| 1820 | /* void glLoadMatrixf ( const GLfloat *m ) */ |
| 1821 | static void |
| 1822 | android_glLoadMatrixf__Ljava_nio_FloatBuffer_2 |
| 1823 | (JNIEnv *_env, jobject _this, jobject m_buf) { |
| 1824 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1825 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1826 | jint _remaining; |
| 1827 | GLfloat *m = (GLfloat *) 0; |
| 1828 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1829 | m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset); |
| 1830 | if (m == NULL) { |
| 1831 | char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1832 | m = (GLfloat *) (_mBase + _bufferOffset); |
| 1833 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1834 | glLoadMatrixf( |
| 1835 | (GLfloat *)m |
| 1836 | ); |
| 1837 | if (_array) { |
| 1838 | releasePointer(_env, _array, m, JNI_FALSE); |
| 1839 | } |
| 1840 | } |
| 1841 | |
| 1842 | /* void glLoadMatrixx ( const GLfixed *m ) */ |
| 1843 | static void |
| 1844 | android_glLoadMatrixx___3II |
| 1845 | (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1846 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1847 | const char * _exceptionType = NULL; |
| 1848 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1849 | GLfixed *m_base = (GLfixed *) 0; |
| 1850 | jint _remaining; |
| 1851 | GLfixed *m = (GLfixed *) 0; |
| 1852 | |
| 1853 | if (!m_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1854 | _exception = 1; |
| 1855 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1856 | _exceptionMessage = "m == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1857 | goto exit; |
| 1858 | } |
| 1859 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1860 | _exception = 1; |
| 1861 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1862 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1863 | goto exit; |
| 1864 | } |
| 1865 | _remaining = _env->GetArrayLength(m_ref) - offset; |
| 1866 | m_base = (GLfixed *) |
| 1867 | _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0); |
| 1868 | m = m_base + offset; |
| 1869 | |
| 1870 | glLoadMatrixx( |
| 1871 | (GLfixed *)m |
| 1872 | ); |
| 1873 | |
| 1874 | exit: |
| 1875 | if (m_base) { |
| 1876 | _env->ReleasePrimitiveArrayCritical(m_ref, m_base, |
| 1877 | JNI_ABORT); |
| 1878 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1879 | if (_exception) { |
| 1880 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1881 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1882 | } |
| 1883 | |
| 1884 | /* void glLoadMatrixx ( const GLfixed *m ) */ |
| 1885 | static void |
| 1886 | android_glLoadMatrixx__Ljava_nio_IntBuffer_2 |
| 1887 | (JNIEnv *_env, jobject _this, jobject m_buf) { |
| 1888 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1889 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1890 | jint _remaining; |
| 1891 | GLfixed *m = (GLfixed *) 0; |
| 1892 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1893 | m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset); |
| 1894 | if (m == NULL) { |
| 1895 | char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1896 | m = (GLfixed *) (_mBase + _bufferOffset); |
| 1897 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1898 | glLoadMatrixx( |
| 1899 | (GLfixed *)m |
| 1900 | ); |
| 1901 | if (_array) { |
| 1902 | releasePointer(_env, _array, m, JNI_FALSE); |
| 1903 | } |
| 1904 | } |
| 1905 | |
| 1906 | /* void glLogicOp ( GLenum opcode ) */ |
| 1907 | static void |
| 1908 | android_glLogicOp__I |
| 1909 | (JNIEnv *_env, jobject _this, jint opcode) { |
| 1910 | glLogicOp( |
| 1911 | (GLenum)opcode |
| 1912 | ); |
| 1913 | } |
| 1914 | |
| 1915 | /* void glMaterialf ( GLenum face, GLenum pname, GLfloat param ) */ |
| 1916 | static void |
| 1917 | android_glMaterialf__IIF |
| 1918 | (JNIEnv *_env, jobject _this, jint face, jint pname, jfloat param) { |
| 1919 | glMaterialf( |
| 1920 | (GLenum)face, |
| 1921 | (GLenum)pname, |
| 1922 | (GLfloat)param |
| 1923 | ); |
| 1924 | } |
| 1925 | |
| 1926 | /* void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) */ |
| 1927 | static void |
| 1928 | android_glMaterialfv__II_3FI |
| 1929 | (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1930 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1931 | const char * _exceptionType = NULL; |
| 1932 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1933 | GLfloat *params_base = (GLfloat *) 0; |
| 1934 | jint _remaining; |
| 1935 | GLfloat *params = (GLfloat *) 0; |
| 1936 | |
| 1937 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1938 | _exception = 1; |
| 1939 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1940 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1941 | goto exit; |
| 1942 | } |
| 1943 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1944 | _exception = 1; |
| 1945 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1946 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1947 | goto exit; |
| 1948 | } |
| 1949 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 1950 | int _needed; |
| 1951 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1952 | #if defined(GL_AMBIENT) |
| 1953 | case GL_AMBIENT: |
| 1954 | #endif // defined(GL_AMBIENT) |
| 1955 | #if defined(GL_DIFFUSE) |
| 1956 | case GL_DIFFUSE: |
| 1957 | #endif // defined(GL_DIFFUSE) |
| 1958 | #if defined(GL_SPECULAR) |
| 1959 | case GL_SPECULAR: |
| 1960 | #endif // defined(GL_SPECULAR) |
| 1961 | #if defined(GL_EMISSION) |
| 1962 | case GL_EMISSION: |
| 1963 | #endif // defined(GL_EMISSION) |
| 1964 | #if defined(GL_AMBIENT_AND_DIFFUSE) |
| 1965 | case GL_AMBIENT_AND_DIFFUSE: |
| 1966 | #endif // defined(GL_AMBIENT_AND_DIFFUSE) |
| 1967 | _needed = 4; |
| 1968 | break; |
| 1969 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1970 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1971 | break; |
| 1972 | } |
| 1973 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1974 | _exception = 1; |
| 1975 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1976 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1977 | goto exit; |
| 1978 | } |
| 1979 | params_base = (GLfloat *) |
| 1980 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 1981 | params = params_base + offset; |
| 1982 | |
| 1983 | glMaterialfv( |
| 1984 | (GLenum)face, |
| 1985 | (GLenum)pname, |
| 1986 | (GLfloat *)params |
| 1987 | ); |
| 1988 | |
| 1989 | exit: |
| 1990 | if (params_base) { |
| 1991 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 1992 | JNI_ABORT); |
| 1993 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1994 | if (_exception) { |
| 1995 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1996 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1997 | } |
| 1998 | |
| 1999 | /* void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) */ |
| 2000 | static void |
| 2001 | android_glMaterialfv__IILjava_nio_FloatBuffer_2 |
| 2002 | (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2003 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2004 | const char * _exceptionType = NULL; |
| 2005 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2006 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2007 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2008 | jint _remaining; |
| 2009 | GLfloat *params = (GLfloat *) 0; |
| 2010 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2011 | params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2012 | int _needed; |
| 2013 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2014 | #if defined(GL_AMBIENT) |
| 2015 | case GL_AMBIENT: |
| 2016 | #endif // defined(GL_AMBIENT) |
| 2017 | #if defined(GL_DIFFUSE) |
| 2018 | case GL_DIFFUSE: |
| 2019 | #endif // defined(GL_DIFFUSE) |
| 2020 | #if defined(GL_SPECULAR) |
| 2021 | case GL_SPECULAR: |
| 2022 | #endif // defined(GL_SPECULAR) |
| 2023 | #if defined(GL_EMISSION) |
| 2024 | case GL_EMISSION: |
| 2025 | #endif // defined(GL_EMISSION) |
| 2026 | #if defined(GL_AMBIENT_AND_DIFFUSE) |
| 2027 | case GL_AMBIENT_AND_DIFFUSE: |
| 2028 | #endif // defined(GL_AMBIENT_AND_DIFFUSE) |
| 2029 | _needed = 4; |
| 2030 | break; |
| 2031 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2032 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2033 | break; |
| 2034 | } |
| 2035 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2036 | _exception = 1; |
| 2037 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2038 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2039 | goto exit; |
| 2040 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2041 | if (params == NULL) { |
| 2042 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2043 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 2044 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2045 | glMaterialfv( |
| 2046 | (GLenum)face, |
| 2047 | (GLenum)pname, |
| 2048 | (GLfloat *)params |
| 2049 | ); |
| 2050 | |
| 2051 | exit: |
| 2052 | if (_array) { |
| 2053 | releasePointer(_env, _array, params, JNI_FALSE); |
| 2054 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2055 | if (_exception) { |
| 2056 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2057 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2058 | } |
| 2059 | |
| 2060 | /* void glMaterialx ( GLenum face, GLenum pname, GLfixed param ) */ |
| 2061 | static void |
| 2062 | android_glMaterialx__III |
| 2063 | (JNIEnv *_env, jobject _this, jint face, jint pname, jint param) { |
| 2064 | glMaterialx( |
| 2065 | (GLenum)face, |
| 2066 | (GLenum)pname, |
| 2067 | (GLfixed)param |
| 2068 | ); |
| 2069 | } |
| 2070 | |
| 2071 | /* void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params ) */ |
| 2072 | static void |
| 2073 | android_glMaterialxv__II_3II |
| 2074 | (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2075 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2076 | const char * _exceptionType = NULL; |
| 2077 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2078 | GLfixed *params_base = (GLfixed *) 0; |
| 2079 | jint _remaining; |
| 2080 | GLfixed *params = (GLfixed *) 0; |
| 2081 | |
| 2082 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2083 | _exception = 1; |
| 2084 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2085 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2086 | goto exit; |
| 2087 | } |
| 2088 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2089 | _exception = 1; |
| 2090 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2091 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2092 | goto exit; |
| 2093 | } |
| 2094 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2095 | int _needed; |
| 2096 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2097 | #if defined(GL_AMBIENT) |
| 2098 | case GL_AMBIENT: |
| 2099 | #endif // defined(GL_AMBIENT) |
| 2100 | #if defined(GL_DIFFUSE) |
| 2101 | case GL_DIFFUSE: |
| 2102 | #endif // defined(GL_DIFFUSE) |
| 2103 | #if defined(GL_SPECULAR) |
| 2104 | case GL_SPECULAR: |
| 2105 | #endif // defined(GL_SPECULAR) |
| 2106 | #if defined(GL_EMISSION) |
| 2107 | case GL_EMISSION: |
| 2108 | #endif // defined(GL_EMISSION) |
| 2109 | #if defined(GL_AMBIENT_AND_DIFFUSE) |
| 2110 | case GL_AMBIENT_AND_DIFFUSE: |
| 2111 | #endif // defined(GL_AMBIENT_AND_DIFFUSE) |
| 2112 | _needed = 4; |
| 2113 | break; |
| 2114 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2115 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2116 | break; |
| 2117 | } |
| 2118 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2119 | _exception = 1; |
| 2120 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2121 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2122 | goto exit; |
| 2123 | } |
| 2124 | params_base = (GLfixed *) |
| 2125 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 2126 | params = params_base + offset; |
| 2127 | |
| 2128 | glMaterialxv( |
| 2129 | (GLenum)face, |
| 2130 | (GLenum)pname, |
| 2131 | (GLfixed *)params |
| 2132 | ); |
| 2133 | |
| 2134 | exit: |
| 2135 | if (params_base) { |
| 2136 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 2137 | JNI_ABORT); |
| 2138 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2139 | if (_exception) { |
| 2140 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2141 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2142 | } |
| 2143 | |
| 2144 | /* void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params ) */ |
| 2145 | static void |
| 2146 | android_glMaterialxv__IILjava_nio_IntBuffer_2 |
| 2147 | (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2148 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2149 | const char * _exceptionType = NULL; |
| 2150 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2151 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2152 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2153 | jint _remaining; |
| 2154 | GLfixed *params = (GLfixed *) 0; |
| 2155 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2156 | params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2157 | int _needed; |
| 2158 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2159 | #if defined(GL_AMBIENT) |
| 2160 | case GL_AMBIENT: |
| 2161 | #endif // defined(GL_AMBIENT) |
| 2162 | #if defined(GL_DIFFUSE) |
| 2163 | case GL_DIFFUSE: |
| 2164 | #endif // defined(GL_DIFFUSE) |
| 2165 | #if defined(GL_SPECULAR) |
| 2166 | case GL_SPECULAR: |
| 2167 | #endif // defined(GL_SPECULAR) |
| 2168 | #if defined(GL_EMISSION) |
| 2169 | case GL_EMISSION: |
| 2170 | #endif // defined(GL_EMISSION) |
| 2171 | #if defined(GL_AMBIENT_AND_DIFFUSE) |
| 2172 | case GL_AMBIENT_AND_DIFFUSE: |
| 2173 | #endif // defined(GL_AMBIENT_AND_DIFFUSE) |
| 2174 | _needed = 4; |
| 2175 | break; |
| 2176 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2177 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2178 | break; |
| 2179 | } |
| 2180 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2181 | _exception = 1; |
| 2182 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2183 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2184 | goto exit; |
| 2185 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2186 | if (params == NULL) { |
| 2187 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2188 | params = (GLfixed *) (_paramsBase + _bufferOffset); |
| 2189 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2190 | glMaterialxv( |
| 2191 | (GLenum)face, |
| 2192 | (GLenum)pname, |
| 2193 | (GLfixed *)params |
| 2194 | ); |
| 2195 | |
| 2196 | exit: |
| 2197 | if (_array) { |
| 2198 | releasePointer(_env, _array, params, JNI_FALSE); |
| 2199 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2200 | if (_exception) { |
| 2201 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2202 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2203 | } |
| 2204 | |
| 2205 | /* void glMatrixMode ( GLenum mode ) */ |
| 2206 | static void |
| 2207 | android_glMatrixMode__I |
| 2208 | (JNIEnv *_env, jobject _this, jint mode) { |
| 2209 | glMatrixMode( |
| 2210 | (GLenum)mode |
| 2211 | ); |
| 2212 | } |
| 2213 | |
| 2214 | /* void glMultMatrixf ( const GLfloat *m ) */ |
| 2215 | static void |
| 2216 | android_glMultMatrixf___3FI |
| 2217 | (JNIEnv *_env, jobject _this, jfloatArray m_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2218 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2219 | const char * _exceptionType = NULL; |
| 2220 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2221 | GLfloat *m_base = (GLfloat *) 0; |
| 2222 | jint _remaining; |
| 2223 | GLfloat *m = (GLfloat *) 0; |
| 2224 | |
| 2225 | if (!m_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2226 | _exception = 1; |
| 2227 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2228 | _exceptionMessage = "m == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2229 | goto exit; |
| 2230 | } |
| 2231 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2232 | _exception = 1; |
| 2233 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2234 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2235 | goto exit; |
| 2236 | } |
| 2237 | _remaining = _env->GetArrayLength(m_ref) - offset; |
| 2238 | m_base = (GLfloat *) |
| 2239 | _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0); |
| 2240 | m = m_base + offset; |
| 2241 | |
| 2242 | glMultMatrixf( |
| 2243 | (GLfloat *)m |
| 2244 | ); |
| 2245 | |
| 2246 | exit: |
| 2247 | if (m_base) { |
| 2248 | _env->ReleasePrimitiveArrayCritical(m_ref, m_base, |
| 2249 | JNI_ABORT); |
| 2250 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2251 | if (_exception) { |
| 2252 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2253 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2254 | } |
| 2255 | |
| 2256 | /* void glMultMatrixf ( const GLfloat *m ) */ |
| 2257 | static void |
| 2258 | android_glMultMatrixf__Ljava_nio_FloatBuffer_2 |
| 2259 | (JNIEnv *_env, jobject _this, jobject m_buf) { |
| 2260 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2261 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2262 | jint _remaining; |
| 2263 | GLfloat *m = (GLfloat *) 0; |
| 2264 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2265 | m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset); |
| 2266 | if (m == NULL) { |
| 2267 | char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2268 | m = (GLfloat *) (_mBase + _bufferOffset); |
| 2269 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2270 | glMultMatrixf( |
| 2271 | (GLfloat *)m |
| 2272 | ); |
| 2273 | if (_array) { |
| 2274 | releasePointer(_env, _array, m, JNI_FALSE); |
| 2275 | } |
| 2276 | } |
| 2277 | |
| 2278 | /* void glMultMatrixx ( const GLfixed *m ) */ |
| 2279 | static void |
| 2280 | android_glMultMatrixx___3II |
| 2281 | (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2282 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2283 | const char * _exceptionType = NULL; |
| 2284 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2285 | GLfixed *m_base = (GLfixed *) 0; |
| 2286 | jint _remaining; |
| 2287 | GLfixed *m = (GLfixed *) 0; |
| 2288 | |
| 2289 | if (!m_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2290 | _exception = 1; |
| 2291 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2292 | _exceptionMessage = "m == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2293 | goto exit; |
| 2294 | } |
| 2295 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2296 | _exception = 1; |
| 2297 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2298 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2299 | goto exit; |
| 2300 | } |
| 2301 | _remaining = _env->GetArrayLength(m_ref) - offset; |
| 2302 | m_base = (GLfixed *) |
| 2303 | _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0); |
| 2304 | m = m_base + offset; |
| 2305 | |
| 2306 | glMultMatrixx( |
| 2307 | (GLfixed *)m |
| 2308 | ); |
| 2309 | |
| 2310 | exit: |
| 2311 | if (m_base) { |
| 2312 | _env->ReleasePrimitiveArrayCritical(m_ref, m_base, |
| 2313 | JNI_ABORT); |
| 2314 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2315 | if (_exception) { |
| 2316 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2317 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2318 | } |
| 2319 | |
| 2320 | /* void glMultMatrixx ( const GLfixed *m ) */ |
| 2321 | static void |
| 2322 | android_glMultMatrixx__Ljava_nio_IntBuffer_2 |
| 2323 | (JNIEnv *_env, jobject _this, jobject m_buf) { |
| 2324 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2325 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2326 | jint _remaining; |
| 2327 | GLfixed *m = (GLfixed *) 0; |
| 2328 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2329 | m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset); |
| 2330 | if (m == NULL) { |
| 2331 | char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2332 | m = (GLfixed *) (_mBase + _bufferOffset); |
| 2333 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2334 | glMultMatrixx( |
| 2335 | (GLfixed *)m |
| 2336 | ); |
| 2337 | if (_array) { |
| 2338 | releasePointer(_env, _array, m, JNI_FALSE); |
| 2339 | } |
| 2340 | } |
| 2341 | |
| 2342 | /* void glMultiTexCoord4f ( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ) */ |
| 2343 | static void |
| 2344 | android_glMultiTexCoord4f__IFFFF |
| 2345 | (JNIEnv *_env, jobject _this, jint target, jfloat s, jfloat t, jfloat r, jfloat q) { |
| 2346 | glMultiTexCoord4f( |
| 2347 | (GLenum)target, |
| 2348 | (GLfloat)s, |
| 2349 | (GLfloat)t, |
| 2350 | (GLfloat)r, |
| 2351 | (GLfloat)q |
| 2352 | ); |
| 2353 | } |
| 2354 | |
| 2355 | /* void glMultiTexCoord4x ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q ) */ |
| 2356 | static void |
| 2357 | android_glMultiTexCoord4x__IIIII |
| 2358 | (JNIEnv *_env, jobject _this, jint target, jint s, jint t, jint r, jint q) { |
| 2359 | glMultiTexCoord4x( |
| 2360 | (GLenum)target, |
| 2361 | (GLfixed)s, |
| 2362 | (GLfixed)t, |
| 2363 | (GLfixed)r, |
| 2364 | (GLfixed)q |
| 2365 | ); |
| 2366 | } |
| 2367 | |
| 2368 | /* void glNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz ) */ |
| 2369 | static void |
| 2370 | android_glNormal3f__FFF |
| 2371 | (JNIEnv *_env, jobject _this, jfloat nx, jfloat ny, jfloat nz) { |
| 2372 | glNormal3f( |
| 2373 | (GLfloat)nx, |
| 2374 | (GLfloat)ny, |
| 2375 | (GLfloat)nz |
| 2376 | ); |
| 2377 | } |
| 2378 | |
| 2379 | /* void glNormal3x ( GLfixed nx, GLfixed ny, GLfixed nz ) */ |
| 2380 | static void |
| 2381 | android_glNormal3x__III |
| 2382 | (JNIEnv *_env, jobject _this, jint nx, jint ny, jint nz) { |
| 2383 | glNormal3x( |
| 2384 | (GLfixed)nx, |
| 2385 | (GLfixed)ny, |
| 2386 | (GLfixed)nz |
| 2387 | ); |
| 2388 | } |
| 2389 | |
| 2390 | /* void glNormalPointer ( GLenum type, GLsizei stride, const GLvoid *pointer ) */ |
| 2391 | static void |
| 2392 | android_glNormalPointerBounds__IILjava_nio_Buffer_2I |
| 2393 | (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) { |
| 2394 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2395 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2396 | jint _remaining; |
| 2397 | GLvoid *pointer = (GLvoid *) 0; |
| 2398 | |
Jack Palevich | e20ea78 | 2009-05-07 18:28:29 -0700 | [diff] [blame] | 2399 | if (pointer_buf) { |
Jack Palevich | 16e7972 | 2009-05-15 18:13:34 -0700 | [diff] [blame] | 2400 | pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf); |
Jack Palevich | e20ea78 | 2009-05-07 18:28:29 -0700 | [diff] [blame] | 2401 | if ( ! pointer ) { |
Jack Palevich | e20ea78 | 2009-05-07 18:28:29 -0700 | [diff] [blame] | 2402 | return; |
| 2403 | } |
| 2404 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2405 | glNormalPointerBounds( |
| 2406 | (GLenum)type, |
| 2407 | (GLsizei)stride, |
| 2408 | (GLvoid *)pointer, |
| 2409 | (GLsizei)remaining |
| 2410 | ); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2411 | } |
| 2412 | |
| 2413 | /* void glOrthof ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */ |
| 2414 | static void |
| 2415 | android_glOrthof__FFFFFF |
| 2416 | (JNIEnv *_env, jobject _this, jfloat left, jfloat right, jfloat bottom, jfloat top, jfloat zNear, jfloat zFar) { |
| 2417 | glOrthof( |
| 2418 | (GLfloat)left, |
| 2419 | (GLfloat)right, |
| 2420 | (GLfloat)bottom, |
| 2421 | (GLfloat)top, |
| 2422 | (GLfloat)zNear, |
| 2423 | (GLfloat)zFar |
| 2424 | ); |
| 2425 | } |
| 2426 | |
| 2427 | /* void glOrthox ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) */ |
| 2428 | static void |
| 2429 | android_glOrthox__IIIIII |
| 2430 | (JNIEnv *_env, jobject _this, jint left, jint right, jint bottom, jint top, jint zNear, jint zFar) { |
| 2431 | glOrthox( |
| 2432 | (GLfixed)left, |
| 2433 | (GLfixed)right, |
| 2434 | (GLfixed)bottom, |
| 2435 | (GLfixed)top, |
| 2436 | (GLfixed)zNear, |
| 2437 | (GLfixed)zFar |
| 2438 | ); |
| 2439 | } |
| 2440 | |
| 2441 | /* void glPixelStorei ( GLenum pname, GLint param ) */ |
| 2442 | static void |
| 2443 | android_glPixelStorei__II |
| 2444 | (JNIEnv *_env, jobject _this, jint pname, jint param) { |
| 2445 | glPixelStorei( |
| 2446 | (GLenum)pname, |
| 2447 | (GLint)param |
| 2448 | ); |
| 2449 | } |
| 2450 | |
| 2451 | /* void glPointSize ( GLfloat size ) */ |
| 2452 | static void |
| 2453 | android_glPointSize__F |
| 2454 | (JNIEnv *_env, jobject _this, jfloat size) { |
| 2455 | glPointSize( |
| 2456 | (GLfloat)size |
| 2457 | ); |
| 2458 | } |
| 2459 | |
| 2460 | /* void glPointSizex ( GLfixed size ) */ |
| 2461 | static void |
| 2462 | android_glPointSizex__I |
| 2463 | (JNIEnv *_env, jobject _this, jint size) { |
| 2464 | glPointSizex( |
| 2465 | (GLfixed)size |
| 2466 | ); |
| 2467 | } |
| 2468 | |
| 2469 | /* void glPolygonOffset ( GLfloat factor, GLfloat units ) */ |
| 2470 | static void |
| 2471 | android_glPolygonOffset__FF |
| 2472 | (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) { |
| 2473 | glPolygonOffset( |
| 2474 | (GLfloat)factor, |
| 2475 | (GLfloat)units |
| 2476 | ); |
| 2477 | } |
| 2478 | |
| 2479 | /* void glPolygonOffsetx ( GLfixed factor, GLfixed units ) */ |
| 2480 | static void |
| 2481 | android_glPolygonOffsetx__II |
| 2482 | (JNIEnv *_env, jobject _this, jint factor, jint units) { |
| 2483 | glPolygonOffsetx( |
| 2484 | (GLfixed)factor, |
| 2485 | (GLfixed)units |
| 2486 | ); |
| 2487 | } |
| 2488 | |
| 2489 | /* void glPopMatrix ( void ) */ |
| 2490 | static void |
| 2491 | android_glPopMatrix__ |
| 2492 | (JNIEnv *_env, jobject _this) { |
| 2493 | glPopMatrix(); |
| 2494 | } |
| 2495 | |
| 2496 | /* void glPushMatrix ( void ) */ |
| 2497 | static void |
| 2498 | android_glPushMatrix__ |
| 2499 | (JNIEnv *_env, jobject _this) { |
| 2500 | glPushMatrix(); |
| 2501 | } |
| 2502 | |
| 2503 | /* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */ |
| 2504 | static void |
| 2505 | android_glReadPixels__IIIIIILjava_nio_Buffer_2 |
| 2506 | (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2507 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2508 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2509 | jint _remaining; |
| 2510 | GLvoid *pixels = (GLvoid *) 0; |
| 2511 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2512 | pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset); |
| 2513 | if (pixels == NULL) { |
| 2514 | char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2515 | pixels = (GLvoid *) (_pixelsBase + _bufferOffset); |
| 2516 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2517 | glReadPixels( |
| 2518 | (GLint)x, |
| 2519 | (GLint)y, |
| 2520 | (GLsizei)width, |
| 2521 | (GLsizei)height, |
| 2522 | (GLenum)format, |
| 2523 | (GLenum)type, |
| 2524 | (GLvoid *)pixels |
| 2525 | ); |
| 2526 | if (_array) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2527 | releasePointer(_env, _array, pixels, JNI_TRUE); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2528 | } |
| 2529 | } |
| 2530 | |
| 2531 | /* void glRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) */ |
| 2532 | static void |
| 2533 | android_glRotatef__FFFF |
| 2534 | (JNIEnv *_env, jobject _this, jfloat angle, jfloat x, jfloat y, jfloat z) { |
| 2535 | glRotatef( |
| 2536 | (GLfloat)angle, |
| 2537 | (GLfloat)x, |
| 2538 | (GLfloat)y, |
| 2539 | (GLfloat)z |
| 2540 | ); |
| 2541 | } |
| 2542 | |
| 2543 | /* void glRotatex ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z ) */ |
| 2544 | static void |
| 2545 | android_glRotatex__IIII |
| 2546 | (JNIEnv *_env, jobject _this, jint angle, jint x, jint y, jint z) { |
| 2547 | glRotatex( |
| 2548 | (GLfixed)angle, |
| 2549 | (GLfixed)x, |
| 2550 | (GLfixed)y, |
| 2551 | (GLfixed)z |
| 2552 | ); |
| 2553 | } |
| 2554 | |
| 2555 | /* void glSampleCoverage ( GLclampf value, GLboolean invert ) */ |
| 2556 | static void |
| 2557 | android_glSampleCoverage__FZ |
| 2558 | (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) { |
| 2559 | glSampleCoverage( |
| 2560 | (GLclampf)value, |
| 2561 | (GLboolean)invert |
| 2562 | ); |
| 2563 | } |
| 2564 | |
| 2565 | /* void glSampleCoveragex ( GLclampx value, GLboolean invert ) */ |
| 2566 | static void |
| 2567 | android_glSampleCoveragex__IZ |
| 2568 | (JNIEnv *_env, jobject _this, jint value, jboolean invert) { |
| 2569 | glSampleCoveragex( |
| 2570 | (GLclampx)value, |
| 2571 | (GLboolean)invert |
| 2572 | ); |
| 2573 | } |
| 2574 | |
| 2575 | /* void glScalef ( GLfloat x, GLfloat y, GLfloat z ) */ |
| 2576 | static void |
| 2577 | android_glScalef__FFF |
| 2578 | (JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat z) { |
| 2579 | glScalef( |
| 2580 | (GLfloat)x, |
| 2581 | (GLfloat)y, |
| 2582 | (GLfloat)z |
| 2583 | ); |
| 2584 | } |
| 2585 | |
| 2586 | /* void glScalex ( GLfixed x, GLfixed y, GLfixed z ) */ |
| 2587 | static void |
| 2588 | android_glScalex__III |
| 2589 | (JNIEnv *_env, jobject _this, jint x, jint y, jint z) { |
| 2590 | glScalex( |
| 2591 | (GLfixed)x, |
| 2592 | (GLfixed)y, |
| 2593 | (GLfixed)z |
| 2594 | ); |
| 2595 | } |
| 2596 | |
| 2597 | /* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */ |
| 2598 | static void |
| 2599 | android_glScissor__IIII |
| 2600 | (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) { |
| 2601 | glScissor( |
| 2602 | (GLint)x, |
| 2603 | (GLint)y, |
| 2604 | (GLsizei)width, |
| 2605 | (GLsizei)height |
| 2606 | ); |
| 2607 | } |
| 2608 | |
| 2609 | /* void glShadeModel ( GLenum mode ) */ |
| 2610 | static void |
| 2611 | android_glShadeModel__I |
| 2612 | (JNIEnv *_env, jobject _this, jint mode) { |
| 2613 | glShadeModel( |
| 2614 | (GLenum)mode |
| 2615 | ); |
| 2616 | } |
| 2617 | |
| 2618 | /* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */ |
| 2619 | static void |
| 2620 | android_glStencilFunc__III |
| 2621 | (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) { |
| 2622 | glStencilFunc( |
| 2623 | (GLenum)func, |
| 2624 | (GLint)ref, |
| 2625 | (GLuint)mask |
| 2626 | ); |
| 2627 | } |
| 2628 | |
| 2629 | /* void glStencilMask ( GLuint mask ) */ |
| 2630 | static void |
| 2631 | android_glStencilMask__I |
| 2632 | (JNIEnv *_env, jobject _this, jint mask) { |
| 2633 | glStencilMask( |
| 2634 | (GLuint)mask |
| 2635 | ); |
| 2636 | } |
| 2637 | |
| 2638 | /* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */ |
| 2639 | static void |
| 2640 | android_glStencilOp__III |
| 2641 | (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) { |
| 2642 | glStencilOp( |
| 2643 | (GLenum)fail, |
| 2644 | (GLenum)zfail, |
| 2645 | (GLenum)zpass |
| 2646 | ); |
| 2647 | } |
| 2648 | |
| 2649 | /* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */ |
| 2650 | static void |
| 2651 | android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I |
| 2652 | (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) { |
| 2653 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2654 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2655 | jint _remaining; |
| 2656 | GLvoid *pointer = (GLvoid *) 0; |
| 2657 | |
Jack Palevich | e20ea78 | 2009-05-07 18:28:29 -0700 | [diff] [blame] | 2658 | if (pointer_buf) { |
Jack Palevich | 16e7972 | 2009-05-15 18:13:34 -0700 | [diff] [blame] | 2659 | pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf); |
Jack Palevich | e20ea78 | 2009-05-07 18:28:29 -0700 | [diff] [blame] | 2660 | if ( ! pointer ) { |
Jack Palevich | e20ea78 | 2009-05-07 18:28:29 -0700 | [diff] [blame] | 2661 | return; |
| 2662 | } |
| 2663 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2664 | glTexCoordPointerBounds( |
| 2665 | (GLint)size, |
| 2666 | (GLenum)type, |
| 2667 | (GLsizei)stride, |
| 2668 | (GLvoid *)pointer, |
| 2669 | (GLsizei)remaining |
| 2670 | ); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2671 | } |
| 2672 | |
| 2673 | /* void glTexEnvf ( GLenum target, GLenum pname, GLfloat param ) */ |
| 2674 | static void |
| 2675 | android_glTexEnvf__IIF |
| 2676 | (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) { |
| 2677 | glTexEnvf( |
| 2678 | (GLenum)target, |
| 2679 | (GLenum)pname, |
| 2680 | (GLfloat)param |
| 2681 | ); |
| 2682 | } |
| 2683 | |
| 2684 | /* void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) */ |
| 2685 | static void |
| 2686 | android_glTexEnvfv__II_3FI |
| 2687 | (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2688 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2689 | const char * _exceptionType = NULL; |
| 2690 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2691 | GLfloat *params_base = (GLfloat *) 0; |
| 2692 | jint _remaining; |
| 2693 | GLfloat *params = (GLfloat *) 0; |
| 2694 | |
| 2695 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2696 | _exception = 1; |
| 2697 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2698 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2699 | goto exit; |
| 2700 | } |
| 2701 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2702 | _exception = 1; |
| 2703 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2704 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2705 | goto exit; |
| 2706 | } |
| 2707 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2708 | int _needed; |
| 2709 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2710 | #if defined(GL_TEXTURE_ENV_COLOR) |
| 2711 | case GL_TEXTURE_ENV_COLOR: |
| 2712 | #endif // defined(GL_TEXTURE_ENV_COLOR) |
| 2713 | _needed = 4; |
| 2714 | break; |
| 2715 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2716 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2717 | break; |
| 2718 | } |
| 2719 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2720 | _exception = 1; |
| 2721 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2722 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2723 | goto exit; |
| 2724 | } |
| 2725 | params_base = (GLfloat *) |
| 2726 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 2727 | params = params_base + offset; |
| 2728 | |
| 2729 | glTexEnvfv( |
| 2730 | (GLenum)target, |
| 2731 | (GLenum)pname, |
| 2732 | (GLfloat *)params |
| 2733 | ); |
| 2734 | |
| 2735 | exit: |
| 2736 | if (params_base) { |
| 2737 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 2738 | JNI_ABORT); |
| 2739 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2740 | if (_exception) { |
| 2741 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2742 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2743 | } |
| 2744 | |
| 2745 | /* void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) */ |
| 2746 | static void |
| 2747 | android_glTexEnvfv__IILjava_nio_FloatBuffer_2 |
| 2748 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2749 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2750 | const char * _exceptionType = NULL; |
| 2751 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2752 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2753 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2754 | jint _remaining; |
| 2755 | GLfloat *params = (GLfloat *) 0; |
| 2756 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2757 | params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2758 | int _needed; |
| 2759 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2760 | #if defined(GL_TEXTURE_ENV_COLOR) |
| 2761 | case GL_TEXTURE_ENV_COLOR: |
| 2762 | #endif // defined(GL_TEXTURE_ENV_COLOR) |
| 2763 | _needed = 4; |
| 2764 | break; |
| 2765 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2766 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2767 | break; |
| 2768 | } |
| 2769 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2770 | _exception = 1; |
| 2771 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2772 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2773 | goto exit; |
| 2774 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2775 | if (params == NULL) { |
| 2776 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2777 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 2778 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2779 | glTexEnvfv( |
| 2780 | (GLenum)target, |
| 2781 | (GLenum)pname, |
| 2782 | (GLfloat *)params |
| 2783 | ); |
| 2784 | |
| 2785 | exit: |
| 2786 | if (_array) { |
| 2787 | releasePointer(_env, _array, params, JNI_FALSE); |
| 2788 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2789 | if (_exception) { |
| 2790 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2791 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2792 | } |
| 2793 | |
| 2794 | /* void glTexEnvx ( GLenum target, GLenum pname, GLfixed param ) */ |
| 2795 | static void |
| 2796 | android_glTexEnvx__III |
| 2797 | (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) { |
| 2798 | glTexEnvx( |
| 2799 | (GLenum)target, |
| 2800 | (GLenum)pname, |
| 2801 | (GLfixed)param |
| 2802 | ); |
| 2803 | } |
| 2804 | |
| 2805 | /* void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params ) */ |
| 2806 | static void |
| 2807 | android_glTexEnvxv__II_3II |
| 2808 | (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2809 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2810 | const char * _exceptionType = NULL; |
| 2811 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2812 | GLfixed *params_base = (GLfixed *) 0; |
| 2813 | jint _remaining; |
| 2814 | GLfixed *params = (GLfixed *) 0; |
| 2815 | |
| 2816 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2817 | _exception = 1; |
| 2818 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2819 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2820 | goto exit; |
| 2821 | } |
| 2822 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2823 | _exception = 1; |
| 2824 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2825 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2826 | goto exit; |
| 2827 | } |
| 2828 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2829 | int _needed; |
| 2830 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2831 | #if defined(GL_TEXTURE_ENV_COLOR) |
| 2832 | case GL_TEXTURE_ENV_COLOR: |
| 2833 | #endif // defined(GL_TEXTURE_ENV_COLOR) |
| 2834 | _needed = 4; |
| 2835 | break; |
| 2836 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2837 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2838 | break; |
| 2839 | } |
| 2840 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2841 | _exception = 1; |
| 2842 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2843 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2844 | goto exit; |
| 2845 | } |
| 2846 | params_base = (GLfixed *) |
| 2847 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 2848 | params = params_base + offset; |
| 2849 | |
| 2850 | glTexEnvxv( |
| 2851 | (GLenum)target, |
| 2852 | (GLenum)pname, |
| 2853 | (GLfixed *)params |
| 2854 | ); |
| 2855 | |
| 2856 | exit: |
| 2857 | if (params_base) { |
| 2858 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 2859 | JNI_ABORT); |
| 2860 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2861 | if (_exception) { |
| 2862 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2863 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2864 | } |
| 2865 | |
| 2866 | /* void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params ) */ |
| 2867 | static void |
| 2868 | android_glTexEnvxv__IILjava_nio_IntBuffer_2 |
| 2869 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2870 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2871 | const char * _exceptionType = NULL; |
| 2872 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2873 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2874 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2875 | jint _remaining; |
| 2876 | GLfixed *params = (GLfixed *) 0; |
| 2877 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2878 | params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2879 | int _needed; |
| 2880 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2881 | #if defined(GL_TEXTURE_ENV_COLOR) |
| 2882 | case GL_TEXTURE_ENV_COLOR: |
| 2883 | #endif // defined(GL_TEXTURE_ENV_COLOR) |
| 2884 | _needed = 4; |
| 2885 | break; |
| 2886 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2887 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2888 | break; |
| 2889 | } |
| 2890 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2891 | _exception = 1; |
| 2892 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2893 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2894 | goto exit; |
| 2895 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2896 | if (params == NULL) { |
| 2897 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2898 | params = (GLfixed *) (_paramsBase + _bufferOffset); |
| 2899 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2900 | glTexEnvxv( |
| 2901 | (GLenum)target, |
| 2902 | (GLenum)pname, |
| 2903 | (GLfixed *)params |
| 2904 | ); |
| 2905 | |
| 2906 | exit: |
| 2907 | if (_array) { |
| 2908 | releasePointer(_env, _array, params, JNI_FALSE); |
| 2909 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2910 | if (_exception) { |
| 2911 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2912 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2913 | } |
| 2914 | |
| 2915 | /* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */ |
| 2916 | static void |
| 2917 | android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 |
| 2918 | (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) { |
| 2919 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2920 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2921 | jint _remaining; |
| 2922 | GLvoid *pixels = (GLvoid *) 0; |
| 2923 | |
| 2924 | if (pixels_buf) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2925 | pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset); |
| 2926 | } |
Thomas Tafertshofer | 37c9b49 | 2012-07-23 16:56:04 -0700 | [diff] [blame] | 2927 | if (pixels_buf && pixels == NULL) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2928 | char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2929 | pixels = (GLvoid *) (_pixelsBase + _bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2930 | } |
| 2931 | glTexImage2D( |
| 2932 | (GLenum)target, |
| 2933 | (GLint)level, |
| 2934 | (GLint)internalformat, |
| 2935 | (GLsizei)width, |
| 2936 | (GLsizei)height, |
| 2937 | (GLint)border, |
| 2938 | (GLenum)format, |
| 2939 | (GLenum)type, |
| 2940 | (GLvoid *)pixels |
| 2941 | ); |
| 2942 | if (_array) { |
| 2943 | releasePointer(_env, _array, pixels, JNI_FALSE); |
| 2944 | } |
| 2945 | } |
| 2946 | |
| 2947 | /* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */ |
| 2948 | static void |
| 2949 | android_glTexParameterf__IIF |
| 2950 | (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) { |
| 2951 | glTexParameterf( |
| 2952 | (GLenum)target, |
| 2953 | (GLenum)pname, |
| 2954 | (GLfloat)param |
| 2955 | ); |
| 2956 | } |
| 2957 | |
| 2958 | /* void glTexParameterx ( GLenum target, GLenum pname, GLfixed param ) */ |
| 2959 | static void |
| 2960 | android_glTexParameterx__III |
| 2961 | (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) { |
| 2962 | glTexParameterx( |
| 2963 | (GLenum)target, |
| 2964 | (GLenum)pname, |
| 2965 | (GLfixed)param |
| 2966 | ); |
| 2967 | } |
| 2968 | |
| 2969 | /* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */ |
| 2970 | static void |
| 2971 | android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 |
| 2972 | (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) { |
| 2973 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2974 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2975 | jint _remaining; |
| 2976 | GLvoid *pixels = (GLvoid *) 0; |
| 2977 | |
| 2978 | if (pixels_buf) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2979 | pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset); |
| 2980 | } |
Thomas Tafertshofer | 37c9b49 | 2012-07-23 16:56:04 -0700 | [diff] [blame] | 2981 | if (pixels_buf && pixels == NULL) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2982 | char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2983 | pixels = (GLvoid *) (_pixelsBase + _bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2984 | } |
| 2985 | glTexSubImage2D( |
| 2986 | (GLenum)target, |
| 2987 | (GLint)level, |
| 2988 | (GLint)xoffset, |
| 2989 | (GLint)yoffset, |
| 2990 | (GLsizei)width, |
| 2991 | (GLsizei)height, |
| 2992 | (GLenum)format, |
| 2993 | (GLenum)type, |
| 2994 | (GLvoid *)pixels |
| 2995 | ); |
| 2996 | if (_array) { |
| 2997 | releasePointer(_env, _array, pixels, JNI_FALSE); |
| 2998 | } |
| 2999 | } |
| 3000 | |
| 3001 | /* void glTranslatef ( GLfloat x, GLfloat y, GLfloat z ) */ |
| 3002 | static void |
| 3003 | android_glTranslatef__FFF |
| 3004 | (JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat z) { |
| 3005 | glTranslatef( |
| 3006 | (GLfloat)x, |
| 3007 | (GLfloat)y, |
| 3008 | (GLfloat)z |
| 3009 | ); |
| 3010 | } |
| 3011 | |
| 3012 | /* void glTranslatex ( GLfixed x, GLfixed y, GLfixed z ) */ |
| 3013 | static void |
| 3014 | android_glTranslatex__III |
| 3015 | (JNIEnv *_env, jobject _this, jint x, jint y, jint z) { |
| 3016 | glTranslatex( |
| 3017 | (GLfixed)x, |
| 3018 | (GLfixed)y, |
| 3019 | (GLfixed)z |
| 3020 | ); |
| 3021 | } |
| 3022 | |
| 3023 | /* void glVertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */ |
| 3024 | static void |
| 3025 | android_glVertexPointerBounds__IIILjava_nio_Buffer_2I |
| 3026 | (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) { |
| 3027 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3028 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3029 | jint _remaining; |
| 3030 | GLvoid *pointer = (GLvoid *) 0; |
| 3031 | |
Jack Palevich | e20ea78 | 2009-05-07 18:28:29 -0700 | [diff] [blame] | 3032 | if (pointer_buf) { |
Jack Palevich | 16e7972 | 2009-05-15 18:13:34 -0700 | [diff] [blame] | 3033 | pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf); |
Jack Palevich | e20ea78 | 2009-05-07 18:28:29 -0700 | [diff] [blame] | 3034 | if ( ! pointer ) { |
Jack Palevich | e20ea78 | 2009-05-07 18:28:29 -0700 | [diff] [blame] | 3035 | return; |
| 3036 | } |
| 3037 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3038 | glVertexPointerBounds( |
| 3039 | (GLint)size, |
| 3040 | (GLenum)type, |
| 3041 | (GLsizei)stride, |
| 3042 | (GLvoid *)pointer, |
| 3043 | (GLsizei)remaining |
| 3044 | ); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3045 | } |
| 3046 | |
| 3047 | /* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */ |
| 3048 | static void |
| 3049 | android_glViewport__IIII |
| 3050 | (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) { |
| 3051 | glViewport( |
| 3052 | (GLint)x, |
| 3053 | (GLint)y, |
| 3054 | (GLsizei)width, |
| 3055 | (GLsizei)height |
| 3056 | ); |
| 3057 | } |
| 3058 | |
| 3059 | static const char *classPathName = "android/opengl/GLES10"; |
| 3060 | |
| 3061 | static JNINativeMethod methods[] = { |
| 3062 | {"_nativeClassInit", "()V", (void*)nativeClassInit }, |
| 3063 | {"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I }, |
| 3064 | {"glAlphaFunc", "(IF)V", (void *) android_glAlphaFunc__IF }, |
| 3065 | {"glAlphaFuncx", "(II)V", (void *) android_glAlphaFuncx__II }, |
| 3066 | {"glBindTexture", "(II)V", (void *) android_glBindTexture__II }, |
| 3067 | {"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II }, |
| 3068 | {"glClear", "(I)V", (void *) android_glClear__I }, |
| 3069 | {"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF }, |
| 3070 | {"glClearColorx", "(IIII)V", (void *) android_glClearColorx__IIII }, |
| 3071 | {"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F }, |
| 3072 | {"glClearDepthx", "(I)V", (void *) android_glClearDepthx__I }, |
| 3073 | {"glClearStencil", "(I)V", (void *) android_glClearStencil__I }, |
| 3074 | {"glClientActiveTexture", "(I)V", (void *) android_glClientActiveTexture__I }, |
| 3075 | {"glColor4f", "(FFFF)V", (void *) android_glColor4f__FFFF }, |
| 3076 | {"glColor4x", "(IIII)V", (void *) android_glColor4x__IIII }, |
| 3077 | {"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ }, |
| 3078 | {"glColorPointerBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glColorPointerBounds__IIILjava_nio_Buffer_2I }, |
| 3079 | {"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 }, |
| 3080 | {"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 }, |
| 3081 | {"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII }, |
| 3082 | {"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII }, |
| 3083 | {"glCullFace", "(I)V", (void *) android_glCullFace__I }, |
| 3084 | {"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II }, |
| 3085 | {"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 }, |
| 3086 | {"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I }, |
| 3087 | {"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z }, |
| 3088 | {"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF }, |
| 3089 | {"glDepthRangex", "(II)V", (void *) android_glDepthRangex__II }, |
| 3090 | {"glDisable", "(I)V", (void *) android_glDisable__I }, |
| 3091 | {"glDisableClientState", "(I)V", (void *) android_glDisableClientState__I }, |
| 3092 | {"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III }, |
| 3093 | {"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 }, |
| 3094 | {"glEnable", "(I)V", (void *) android_glEnable__I }, |
| 3095 | {"glEnableClientState", "(I)V", (void *) android_glEnableClientState__I }, |
| 3096 | {"glFinish", "()V", (void *) android_glFinish__ }, |
| 3097 | {"glFlush", "()V", (void *) android_glFlush__ }, |
| 3098 | {"glFogf", "(IF)V", (void *) android_glFogf__IF }, |
| 3099 | {"glFogfv", "(I[FI)V", (void *) android_glFogfv__I_3FI }, |
| 3100 | {"glFogfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glFogfv__ILjava_nio_FloatBuffer_2 }, |
| 3101 | {"glFogx", "(II)V", (void *) android_glFogx__II }, |
| 3102 | {"glFogxv", "(I[II)V", (void *) android_glFogxv__I_3II }, |
| 3103 | {"glFogxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glFogxv__ILjava_nio_IntBuffer_2 }, |
| 3104 | {"glFrontFace", "(I)V", (void *) android_glFrontFace__I }, |
| 3105 | {"glFrustumf", "(FFFFFF)V", (void *) android_glFrustumf__FFFFFF }, |
| 3106 | {"glFrustumx", "(IIIIII)V", (void *) android_glFrustumx__IIIIII }, |
| 3107 | {"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II }, |
| 3108 | {"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 }, |
| 3109 | {"glGetError", "()I", (void *) android_glGetError__ }, |
| 3110 | {"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II }, |
| 3111 | {"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 }, |
Jack Palevich | a379585 | 2009-04-24 10:35:11 -0700 | [diff] [blame] | 3112 | {"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString }, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3113 | {"glHint", "(II)V", (void *) android_glHint__II }, |
| 3114 | {"glLightModelf", "(IF)V", (void *) android_glLightModelf__IF }, |
| 3115 | {"glLightModelfv", "(I[FI)V", (void *) android_glLightModelfv__I_3FI }, |
| 3116 | {"glLightModelfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glLightModelfv__ILjava_nio_FloatBuffer_2 }, |
| 3117 | {"glLightModelx", "(II)V", (void *) android_glLightModelx__II }, |
| 3118 | {"glLightModelxv", "(I[II)V", (void *) android_glLightModelxv__I_3II }, |
| 3119 | {"glLightModelxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glLightModelxv__ILjava_nio_IntBuffer_2 }, |
| 3120 | {"glLightf", "(IIF)V", (void *) android_glLightf__IIF }, |
| 3121 | {"glLightfv", "(II[FI)V", (void *) android_glLightfv__II_3FI }, |
| 3122 | {"glLightfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glLightfv__IILjava_nio_FloatBuffer_2 }, |
| 3123 | {"glLightx", "(III)V", (void *) android_glLightx__III }, |
| 3124 | {"glLightxv", "(II[II)V", (void *) android_glLightxv__II_3II }, |
| 3125 | {"glLightxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glLightxv__IILjava_nio_IntBuffer_2 }, |
| 3126 | {"glLineWidth", "(F)V", (void *) android_glLineWidth__F }, |
| 3127 | {"glLineWidthx", "(I)V", (void *) android_glLineWidthx__I }, |
| 3128 | {"glLoadIdentity", "()V", (void *) android_glLoadIdentity__ }, |
| 3129 | {"glLoadMatrixf", "([FI)V", (void *) android_glLoadMatrixf___3FI }, |
| 3130 | {"glLoadMatrixf", "(Ljava/nio/FloatBuffer;)V", (void *) android_glLoadMatrixf__Ljava_nio_FloatBuffer_2 }, |
| 3131 | {"glLoadMatrixx", "([II)V", (void *) android_glLoadMatrixx___3II }, |
| 3132 | {"glLoadMatrixx", "(Ljava/nio/IntBuffer;)V", (void *) android_glLoadMatrixx__Ljava_nio_IntBuffer_2 }, |
| 3133 | {"glLogicOp", "(I)V", (void *) android_glLogicOp__I }, |
| 3134 | {"glMaterialf", "(IIF)V", (void *) android_glMaterialf__IIF }, |
| 3135 | {"glMaterialfv", "(II[FI)V", (void *) android_glMaterialfv__II_3FI }, |
| 3136 | {"glMaterialfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glMaterialfv__IILjava_nio_FloatBuffer_2 }, |
| 3137 | {"glMaterialx", "(III)V", (void *) android_glMaterialx__III }, |
| 3138 | {"glMaterialxv", "(II[II)V", (void *) android_glMaterialxv__II_3II }, |
| 3139 | {"glMaterialxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glMaterialxv__IILjava_nio_IntBuffer_2 }, |
| 3140 | {"glMatrixMode", "(I)V", (void *) android_glMatrixMode__I }, |
| 3141 | {"glMultMatrixf", "([FI)V", (void *) android_glMultMatrixf___3FI }, |
| 3142 | {"glMultMatrixf", "(Ljava/nio/FloatBuffer;)V", (void *) android_glMultMatrixf__Ljava_nio_FloatBuffer_2 }, |
| 3143 | {"glMultMatrixx", "([II)V", (void *) android_glMultMatrixx___3II }, |
| 3144 | {"glMultMatrixx", "(Ljava/nio/IntBuffer;)V", (void *) android_glMultMatrixx__Ljava_nio_IntBuffer_2 }, |
| 3145 | {"glMultiTexCoord4f", "(IFFFF)V", (void *) android_glMultiTexCoord4f__IFFFF }, |
| 3146 | {"glMultiTexCoord4x", "(IIIII)V", (void *) android_glMultiTexCoord4x__IIIII }, |
| 3147 | {"glNormal3f", "(FFF)V", (void *) android_glNormal3f__FFF }, |
| 3148 | {"glNormal3x", "(III)V", (void *) android_glNormal3x__III }, |
| 3149 | {"glNormalPointerBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glNormalPointerBounds__IILjava_nio_Buffer_2I }, |
| 3150 | {"glOrthof", "(FFFFFF)V", (void *) android_glOrthof__FFFFFF }, |
| 3151 | {"glOrthox", "(IIIIII)V", (void *) android_glOrthox__IIIIII }, |
| 3152 | {"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II }, |
| 3153 | {"glPointSize", "(F)V", (void *) android_glPointSize__F }, |
| 3154 | {"glPointSizex", "(I)V", (void *) android_glPointSizex__I }, |
| 3155 | {"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF }, |
| 3156 | {"glPolygonOffsetx", "(II)V", (void *) android_glPolygonOffsetx__II }, |
| 3157 | {"glPopMatrix", "()V", (void *) android_glPopMatrix__ }, |
| 3158 | {"glPushMatrix", "()V", (void *) android_glPushMatrix__ }, |
| 3159 | {"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 }, |
| 3160 | {"glRotatef", "(FFFF)V", (void *) android_glRotatef__FFFF }, |
| 3161 | {"glRotatex", "(IIII)V", (void *) android_glRotatex__IIII }, |
| 3162 | {"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ }, |
| 3163 | {"glSampleCoveragex", "(IZ)V", (void *) android_glSampleCoveragex__IZ }, |
| 3164 | {"glScalef", "(FFF)V", (void *) android_glScalef__FFF }, |
| 3165 | {"glScalex", "(III)V", (void *) android_glScalex__III }, |
| 3166 | {"glScissor", "(IIII)V", (void *) android_glScissor__IIII }, |
| 3167 | {"glShadeModel", "(I)V", (void *) android_glShadeModel__I }, |
| 3168 | {"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III }, |
| 3169 | {"glStencilMask", "(I)V", (void *) android_glStencilMask__I }, |
| 3170 | {"glStencilOp", "(III)V", (void *) android_glStencilOp__III }, |
| 3171 | {"glTexCoordPointerBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I }, |
| 3172 | {"glTexEnvf", "(IIF)V", (void *) android_glTexEnvf__IIF }, |
| 3173 | {"glTexEnvfv", "(II[FI)V", (void *) android_glTexEnvfv__II_3FI }, |
| 3174 | {"glTexEnvfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexEnvfv__IILjava_nio_FloatBuffer_2 }, |
| 3175 | {"glTexEnvx", "(III)V", (void *) android_glTexEnvx__III }, |
| 3176 | {"glTexEnvxv", "(II[II)V", (void *) android_glTexEnvxv__II_3II }, |
| 3177 | {"glTexEnvxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexEnvxv__IILjava_nio_IntBuffer_2 }, |
| 3178 | {"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 }, |
| 3179 | {"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF }, |
| 3180 | {"glTexParameterx", "(III)V", (void *) android_glTexParameterx__III }, |
| 3181 | {"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 }, |
| 3182 | {"glTranslatef", "(FFF)V", (void *) android_glTranslatef__FFF }, |
| 3183 | {"glTranslatex", "(III)V", (void *) android_glTranslatex__III }, |
| 3184 | {"glVertexPointerBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glVertexPointerBounds__IIILjava_nio_Buffer_2I }, |
| 3185 | {"glViewport", "(IIII)V", (void *) android_glViewport__IIII }, |
| 3186 | }; |
| 3187 | |
| 3188 | int register_android_opengl_jni_GLES10(JNIEnv *_env) |
| 3189 | { |
| 3190 | int err; |
| 3191 | err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods)); |
| 3192 | return err; |
| 3193 | } |