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