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