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