android_opengl_GLES20.cpp revision 3b1d46e809ed38cd5662c110c511b8d98868ed72
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-but-set-variable"
22bfe6333c3cf529600f41f14e3b8c5846e632c9a2Andreas Gampe#pragma GCC diagnostic ignored "-Wunused-function"
23bfe6333c3cf529600f41f14e3b8c5846e632c9a2Andreas Gampe
242ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#include <GLES2/gl2.h>
252ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#include <GLES2/gl2ext.h>
262ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
279626f8203a8c222b8960a49cdc66d540fdb688b0Jesse Hall#include <jni.h>
289626f8203a8c222b8960a49cdc66d540fdb688b0Jesse Hall#include <JNIHelp.h>
29560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich#include <android_runtime/AndroidRuntime.h>
30560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich#include <utils/misc.h>
31560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich#include <assert.h>
32560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
33560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic int initialized = 0;
34560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
35560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jclass nioAccessClass;
36560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jclass bufferClass;
37560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jmethodID getBasePointerID;
38560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jmethodID getBaseArrayID;
39560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jmethodID getBaseArrayOffsetID;
40560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jfieldID positionID;
41560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jfieldID limitID;
42560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jfieldID elementSizeShiftID;
43560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
442ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
452ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian/* special calls implemented in Android's GLES wrapper used to more
462ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian * efficiently bound-check passed arrays */
472ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianextern "C" {
482ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#ifdef GL_VERSION_ES_CM_1_1
492ad0477f16c64dc3126741933f11e27353521bb4Mathias AgopianGL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
502ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        const GLvoid *ptr, GLsizei count);
512ad0477f16c64dc3126741933f11e27353521bb4Mathias AgopianGL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
522ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        const GLvoid *pointer, GLsizei count);
532ad0477f16c64dc3126741933f11e27353521bb4Mathias AgopianGL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
542ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        GLsizei stride, const GLvoid *pointer, GLsizei count);
552ad0477f16c64dc3126741933f11e27353521bb4Mathias AgopianGL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
562ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        GLsizei stride, const GLvoid *pointer, GLsizei count);
572ad0477f16c64dc3126741933f11e27353521bb4Mathias AgopianGL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        GLsizei stride, const GLvoid *pointer, GLsizei count);
592ad0477f16c64dc3126741933f11e27353521bb4Mathias AgopianGL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        GLsizei stride, const GLvoid *pointer, GLsizei count);
612ad0477f16c64dc3126741933f11e27353521bb4Mathias AgopianGL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        GLsizei stride, const GLvoid *pointer, GLsizei count);
632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#endif
642ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#ifdef GL_ES_VERSION_2_0
652ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianstatic void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type,
662ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) {
672ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    glVertexAttribPointer(indx, size, type, normalized, stride, pointer);
682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian}
692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#endif
70cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden#ifdef GL_ES_VERSION_3_0
71cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFaddenstatic void glVertexAttribIPointerBounds(GLuint indx, GLint size, GLenum type,
72cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden        GLsizei stride, const GLvoid *pointer, GLsizei count) {
73cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    glVertexAttribIPointer(indx, size, type, stride, pointer);
74cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden}
75cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden#endif
762ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian}
772ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
78560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* Cache method IDs each time the class is loaded. */
79560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
80560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
8124ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott HughesnativeClassInit(JNIEnv *_env, jclass glImplClass)
82560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{
83560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
84560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
85560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
86560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
87560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
88560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
89560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
90560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            "getBasePointer", "(Ljava/nio/Buffer;)J");
91560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
92560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
93560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
94560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
95560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
96560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    positionID = _env->GetFieldID(bufferClass, "position", "I");
97560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    limitID = _env->GetFieldID(bufferClass, "limit", "I");
98560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    elementSizeShiftID =
99560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
100560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
101560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
102560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void *
10317045a16575ece34cfadb63da4791f115625df78Thomas TafertshofergetPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
104560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{
105560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint position;
106560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint limit;
107560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint elementSizeShift;
108560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jlong pointer;
109560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
110560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    position = _env->GetIntField(buffer, positionID);
111560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    limit = _env->GetIntField(buffer, limitID);
112560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
113560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    *remaining = (limit - position) << elementSizeShift;
114560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    pointer = _env->CallStaticLongMethod(nioAccessClass,
115560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            getBasePointerID, buffer);
116560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (pointer != 0L) {
117560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        *array = NULL;
11801c26ea89d4bbea3cf550e9328742302dd9a2b25Ashok Bhat        return reinterpret_cast<void*>(pointer);
119560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
12024ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes
121560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
122560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            getBaseArrayID, buffer);
12317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    *offset = _env->CallStaticIntMethod(nioAccessClass,
124560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            getBaseArrayOffsetID, buffer);
12524ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes
12617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    return NULL;
127560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
128560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1293b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass ByteArrayGetter {
1303b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1313b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
1323b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        return _env->GetByteArrayElements(array, is_copy);
1333b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
1343b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
1353b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass BooleanArrayGetter {
1363b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1373b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
1383b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        return _env->GetBooleanArrayElements(array, is_copy);
1393b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
1403b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
1413b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass CharArrayGetter {
1423b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1433b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
1443b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        return _env->GetCharArrayElements(array, is_copy);
1453b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
1463b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
1473b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass ShortArrayGetter {
1483b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1493b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
1503b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        return _env->GetShortArrayElements(array, is_copy);
1513b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
1523b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
1533b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass IntArrayGetter {
1543b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1553b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
1563b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        return _env->GetIntArrayElements(array, is_copy);
1573b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
1583b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
1593b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass LongArrayGetter {
1603b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1613b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
1623b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        return _env->GetLongArrayElements(array, is_copy);
1633b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
1643b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
1653b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass FloatArrayGetter {
1663b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1673b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
1683b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        return _env->GetFloatArrayElements(array, is_copy);
1693b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
1703b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
1713b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass DoubleArrayGetter {
1723b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1733b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
1743b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        return _env->GetDoubleArrayElements(array, is_copy);
1753b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
1763b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
1773b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi
1783b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchitemplate<typename JTYPEARRAY, typename ARRAYGETTER>
1793b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchistatic void*
1803b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi YamauchigetArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
1813b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    return ARRAYGETTER::Get(_env, array, is_copy);
1823b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi}
1833b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi
1843b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass ByteArrayReleaser {
1853b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1863b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
1873b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
1883b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
1893b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
1903b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass BooleanArrayReleaser {
1913b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1923b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
1933b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
1943b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
1953b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
1963b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass CharArrayReleaser {
1973b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
1983b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
1993b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
2003b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
2013b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
2023b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass ShortArrayReleaser {
2033b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
2043b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
2053b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
2063b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
2073b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
2083b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass IntArrayReleaser {
2093b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
2103b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
2113b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
2123b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
2133b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
2143b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass LongArrayReleaser {
2153b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
2163b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
2173b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
2183b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
2193b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
2203b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass FloatArrayReleaser {
2213b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
2223b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
2233b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
2243b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
2253b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
2263b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchiclass DoubleArrayReleaser {
2273b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchipublic:
2283b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
2293b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
2303b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    }
2313b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi};
2323b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi
2333b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchitemplate<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
2343b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchistatic void
2353b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi YamauchireleaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
2363b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    ARRAYRELEASER::Release(_env, array, data, commit);
2373b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi}
2383b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi
239560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
240560814f6b11abe83ff0c4ed18cac015c276b3181Jack PalevichreleasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
241560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{
242560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _env->ReleasePrimitiveArrayCritical(array, data,
2432ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian                       commit ? 0 : JNI_ABORT);
244560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
245560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
246560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void *
247560814f6b11abe83ff0c4ed18cac015c276b3181Jack PalevichgetDirectBufferPointer(JNIEnv *_env, jobject buffer) {
248560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    char* buf = (char*) _env->GetDirectBufferAddress(buffer);
249560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (buf) {
250560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        jint position = _env->GetIntField(buffer, positionID);
251560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
252560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        buf += position << elementSizeShift;
253560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    } else {
25424ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        jniThrowException(_env, "java/lang/IllegalArgumentException",
25524ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes                          "Must use a native order direct Buffer");
256560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
257560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    return (void*) buf;
258560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
259560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian// --------------------------------------------------------------------------
2612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
2622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian/*
2632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian * returns the number of values glGet returns for a given pname.
2642ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian *
2652ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian * The code below is written such that pnames requiring only one values
2662ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian * are the default (and are not explicitely tested for). This makes the
2672ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian * checking code much shorter/readable/efficient.
2682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian *
2692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian * This means that unknown pnames (e.g.: extensions) will default to 1. If
2702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian * that unknown pname needs more than 1 value, then the validation check
2712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian * is incomplete and the app may crash if it passed the wrong number params.
2722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian */
2732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianstatic int getNeededCount(GLint pname) {
2742ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    int needed = 1;
2752ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#ifdef GL_ES_VERSION_2_0
2762ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    // GLES 2.x pnames
2772ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    switch (pname) {
2782ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_ALIASED_LINE_WIDTH_RANGE:
2792ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_ALIASED_POINT_SIZE_RANGE:
2802ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            needed = 2;
2812ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
2822ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
2832ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_BLEND_COLOR:
2842ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_COLOR_CLEAR_VALUE:
2852ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_COLOR_WRITEMASK:
2862ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_SCISSOR_BOX:
2872ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_VIEWPORT:
2882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            needed = 4;
2892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
2902ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
2912ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_COMPRESSED_TEXTURE_FORMATS:
2922ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
2932ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
2942ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
2952ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_SHADER_BINARY_FORMATS:
2962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed);
2972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
2982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
2992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#endif
3002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
3012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#ifdef GL_VERSION_ES_CM_1_1
3022ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    // GLES 1.x pnames
3032ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    switch (pname) {
3042ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_ALIASED_LINE_WIDTH_RANGE:
3052ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_ALIASED_POINT_SIZE_RANGE:
3062ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_DEPTH_RANGE:
3072ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_SMOOTH_LINE_WIDTH_RANGE:
3082ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_SMOOTH_POINT_SIZE_RANGE:
3092ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            needed = 2;
3102ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
3112ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
3122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_CURRENT_NORMAL:
3132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_POINT_DISTANCE_ATTENUATION:
3142ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            needed = 3;
3152ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
3162ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
3172ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_COLOR_CLEAR_VALUE:
3182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_COLOR_WRITEMASK:
3192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_CURRENT_COLOR:
3202ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_CURRENT_TEXTURE_COORDS:
3212ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_FOG_COLOR:
3222ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_LIGHT_MODEL_AMBIENT:
3232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_SCISSOR_BOX:
3242ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_VIEWPORT:
3252ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            needed = 4;
3262ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
3272ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
3282ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_MODELVIEW_MATRIX:
3292ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_PROJECTION_MATRIX:
3302ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_TEXTURE_MATRIX:
3312ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            needed = 16;
3322ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
3332ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
3342ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_COMPRESSED_TEXTURE_FORMATS:
3352ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
3362ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
3372ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3382ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#endif
3392ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    return needed;
340560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
341560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3423b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchitemplate <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
3433b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi          typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
3442ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianstatic void
3452ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianget
3462ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian  (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
3472ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
3482ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType;
3492ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage;
3502ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    CTYPE *params_base = (CTYPE *) 0;
3512ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _remaining;
3522ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    CTYPE *params = (CTYPE *) 0;
3532ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    int _needed = 0;
3542ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
3552ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (!params_ref) {
3562ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
3572ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
3582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "params == null";
3592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
3602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (offset < 0) {
3622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
3632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
3642ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "offset < 0";
3652ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
3662ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3672ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    _remaining = _env->GetArrayLength(params_ref) - offset;
3682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    _needed = getNeededCount(pname);
3692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    // if we didn't find this pname, we just assume the user passed
3702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    // an array of the right size -- this might happen with extensions
3712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    // or if we forget an enum here.
3722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < _needed) {
3732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
3742ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
3752ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < needed";
3762ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
3772ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3783b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
3793b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env, params_ref, (jboolean *)0);
3802ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    params = params_base + offset;
3812ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
3822ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    GET(
3832ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        (GLenum)pname,
3842ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        (CTYPE *)params
3852ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    );
3862ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
3872ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
3882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (params_base) {
3893b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
3903b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi            _env, params_ref, params_base, !_exception);
3912ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3922ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
3932ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
3942ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3952ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian}
3962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
3972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
3983b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchitemplate <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
3993b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi          typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
4002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianstatic void
4012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopiangetarray
4022ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
4032ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
4042ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType;
4052ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage;
4063b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    JTYPEARRAY _array = (JTYPEARRAY) 0;
4072ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _bufferOffset = (jint) 0;
4082ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _remaining;
4092ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    CTYPE *params = (CTYPE *) 0;
4102ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    int _needed = 0;
4112ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
4123b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
413cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    _remaining /= sizeof(CTYPE);    // convert from bytes to item count
4142ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    _needed = getNeededCount(pname);
4152ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    // if we didn't find this pname, we just assume the user passed
4162ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    // an array of the right size -- this might happen with extensions
4172ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    // or if we forget an enum here.
4182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_needed>0 && _remaining < _needed) {
4192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
4202ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
4212ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < needed";
4222ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
4232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
4242ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (params == NULL) {
4253b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
4263b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi            _env, _array, (jboolean *) 0);
4272ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        params = (CTYPE *) (_paramsBase + _bufferOffset);
4282ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
4292ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    GET(
4302ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        (GLenum)pname,
4312ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        (CTYPE *)params
4322ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    );
4332ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
4342ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
4352ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_array) {
4363b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
4373b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi            _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
4382ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
4392ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
4402ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
4412ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
442560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
443560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
444560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich// --------------------------------------------------------------------------
445560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glActiveTexture ( GLenum texture ) */
446560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
447560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glActiveTexture__I
448560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint texture) {
449560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glActiveTexture(
450560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)texture
451560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
452560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
453560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
454560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glAttachShader ( GLuint program, GLuint shader ) */
455560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
456560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glAttachShader__II
457560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint shader) {
458560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glAttachShader(
459560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
460560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader
461560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
462560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
463560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
464560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBindAttribLocation ( GLuint program, GLuint index, const char *name ) */
465560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
466560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBindAttribLocation__IILjava_lang_String_2
467560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint index, jstring name) {
4682545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
4692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
4702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
471560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    const char* _nativename = 0;
472560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
473560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!name) {
474428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes        _exception = 1;
4752545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
4762545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "name == null";
477560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
478560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
479560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _nativename = _env->GetStringUTFChars(name, 0);
480560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
481560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBindAttribLocation(
482560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
483560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
484560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (char *)_nativename
485560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
486560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
487560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
488560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_nativename) {
489560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleaseStringUTFChars(name, _nativename);
490560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
491560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4922545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
4932545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
4942545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
495560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
496560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
497560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBindBuffer ( GLenum target, GLuint buffer ) */
498560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
499560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBindBuffer__II
500560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint buffer) {
501560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBindBuffer(
502560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
503560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)buffer
504560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
505560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
506560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
507560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBindFramebuffer ( GLenum target, GLuint framebuffer ) */
508560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
509560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBindFramebuffer__II
510560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint framebuffer) {
511560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBindFramebuffer(
512560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
513560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)framebuffer
514560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
515560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
516560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
517560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBindRenderbuffer ( GLenum target, GLuint renderbuffer ) */
518560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
519560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBindRenderbuffer__II
520560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint renderbuffer) {
521560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBindRenderbuffer(
522560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
523560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)renderbuffer
524560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
525560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
526560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
527560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBindTexture ( GLenum target, GLuint texture ) */
528560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
529560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBindTexture__II
530560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint texture) {
531560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBindTexture(
532560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
533560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)texture
534560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
535560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
536560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
537560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBlendColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
538560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
539560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBlendColor__FFFF
540560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
541560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBlendColor(
542560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)red,
543560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)green,
544560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)blue,
545560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)alpha
546560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
547560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
548560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
549560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBlendEquation ( GLenum mode ) */
550560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
551560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBlendEquation__I
552560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint mode) {
55373108675c944ab4ee89631dced23566b12341b66Jack Palevich    glBlendEquation(
55473108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)mode
55573108675c944ab4ee89631dced23566b12341b66Jack Palevich    );
556560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
557560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
558560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBlendEquationSeparate ( GLenum modeRGB, GLenum modeAlpha ) */
559560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
560560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBlendEquationSeparate__II
561560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint modeRGB, jint modeAlpha) {
56273108675c944ab4ee89631dced23566b12341b66Jack Palevich    glBlendEquationSeparate(
56373108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)modeRGB,
56473108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)modeAlpha
56573108675c944ab4ee89631dced23566b12341b66Jack Palevich    );
566560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
567560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
568560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */
569560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
570560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBlendFunc__II
571560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) {
572560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBlendFunc(
573560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)sfactor,
574560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)dfactor
575560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
576560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
577560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
578560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBlendFuncSeparate ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) */
579560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
580560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBlendFuncSeparate__IIII
581560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) {
58273108675c944ab4ee89631dced23566b12341b66Jack Palevich    glBlendFuncSeparate(
58373108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)srcRGB,
58473108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)dstRGB,
58573108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)srcAlpha,
58673108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)dstAlpha
58773108675c944ab4ee89631dced23566b12341b66Jack Palevich    );
588560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
589560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
590560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */
591560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
592560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBufferData__IILjava_nio_Buffer_2I
593560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) {
5942545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
5952ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
5962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
597560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
59817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
599560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
600560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *data = (GLvoid *) 0;
601560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
602560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (data_buf) {
6033b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
604560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        if (_remaining < size) {
6052545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer            _exception = 1;
6062545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer            _exceptionType = "java/lang/IllegalArgumentException";
6072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer            _exceptionMessage = "remaining() < size < needed";
608560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            goto exit;
609560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        }
610560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
61137c9b49ab5eb5a676370fd7081db0967c38e97a6Thomas Tafertshofer    if (data_buf && data == NULL) {
61217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
61317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        data = (GLvoid *) (_dataBase + _bufferOffset);
61417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
615560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBufferData(
616560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
617560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizeiptr)size,
618560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)data,
619560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)usage
620560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
621560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
622560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
623560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
624560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, data, JNI_FALSE);
625560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
6262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
6272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
6282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
629560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
630560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
631560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */
632560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
633560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBufferSubData__IIILjava_nio_Buffer_2
634560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) {
6352545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
6362ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
6372ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
638560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
63917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
640560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
641560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *data = (GLvoid *) 0;
642560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6433b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
644560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < size) {
6452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
6462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
6472545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < size < needed";
648560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
649560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
65017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (data == NULL) {
65117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
65217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        data = (GLvoid *) (_dataBase + _bufferOffset);
65317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
654560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBufferSubData(
655560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
656560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLintptr)offset,
657560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizeiptr)size,
658560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)data
659560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
660560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
661560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
662560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
663560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, data, JNI_FALSE);
664560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
6652545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
6662545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
6672545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
668560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
669560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
670560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLenum glCheckFramebufferStatus ( GLenum target ) */
671560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jint
672560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCheckFramebufferStatus__I
673560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target) {
674560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum _returnValue;
675560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glCheckFramebufferStatus(
676560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target
677560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
678cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jint)_returnValue;
679560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
680560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
681560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glClear ( GLbitfield mask ) */
682560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
683560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glClear__I
684560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint mask) {
685560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glClear(
686560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLbitfield)mask
687560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
688560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
689560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
690560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
691560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
692560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glClearColor__FFFF
693560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
694560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glClearColor(
695560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)red,
696560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)green,
697560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)blue,
698560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)alpha
699560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
700560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
701560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
702560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glClearDepthf ( GLclampf depth ) */
703560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
704560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glClearDepthf__F
705560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jfloat depth) {
706560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glClearDepthf(
707560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)depth
708560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
709560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
710560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
711560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glClearStencil ( GLint s ) */
712560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
713560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glClearStencil__I
714560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint s) {
715560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glClearStencil(
716560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)s
717560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
718560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
719560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
720560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */
721560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
722560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glColorMask__ZZZZ
723560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) {
724560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glColorMask(
725560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)red,
726560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)green,
727560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)blue,
728560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)alpha
729560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
730560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
731560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
732560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glCompileShader ( GLuint shader ) */
733560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
734560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCompileShader__I
735560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shader) {
736560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glCompileShader(
737560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader
738560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
739560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
740560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
741560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */
742560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
743560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2
744560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) {
745560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
74617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
747560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
748560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *data = (GLvoid *) 0;
749560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
7503b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
75117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (data == NULL) {
75217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
75317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        data = (GLvoid *) (_dataBase + _bufferOffset);
75417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
755560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glCompressedTexImage2D(
756560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
757560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)level,
758560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)internalformat,
759560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
760560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height,
761560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)border,
762560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)imageSize,
763560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)data
764560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
765560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
766560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, data, JNI_FALSE);
767560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
768560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
769560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
770560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */
771560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
772560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
773560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) {
774560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
77517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
776560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
777560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *data = (GLvoid *) 0;
778560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
7793b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
78017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (data == NULL) {
78117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
78217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        data = (GLvoid *) (_dataBase + _bufferOffset);
78317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
784560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glCompressedTexSubImage2D(
785560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
786560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)level,
787560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)xoffset,
788560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)yoffset,
789560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
790560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height,
791560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)format,
792560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)imageSize,
793560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)data
794560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
795560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
796560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, data, JNI_FALSE);
797560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
798560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
799560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
800560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */
801560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
802560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCopyTexImage2D__IIIIIIII
803560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) {
804560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glCopyTexImage2D(
805560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
806560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)level,
807560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)internalformat,
808560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
809560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y,
810560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
811560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height,
812560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)border
813560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
814560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
815560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
816560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */
817560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
818560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCopyTexSubImage2D__IIIIIIII
819560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) {
820560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glCopyTexSubImage2D(
821560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
822560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)level,
823560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)xoffset,
824560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)yoffset,
825560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
826560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y,
827560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
828560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height
829560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
830560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
831560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
832560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLuint glCreateProgram ( void ) */
833560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jint
834560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCreateProgram__
835560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this) {
836560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint _returnValue;
837560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glCreateProgram();
838cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jint)_returnValue;
839560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
840560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
841560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLuint glCreateShader ( GLenum type ) */
842560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jint
843560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCreateShader__I
844560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint type) {
845560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint _returnValue;
846560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glCreateShader(
847560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)type
848560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
849cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jint)_returnValue;
850560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
851560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
852560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glCullFace ( GLenum mode ) */
853560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
854560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCullFace__I
855560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint mode) {
856560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glCullFace(
857560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)mode
858560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
859560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
860560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
861560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
862560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
863560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteBuffers__I_3II
864560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
8652545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
8662ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
8672ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
868560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *buffers_base = (GLuint *) 0;
869560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
870560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *buffers = (GLuint *) 0;
871560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
872560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!buffers_ref) {
8732545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
8742545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
8752545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "buffers == null";
876560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
877560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
878560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
8792545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
8802545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
8812545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
882560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
883560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
884560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(buffers_ref) - offset;
885560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
8862545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
8872545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
8882545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < n < needed";
889560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
890560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
891560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    buffers_base = (GLuint *)
8923b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
893560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    buffers = buffers_base + offset;
894560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
895560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteBuffers(
896560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
897560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)buffers
898560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
899560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
900560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
901560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (buffers_base) {
9023b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
903560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
904560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
9052545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
9062545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
9072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
908560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
909560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
910560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
911560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
912560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteBuffers__ILjava_nio_IntBuffer_2
913560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
9142545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
9152ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
9162ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
9173b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
91817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
919560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
920560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *buffers = (GLuint *) 0;
921560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
9223b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
923560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
9242545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
9252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
9262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < n < needed";
927560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
928560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
92917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (buffers == NULL) {
9303b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
93117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        buffers = (GLuint *) (_buffersBase + _bufferOffset);
93217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
933560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteBuffers(
934560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
935560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)buffers
936560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
937560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
938560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
939560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
9403b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)buffers, JNI_ABORT);
941560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
9422545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
9432545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
9442545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
945560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
946560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
947560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */
948560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
949560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteFramebuffers__I_3II
950560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
9512545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
9522ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
9532ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
954560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *framebuffers_base = (GLuint *) 0;
955560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
956560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *framebuffers = (GLuint *) 0;
957560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
958560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!framebuffers_ref) {
9592545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
9602545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
9612545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "framebuffers == null";
962560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
963560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
964560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
9652545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
9662545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
9672545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
968560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
969560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
970560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
9712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < n) {
9722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
9732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
9742ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < n < needed";
9752ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
9762ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
977560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    framebuffers_base = (GLuint *)
9783b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0);
979560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    framebuffers = framebuffers_base + offset;
980560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
981560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteFramebuffers(
982560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
983560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)framebuffers
984560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
985560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
986560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
987560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (framebuffers_base) {
9883b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base,
989560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
990560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
9912545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
9922545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
9932545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
994560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
995560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
996560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */
997560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
998560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteFramebuffers__ILjava_nio_IntBuffer_2
999560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
10002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
10012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
10022ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
10033b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
100417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1005560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1006560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *framebuffers = (GLuint *) 0;
1007560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
10083b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
10092ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < n) {
10102ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
10112ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
10122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < n < needed";
10132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
10142ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
101517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (framebuffers == NULL) {
10163b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
101717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
101817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1019560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteFramebuffers(
1020560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1021560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)framebuffers
1022560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
10232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
10242ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
1025560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
10263b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, JNI_ABORT);
1027560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
10282ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
10292ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
10302ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
1031560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1032560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1033560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteProgram ( GLuint program ) */
1034560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1035560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteProgram__I
1036560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program) {
1037560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteProgram(
1038560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program
1039560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1040560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1041560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1042560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */
1043560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1044560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteRenderbuffers__I_3II
1045560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
10462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
10472ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
10482ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
1049560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *renderbuffers_base = (GLuint *) 0;
1050560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1051560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *renderbuffers = (GLuint *) 0;
1052560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1053560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!renderbuffers_ref) {
10542545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
10552545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
10562545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "renderbuffers == null";
1057560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1058560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1059560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
10602545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
10612545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
10622545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
1063560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1064560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1065560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
10662ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < n) {
10672ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
10682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
10692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < n < needed";
10702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
10712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
1072560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    renderbuffers_base = (GLuint *)
10733b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0);
1074560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    renderbuffers = renderbuffers_base + offset;
1075560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1076560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteRenderbuffers(
1077560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1078560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)renderbuffers
1079560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1080560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1081560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1082560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (renderbuffers_base) {
10833b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base,
1084560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
1085560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
10862545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
10872545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
10882545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1089560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1090560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1091560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */
1092560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1093560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2
1094560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
10952ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
10962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
10972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
10983b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
109917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1100560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1101560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *renderbuffers = (GLuint *) 0;
1102560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
11033b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
11042ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < n) {
11052ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
11062ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
11072ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < n < needed";
11082ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
11092ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
111017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (renderbuffers == NULL) {
11113b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
111217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
111317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1114560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteRenderbuffers(
1115560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1116560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)renderbuffers
1117560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
11182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
11192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
1120560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
11213b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, JNI_ABORT);
1122560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
11232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
11242ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
11252ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
1126560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1127560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1128560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteShader ( GLuint shader ) */
1129560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1130560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteShader__I
1131560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shader) {
1132560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteShader(
1133560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader
1134560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1135560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1136560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1137560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
1138560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1139560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteTextures__I_3II
1140560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
11412545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
11422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
11432ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
1144560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *textures_base = (GLuint *) 0;
1145560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1146560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *textures = (GLuint *) 0;
1147560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1148560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!textures_ref) {
11492545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
11502545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
11512545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "textures == null";
1152560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1153560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1154560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
11552545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
11562545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
11572545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
1158560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1159560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1160560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(textures_ref) - offset;
1161560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
11622545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
11632545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
11642545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < n < needed";
1165560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1166560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1167560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    textures_base = (GLuint *)
11683b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(textures_ref, (jboolean *)0);
1169560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    textures = textures_base + offset;
1170560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1171560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteTextures(
1172560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1173560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)textures
1174560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1175560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1176560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1177560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (textures_base) {
11783b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base,
1179560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
1180560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
11812545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
11822545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
11832545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1184560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1185560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1186560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
1187560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1188560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteTextures__ILjava_nio_IntBuffer_2
1189560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
11902545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
11912ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
11922ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
11933b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
119417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1195560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1196560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *textures = (GLuint *) 0;
1197560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
11983b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1199560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
12002545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
12012545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
12022545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < n < needed";
1203560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1204560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
120517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (textures == NULL) {
12063b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
120717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        textures = (GLuint *) (_texturesBase + _bufferOffset);
120817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1209560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteTextures(
1210560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1211560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)textures
1212560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1213560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1214560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1215560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
12163b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)textures, JNI_ABORT);
1217560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
12182545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
12192545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
12202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1221560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1222560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1223560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDepthFunc ( GLenum func ) */
1224560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1225560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDepthFunc__I
1226560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint func) {
1227560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDepthFunc(
1228560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)func
1229560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1230560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1231560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1232560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDepthMask ( GLboolean flag ) */
1233560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1234560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDepthMask__Z
1235560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jboolean flag) {
1236560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDepthMask(
1237560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)flag
1238560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1239560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1240560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1241560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */
1242560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1243560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDepthRangef__FF
1244560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) {
1245560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDepthRangef(
1246560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)zNear,
1247560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)zFar
1248560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1249560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1250560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1251560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDetachShader ( GLuint program, GLuint shader ) */
1252560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1253560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDetachShader__II
1254560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint shader) {
1255560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDetachShader(
1256560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
1257560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader
1258560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1259560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1260560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1261560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDisable ( GLenum cap ) */
1262560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1263560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDisable__I
1264560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint cap) {
1265560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDisable(
1266560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)cap
1267560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1268560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1269560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1270560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDisableVertexAttribArray ( GLuint index ) */
1271560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1272560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDisableVertexAttribArray__I
1273560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint index) {
1274560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDisableVertexAttribArray(
1275560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index
1276560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1277560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1278560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1279560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */
1280560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1281560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDrawArrays__III
1282560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) {
1283560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDrawArrays(
1284560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)mode,
1285560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)first,
1286560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count
1287560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1288560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1289560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1290224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */
1291224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevichstatic void
1292224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevichandroid_glDrawElements__IIII
1293224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich  (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) {
12942545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
12952ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
12962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
1297224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich    glDrawElements(
1298224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLenum)mode,
1299224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLsizei)count,
1300224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLenum)type,
130101c26ea89d4bbea3cf550e9328742302dd9a2b25Ashok Bhat        reinterpret_cast<GLvoid *>(offset)
1302224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich    );
13032545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
13042545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
13052545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1306224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich}
1307224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich
1308560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */
1309560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1310560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDrawElements__IIILjava_nio_Buffer_2
1311560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) {
13122545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
13132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
13142ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
1315560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
131617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1317560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1318560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *indices = (GLvoid *) 0;
1319560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
13203b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    indices = (GLvoid *)getPointer(_env, indices_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1321560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < count) {
13222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
13232545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
13242545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < count < needed";
1325560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1326560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
132717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (indices == NULL) {
132817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
132917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        indices = (GLvoid *) (_indicesBase + _bufferOffset);
133017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1331560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDrawElements(
1332560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)mode,
1333560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
1334560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)type,
1335560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)indices
1336560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1337560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1338560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1339560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
1340560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, indices, JNI_FALSE);
1341560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
13422545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
13432545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
13442545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1345560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1346560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1347560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glEnable ( GLenum cap ) */
1348560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1349560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glEnable__I
1350560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint cap) {
1351560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glEnable(
1352560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)cap
1353560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1354560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1355560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1356560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glEnableVertexAttribArray ( GLuint index ) */
1357560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1358560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glEnableVertexAttribArray__I
1359560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint index) {
1360560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glEnableVertexAttribArray(
1361560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index
1362560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1363560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1364560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1365560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glFinish ( void ) */
1366560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1367560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glFinish__
1368560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this) {
1369560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glFinish();
1370560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1371560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1372560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glFlush ( void ) */
1373560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1374560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glFlush__
1375560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this) {
1376560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glFlush();
1377560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1378560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1379560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glFramebufferRenderbuffer ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) */
1380560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1381560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glFramebufferRenderbuffer__IIII
1382560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint renderbuffertarget, jint renderbuffer) {
1383560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glFramebufferRenderbuffer(
1384560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
1385560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)attachment,
1386560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)renderbuffertarget,
1387560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)renderbuffer
1388560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1389560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1390560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1391560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glFramebufferTexture2D ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) */
1392560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1393560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glFramebufferTexture2D__IIIII
1394560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint textarget, jint texture, jint level) {
1395560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glFramebufferTexture2D(
1396560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
1397560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)attachment,
1398560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)textarget,
1399560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)texture,
1400560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)level
1401560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1402560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1403560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1404560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glFrontFace ( GLenum mode ) */
1405560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1406560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glFrontFace__I
1407560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint mode) {
1408560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glFrontFace(
1409560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)mode
1410560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1411560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1412560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1413560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
1414560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1415560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenBuffers__I_3II
1416560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
1417560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
14182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
14192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
1420560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *buffers_base = (GLuint *) 0;
1421560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1422560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *buffers = (GLuint *) 0;
1423560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1424560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!buffers_ref) {
1425560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
14262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
14272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "buffers == null";
1428560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1429560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1430560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
1431560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
14322545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
14332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
1434560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1435560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1436560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(buffers_ref) - offset;
1437560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
1438560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
14392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
14402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < n < needed";
1441560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1442560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1443560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    buffers_base = (GLuint *)
14443b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
1445560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    buffers = buffers_base + offset;
1446560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1447560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenBuffers(
1448560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1449560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)buffers
1450560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1451560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1452560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1453560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (buffers_base) {
14543b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
1455560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1456560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
14572545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
14582545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
14592545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1460560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1461560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1462560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
1463560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1464560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenBuffers__ILjava_nio_IntBuffer_2
1465560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
1466560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
14672ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
14682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
14693b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
147017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1471560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1472560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *buffers = (GLuint *) 0;
1473560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
14743b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1475560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
1476560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
14772545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
14782545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < n < needed";
1479560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1480560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
148117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (buffers == NULL) {
14823b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
148317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        buffers = (GLuint *) (_buffersBase + _bufferOffset);
148417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1485560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenBuffers(
1486560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1487560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)buffers
1488560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1489560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1490560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1491560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
14923b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)buffers, _exception ? JNI_ABORT : 0);
1493560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
14942545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
14952545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
14962545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1497560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1498560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1499560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenerateMipmap ( GLenum target ) */
1500560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1501560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenerateMipmap__I
1502560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target) {
1503560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenerateMipmap(
1504560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target
1505560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1506560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1507560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1508560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */
1509560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1510560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenFramebuffers__I_3II
1511560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
1512560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
15132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
15142ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
1515560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *framebuffers_base = (GLuint *) 0;
1516560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1517560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *framebuffers = (GLuint *) 0;
1518560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1519560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!framebuffers_ref) {
1520560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
15212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
15222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "framebuffers == null";
1523560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1524560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1525560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
1526560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
15272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
15282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
1529560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1530560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1531560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
15322ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < n) {
15332ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
15342ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
15352ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < n < needed";
15362ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
15372ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
1538560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    framebuffers_base = (GLuint *)
15393b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0);
1540560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    framebuffers = framebuffers_base + offset;
1541560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1542560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenFramebuffers(
1543560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1544560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)framebuffers
1545560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1546560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1547560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1548560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (framebuffers_base) {
15493b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base,
1550560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1551560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
15522545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
15532545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
15542545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1555560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1556560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1557560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */
1558560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1559560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenFramebuffers__ILjava_nio_IntBuffer_2
1560560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
15612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
15622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
15632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
15643b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
156517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1566560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1567560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *framebuffers = (GLuint *) 0;
1568560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
15693b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
15702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < n) {
15712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
15722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
15732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < n < needed";
15742ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
15752ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
157617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (framebuffers == NULL) {
15773b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
157817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
157917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1580560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenFramebuffers(
1581560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1582560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)framebuffers
1583560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
15842ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
15852ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
1586560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
15873b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, _exception ? JNI_ABORT : 0);
15882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
15892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
15902ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
1591560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1592560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1593560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1594560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */
1595560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1596560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenRenderbuffers__I_3II
1597560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
1598560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
15992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
16002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
1601560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *renderbuffers_base = (GLuint *) 0;
1602560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1603560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *renderbuffers = (GLuint *) 0;
1604560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1605560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!renderbuffers_ref) {
1606560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
16072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
16082545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "renderbuffers == null";
1609560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1610560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1611560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
1612560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
16132545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
16142545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
1615560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1616560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1617560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
16182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < n) {
16192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
16202ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
16212ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < n < needed";
16222ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
16232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
1624560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    renderbuffers_base = (GLuint *)
16253b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0);
1626560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    renderbuffers = renderbuffers_base + offset;
1627560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1628560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenRenderbuffers(
1629560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1630560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)renderbuffers
1631560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1632560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1633560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1634560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (renderbuffers_base) {
16353b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base,
1636560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1637560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
16382545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
16392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
16402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1641560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1642560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1643560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */
1644560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1645560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenRenderbuffers__ILjava_nio_IntBuffer_2
1646560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
16472ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
16482ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
16492ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
16503b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
165117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1652560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1653560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *renderbuffers = (GLuint *) 0;
1654560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
16553b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
16562ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < n) {
16572ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
16582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
16592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < n < needed";
16602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
16612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
166217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (renderbuffers == NULL) {
16633b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
166417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
166517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1666560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenRenderbuffers(
1667560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1668560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)renderbuffers
1669560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
16702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
16712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
1672560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
16733b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, _exception ? JNI_ABORT : 0);
16742ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
16752ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
16762ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
1677560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1678560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1679560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1680560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1681560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1682560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenTextures__I_3II
1683560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
1684560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
16852ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
16862ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
1687560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *textures_base = (GLuint *) 0;
1688560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1689560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *textures = (GLuint *) 0;
1690560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1691560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!textures_ref) {
1692560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
16932545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
16942545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "textures == null";
1695560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1696560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1697560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
1698560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
16992545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
17002545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
1701560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1702560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1703560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(textures_ref) - offset;
1704560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
1705560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
17062545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
17072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < n < needed";
1708560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1709560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1710560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    textures_base = (GLuint *)
17113b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(textures_ref, (jboolean *)0);
1712560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    textures = textures_base + offset;
1713560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1714560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenTextures(
1715560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1716560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)textures
1717560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1718560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1719560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1720560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (textures_base) {
17213b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base,
1722560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1723560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
17242545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
17252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
17262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1727560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1728560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1729560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1730560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1731560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenTextures__ILjava_nio_IntBuffer_2
1732560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
1733560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
17342ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
17352ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
17363b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
173717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1738560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1739560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *textures = (GLuint *) 0;
1740560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
17413b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1742560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
1743560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
17442545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
17452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < n < needed";
1746560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1747560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
174817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (textures == NULL) {
17493b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
175017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        textures = (GLuint *) (_texturesBase + _bufferOffset);
175117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1752560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenTextures(
1753560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1754560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)textures
1755560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1756560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1757560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1758560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
17593b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)textures, _exception ? JNI_ABORT : 0);
1760560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
17612545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
17622545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
17632545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1764560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1765560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1766560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1767560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1768560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetActiveAttrib__III_3II_3II_3II_3BI
1769560814f6b11abe83ff0c4ed18cac015c276b3181Jack 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) {
1770560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
17712545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    const char * _exceptionType;
17722545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    const char * _exceptionMessage;
1773560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length_base = (GLsizei *) 0;
1774560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _lengthRemaining;
1775560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length = (GLsizei *) 0;
1776560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *size_base = (GLint *) 0;
1777560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _sizeRemaining;
1778560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *size = (GLint *) 0;
1779560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum *type_base = (GLenum *) 0;
1780560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _typeRemaining;
1781560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum *type = (GLenum *) 0;
1782560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    char *name_base = (char *) 0;
1783560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _nameRemaining;
1784560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    char *name = (char *) 0;
1785560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1786560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!length_ref) {
1787560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
17882545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
17892545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length == null";
1790560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1791560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1792560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (lengthOffset < 0) {
1793560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
17942545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
17952545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "lengthOffset < 0";
1796560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1797560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1798560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
1799560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    length_base = (GLsizei *)
18003b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(length_ref, (jboolean *)0);
1801560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    length = length_base + lengthOffset;
1802560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1803560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!size_ref) {
1804560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
18052545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
18062545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "size == null";
1807560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1808560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1809560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (sizeOffset < 0) {
1810560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
18112545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
18122545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "sizeOffset < 0";
1813560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1814560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1815560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
1816560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    size_base = (GLint *)
18173b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(size_ref, (jboolean *)0);
1818560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    size = size_base + sizeOffset;
1819560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1820560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!type_ref) {
1821560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
18222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
18232545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "type == null";
1824560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1825560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1826560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (typeOffset < 0) {
1827560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
18282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
18292545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "typeOffset < 0";
1830560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1831560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1832560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
1833560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    type_base = (GLenum *)
18343b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(type_ref, (jboolean *)0);
1835560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    type = type_base + typeOffset;
1836560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1837560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!name_ref) {
1838560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
18392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
18402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "name == null";
1841560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1842560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1843560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (nameOffset < 0) {
1844560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
18452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
18462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "nameOffset < 0";
1847560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1848560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1849560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
1850560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    name_base = (char *)
18513b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetByteArrayElements(name_ref, (jboolean *)0);
1852560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    name = name_base + nameOffset;
1853560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1854560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetActiveAttrib(
1855560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
1856560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
1857560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)bufsize,
1858560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)length,
1859560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)size,
1860560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum *)type,
1861560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (char *)name
1862560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1863560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1864560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1865560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (name_base) {
18663b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
1867560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1868560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1869560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (type_base) {
18703b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
1871560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1872560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1873560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (size_base) {
18743b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
1875560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1876560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1877560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (length_base) {
18783b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
1879560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1880560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
18812545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
18822545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
18832545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1884560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1885560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1886560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1887560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1888560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
1889560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
18903b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _lengthArray = (jintArray) 0;
189117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _lengthBufferOffset = (jint) 0;
18923b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _sizeArray = (jintArray) 0;
189317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _sizeBufferOffset = (jint) 0;
18943b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _typeArray = (jintArray) 0;
189517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _typeBufferOffset = (jint) 0;
1896560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _lengthRemaining;
1897560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length = (GLsizei *) 0;
1898560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _sizeRemaining;
1899560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *size = (GLint *) 0;
1900560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _typeRemaining;
1901560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum *type = (GLenum *) 0;
1902560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
19033b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
19043b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
19053b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
190617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (length == NULL) {
19073b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
190817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
190917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
191017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (size == NULL) {
19113b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
191217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        size = (GLint *) (_sizeBase + _sizeBufferOffset);
191317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
191417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (type == NULL) {
19153b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
191617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        type = (GLenum *) (_typeBase + _typeBufferOffset);
191717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1918560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetActiveAttrib(
1919560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
1920560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
1921560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)bufsize,
1922560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)length,
1923560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)size,
1924560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum *)type,
192501c26ea89d4bbea3cf550e9328742302dd9a2b25Ashok Bhat        reinterpret_cast<char *>(name)
1926560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
192717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (_typeArray) {
19283b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
1929560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1930560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_sizeArray) {
19313b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
1932560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
193317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (_lengthArray) {
19343b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
1935560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1936560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1937560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1938dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1939dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferstatic jstring
1940dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferandroid_glGetActiveAttrib1
1941dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer  (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
1942dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _exception = 0;
1943dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    const char * _exceptionType;
1944dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    const char * _exceptionMessage;
1945dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint *size_base = (GLint *) 0;
1946dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _sizeRemaining;
1947dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint *size = (GLint *) 0;
1948dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLenum *type_base = (GLenum *) 0;
1949dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _typeRemaining;
1950dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLenum *type = (GLenum *) 0;
1951dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
1952dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jstring result = 0;
1953dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
1954dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint len = 0;
1955dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
1956dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!len) {
1957dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return _env->NewStringUTF("");
1958dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1959dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    char* buf = (char*) malloc(len);
1960dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
1961dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf == NULL) {
1962dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
1963dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return NULL;
1964dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1965dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!size_ref) {
1966dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
1967dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
1968dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "size == null";
1969dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
1970dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1971dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (sizeOffset < 0) {
1972dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
1973dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
1974dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "sizeOffset < 0";
1975dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
1976dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1977dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
1978dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    size_base = (GLint *)
19793b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(size_ref, (jboolean *)0);
1980dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    size = size_base + sizeOffset;
1981dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
1982dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!type_ref) {
1983dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
1984dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
1985dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "type == null";
1986dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
1987dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1988dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (typeOffset < 0) {
1989dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
1990dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
1991dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "typeOffset < 0";
1992dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
1993dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1994dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
1995dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    type_base = (GLenum *)
19963b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(type_ref, (jboolean *)0);
1997dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    type = type_base + typeOffset;
1998dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
1999dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetActiveAttrib(
2000dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)program,
2001dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)index,
2002dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLsizei)len,
2003dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        NULL,
2004dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLint *)size,
2005dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLenum *)type,
2006dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (char *)buf
2007dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    );
2008dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferexit:
2009dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (type_base) {
20103b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
2011dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer            _exception ? JNI_ABORT: 0);
2012dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2013dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (size_base) {
20143b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
2015dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer            _exception ? JNI_ABORT: 0);
2016dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2017dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_exception != 1) {
2018dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        result = _env->NewStringUTF(buf);
2019dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2020dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf) {
2021dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        free(buf);
2022dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2023dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_exception) {
2024dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
2025dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2026dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (result == 0) {
2027dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        result = _env->NewStringUTF("");
2028dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2029dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2030dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    return result;
2031dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer}
2032dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2033dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2034dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferstatic jstring
2035dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferandroid_glGetActiveAttrib2
2036dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer  (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
20373b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _sizeArray = (jintArray) 0;
2038dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _sizeBufferOffset = (jint) 0;
20393b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _typeArray = (jintArray) 0;
2040dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _typeBufferOffset = (jint) 0;
2041dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _lengthRemaining;
2042dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLsizei *length = (GLsizei *) 0;
2043dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _sizeRemaining;
2044dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint *size = (GLint *) 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
20623b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
20633b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
2064dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (size == NULL) {
20653b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
2066dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        size = (GLint *) (_sizeBase + _sizeBufferOffset);
2067dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2068dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (type == NULL) {
20693b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
2070dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        type = (GLenum *) (_typeBase + _typeBufferOffset);
2071dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2072dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetActiveAttrib(
2073dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)program,
2074dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)index,
2075dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLsizei)len,
2076dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        NULL,
2077dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLint *)size,
2078dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLenum *)type,
2079dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (char *)buf
2080dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    );
2081dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2082dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_typeArray) {
20833b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
2084dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2085dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_sizeArray) {
20863b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
2087dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2088dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    result = _env->NewStringUTF(buf);
2089dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf) {
2090dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        free(buf);
2091dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2092dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    return result;
2093dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer}
2094560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2095560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2096560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetActiveUniform__III_3II_3II_3II_3BI
2097560814f6b11abe83ff0c4ed18cac015c276b3181Jack 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) {
2098560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
20992545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    const char * _exceptionType;
21002545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    const char * _exceptionMessage;
2101560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length_base = (GLsizei *) 0;
2102560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _lengthRemaining;
2103560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length = (GLsizei *) 0;
2104560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *size_base = (GLint *) 0;
2105560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _sizeRemaining;
2106560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *size = (GLint *) 0;
2107560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum *type_base = (GLenum *) 0;
2108560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _typeRemaining;
2109560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum *type = (GLenum *) 0;
2110560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    char *name_base = (char *) 0;
2111560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _nameRemaining;
2112560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    char *name = (char *) 0;
2113560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2114560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!length_ref) {
2115560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
21162545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
21172545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length == null";
2118560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2119560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2120560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (lengthOffset < 0) {
2121560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
21222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
21232545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "lengthOffset < 0";
2124560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2125560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2126560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
2127560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    length_base = (GLsizei *)
21283b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(length_ref, (jboolean *)0);
2129560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    length = length_base + lengthOffset;
2130560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2131560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!size_ref) {
2132560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
21332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
21342545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "size == null";
2135560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2136560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2137560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (sizeOffset < 0) {
2138560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
21392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
21402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "sizeOffset < 0";
2141560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2142560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2143560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2144560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    size_base = (GLint *)
21453b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(size_ref, (jboolean *)0);
2146560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    size = size_base + sizeOffset;
2147560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2148560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!type_ref) {
2149560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
21502545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
21512545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "type == null";
2152560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2153560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2154560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (typeOffset < 0) {
2155560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
21562545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
21572545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "typeOffset < 0";
2158560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2159560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2160560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2161560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    type_base = (GLenum *)
21623b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(type_ref, (jboolean *)0);
2163560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    type = type_base + typeOffset;
2164560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2165560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!name_ref) {
2166560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
21672545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
21682545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "name == null";
2169560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2170560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2171560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (nameOffset < 0) {
2172560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
21732545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
21742545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "nameOffset < 0";
2175560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2176560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2177560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
2178560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    name_base = (char *)
21793b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetByteArrayElements(name_ref, (jboolean *)0);
2180560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    name = name_base + nameOffset;
2181560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2182560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetActiveUniform(
2183560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
2184560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
2185560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)bufsize,
2186560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)length,
2187560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)size,
2188560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum *)type,
2189560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (char *)name
2190560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
2191560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2192560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
2193560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (name_base) {
21943b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
2195560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2196560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2197560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (type_base) {
21983b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
2199560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2200560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2201560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (size_base) {
22023b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
2203560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2204560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2205560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (length_base) {
22063b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
2207560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2208560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
22092545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
22102545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
22112545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2212560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2213560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2214560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2215560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2216560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
2217560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
22183b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _lengthArray = (jintArray) 0;
221917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _lengthBufferOffset = (jint) 0;
22203b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _sizeArray = (jintArray) 0;
222117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _sizeBufferOffset = (jint) 0;
22223b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _typeArray = (jintArray) 0;
222317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _typeBufferOffset = (jint) 0;
2224560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _lengthRemaining;
2225560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length = (GLsizei *) 0;
2226560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _sizeRemaining;
2227560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *size = (GLint *) 0;
2228560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _typeRemaining;
2229560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum *type = (GLenum *) 0;
2230560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
22313b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
22323b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
22333b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
223417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (length == NULL) {
22353b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
223617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
223717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
223817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (size == NULL) {
22393b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
224017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        size = (GLint *) (_sizeBase + _sizeBufferOffset);
224117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
224217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (type == NULL) {
22433b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
224417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        type = (GLenum *) (_typeBase + _typeBufferOffset);
224517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
2246560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetActiveUniform(
2247560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
2248560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
2249560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)bufsize,
2250560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)length,
2251560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)size,
2252560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum *)type,
225301c26ea89d4bbea3cf550e9328742302dd9a2b25Ashok Bhat        reinterpret_cast<char *>(name)
2254560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
225517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (_typeArray) {
22563b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
2257560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2258560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_sizeArray) {
22593b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
2260560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
226117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (_lengthArray) {
22623b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
2263560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2264560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2265560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2266dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2267dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferstatic jstring
2268dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferandroid_glGetActiveUniform1
2269dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer  (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
2270dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _exception = 0;
2271dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    const char * _exceptionType;
2272dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    const char * _exceptionMessage;
2273dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2274dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint *size_base = (GLint *) 0;
2275dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _sizeRemaining;
2276dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint *size = (GLint *) 0;
2277dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2278dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLenum *type_base = (GLenum *) 0;
2279dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _typeRemaining;
2280dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLenum *type = (GLenum *) 0;
2281dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2282dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jstring result = 0;
2283dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2284dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint len = 0;
2285dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
2286dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!len) {
2287dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return _env->NewStringUTF("");
2288dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2289dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    char* buf = (char*) malloc(len);
2290dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2291dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf == NULL) {
2292dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2293dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return NULL;
2294dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2295dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2296dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!size_ref) {
2297dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
2298dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
2299dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "size == null";
2300dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
2301dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2302dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (sizeOffset < 0) {
2303dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
2304dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
2305dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "sizeOffset < 0";
2306dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
2307dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2308dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2309dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    size_base = (GLint *)
23103b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(size_ref, (jboolean *)0);
2311dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    size = size_base + sizeOffset;
2312dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2313dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!type_ref) {
2314dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
2315dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
2316dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "type == null";
2317dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
2318dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2319dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (typeOffset < 0) {
2320dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
2321dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
2322dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "typeOffset < 0";
2323dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
2324dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2325dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2326dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    type_base = (GLenum *)
23273b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(type_ref, (jboolean *)0);
2328dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    type = type_base + typeOffset;
2329dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2330dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetActiveUniform(
2331dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)program,
2332dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)index,
2333dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLsizei)len,
2334dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        NULL,
2335dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLint *)size,
2336dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLenum *)type,
2337dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (char *)buf
2338dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    );
2339dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2340dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferexit:
2341dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (type_base) {
23423b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
2343dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer            _exception ? JNI_ABORT: 0);
2344dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2345dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (size_base) {
23463b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
2347dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer            _exception ? JNI_ABORT: 0);
2348dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2349dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_exception != 1) {
2350dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        result = _env->NewStringUTF(buf);
2351dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2352dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf) {
2353dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        free(buf);
2354dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2355dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_exception) {
2356dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
2357dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2358dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (result == 0) {
2359dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        result = _env->NewStringUTF("");
2360dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2361dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    return result;
2362dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer}
2363dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2364dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2365dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferstatic jstring
2366dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferandroid_glGetActiveUniform2
2367dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer  (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
23683b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _sizeArray = (jintArray) 0;
2369dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _sizeBufferOffset = (jint) 0;
23703b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _typeArray = (jintArray) 0;
2371dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _typeBufferOffset = (jint) 0;
2372dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _sizeRemaining;
2373dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint *size = (GLint *) 0;
2374dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _typeRemaining;
2375dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLenum *type = (GLenum *) 0;
2376dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2377dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jstring result = 0;
2378dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint len = 0;
2379dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
2380dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!len) {
2381dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return _env->NewStringUTF("");
2382dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2383dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    char* buf = (char*) malloc(len);
2384dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2385dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf == NULL) {
2386dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2387dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return NULL;
2388dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2389dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
23903b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
23913b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
2392dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2393dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (size == NULL) {
23943b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
2395dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        size = (GLint *) (_sizeBase + _sizeBufferOffset);
2396dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2397dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (type == NULL) {
23983b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
2399dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        type = (GLenum *) (_typeBase + _typeBufferOffset);
2400dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2401dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetActiveUniform(
2402dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)program,
2403dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)index,
2404dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        len,
2405dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        NULL,
2406dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLint *)size,
2407dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLenum *)type,
2408dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (char *)buf
2409dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    );
2410dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2411dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_typeArray) {
24123b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
2413dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2414dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_sizeArray) {
24153b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
2416dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2417dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    result = _env->NewStringUTF(buf);
2418dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf) {
2419dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        free(buf);
2420dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2421dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    return result;
2422dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer}
2423560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */
2424560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2425560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetAttachedShaders__II_3II_3II
2426560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint maxcount, jintArray count_ref, jint countOffset, jintArray shaders_ref, jint shadersOffset) {
2427560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
24282ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
24292ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
2430560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *count_base = (GLsizei *) 0;
2431560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _countRemaining;
2432560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *count = (GLsizei *) 0;
2433560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *shaders_base = (GLuint *) 0;
2434560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _shadersRemaining;
2435560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *shaders = (GLuint *) 0;
2436560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2437560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!count_ref) {
2438560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
24392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
24402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "count == null";
2441560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2442560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2443560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (countOffset < 0) {
2444560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
24452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
24462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "countOffset < 0";
2447560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2448560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2449560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _countRemaining = _env->GetArrayLength(count_ref) - countOffset;
24502ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_countRemaining < 1) {
24512ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
24522ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
24532ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - countOffset < 1 < needed";
24542ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
24552ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
2456560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    count_base = (GLsizei *)
24573b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(count_ref, (jboolean *)0);
2458560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    count = count_base + countOffset;
2459560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2460560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!shaders_ref) {
2461560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
24622545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
24632545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "shaders == null";
2464560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2465560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2466560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (shadersOffset < 0) {
2467560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
24682545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
24692545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "shadersOffset < 0";
2470560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2471560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2472560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _shadersRemaining = _env->GetArrayLength(shaders_ref) - shadersOffset;
24732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_shadersRemaining < maxcount) {
24742ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
24752ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
24762ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - shadersOffset < maxcount < needed";
24772ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
24782ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
2479560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    shaders_base = (GLuint *)
24803b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(shaders_ref, (jboolean *)0);
2481560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    shaders = shaders_base + shadersOffset;
2482560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2483560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetAttachedShaders(
2484560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
2485560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)maxcount,
2486560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)count,
2487560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)shaders
2488560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
2489560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2490560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
2491560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (shaders_base) {
24923b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(shaders_ref, (jint*)shaders_base,
2493560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2494560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2495560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (count_base) {
24963b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(count_ref, (jint*)count_base,
2497560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2498560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
24992545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
25002545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
25012545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2502560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2503560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2504560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */
2505560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2506560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
2507560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint maxcount, jobject count_buf, jobject shaders_buf) {
25082ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
25092ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
25102ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
25113b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _countArray = (jintArray) 0;
251217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _countBufferOffset = (jint) 0;
25133b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _shadersArray = (jintArray) 0;
251417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _shadersBufferOffset = (jint) 0;
2515560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _countRemaining;
2516560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *count = (GLsizei *) 0;
2517560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _shadersRemaining;
2518560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *shaders = (GLuint *) 0;
2519560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
25202ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (count_buf) {
25213b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        count = (GLsizei *)getPointer(_env, count_buf, (jarray*)&_countArray, &_countRemaining, &_countBufferOffset);
25222ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        if (_countRemaining < 1) {
25232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _exception = 1;
25242ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _exceptionType = "java/lang/IllegalArgumentException";
25252ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _exceptionMessage = "remaining() < 1 < needed";
25262ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            goto exit;
25272ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        }
25282ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
25292ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (shaders_buf) {
25303b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        shaders = (GLuint *)getPointer(_env, shaders_buf, (jarray*)&_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
25312ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        if (_shadersRemaining < maxcount) {
25322ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _exception = 1;
25332ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _exceptionType = "java/lang/IllegalArgumentException";
25342ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _exceptionMessage = "remaining() < maxcount < needed";
25352ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            goto exit;
25362ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        }
25372ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
25382ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (count_buf && count == NULL) {
25393b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _countBase = (char *)_env->GetIntArrayElements(_countArray, (jboolean *) 0);
25402ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        count = (GLsizei *) (_countBase + _countBufferOffset);
25412ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
25422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (shaders_buf && shaders == NULL) {
25433b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _shadersBase = (char *)_env->GetIntArrayElements(_shadersArray, (jboolean *) 0);
254417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        shaders = (GLuint *) (_shadersBase + _shadersBufferOffset);
254517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
2546560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetAttachedShaders(
2547560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
2548560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)maxcount,
2549560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)count,
2550560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)shaders
2551560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
25522ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
25532ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
2554560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_shadersArray) {
25553b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_shadersArray, (jint*)shaders, _exception ? JNI_ABORT : 0);
255617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
255717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (_countArray) {
25583b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_countArray, (jint*)count, _exception ? JNI_ABORT : 0);
25592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
25602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
25612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
2562560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2563560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2564560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
256589be00bcda2b5965757e83bdf70a650b64373045Mathias Agopian/* GLint glGetAttribLocation ( GLuint program, const char *name ) */
2566560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jint
2567560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetAttribLocation__ILjava_lang_String_2
2568560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jstring name) {
25692545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
25702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
25712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
257289be00bcda2b5965757e83bdf70a650b64373045Mathias Agopian    GLint _returnValue = 0;
2573560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    const char* _nativename = 0;
2574560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2575560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!name) {
2576428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes        _exception = 1;
25772545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
25782545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "name == null";
2579560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2580560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2581560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _nativename = _env->GetStringUTFChars(name, 0);
2582560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2583560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glGetAttribLocation(
2584560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
2585560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (char *)_nativename
2586560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
2587560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2588560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
2589560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_nativename) {
2590560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleaseStringUTFChars(name, _nativename);
2591560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2592560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
25932545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
25942545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
25952545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2596cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jint)_returnValue;
2597560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2598560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2599560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
2600560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2601560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetBooleanv__I_3ZI
2602560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
26033b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    get<jbooleanArray, BooleanArrayGetter, jboolean*, BooleanArrayReleaser, GLboolean, glGetBooleanv>(
26043b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env, _this, pname, params_ref, offset);
2605560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2606560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2607560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
2608560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2609560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetBooleanv__ILjava_nio_IntBuffer_2
2610560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
26113b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    getarray<GLboolean, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetBooleanv>(
26123b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env, _this, pname, params_buf);
2613560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2614560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2615560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2616560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetBufferParameteriv__II_3II
2617560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
261873108675c944ab4ee89631dced23566b12341b66Jack Palevich    jint _exception = 0;
26192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
26202ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
262173108675c944ab4ee89631dced23566b12341b66Jack Palevich    GLint *params_base = (GLint *) 0;
262273108675c944ab4ee89631dced23566b12341b66Jack Palevich    jint _remaining;
262373108675c944ab4ee89631dced23566b12341b66Jack Palevich    GLint *params = (GLint *) 0;
262473108675c944ab4ee89631dced23566b12341b66Jack Palevich
262573108675c944ab4ee89631dced23566b12341b66Jack Palevich    if (!params_ref) {
262673108675c944ab4ee89631dced23566b12341b66Jack Palevich        _exception = 1;
26272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
26282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
262973108675c944ab4ee89631dced23566b12341b66Jack Palevich        goto exit;
263073108675c944ab4ee89631dced23566b12341b66Jack Palevich    }
263173108675c944ab4ee89631dced23566b12341b66Jack Palevich    if (offset < 0) {
263273108675c944ab4ee89631dced23566b12341b66Jack Palevich        _exception = 1;
26332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
26342545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
263573108675c944ab4ee89631dced23566b12341b66Jack Palevich        goto exit;
263673108675c944ab4ee89631dced23566b12341b66Jack Palevich    }
263773108675c944ab4ee89631dced23566b12341b66Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
263873108675c944ab4ee89631dced23566b12341b66Jack Palevich    if (_remaining < 1) {
263973108675c944ab4ee89631dced23566b12341b66Jack Palevich        _exception = 1;
26402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
26412545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < 1 < needed";
264273108675c944ab4ee89631dced23566b12341b66Jack Palevich        goto exit;
264373108675c944ab4ee89631dced23566b12341b66Jack Palevich    }
264473108675c944ab4ee89631dced23566b12341b66Jack Palevich    params_base = (GLint *)
26453b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(params_ref, (jboolean *)0);
264673108675c944ab4ee89631dced23566b12341b66Jack Palevich    params = params_base + offset;
264773108675c944ab4ee89631dced23566b12341b66Jack Palevich
264873108675c944ab4ee89631dced23566b12341b66Jack Palevich    glGetBufferParameteriv(
264973108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)target,
265073108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)pname,
265173108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLint *)params
265273108675c944ab4ee89631dced23566b12341b66Jack Palevich    );
265373108675c944ab4ee89631dced23566b12341b66Jack Palevich
265473108675c944ab4ee89631dced23566b12341b66Jack Palevichexit:
265573108675c944ab4ee89631dced23566b12341b66Jack Palevich    if (params_base) {
26563b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
265773108675c944ab4ee89631dced23566b12341b66Jack Palevich            _exception ? JNI_ABORT: 0);
265873108675c944ab4ee89631dced23566b12341b66Jack Palevich    }
26592545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
26602545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
26612545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2662560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2663560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2664560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2665560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2666560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
2667560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
266873108675c944ab4ee89631dced23566b12341b66Jack Palevich    jint _exception = 0;
26692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
26702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
26713b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
267217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
267373108675c944ab4ee89631dced23566b12341b66Jack Palevich    jint _remaining;
267473108675c944ab4ee89631dced23566b12341b66Jack Palevich    GLint *params = (GLint *) 0;
267573108675c944ab4ee89631dced23566b12341b66Jack Palevich
26763b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
267773108675c944ab4ee89631dced23566b12341b66Jack Palevich    if (_remaining < 1) {
267873108675c944ab4ee89631dced23566b12341b66Jack Palevich        _exception = 1;
26792545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
26802545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < 1 < needed";
268173108675c944ab4ee89631dced23566b12341b66Jack Palevich        goto exit;
268273108675c944ab4ee89631dced23566b12341b66Jack Palevich    }
268317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
26843b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
268517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
268617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
268773108675c944ab4ee89631dced23566b12341b66Jack Palevich    glGetBufferParameteriv(
268873108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)target,
268973108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)pname,
269073108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLint *)params
269173108675c944ab4ee89631dced23566b12341b66Jack Palevich    );
269273108675c944ab4ee89631dced23566b12341b66Jack Palevich
269373108675c944ab4ee89631dced23566b12341b66Jack Palevichexit:
269473108675c944ab4ee89631dced23566b12341b66Jack Palevich    if (_array) {
26953b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
269673108675c944ab4ee89631dced23566b12341b66Jack Palevich    }
26972545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
26982545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
26992545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2700560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2701560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2702560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLenum glGetError ( void ) */
2703560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jint
2704560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetError__
2705560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this) {
2706560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum _returnValue;
2707560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glGetError();
2708cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jint)_returnValue;
2709560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2710560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2711560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
2712560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2713560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetFloatv__I_3FI
2714560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
27153b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    get<jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, GLfloat, glGetFloatv>(
27163b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env, _this, pname, params_ref, offset);
2717560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2718560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2719560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
2720560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2721560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetFloatv__ILjava_nio_FloatBuffer_2
2722560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
27233b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    getarray<GLfloat, jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, glGetFloatv>(
27243b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env, _this, pname, params_buf);
2725560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2726560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
2727560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2728560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetFramebufferAttachmentParameteriv__III_3II
2729560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jintArray params_ref, jint offset) {
2730560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
27312ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
27322ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
2733560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
2734560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
2735560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
2736560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2737560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
2738560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
27392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
27402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
2741560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2742560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2743560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
2744560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
27452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
27462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
2747560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2748560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2749560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
2750560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
27513b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(params_ref, (jboolean *)0);
2752560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
2753560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2754560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetFramebufferAttachmentParameteriv(
2755560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
2756560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)attachment,
2757560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
2758560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
2759560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
2760560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2761560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
2762560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
27633b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
2764560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2765560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
27662545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
27672545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
27682545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2769560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2770560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2771560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
2772560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2773560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2
2774560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) {
27753b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
277617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
2777560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
2778560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
2779560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
27803b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
278117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
27823b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
278317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
278417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
2785560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetFramebufferAttachmentParameteriv(
2786560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
2787560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)attachment,
2788560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
2789560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
2790560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
2791560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
27923b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
2793560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2794560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2795560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2796560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetIntegerv ( GLenum pname, GLint *params ) */
2797560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2798560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetIntegerv__I_3II
2799560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
28003b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    get<jintArray, IntArrayGetter, jint*, IntArrayReleaser, GLint, glGetIntegerv>(
28013b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env, _this, pname, params_ref, offset);
2802560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2803560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2804560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetIntegerv ( GLenum pname, GLint *params ) */
2805560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2806560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetIntegerv__ILjava_nio_IntBuffer_2
2807560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
28083b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    getarray<GLint, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetIntegerv>(
28093b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env, _this, pname, params_buf);
2810560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2811560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2812560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2813560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetProgramiv__II_3II
2814560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint pname, jintArray params_ref, jint offset) {
2815560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
28162ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
28172ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
2818560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
2819560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
2820560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
2821560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2822560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
2823560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
28242545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
28252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
2826560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2827560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2828560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
2829560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
28302545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
28312545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
2832560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2833560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2834560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
28352ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
28362ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
28372ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
28382ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < 1 < needed";
28392ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
28402ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
2841560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
28423b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(params_ref, (jboolean *)0);
2843560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
2844560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2845560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetProgramiv(
2846560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
2847560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
2848560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
2849560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
2850560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2851560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
2852560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
28533b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
2854560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2855560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
28562545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
28572545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
28582545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2859560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2860560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2861560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2862560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2863560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetProgramiv__IILjava_nio_IntBuffer_2
2864560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint pname, jobject params_buf) {
28652ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
28662ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
28672ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
28683b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
286917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
2870560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
2871560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
2872560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
28733b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
28742ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
28752ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
28762ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
28772ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
28782ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
28792ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
288017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
28813b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
288217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
288317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
2884560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetProgramiv(
2885560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
2886560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
2887560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
2888560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
28892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
28902ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
2891560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
28923b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
28932ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
28942ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
28952ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
2896560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2897560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2898560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
289924ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes#include <stdlib.h>
2900560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2901560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetProgramInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
290224ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughesstatic jstring android_glGetProgramInfoLog(JNIEnv *_env, jobject, jint shader) {
2903560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint infoLen = 0;
2904560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
290524ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    if (!infoLen) {
290624ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        return _env->NewStringUTF("");
2907560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
290824ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    char* buf = (char*) malloc(infoLen);
290924ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    if (buf == NULL) {
291024ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
291124ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        return NULL;
2912560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
291324ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    glGetProgramInfoLog(shader, infoLen, NULL, buf);
291424ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    jstring result = _env->NewStringUTF(buf);
291524ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    free(buf);
291624ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    return result;
2917560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2918560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2919560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2920560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetRenderbufferParameteriv__II_3II
2921560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2922560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
29232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
29242ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
2925560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
2926560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
2927560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
2928560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2929560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
2930560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
29312545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
29322545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
2933560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2934560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2935560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
2936560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
29372545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
29382545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
2939560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2940560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2941560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
29422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
29432ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
29442ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
29452ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < 1 < needed";
29462ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
29472ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
2948560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
29493b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(params_ref, (jboolean *)0);
2950560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
2951560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2952560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetRenderbufferParameteriv(
2953560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
2954560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
2955560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
2956560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
2957560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2958560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
2959560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
29603b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
2961560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2962560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
29632545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
29642545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
29652545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2966560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2967560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2968560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2969560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2970560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2
2971560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
29722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
29732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
29742ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
29753b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
297617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
2977560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
2978560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
2979560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
29803b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
29812ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
29822ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
29832ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
29842ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
29852ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
29862ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
298717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
29883b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
298917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
299017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
2991560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetRenderbufferParameteriv(
2992560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
2993560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
2994560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
2995560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
29962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
29972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
2998560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
29993b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
30002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
30012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
30022ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
3003560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3004560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3005560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3006560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
3007560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3008560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetShaderiv__II_3II
3009560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shader, jint pname, jintArray params_ref, jint offset) {
3010560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
30112ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
30122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
3013560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
3014560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3015560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3016560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3017560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
3018560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
30192545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
30202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
3021560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3022560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3023560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
3024560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
30252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
30262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
3027560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3028560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3029560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
30302ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
30312ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
30322ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
30332ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < 1 < needed";
30342ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
30352ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3036560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
30373b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(params_ref, (jboolean *)0);
3038560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
3039560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3040560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetShaderiv(
3041560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader,
3042560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3043560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3044560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3045560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3046560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3047560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
30483b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
3049560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3050560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
30512545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
30522545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
30532545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3054560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3055560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3056560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
3057560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3058560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetShaderiv__IILjava_nio_IntBuffer_2
3059560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shader, jint pname, jobject params_buf) {
30602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
30612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
30622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
30633b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
306417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3065560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3066560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3067560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
30683b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
30692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
30702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
30712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
30722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
30732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
30742ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
307517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
30763b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
307717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
307817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3079560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetShaderiv(
3080560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader,
3081560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3082560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3083560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
30842ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
30852ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
3086560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
30873b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
30882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
30892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
30902ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
3091560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3092560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3093560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
309424ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes#include <stdlib.h>
3095560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3096560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetShaderInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
309724ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughesstatic jstring android_glGetShaderInfoLog(JNIEnv *_env, jobject, jint shader) {
3098560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint infoLen = 0;
3099560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
310024ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    if (!infoLen) {
310124ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        return _env->NewStringUTF("");
3102560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
310324ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    char* buf = (char*) malloc(infoLen);
310424ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    if (buf == NULL) {
310524ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
310624ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        return NULL;
3107560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
310824ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    glGetShaderInfoLog(shader, infoLen, NULL, buf);
310924ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    jstring result = _env->NewStringUTF(buf);
311024ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    free(buf);
311124ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    return result;
3112560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3113560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
3114560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3115560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetShaderPrecisionFormat__II_3II_3II
3116560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jintArray range_ref, jint rangeOffset, jintArray precision_ref, jint precisionOffset) {
3117560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
31182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
31192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
3120560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *range_base = (GLint *) 0;
3121560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _rangeRemaining;
3122560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *range = (GLint *) 0;
3123560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *precision_base = (GLint *) 0;
3124560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _precisionRemaining;
3125560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *precision = (GLint *) 0;
3126560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3127560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!range_ref) {
3128560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
31292545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
31302545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "range == null";
3131560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3132560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3133560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (rangeOffset < 0) {
3134560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
31352545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
31362545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "rangeOffset < 0";
3137560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3138560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3139560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _rangeRemaining = _env->GetArrayLength(range_ref) - rangeOffset;
31402ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_rangeRemaining < 1) {
31412ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
31422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
31432ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - rangeOffset < 1 < needed";
31442ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
31452ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3146560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    range_base = (GLint *)
31473b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(range_ref, (jboolean *)0);
3148560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    range = range_base + rangeOffset;
3149560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3150560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!precision_ref) {
3151560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
31522545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
31532545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "precision == null";
3154560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3155560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3156560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (precisionOffset < 0) {
3157560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
31582545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
31592545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "precisionOffset < 0";
3160560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3161560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3162560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _precisionRemaining = _env->GetArrayLength(precision_ref) - precisionOffset;
31632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_precisionRemaining < 1) {
31642ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
31652ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
31662ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - precisionOffset < 1 < needed";
31672ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
31682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3169560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    precision_base = (GLint *)
31703b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(precision_ref, (jboolean *)0);
3171560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    precision = precision_base + precisionOffset;
3172560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3173560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetShaderPrecisionFormat(
3174560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)shadertype,
3175560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)precisiontype,
3176560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)range,
3177560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)precision
3178560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3179560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3180560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3181560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (precision_base) {
31823b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(precision_ref, (jint*)precision_base,
3183560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3184560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3185560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (range_base) {
31863b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(range_ref, (jint*)range_base,
3187560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3188560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
31892545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
31902545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
31912545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3192560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3193560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3194560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
3195560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3196560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
3197560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jobject range_buf, jobject precision_buf) {
31982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
31992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
32002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
32013b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _rangeArray = (jintArray) 0;
320217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _rangeBufferOffset = (jint) 0;
32033b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _precisionArray = (jintArray) 0;
320417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _precisionBufferOffset = (jint) 0;
3205560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _rangeRemaining;
3206560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *range = (GLint *) 0;
3207560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _precisionRemaining;
3208560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *precision = (GLint *) 0;
3209560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
32103b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    range = (GLint *)getPointer(_env, range_buf, (jarray*)&_rangeArray, &_rangeRemaining, &_rangeBufferOffset);
32112ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_rangeRemaining < 1) {
32122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
32132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
32142ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
32152ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
32162ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
32173b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    precision = (GLint *)getPointer(_env, precision_buf, (jarray*)&_precisionArray, &_precisionRemaining, &_precisionBufferOffset);
32182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_precisionRemaining < 1) {
32192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
32202ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
32212ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
32222ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
32232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
322417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (range == NULL) {
32253b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _rangeBase = (char *)_env->GetIntArrayElements(_rangeArray, (jboolean *) 0);
322617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        range = (GLint *) (_rangeBase + _rangeBufferOffset);
322717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
322817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (precision == NULL) {
32293b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _precisionBase = (char *)_env->GetIntArrayElements(_precisionArray, (jboolean *) 0);
323017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        precision = (GLint *) (_precisionBase + _precisionBufferOffset);
323117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3232560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetShaderPrecisionFormat(
3233560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)shadertype,
3234560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)precisiontype,
3235560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)range,
3236560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)precision
3237560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
32382ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
32392ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
3240560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_precisionArray) {
32413b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_precisionArray, (jint*)precision, _exception ? JNI_ABORT : 0);
324217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
324317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (_rangeArray) {
32443b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_rangeArray, (jint*)range, _exception ? JNI_ABORT : 0);
32452ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
32462ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
32472ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
3248560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3249560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3250560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3251560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3252560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3253560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetShaderSource__II_3II_3BI
3254560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jintArray length_ref, jint lengthOffset, jbyteArray source_ref, jint sourceOffset) {
3255560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
32562545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    const char * _exceptionType;
32572545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    const char * _exceptionMessage;
3258560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length_base = (GLsizei *) 0;
3259560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _lengthRemaining;
3260560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length = (GLsizei *) 0;
3261560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    char *source_base = (char *) 0;
3262560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _sourceRemaining;
3263560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    char *source = (char *) 0;
3264560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3265560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!length_ref) {
3266560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
32672545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
32682545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length == null";
3269560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3270560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3271560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (lengthOffset < 0) {
3272560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
32732545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
32742545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "lengthOffset < 0";
3275560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3276560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3277560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
3278560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    length_base = (GLsizei *)
32793b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(length_ref, (jboolean *)0);
3280560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    length = length_base + lengthOffset;
3281560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3282560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!source_ref) {
3283560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
32842545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
32852545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "source == null";
3286560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3287560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3288560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (sourceOffset < 0) {
3289560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
32902545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
32912545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "sourceOffset < 0";
3292560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3293560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3294560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _sourceRemaining = _env->GetArrayLength(source_ref) - sourceOffset;
3295560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    source_base = (char *)
32963b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetByteArrayElements(source_ref, (jboolean *)0);
3297560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    source = source_base + sourceOffset;
3298560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3299560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetShaderSource(
3300560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader,
3301560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)bufsize,
3302560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)length,
3303560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (char *)source
3304560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3305560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3306560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3307560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (source_base) {
33083b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseByteArrayElements(source_ref, (jbyte*)source_base,
3309560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3310560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3311560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (length_base) {
33123b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
3313560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3314560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
33152545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
33162545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
33172545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3318560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3319560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3320560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3321560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3322560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetShaderSource__IILjava_nio_IntBuffer_2B
3323560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jobject length_buf, jbyte source) {
33243b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
332517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3326560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3327560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length = (GLsizei *) 0;
3328560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
33293b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
333017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (length == NULL) {
33313b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _lengthBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
333217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        length = (GLsizei *) (_lengthBase + _bufferOffset);
333317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3334560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetShaderSource(
3335560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader,
3336560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)bufsize,
3337560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)length,
333801c26ea89d4bbea3cf550e9328742302dd9a2b25Ashok Bhat        reinterpret_cast<char *>(source)
3339560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3340560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
33413b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _array, (jint*)length, JNI_TRUE);
3342560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3343560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3344560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3345dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3346dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferstatic jstring android_glGetShaderSource(JNIEnv *_env, jobject, jint shader) {
3347dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint shaderLen = 0;
3348dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetShaderiv((GLuint)shader, GL_SHADER_SOURCE_LENGTH, &shaderLen);
3349dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!shaderLen) {
3350dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return _env->NewStringUTF("");
3351dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
3352dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    char* buf = (char*) malloc(shaderLen);
3353dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf == NULL) {
3354dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
3355dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return NULL;
3356dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
3357dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetShaderSource(shader, shaderLen, NULL, buf);
3358dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jstring result = _env->NewStringUTF(buf);
3359dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    free(buf);
3360dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    return result;
3361dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer}
3362560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* const GLubyte * glGetString ( GLenum name ) */
336324ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughesstatic jstring android_glGetString(JNIEnv* _env, jobject, jint name) {
336424ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    const char* chars = (const char*) glGetString((GLenum) name);
336524ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    return _env->NewStringUTF(chars);
3366560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3367560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
3368560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3369560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetTexParameterfv__II_3FI
3370560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
3371560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
33722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
33732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
3374560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params_base = (GLfloat *) 0;
3375560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3376560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
3377560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3378560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
3379560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
33802545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
33812545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
3382560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3383560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3384560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
3385560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
33862545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
33872545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
3388560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3389560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3390560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
3391560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
3392560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
33932545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
33942545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < 1 < needed";
3395560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3396560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3397560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLfloat *)
33983b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(params_ref, (jboolean *)0);
3399560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
3400560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3401560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetTexParameterfv(
3402560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
3403560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3404560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
3405560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3406560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3407560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3408560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
34093b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
3410560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3411560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
34122545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
34132545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
34142545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3415560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3416560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3417560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
3418560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3419560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetTexParameterfv__IILjava_nio_FloatBuffer_2
3420560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3421560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
34222ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
34232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
34243b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
342517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3426560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3427560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
3428560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
34293b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3430560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
3431560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
34322545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
34332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < 1 < needed";
3434560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3435560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
343617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
34373b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
343817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLfloat *) (_paramsBase + _bufferOffset);
343917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3440560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetTexParameterfv(
3441560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
3442560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3443560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
3444560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3445560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3446560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3447560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
34483b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
3449560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
34502545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
34512545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
34522545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3453560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3454560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3455560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3456560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3457560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetTexParameteriv__II_3II
3458560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
3459560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
34602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
34612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
3462560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
3463560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3464560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3465560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3466560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
3467560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
34682545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
34692545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
3470560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3471560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3472560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
3473560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
34742545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
34752545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
3476560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3477560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3478560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
3479560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
3480560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
34812545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
34822545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < 1 < needed";
3483560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3484560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3485560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
34863b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(params_ref, (jboolean *)0);
3487560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
3488560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3489560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetTexParameteriv(
3490560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
3491560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3492560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3493560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3494560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3495560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3496560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
34973b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
3498560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3499560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
35002545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
35012545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
35022545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3503560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3504560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3505560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3506560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3507560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetTexParameteriv__IILjava_nio_IntBuffer_2
3508560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3509560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
35102ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
35112ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
35123b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
351317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3514560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3515560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3516560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
35173b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3518560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
3519560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
35202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
35212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < 1 < needed";
3522560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3523560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
352417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
35253b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
352617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
352717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3528560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetTexParameteriv(
3529560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
3530560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3531560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3532560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3533560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3534560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3535560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
35363b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
3537560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
35382545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
35392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
35402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3541560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3542560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3543560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3544560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3545560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetUniformfv__II_3FI
3546560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint location, jfloatArray params_ref, jint offset) {
3547560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
35482ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
35492ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
3550560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params_base = (GLfloat *) 0;
3551560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3552560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
3553560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3554560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
3555560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
35562545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
35572545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
3558560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3559560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3560560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
3561560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
35622545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
35632545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
3564560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3565560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3566560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
35672ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
35682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
35692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
35702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < 1 < needed";
35712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
35722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3573560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLfloat *)
35743b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(params_ref, (jboolean *)0);
3575560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
3576560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3577560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetUniformfv(
3578560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
3579560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
3580560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
3581560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3582560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3583560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3584560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
35853b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
3586560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3587560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
35882545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
35892545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
35902545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3591560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3592560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3593560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3594560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3595560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetUniformfv__IILjava_nio_FloatBuffer_2
3596560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
35972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
35982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
35992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
36003b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
360117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3602560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3603560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
3604560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
36053b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
36062ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
36072ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
36082ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
36092ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
36102ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
36112ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
361217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
36133b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
361417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLfloat *) (_paramsBase + _bufferOffset);
361517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3616560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetUniformfv(
3617560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
3618560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
3619560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
3620560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
36212ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
36222ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
3623560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
36243b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
36252ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
36262ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
36272ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
3628560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3629560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3630560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3631560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3632560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3633560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetUniformiv__II_3II
3634560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint location, jintArray params_ref, jint offset) {
3635560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
36362ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
36372ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
3638560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
3639560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3640560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3641560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3642560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
3643560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
36442545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
36452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
3646560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3647560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3648560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
3649560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
36502545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
36512545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
3652560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3653560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3654560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
36552ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
36562ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
36572ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
36582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < 1 < needed";
36592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
36602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3661560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
36623b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(params_ref, (jboolean *)0);
3663560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
3664560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3665560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetUniformiv(
3666560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
3667560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
3668560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3669560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3670560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3671560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3672560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
36733b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
3674560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3675560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
36762545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
36772545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
36782545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3679560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3680560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3681560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3682560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3683560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetUniformiv__IILjava_nio_IntBuffer_2
3684560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
36852ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
36862ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
36872ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
36883b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
368917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3690560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3691560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3692560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
36933b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
36942ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
36952ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
36962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
36972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
36982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
36992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
370017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
37013b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
370217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
370317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3704560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetUniformiv(
3705560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
3706560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
3707560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3708560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
37092ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
37102ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
3711560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
37123b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
37132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
37142ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
37152ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
3716560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3717560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3718560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
371989be00bcda2b5965757e83bdf70a650b64373045Mathias Agopian/* GLint glGetUniformLocation ( GLuint program, const char *name ) */
3720560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jint
3721560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetUniformLocation__ILjava_lang_String_2
3722560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jstring name) {
37232545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
37242ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
37252ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
372689be00bcda2b5965757e83bdf70a650b64373045Mathias Agopian    GLint _returnValue = 0;
3727560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    const char* _nativename = 0;
3728560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3729560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!name) {
3730428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes        _exception = 1;
37312545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
37322545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "name == null";
3733560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3734560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3735560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _nativename = _env->GetStringUTFChars(name, 0);
3736560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3737560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glGetUniformLocation(
3738560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
3739560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (char *)_nativename
3740560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3741560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3742560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3743560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_nativename) {
3744560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleaseStringUTFChars(name, _nativename);
3745560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3746560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
37472545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
37482545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
37492545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3750cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jint)_returnValue;
3751560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3752560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3753560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3754560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3755560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetVertexAttribfv__II_3FI
3756560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint index, jint pname, jfloatArray params_ref, jint offset) {
3757560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
37582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
37592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
3760560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params_base = (GLfloat *) 0;
3761560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3762560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
3763560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3764560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
3765560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
37662545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
37672545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
3768560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3769560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3770560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
3771560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
37722545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
37732545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
3774560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3775560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3776560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
37772ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    int _needed;
37782ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    switch (pname) {
37792ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#if defined(GL_CURRENT_VERTEX_ATTRIB)
37802ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_CURRENT_VERTEX_ATTRIB:
37812ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
37822ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _needed = 4;
37832ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
37842ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        default:
37852ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _needed = 1;
37862ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
37872ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
37882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < _needed) {
37892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
37902ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
37912ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < needed";
37922ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
37932ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3794560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLfloat *)
37953b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(params_ref, (jboolean *)0);
3796560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
3797560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3798560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetVertexAttribfv(
3799560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
3800560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3801560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
3802560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3803560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3804560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3805560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
38063b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
3807560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3808560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
38092545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
38102545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
38112545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3812560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3813560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3814560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3815560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3816560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2
3817560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
38182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
38192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
38202ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
38213b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
382217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3823560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3824560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
3825560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
38263b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
38272ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    int _needed;
38282ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    switch (pname) {
38292ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#if defined(GL_CURRENT_VERTEX_ATTRIB)
38302ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_CURRENT_VERTEX_ATTRIB:
38312ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
38322ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _needed = 4;
38332ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
38342ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        default:
38352ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _needed = 1;
38362ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
38372ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
38382ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < _needed) {
38392ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
38402ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
38412ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < needed";
38422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
38432ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
384417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
38453b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
384617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLfloat *) (_paramsBase + _bufferOffset);
384717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3848560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetVertexAttribfv(
3849560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
3850560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3851560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
3852560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
38532ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
38542ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
3855560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
38563b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
38572ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
38582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
38592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
3860560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3861560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3862560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3863560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
3864560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3865560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetVertexAttribiv__II_3II
3866560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint index, jint pname, jintArray params_ref, jint offset) {
3867560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
38682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
38692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
3870560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
3871560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3872560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3873560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3874560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
3875560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
38762545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
38772545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
3878560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3879560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3880560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
3881560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
38822545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
38832545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
3884560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3885560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3886560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
38872ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    int _needed;
38882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    switch (pname) {
38892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#if defined(GL_CURRENT_VERTEX_ATTRIB)
38902ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_CURRENT_VERTEX_ATTRIB:
38912ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
38922ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _needed = 4;
38932ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
38942ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        default:
38952ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _needed = 1;
38962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
38972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
38982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < _needed) {
38992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
39002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
39012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < needed";
39022ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
39032ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
3904560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
39053b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(params_ref, (jboolean *)0);
3906560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
3907560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3908560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetVertexAttribiv(
3909560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
3910560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3911560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3912560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3913560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3914560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3915560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
39163b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
3917560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3918560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
39192545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
39202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
39212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3922560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3923560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3924560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
3925560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3926560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetVertexAttribiv__IILjava_nio_IntBuffer_2
3927560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
39282ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
39292ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
39302ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
39313b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
393217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3933560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3934560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3935560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
39363b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
39372ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    int _needed;
39382ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    switch (pname) {
39392ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#if defined(GL_CURRENT_VERTEX_ATTRIB)
39402ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        case GL_CURRENT_VERTEX_ATTRIB:
39412ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
39422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _needed = 4;
39432ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
39442ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        default:
39452ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            _needed = 1;
39462ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian            break;
39472ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
39482ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < _needed) {
39492ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
39502ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
39512ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < needed";
39522ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
39532ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
395417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
39553b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
395617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
395717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3958560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetVertexAttribiv(
3959560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
3960560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3961560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3962560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
39632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
39642ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
3965560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
39663b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
39672ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
39682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
39692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
3970560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3971560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3972560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3973560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glHint ( GLenum target, GLenum mode ) */
3974560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3975560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glHint__II
3976560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint mode) {
3977560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glHint(
3978560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
3979560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)mode
3980560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3981560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3982560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3983560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLboolean glIsBuffer ( GLuint buffer ) */
3984560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jboolean
3985560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glIsBuffer__I
3986560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint buffer) {
3987560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLboolean _returnValue;
3988560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glIsBuffer(
3989560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)buffer
3990560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3991cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jboolean)_returnValue;
3992560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3993560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3994560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLboolean glIsEnabled ( GLenum cap ) */
3995560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jboolean
3996560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glIsEnabled__I
3997560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint cap) {
3998560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLboolean _returnValue;
3999560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glIsEnabled(
4000560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)cap
4001560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4002cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jboolean)_returnValue;
4003560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4004560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4005560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLboolean glIsFramebuffer ( GLuint framebuffer ) */
4006560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jboolean
4007560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glIsFramebuffer__I
4008560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint framebuffer) {
4009560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLboolean _returnValue;
4010560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glIsFramebuffer(
4011560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)framebuffer
4012560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4013cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jboolean)_returnValue;
4014560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4015560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4016560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLboolean glIsProgram ( GLuint program ) */
4017560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jboolean
4018560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glIsProgram__I
4019560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program) {
4020560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLboolean _returnValue;
4021560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glIsProgram(
4022560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program
4023560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4024cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jboolean)_returnValue;
4025560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4026560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4027560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLboolean glIsRenderbuffer ( GLuint renderbuffer ) */
4028560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jboolean
4029560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glIsRenderbuffer__I
4030560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint renderbuffer) {
4031560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLboolean _returnValue;
4032560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glIsRenderbuffer(
4033560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)renderbuffer
4034560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4035cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jboolean)_returnValue;
4036560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4037560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4038560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLboolean glIsShader ( GLuint shader ) */
4039560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jboolean
4040560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glIsShader__I
4041560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shader) {
4042560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLboolean _returnValue;
4043560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glIsShader(
4044560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader
4045560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4046cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jboolean)_returnValue;
4047560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4048560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4049560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLboolean glIsTexture ( GLuint texture ) */
4050560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jboolean
4051560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glIsTexture__I
4052560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint texture) {
4053560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLboolean _returnValue;
4054560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glIsTexture(
4055560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)texture
4056560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4057cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden    return (jboolean)_returnValue;
4058560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4059560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4060560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glLineWidth ( GLfloat width ) */
4061560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4062560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glLineWidth__F
4063560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jfloat width) {
4064560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glLineWidth(
4065560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)width
4066560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4067560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4068560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4069560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glLinkProgram ( GLuint program ) */
4070560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4071560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glLinkProgram__I
4072560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program) {
4073560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glLinkProgram(
4074560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program
4075560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4076560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4077560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4078560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glPixelStorei ( GLenum pname, GLint param ) */
4079560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4080560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glPixelStorei__II
4081560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint pname, jint param) {
4082560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glPixelStorei(
4083560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4084560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)param
4085560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4086560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4087560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4088560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glPolygonOffset ( GLfloat factor, GLfloat units ) */
4089560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4090560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glPolygonOffset__FF
4091560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) {
4092560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glPolygonOffset(
4093560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)factor,
4094560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)units
4095560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4096560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4097560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4098560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */
4099560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4100560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glReadPixels__IIIIIILjava_nio_Buffer_2
4101560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) {
4102560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
410317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4104560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4105560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *pixels = (GLvoid *) 0;
4106560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
41073b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
410817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (pixels == NULL) {
410917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
411017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
411117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4112560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glReadPixels(
4113560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
4114560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y,
4115560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
4116560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height,
4117560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)format,
4118560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)type,
4119560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)pixels
4120560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4121560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
41222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        releasePointer(_env, _array, pixels, JNI_TRUE);
4123560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4124560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4125560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4126560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glReleaseShaderCompiler ( void ) */
4127560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4128560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glReleaseShaderCompiler__
4129560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this) {
4130560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glReleaseShaderCompiler();
4131560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4132560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4133560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glRenderbufferStorage ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) */
4134560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4135560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glRenderbufferStorage__IIII
4136560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint width, jint height) {
4137560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glRenderbufferStorage(
4138560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4139560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)internalformat,
4140560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
4141560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height
4142560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4143560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4144560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4145560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glSampleCoverage ( GLclampf value, GLboolean invert ) */
4146560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4147560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glSampleCoverage__FZ
4148560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) {
4149560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glSampleCoverage(
4150560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)value,
4151560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)invert
4152560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4153560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4154560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4155560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */
4156560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4157560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glScissor__IIII
4158560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
4159560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glScissor(
4160560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
4161560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y,
4162560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
4163560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height
4164560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4165560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4166560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4167560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
4168560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4169560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glShaderBinary__I_3IIILjava_nio_Buffer_2I
4170560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray shaders_ref, jint offset, jint binaryformat, jobject binary_buf, jint length) {
41712545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
41722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
41732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
4174560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
417517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4176560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *shaders_base = (GLuint *) 0;
4177560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _shadersRemaining;
4178560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *shaders = (GLuint *) 0;
4179560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _binaryRemaining;
4180560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *binary = (GLvoid *) 0;
4181560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4182560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!shaders_ref) {
41832545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
41842545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
41852545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "shaders == null";
4186560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4187560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4188560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
41892545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
41902545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
41912545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
4192560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4193560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4194560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _shadersRemaining = _env->GetArrayLength(shaders_ref) - offset;
4195560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    shaders_base = (GLuint *)
41963b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(shaders_ref, (jboolean *)0);
4197560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    shaders = shaders_base + offset;
4198560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
41993b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    binary = (GLvoid *)getPointer(_env, binary_buf, (jarray*)&_array, &_binaryRemaining, &_bufferOffset);
42002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_binaryRemaining < length) {
42012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
42022ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
42032ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < length < needed";
42042ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
42052ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
420617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (binary == NULL) {
420717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
420817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        binary = (GLvoid *) (_binaryBase + _bufferOffset);
420917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4210560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glShaderBinary(
4211560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
4212560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)shaders,
4213560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)binaryformat,
4214560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)binary,
4215560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)length
4216560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4217560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4218560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4219560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
4220560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, binary, JNI_FALSE);
4221560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4222560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (shaders_base) {
42233b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(shaders_ref, (jint*)shaders_base,
4224560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
4225560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
42262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
42272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
42282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4229560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4230560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4231560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
4232560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4233560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I
4234560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject shaders_buf, jint binaryformat, jobject binary_buf, jint length) {
42352ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
42362ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
42372ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
42383b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _shadersArray = (jintArray) 0;
423917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _shadersBufferOffset = (jint) 0;
42403b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _binaryArray = (jintArray) 0;
424117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _binaryBufferOffset = (jint) 0;
4242560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _shadersRemaining;
4243560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *shaders = (GLuint *) 0;
4244560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _binaryRemaining;
4245560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *binary = (GLvoid *) 0;
4246560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
42473b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    shaders = (GLuint *)getPointer(_env, shaders_buf, (jarray*)&_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
42483b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    binary = (GLvoid *)getPointer(_env, binary_buf, (jarray*)&_binaryArray, &_binaryRemaining, &_binaryBufferOffset);
42492ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_binaryRemaining < length) {
42502ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
42512ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
42522ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < length < needed";
42532ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
42542ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
425517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (shaders == NULL) {
42563b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _shadersBase = (char *)_env->GetIntArrayElements(_shadersArray, (jboolean *) 0);
425717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        shaders = (GLuint *) (_shadersBase + _shadersBufferOffset);
425817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
425917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (binary == NULL) {
426017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_binaryArray, (jboolean *) 0);
426117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        binary = (GLvoid *) (_binaryBase + _binaryBufferOffset);
426217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4263560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glShaderBinary(
4264560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
4265560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)shaders,
4266560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)binaryformat,
4267560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)binary,
4268560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)length
4269560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
42702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
42712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
4272560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_binaryArray) {
427317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        releasePointer(_env, _binaryArray, binary, JNI_FALSE);
427417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
427517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (_shadersArray) {
42763b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_shadersArray, (jint*)shaders, JNI_ABORT);
4277560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
42782ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
42792ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
42802ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
4281560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4282560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4283560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4284560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint * length ) */
4285560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic
4286560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichvoid
4287560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glShaderSource
4288560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    (JNIEnv *_env, jobject _this, jint shader, jstring string) {
4289560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4290560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!string) {
429124ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        jniThrowException(_env, "java/lang/IllegalArgumentException", "string == null");
4292560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        return;
4293560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4294560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4295560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    const char* nativeString = _env->GetStringUTFChars(string, 0);
4296560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    const char* strings[] = {nativeString};
4297560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glShaderSource(shader, 1, strings, 0);
4298560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _env->ReleaseStringUTFChars(string, nativeString);
4299560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4300560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */
4301560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4302560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glStencilFunc__III
4303560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) {
4304560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glStencilFunc(
4305560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)func,
4306560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)ref,
4307560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)mask
4308560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4309560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4310560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4311560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glStencilFuncSeparate ( GLenum face, GLenum func, GLint ref, GLuint mask ) */
4312560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4313560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glStencilFuncSeparate__IIII
4314560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint face, jint func, jint ref, jint mask) {
4315560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glStencilFuncSeparate(
4316560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)face,
4317560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)func,
4318560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)ref,
4319560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)mask
4320560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4321560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4322560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4323560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glStencilMask ( GLuint mask ) */
4324560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4325560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glStencilMask__I
4326560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint mask) {
4327560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glStencilMask(
4328560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)mask
4329560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4330560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4331560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4332560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glStencilMaskSeparate ( GLenum face, GLuint mask ) */
4333560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4334560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glStencilMaskSeparate__II
4335560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint face, jint mask) {
4336560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glStencilMaskSeparate(
4337560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)face,
4338560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)mask
4339560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4340560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4341560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4342560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */
4343560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4344560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glStencilOp__III
4345560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) {
4346560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glStencilOp(
4347560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)fail,
4348560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)zfail,
4349560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)zpass
4350560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4351560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4352560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4353560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) */
4354560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4355560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glStencilOpSeparate__IIII
4356560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint face, jint fail, jint zfail, jint zpass) {
4357560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glStencilOpSeparate(
4358560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)face,
4359560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)fail,
4360560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)zfail,
4361560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)zpass
4362560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4363560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4364560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4365560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */
4366560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4367560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexImage2D__IIIIIIIILjava_nio_Buffer_2
4368560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) {
4369560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
437017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4371560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4372560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *pixels = (GLvoid *) 0;
4373560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4374560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (pixels_buf) {
43753b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
437617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
437737c9b49ab5eb5a676370fd7081db0967c38e97a6Thomas Tafertshofer    if (pixels_buf && pixels == NULL) {
437817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
437917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
4380560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4381560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexImage2D(
4382560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4383560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)level,
4384560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)internalformat,
4385560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
4386560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height,
4387560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)border,
4388560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)format,
4389560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)type,
4390560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)pixels
4391560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4392560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
4393560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, pixels, JNI_FALSE);
4394560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4395560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4396560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4397560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */
4398560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4399560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexParameterf__IIF
4400560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
4401560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexParameterf(
4402560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4403560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4404560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)param
4405560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4406560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4407560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4408560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
4409560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4410560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexParameterfv__II_3FI
4411560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
44122545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
44132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
44142ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
4415560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params_base = (GLfloat *) 0;
4416560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4417560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
4418560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4419560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
44202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
44212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
44222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
4423560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4424560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4425560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
44262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
44272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
44282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
4429560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4430560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4431560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
4432560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
44332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
44342545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
44352545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < 1 < needed";
4436560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4437560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4438560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLfloat *)
44393b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(params_ref, (jboolean *)0);
4440560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
4441560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4442560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexParameterfv(
4443560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4444560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4445560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
4446560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4447560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4448560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4449560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
44503b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
4451560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
4452560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
44532545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
44542545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
44552545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4456560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4457560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4458560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
4459560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4460560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexParameterfv__IILjava_nio_FloatBuffer_2
4461560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
44622545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
44632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
44642ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
44653b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
446617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4467560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4468560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
4469560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
44703b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
4471560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
44722545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
44732545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
44742545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < 1 < needed";
4475560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4476560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
447717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
44783b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
447917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLfloat *) (_paramsBase + _bufferOffset);
448017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4481560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexParameterfv(
4482560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4483560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4484560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
4485560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4486560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4487560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4488560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
44893b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
4490560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
44912545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
44922545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
44932545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4494560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4495560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4496560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */
4497560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4498560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexParameteri__III
4499560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
4500560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexParameteri(
4501560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4502560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4503560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)param
4504560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4505560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4506560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4507560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
4508560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4509560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexParameteriv__II_3II
4510560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
45112545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
45122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
45132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
4514560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
4515560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4516560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
4517560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4518560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
45192545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
45202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
45212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
4522560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4523560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4524560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
45252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
45262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
45272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
4528560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4529560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4530560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
4531560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
45322545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
45332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
45342545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < 1 < needed";
4535560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4536560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4537560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
45383b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(params_ref, (jboolean *)0);
4539560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
4540560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4541560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexParameteriv(
4542560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4543560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4544560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
4545560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4546560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4547560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4548560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
45493b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
4550560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
4551560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
45522545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
45532545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
45542545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4555560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4556560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4557560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
4558560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4559560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexParameteriv__IILjava_nio_IntBuffer_2
4560560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
45612545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
45622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
45632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
45643b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
456517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4566560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4567560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
4568560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
45693b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
4570560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
45712545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
45722545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
45732545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < 1 < needed";
4574560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4575560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
457617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
45773b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
457817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
457917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4580560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexParameteriv(
4581560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4582560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4583560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
4584560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4585560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4586560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4587560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
45883b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
4589560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
45902545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
45912545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
45922545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4593560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4594560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4595560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */
4596560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4597560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
4598560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) {
4599560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
460017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4601560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4602560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *pixels = (GLvoid *) 0;
4603560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4604560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (pixels_buf) {
46053b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
460617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
460737c9b49ab5eb5a676370fd7081db0967c38e97a6Thomas Tafertshofer    if (pixels_buf && pixels == NULL) {
460817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
460917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
4610560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4611560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexSubImage2D(
4612560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4613560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)level,
4614560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)xoffset,
4615560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)yoffset,
4616560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
4617560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height,
4618560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)format,
4619560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)type,
4620560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)pixels
4621560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4622560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
4623560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, pixels, JNI_FALSE);
4624560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4625560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4626560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4627560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform1f ( GLint location, GLfloat x ) */
4628560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4629560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform1f__IF
4630560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jfloat x) {
4631560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform1f(
4632560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4633560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x
4634560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4635560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4636560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4637560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
4638560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4639560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform1fv__II_3FI
4640560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
46412545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
46422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
46432ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
4644560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v_base = (GLfloat *) 0;
4645560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4646560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
4647560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4648560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
46492545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
46502545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
46512545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
4652560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4653560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4654560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
46552545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
46562545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
46572545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
4658560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4659560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4660560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
46612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count) {
46622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
46632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
46642ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count < needed";
46652ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
46662ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
4667560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLfloat *)
46683b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(v_ref, (jboolean *)0);
4669560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
4670560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4671560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform1fv(
4672560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4673560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
4674560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
4675560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4676560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4677560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4678560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
46793b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
4680560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
4681560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
46822545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
46832545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
46842545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4685560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4686560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4687560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
4688560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4689560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform1fv__IILjava_nio_FloatBuffer_2
4690560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
46912ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
46922ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
46932ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
46943b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
469517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4696560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4697560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
4698560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
46993b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
47002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count) {
47012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
47022ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
47032ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count < needed";
47042ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
47052ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
470617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
47073b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
470817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLfloat *) (_vBase + _bufferOffset);
470917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4710560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform1fv(
4711560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4712560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
4713560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
4714560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
47152ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
47162ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
4717560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
47183b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
4719560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
47202ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
47212ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
47222ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
4723560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4724560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4725560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform1i ( GLint location, GLint x ) */
4726560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4727560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform1i__II
4728560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint x) {
4729560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform1i(
4730560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4731560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x
4732560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4733560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4734560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4735560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
4736560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4737560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform1iv__II_3II
4738560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
47392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
47402ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
47412ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
4742560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v_base = (GLint *) 0;
4743560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4744560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
4745560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4746560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
47472545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
47482545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
47492545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
4750560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4751560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4752560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
47532545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
47542545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
47552545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
4756560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4757560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4758560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
47592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count) {
47602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
47612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
47622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count < needed";
47632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
47642ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
4765560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLint *)
47663b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(v_ref, (jboolean *)0);
4767560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
4768560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4769560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform1iv(
4770560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4771560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
4772560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
4773560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4774560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4775560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4776560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
47773b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
4778560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
4779560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
47802545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
47812545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
47822545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4783560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4784560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4785560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
4786560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4787560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform1iv__IILjava_nio_IntBuffer_2
4788560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
47892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
47902ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
47912ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
47923b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
479317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4794560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4795560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
4796560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
47973b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
47982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count) {
47992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
48002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
48012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count < needed";
48022ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
48032ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
480417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
48053b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
480617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLint *) (_vBase + _bufferOffset);
480717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4808560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform1iv(
4809560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4810560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
4811560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
4812560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
48132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
48142ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
4815560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
48163b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
4817560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
48182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
48192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
48202ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
4821560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4822560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4823560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform2f ( GLint location, GLfloat x, GLfloat y ) */
4824560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4825560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform2f__IFF
4826560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y) {
4827560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform2f(
4828560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4829560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x,
4830560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)y
4831560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4832560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4833560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4834560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
4835560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4836560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform2fv__II_3FI
4837560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
48382545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
48392ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
48402ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
4841560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v_base = (GLfloat *) 0;
4842560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4843560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
4844560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4845560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
48462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
48472545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
48482545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
4849560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4850560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4851560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
48522545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
48532545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
48542545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
4855560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4856560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4857560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
48582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*2) {
48592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
48602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
48612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count*2 < needed";
48622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
48632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
4864560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLfloat *)
48653b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(v_ref, (jboolean *)0);
4866560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
4867560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4868560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform2fv(
4869560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4870560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
4871560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
4872560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4873560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4874560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4875560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
48763b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
4877560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
4878560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
48792545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
48802545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
48812545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4882560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4883560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4884560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
4885560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4886560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform2fv__IILjava_nio_FloatBuffer_2
4887560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
48882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
48892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
48902ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
48913b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
489217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4893560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4894560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
4895560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
48963b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
48972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*2) {
48982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
48992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
49002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count*2 < needed";
49012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
49022ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
490317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
49043b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
490517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLfloat *) (_vBase + _bufferOffset);
490617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4907560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform2fv(
4908560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4909560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
4910560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
4911560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
49122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
49132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
4914560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
49153b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
4916560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
49172ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
49182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
49192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
4920560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4921560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4922560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform2i ( GLint location, GLint x, GLint y ) */
4923560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4924560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform2i__III
4925560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint x, jint y) {
4926560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform2i(
4927560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4928560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
4929560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y
4930560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4931560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4932560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4933560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
4934560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4935560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform2iv__II_3II
4936560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
49372545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
49382ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
49392ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
4940560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v_base = (GLint *) 0;
4941560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4942560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
4943560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4944560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
49452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
49462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
49472545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
4948560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4949560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4950560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
49512545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
49522545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
49532545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
4954560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4955560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4956560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
49572ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*2) {
49582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
49592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
49602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count*2 < needed";
49612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
49622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
4963560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLint *)
49643b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(v_ref, (jboolean *)0);
4965560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
4966560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4967560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform2iv(
4968560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4969560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
4970560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
4971560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4972560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4973560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4974560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
49753b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
4976560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
4977560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
49782545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
49792545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
49802545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4981560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4982560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4983560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
4984560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4985560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform2iv__IILjava_nio_IntBuffer_2
4986560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
49872ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
49882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
49892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
49903b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
499117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4992560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4993560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
4994560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
49953b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
49962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*2) {
49972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
49982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
49992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count*2 < needed";
50002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
50012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
500217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
50033b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
500417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLint *) (_vBase + _bufferOffset);
500517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5006560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform2iv(
5007560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5008560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5009560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
5010560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
50112ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
50122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
5013560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
50143b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
5015560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
50162ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
50172ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
50182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5019560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5020560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5021560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z ) */
5022560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5023560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform3f__IFFF
5024560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z) {
5025560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform3f(
5026560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5027560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x,
5028560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)y,
5029560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)z
5030560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5031560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5032560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5033560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
5034560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5035560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform3fv__II_3FI
5036560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
50372545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
50382ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
50392ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
5040560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v_base = (GLfloat *) 0;
5041560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5042560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
5043560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5044560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
50452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
50462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
50472545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
5048560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5049560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5050560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
50512545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
50522545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
50532545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5054560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5055560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5056560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
50572ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*3) {
50582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
50592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
50602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count*3 < needed";
50612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
50622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5063560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLfloat *)
50643b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(v_ref, (jboolean *)0);
5065560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
5066560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5067560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform3fv(
5068560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5069560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5070560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
5071560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5072560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5073560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5074560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
50753b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
5076560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5077560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
50782545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
50792545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
50802545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5081560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5082560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5083560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
5084560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5085560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform3fv__IILjava_nio_FloatBuffer_2
5086560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
50872ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
50882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
50892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
50903b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
509117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5092560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5093560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
5094560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
50953b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
50962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*3) {
50972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
50982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
50992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count*3 < needed";
51002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
51012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
510217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
51033b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
510417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLfloat *) (_vBase + _bufferOffset);
510517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5106560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform3fv(
5107560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5108560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5109560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
5110560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
51112ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
51122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
5113560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
51143b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
5115560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
51162ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
51172ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
51182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5119560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5120560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5121560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform3i ( GLint location, GLint x, GLint y, GLint z ) */
5122560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5123560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform3i__IIII
5124560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z) {
5125560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform3i(
5126560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5127560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
5128560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y,
5129560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)z
5130560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5131560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5132560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5133560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
5134560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5135560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform3iv__II_3II
5136560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
51372545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
51382ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
51392ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
5140560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v_base = (GLint *) 0;
5141560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5142560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
5143560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5144560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
51452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
51462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
51472545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
5148560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5149560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5150560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
51512545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
51522545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
51532545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5154560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5155560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5156560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
51572ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*3) {
51582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
51592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
51602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count*3 < needed";
51612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
51622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5163560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLint *)
51643b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(v_ref, (jboolean *)0);
5165560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
5166560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5167560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform3iv(
5168560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5169560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5170560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
5171560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5172560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5173560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5174560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
51753b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
5176560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5177560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
51782545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
51792545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
51802545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5181560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5182560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5183560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
5184560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5185560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform3iv__IILjava_nio_IntBuffer_2
5186560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
51872ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
51882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
51892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
51903b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
519117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5192560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5193560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
5194560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
51953b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
51962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*3) {
51972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
51982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
51992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count*3 < needed";
52002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
52012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
520217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
52033b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
520417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLint *) (_vBase + _bufferOffset);
520517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5206560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform3iv(
5207560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5208560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5209560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
5210560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
52112ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
52122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
5213560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
52143b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
5215560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
52162ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
52172ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
52182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5219560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5220560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5221560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
5222560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5223560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform4f__IFFFF
5224560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z, jfloat w) {
5225560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform4f(
5226560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5227560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x,
5228560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)y,
5229560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)z,
5230560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)w
5231560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5232560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5233560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5234560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
5235560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5236560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform4fv__II_3FI
5237560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
52382545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
52392ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
52402ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
5241560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v_base = (GLfloat *) 0;
5242560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5243560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
5244560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5245560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
52462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
52472545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
52482545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
5249560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5250560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5251560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
52522545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
52532545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
52542545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5255560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5256560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5257560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
52582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*4) {
52592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
52602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
52612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count*4 < needed";
52622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
52632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5264560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLfloat *)
52653b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(v_ref, (jboolean *)0);
5266560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
5267560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5268560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform4fv(
5269560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5270560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5271560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
5272560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5273560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5274560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5275560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
52763b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
5277560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5278560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
52792545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
52802545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
52812545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5282560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5283560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5284560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
5285560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5286560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform4fv__IILjava_nio_FloatBuffer_2
5287560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
52882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
52892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
52902ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
52913b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
529217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5293560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5294560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
5295560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
52963b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
52972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*4) {
52982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
52992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
53002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count*4 < needed";
53012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
53022ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
530317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
53043b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
530517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLfloat *) (_vBase + _bufferOffset);
530617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5307560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform4fv(
5308560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5309560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5310560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
5311560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
53122ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
53132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
5314560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
53153b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
5316560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
53172ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
53182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
53192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5320560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5321560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5322560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w ) */
5323560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5324560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform4i__IIIII
5325560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z, jint w) {
5326560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform4i(
5327560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5328560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
5329560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y,
5330560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)z,
5331560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)w
5332560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5333560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5334560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5335560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
5336560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5337560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform4iv__II_3II
5338560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
53392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
53402ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
53412ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
5342560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v_base = (GLint *) 0;
5343560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5344560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
5345560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5346560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
53472545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
53482545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
53492545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
5350560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5351560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5352560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
53532545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
53542545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
53552545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5356560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5357560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5358560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
53592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*4) {
53602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
53612ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
53622ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count*4 < needed";
53632ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
53642ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5365560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLint *)
53663b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetIntArrayElements(v_ref, (jboolean *)0);
5367560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
5368560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5369560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform4iv(
5370560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5371560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5372560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
5373560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5374560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5375560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5376560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
53773b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
5378560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5379560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
53802545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
53812545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
53822545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5383560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5384560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5385560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
5386560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5387560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform4iv__IILjava_nio_IntBuffer_2
5388560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
53892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
53902ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
53912ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
53923b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jintArray _array = (jintArray) 0;
539317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5394560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5395560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
5396560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
53973b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
53982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*4) {
53992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
54002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
54012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count*4 < needed";
54022ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
54032ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
540417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
54053b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
540617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLint *) (_vBase + _bufferOffset);
540717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5408560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform4iv(
5409560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5410560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5411560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
5412560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
54132ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
54142ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
5415560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
54163b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
5417560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
54182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
54192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
54202ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5421560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5422560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5423560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5424560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5425560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniformMatrix2fv__IIZ_3FI
5426560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
54272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
54282ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
54292ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
5430560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value_base = (GLfloat *) 0;
5431560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5432560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value = (GLfloat *) 0;
5433560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5434560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!value_ref) {
54352545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
54362545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
54372545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "value == null";
5438560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5439560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5440560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
54412545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
54422545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
54432545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5444560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5445560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5446560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(value_ref) - offset;
54472ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*4) {
54482ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
54492ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
54502ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count*4 < needed";
54512ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
54522ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5453560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    value_base = (GLfloat *)
54543b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(value_ref, (jboolean *)0);
5455560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    value = value_base + offset;
5456560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5457560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniformMatrix2fv(
5458560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5459560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5460560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)transpose,
5461560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)value
5462560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5463560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5464560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5465560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (value_base) {
54663b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
5467560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5468560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
54692545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
54702545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
54712545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5472560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5473560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5474560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5475560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5476560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2
5477560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
54782ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
54792ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
54802ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
54813b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
548217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5483560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5484560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value = (GLfloat *) 0;
5485560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
54863b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
54872ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*4) {
54882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
54892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
54902ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count*4 < needed";
54912ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
54922ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
549317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (value == NULL) {
54943b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
549517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        value = (GLfloat *) (_valueBase + _bufferOffset);
549617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5497560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniformMatrix2fv(
5498560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5499560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5500560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)transpose,
5501560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)value
5502560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
55032ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
55042ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
5505560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
55063b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
5507560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
55082ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
55092ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
55102ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5511560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5512560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5513560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5514560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5515560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniformMatrix3fv__IIZ_3FI
5516560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
55172545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
55182ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
55192ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
5520560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value_base = (GLfloat *) 0;
5521560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5522560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value = (GLfloat *) 0;
5523560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5524560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!value_ref) {
55252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
55262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
55272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "value == null";
5528560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5529560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5530560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
55312545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
55322545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
55332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5534560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5535560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5536560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(value_ref) - offset;
55372ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*9) {
55382ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
55392ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
55402ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count*9 < needed";
55412ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
55422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5543560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    value_base = (GLfloat *)
55443b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(value_ref, (jboolean *)0);
5545560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    value = value_base + offset;
5546560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5547560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniformMatrix3fv(
5548560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5549560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5550560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)transpose,
5551560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)value
5552560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5553560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5554560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5555560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (value_base) {
55563b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
5557560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5558560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
55592545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
55602545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
55612545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5562560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5563560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5564560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5565560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5566560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2
5567560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
55682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
55692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
55702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
55713b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
557217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5573560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5574560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value = (GLfloat *) 0;
5575560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
55763b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
55772ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*9) {
55782ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
55792ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
55802ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count*9 < needed";
55812ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
55822ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
558317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (value == NULL) {
55843b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
558517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        value = (GLfloat *) (_valueBase + _bufferOffset);
558617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5587560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniformMatrix3fv(
5588560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5589560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5590560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)transpose,
5591560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)value
5592560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
55932ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
55942ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
5595560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
55963b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
5597560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
55982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
55992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
56002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5601560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5602560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5603560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5604560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5605560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniformMatrix4fv__IIZ_3FI
5606560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
56072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
56082ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
56092ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
5610560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value_base = (GLfloat *) 0;
5611560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5612560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value = (GLfloat *) 0;
5613560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5614560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!value_ref) {
56152545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
56162545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
56172545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "value == null";
5618560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5619560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5620560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
56212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
56222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
56232545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5624560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5625560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5626560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(value_ref) - offset;
56272ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*16) {
56282ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
56292ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
56302ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < count*16 < needed";
56312ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
56322ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5633560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    value_base = (GLfloat *)
56343b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(value_ref, (jboolean *)0);
5635560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    value = value_base + offset;
5636560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5637560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniformMatrix4fv(
5638560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5639560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5640560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)transpose,
5641560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)value
5642560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5643560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5644560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5645560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (value_base) {
56463b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
5647560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5648560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
56492545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
56502545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
56512545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5652560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5653560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5654560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5655560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5656560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2
5657560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
56582ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
56592ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
56602ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
56613b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
566217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5663560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5664560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value = (GLfloat *) 0;
5665560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
56663b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
56672ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < count*16) {
56682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
56692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
56702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < count*16 < needed";
56712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
56722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
567317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (value == NULL) {
56743b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
567517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        value = (GLfloat *) (_valueBase + _bufferOffset);
567617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5677560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniformMatrix4fv(
5678560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5679560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5680560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)transpose,
5681560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)value
5682560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
56832ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
56842ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
5685560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
56863b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
5687560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
56882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
56892ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
56902ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5691560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5692560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5693560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUseProgram ( GLuint program ) */
5694560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5695560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUseProgram__I
5696560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program) {
5697560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUseProgram(
5698560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program
5699560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5700560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5701560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5702560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glValidateProgram ( GLuint program ) */
5703560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5704560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glValidateProgram__I
5705560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program) {
5706560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glValidateProgram(
5707560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program
5708560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5709560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5710560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5711560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib1f ( GLuint indx, GLfloat x ) */
5712560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5713560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib1f__IF
5714560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloat x) {
5715560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib1f(
5716560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
5717560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x
5718560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5719560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5720560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5721560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
5722560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5723560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib1fv__I_3FI
5724560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
57252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
57262ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
57272ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
5728560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values_base = (GLfloat *) 0;
5729560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5730560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
5731560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5732560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!values_ref) {
57332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
57342545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
57352545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "values == null";
5736560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5737560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5738560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
57392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
57402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
57412545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5742560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5743560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5744560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(values_ref) - offset;
57452ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
57462ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
57472ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
57482ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < 1 < needed";
57492ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
57502ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5751560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values_base = (GLfloat *)
57523b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(values_ref, (jboolean *)0);
5753560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values = values_base + offset;
5754560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5755560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib1fv(
5756560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
5757560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
5758560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5759560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5760560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5761560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (values_base) {
57623b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
5763560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5764560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
57652545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
57662545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
57672545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5768560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5769560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5770560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
5771560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5772560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2
5773560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
57742ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
57752ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
57762ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
57773b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
577817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5779560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5780560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
5781560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
57823b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
57832ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 1) {
57842ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
57852ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
57862ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
57872ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
57882ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
578917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (values == NULL) {
57903b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
579117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        values = (GLfloat *) (_valuesBase + _bufferOffset);
579217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5793560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib1fv(
5794560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
5795560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
5796560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
57972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
57982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
5799560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
58003b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
5801560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
58022ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
58032ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
58042ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5805560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5806560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5807560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib2f ( GLuint indx, GLfloat x, GLfloat y ) */
5808560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5809560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib2f__IFF
5810560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y) {
5811560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib2f(
5812560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
5813560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x,
5814560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)y
5815560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5816560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5817560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5818560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
5819560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5820560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib2fv__I_3FI
5821560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
58222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
58232ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
58242ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
5825560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values_base = (GLfloat *) 0;
5826560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5827560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
5828560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5829560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!values_ref) {
58302545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
58312545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
58322545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "values == null";
5833560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5834560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5835560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
58362545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
58372545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
58382545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5839560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5840560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5841560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(values_ref) - offset;
58422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 2) {
58432ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
58442ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
58452ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < 2 < needed";
58462ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
58472ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5848560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values_base = (GLfloat *)
58493b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(values_ref, (jboolean *)0);
5850560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values = values_base + offset;
5851560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5852560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib2fv(
5853560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
5854560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
5855560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5856560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5857560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5858560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (values_base) {
58593b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
5860560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5861560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
58622545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
58632545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
58642545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5865560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5866560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5867560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
5868560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5869560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2
5870560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
58712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
58722ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
58732ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
58743b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
587517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5876560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5877560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
5878560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
58793b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
58802ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 2) {
58812ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
58822ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
58832ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 2 < needed";
58842ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
58852ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
588617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (values == NULL) {
58873b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
588817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        values = (GLfloat *) (_valuesBase + _bufferOffset);
588917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5890560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib2fv(
5891560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
5892560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
5893560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
58942ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
58952ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
5896560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
58973b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
5898560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
58992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
59002ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
59012ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5902560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5903560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5904560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib3f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z ) */
5905560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5906560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib3f__IFFF
5907560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z) {
5908560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib3f(
5909560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
5910560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x,
5911560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)y,
5912560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)z
5913560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5914560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5915560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5916560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
5917560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5918560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib3fv__I_3FI
5919560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
59202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
59212ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
59222ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
5923560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values_base = (GLfloat *) 0;
5924560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5925560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
5926560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5927560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!values_ref) {
59282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
59292545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
59302545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "values == null";
5931560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5932560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5933560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
59342545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
59352545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
59362545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5937560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5938560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5939560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(values_ref) - offset;
59402ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 3) {
59412ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
59422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
59432ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < 3 < needed";
59442ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
59452ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
5946560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values_base = (GLfloat *)
59473b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(values_ref, (jboolean *)0);
5948560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values = values_base + offset;
5949560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5950560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib3fv(
5951560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
5952560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
5953560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5954560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5955560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5956560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (values_base) {
59573b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
5958560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5959560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
59602545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
59612545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
59622545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5963560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5964560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5965560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
5966560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5967560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2
5968560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
59692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
59702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
59712ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
59723b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
597317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5974560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5975560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
5976560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
59773b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
59782ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 3) {
59792ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
59802ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
59812ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 3 < needed";
59822ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
59832ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
598417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (values == NULL) {
59853b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
598617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        values = (GLfloat *) (_valuesBase + _bufferOffset);
598717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5988560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib3fv(
5989560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
5990560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
5991560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
59922ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
59932ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
5994560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
59953b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
5996560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
59972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
59982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
59992ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
6000560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6001560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6002560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib4f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
6003560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
6004560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib4f__IFFFF
6005560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z, jfloat w) {
6006560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib4f(
6007560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
6008560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x,
6009560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)y,
6010560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)z,
6011560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)w
6012560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
6013560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6014560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6015560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
6016560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
6017560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib4fv__I_3FI
6018560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
60192545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
60202ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
60212ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
6022560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values_base = (GLfloat *) 0;
6023560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
6024560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
6025560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6026560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!values_ref) {
60272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
60282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
60292545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "values == null";
6030560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
6031560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
6032560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
60332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
60342545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
60352545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
6036560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
6037560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
6038560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(values_ref) - offset;
60392ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 4) {
60402ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
60412ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
60422ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "length - offset < 4 < needed";
60432ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
60442ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
6045560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values_base = (GLfloat *)
60463b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->GetFloatArrayElements(values_ref, (jboolean *)0);
6047560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values = values_base + offset;
6048560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6049560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib4fv(
6050560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
6051560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
6052560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
6053560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6054560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
6055560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (values_base) {
60563b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
6057560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
6058560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
60592545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
60602545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
60612545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
6062560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6063560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6064560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
6065560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
6066560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2
6067560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
60682ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    jint _exception = 0;
60692ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionType = NULL;
60702ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    const char * _exceptionMessage = NULL;
60713b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    jfloatArray _array = (jfloatArray) 0;
607217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
6073560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
6074560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
6075560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
60763b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi    values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
60772ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_remaining < 4) {
60782ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exception = 1;
60792ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
60802ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        _exceptionMessage = "remaining() < 4 < needed";
60812ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        goto exit;
60822ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
608317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (values == NULL) {
60843b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
608517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        values = (GLfloat *) (_valuesBase + _bufferOffset);
608617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
6087560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib4fv(
6088560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
6089560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
6090560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
60912ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian
60922ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopianexit:
6093560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
60943b1d46e809ed38cd5662c110c511b8d98868ed72Hiroshi Yamauchi        _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
6095560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
60962ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    if (_exception) {
60972ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
60982ad0477f16c64dc3126741933f11e27353521bb4Mathias Agopian    }
6099560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6100560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6101224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint offset ) */
6102224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevichstatic void
6103224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevichandroid_glVertexAttribPointer__IIIZII
6104224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich  (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jint offset) {
6105224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich    glVertexAttribPointer(
6106224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLuint)indx,
6107224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLint)size,
6108224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLenum)type,
6109224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLboolean)normalized,
6110224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLsizei)stride,
611101c26ea89d4bbea3cf550e9328742302dd9a2b25Ashok Bhat        reinterpret_cast<GLvoid *>(offset)
6112224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich    );
6113224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich}
6114224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich
6115560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr ) */
6116560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
6117560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I
6118560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jobject ptr_buf, jint remaining) {
6119560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
612017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
6121560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
6122560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *ptr = (GLvoid *) 0;
6123560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6124560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (ptr_buf) {
6125560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        ptr = (GLvoid *) getDirectBufferPointer(_env, ptr_buf);
6126560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        if ( ! ptr ) {
6127560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            return;
6128560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        }
6129560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
6130560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttribPointerBounds(
6131560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
6132560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)size,
6133560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)type,
6134560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)normalized,
6135560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)stride,
6136560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)ptr,
6137560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)remaining
6138560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
6139560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6140560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6141560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */
6142560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
6143560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glViewport__IIII
6144560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
6145560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glViewport(
6146560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
6147560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y,
6148560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
6149560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height
6150560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
6151560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6152560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6153560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic const char *classPathName = "android/opengl/GLES20";
6154560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6155560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic JNINativeMethod methods[] = {
6156560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"_nativeClassInit", "()V", (void*)nativeClassInit },
6157560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I },
6158560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glAttachShader", "(II)V", (void *) android_glAttachShader__II },
6159560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBindAttribLocation", "(IILjava/lang/String;)V", (void *) android_glBindAttribLocation__IILjava_lang_String_2 },
6160560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II },
6161560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBindFramebuffer", "(II)V", (void *) android_glBindFramebuffer__II },
6162560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBindRenderbuffer", "(II)V", (void *) android_glBindRenderbuffer__II },
6163560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBindTexture", "(II)V", (void *) android_glBindTexture__II },
6164560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBlendColor", "(FFFF)V", (void *) android_glBlendColor__FFFF },
6165560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBlendEquation", "(I)V", (void *) android_glBlendEquation__I },
6166560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBlendEquationSeparate", "(II)V", (void *) android_glBlendEquationSeparate__II },
6167560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II },
6168560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBlendFuncSeparate", "(IIII)V", (void *) android_glBlendFuncSeparate__IIII },
6169560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I },
6170560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 },
6171560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCheckFramebufferStatus", "(I)I", (void *) android_glCheckFramebufferStatus__I },
6172560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glClear", "(I)V", (void *) android_glClear__I },
6173560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF },
6174560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F },
6175560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glClearStencil", "(I)V", (void *) android_glClearStencil__I },
6176560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ },
6177560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCompileShader", "(I)V", (void *) android_glCompileShader__I },
6178560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 },
6179560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
6180560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII },
6181560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII },
6182560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCreateProgram", "()I", (void *) android_glCreateProgram__ },
6183560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCreateShader", "(I)I", (void *) android_glCreateShader__I },
6184560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCullFace", "(I)V", (void *) android_glCullFace__I },
6185560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II },
6186560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 },
6187560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteFramebuffers", "(I[II)V", (void *) android_glDeleteFramebuffers__I_3II },
6188560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2 },
6189560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteProgram", "(I)V", (void *) android_glDeleteProgram__I },
6190560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteRenderbuffers", "(I[II)V", (void *) android_glDeleteRenderbuffers__I_3II },
6191560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2 },
6192560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteShader", "(I)V", (void *) android_glDeleteShader__I },
6193560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II },
6194560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 },
6195560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I },
6196560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z },
6197560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF },
6198560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDetachShader", "(II)V", (void *) android_glDetachShader__II },
6199560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDisable", "(I)V", (void *) android_glDisable__I },
6200560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDisableVertexAttribArray", "(I)V", (void *) android_glDisableVertexAttribArray__I },
6201560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III },
6202224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich{"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII },
6203560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 },
6204560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glEnable", "(I)V", (void *) android_glEnable__I },
6205560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glEnableVertexAttribArray", "(I)V", (void *) android_glEnableVertexAttribArray__I },
6206560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glFinish", "()V", (void *) android_glFinish__ },
6207560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glFlush", "()V", (void *) android_glFlush__ },
6208560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glFramebufferRenderbuffer", "(IIII)V", (void *) android_glFramebufferRenderbuffer__IIII },
6209560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glFramebufferTexture2D", "(IIIII)V", (void *) android_glFramebufferTexture2D__IIIII },
6210560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glFrontFace", "(I)V", (void *) android_glFrontFace__I },
6211560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II },
6212560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 },
6213560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenerateMipmap", "(I)V", (void *) android_glGenerateMipmap__I },
6214560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenFramebuffers", "(I[II)V", (void *) android_glGenFramebuffers__I_3II },
6215560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenFramebuffers__ILjava_nio_IntBuffer_2 },
6216560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenRenderbuffers", "(I[II)V", (void *) android_glGenRenderbuffers__I_3II },
6217560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenRenderbuffers__ILjava_nio_IntBuffer_2 },
6218560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II },
6219560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 },
6220560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetActiveAttrib", "(III[II[II[II[BI)V", (void *) android_glGetActiveAttrib__III_3II_3II_3II_3BI },
6221560814f6b11abe83ff0c4ed18cac015c276b3181Jack 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 },
6222dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer{"glGetActiveAttrib", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveAttrib1 },
6223dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer{"glGetActiveAttrib", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveAttrib2 },
6224560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetActiveUniform", "(III[II[II[II[BI)V", (void *) android_glGetActiveUniform__III_3II_3II_3II_3BI },
6225dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer{"glGetActiveUniform", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveUniform1 },
6226560814f6b11abe83ff0c4ed18cac015c276b3181Jack 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 },
6227dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer{"glGetActiveUniform", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveUniform2 },
6228560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetAttachedShaders", "(II[II[II)V", (void *) android_glGetAttachedShaders__II_3II_3II },
6229560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetAttachedShaders", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
6230560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetAttribLocation", "(ILjava/lang/String;)I", (void *) android_glGetAttribLocation__ILjava_lang_String_2 },
6231560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI },
6232560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 },
6233560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II },
6234560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 },
6235560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetError", "()I", (void *) android_glGetError__ },
6236560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI },
6237560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 },
6238560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetFramebufferAttachmentParameteriv", "(III[II)V", (void *) android_glGetFramebufferAttachmentParameteriv__III_3II },
6239560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetFramebufferAttachmentParameteriv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2 },
6240560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II },
6241560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 },
6242560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetProgramiv", "(II[II)V", (void *) android_glGetProgramiv__II_3II },
6243560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetProgramiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetProgramiv__IILjava_nio_IntBuffer_2 },
6244560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetProgramInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetProgramInfoLog },
6245560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetRenderbufferParameteriv", "(II[II)V", (void *) android_glGetRenderbufferParameteriv__II_3II },
6246560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetRenderbufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2 },
6247560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetShaderiv", "(II[II)V", (void *) android_glGetShaderiv__II_3II },
6248560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetShaderiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetShaderiv__IILjava_nio_IntBuffer_2 },
6249560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetShaderInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetShaderInfoLog },
6250560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetShaderPrecisionFormat", "(II[II[II)V", (void *) android_glGetShaderPrecisionFormat__II_3II_3II },
6251560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetShaderPrecisionFormat", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
6252560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetShaderSource", "(II[II[BI)V", (void *) android_glGetShaderSource__II_3II_3BI },
6253560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetShaderSource", "(IILjava/nio/IntBuffer;B)V", (void *) android_glGetShaderSource__IILjava_nio_IntBuffer_2B },
6254dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer{"glGetShaderSource", "(I)Ljava/lang/String;", (void *) android_glGetShaderSource },
6255560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString },
6256560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI },
6257560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 },
6258560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II },
6259560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 },
6260560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetUniformfv", "(II[FI)V", (void *) android_glGetUniformfv__II_3FI },
6261560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetUniformfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetUniformfv__IILjava_nio_FloatBuffer_2 },
6262560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetUniformiv", "(II[II)V", (void *) android_glGetUniformiv__II_3II },
6263560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetUniformiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetUniformiv__IILjava_nio_IntBuffer_2 },
6264560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetUniformLocation", "(ILjava/lang/String;)I", (void *) android_glGetUniformLocation__ILjava_lang_String_2 },
6265560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetVertexAttribfv", "(II[FI)V", (void *) android_glGetVertexAttribfv__II_3FI },
6266560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetVertexAttribfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2 },
6267560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetVertexAttribiv", "(II[II)V", (void *) android_glGetVertexAttribiv__II_3II },
6268560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetVertexAttribiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2 },
6269560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glHint", "(II)V", (void *) android_glHint__II },
6270560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I },
6271560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I },
6272560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glIsFramebuffer", "(I)Z", (void *) android_glIsFramebuffer__I },
6273560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glIsProgram", "(I)Z", (void *) android_glIsProgram__I },
6274560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glIsRenderbuffer", "(I)Z", (void *) android_glIsRenderbuffer__I },
6275560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glIsShader", "(I)Z", (void *) android_glIsShader__I },
6276560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glIsTexture", "(I)Z", (void *) android_glIsTexture__I },
6277560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glLineWidth", "(F)V", (void *) android_glLineWidth__F },
6278560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glLinkProgram", "(I)V", (void *) android_glLinkProgram__I },
6279560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II },
6280560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF },
6281560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 },
6282560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glReleaseShaderCompiler", "()V", (void *) android_glReleaseShaderCompiler__ },
6283560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glRenderbufferStorage", "(IIII)V", (void *) android_glRenderbufferStorage__IIII },
6284560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ },
6285560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glScissor", "(IIII)V", (void *) android_glScissor__IIII },
6286560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glShaderBinary", "(I[IIILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__I_3IIILjava_nio_Buffer_2I },
6287560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glShaderBinary", "(ILjava/nio/IntBuffer;ILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I },
6288560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glShaderSource", "(ILjava/lang/String;)V", (void *) android_glShaderSource },
6289560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III },
6290560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glStencilFuncSeparate", "(IIII)V", (void *) android_glStencilFuncSeparate__IIII },
6291560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glStencilMask", "(I)V", (void *) android_glStencilMask__I },
6292560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glStencilMaskSeparate", "(II)V", (void *) android_glStencilMaskSeparate__II },
6293560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glStencilOp", "(III)V", (void *) android_glStencilOp__III },
6294560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glStencilOpSeparate", "(IIII)V", (void *) android_glStencilOpSeparate__IIII },
6295560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 },
6296560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF },
6297560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI },
6298560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 },
6299560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III },
6300560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II },
6301560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 },
6302560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
6303560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform1f", "(IF)V", (void *) android_glUniform1f__IF },
6304560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform1fv", "(II[FI)V", (void *) android_glUniform1fv__II_3FI },
6305560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform1fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform1fv__IILjava_nio_FloatBuffer_2 },
6306560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform1i", "(II)V", (void *) android_glUniform1i__II },
6307560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform1iv", "(II[II)V", (void *) android_glUniform1iv__II_3II },
6308560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform1iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform1iv__IILjava_nio_IntBuffer_2 },
6309560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform2f", "(IFF)V", (void *) android_glUniform2f__IFF },
6310560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform2fv", "(II[FI)V", (void *) android_glUniform2fv__II_3FI },
6311560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform2fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform2fv__IILjava_nio_FloatBuffer_2 },
6312560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform2i", "(III)V", (void *) android_glUniform2i__III },
6313560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform2iv", "(II[II)V", (void *) android_glUniform2iv__II_3II },
6314560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform2iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform2iv__IILjava_nio_IntBuffer_2 },
6315560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform3f", "(IFFF)V", (void *) android_glUniform3f__IFFF },
6316560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform3fv", "(II[FI)V", (void *) android_glUniform3fv__II_3FI },
6317560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform3fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform3fv__IILjava_nio_FloatBuffer_2 },
6318560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform3i", "(IIII)V", (void *) android_glUniform3i__IIII },
6319560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform3iv", "(II[II)V", (void *) android_glUniform3iv__II_3II },
6320560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform3iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform3iv__IILjava_nio_IntBuffer_2 },
6321560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform4f", "(IFFFF)V", (void *) android_glUniform4f__IFFFF },
6322560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform4fv", "(II[FI)V", (void *) android_glUniform4fv__II_3FI },
6323560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform4fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform4fv__IILjava_nio_FloatBuffer_2 },
6324560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform4i", "(IIIII)V", (void *) android_glUniform4i__IIIII },
6325560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform4iv", "(II[II)V", (void *) android_glUniform4iv__II_3II },
6326560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform4iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform4iv__IILjava_nio_IntBuffer_2 },
6327560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniformMatrix2fv", "(IIZ[FI)V", (void *) android_glUniformMatrix2fv__IIZ_3FI },
6328560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniformMatrix2fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2 },
6329560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniformMatrix3fv", "(IIZ[FI)V", (void *) android_glUniformMatrix3fv__IIZ_3FI },
6330560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniformMatrix3fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2 },
6331560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniformMatrix4fv", "(IIZ[FI)V", (void *) android_glUniformMatrix4fv__IIZ_3FI },
6332560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniformMatrix4fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2 },
6333560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUseProgram", "(I)V", (void *) android_glUseProgram__I },
6334560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glValidateProgram", "(I)V", (void *) android_glValidateProgram__I },
6335560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib1f", "(IF)V", (void *) android_glVertexAttrib1f__IF },
6336560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib1fv", "(I[FI)V", (void *) android_glVertexAttrib1fv__I_3FI },
6337560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib1fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2 },
6338560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib2f", "(IFF)V", (void *) android_glVertexAttrib2f__IFF },
6339560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib2fv", "(I[FI)V", (void *) android_glVertexAttrib2fv__I_3FI },
6340560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib2fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2 },
6341560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib3f", "(IFFF)V", (void *) android_glVertexAttrib3f__IFFF },
6342560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib3fv", "(I[FI)V", (void *) android_glVertexAttrib3fv__I_3FI },
6343560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib3fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2 },
6344560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib4f", "(IFFFF)V", (void *) android_glVertexAttrib4f__IFFFF },
6345560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib4fv", "(I[FI)V", (void *) android_glVertexAttrib4fv__I_3FI },
6346560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib4fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2 },
6347224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich{"glVertexAttribPointer", "(IIIZII)V", (void *) android_glVertexAttribPointer__IIIZII },
6348560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttribPointerBounds", "(IIIZILjava/nio/Buffer;I)V", (void *) android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I },
6349560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glViewport", "(IIII)V", (void *) android_glViewport__IIII },
6350560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich};
6351560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6352560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichint register_android_opengl_jni_GLES20(JNIEnv *_env)
6353560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{
6354560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    int err;
6355560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
6356560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    return err;
6357560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6358