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