1560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/*
2560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich**
3560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich** Copyright 2009, The Android Open Source Project
4560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich**
524ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes** Licensed under the Apache License, Version 2.0 (the "License");
624ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes** you may not use this file except in compliance with the License.
724ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes** You may obtain a copy of the License at
8560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich**
924ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes**     http://www.apache.org/licenses/LICENSE-2.0
10560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich**
1124ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes** Unless required by applicable law or agreed to in writing, software
1224ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes** distributed under the License is distributed on an "AS IS" BASIS,
1324ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1424ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes** See the License for the specific language governing permissions and
15560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich** limitations under the License.
16560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich*/
17560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
18560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich// This source file is automatically generated
19560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
20bfe6333c3cf529600f41f14e3b8c5846e632c9a2Andreas Gampe#pragma GCC diagnostic ignored "-Wunused-variable"
21bfe6333c3cf529600f41f14e3b8c5846e632c9a2Andreas Gampe#pragma GCC diagnostic ignored "-Wunused-function"
22bfe6333c3cf529600f41f14e3b8c5846e632c9a2Andreas Gampe
232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#include <GLES2/gl2.h>
242ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#include <GLES2/gl2ext.h>
252ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
269626f8203a8c222b8960a49cdc66d540fdb688b0Jesse Hall#include <jni.h>
272279b2534272282a5b5152723235da397e49195cSteven Moreland#include <nativehelper/JNIHelp.h>
28560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich#include <android_runtime/AndroidRuntime.h>
29560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich#include <utils/misc.h>
30560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich#include <assert.h>
31560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
32560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic int initialized = 0;
33560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
34560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jclass nioAccessClass;
35560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jclass bufferClass;
36560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jmethodID getBasePointerID;
37560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jmethodID getBaseArrayID;
38560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jmethodID getBaseArrayOffsetID;
39560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jfieldID positionID;
40560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jfieldID limitID;
41560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jfieldID elementSizeShiftID;
42560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
432ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
442ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian/* special calls implemented in Android's GLES wrapper used to more
452ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian * efficiently bound-check passed arrays */
462ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianextern "C" {
472ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#ifdef GL_VERSION_ES_CM_1_1
482ad0477f16c64dc3126741933f11e27353521bb4Mathias AgopianGL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
492ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        const GLvoid *ptr, GLsizei count);
502ad0477f16c64dc3126741933f11e27353521bb4Mathias AgopianGL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
512ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        const GLvoid *pointer, GLsizei count);
522ad0477f16c64dc3126741933f11e27353521bb4Mathias AgopianGL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
532ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        GLsizei stride, const GLvoid *pointer, GLsizei count);
542ad0477f16c64dc3126741933f11e27353521bb4Mathias AgopianGL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
552ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        GLsizei stride, const GLvoid *pointer, GLsizei count);
562ad0477f16c64dc3126741933f11e27353521bb4Mathias AgopianGL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
572ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        GLsizei stride, const GLvoid *pointer, GLsizei count);
582ad0477f16c64dc3126741933f11e27353521bb4Mathias AgopianGL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        GLsizei stride, const GLvoid *pointer, GLsizei count);
602ad0477f16c64dc3126741933f11e27353521bb4Mathias AgopianGL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        GLsizei stride, const GLvoid *pointer, GLsizei count);
622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#endif
632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#ifdef GL_ES_VERSION_2_0
642ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianstatic void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type,
652ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) {
662ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    glVertexAttribPointer(indx, size, type, normalized, stride, pointer);
672ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian}
682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#endif
69cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden#ifdef GL_ES_VERSION_3_0
70cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFaddenstatic void glVertexAttribIPointerBounds(GLuint indx, GLint size, GLenum type,
71cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden        GLsizei stride, const GLvoid *pointer, GLsizei count) {
72cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    glVertexAttribIPointer(indx, size, type, stride, pointer);
73cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden}
74cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden#endif
752ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian}
762ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
77560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* Cache method IDs each time the class is loaded. */
78560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
79560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
8024ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott HughesnativeClassInit(JNIEnv *_env, jclass glImplClass)
81560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{
82560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
83560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
84560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
85560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
86560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
87560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
88560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
89560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            "getBasePointer", "(Ljava/nio/Buffer;)J");
90560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
91560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
92560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
93560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
94560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
95560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    positionID = _env->GetFieldID(bufferClass, "position", "I");
96560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    limitID = _env->GetFieldID(bufferClass, "limit", "I");
97560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    elementSizeShiftID =
98560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
99560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
100560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
101560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void *
10217045a16575ece34cfadb63da4791f115625df78Thomas TafertshofergetPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
103560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{
104560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint position;
105560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint limit;
106560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint elementSizeShift;
107560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jlong pointer;
108560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
109560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    position = _env->GetIntField(buffer, positionID);
110560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    limit = _env->GetIntField(buffer, limitID);
111560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
112560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    *remaining = (limit - position) << elementSizeShift;
113560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    pointer = _env->CallStaticLongMethod(nioAccessClass,
114560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            getBasePointerID, buffer);
115560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (pointer != 0L) {
116560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        *array = NULL;
11701c26ea89d4bbea3cf550e9328742302dd9a2b25Ashok Bhat        return reinterpret_cast<void*>(pointer);
118560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
11924ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes
120560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
121560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            getBaseArrayID, buffer);
12217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    *offset = _env->CallStaticIntMethod(nioAccessClass,
123560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            getBaseArrayOffsetID, buffer);
12424ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes
12517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    return NULL;
126560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
127560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1283b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass ByteArrayGetter {
1293b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1303b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
1313b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        return _env->GetByteArrayElements(array, is_copy);
1323b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
1333b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
1343b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass BooleanArrayGetter {
1353b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1363b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
1373b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        return _env->GetBooleanArrayElements(array, is_copy);
1383b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
1393b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
1403b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass CharArrayGetter {
1413b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1423b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
1433b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        return _env->GetCharArrayElements(array, is_copy);
1443b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
1453b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
1463b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass ShortArrayGetter {
1473b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1483b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
1493b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        return _env->GetShortArrayElements(array, is_copy);
1503b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
1513b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
1523b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass IntArrayGetter {
1533b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1543b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
1553b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        return _env->GetIntArrayElements(array, is_copy);
1563b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
1573b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
1583b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass LongArrayGetter {
1593b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1603b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
1613b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        return _env->GetLongArrayElements(array, is_copy);
1623b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
1633b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
1643b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass FloatArrayGetter {
1653b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1663b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
1673b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        return _env->GetFloatArrayElements(array, is_copy);
1683b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
1693b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
1703b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass DoubleArrayGetter {
1713b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1723b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
1733b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        return _env->GetDoubleArrayElements(array, is_copy);
1743b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
1753b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
1763b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi
1773b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchitemplate<typename JTYPEARRAY, typename ARRAYGETTER>
1783b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchistatic void*
1793b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi YamauchigetArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
1803b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    return ARRAYGETTER::Get(_env, array, is_copy);
1813b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi}
1823b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi
1833b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass ByteArrayReleaser {
1843b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1853b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
1863b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
1873b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
1883b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
1893b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass BooleanArrayReleaser {
1903b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1913b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
1923b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
1933b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
1943b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
1953b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass CharArrayReleaser {
1963b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1973b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
1983b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
1993b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
2003b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
2013b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass ShortArrayReleaser {
2023b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
2033b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
2043b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
2053b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
2063b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
2073b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass IntArrayReleaser {
2083b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
2093b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
2103b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
2113b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
2123b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
2133b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass LongArrayReleaser {
2143b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
2153b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
2163b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
2173b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
2183b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
2193b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass FloatArrayReleaser {
2203b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
2213b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
2223b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
2233b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
2243b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
2253b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass DoubleArrayReleaser {
2263b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
2273b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
2283b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
2293b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
2303b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
2313b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi
2323b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchitemplate<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
2333b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchistatic void
2343b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi YamauchireleaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
2353b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    ARRAYRELEASER::Release(_env, array, data, commit);
2363b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi}
2373b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi
238560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
239560814f6b11abe83ff0c4ed18cac015c276b3181Jack PalevichreleasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
240560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{
241560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _env->ReleasePrimitiveArrayCritical(array, data,
2422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian                       commit ? 0 : JNI_ABORT);
243560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
244560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
245560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void *
246560814f6b11abe83ff0c4ed18cac015c276b3181Jack PalevichgetDirectBufferPointer(JNIEnv *_env, jobject buffer) {
247560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    char* buf = (char*) _env->GetDirectBufferAddress(buffer);
248560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (buf) {
249560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        jint position = _env->GetIntField(buffer, positionID);
250560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
251560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        buf += position << elementSizeShift;
252560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    } else {
25324ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        jniThrowException(_env, "java/lang/IllegalArgumentException",
25424ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes                          "Must use a native order direct Buffer");
255560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
256560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    return (void*) buf;
257560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
258560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian// --------------------------------------------------------------------------
2602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
2612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian/*
2622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian * returns the number of values glGet returns for a given pname.
2632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian *
2642ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian * The code below is written such that pnames requiring only one values
2652ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian * are the default (and are not explicitely tested for). This makes the
2662ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian * checking code much shorter/readable/efficient.
2672ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian *
2682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian * This means that unknown pnames (e.g.: extensions) will default to 1. If
2692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian * that unknown pname needs more than 1 value, then the validation check
2702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian * is incomplete and the app may crash if it passed the wrong number params.
2712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian */
2722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianstatic int getNeededCount(GLint pname) {
2732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    int needed = 1;
274dc43a6c99c21e99723058bab4041e80557795a74Romain Guy#ifdef GL_ES_VERSION_3_0
275dc43a6c99c21e99723058bab4041e80557795a74Romain Guy    // GLES 3.x pnames
276dc43a6c99c21e99723058bab4041e80557795a74Romain Guy    switch (pname) {
277dc43a6c99c21e99723058bab4041e80557795a74Romain Guy        case GL_MAX_VIEWPORT_DIMS:
278dc43a6c99c21e99723058bab4041e80557795a74Romain Guy            needed = 2;
279dc43a6c99c21e99723058bab4041e80557795a74Romain Guy            break;
280dc43a6c99c21e99723058bab4041e80557795a74Romain Guy
281dc43a6c99c21e99723058bab4041e80557795a74Romain Guy        case GL_PROGRAM_BINARY_FORMATS:
282dc43a6c99c21e99723058bab4041e80557795a74Romain Guy            glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &needed);
283dc43a6c99c21e99723058bab4041e80557795a74Romain Guy            break;
284dc43a6c99c21e99723058bab4041e80557795a74Romain Guy    }
285dc43a6c99c21e99723058bab4041e80557795a74Romain Guy#endif
286dc43a6c99c21e99723058bab4041e80557795a74Romain Guy
2872ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#ifdef GL_ES_VERSION_2_0
2882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    // GLES 2.x pnames
2892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    switch (pname) {
2902ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_ALIASED_LINE_WIDTH_RANGE:
2912ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_ALIASED_POINT_SIZE_RANGE:
2922ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            needed = 2;
2932ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
2942ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
2952ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_BLEND_COLOR:
2962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_COLOR_CLEAR_VALUE:
2972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_COLOR_WRITEMASK:
2982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_SCISSOR_BOX:
2992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_VIEWPORT:
3002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            needed = 4;
3012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
3022ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
3032ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_COMPRESSED_TEXTURE_FORMATS:
3042ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
3052ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
3062ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
3072ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_SHADER_BINARY_FORMATS:
3082ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed);
3092ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
3102ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3112ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#endif
3122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
3132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#ifdef GL_VERSION_ES_CM_1_1
3142ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    // GLES 1.x pnames
3152ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    switch (pname) {
3162ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_ALIASED_LINE_WIDTH_RANGE:
3172ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_ALIASED_POINT_SIZE_RANGE:
3182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_DEPTH_RANGE:
3192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_SMOOTH_LINE_WIDTH_RANGE:
3202ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_SMOOTH_POINT_SIZE_RANGE:
3212ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            needed = 2;
3222ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
3232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
3242ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_CURRENT_NORMAL:
3252ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_POINT_DISTANCE_ATTENUATION:
3262ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            needed = 3;
3272ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
3282ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
3292ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_COLOR_CLEAR_VALUE:
3302ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_COLOR_WRITEMASK:
3312ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_CURRENT_COLOR:
3322ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_CURRENT_TEXTURE_COORDS:
3332ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_FOG_COLOR:
3342ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_LIGHT_MODEL_AMBIENT:
3352ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_SCISSOR_BOX:
3362ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_VIEWPORT:
3372ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            needed = 4;
3382ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
3392ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
3402ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_MODELVIEW_MATRIX:
3412ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_PROJECTION_MATRIX:
3422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_TEXTURE_MATRIX:
3432ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            needed = 16;
3442ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
3452ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
3462ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_COMPRESSED_TEXTURE_FORMATS:
3472ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
3482ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
3492ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3502ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#endif
3512ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    return needed;
352560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
353560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3543b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchitemplate <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
3553b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi          typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
3562ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianstatic void
3572ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianget
3582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian  (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
3592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
3602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType;
3612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage;
3622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    CTYPE *params_base = (CTYPE *) 0;
3632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _remaining;
3642ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    CTYPE *params = (CTYPE *) 0;
3652ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    int _needed = 0;
3662ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
3672ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (!params_ref) {
3682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
3692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
3702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "params == null";
3712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
3722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (offset < 0) {
3742ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
3752ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
3762ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "offset < 0";
3772ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
3782ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3792ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    _remaining = _env->GetArrayLength(params_ref) - offset;
3802ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    _needed = getNeededCount(pname);
3812ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    // if we didn't find this pname, we just assume the user passed
3822ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    // an array of the right size -- this might happen with extensions
3832ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    // or if we forget an enum here.
3842ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < _needed) {
3852ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
3862ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
3872ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < needed";
3882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
3892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3903b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
3913b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env, params_ref, (jboolean *)0);
3922ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    params = params_base + offset;
3932ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
3942ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    GET(
3952ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        (GLenum)pname,
3962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        (CTYPE *)params
3972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    );
3982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
3992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
4002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (params_base) {
4013b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
4023b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi            _env, params_ref, params_base, !_exception);
4032ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
4042ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
4052ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
4062ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
4072ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian}
4082ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
4092ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
4103b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchitemplate <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
4113b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi          typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
4122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianstatic void
4132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopiangetarray
4142ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
4152ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
4162ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType;
4172ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage;
4183b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    JTYPEARRAY _array = (JTYPEARRAY) 0;
4192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _bufferOffset = (jint) 0;
4202ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _remaining;
4212ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    CTYPE *params = (CTYPE *) 0;
4222ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    int _needed = 0;
4232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
4243b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
425cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    _remaining /= sizeof(CTYPE);    // convert from bytes to item count
4262ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    _needed = getNeededCount(pname);
4272ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    // if we didn't find this pname, we just assume the user passed
4282ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    // an array of the right size -- this might happen with extensions
4292ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    // or if we forget an enum here.
4302ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_needed>0 && _remaining < _needed) {
4312ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
4322ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
4332ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < needed";
4342ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
4352ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
4362ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (params == NULL) {
4373b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
4383b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi            _env, _array, (jboolean *) 0);
4392ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        params = (CTYPE *) (_paramsBase + _bufferOffset);
4402ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
4412ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    GET(
4422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        (GLenum)pname,
4432ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        (CTYPE *)params
4442ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    );
4452ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
4462ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
4472ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_array) {
4483b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
4493b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi            _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
4502ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
4512ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
4522ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
4532ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
454560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
455560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
456560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich// --------------------------------------------------------------------------
457560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glActiveTexture ( GLenum texture ) */
458560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
459560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glActiveTexture__I
460560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint texture) {
461560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glActiveTexture(
462560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)texture
463560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
464560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
465560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
466560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glAttachShader ( GLuint program, GLuint shader ) */
467560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
468560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glAttachShader__II
469560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint shader) {
470560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glAttachShader(
471560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
472560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader
473560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
474560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
475560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
476560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBindAttribLocation ( GLuint program, GLuint index, const char *name ) */
477560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
478560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBindAttribLocation__IILjava_lang_String_2
479560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint index, jstring name) {
4802545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
4812ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
4822ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
483560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    const char* _nativename = 0;
484560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
485560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!name) {
486428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes        _exception = 1;
4872545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
4882545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "name == null";
489560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
490560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
491560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _nativename = _env->GetStringUTFChars(name, 0);
492560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
493560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBindAttribLocation(
494560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
495560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
496560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (char *)_nativename
497560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
498560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
499560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
500560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_nativename) {
501560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleaseStringUTFChars(name, _nativename);
502560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
503560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5042545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
5052545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
5062545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
507560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
508560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
509560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBindBuffer ( GLenum target, GLuint buffer ) */
510560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
511560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBindBuffer__II
512560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint buffer) {
513560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBindBuffer(
514560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
515560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)buffer
516560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
517560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
518560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
519560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBindFramebuffer ( GLenum target, GLuint framebuffer ) */
520560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
521560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBindFramebuffer__II
522560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint framebuffer) {
523560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBindFramebuffer(
524560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
525560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)framebuffer
526560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
527560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
528560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
529560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBindRenderbuffer ( GLenum target, GLuint renderbuffer ) */
530560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
531560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBindRenderbuffer__II
532560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint renderbuffer) {
533560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBindRenderbuffer(
534560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
535560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)renderbuffer
536560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
537560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
538560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
539560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBindTexture ( GLenum target, GLuint texture ) */
540560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
541560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBindTexture__II
542560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint texture) {
543560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBindTexture(
544560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
545560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)texture
546560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
547560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
548560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
549560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBlendColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
550560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
551560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBlendColor__FFFF
552560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
553560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBlendColor(
554560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)red,
555560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)green,
556560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)blue,
557560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)alpha
558560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
559560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
560560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
561560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBlendEquation ( GLenum mode ) */
562560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
563560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBlendEquation__I
564560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint mode) {
56573108675c944ab4ee89631dced23566b12341b66Jack Palevich    glBlendEquation(
56673108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)mode
56773108675c944ab4ee89631dced23566b12341b66Jack Palevich    );
568560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
569560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
570560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBlendEquationSeparate ( GLenum modeRGB, GLenum modeAlpha ) */
571560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
572560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBlendEquationSeparate__II
573560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint modeRGB, jint modeAlpha) {
57473108675c944ab4ee89631dced23566b12341b66Jack Palevich    glBlendEquationSeparate(
57573108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)modeRGB,
57673108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)modeAlpha
57773108675c944ab4ee89631dced23566b12341b66Jack Palevich    );
578560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
579560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
580560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */
581560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
582560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBlendFunc__II
583560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) {
584560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBlendFunc(
585560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)sfactor,
586560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)dfactor
587560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
588560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
589560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
590560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBlendFuncSeparate ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) */
591560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
592560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBlendFuncSeparate__IIII
593560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) {
59473108675c944ab4ee89631dced23566b12341b66Jack Palevich    glBlendFuncSeparate(
59573108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)srcRGB,
59673108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)dstRGB,
59773108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)srcAlpha,
59873108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)dstAlpha
59973108675c944ab4ee89631dced23566b12341b66Jack Palevich    );
600560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
601560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
602560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */
603560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
604560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBufferData__IILjava_nio_Buffer_2I
605560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) {
6062545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
6072ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
6082ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
609560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
61017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
611560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
612560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *data = (GLvoid *) 0;
613560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
614560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (data_buf) {
6153b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
616560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        if (_remaining < size) {
6172545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer            _exception = 1;
6182545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer            _exceptionType = "java/lang/IllegalArgumentException";
6192545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer            _exceptionMessage = "remaining() < size < needed";
620560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            goto exit;
621560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        }
622560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
62337c9b49ab5eb5a676370fd7081db0967c38e97a6Thomas Tafertshofer    if (data_buf && data == NULL) {
62417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
62517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        data = (GLvoid *) (_dataBase + _bufferOffset);
62617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
627560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBufferData(
628560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
629560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizeiptr)size,
630560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)data,
631560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)usage
632560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
633560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
634560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
635560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
636560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, data, JNI_FALSE);
637560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
6382545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
6392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
6402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
641560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
642560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
643560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */
644560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
645560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBufferSubData__IIILjava_nio_Buffer_2
646560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) {
6472545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
6482ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
6492ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
650560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
65117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
652560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
653560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *data = (GLvoid *) 0;
654560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
65584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!data_buf) {
65684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
65784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
65884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "data == null";
65984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
66084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
6613b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
662560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < size) {
6632545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
6642545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
6652545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < size < needed";
666560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
667560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
66817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (data == NULL) {
66917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
67017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        data = (GLvoid *) (_dataBase + _bufferOffset);
67117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
672560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBufferSubData(
673560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
674560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLintptr)offset,
675560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizeiptr)size,
676560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)data
677560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
678560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
679560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
680560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
681560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, data, JNI_FALSE);
682560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
6832545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
6842545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
6852545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
686560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
687560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
688560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLenum glCheckFramebufferStatus ( GLenum target ) */
689560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jint
690560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCheckFramebufferStatus__I
691560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target) {
692560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum _returnValue;
693560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glCheckFramebufferStatus(
694560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target
695560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
696cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jint)_returnValue;
697560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
698560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
699560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glClear ( GLbitfield mask ) */
700560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
701560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glClear__I
702560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint mask) {
703560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glClear(
704560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLbitfield)mask
705560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
706560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
707560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
708560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
709560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
710560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glClearColor__FFFF
711560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
712560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glClearColor(
713560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)red,
714560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)green,
715560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)blue,
716560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)alpha
717560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
718560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
719560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
720560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glClearDepthf ( GLclampf depth ) */
721560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
722560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glClearDepthf__F
723560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jfloat depth) {
724560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glClearDepthf(
725560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)depth
726560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
727560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
728560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
729560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glClearStencil ( GLint s ) */
730560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
731560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glClearStencil__I
732560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint s) {
733560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glClearStencil(
734560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)s
735560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
736560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
737560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
738560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */
739560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
740560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glColorMask__ZZZZ
741560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) {
742560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glColorMask(
743560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)red,
744560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)green,
745560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)blue,
746560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)alpha
747560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
748560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
749560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
750560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glCompileShader ( GLuint shader ) */
751560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
752560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCompileShader__I
753560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shader) {
754560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glCompileShader(
755560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader
756560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
757560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
758560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
759560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */
760560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
761560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2
762560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) {
76384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    jint _exception = 0;
76484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    const char * _exceptionType = NULL;
76584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    const char * _exceptionMessage = NULL;
766560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
76717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
768560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
769560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *data = (GLvoid *) 0;
770560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
77184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!data_buf) {
77284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
77384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
77484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "data == null";
77584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
77684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
7773b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
77817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (data == NULL) {
77917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
78017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        data = (GLvoid *) (_dataBase + _bufferOffset);
78117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
782560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glCompressedTexImage2D(
783560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
784560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)level,
785560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)internalformat,
786560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
787560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height,
788560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)border,
789560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)imageSize,
790560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)data
791560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
79284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy
79384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guyexit:
794560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
795560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, data, JNI_FALSE);
796560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
79784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (_exception) {
79884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        jniThrowException(_env, _exceptionType, _exceptionMessage);
79984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
800560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
801560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
802560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */
803560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
804560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
805560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) {
80684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    jint _exception = 0;
80784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    const char * _exceptionType = NULL;
80884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    const char * _exceptionMessage = NULL;
809560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
81017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
811560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
812560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *data = (GLvoid *) 0;
813560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
81484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!data_buf) {
81584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
81684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
81784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "data == null";
81884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
81984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
8203b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
82117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (data == NULL) {
82217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
82317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        data = (GLvoid *) (_dataBase + _bufferOffset);
82417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
825560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glCompressedTexSubImage2D(
826560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
827560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)level,
828560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)xoffset,
829560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)yoffset,
830560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
831560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height,
832560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)format,
833560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)imageSize,
834560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)data
835560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
83684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy
83784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guyexit:
838560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
839560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, data, JNI_FALSE);
840560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
84184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (_exception) {
84284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        jniThrowException(_env, _exceptionType, _exceptionMessage);
84384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
844560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
845560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
846560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */
847560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
848560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCopyTexImage2D__IIIIIIII
849560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) {
850560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glCopyTexImage2D(
851560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
852560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)level,
853560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)internalformat,
854560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
855560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y,
856560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
857560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height,
858560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)border
859560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
860560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
861560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
862560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */
863560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
864560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCopyTexSubImage2D__IIIIIIII
865560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) {
866560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glCopyTexSubImage2D(
867560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
868560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)level,
869560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)xoffset,
870560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)yoffset,
871560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
872560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y,
873560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
874560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height
875560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
876560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
877560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
878560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLuint glCreateProgram ( void ) */
879560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jint
880560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCreateProgram__
881560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this) {
882560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint _returnValue;
883560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glCreateProgram();
884cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jint)_returnValue;
885560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
886560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
887560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLuint glCreateShader ( GLenum type ) */
888560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jint
889560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCreateShader__I
890560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint type) {
891560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint _returnValue;
892560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glCreateShader(
893560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)type
894560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
895cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jint)_returnValue;
896560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
897560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
898560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glCullFace ( GLenum mode ) */
899560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
900560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCullFace__I
901560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint mode) {
902560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glCullFace(
903560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)mode
904560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
905560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
906560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
907560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
908560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
909560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteBuffers__I_3II
910560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
9112545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
9122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
9132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
914560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *buffers_base = (GLuint *) 0;
915560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
916560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *buffers = (GLuint *) 0;
917560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
918560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!buffers_ref) {
9192545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
9202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
9212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "buffers == null";
922560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
923560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
924560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
9252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
9262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
9272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
928560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
929560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
930560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(buffers_ref) - offset;
931560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
9322545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
9332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
9342545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < n < needed";
935560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
936560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
937560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    buffers_base = (GLuint *)
9383b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
939560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    buffers = buffers_base + offset;
940560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
941560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteBuffers(
942560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
943560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)buffers
944560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
945560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
946560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
947560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (buffers_base) {
9483b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
949560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
950560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
9512545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
9522545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
9532545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
954560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
955560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
956560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
957560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
958560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteBuffers__ILjava_nio_IntBuffer_2
959560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
9602545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
9612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
9622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
9633b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
96417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
965560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
966560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *buffers = (GLuint *) 0;
967560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
96884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!buffers_buf) {
96984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
97084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
97184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "buffers == null";
97284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
97384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
9743b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
975560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
9762545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
9772545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
9782545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < n < needed";
979560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
980560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
98117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (buffers == NULL) {
9823b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
98317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        buffers = (GLuint *) (_buffersBase + _bufferOffset);
98417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
985560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteBuffers(
986560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
987560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)buffers
988560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
989560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
990560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
991560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
9923b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)buffers, JNI_ABORT);
993560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
9942545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
9952545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
9962545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
997560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
998560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
999560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */
1000560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1001560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteFramebuffers__I_3II
1002560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
10032545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
10042ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
10052ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
1006560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *framebuffers_base = (GLuint *) 0;
1007560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1008560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *framebuffers = (GLuint *) 0;
1009560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1010560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!framebuffers_ref) {
10112545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
10122545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
10132545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "framebuffers == null";
1014560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1015560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1016560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
10172545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
10182545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
10192545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
1020560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1021560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1022560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
10232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < n) {
10242ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
10252ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
10262ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < n < needed";
10272ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
10282ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
1029560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    framebuffers_base = (GLuint *)
10303b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0);
1031560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    framebuffers = framebuffers_base + offset;
1032560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1033560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteFramebuffers(
1034560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1035560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)framebuffers
1036560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1037560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1038560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1039560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (framebuffers_base) {
10403b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base,
1041560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
1042560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
10432545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
10442545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
10452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1046560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1047560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1048560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */
1049560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1050560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteFramebuffers__ILjava_nio_IntBuffer_2
1051560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
10522ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
10532ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
10542ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
10553b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
105617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1057560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1058560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *framebuffers = (GLuint *) 0;
1059560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
106084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!framebuffers_buf) {
106184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
106284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
106384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "framebuffers == null";
106484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
106584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
10663b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
10672ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < n) {
10682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
10692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
10702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < n < needed";
10712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
10722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
107317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (framebuffers == NULL) {
10743b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
107517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
107617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1077560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteFramebuffers(
1078560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1079560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)framebuffers
1080560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
10812ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
10822ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
1083560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
10843b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, JNI_ABORT);
1085560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
10862ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
10872ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
10882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
1089560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1090560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1091560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteProgram ( GLuint program ) */
1092560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1093560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteProgram__I
1094560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program) {
1095560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteProgram(
1096560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program
1097560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1098560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1099560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1100560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */
1101560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1102560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteRenderbuffers__I_3II
1103560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
11042545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
11052ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
11062ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
1107560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *renderbuffers_base = (GLuint *) 0;
1108560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1109560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *renderbuffers = (GLuint *) 0;
1110560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1111560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!renderbuffers_ref) {
11122545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
11132545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
11142545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "renderbuffers == null";
1115560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1116560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1117560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
11182545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
11192545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
11202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
1121560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1122560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1123560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
11242ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < n) {
11252ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
11262ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
11272ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < n < needed";
11282ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
11292ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
1130560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    renderbuffers_base = (GLuint *)
11313b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0);
1132560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    renderbuffers = renderbuffers_base + offset;
1133560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1134560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteRenderbuffers(
1135560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1136560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)renderbuffers
1137560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1138560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1139560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1140560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (renderbuffers_base) {
11413b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base,
1142560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
1143560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
11442545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
11452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
11462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1147560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1148560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1149560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */
1150560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1151560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2
1152560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
11532ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
11542ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
11552ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
11563b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
115717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1158560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1159560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *renderbuffers = (GLuint *) 0;
1160560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
116184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!renderbuffers_buf) {
116284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
116384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
116484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "renderbuffers == null";
116584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
116684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
11673b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
11682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < n) {
11692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
11702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
11712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < n < needed";
11722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
11732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
117417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (renderbuffers == NULL) {
11753b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
117617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
117717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1178560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteRenderbuffers(
1179560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1180560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)renderbuffers
1181560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
11822ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
11832ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
1184560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
11853b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, JNI_ABORT);
1186560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
11872ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
11882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
11892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
1190560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1191560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1192560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteShader ( GLuint shader ) */
1193560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1194560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteShader__I
1195560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shader) {
1196560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteShader(
1197560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader
1198560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1199560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1200560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1201560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
1202560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1203560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteTextures__I_3II
1204560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
12052545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
12062ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
12072ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
1208560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *textures_base = (GLuint *) 0;
1209560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1210560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *textures = (GLuint *) 0;
1211560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1212560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!textures_ref) {
12132545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
12142545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
12152545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "textures == null";
1216560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1217560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1218560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
12192545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
12202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
12212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
1222560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1223560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1224560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(textures_ref) - offset;
1225560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
12262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
12272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
12282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < n < needed";
1229560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1230560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1231560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    textures_base = (GLuint *)
12323b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(textures_ref, (jboolean *)0);
1233560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    textures = textures_base + offset;
1234560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1235560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteTextures(
1236560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1237560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)textures
1238560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1239560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1240560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1241560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (textures_base) {
12423b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base,
1243560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
1244560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
12452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
12462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
12472545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1248560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1249560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1250560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
1251560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1252560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteTextures__ILjava_nio_IntBuffer_2
1253560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
12542545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
12552ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
12562ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
12573b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
125817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1259560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1260560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *textures = (GLuint *) 0;
1261560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
126284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!textures_buf) {
126384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
126484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
126584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "textures == null";
126684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
126784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
12683b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1269560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
12702545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
12712545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
12722545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < n < needed";
1273560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1274560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
127517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (textures == NULL) {
12763b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
127717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        textures = (GLuint *) (_texturesBase + _bufferOffset);
127817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1279560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteTextures(
1280560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1281560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)textures
1282560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1283560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1284560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1285560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
12863b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)textures, JNI_ABORT);
1287560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
12882545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
12892545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
12902545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1291560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1292560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1293560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDepthFunc ( GLenum func ) */
1294560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1295560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDepthFunc__I
1296560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint func) {
1297560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDepthFunc(
1298560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)func
1299560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1300560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1301560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1302560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDepthMask ( GLboolean flag ) */
1303560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1304560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDepthMask__Z
1305560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jboolean flag) {
1306560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDepthMask(
1307560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)flag
1308560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1309560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1310560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1311560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */
1312560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1313560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDepthRangef__FF
1314560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) {
1315560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDepthRangef(
1316560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)zNear,
1317560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)zFar
1318560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1319560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1320560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1321560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDetachShader ( GLuint program, GLuint shader ) */
1322560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1323560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDetachShader__II
1324560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint shader) {
1325560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDetachShader(
1326560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
1327560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader
1328560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1329560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1330560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1331560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDisable ( GLenum cap ) */
1332560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1333560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDisable__I
1334560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint cap) {
1335560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDisable(
1336560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)cap
1337560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1338560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1339560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1340560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDisableVertexAttribArray ( GLuint index ) */
1341560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1342560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDisableVertexAttribArray__I
1343560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint index) {
1344560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDisableVertexAttribArray(
1345560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index
1346560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1347560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1348560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1349560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */
1350560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1351560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDrawArrays__III
1352560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) {
1353560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDrawArrays(
1354560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)mode,
1355560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)first,
1356560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count
1357560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1358560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1359560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1360224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */
1361224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevichstatic void
1362224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevichandroid_glDrawElements__IIII
1363224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich  (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) {
13642545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
13652ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
13662ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
1367224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich    glDrawElements(
1368224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLenum)mode,
1369224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLsizei)count,
1370224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLenum)type,
137101c26ea89d4bbea3cf550e9328742302dd9a2b25Ashok Bhat        reinterpret_cast<GLvoid *>(offset)
1372224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich    );
13732545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
13742545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
13752545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1376224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich}
1377224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich
1378560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */
1379560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1380560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDrawElements__IIILjava_nio_Buffer_2
1381560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) {
13822545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
13832ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
13842ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
1385560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
138617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1387560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1388560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *indices = (GLvoid *) 0;
1389560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
139084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!indices_buf) {
139184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
139284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
139384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "indices == null";
139484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
139584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
13963b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    indices = (GLvoid *)getPointer(_env, indices_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1397560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < count) {
13982545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
13992545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
14002545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < count < needed";
1401560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1402560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
140317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (indices == NULL) {
140417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
140517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        indices = (GLvoid *) (_indicesBase + _bufferOffset);
140617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1407560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDrawElements(
1408560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)mode,
1409560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
1410560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)type,
1411560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)indices
1412560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1413560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1414560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1415560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
1416560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, indices, JNI_FALSE);
1417560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
14182545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
14192545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
14202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1421560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1422560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1423560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glEnable ( GLenum cap ) */
1424560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1425560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glEnable__I
1426560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint cap) {
1427560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glEnable(
1428560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)cap
1429560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1430560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1431560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1432560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glEnableVertexAttribArray ( GLuint index ) */
1433560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1434560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glEnableVertexAttribArray__I
1435560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint index) {
1436560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glEnableVertexAttribArray(
1437560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index
1438560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1439560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1440560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1441560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glFinish ( void ) */
1442560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1443560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glFinish__
1444560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this) {
1445560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glFinish();
1446560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1447560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1448560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glFlush ( void ) */
1449560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1450560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glFlush__
1451560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this) {
1452560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glFlush();
1453560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1454560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1455560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glFramebufferRenderbuffer ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) */
1456560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1457560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glFramebufferRenderbuffer__IIII
1458560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint renderbuffertarget, jint renderbuffer) {
1459560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glFramebufferRenderbuffer(
1460560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
1461560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)attachment,
1462560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)renderbuffertarget,
1463560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)renderbuffer
1464560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1465560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1466560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1467560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glFramebufferTexture2D ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) */
1468560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1469560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glFramebufferTexture2D__IIIII
1470560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint textarget, jint texture, jint level) {
1471560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glFramebufferTexture2D(
1472560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
1473560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)attachment,
1474560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)textarget,
1475560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)texture,
1476560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)level
1477560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1478560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1479560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1480560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glFrontFace ( GLenum mode ) */
1481560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1482560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glFrontFace__I
1483560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint mode) {
1484560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glFrontFace(
1485560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)mode
1486560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1487560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1488560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1489560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
1490560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1491560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenBuffers__I_3II
1492560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
1493560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
14942ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
14952ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
1496560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *buffers_base = (GLuint *) 0;
1497560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1498560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *buffers = (GLuint *) 0;
1499560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1500560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!buffers_ref) {
1501560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
15022545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
15032545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "buffers == null";
1504560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1505560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1506560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
1507560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
15082545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
15092545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
1510560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1511560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1512560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(buffers_ref) - offset;
1513560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
1514560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
15152545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
15162545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < n < needed";
1517560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1518560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1519560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    buffers_base = (GLuint *)
15203b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
1521560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    buffers = buffers_base + offset;
1522560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1523560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenBuffers(
1524560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1525560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)buffers
1526560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1527560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1528560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1529560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (buffers_base) {
15303b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
1531560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1532560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
15332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
15342545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
15352545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1536560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1537560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1538560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
1539560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1540560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenBuffers__ILjava_nio_IntBuffer_2
1541560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
1542560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
15432ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
15442ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
15453b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
154617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1547560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1548560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *buffers = (GLuint *) 0;
1549560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
155084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!buffers_buf) {
155184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
155284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
155384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "buffers == null";
155484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
155584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
15563b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1557560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
1558560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
15592545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
15602545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < n < needed";
1561560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1562560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
156317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (buffers == NULL) {
15643b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
156517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        buffers = (GLuint *) (_buffersBase + _bufferOffset);
156617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1567560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenBuffers(
1568560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1569560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)buffers
1570560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1571560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1572560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1573560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
15743b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)buffers, _exception ? JNI_ABORT : 0);
1575560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
15762545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
15772545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
15782545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1579560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1580560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1581560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenerateMipmap ( GLenum target ) */
1582560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1583560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenerateMipmap__I
1584560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target) {
1585560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenerateMipmap(
1586560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target
1587560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1588560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1589560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1590560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */
1591560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1592560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenFramebuffers__I_3II
1593560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
1594560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
15952ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
15962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
1597560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *framebuffers_base = (GLuint *) 0;
1598560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1599560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *framebuffers = (GLuint *) 0;
1600560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1601560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!framebuffers_ref) {
1602560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
16032545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
16042545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "framebuffers == null";
1605560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1606560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1607560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
1608560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
16092545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
16102545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
1611560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1612560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1613560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
16142ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < n) {
16152ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
16162ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
16172ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < n < needed";
16182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
16192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
1620560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    framebuffers_base = (GLuint *)
16213b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0);
1622560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    framebuffers = framebuffers_base + offset;
1623560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1624560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenFramebuffers(
1625560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1626560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)framebuffers
1627560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1628560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1629560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1630560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (framebuffers_base) {
16313b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base,
1632560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1633560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
16342545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
16352545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
16362545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1637560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1638560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1639560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */
1640560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1641560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenFramebuffers__ILjava_nio_IntBuffer_2
1642560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
16432ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
16442ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
16452ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
16463b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
164717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1648560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1649560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *framebuffers = (GLuint *) 0;
1650560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
165184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!framebuffers_buf) {
165284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
165384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
165484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "framebuffers == null";
165584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
165684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
16573b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
16582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < n) {
16592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
16602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
16612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < n < needed";
16622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
16632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
166417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (framebuffers == NULL) {
16653b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
166617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
166717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1668560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenFramebuffers(
1669560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1670560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)framebuffers
1671560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
16722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
16732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
1674560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
16753b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, _exception ? JNI_ABORT : 0);
16762ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
16772ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
16782ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
1679560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1680560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1681560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1682560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */
1683560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1684560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenRenderbuffers__I_3II
1685560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
1686560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
16872ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
16882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
1689560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *renderbuffers_base = (GLuint *) 0;
1690560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1691560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *renderbuffers = (GLuint *) 0;
1692560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1693560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!renderbuffers_ref) {
1694560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
16952545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
16962545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "renderbuffers == null";
1697560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1698560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1699560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
1700560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
17012545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
17022545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
1703560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1704560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1705560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
17062ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < n) {
17072ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
17082ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
17092ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < n < needed";
17102ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
17112ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
1712560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    renderbuffers_base = (GLuint *)
17133b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0);
1714560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    renderbuffers = renderbuffers_base + offset;
1715560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1716560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenRenderbuffers(
1717560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1718560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)renderbuffers
1719560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1720560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1721560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1722560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (renderbuffers_base) {
17233b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base,
1724560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1725560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
17262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
17272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
17282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1729560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1730560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1731560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */
1732560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1733560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenRenderbuffers__ILjava_nio_IntBuffer_2
1734560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
17352ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
17362ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
17372ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
17383b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
173917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1740560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1741560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *renderbuffers = (GLuint *) 0;
1742560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
174384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!renderbuffers_buf) {
174484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
174584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
174684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "renderbuffers == null";
174784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
174884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
17493b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
17502ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < n) {
17512ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
17522ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
17532ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < n < needed";
17542ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
17552ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
175617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (renderbuffers == NULL) {
17573b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
175817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
175917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1760560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenRenderbuffers(
1761560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1762560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)renderbuffers
1763560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
17642ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
17652ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
1766560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
17673b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, _exception ? JNI_ABORT : 0);
17682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
17692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
17702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
1771560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1772560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1773560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1774560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1775560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1776560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenTextures__I_3II
1777560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
1778560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
17792ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
17802ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
1781560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *textures_base = (GLuint *) 0;
1782560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1783560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *textures = (GLuint *) 0;
1784560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1785560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!textures_ref) {
1786560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
17872545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
17882545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "textures == null";
1789560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1790560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1791560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
1792560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
17932545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
17942545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
1795560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1796560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1797560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(textures_ref) - offset;
1798560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
1799560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
18002545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
18012545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < n < needed";
1802560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1803560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1804560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    textures_base = (GLuint *)
18053b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(textures_ref, (jboolean *)0);
1806560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    textures = textures_base + offset;
1807560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1808560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenTextures(
1809560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1810560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)textures
1811560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1812560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1813560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1814560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (textures_base) {
18153b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base,
1816560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1817560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
18182545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
18192545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
18202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1821560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1822560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1823560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1824560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1825560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenTextures__ILjava_nio_IntBuffer_2
1826560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
1827560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
18282ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
18292ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
18303b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
183117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1832560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1833560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *textures = (GLuint *) 0;
1834560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
183584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!textures_buf) {
183684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
183784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
183884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "textures == null";
183984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
184084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
18413b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1842560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
1843560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
18442545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
18452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < n < needed";
1846560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1847560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
184817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (textures == NULL) {
18493b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
185017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        textures = (GLuint *) (_texturesBase + _bufferOffset);
185117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1852560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenTextures(
1853560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1854560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)textures
1855560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1856560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1857560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1858560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
18593b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)textures, _exception ? JNI_ABORT : 0);
1860560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
18612545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
18622545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
18632545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1864560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1865560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1866560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1867560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1868560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetActiveAttrib__III_3II_3II_3II_3BI
1869560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jintArray length_ref, jint lengthOffset, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset, jbyteArray name_ref, jint nameOffset) {
1870560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
18712545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    const char * _exceptionType;
18722545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    const char * _exceptionMessage;
1873560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length_base = (GLsizei *) 0;
1874560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _lengthRemaining;
1875560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length = (GLsizei *) 0;
1876560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *size_base = (GLint *) 0;
1877560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _sizeRemaining;
1878560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *size = (GLint *) 0;
1879560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum *type_base = (GLenum *) 0;
1880560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _typeRemaining;
1881560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum *type = (GLenum *) 0;
1882560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    char *name_base = (char *) 0;
1883560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _nameRemaining;
1884560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    char *name = (char *) 0;
1885560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
18866aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos    if (length_ref) {
18876aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        if (lengthOffset < 0) {
18886aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            _exception = 1;
18896aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            _exceptionType = "java/lang/IllegalArgumentException";
18906aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            _exceptionMessage = "lengthOffset < 0";
18916aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            goto exit;
18926aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        }
18936aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
18946aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        length_base = (GLsizei *)
18956aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            _env->GetIntArrayElements(length_ref, (jboolean *)0);
18966aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        length = length_base + lengthOffset;
1897560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1898560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1899560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!size_ref) {
1900560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
19012545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
19022545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "size == null";
1903560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1904560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1905560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (sizeOffset < 0) {
1906560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
19072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
19082545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "sizeOffset < 0";
1909560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1910560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1911560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
1912560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    size_base = (GLint *)
19133b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(size_ref, (jboolean *)0);
1914560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    size = size_base + sizeOffset;
1915560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1916560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!type_ref) {
1917560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
19182545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
19192545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "type == null";
1920560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1921560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1922560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (typeOffset < 0) {
1923560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
19242545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
19252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "typeOffset < 0";
1926560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1927560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1928560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
1929560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    type_base = (GLenum *)
19303b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(type_ref, (jboolean *)0);
1931560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    type = type_base + typeOffset;
1932560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1933560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!name_ref) {
1934560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
19352545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
19362545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "name == null";
1937560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1938560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1939560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (nameOffset < 0) {
1940560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
19412545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
19422545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "nameOffset < 0";
1943560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1944560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1945560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
1946560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    name_base = (char *)
19473b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetByteArrayElements(name_ref, (jboolean *)0);
1948560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    name = name_base + nameOffset;
1949560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1950560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetActiveAttrib(
1951560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
1952560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
1953560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)bufsize,
1954560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)length,
1955560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)size,
1956560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum *)type,
1957560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (char *)name
1958560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1959560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1960560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1961560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (name_base) {
19623b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
1963560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1964560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1965560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (type_base) {
19663b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
1967560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1968560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1969560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (size_base) {
19703b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
1971560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1972560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1973560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (length_base) {
19743b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
1975560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1976560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
19772545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
19782545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
19792545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1980560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1981560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1982560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1983560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1984560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
1985560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
19863b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _lengthArray = (jintArray) 0;
198717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _lengthBufferOffset = (jint) 0;
19883b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _sizeArray = (jintArray) 0;
198917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _sizeBufferOffset = (jint) 0;
19903b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _typeArray = (jintArray) 0;
199117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _typeBufferOffset = (jint) 0;
1992560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _lengthRemaining;
1993560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length = (GLsizei *) 0;
1994560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _sizeRemaining;
1995560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *size = (GLint *) 0;
1996560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _typeRemaining;
1997560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum *type = (GLenum *) 0;
1998560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
19993b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
20003b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
20013b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
200217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (length == NULL) {
20033b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
200417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
200517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
200617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (size == NULL) {
20073b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
200817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        size = (GLint *) (_sizeBase + _sizeBufferOffset);
200917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
201017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (type == NULL) {
20113b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
201217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        type = (GLenum *) (_typeBase + _typeBufferOffset);
201317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
2014560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetActiveAttrib(
2015560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
2016560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
2017560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)bufsize,
2018560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)length,
2019560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)size,
2020560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum *)type,
202101c26ea89d4bbea3cf550e9328742302dd9a2b25Ashok Bhat        reinterpret_cast<char *>(name)
2022560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
202317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (_typeArray) {
20243b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
2025560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2026560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_sizeArray) {
20273b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
2028560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
202917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (_lengthArray) {
20303b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
2031560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2032560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2033560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2034dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2035dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferstatic jstring
2036dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferandroid_glGetActiveAttrib1
2037dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer  (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
2038dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _exception = 0;
2039dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    const char * _exceptionType;
2040dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    const char * _exceptionMessage;
2041dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint *size_base = (GLint *) 0;
2042dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _sizeRemaining;
2043dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint *size = (GLint *) 0;
2044dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLenum *type_base = (GLenum *) 0;
2045dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _typeRemaining;
2046dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLenum *type = (GLenum *) 0;
2047dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2048dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jstring result = 0;
2049dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2050dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint len = 0;
2051dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
2052dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!len) {
2053dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return _env->NewStringUTF("");
2054dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2055dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    char* buf = (char*) malloc(len);
2056dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2057dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf == NULL) {
2058dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2059dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return NULL;
2060dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2061dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!size_ref) {
2062dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
2063dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
2064dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "size == null";
2065dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
2066dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2067dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (sizeOffset < 0) {
2068dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
2069dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
2070dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "sizeOffset < 0";
2071dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
2072dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2073dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2074dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    size_base = (GLint *)
20753b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(size_ref, (jboolean *)0);
2076dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    size = size_base + sizeOffset;
2077dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2078dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!type_ref) {
2079dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
2080dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
2081dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "type == null";
2082dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
2083dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2084dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (typeOffset < 0) {
2085dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
2086dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
2087dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "typeOffset < 0";
2088dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
2089dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2090dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2091dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    type_base = (GLenum *)
20923b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(type_ref, (jboolean *)0);
2093dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    type = type_base + typeOffset;
2094dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2095dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetActiveAttrib(
2096dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)program,
2097dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)index,
2098dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLsizei)len,
2099dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        NULL,
2100dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLint *)size,
2101dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLenum *)type,
2102dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (char *)buf
2103dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    );
2104dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferexit:
2105dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (type_base) {
21063b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
2107dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer            _exception ? JNI_ABORT: 0);
2108dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2109dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (size_base) {
21103b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
2111dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer            _exception ? JNI_ABORT: 0);
2112dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2113dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_exception != 1) {
2114dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        result = _env->NewStringUTF(buf);
2115dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2116dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf) {
2117dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        free(buf);
2118dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2119dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_exception) {
2120dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
2121dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2122dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (result == 0) {
2123dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        result = _env->NewStringUTF("");
2124dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2125dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2126dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    return result;
2127dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer}
2128dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2129dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2130dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferstatic jstring
2131dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferandroid_glGetActiveAttrib2
2132dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer  (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
21333b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _sizeArray = (jintArray) 0;
2134dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _sizeBufferOffset = (jint) 0;
21353b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _typeArray = (jintArray) 0;
2136dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _typeBufferOffset = (jint) 0;
2137dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _lengthRemaining;
2138dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLsizei *length = (GLsizei *) 0;
2139dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _sizeRemaining;
2140dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint *size = (GLint *) 0;
2141dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _typeRemaining;
2142dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLenum *type = (GLenum *) 0;
2143dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2144dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jstring result = 0;
2145dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2146dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint len = 0;
2147dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
2148dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!len) {
2149dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return _env->NewStringUTF("");
2150dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2151dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    char* buf = (char*) malloc(len);
2152dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2153dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf == NULL) {
2154dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2155dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return NULL;
2156dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2157dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
21583b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
21593b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
2160dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (size == NULL) {
21613b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
2162dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        size = (GLint *) (_sizeBase + _sizeBufferOffset);
2163dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2164dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (type == NULL) {
21653b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
2166dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        type = (GLenum *) (_typeBase + _typeBufferOffset);
2167dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2168dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetActiveAttrib(
2169dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)program,
2170dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)index,
2171dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLsizei)len,
2172dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        NULL,
2173dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLint *)size,
2174dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLenum *)type,
2175dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (char *)buf
2176dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    );
2177dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2178dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_typeArray) {
21793b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
2180dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2181dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_sizeArray) {
21823b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
2183dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2184dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    result = _env->NewStringUTF(buf);
2185dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf) {
2186dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        free(buf);
2187dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2188dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    return result;
2189dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer}
2190560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2191560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2192560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetActiveUniform__III_3II_3II_3II_3BI
2193560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jintArray length_ref, jint lengthOffset, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset, jbyteArray name_ref, jint nameOffset) {
2194560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
21952545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    const char * _exceptionType;
21962545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    const char * _exceptionMessage;
2197560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length_base = (GLsizei *) 0;
2198560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _lengthRemaining;
2199560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length = (GLsizei *) 0;
2200560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *size_base = (GLint *) 0;
2201560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _sizeRemaining;
2202560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *size = (GLint *) 0;
2203560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum *type_base = (GLenum *) 0;
2204560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _typeRemaining;
2205560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum *type = (GLenum *) 0;
2206560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    char *name_base = (char *) 0;
2207560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _nameRemaining;
2208560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    char *name = (char *) 0;
2209560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
22106aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos    if (length_ref) {
22116aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        if (lengthOffset < 0) {
22126aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            _exception = 1;
22136aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            _exceptionType = "java/lang/IllegalArgumentException";
22146aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            _exceptionMessage = "lengthOffset < 0";
22156aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            goto exit;
22166aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        }
22176aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
22186aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        length_base = (GLsizei *)
22196aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            _env->GetIntArrayElements(length_ref, (jboolean *)0);
22206aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        length = length_base + lengthOffset;
2221560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2222560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2223560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!size_ref) {
2224560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
22252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
22262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "size == null";
2227560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2228560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2229560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (sizeOffset < 0) {
2230560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
22312545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
22322545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "sizeOffset < 0";
2233560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2234560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2235560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2236560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    size_base = (GLint *)
22373b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(size_ref, (jboolean *)0);
2238560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    size = size_base + sizeOffset;
2239560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2240560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!type_ref) {
2241560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
22422545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
22432545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "type == null";
2244560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2245560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2246560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (typeOffset < 0) {
2247560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
22482545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
22492545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "typeOffset < 0";
2250560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2251560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2252560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2253560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    type_base = (GLenum *)
22543b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(type_ref, (jboolean *)0);
2255560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    type = type_base + typeOffset;
2256560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2257560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!name_ref) {
2258560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
22592545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
22602545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "name == null";
2261560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2262560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2263560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (nameOffset < 0) {
2264560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
22652545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
22662545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "nameOffset < 0";
2267560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2268560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2269560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
2270560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    name_base = (char *)
22713b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetByteArrayElements(name_ref, (jboolean *)0);
2272560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    name = name_base + nameOffset;
2273560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2274560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetActiveUniform(
2275560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
2276560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
2277560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)bufsize,
2278560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)length,
2279560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)size,
2280560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum *)type,
2281560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (char *)name
2282560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
2283560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2284560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
2285560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (name_base) {
22863b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
2287560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2288560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2289560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (type_base) {
22903b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
2291560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2292560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2293560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (size_base) {
22943b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
2295560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2296560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2297560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (length_base) {
22983b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
2299560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2300560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
23012545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
23022545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
23032545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2304560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2305560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2306560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2307560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2308560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
2309560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
23103b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _lengthArray = (jintArray) 0;
231117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _lengthBufferOffset = (jint) 0;
23123b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _sizeArray = (jintArray) 0;
231317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _sizeBufferOffset = (jint) 0;
23143b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _typeArray = (jintArray) 0;
231517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _typeBufferOffset = (jint) 0;
2316560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _lengthRemaining;
2317560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length = (GLsizei *) 0;
2318560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _sizeRemaining;
2319560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *size = (GLint *) 0;
2320560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _typeRemaining;
2321560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum *type = (GLenum *) 0;
2322560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
23233b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
23243b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
23253b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
232617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (length == NULL) {
23273b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
232817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
232917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
233017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (size == NULL) {
23313b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
233217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        size = (GLint *) (_sizeBase + _sizeBufferOffset);
233317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
233417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (type == NULL) {
23353b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
233617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        type = (GLenum *) (_typeBase + _typeBufferOffset);
233717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
2338560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetActiveUniform(
2339560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
2340560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
2341560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)bufsize,
2342560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)length,
2343560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)size,
2344560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum *)type,
234501c26ea89d4bbea3cf550e9328742302dd9a2b25Ashok Bhat        reinterpret_cast<char *>(name)
2346560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
234717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (_typeArray) {
23483b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
2349560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2350560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_sizeArray) {
23513b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
2352560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
235317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (_lengthArray) {
23543b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
2355560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2356560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2357560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2358dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2359dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferstatic jstring
2360dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferandroid_glGetActiveUniform1
2361dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer  (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
2362dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _exception = 0;
2363dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    const char * _exceptionType;
2364dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    const char * _exceptionMessage;
2365dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2366dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint *size_base = (GLint *) 0;
2367dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _sizeRemaining;
2368dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint *size = (GLint *) 0;
2369dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2370dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLenum *type_base = (GLenum *) 0;
2371dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _typeRemaining;
2372dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLenum *type = (GLenum *) 0;
2373dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2374dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jstring result = 0;
2375dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2376dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint len = 0;
2377dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
2378dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!len) {
2379dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return _env->NewStringUTF("");
2380dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2381dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    char* buf = (char*) malloc(len);
2382dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2383dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf == NULL) {
2384dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2385dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return NULL;
2386dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2387dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2388dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!size_ref) {
2389dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
2390dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
2391dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "size == null";
2392dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
2393dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2394dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (sizeOffset < 0) {
2395dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
2396dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
2397dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "sizeOffset < 0";
2398dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
2399dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2400dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2401dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    size_base = (GLint *)
24023b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(size_ref, (jboolean *)0);
2403dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    size = size_base + sizeOffset;
2404dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2405dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!type_ref) {
2406dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
2407dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
2408dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "type == null";
2409dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
2410dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2411dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (typeOffset < 0) {
2412dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
2413dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
2414dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "typeOffset < 0";
2415dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
2416dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2417dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2418dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    type_base = (GLenum *)
24193b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(type_ref, (jboolean *)0);
2420dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    type = type_base + typeOffset;
2421dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2422dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetActiveUniform(
2423dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)program,
2424dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)index,
2425dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLsizei)len,
2426dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        NULL,
2427dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLint *)size,
2428dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLenum *)type,
2429dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (char *)buf
2430dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    );
2431dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2432dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferexit:
2433dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (type_base) {
24343b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
2435dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer            _exception ? JNI_ABORT: 0);
2436dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2437dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (size_base) {
24383b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
2439dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer            _exception ? JNI_ABORT: 0);
2440dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2441dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_exception != 1) {
2442dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        result = _env->NewStringUTF(buf);
2443dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2444dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf) {
2445dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        free(buf);
2446dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2447dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_exception) {
2448dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
2449dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2450dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (result == 0) {
2451dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        result = _env->NewStringUTF("");
2452dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2453dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    return result;
2454dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer}
2455dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2456dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2457dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferstatic jstring
2458dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferandroid_glGetActiveUniform2
2459dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer  (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
24603b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _sizeArray = (jintArray) 0;
2461dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _sizeBufferOffset = (jint) 0;
24623b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _typeArray = (jintArray) 0;
2463dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _typeBufferOffset = (jint) 0;
2464dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _sizeRemaining;
2465dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint *size = (GLint *) 0;
2466dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _typeRemaining;
2467dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLenum *type = (GLenum *) 0;
2468dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2469dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jstring result = 0;
2470dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint len = 0;
2471dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
2472dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!len) {
2473dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return _env->NewStringUTF("");
2474dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2475dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    char* buf = (char*) malloc(len);
2476dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2477dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf == NULL) {
2478dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2479dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return NULL;
2480dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2481dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
24823b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
24833b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
2484dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2485dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (size == NULL) {
24863b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
2487dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        size = (GLint *) (_sizeBase + _sizeBufferOffset);
2488dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2489dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (type == NULL) {
24903b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
2491dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        type = (GLenum *) (_typeBase + _typeBufferOffset);
2492dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2493dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetActiveUniform(
2494dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)program,
2495dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)index,
2496dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        len,
2497dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        NULL,
2498dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLint *)size,
2499dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLenum *)type,
2500dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (char *)buf
2501dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    );
2502dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2503dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_typeArray) {
25043b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
2505dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2506dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_sizeArray) {
25073b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
2508dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2509dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    result = _env->NewStringUTF(buf);
2510dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf) {
2511dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        free(buf);
2512dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2513dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    return result;
2514dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer}
2515560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */
2516560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2517560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetAttachedShaders__II_3II_3II
2518560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint maxcount, jintArray count_ref, jint countOffset, jintArray shaders_ref, jint shadersOffset) {
2519560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
25202ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
25212ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
2522560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *count_base = (GLsizei *) 0;
2523560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _countRemaining;
2524560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *count = (GLsizei *) 0;
2525560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *shaders_base = (GLuint *) 0;
2526560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _shadersRemaining;
2527560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *shaders = (GLuint *) 0;
2528560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
25296aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos    if (count_ref) {
25306aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        if (countOffset < 0) {
25316aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            _exception = 1;
25326aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            _exceptionType = "java/lang/IllegalArgumentException";
25336aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            _exceptionMessage = "countOffset < 0";
25346aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            goto exit;
25356aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        }
25366aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        _countRemaining = _env->GetArrayLength(count_ref) - countOffset;
25376aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        if (_countRemaining < 1) {
25386aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            _exception = 1;
25396aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            _exceptionType = "java/lang/IllegalArgumentException";
25406aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            _exceptionMessage = "length - countOffset < 1 < needed";
25416aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            goto exit;
25426aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        }
25436aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        count_base = (GLsizei *)
25446aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            _env->GetIntArrayElements(count_ref, (jboolean *)0);
25456aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        count = count_base + countOffset;
25462ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
2547560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2548560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!shaders_ref) {
2549560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
25502545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
25512545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "shaders == null";
2552560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2553560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2554560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (shadersOffset < 0) {
2555560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
25562545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
25572545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "shadersOffset < 0";
2558560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2559560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2560560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _shadersRemaining = _env->GetArrayLength(shaders_ref) - shadersOffset;
25612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_shadersRemaining < maxcount) {
25622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
25632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
25642ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - shadersOffset < maxcount < needed";
25652ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
25662ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
2567560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    shaders_base = (GLuint *)
25683b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(shaders_ref, (jboolean *)0);
2569560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    shaders = shaders_base + shadersOffset;
2570560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2571560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetAttachedShaders(
2572560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
2573560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)maxcount,
2574560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)count,
2575560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)shaders
2576560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
2577560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2578560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
2579560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (shaders_base) {
25803b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(shaders_ref, (jint*)shaders_base,
2581560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2582560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2583560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (count_base) {
25843b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(count_ref, (jint*)count_base,
2585560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2586560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
25872545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
25882545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
25892545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2590560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2591560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2592560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */
2593560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2594560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
2595560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint maxcount, jobject count_buf, jobject shaders_buf) {
25962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
25972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
25982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
25993b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _countArray = (jintArray) 0;
260017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _countBufferOffset = (jint) 0;
26013b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _shadersArray = (jintArray) 0;
260217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _shadersBufferOffset = (jint) 0;
2603560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _countRemaining;
2604560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *count = (GLsizei *) 0;
2605560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _shadersRemaining;
2606560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *shaders = (GLuint *) 0;
2607560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
26082ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (count_buf) {
26093b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        count = (GLsizei *)getPointer(_env, count_buf, (jarray*)&_countArray, &_countRemaining, &_countBufferOffset);
26102ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        if (_countRemaining < 1) {
26112ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _exception = 1;
26122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _exceptionType = "java/lang/IllegalArgumentException";
26132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _exceptionMessage = "remaining() < 1 < needed";
26142ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            goto exit;
26152ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        }
26162ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
261784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!shaders_buf) {
261884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
261984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
262084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "shaders == null";
262184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
262284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
26236aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos    shaders = (GLuint *)getPointer(_env, shaders_buf, (jarray*)&_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
26246aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos    if (_shadersRemaining < maxcount) {
26256aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        _exception = 1;
26266aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        _exceptionType = "java/lang/IllegalArgumentException";
26276aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        _exceptionMessage = "remaining() < maxcount < needed";
26286aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        goto exit;
26292ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
26302ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (count_buf && count == NULL) {
26313b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _countBase = (char *)_env->GetIntArrayElements(_countArray, (jboolean *) 0);
26322ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        count = (GLsizei *) (_countBase + _countBufferOffset);
26332ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
26346aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos    if (shaders == NULL) {
26353b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _shadersBase = (char *)_env->GetIntArrayElements(_shadersArray, (jboolean *) 0);
263617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        shaders = (GLuint *) (_shadersBase + _shadersBufferOffset);
263717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
2638560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetAttachedShaders(
2639560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
2640560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)maxcount,
2641560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)count,
2642560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)shaders
2643560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
26442ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
26452ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
2646560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_shadersArray) {
26473b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_shadersArray, (jint*)shaders, _exception ? JNI_ABORT : 0);
264817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
264917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (_countArray) {
26503b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_countArray, (jint*)count, _exception ? JNI_ABORT : 0);
26512ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
26522ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
26532ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
2654560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2655560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2656560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
265789be00bcda2b5965757e83bdf70a650b64373045Mathias Agopian/* GLint glGetAttribLocation ( GLuint program, const char *name ) */
2658560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jint
2659560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetAttribLocation__ILjava_lang_String_2
2660560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jstring name) {
26612545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
26622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
26632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
266489be00bcda2b5965757e83bdf70a650b64373045Mathias Agopian    GLint _returnValue = 0;
2665560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    const char* _nativename = 0;
2666560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2667560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!name) {
2668428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes        _exception = 1;
26692545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
26702545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "name == null";
2671560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2672560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2673560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _nativename = _env->GetStringUTFChars(name, 0);
2674560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2675560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glGetAttribLocation(
2676560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
2677560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (char *)_nativename
2678560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
2679560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2680560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
2681560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_nativename) {
2682560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleaseStringUTFChars(name, _nativename);
2683560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2684560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
26852545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
26862545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
26872545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2688cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jint)_returnValue;
2689560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2690560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2691560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
2692560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2693560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetBooleanv__I_3ZI
2694560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
26953b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    get<jbooleanArray, BooleanArrayGetter, jboolean*, BooleanArrayReleaser, GLboolean, glGetBooleanv>(
26963b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env, _this, pname, params_ref, offset);
2697560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2698560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2699560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
2700560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2701560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetBooleanv__ILjava_nio_IntBuffer_2
2702560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
27033b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    getarray<GLboolean, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetBooleanv>(
27043b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env, _this, pname, params_buf);
2705560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2706560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2707560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2708560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetBufferParameteriv__II_3II
2709560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
271073108675c944ab4ee89631dced23566b12341b66Jack Palevich    jint _exception = 0;
27112ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
27122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
271373108675c944ab4ee89631dced23566b12341b66Jack Palevich    GLint *params_base = (GLint *) 0;
271473108675c944ab4ee89631dced23566b12341b66Jack Palevich    jint _remaining;
271573108675c944ab4ee89631dced23566b12341b66Jack Palevich    GLint *params = (GLint *) 0;
271673108675c944ab4ee89631dced23566b12341b66Jack Palevich
271773108675c944ab4ee89631dced23566b12341b66Jack Palevich    if (!params_ref) {
271873108675c944ab4ee89631dced23566b12341b66Jack Palevich        _exception = 1;
27192545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
27202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
272173108675c944ab4ee89631dced23566b12341b66Jack Palevich        goto exit;
272273108675c944ab4ee89631dced23566b12341b66Jack Palevich    }
272373108675c944ab4ee89631dced23566b12341b66Jack Palevich    if (offset < 0) {
272473108675c944ab4ee89631dced23566b12341b66Jack Palevich        _exception = 1;
27252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
27262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
272773108675c944ab4ee89631dced23566b12341b66Jack Palevich        goto exit;
272873108675c944ab4ee89631dced23566b12341b66Jack Palevich    }
272973108675c944ab4ee89631dced23566b12341b66Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
273073108675c944ab4ee89631dced23566b12341b66Jack Palevich    if (_remaining < 1) {
273173108675c944ab4ee89631dced23566b12341b66Jack Palevich        _exception = 1;
27322545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
27332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < 1 < needed";
273473108675c944ab4ee89631dced23566b12341b66Jack Palevich        goto exit;
273573108675c944ab4ee89631dced23566b12341b66Jack Palevich    }
273673108675c944ab4ee89631dced23566b12341b66Jack Palevich    params_base = (GLint *)
27373b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(params_ref, (jboolean *)0);
273873108675c944ab4ee89631dced23566b12341b66Jack Palevich    params = params_base + offset;
273973108675c944ab4ee89631dced23566b12341b66Jack Palevich
274073108675c944ab4ee89631dced23566b12341b66Jack Palevich    glGetBufferParameteriv(
274173108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)target,
274273108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)pname,
274373108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLint *)params
274473108675c944ab4ee89631dced23566b12341b66Jack Palevich    );
274573108675c944ab4ee89631dced23566b12341b66Jack Palevich
274673108675c944ab4ee89631dced23566b12341b66Jack Palevichexit:
274773108675c944ab4ee89631dced23566b12341b66Jack Palevich    if (params_base) {
27483b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
274973108675c944ab4ee89631dced23566b12341b66Jack Palevich            _exception ? JNI_ABORT: 0);
275073108675c944ab4ee89631dced23566b12341b66Jack Palevich    }
27512545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
27522545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
27532545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2754560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2755560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2756560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2757560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2758560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
2759560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
276073108675c944ab4ee89631dced23566b12341b66Jack Palevich    jint _exception = 0;
27612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
27622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
27633b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
276417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
276573108675c944ab4ee89631dced23566b12341b66Jack Palevich    jint _remaining;
276673108675c944ab4ee89631dced23566b12341b66Jack Palevich    GLint *params = (GLint *) 0;
276773108675c944ab4ee89631dced23566b12341b66Jack Palevich
276884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!params_buf) {
276984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
277084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
277184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "params == null";
277284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
277384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
27743b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
277573108675c944ab4ee89631dced23566b12341b66Jack Palevich    if (_remaining < 1) {
277673108675c944ab4ee89631dced23566b12341b66Jack Palevich        _exception = 1;
27772545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
27782545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < 1 < needed";
277973108675c944ab4ee89631dced23566b12341b66Jack Palevich        goto exit;
278073108675c944ab4ee89631dced23566b12341b66Jack Palevich    }
278117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
27823b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
278317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
278417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
278573108675c944ab4ee89631dced23566b12341b66Jack Palevich    glGetBufferParameteriv(
278673108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)target,
278773108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)pname,
278873108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLint *)params
278973108675c944ab4ee89631dced23566b12341b66Jack Palevich    );
279073108675c944ab4ee89631dced23566b12341b66Jack Palevich
279173108675c944ab4ee89631dced23566b12341b66Jack Palevichexit:
279273108675c944ab4ee89631dced23566b12341b66Jack Palevich    if (_array) {
27933b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
279473108675c944ab4ee89631dced23566b12341b66Jack Palevich    }
27952545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
27962545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
27972545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2798560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2799560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2800560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLenum glGetError ( void ) */
2801560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jint
2802560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetError__
2803560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this) {
2804560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum _returnValue;
2805560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glGetError();
2806cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jint)_returnValue;
2807560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2808560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2809560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
2810560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2811560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetFloatv__I_3FI
2812560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
28133b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    get<jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, GLfloat, glGetFloatv>(
28143b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env, _this, pname, params_ref, offset);
2815560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2816560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2817560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
2818560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2819560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetFloatv__ILjava_nio_FloatBuffer_2
2820560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
28213b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    getarray<GLfloat, jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, glGetFloatv>(
28223b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env, _this, pname, params_buf);
2823560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2824560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
2825560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2826560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetFramebufferAttachmentParameteriv__III_3II
2827560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jintArray params_ref, jint offset) {
2828560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
28292ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
28302ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
2831560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
2832560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
2833560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
2834560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2835560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
2836560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
28372545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
28382545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
2839560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2840560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2841560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
2842560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
28432545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
28442545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
2845560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2846560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2847560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
2848560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
28493b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(params_ref, (jboolean *)0);
2850560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
2851560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2852560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetFramebufferAttachmentParameteriv(
2853560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
2854560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)attachment,
2855560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
2856560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
2857560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
2858560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2859560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
2860560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
28613b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
2862560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2863560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
28642545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
28652545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
28662545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2867560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2868560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2869560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
2870560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2871560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2
2872560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) {
287384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    jint _exception = 0;
287484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    const char * _exceptionType = NULL;
287584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    const char * _exceptionMessage = NULL;
28763b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
287717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
2878560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
2879560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
2880560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
288184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!params_buf) {
288284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
288384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
288484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "params == null";
288584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
288684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
28873b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
288817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
28893b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
289017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
289117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
2892560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetFramebufferAttachmentParameteriv(
2893560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
2894560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)attachment,
2895560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
2896560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
2897560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
289884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy
289984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guyexit:
2900560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
290184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
290284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
290384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (_exception) {
290484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        jniThrowException(_env, _exceptionType, _exceptionMessage);
2905560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2906560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2907560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2908560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetIntegerv ( GLenum pname, GLint *params ) */
2909560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2910560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetIntegerv__I_3II
2911560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
29123b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    get<jintArray, IntArrayGetter, jint*, IntArrayReleaser, GLint, glGetIntegerv>(
29133b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env, _this, pname, params_ref, offset);
2914560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2915560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2916560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetIntegerv ( GLenum pname, GLint *params ) */
2917560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2918560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetIntegerv__ILjava_nio_IntBuffer_2
2919560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
29203b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    getarray<GLint, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetIntegerv>(
29213b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env, _this, pname, params_buf);
2922560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2923560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2924560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2925560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetProgramiv__II_3II
2926560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint pname, jintArray params_ref, jint offset) {
2927560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
29282ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
29292ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
2930560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
2931560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
2932560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
2933560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2934560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
2935560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
29362545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
29372545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
2938560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2939560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2940560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
2941560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
29422545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
29432545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
2944560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2945560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2946560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
29472ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
29482ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
29492ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
29502ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < 1 < needed";
29512ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
29522ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
2953560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
29543b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(params_ref, (jboolean *)0);
2955560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
2956560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2957560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetProgramiv(
2958560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
2959560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
2960560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
2961560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
2962560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2963560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
2964560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
29653b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
2966560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2967560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
29682545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
29692545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
29702545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2971560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2972560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2973560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2974560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2975560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetProgramiv__IILjava_nio_IntBuffer_2
2976560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint pname, jobject params_buf) {
29772ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
29782ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
29792ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
29803b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
298117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
2982560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
2983560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
2984560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
298584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!params_buf) {
298684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
298784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
298884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "params == null";
298984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
299084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
29913b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
29922ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
29932ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
29942ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
29952ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
29962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
29972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
299817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
29993b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
300017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
300117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3002560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetProgramiv(
3003560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
3004560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3005560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3006560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
30072ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
30082ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
3009560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
30103b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
30112ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
30122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
30132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
3014560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3015560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3016560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
301724ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes#include <stdlib.h>
3018560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3019560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetProgramInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
302024ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughesstatic jstring android_glGetProgramInfoLog(JNIEnv *_env, jobject, jint shader) {
3021560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint infoLen = 0;
3022560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
302324ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    if (!infoLen) {
302424ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        return _env->NewStringUTF("");
3025560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
302624ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    char* buf = (char*) malloc(infoLen);
302724ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    if (buf == NULL) {
302824ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
302924ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        return NULL;
3030560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
303124ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    glGetProgramInfoLog(shader, infoLen, NULL, buf);
303224ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    jstring result = _env->NewStringUTF(buf);
303324ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    free(buf);
303424ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    return result;
3035560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3036560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3037560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3038560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetRenderbufferParameteriv__II_3II
3039560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
3040560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
30412ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
30422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
3043560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
3044560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3045560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3046560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3047560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
3048560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
30492545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
30502545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
3051560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3052560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3053560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
3054560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
30552545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
30562545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
3057560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3058560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3059560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
30602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
30612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
30622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
30632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < 1 < needed";
30642ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
30652ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3066560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
30673b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(params_ref, (jboolean *)0);
3068560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
3069560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3070560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetRenderbufferParameteriv(
3071560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
3072560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3073560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3074560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3075560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3076560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3077560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
30783b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
3079560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3080560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
30812545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
30822545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
30832545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3084560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3085560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3086560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3087560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3088560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2
3089560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
30902ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
30912ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
30922ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
30933b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
309417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3095560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3096560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3097560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
309884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!params_buf) {
309984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
310084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
310184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "params == null";
310284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
310384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
31043b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
31052ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
31062ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
31072ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
31082ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
31092ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
31102ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
311117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
31123b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
311317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
311417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3115560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetRenderbufferParameteriv(
3116560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
3117560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3118560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3119560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
31202ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
31212ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
3122560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
31233b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
31242ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
31252ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
31262ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
3127560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3128560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3129560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3130560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
3131560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3132560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetShaderiv__II_3II
3133560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shader, jint pname, jintArray params_ref, jint offset) {
3134560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
31352ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
31362ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
3137560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
3138560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3139560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3140560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3141560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
3142560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
31432545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
31442545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
3145560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3146560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3147560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
3148560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
31492545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
31502545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
3151560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3152560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3153560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
31542ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
31552ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
31562ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
31572ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < 1 < needed";
31582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
31592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3160560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
31613b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(params_ref, (jboolean *)0);
3162560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
3163560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3164560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetShaderiv(
3165560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader,
3166560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3167560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3168560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3169560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3170560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3171560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
31723b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
3173560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3174560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
31752545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
31762545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
31772545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3178560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3179560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3180560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
3181560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3182560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetShaderiv__IILjava_nio_IntBuffer_2
3183560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shader, jint pname, jobject params_buf) {
31842ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
31852ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
31862ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
31873b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
318817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3189560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3190560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3191560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
319284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!params_buf) {
319384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
319484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
319584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "params == null";
319684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
319784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
31983b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
31992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
32002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
32012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
32022ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
32032ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
32042ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
320517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
32063b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
320717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
320817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3209560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetShaderiv(
3210560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader,
3211560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3212560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3213560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
32142ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
32152ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
3216560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
32173b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
32182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
32192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
32202ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
3221560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3222560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3223560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
322424ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes#include <stdlib.h>
3225560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3226560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetShaderInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
322724ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughesstatic jstring android_glGetShaderInfoLog(JNIEnv *_env, jobject, jint shader) {
3228560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint infoLen = 0;
3229560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
323024ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    if (!infoLen) {
3231e842e50d42e311eaf97aa01548c4fc29ad352b53Romain Guy        infoLen = 512;
3232560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
323324ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    char* buf = (char*) malloc(infoLen);
323424ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    if (buf == NULL) {
323524ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
323624ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        return NULL;
3237560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3238e842e50d42e311eaf97aa01548c4fc29ad352b53Romain Guy    GLsizei outLen = 0;
3239e842e50d42e311eaf97aa01548c4fc29ad352b53Romain Guy    glGetShaderInfoLog(shader, infoLen, &outLen, buf);
3240e842e50d42e311eaf97aa01548c4fc29ad352b53Romain Guy    jstring result = _env->NewStringUTF(outLen == 0 ? "" : buf);
324124ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    free(buf);
324224ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    return result;
3243560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3244560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
3245560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3246560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetShaderPrecisionFormat__II_3II_3II
3247560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jintArray range_ref, jint rangeOffset, jintArray precision_ref, jint precisionOffset) {
3248560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
32492ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
32502ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
3251560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *range_base = (GLint *) 0;
3252560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _rangeRemaining;
3253560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *range = (GLint *) 0;
3254560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *precision_base = (GLint *) 0;
3255560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _precisionRemaining;
3256560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *precision = (GLint *) 0;
3257560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3258560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!range_ref) {
3259560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
32602545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
32612545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "range == null";
3262560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3263560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3264560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (rangeOffset < 0) {
3265560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
32662545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
32672545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "rangeOffset < 0";
3268560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3269560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3270560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _rangeRemaining = _env->GetArrayLength(range_ref) - rangeOffset;
32712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_rangeRemaining < 1) {
32722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
32732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
32742ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - rangeOffset < 1 < needed";
32752ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
32762ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3277560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    range_base = (GLint *)
32783b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(range_ref, (jboolean *)0);
3279560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    range = range_base + rangeOffset;
3280560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3281560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!precision_ref) {
3282560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
32832545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
32842545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "precision == null";
3285560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3286560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3287560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (precisionOffset < 0) {
3288560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
32892545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
32902545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "precisionOffset < 0";
3291560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3292560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3293560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _precisionRemaining = _env->GetArrayLength(precision_ref) - precisionOffset;
32942ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_precisionRemaining < 1) {
32952ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
32962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
32972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - precisionOffset < 1 < needed";
32982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
32992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3300560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    precision_base = (GLint *)
33013b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(precision_ref, (jboolean *)0);
3302560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    precision = precision_base + precisionOffset;
3303560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3304560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetShaderPrecisionFormat(
3305560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)shadertype,
3306560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)precisiontype,
3307560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)range,
3308560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)precision
3309560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3310560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3311560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3312560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (precision_base) {
33133b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(precision_ref, (jint*)precision_base,
3314560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3315560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3316560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (range_base) {
33173b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(range_ref, (jint*)range_base,
3318560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3319560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
33202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
33212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
33222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3323560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3324560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3325560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
3326560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3327560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
3328560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jobject range_buf, jobject precision_buf) {
33292ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
33302ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
33312ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
33323b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _rangeArray = (jintArray) 0;
333317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _rangeBufferOffset = (jint) 0;
33343b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _precisionArray = (jintArray) 0;
333517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _precisionBufferOffset = (jint) 0;
3336560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _rangeRemaining;
3337560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *range = (GLint *) 0;
3338560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _precisionRemaining;
3339560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *precision = (GLint *) 0;
3340560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
334184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!range_buf) {
334284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
334384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
334484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "range == null";
334584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
334684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
33473b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    range = (GLint *)getPointer(_env, range_buf, (jarray*)&_rangeArray, &_rangeRemaining, &_rangeBufferOffset);
33482ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_rangeRemaining < 1) {
33492ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
33502ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
33512ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
33522ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
33532ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
335484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!precision_buf) {
335584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
335684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
335784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "precision == null";
335884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
335984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
33603b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    precision = (GLint *)getPointer(_env, precision_buf, (jarray*)&_precisionArray, &_precisionRemaining, &_precisionBufferOffset);
33612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_precisionRemaining < 1) {
33622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
33632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
33642ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
33652ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
33662ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
336717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (range == NULL) {
33683b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _rangeBase = (char *)_env->GetIntArrayElements(_rangeArray, (jboolean *) 0);
336917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        range = (GLint *) (_rangeBase + _rangeBufferOffset);
337017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
337117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (precision == NULL) {
33723b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _precisionBase = (char *)_env->GetIntArrayElements(_precisionArray, (jboolean *) 0);
337317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        precision = (GLint *) (_precisionBase + _precisionBufferOffset);
337417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3375560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetShaderPrecisionFormat(
3376560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)shadertype,
3377560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)precisiontype,
3378560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)range,
3379560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)precision
3380560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
33812ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
33822ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
3383560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_precisionArray) {
33843b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_precisionArray, (jint*)precision, _exception ? JNI_ABORT : 0);
338517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
338617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (_rangeArray) {
33873b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_rangeArray, (jint*)range, _exception ? JNI_ABORT : 0);
33882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
33892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
33902ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
3391560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3392560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3393560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3394560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3395560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3396560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetShaderSource__II_3II_3BI
3397560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jintArray length_ref, jint lengthOffset, jbyteArray source_ref, jint sourceOffset) {
3398560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
33992545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    const char * _exceptionType;
34002545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    const char * _exceptionMessage;
3401560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length_base = (GLsizei *) 0;
3402560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _lengthRemaining;
3403560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length = (GLsizei *) 0;
3404560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    char *source_base = (char *) 0;
3405560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _sourceRemaining;
3406560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    char *source = (char *) 0;
3407560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
34086aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos    if (length_ref) {
34096aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        if (lengthOffset < 0) {
34106aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            _exception = 1;
34116aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            _exceptionType = "java/lang/IllegalArgumentException";
34126aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            _exceptionMessage = "lengthOffset < 0";
34136aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            goto exit;
34146aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        }
34156aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
34166aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        length_base = (GLsizei *)
34176aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos            _env->GetIntArrayElements(length_ref, (jboolean *)0);
34186aff9068f91fdfef0bc55fda0721c180c0de9284Pablo Ceballos        length = length_base + lengthOffset;
3419560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3420560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3421560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!source_ref) {
3422560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
34232545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
34242545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "source == null";
3425560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3426560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3427560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (sourceOffset < 0) {
3428560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
34292545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
34302545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "sourceOffset < 0";
3431560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3432560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3433560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _sourceRemaining = _env->GetArrayLength(source_ref) - sourceOffset;
3434560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    source_base = (char *)
34353b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetByteArrayElements(source_ref, (jboolean *)0);
3436560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    source = source_base + sourceOffset;
3437560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3438560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetShaderSource(
3439560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader,
3440560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)bufsize,
3441560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)length,
3442560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (char *)source
3443560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3444560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3445560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3446560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (source_base) {
34473b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseByteArrayElements(source_ref, (jbyte*)source_base,
3448560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3449560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3450560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (length_base) {
34513b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
3452560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3453560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
34542545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
34552545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
34562545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3457560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3458560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3459560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3460560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3461560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetShaderSource__IILjava_nio_IntBuffer_2B
3462560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jobject length_buf, jbyte source) {
34633b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
346417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3465560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3466560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length = (GLsizei *) 0;
3467560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
34683b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
346917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (length == NULL) {
34703b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _lengthBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
347117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        length = (GLsizei *) (_lengthBase + _bufferOffset);
347217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3473560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetShaderSource(
3474560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader,
3475560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)bufsize,
3476560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)length,
347701c26ea89d4bbea3cf550e9328742302dd9a2b25Ashok Bhat        reinterpret_cast<char *>(source)
3478560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3479560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
34803b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _array, (jint*)length, JNI_TRUE);
3481560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3482560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3483560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3484dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3485dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferstatic jstring android_glGetShaderSource(JNIEnv *_env, jobject, jint shader) {
3486dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint shaderLen = 0;
3487dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetShaderiv((GLuint)shader, GL_SHADER_SOURCE_LENGTH, &shaderLen);
3488dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!shaderLen) {
3489dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return _env->NewStringUTF("");
3490dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
3491dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    char* buf = (char*) malloc(shaderLen);
3492dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf == NULL) {
3493dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
3494dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return NULL;
3495dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
3496dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetShaderSource(shader, shaderLen, NULL, buf);
3497dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jstring result = _env->NewStringUTF(buf);
3498dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    free(buf);
3499dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    return result;
3500dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer}
3501560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* const GLubyte * glGetString ( GLenum name ) */
350224ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughesstatic jstring android_glGetString(JNIEnv* _env, jobject, jint name) {
350324ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    const char* chars = (const char*) glGetString((GLenum) name);
350424ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    return _env->NewStringUTF(chars);
3505560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3506560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
3507560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3508560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetTexParameterfv__II_3FI
3509560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
3510560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
35112ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
35122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
3513560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params_base = (GLfloat *) 0;
3514560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3515560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
3516560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3517560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
3518560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
35192545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
35202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
3521560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3522560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3523560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
3524560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
35252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
35262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
3527560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3528560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3529560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
3530560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
3531560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
35322545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
35332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < 1 < needed";
3534560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3535560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3536560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLfloat *)
35373b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(params_ref, (jboolean *)0);
3538560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
3539560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3540560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetTexParameterfv(
3541560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
3542560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3543560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
3544560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3545560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3546560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3547560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
35483b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
3549560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3550560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
35512545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
35522545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
35532545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3554560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3555560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3556560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
3557560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3558560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetTexParameterfv__IILjava_nio_FloatBuffer_2
3559560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3560560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
35612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
35622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
35633b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
356417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3565560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3566560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
3567560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
356884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!params_buf) {
356984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
357084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
357184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "params == null";
357284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
357384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
35743b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3575560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
3576560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
35772545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
35782545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < 1 < needed";
3579560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3580560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
358117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
35823b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
358317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLfloat *) (_paramsBase + _bufferOffset);
358417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3585560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetTexParameterfv(
3586560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
3587560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3588560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
3589560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3590560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3591560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3592560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
35933b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
3594560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
35952545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
35962545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
35972545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3598560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3599560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3600560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3601560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3602560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetTexParameteriv__II_3II
3603560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
3604560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
36052ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
36062ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
3607560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
3608560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3609560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3610560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3611560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
3612560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
36132545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
36142545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
3615560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3616560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3617560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
3618560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
36192545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
36202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
3621560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3622560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3623560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
3624560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
3625560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
36262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
36272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < 1 < needed";
3628560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3629560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3630560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
36313b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(params_ref, (jboolean *)0);
3632560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
3633560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3634560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetTexParameteriv(
3635560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
3636560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3637560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3638560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3639560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3640560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3641560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
36423b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
3643560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3644560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
36452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
36462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
36472545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3648560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3649560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3650560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3651560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3652560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetTexParameteriv__IILjava_nio_IntBuffer_2
3653560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3654560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
36552ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
36562ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
36573b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
365817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3659560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3660560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3661560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
366284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!params_buf) {
366384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
366484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
366584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "params == null";
366684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
366784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
36683b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3669560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
3670560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
36712545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
36722545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < 1 < needed";
3673560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3674560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
367517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
36763b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
367717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
367817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3679560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetTexParameteriv(
3680560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
3681560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3682560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3683560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3684560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3685560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3686560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
36873b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
3688560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
36892545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
36902545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
36912545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3692560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3693560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3694560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3695560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3696560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetUniformfv__II_3FI
3697560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint location, jfloatArray params_ref, jint offset) {
3698560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
36992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
37002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
3701560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params_base = (GLfloat *) 0;
3702560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3703560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
3704560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3705560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
3706560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
37072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
37082545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
3709560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3710560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3711560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
3712560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
37132545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
37142545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
3715560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3716560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3717560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
37182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
37192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
37202ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
37212ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < 1 < needed";
37222ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
37232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3724560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLfloat *)
37253b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(params_ref, (jboolean *)0);
3726560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
3727560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3728560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetUniformfv(
3729560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
3730560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
3731560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
3732560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3733560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3734560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3735560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
37363b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
3737560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3738560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
37392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
37402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
37412545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3742560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3743560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3744560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3745560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3746560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetUniformfv__IILjava_nio_FloatBuffer_2
3747560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
37482ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
37492ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
37502ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
37513b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
375217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3753560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3754560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
3755560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
375684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!params_buf) {
375784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
375884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
375984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "params == null";
376084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
376184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
37623b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
37632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
37642ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
37652ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
37662ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
37672ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
37682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
376917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
37703b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
377117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLfloat *) (_paramsBase + _bufferOffset);
377217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3773560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetUniformfv(
3774560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
3775560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
3776560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
3777560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
37782ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
37792ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
3780560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
37813b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
37822ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
37832ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
37842ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
3785560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3786560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3787560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3788560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3789560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3790560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetUniformiv__II_3II
3791560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint location, jintArray params_ref, jint offset) {
3792560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
37932ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
37942ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
3795560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
3796560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3797560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3798560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3799560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
3800560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
38012545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
38022545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
3803560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3804560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3805560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
3806560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
38072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
38082545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
3809560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3810560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3811560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
38122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
38132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
38142ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
38152ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < 1 < needed";
38162ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
38172ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3818560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
38193b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(params_ref, (jboolean *)0);
3820560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
3821560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3822560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetUniformiv(
3823560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
3824560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
3825560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3826560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3827560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3828560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3829560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
38303b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
3831560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3832560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
38332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
38342545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
38352545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3836560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3837560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3838560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3839560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3840560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetUniformiv__IILjava_nio_IntBuffer_2
3841560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
38422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
38432ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
38442ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
38453b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
384617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3847560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3848560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3849560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
385084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!params_buf) {
385184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
385284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
385384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "params == null";
385484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
385584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
38563b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
38572ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
38582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
38592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
38602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
38612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
38622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
386317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
38643b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
386517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
386617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3867560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetUniformiv(
3868560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
3869560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
3870560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3871560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
38722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
38732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
3874560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
38753b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
38762ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
38772ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
38782ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
3879560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3880560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3881560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
388289be00bcda2b5965757e83bdf70a650b64373045Mathias Agopian/* GLint glGetUniformLocation ( GLuint program, const char *name ) */
3883560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jint
3884560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetUniformLocation__ILjava_lang_String_2
3885560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jstring name) {
38862545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
38872ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
38882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
388989be00bcda2b5965757e83bdf70a650b64373045Mathias Agopian    GLint _returnValue = 0;
3890560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    const char* _nativename = 0;
3891560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3892560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!name) {
3893428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes        _exception = 1;
38942545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
38952545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "name == null";
3896560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3897560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3898560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _nativename = _env->GetStringUTFChars(name, 0);
3899560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3900560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glGetUniformLocation(
3901560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
3902560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (char *)_nativename
3903560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3904560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3905560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3906560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_nativename) {
3907560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleaseStringUTFChars(name, _nativename);
3908560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3909560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
39102545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
39112545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
39122545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3913cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jint)_returnValue;
3914560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3915560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3916560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3917560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3918560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetVertexAttribfv__II_3FI
3919560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint index, jint pname, jfloatArray params_ref, jint offset) {
3920560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
39212ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
39222ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
3923560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params_base = (GLfloat *) 0;
3924560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3925560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
3926560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3927560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
3928560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
39292545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
39302545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
3931560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3932560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3933560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
3934560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
39352545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
39362545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
3937560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3938560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3939560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
39402ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    int _needed;
39412ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    switch (pname) {
39422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#if defined(GL_CURRENT_VERTEX_ATTRIB)
39432ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_CURRENT_VERTEX_ATTRIB:
39442ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
39452ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _needed = 4;
39462ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
39472ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        default:
39482ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _needed = 1;
39492ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
39502ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
39512ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < _needed) {
39522ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
39532ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
39542ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < needed";
39552ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
39562ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3957560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLfloat *)
39583b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(params_ref, (jboolean *)0);
3959560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
3960560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3961560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetVertexAttribfv(
3962560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
3963560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3964560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
3965560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3966560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3967560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3968560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
39693b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
3970560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3971560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
39722545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
39732545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
39742545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3975560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3976560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3977560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3978560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3979560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2
3980560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
39812ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
39822ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
39832ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
39843b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
398517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3986560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3987560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
3988560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
398984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!params_buf) {
399084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
399184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
399284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "params == null";
399384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
399484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
39953b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
39962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    int _needed;
39972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    switch (pname) {
39982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#if defined(GL_CURRENT_VERTEX_ATTRIB)
39992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_CURRENT_VERTEX_ATTRIB:
40002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
40012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _needed = 4;
40022ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
40032ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        default:
40042ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _needed = 1;
40052ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
40062ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
40072ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < _needed) {
40082ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
40092ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
40102ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < needed";
40112ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
40122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
401317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
40143b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
401517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLfloat *) (_paramsBase + _bufferOffset);
401617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4017560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetVertexAttribfv(
4018560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
4019560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4020560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
4021560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
40222ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
40232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
4024560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
40253b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
40262ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
40272ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
40282ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
4029560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4030560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4031560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4032560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
4033560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4034560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetVertexAttribiv__II_3II
4035560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint index, jint pname, jintArray params_ref, jint offset) {
4036560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
40372ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
40382ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
4039560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
4040560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4041560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
4042560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4043560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
4044560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
40452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
40462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
4047560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4048560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4049560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
4050560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
40512545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
40522545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
4053560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4054560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4055560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
40562ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    int _needed;
40572ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    switch (pname) {
40582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#if defined(GL_CURRENT_VERTEX_ATTRIB)
40592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_CURRENT_VERTEX_ATTRIB:
40602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
40612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _needed = 4;
40622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
40632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        default:
40642ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _needed = 1;
40652ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
40662ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
40672ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < _needed) {
40682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
40692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
40702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < needed";
40712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
40722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
4073560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
40743b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(params_ref, (jboolean *)0);
4075560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
4076560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4077560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetVertexAttribiv(
4078560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
4079560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4080560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
4081560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4082560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4083560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4084560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
40853b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
4086560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
4087560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
40882545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
40892545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
40902545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4091560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4092560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4093560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
4094560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4095560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetVertexAttribiv__IILjava_nio_IntBuffer_2
4096560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
40972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
40982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
40992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
41003b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
410117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4102560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4103560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
4104560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
410584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!params_buf) {
410684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
410784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
410884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "params == null";
410984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
411084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
41113b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
41122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    int _needed;
41132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    switch (pname) {
41142ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#if defined(GL_CURRENT_VERTEX_ATTRIB)
41152ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_CURRENT_VERTEX_ATTRIB:
41162ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
41172ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _needed = 4;
41182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
41192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        default:
41202ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _needed = 1;
41212ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
41222ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
41232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < _needed) {
41242ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
41252ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
41262ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < needed";
41272ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
41282ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
412917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
41303b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
413117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
413217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4133560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetVertexAttribiv(
4134560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
4135560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4136560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
4137560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
41382ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
41392ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
4140560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
41413b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
41422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
41432ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
41442ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
4145560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4146560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4147560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4148560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glHint ( GLenum target, GLenum mode ) */
4149560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4150560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glHint__II
4151560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint mode) {
4152560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glHint(
4153560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4154560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)mode
4155560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4156560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4157560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4158560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLboolean glIsBuffer ( GLuint buffer ) */
4159560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jboolean
4160560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glIsBuffer__I
4161560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint buffer) {
4162560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLboolean _returnValue;
4163560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glIsBuffer(
4164560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)buffer
4165560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4166cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jboolean)_returnValue;
4167560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4168560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4169560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLboolean glIsEnabled ( GLenum cap ) */
4170560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jboolean
4171560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glIsEnabled__I
4172560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint cap) {
4173560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLboolean _returnValue;
4174560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glIsEnabled(
4175560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)cap
4176560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4177cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jboolean)_returnValue;
4178560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4179560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4180560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLboolean glIsFramebuffer ( GLuint framebuffer ) */
4181560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jboolean
4182560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glIsFramebuffer__I
4183560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint framebuffer) {
4184560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLboolean _returnValue;
4185560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glIsFramebuffer(
4186560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)framebuffer
4187560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4188cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jboolean)_returnValue;
4189560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4190560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4191560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLboolean glIsProgram ( GLuint program ) */
4192560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jboolean
4193560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glIsProgram__I
4194560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program) {
4195560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLboolean _returnValue;
4196560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glIsProgram(
4197560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program
4198560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4199cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jboolean)_returnValue;
4200560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4201560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4202560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLboolean glIsRenderbuffer ( GLuint renderbuffer ) */
4203560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jboolean
4204560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glIsRenderbuffer__I
4205560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint renderbuffer) {
4206560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLboolean _returnValue;
4207560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glIsRenderbuffer(
4208560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)renderbuffer
4209560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4210cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jboolean)_returnValue;
4211560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4212560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4213560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLboolean glIsShader ( GLuint shader ) */
4214560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jboolean
4215560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glIsShader__I
4216560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shader) {
4217560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLboolean _returnValue;
4218560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glIsShader(
4219560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader
4220560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4221cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jboolean)_returnValue;
4222560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4223560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4224560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLboolean glIsTexture ( GLuint texture ) */
4225560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jboolean
4226560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glIsTexture__I
4227560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint texture) {
4228560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLboolean _returnValue;
4229560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glIsTexture(
4230560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)texture
4231560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4232cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jboolean)_returnValue;
4233560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4234560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4235560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glLineWidth ( GLfloat width ) */
4236560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4237560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glLineWidth__F
4238560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jfloat width) {
4239560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glLineWidth(
4240560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)width
4241560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4242560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4243560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4244560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glLinkProgram ( GLuint program ) */
4245560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4246560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glLinkProgram__I
4247560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program) {
4248560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glLinkProgram(
4249560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program
4250560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4251560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4252560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4253560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glPixelStorei ( GLenum pname, GLint param ) */
4254560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4255560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glPixelStorei__II
4256560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint pname, jint param) {
4257560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glPixelStorei(
4258560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4259560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)param
4260560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4261560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4262560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4263560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glPolygonOffset ( GLfloat factor, GLfloat units ) */
4264560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4265560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glPolygonOffset__FF
4266560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) {
4267560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glPolygonOffset(
4268560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)factor,
4269560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)units
4270560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4271560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4272560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4273560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */
4274560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4275560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glReadPixels__IIIIIILjava_nio_Buffer_2
4276560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) {
427784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    jint _exception = 0;
427884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    const char * _exceptionType = NULL;
427984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    const char * _exceptionMessage = NULL;
4280560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
428117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4282560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4283560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *pixels = (GLvoid *) 0;
4284560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
428584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!pixels_buf) {
428684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
428784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
428884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "pixels == null";
428984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
429084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
42913b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
429217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (pixels == NULL) {
429317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
429417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
429517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4296560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glReadPixels(
4297560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
4298560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y,
4299560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
4300560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height,
4301560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)format,
4302560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)type,
4303560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)pixels
4304560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
430584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy
430684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guyexit:
4307560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
430884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        releasePointer(_env, _array, pixels, _exception ? JNI_FALSE : JNI_TRUE);
430984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
431084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (_exception) {
431184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        jniThrowException(_env, _exceptionType, _exceptionMessage);
4312560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4313560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4314560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4315560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glReleaseShaderCompiler ( void ) */
4316560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4317560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glReleaseShaderCompiler__
4318560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this) {
4319560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glReleaseShaderCompiler();
4320560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4321560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4322560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glRenderbufferStorage ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) */
4323560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4324560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glRenderbufferStorage__IIII
4325560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint width, jint height) {
4326560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glRenderbufferStorage(
4327560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4328560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)internalformat,
4329560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
4330560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height
4331560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4332560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4333560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4334560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glSampleCoverage ( GLclampf value, GLboolean invert ) */
4335560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4336560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glSampleCoverage__FZ
4337560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) {
4338560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glSampleCoverage(
4339560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)value,
4340560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)invert
4341560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4342560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4343560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4344560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */
4345560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4346560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glScissor__IIII
4347560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
4348560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glScissor(
4349560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
4350560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y,
4351560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
4352560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height
4353560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4354560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4355560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4356560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
4357560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4358560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glShaderBinary__I_3IIILjava_nio_Buffer_2I
4359560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray shaders_ref, jint offset, jint binaryformat, jobject binary_buf, jint length) {
43602545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
43612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
43622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
4363560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
436417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4365560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *shaders_base = (GLuint *) 0;
4366560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _shadersRemaining;
4367560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *shaders = (GLuint *) 0;
4368560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _binaryRemaining;
4369560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *binary = (GLvoid *) 0;
4370560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4371560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!shaders_ref) {
43722545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
43732545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
43742545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "shaders == null";
4375560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4376560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4377560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
43782545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
43792545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
43802545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
4381560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4382560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4383560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _shadersRemaining = _env->GetArrayLength(shaders_ref) - offset;
4384560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    shaders_base = (GLuint *)
43853b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(shaders_ref, (jboolean *)0);
4386560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    shaders = shaders_base + offset;
4387560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
438884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!binary_buf) {
438984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
439084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
439184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "binary == null";
439284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
439384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
43943b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    binary = (GLvoid *)getPointer(_env, binary_buf, (jarray*)&_array, &_binaryRemaining, &_bufferOffset);
43952ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_binaryRemaining < length) {
43962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
43972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
43982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < length < needed";
43992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
44002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
440117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (binary == NULL) {
440217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
440317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        binary = (GLvoid *) (_binaryBase + _bufferOffset);
440417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4405560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glShaderBinary(
4406560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
4407560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)shaders,
4408560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)binaryformat,
4409560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)binary,
4410560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)length
4411560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4412560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4413560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4414560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
4415560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, binary, JNI_FALSE);
4416560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4417560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (shaders_base) {
44183b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(shaders_ref, (jint*)shaders_base,
4419560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
4420560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
44212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
44222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
44232545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4424560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4425560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4426560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
4427560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4428560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I
4429560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject shaders_buf, jint binaryformat, jobject binary_buf, jint length) {
44302ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
44312ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
44322ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
44333b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _shadersArray = (jintArray) 0;
443417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _shadersBufferOffset = (jint) 0;
44353b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _binaryArray = (jintArray) 0;
443617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _binaryBufferOffset = (jint) 0;
4437560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _shadersRemaining;
4438560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *shaders = (GLuint *) 0;
4439560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _binaryRemaining;
4440560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *binary = (GLvoid *) 0;
4441560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
444284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!shaders_buf) {
444384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
444484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
444584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "shaders == null";
444684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
444784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
44483b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    shaders = (GLuint *)getPointer(_env, shaders_buf, (jarray*)&_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
444984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!binary_buf) {
445084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
445184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
445284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "binary == null";
445384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
445484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
44553b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    binary = (GLvoid *)getPointer(_env, binary_buf, (jarray*)&_binaryArray, &_binaryRemaining, &_binaryBufferOffset);
44562ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_binaryRemaining < length) {
44572ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
44582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
44592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < length < needed";
44602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
44612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
446217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (shaders == NULL) {
44633b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _shadersBase = (char *)_env->GetIntArrayElements(_shadersArray, (jboolean *) 0);
446417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        shaders = (GLuint *) (_shadersBase + _shadersBufferOffset);
446517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
446617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (binary == NULL) {
446717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_binaryArray, (jboolean *) 0);
446817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        binary = (GLvoid *) (_binaryBase + _binaryBufferOffset);
446917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4470560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glShaderBinary(
4471560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
4472560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)shaders,
4473560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)binaryformat,
4474560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)binary,
4475560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)length
4476560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
44772ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
44782ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
4479560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_binaryArray) {
448017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        releasePointer(_env, _binaryArray, binary, JNI_FALSE);
448117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
448217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (_shadersArray) {
44833b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_shadersArray, (jint*)shaders, JNI_ABORT);
4484560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
44852ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
44862ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
44872ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
4488560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4489560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4490560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4491560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint * length ) */
4492560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic
4493560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichvoid
4494560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glShaderSource
4495560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    (JNIEnv *_env, jobject _this, jint shader, jstring string) {
4496560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4497560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!string) {
449824ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        jniThrowException(_env, "java/lang/IllegalArgumentException", "string == null");
4499560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        return;
4500560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4501560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4502560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    const char* nativeString = _env->GetStringUTFChars(string, 0);
4503560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    const char* strings[] = {nativeString};
4504560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glShaderSource(shader, 1, strings, 0);
4505560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _env->ReleaseStringUTFChars(string, nativeString);
4506560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4507560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */
4508560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4509560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glStencilFunc__III
4510560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) {
4511560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glStencilFunc(
4512560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)func,
4513560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)ref,
4514560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)mask
4515560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4516560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4517560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4518560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glStencilFuncSeparate ( GLenum face, GLenum func, GLint ref, GLuint mask ) */
4519560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4520560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glStencilFuncSeparate__IIII
4521560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint face, jint func, jint ref, jint mask) {
4522560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glStencilFuncSeparate(
4523560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)face,
4524560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)func,
4525560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)ref,
4526560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)mask
4527560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4528560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4529560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4530560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glStencilMask ( GLuint mask ) */
4531560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4532560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glStencilMask__I
4533560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint mask) {
4534560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glStencilMask(
4535560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)mask
4536560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4537560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4538560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4539560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glStencilMaskSeparate ( GLenum face, GLuint mask ) */
4540560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4541560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glStencilMaskSeparate__II
4542560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint face, jint mask) {
4543560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glStencilMaskSeparate(
4544560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)face,
4545560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)mask
4546560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4547560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4548560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4549560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */
4550560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4551560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glStencilOp__III
4552560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) {
4553560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glStencilOp(
4554560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)fail,
4555560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)zfail,
4556560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)zpass
4557560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4558560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4559560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4560560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) */
4561560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4562560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glStencilOpSeparate__IIII
4563560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint face, jint fail, jint zfail, jint zpass) {
4564560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glStencilOpSeparate(
4565560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)face,
4566560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)fail,
4567560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)zfail,
4568560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)zpass
4569560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4570560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4571560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4572560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */
4573560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4574560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexImage2D__IIIIIIIILjava_nio_Buffer_2
4575560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) {
457684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    jint _exception = 0;
457784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    const char * _exceptionType = NULL;
457884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    const char * _exceptionMessage = NULL;
4579560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
458017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4581560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4582560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *pixels = (GLvoid *) 0;
4583560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4584560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (pixels_buf) {
45853b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
458617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
458737c9b49ab5eb5a676370fd7081db0967c38e97a6Thomas Tafertshofer    if (pixels_buf && pixels == NULL) {
458817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
458917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
4590560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4591560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexImage2D(
4592560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4593560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)level,
4594560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)internalformat,
4595560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
4596560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height,
4597560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)border,
4598560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)format,
4599560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)type,
4600560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)pixels
4601560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4602560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
4603560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, pixels, JNI_FALSE);
4604560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
460584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (_exception) {
460684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        jniThrowException(_env, _exceptionType, _exceptionMessage);
460784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
4608560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4609560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4610560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */
4611560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4612560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexParameterf__IIF
4613560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
4614560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexParameterf(
4615560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4616560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4617560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)param
4618560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4619560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4620560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4621560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
4622560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4623560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexParameterfv__II_3FI
4624560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
46252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
46262ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
46272ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
4628560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params_base = (GLfloat *) 0;
4629560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4630560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
4631560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4632560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
46332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
46342545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
46352545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
4636560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4637560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4638560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
46392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
46402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
46412545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
4642560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4643560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4644560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
4645560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
46462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
46472545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
46482545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < 1 < needed";
4649560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4650560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4651560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLfloat *)
46523b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(params_ref, (jboolean *)0);
4653560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
4654560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4655560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexParameterfv(
4656560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4657560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4658560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
4659560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4660560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4661560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4662560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
46633b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
4664560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
4665560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
46662545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
46672545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
46682545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4669560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4670560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4671560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
4672560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4673560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexParameterfv__IILjava_nio_FloatBuffer_2
4674560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
46752545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
46762ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
46772ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
46783b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
467917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4680560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4681560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
4682560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
468384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!params_buf) {
468484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
468584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
468684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "params == null";
468784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
468884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
46893b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
4690560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
46912545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
46922545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
46932545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < 1 < needed";
4694560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4695560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
469617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
46973b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
469817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLfloat *) (_paramsBase + _bufferOffset);
469917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4700560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexParameterfv(
4701560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4702560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4703560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
4704560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4705560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4706560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4707560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
47083b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
4709560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
47102545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
47112545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
47122545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4713560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4714560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4715560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */
4716560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4717560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexParameteri__III
4718560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
4719560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexParameteri(
4720560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4721560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4722560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)param
4723560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4724560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4725560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4726560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
4727560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4728560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexParameteriv__II_3II
4729560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
47302545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
47312ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
47322ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
4733560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
4734560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4735560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
4736560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4737560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
47382545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
47392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
47402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
4741560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4742560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4743560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
47442545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
47452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
47462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
4747560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4748560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4749560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
4750560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
47512545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
47522545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
47532545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < 1 < needed";
4754560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4755560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4756560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
47573b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(params_ref, (jboolean *)0);
4758560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
4759560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4760560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexParameteriv(
4761560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4762560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4763560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
4764560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4765560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4766560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4767560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
47683b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
4769560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
4770560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
47712545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
47722545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
47732545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4774560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4775560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4776560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
4777560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4778560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexParameteriv__IILjava_nio_IntBuffer_2
4779560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
47802545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
47812ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
47822ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
47833b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
478417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4785560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4786560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
4787560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
478884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!params_buf) {
478984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
479084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
479184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "params == null";
479284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
479384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
47943b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
4795560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
47962545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
47972545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
47982545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < 1 < needed";
4799560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4800560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
480117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
48023b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
480317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
480417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4805560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexParameteriv(
4806560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4807560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4808560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
4809560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4810560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4811560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4812560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
48133b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
4814560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
48152545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
48162545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
48172545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4818560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4819560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4820560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */
4821560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4822560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
4823560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) {
482484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    jint _exception = 0;
482584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    const char * _exceptionType = NULL;
482684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    const char * _exceptionMessage = NULL;
4827560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
482817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4829560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4830560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *pixels = (GLvoid *) 0;
4831560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4832560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (pixels_buf) {
48333b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
483417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
483537c9b49ab5eb5a676370fd7081db0967c38e97a6Thomas Tafertshofer    if (pixels_buf && pixels == NULL) {
483617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
483717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
4838560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4839560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexSubImage2D(
4840560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4841560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)level,
4842560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)xoffset,
4843560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)yoffset,
4844560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
4845560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height,
4846560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)format,
4847560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)type,
4848560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)pixels
4849560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4850560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
4851560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, pixels, JNI_FALSE);
4852560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
485384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (_exception) {
485484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        jniThrowException(_env, _exceptionType, _exceptionMessage);
485584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
4856560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4857560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4858560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform1f ( GLint location, GLfloat x ) */
4859560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4860560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform1f__IF
4861560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jfloat x) {
4862560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform1f(
4863560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4864560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x
4865560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4866560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4867560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4868560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
4869560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4870560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform1fv__II_3FI
4871560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
48722545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
48732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
48742ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
4875560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v_base = (GLfloat *) 0;
4876560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4877560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
4878560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4879560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
48802545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
48812545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
48822545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
4883560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4884560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4885560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
48862545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
48872545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
48882545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
4889560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4890560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4891560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
48922ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count) {
48932ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
48942ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
48952ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count < needed";
48962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
48972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
4898560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLfloat *)
48993b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(v_ref, (jboolean *)0);
4900560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
4901560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4902560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform1fv(
4903560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4904560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
4905560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
4906560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4907560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4908560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4909560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
49103b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
4911560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
4912560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
49132545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
49142545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
49152545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4916560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4917560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4918560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
4919560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4920560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform1fv__IILjava_nio_FloatBuffer_2
4921560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
49222ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
49232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
49242ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
49253b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
492617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4927560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4928560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
4929560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
493084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!v_buf) {
493184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
493284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
493384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "v == null";
493484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
493584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
49363b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
49372ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count) {
49382ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
49392ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
49402ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count < needed";
49412ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
49422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
494317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
49443b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
494517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLfloat *) (_vBase + _bufferOffset);
494617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4947560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform1fv(
4948560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4949560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
4950560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
4951560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
49522ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
49532ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
4954560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
49553b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
4956560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
49572ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
49582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
49592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
4960560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4961560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4962560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform1i ( GLint location, GLint x ) */
4963560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4964560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform1i__II
4965560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint x) {
4966560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform1i(
4967560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4968560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x
4969560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4970560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4971560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4972560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
4973560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4974560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform1iv__II_3II
4975560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
49762545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
49772ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
49782ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
4979560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v_base = (GLint *) 0;
4980560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4981560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
4982560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4983560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
49842545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
49852545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
49862545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
4987560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4988560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4989560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
49902545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
49912545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
49922545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
4993560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4994560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4995560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
49962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count) {
49972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
49982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
49992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count < needed";
50002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
50012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5002560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLint *)
50033b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(v_ref, (jboolean *)0);
5004560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
5005560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5006560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform1iv(
5007560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5008560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5009560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
5010560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5011560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5012560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5013560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
50143b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
5015560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5016560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
50172545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
50182545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
50192545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5020560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5021560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5022560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
5023560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5024560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform1iv__IILjava_nio_IntBuffer_2
5025560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
50262ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
50272ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
50282ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
50293b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
503017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5031560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5032560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
5033560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
503484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!v_buf) {
503584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
503684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
503784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "v == null";
503884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
503984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
50403b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
50412ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count) {
50422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
50432ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
50442ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count < needed";
50452ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
50462ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
504717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
50483b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
504917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLint *) (_vBase + _bufferOffset);
505017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5051560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform1iv(
5052560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5053560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5054560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
5055560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
50562ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
50572ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
5058560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
50593b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
5060560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
50612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
50622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
50632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5064560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5065560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5066560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform2f ( GLint location, GLfloat x, GLfloat y ) */
5067560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5068560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform2f__IFF
5069560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y) {
5070560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform2f(
5071560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5072560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x,
5073560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)y
5074560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5075560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5076560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5077560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
5078560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5079560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform2fv__II_3FI
5080560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
50812545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
50822ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
50832ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
5084560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v_base = (GLfloat *) 0;
5085560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5086560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
5087560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5088560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
50892545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
50902545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
50912545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
5092560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5093560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5094560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
50952545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
50962545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
50972545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5098560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5099560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5100560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
51012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*2) {
51022ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
51032ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
51042ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count*2 < needed";
51052ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
51062ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5107560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLfloat *)
51083b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(v_ref, (jboolean *)0);
5109560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
5110560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5111560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform2fv(
5112560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5113560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5114560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
5115560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5116560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5117560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5118560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
51193b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
5120560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5121560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
51222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
51232545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
51242545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5125560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5126560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5127560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
5128560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5129560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform2fv__IILjava_nio_FloatBuffer_2
5130560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
51312ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
51322ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
51332ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
51343b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
513517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5136560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5137560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
5138560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
513984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!v_buf) {
514084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
514184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
514284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "v == null";
514384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
514484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
51453b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
51462ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*2) {
51472ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
51482ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
51492ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count*2 < needed";
51502ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
51512ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
515217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
51533b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
515417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLfloat *) (_vBase + _bufferOffset);
515517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5156560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform2fv(
5157560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5158560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5159560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
5160560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
51612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
51622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
5163560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
51643b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
5165560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
51662ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
51672ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
51682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5169560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5170560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5171560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform2i ( GLint location, GLint x, GLint y ) */
5172560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5173560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform2i__III
5174560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint x, jint y) {
5175560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform2i(
5176560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5177560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
5178560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y
5179560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5180560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5181560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5182560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
5183560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5184560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform2iv__II_3II
5185560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
51862545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
51872ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
51882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
5189560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v_base = (GLint *) 0;
5190560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5191560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
5192560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5193560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
51942545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
51952545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
51962545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
5197560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5198560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5199560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
52002545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
52012545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
52022545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5203560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5204560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5205560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
52062ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*2) {
52072ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
52082ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
52092ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count*2 < needed";
52102ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
52112ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5212560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLint *)
52133b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(v_ref, (jboolean *)0);
5214560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
5215560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5216560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform2iv(
5217560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5218560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5219560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
5220560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5221560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5222560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5223560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
52243b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
5225560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5226560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
52272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
52282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
52292545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5230560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5231560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5232560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
5233560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5234560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform2iv__IILjava_nio_IntBuffer_2
5235560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
52362ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
52372ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
52382ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
52393b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
524017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5241560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5242560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
5243560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
524484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!v_buf) {
524584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
524684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
524784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "v == null";
524884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
524984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
52503b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
52512ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*2) {
52522ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
52532ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
52542ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count*2 < needed";
52552ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
52562ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
525717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
52583b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
525917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLint *) (_vBase + _bufferOffset);
526017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5261560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform2iv(
5262560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5263560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5264560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
5265560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
52662ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
52672ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
5268560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
52693b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
5270560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
52712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
52722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
52732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5274560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5275560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5276560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z ) */
5277560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5278560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform3f__IFFF
5279560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z) {
5280560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform3f(
5281560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5282560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x,
5283560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)y,
5284560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)z
5285560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5286560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5287560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5288560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
5289560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5290560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform3fv__II_3FI
5291560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
52922545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
52932ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
52942ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
5295560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v_base = (GLfloat *) 0;
5296560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5297560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
5298560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5299560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
53002545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
53012545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
53022545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
5303560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5304560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5305560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
53062545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
53072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
53082545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5309560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5310560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5311560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
53122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*3) {
53132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
53142ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
53152ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count*3 < needed";
53162ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
53172ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5318560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLfloat *)
53193b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(v_ref, (jboolean *)0);
5320560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
5321560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5322560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform3fv(
5323560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5324560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5325560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
5326560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5327560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5328560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5329560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
53303b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
5331560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5332560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
53332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
53342545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
53352545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5336560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5337560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5338560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
5339560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5340560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform3fv__IILjava_nio_FloatBuffer_2
5341560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
53422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
53432ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
53442ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
53453b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
534617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5347560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5348560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
5349560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
535084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!v_buf) {
535184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
535284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
535384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "v == null";
535484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
535584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
53563b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
53572ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*3) {
53582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
53592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
53602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count*3 < needed";
53612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
53622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
536317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
53643b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
536517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLfloat *) (_vBase + _bufferOffset);
536617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5367560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform3fv(
5368560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5369560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5370560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
5371560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
53722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
53732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
5374560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
53753b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
5376560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
53772ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
53782ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
53792ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5380560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5381560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5382560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform3i ( GLint location, GLint x, GLint y, GLint z ) */
5383560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5384560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform3i__IIII
5385560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z) {
5386560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform3i(
5387560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5388560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
5389560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y,
5390560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)z
5391560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5392560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5393560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5394560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
5395560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5396560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform3iv__II_3II
5397560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
53982545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
53992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
54002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
5401560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v_base = (GLint *) 0;
5402560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5403560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
5404560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5405560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
54062545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
54072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
54082545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
5409560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5410560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5411560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
54122545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
54132545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
54142545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5415560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5416560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5417560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
54182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*3) {
54192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
54202ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
54212ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count*3 < needed";
54222ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
54232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5424560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLint *)
54253b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(v_ref, (jboolean *)0);
5426560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
5427560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5428560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform3iv(
5429560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5430560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5431560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
5432560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5433560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5434560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5435560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
54363b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
5437560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5438560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
54392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
54402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
54412545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5442560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5443560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5444560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
5445560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5446560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform3iv__IILjava_nio_IntBuffer_2
5447560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
54482ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
54492ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
54502ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
54513b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
545217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5453560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5454560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
5455560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
545684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!v_buf) {
545784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
545884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
545984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "v == null";
546084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
546184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
54623b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
54632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*3) {
54642ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
54652ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
54662ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count*3 < needed";
54672ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
54682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
546917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
54703b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
547117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLint *) (_vBase + _bufferOffset);
547217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5473560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform3iv(
5474560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5475560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5476560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
5477560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
54782ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
54792ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
5480560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
54813b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
5482560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
54832ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
54842ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
54852ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5486560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5487560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5488560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
5489560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5490560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform4f__IFFFF
5491560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z, jfloat w) {
5492560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform4f(
5493560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5494560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x,
5495560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)y,
5496560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)z,
5497560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)w
5498560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5499560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5500560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5501560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
5502560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5503560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform4fv__II_3FI
5504560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
55052545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
55062ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
55072ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
5508560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v_base = (GLfloat *) 0;
5509560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5510560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
5511560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5512560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
55132545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
55142545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
55152545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
5516560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5517560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5518560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
55192545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
55202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
55212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5522560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5523560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5524560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
55252ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*4) {
55262ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
55272ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
55282ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count*4 < needed";
55292ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
55302ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5531560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLfloat *)
55323b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(v_ref, (jboolean *)0);
5533560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
5534560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5535560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform4fv(
5536560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5537560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5538560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
5539560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5540560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5541560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5542560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
55433b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
5544560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5545560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
55462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
55472545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
55482545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5549560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5550560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5551560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
5552560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5553560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform4fv__IILjava_nio_FloatBuffer_2
5554560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
55552ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
55562ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
55572ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
55583b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
555917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5560560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5561560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
5562560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
556384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!v_buf) {
556484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
556584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
556684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "v == null";
556784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
556884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
55693b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
55702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*4) {
55712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
55722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
55732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count*4 < needed";
55742ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
55752ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
557617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
55773b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
557817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLfloat *) (_vBase + _bufferOffset);
557917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5580560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform4fv(
5581560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5582560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5583560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
5584560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
55852ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
55862ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
5587560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
55883b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
5589560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
55902ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
55912ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
55922ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5593560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5594560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5595560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w ) */
5596560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5597560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform4i__IIIII
5598560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z, jint w) {
5599560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform4i(
5600560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5601560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
5602560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y,
5603560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)z,
5604560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)w
5605560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5606560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5607560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5608560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
5609560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5610560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform4iv__II_3II
5611560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
56122545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
56132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
56142ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
5615560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v_base = (GLint *) 0;
5616560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5617560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
5618560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5619560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
56202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
56212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
56222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
5623560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5624560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5625560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
56262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
56272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
56282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5629560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5630560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5631560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
56322ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*4) {
56332ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
56342ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
56352ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count*4 < needed";
56362ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
56372ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5638560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLint *)
56393b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(v_ref, (jboolean *)0);
5640560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
5641560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5642560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform4iv(
5643560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5644560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5645560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
5646560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5647560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5648560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5649560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
56503b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
5651560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5652560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
56532545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
56542545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
56552545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5656560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5657560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5658560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
5659560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5660560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform4iv__IILjava_nio_IntBuffer_2
5661560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
56622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
56632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
56642ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
56653b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
566617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5667560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5668560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
5669560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
567084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!v_buf) {
567184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
567284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
567384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "v == null";
567484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
567584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
56763b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
56772ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*4) {
56782ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
56792ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
56802ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count*4 < needed";
56812ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
56822ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
568317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
56843b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
568517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLint *) (_vBase + _bufferOffset);
568617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5687560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform4iv(
5688560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5689560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5690560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
5691560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
56922ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
56932ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
5694560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
56953b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
5696560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
56972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
56982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
56992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5700560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5701560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5702560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5703560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5704560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniformMatrix2fv__IIZ_3FI
5705560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
57062545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
57072ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
57082ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
5709560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value_base = (GLfloat *) 0;
5710560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5711560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value = (GLfloat *) 0;
5712560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5713560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!value_ref) {
57142545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
57152545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
57162545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "value == null";
5717560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5718560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5719560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
57202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
57212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
57222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5723560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5724560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5725560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(value_ref) - offset;
57262ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*4) {
57272ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
57282ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
57292ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count*4 < needed";
57302ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
57312ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5732560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    value_base = (GLfloat *)
57333b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(value_ref, (jboolean *)0);
5734560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    value = value_base + offset;
5735560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5736560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniformMatrix2fv(
5737560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5738560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5739560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)transpose,
5740560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)value
5741560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5742560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5743560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5744560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (value_base) {
57453b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
5746560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5747560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
57482545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
57492545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
57502545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5751560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5752560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5753560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5754560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5755560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2
5756560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
57572ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
57582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
57592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
57603b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
576117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5762560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5763560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value = (GLfloat *) 0;
5764560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
576584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!value_buf) {
576684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
576784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
576884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "value == null";
576984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
577084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
57713b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
57722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*4) {
57732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
57742ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
57752ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count*4 < needed";
57762ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
57772ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
577817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (value == NULL) {
57793b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
578017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        value = (GLfloat *) (_valueBase + _bufferOffset);
578117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5782560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniformMatrix2fv(
5783560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5784560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5785560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)transpose,
5786560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)value
5787560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
57882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
57892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
5790560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
57913b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
5792560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
57932ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
57942ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
57952ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5796560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5797560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5798560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5799560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5800560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniformMatrix3fv__IIZ_3FI
5801560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
58022545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
58032ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
58042ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
5805560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value_base = (GLfloat *) 0;
5806560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5807560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value = (GLfloat *) 0;
5808560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5809560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!value_ref) {
58102545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
58112545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
58122545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "value == null";
5813560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5814560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5815560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
58162545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
58172545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
58182545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5819560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5820560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5821560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(value_ref) - offset;
58222ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*9) {
58232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
58242ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
58252ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count*9 < needed";
58262ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
58272ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5828560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    value_base = (GLfloat *)
58293b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(value_ref, (jboolean *)0);
5830560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    value = value_base + offset;
5831560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5832560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniformMatrix3fv(
5833560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5834560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5835560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)transpose,
5836560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)value
5837560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5838560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5839560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5840560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (value_base) {
58413b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
5842560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5843560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
58442545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
58452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
58462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5847560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5848560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5849560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5850560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5851560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2
5852560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
58532ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
58542ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
58552ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
58563b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
585717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5858560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5859560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value = (GLfloat *) 0;
5860560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
586184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!value_buf) {
586284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
586384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
586484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "value == null";
586584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
586684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
58673b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
58682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*9) {
58692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
58702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
58712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count*9 < needed";
58722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
58732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
587417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (value == NULL) {
58753b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
587617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        value = (GLfloat *) (_valueBase + _bufferOffset);
587717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5878560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniformMatrix3fv(
5879560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5880560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5881560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)transpose,
5882560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)value
5883560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
58842ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
58852ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
5886560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
58873b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
5888560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
58892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
58902ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
58912ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5892560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5893560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5894560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5895560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5896560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniformMatrix4fv__IIZ_3FI
5897560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
58982545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
58992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
59002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
5901560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value_base = (GLfloat *) 0;
5902560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5903560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value = (GLfloat *) 0;
5904560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5905560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!value_ref) {
59062545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
59072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
59082545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "value == null";
5909560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5910560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5911560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
59122545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
59132545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
59142545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5915560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5916560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5917560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(value_ref) - offset;
59182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*16) {
59192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
59202ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
59212ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count*16 < needed";
59222ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
59232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5924560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    value_base = (GLfloat *)
59253b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(value_ref, (jboolean *)0);
5926560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    value = value_base + offset;
5927560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5928560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniformMatrix4fv(
5929560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5930560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5931560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)transpose,
5932560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)value
5933560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5934560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5935560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5936560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (value_base) {
59373b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
5938560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5939560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
59402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
59412545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
59422545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5943560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5944560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5945560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5946560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5947560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2
5948560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
59492ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
59502ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
59512ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
59523b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
595317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5954560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5955560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value = (GLfloat *) 0;
5956560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
595784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!value_buf) {
595884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
595984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
596084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "value == null";
596184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
596284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
59633b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
59642ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*16) {
59652ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
59662ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
59672ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count*16 < needed";
59682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
59692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
597017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (value == NULL) {
59713b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
597217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        value = (GLfloat *) (_valueBase + _bufferOffset);
597317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5974560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniformMatrix4fv(
5975560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5976560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5977560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)transpose,
5978560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)value
5979560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
59802ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
59812ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
5982560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
59833b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
5984560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
59852ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
59862ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
59872ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5988560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5989560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5990560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUseProgram ( GLuint program ) */
5991560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5992560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUseProgram__I
5993560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program) {
5994560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUseProgram(
5995560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program
5996560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5997560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5998560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5999560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glValidateProgram ( GLuint program ) */
6000560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
6001560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glValidateProgram__I
6002560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program) {
6003560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glValidateProgram(
6004560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program
6005560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
6006560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6007560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6008560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib1f ( GLuint indx, GLfloat x ) */
6009560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
6010560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib1f__IF
6011560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloat x) {
6012560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib1f(
6013560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
6014560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x
6015560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
6016560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6017560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6018560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
6019560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
6020560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib1fv__I_3FI
6021560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
60222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
60232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
60242ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
6025560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values_base = (GLfloat *) 0;
6026560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
6027560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
6028560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6029560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!values_ref) {
60302545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
60312545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
60322545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "values == null";
6033560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
6034560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
6035560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
60362545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
60372545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
60382545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
6039560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
6040560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
6041560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(values_ref) - offset;
60422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
60432ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
60442ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
60452ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < 1 < needed";
60462ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
60472ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
6048560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values_base = (GLfloat *)
60493b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(values_ref, (jboolean *)0);
6050560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values = values_base + offset;
6051560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6052560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib1fv(
6053560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
6054560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
6055560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
6056560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6057560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
6058560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (values_base) {
60593b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
6060560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
6061560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
60622545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
60632545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
60642545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
6065560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6066560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6067560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
6068560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
6069560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2
6070560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
60712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
60722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
60732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
60743b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
607517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
6076560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
6077560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
6078560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
607984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!values_buf) {
608084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
608184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
608284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "values == null";
608384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
608484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
60853b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
60862ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
60872ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
60882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
60892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
60902ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
60912ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
609217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (values == NULL) {
60933b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
609417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        values = (GLfloat *) (_valuesBase + _bufferOffset);
609517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
6096560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib1fv(
6097560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
6098560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
6099560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
61002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
61012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
6102560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
61033b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
6104560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
61052ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
61062ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
61072ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
6108560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6109560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6110560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib2f ( GLuint indx, GLfloat x, GLfloat y ) */
6111560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
6112560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib2f__IFF
6113560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y) {
6114560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib2f(
6115560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
6116560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x,
6117560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)y
6118560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
6119560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6120560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6121560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
6122560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
6123560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib2fv__I_3FI
6124560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
61252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
61262ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
61272ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
6128560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values_base = (GLfloat *) 0;
6129560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
6130560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
6131560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6132560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!values_ref) {
61332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
61342545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
61352545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "values == null";
6136560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
6137560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
6138560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
61392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
61402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
61412545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
6142560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
6143560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
6144560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(values_ref) - offset;
61452ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 2) {
61462ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
61472ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
61482ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < 2 < needed";
61492ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
61502ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
6151560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values_base = (GLfloat *)
61523b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(values_ref, (jboolean *)0);
6153560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values = values_base + offset;
6154560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6155560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib2fv(
6156560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
6157560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
6158560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
6159560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6160560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
6161560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (values_base) {
61623b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
6163560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
6164560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
61652545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
61662545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
61672545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
6168560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6169560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6170560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
6171560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
6172560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2
6173560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
61742ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
61752ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
61762ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
61773b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
617817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
6179560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
6180560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
6181560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
618284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!values_buf) {
618384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
618484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
618584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "values == null";
618684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
618784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
61883b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
61892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 2) {
61902ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
61912ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
61922ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 2 < needed";
61932ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
61942ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
619517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (values == NULL) {
61963b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
619717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        values = (GLfloat *) (_valuesBase + _bufferOffset);
619817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
6199560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib2fv(
6200560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
6201560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
6202560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
62032ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
62042ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
6205560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
62063b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
6207560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
62082ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
62092ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
62102ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
6211560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6212560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6213560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib3f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z ) */
6214560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
6215560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib3f__IFFF
6216560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z) {
6217560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib3f(
6218560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
6219560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x,
6220560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)y,
6221560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)z
6222560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
6223560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6224560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6225560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
6226560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
6227560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib3fv__I_3FI
6228560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
62292545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
62302ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
62312ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
6232560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values_base = (GLfloat *) 0;
6233560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
6234560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
6235560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6236560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!values_ref) {
62372545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
62382545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
62392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "values == null";
6240560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
6241560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
6242560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
62432545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
62442545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
62452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
6246560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
6247560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
6248560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(values_ref) - offset;
62492ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 3) {
62502ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
62512ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
62522ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < 3 < needed";
62532ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
62542ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
6255560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values_base = (GLfloat *)
62563b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(values_ref, (jboolean *)0);
6257560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values = values_base + offset;
6258560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6259560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib3fv(
6260560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
6261560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
6262560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
6263560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6264560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
6265560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (values_base) {
62663b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
6267560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
6268560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
62692545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
62702545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
62712545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
6272560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6273560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6274560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
6275560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
6276560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2
6277560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
62782ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
62792ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
62802ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
62813b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
628217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
6283560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
6284560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
6285560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
628684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!values_buf) {
628784cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
628884cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
628984cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "values == null";
629084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
629184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
62923b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
62932ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 3) {
62942ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
62952ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
62962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 3 < needed";
62972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
62982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
629917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (values == NULL) {
63003b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
630117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        values = (GLfloat *) (_valuesBase + _bufferOffset);
630217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
6303560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib3fv(
6304560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
6305560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
6306560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
63072ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
63082ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
6309560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
63103b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
6311560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
63122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
63132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
63142ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
6315560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6316560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6317560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib4f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
6318560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
6319560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib4f__IFFFF
6320560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z, jfloat w) {
6321560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib4f(
6322560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
6323560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x,
6324560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)y,
6325560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)z,
6326560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)w
6327560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
6328560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6329560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6330560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
6331560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
6332560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib4fv__I_3FI
6333560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
63342545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
63352ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
63362ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
6337560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values_base = (GLfloat *) 0;
6338560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
6339560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
6340560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6341560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!values_ref) {
63422545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
63432545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
63442545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "values == null";
6345560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
6346560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
6347560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
63482545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
63492545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
63502545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
6351560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
6352560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
6353560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(values_ref) - offset;
63542ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 4) {
63552ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
63562ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
63572ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < 4 < needed";
63582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
63592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
6360560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values_base = (GLfloat *)
63613b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(values_ref, (jboolean *)0);
6362560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values = values_base + offset;
6363560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6364560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib4fv(
6365560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
6366560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
6367560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
6368560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6369560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
6370560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (values_base) {
63713b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
6372560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
6373560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
63742545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
63752545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
63762545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
6377560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6378560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6379560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
6380560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
6381560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2
6382560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
63832ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
63842ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
63852ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
63863b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
638717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
6388560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
6389560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
6390560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
639184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (!values_buf) {
639284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exception = 1;
639384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionType = "java/lang/IllegalArgumentException";
639484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        _exceptionMessage = "values == null";
639584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        goto exit;
639684cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
63973b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
63982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 4) {
63992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
64002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
64012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 4 < needed";
64022ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
64032ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
640417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (values == NULL) {
64053b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
640617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        values = (GLfloat *) (_valuesBase + _bufferOffset);
640717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
6408560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib4fv(
6409560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
6410560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
6411560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
64122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
64132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
6414560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
64153b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
6416560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
64172ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
64182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
64192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
6420560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6421560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6422224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint offset ) */
6423224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevichstatic void
6424224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevichandroid_glVertexAttribPointer__IIIZII
6425224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich  (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jint offset) {
6426224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich    glVertexAttribPointer(
6427224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLuint)indx,
6428224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLint)size,
6429224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLenum)type,
6430224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLboolean)normalized,
6431224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLsizei)stride,
643201c26ea89d4bbea3cf550e9328742302dd9a2b25Ashok Bhat        reinterpret_cast<GLvoid *>(offset)
6433224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich    );
6434224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich}
6435224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich
6436560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr ) */
6437560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
6438560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I
6439560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jobject ptr_buf, jint remaining) {
644084cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    jint _exception = 0;
644184cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    const char * _exceptionType = NULL;
644284cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    const char * _exceptionMessage = NULL;
6443560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
644417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
6445560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
6446560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *ptr = (GLvoid *) 0;
6447560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6448560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (ptr_buf) {
6449560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        ptr = (GLvoid *) getDirectBufferPointer(_env, ptr_buf);
6450560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        if ( ! ptr ) {
6451560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            return;
6452560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        }
6453560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
6454560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttribPointerBounds(
6455560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
6456560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)size,
6457560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)type,
6458560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)normalized,
6459560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)stride,
6460560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)ptr,
6461560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)remaining
6462560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
646384cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    if (_exception) {
646484cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy        jniThrowException(_env, _exceptionType, _exceptionMessage);
646584cac20dfdff35932901e978e6b6d3da843a2fa7Romain Guy    }
6466560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6467560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6468560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */
6469560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
6470560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glViewport__IIII
6471560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
6472560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glViewport(
6473560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
6474560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y,
6475560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
6476560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height
6477560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
6478560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6479560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6480560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic const char *classPathName = "android/opengl/GLES20";
6481560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
648276f6a86de25e1bf74717e047e55fd44b089673f3Daniel Micaystatic const JNINativeMethod methods[] = {
6483560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"_nativeClassInit", "()V", (void*)nativeClassInit },
6484560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I },
6485560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glAttachShader", "(II)V", (void *) android_glAttachShader__II },
6486560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBindAttribLocation", "(IILjava/lang/String;)V", (void *) android_glBindAttribLocation__IILjava_lang_String_2 },
6487560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II },
6488560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBindFramebuffer", "(II)V", (void *) android_glBindFramebuffer__II },
6489560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBindRenderbuffer", "(II)V", (void *) android_glBindRenderbuffer__II },
6490560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBindTexture", "(II)V", (void *) android_glBindTexture__II },
6491560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBlendColor", "(FFFF)V", (void *) android_glBlendColor__FFFF },
6492560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBlendEquation", "(I)V", (void *) android_glBlendEquation__I },
6493560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBlendEquationSeparate", "(II)V", (void *) android_glBlendEquationSeparate__II },
6494560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II },
6495560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBlendFuncSeparate", "(IIII)V", (void *) android_glBlendFuncSeparate__IIII },
6496560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I },
6497560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 },
6498560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCheckFramebufferStatus", "(I)I", (void *) android_glCheckFramebufferStatus__I },
6499560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glClear", "(I)V", (void *) android_glClear__I },
6500560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF },
6501560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F },
6502560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glClearStencil", "(I)V", (void *) android_glClearStencil__I },
6503560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ },
6504560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCompileShader", "(I)V", (void *) android_glCompileShader__I },
6505560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 },
6506560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
6507560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII },
6508560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII },
6509560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCreateProgram", "()I", (void *) android_glCreateProgram__ },
6510560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCreateShader", "(I)I", (void *) android_glCreateShader__I },
6511560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCullFace", "(I)V", (void *) android_glCullFace__I },
6512560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II },
6513560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 },
6514560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteFramebuffers", "(I[II)V", (void *) android_glDeleteFramebuffers__I_3II },
6515560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2 },
6516560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteProgram", "(I)V", (void *) android_glDeleteProgram__I },
6517560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteRenderbuffers", "(I[II)V", (void *) android_glDeleteRenderbuffers__I_3II },
6518560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2 },
6519560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteShader", "(I)V", (void *) android_glDeleteShader__I },
6520560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II },
6521560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 },
6522560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I },
6523560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z },
6524560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF },
6525560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDetachShader", "(II)V", (void *) android_glDetachShader__II },
6526560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDisable", "(I)V", (void *) android_glDisable__I },
6527560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDisableVertexAttribArray", "(I)V", (void *) android_glDisableVertexAttribArray__I },
6528560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III },
6529224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich{"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII },
6530560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 },
6531560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glEnable", "(I)V", (void *) android_glEnable__I },
6532560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glEnableVertexAttribArray", "(I)V", (void *) android_glEnableVertexAttribArray__I },
6533560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glFinish", "()V", (void *) android_glFinish__ },
6534560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glFlush", "()V", (void *) android_glFlush__ },
6535560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glFramebufferRenderbuffer", "(IIII)V", (void *) android_glFramebufferRenderbuffer__IIII },
6536560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glFramebufferTexture2D", "(IIIII)V", (void *) android_glFramebufferTexture2D__IIIII },
6537560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glFrontFace", "(I)V", (void *) android_glFrontFace__I },
6538560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II },
6539560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 },
6540560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenerateMipmap", "(I)V", (void *) android_glGenerateMipmap__I },
6541560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenFramebuffers", "(I[II)V", (void *) android_glGenFramebuffers__I_3II },
6542560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenFramebuffers__ILjava_nio_IntBuffer_2 },
6543560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenRenderbuffers", "(I[II)V", (void *) android_glGenRenderbuffers__I_3II },
6544560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenRenderbuffers__ILjava_nio_IntBuffer_2 },
6545560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II },
6546560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 },
6547560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetActiveAttrib", "(III[II[II[II[BI)V", (void *) android_glGetActiveAttrib__III_3II_3II_3II_3BI },
6548560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetActiveAttrib", "(IIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;B)V", (void *) android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B },
6549dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer{"glGetActiveAttrib", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveAttrib1 },
6550dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer{"glGetActiveAttrib", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveAttrib2 },
6551560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetActiveUniform", "(III[II[II[II[BI)V", (void *) android_glGetActiveUniform__III_3II_3II_3II_3BI },
6552dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer{"glGetActiveUniform", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveUniform1 },
6553560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetActiveUniform", "(IIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;B)V", (void *) android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B },
6554dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer{"glGetActiveUniform", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveUniform2 },
6555560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetAttachedShaders", "(II[II[II)V", (void *) android_glGetAttachedShaders__II_3II_3II },
6556560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetAttachedShaders", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
6557560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetAttribLocation", "(ILjava/lang/String;)I", (void *) android_glGetAttribLocation__ILjava_lang_String_2 },
6558560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI },
6559560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 },
6560560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II },
6561560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 },
6562560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetError", "()I", (void *) android_glGetError__ },
6563560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI },
6564560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 },
6565560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetFramebufferAttachmentParameteriv", "(III[II)V", (void *) android_glGetFramebufferAttachmentParameteriv__III_3II },
6566560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetFramebufferAttachmentParameteriv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2 },
6567560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II },
6568560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 },
6569560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetProgramiv", "(II[II)V", (void *) android_glGetProgramiv__II_3II },
6570560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetProgramiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetProgramiv__IILjava_nio_IntBuffer_2 },
6571560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetProgramInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetProgramInfoLog },
6572560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetRenderbufferParameteriv", "(II[II)V", (void *) android_glGetRenderbufferParameteriv__II_3II },
6573560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetRenderbufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2 },
6574560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetShaderiv", "(II[II)V", (void *) android_glGetShaderiv__II_3II },
6575560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetShaderiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetShaderiv__IILjava_nio_IntBuffer_2 },
6576560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetShaderInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetShaderInfoLog },
6577560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetShaderPrecisionFormat", "(II[II[II)V", (void *) android_glGetShaderPrecisionFormat__II_3II_3II },
6578560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetShaderPrecisionFormat", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
6579560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetShaderSource", "(II[II[BI)V", (void *) android_glGetShaderSource__II_3II_3BI },
6580560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetShaderSource", "(IILjava/nio/IntBuffer;B)V", (void *) android_glGetShaderSource__IILjava_nio_IntBuffer_2B },
6581dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer{"glGetShaderSource", "(I)Ljava/lang/String;", (void *) android_glGetShaderSource },
6582560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString },
6583560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI },
6584560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 },
6585560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II },
6586560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 },
6587560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetUniformfv", "(II[FI)V", (void *) android_glGetUniformfv__II_3FI },
6588560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetUniformfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetUniformfv__IILjava_nio_FloatBuffer_2 },
6589560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetUniformiv", "(II[II)V", (void *) android_glGetUniformiv__II_3II },
6590560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetUniformiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetUniformiv__IILjava_nio_IntBuffer_2 },
6591560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetUniformLocation", "(ILjava/lang/String;)I", (void *) android_glGetUniformLocation__ILjava_lang_String_2 },
6592560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetVertexAttribfv", "(II[FI)V", (void *) android_glGetVertexAttribfv__II_3FI },
6593560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetVertexAttribfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2 },
6594560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetVertexAttribiv", "(II[II)V", (void *) android_glGetVertexAttribiv__II_3II },
6595560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetVertexAttribiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2 },
6596560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glHint", "(II)V", (void *) android_glHint__II },
6597560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I },
6598560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I },
6599560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glIsFramebuffer", "(I)Z", (void *) android_glIsFramebuffer__I },
6600560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glIsProgram", "(I)Z", (void *) android_glIsProgram__I },
6601560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glIsRenderbuffer", "(I)Z", (void *) android_glIsRenderbuffer__I },
6602560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glIsShader", "(I)Z", (void *) android_glIsShader__I },
6603560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glIsTexture", "(I)Z", (void *) android_glIsTexture__I },
6604560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glLineWidth", "(F)V", (void *) android_glLineWidth__F },
6605560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glLinkProgram", "(I)V", (void *) android_glLinkProgram__I },
6606560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II },
6607560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF },
6608560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 },
6609560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glReleaseShaderCompiler", "()V", (void *) android_glReleaseShaderCompiler__ },
6610560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glRenderbufferStorage", "(IIII)V", (void *) android_glRenderbufferStorage__IIII },
6611560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ },
6612560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glScissor", "(IIII)V", (void *) android_glScissor__IIII },
6613560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glShaderBinary", "(I[IIILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__I_3IIILjava_nio_Buffer_2I },
6614560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glShaderBinary", "(ILjava/nio/IntBuffer;ILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I },
6615560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glShaderSource", "(ILjava/lang/String;)V", (void *) android_glShaderSource },
6616560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III },
6617560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glStencilFuncSeparate", "(IIII)V", (void *) android_glStencilFuncSeparate__IIII },
6618560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glStencilMask", "(I)V", (void *) android_glStencilMask__I },
6619560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glStencilMaskSeparate", "(II)V", (void *) android_glStencilMaskSeparate__II },
6620560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glStencilOp", "(III)V", (void *) android_glStencilOp__III },
6621560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glStencilOpSeparate", "(IIII)V", (void *) android_glStencilOpSeparate__IIII },
6622560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 },
6623560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF },
6624560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI },
6625560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 },
6626560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III },
6627560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II },
6628560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 },
6629560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
6630560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform1f", "(IF)V", (void *) android_glUniform1f__IF },
6631560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform1fv", "(II[FI)V", (void *) android_glUniform1fv__II_3FI },
6632560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform1fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform1fv__IILjava_nio_FloatBuffer_2 },
6633560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform1i", "(II)V", (void *) android_glUniform1i__II },
6634560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform1iv", "(II[II)V", (void *) android_glUniform1iv__II_3II },
6635560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform1iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform1iv__IILjava_nio_IntBuffer_2 },
6636560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform2f", "(IFF)V", (void *) android_glUniform2f__IFF },
6637560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform2fv", "(II[FI)V", (void *) android_glUniform2fv__II_3FI },
6638560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform2fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform2fv__IILjava_nio_FloatBuffer_2 },
6639560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform2i", "(III)V", (void *) android_glUniform2i__III },
6640560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform2iv", "(II[II)V", (void *) android_glUniform2iv__II_3II },
6641560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform2iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform2iv__IILjava_nio_IntBuffer_2 },
6642560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform3f", "(IFFF)V", (void *) android_glUniform3f__IFFF },
6643560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform3fv", "(II[FI)V", (void *) android_glUniform3fv__II_3FI },
6644560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform3fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform3fv__IILjava_nio_FloatBuffer_2 },
6645560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform3i", "(IIII)V", (void *) android_glUniform3i__IIII },
6646560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform3iv", "(II[II)V", (void *) android_glUniform3iv__II_3II },
6647560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform3iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform3iv__IILjava_nio_IntBuffer_2 },
6648560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform4f", "(IFFFF)V", (void *) android_glUniform4f__IFFFF },
6649560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform4fv", "(II[FI)V", (void *) android_glUniform4fv__II_3FI },
6650560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform4fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform4fv__IILjava_nio_FloatBuffer_2 },
6651560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform4i", "(IIIII)V", (void *) android_glUniform4i__IIIII },
6652560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform4iv", "(II[II)V", (void *) android_glUniform4iv__II_3II },
6653560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform4iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform4iv__IILjava_nio_IntBuffer_2 },
6654560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniformMatrix2fv", "(IIZ[FI)V", (void *) android_glUniformMatrix2fv__IIZ_3FI },
6655560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniformMatrix2fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2 },
6656560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniformMatrix3fv", "(IIZ[FI)V", (void *) android_glUniformMatrix3fv__IIZ_3FI },
6657560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniformMatrix3fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2 },
6658560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniformMatrix4fv", "(IIZ[FI)V", (void *) android_glUniformMatrix4fv__IIZ_3FI },
6659560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniformMatrix4fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2 },
6660560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUseProgram", "(I)V", (void *) android_glUseProgram__I },
6661560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glValidateProgram", "(I)V", (void *) android_glValidateProgram__I },
6662560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib1f", "(IF)V", (void *) android_glVertexAttrib1f__IF },
6663560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib1fv", "(I[FI)V", (void *) android_glVertexAttrib1fv__I_3FI },
6664560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib1fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2 },
6665560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib2f", "(IFF)V", (void *) android_glVertexAttrib2f__IFF },
6666560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib2fv", "(I[FI)V", (void *) android_glVertexAttrib2fv__I_3FI },
6667560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib2fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2 },
6668560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib3f", "(IFFF)V", (void *) android_glVertexAttrib3f__IFFF },
6669560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib3fv", "(I[FI)V", (void *) android_glVertexAttrib3fv__I_3FI },
6670560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib3fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2 },
6671560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib4f", "(IFFFF)V", (void *) android_glVertexAttrib4f__IFFFF },
6672560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib4fv", "(I[FI)V", (void *) android_glVertexAttrib4fv__I_3FI },
6673560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib4fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2 },
6674224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich{"glVertexAttribPointer", "(IIIZII)V", (void *) android_glVertexAttribPointer__IIIZII },
6675560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttribPointerBounds", "(IIIZILjava/nio/Buffer;I)V", (void *) android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I },
6676560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glViewport", "(IIII)V", (void *) android_glViewport__IIII },
6677560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich};
6678560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6679560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichint register_android_opengl_jni_GLES20(JNIEnv *_env)
6680560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{
6681560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    int err;
6682560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
6683560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    return err;
6684560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6685