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