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