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