android_opengl_GLES20.cpp revision 428d3fcbe3596b18549cdada9fc68a29f159a946
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
2015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian#include <GLES2/gl2.h>
2115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian#include <GLES2/gl2ext.h>
2215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
2324ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes#include "jni.h"
2424ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes#include "JNIHelp.h"
25560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich#include <android_runtime/AndroidRuntime.h>
26560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich#include <utils/misc.h>
27560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich#include <assert.h>
28560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
29560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic int initialized = 0;
30560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
31560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jclass nioAccessClass;
32560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jclass bufferClass;
33560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jmethodID getBasePointerID;
34560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jmethodID getBaseArrayID;
35560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jmethodID getBaseArrayOffsetID;
36560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jfieldID positionID;
37560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jfieldID limitID;
38560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jfieldID elementSizeShiftID;
39560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
4115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian/* special calls implemented in Android's GLES wrapper used to more
4215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian * efficiently bound-check passed arrays */
4315284dee8efe6b4d1441ab040962077614b5061aMathias Agopianextern "C" {
4415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian#ifdef GL_VERSION_ES_CM_1_1
4515284dee8efe6b4d1441ab040962077614b5061aMathias AgopianGL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
4615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        const GLvoid *ptr, GLsizei count);
4715284dee8efe6b4d1441ab040962077614b5061aMathias AgopianGL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
4815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        const GLvoid *pointer, GLsizei count);
4915284dee8efe6b4d1441ab040962077614b5061aMathias AgopianGL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
5015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        GLsizei stride, const GLvoid *pointer, GLsizei count);
5115284dee8efe6b4d1441ab040962077614b5061aMathias AgopianGL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
5215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        GLsizei stride, const GLvoid *pointer, GLsizei count);
5315284dee8efe6b4d1441ab040962077614b5061aMathias AgopianGL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
5415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        GLsizei stride, const GLvoid *pointer, GLsizei count);
5515284dee8efe6b4d1441ab040962077614b5061aMathias AgopianGL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
5615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        GLsizei stride, const GLvoid *pointer, GLsizei count);
5715284dee8efe6b4d1441ab040962077614b5061aMathias AgopianGL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
5815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        GLsizei stride, const GLvoid *pointer, GLsizei count);
5915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian#endif
6015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian#ifdef GL_ES_VERSION_2_0
6115284dee8efe6b4d1441ab040962077614b5061aMathias Agopianstatic void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type,
6215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) {
6315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    glVertexAttribPointer(indx, size, type, normalized, stride, pointer);
6415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian}
6515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian#endif
66428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes#ifdef GL_ES_VERSION_3_0
67428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughesstatic void glVertexAttribIPointerBounds(GLuint indx, GLint size, GLenum type,
68428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes        GLsizei stride, const GLvoid *pointer, GLsizei count) {
69428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes    glVertexAttribIPointer(indx, size, type, stride, pointer);
70428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes}
71428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes#endif
7215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian}
7315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
74560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* Cache method IDs each time the class is loaded. */
75560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
76560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
7724ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott HughesnativeClassInit(JNIEnv *_env, jclass glImplClass)
78560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{
79560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
80560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
81560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
82560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
83560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
84560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
85560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
86560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            "getBasePointer", "(Ljava/nio/Buffer;)J");
87560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
88560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
89560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
90560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
91560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
92560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    positionID = _env->GetFieldID(bufferClass, "position", "I");
93560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    limitID = _env->GetFieldID(bufferClass, "limit", "I");
94560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    elementSizeShiftID =
95560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
96560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
97560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
98560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void *
9917045a16575ece34cfadb63da4791f115625df78Thomas TafertshofergetPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
100560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{
101560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint position;
102560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint limit;
103560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint elementSizeShift;
104560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jlong pointer;
105560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
106560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    position = _env->GetIntField(buffer, positionID);
107560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    limit = _env->GetIntField(buffer, limitID);
108560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
109560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    *remaining = (limit - position) << elementSizeShift;
110560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    pointer = _env->CallStaticLongMethod(nioAccessClass,
111560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            getBasePointerID, buffer);
112560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (pointer != 0L) {
113560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        *array = NULL;
114560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        return (void *) (jint) pointer;
115560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
11624ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes
117560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
118560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            getBaseArrayID, buffer);
11917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    *offset = _env->CallStaticIntMethod(nioAccessClass,
120560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            getBaseArrayOffsetID, buffer);
12124ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes
12217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    return NULL;
123560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
124560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
125560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
126560814f6b11abe83ff0c4ed18cac015c276b3181Jack PalevichreleasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
127560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{
128560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _env->ReleasePrimitiveArrayCritical(array, data,
12915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian                       commit ? 0 : JNI_ABORT);
130560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
131560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
132560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void *
133560814f6b11abe83ff0c4ed18cac015c276b3181Jack PalevichgetDirectBufferPointer(JNIEnv *_env, jobject buffer) {
134560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    char* buf = (char*) _env->GetDirectBufferAddress(buffer);
135560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (buf) {
136560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        jint position = _env->GetIntField(buffer, positionID);
137560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
138560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        buf += position << elementSizeShift;
139560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    } else {
14024ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        jniThrowException(_env, "java/lang/IllegalArgumentException",
14124ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes                          "Must use a native order direct Buffer");
142560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
143560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    return (void*) buf;
144560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
145560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
14615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian// --------------------------------------------------------------------------
14715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
14815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian/*
14915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian * returns the number of values glGet returns for a given pname.
15015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian *
15115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian * The code below is written such that pnames requiring only one values
15215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian * are the default (and are not explicitely tested for). This makes the
15315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian * checking code much shorter/readable/efficient.
15415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian *
15515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian * This means that unknown pnames (e.g.: extensions) will default to 1. If
15615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian * that unknown pname needs more than 1 value, then the validation check
15715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian * is incomplete and the app may crash if it passed the wrong number params.
15815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian */
15915284dee8efe6b4d1441ab040962077614b5061aMathias Agopianstatic int getNeededCount(GLint pname) {
16015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    int needed = 1;
16115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian#ifdef GL_ES_VERSION_2_0
16215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    // GLES 2.x pnames
16315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    switch (pname) {
16415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_ALIASED_LINE_WIDTH_RANGE:
16515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_ALIASED_POINT_SIZE_RANGE:
16615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            needed = 2;
16715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            break;
16815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
16915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_BLEND_COLOR:
17015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_COLOR_CLEAR_VALUE:
17115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_COLOR_WRITEMASK:
17215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_SCISSOR_BOX:
17315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_VIEWPORT:
17415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            needed = 4;
17515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            break;
17615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
17715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_COMPRESSED_TEXTURE_FORMATS:
17815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
17915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            break;
18015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
18115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_SHADER_BINARY_FORMATS:
18215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed);
18315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            break;
18415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
18515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian#endif
18615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
18715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian#ifdef GL_VERSION_ES_CM_1_1
18815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    // GLES 1.x pnames
18915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    switch (pname) {
19015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_ALIASED_LINE_WIDTH_RANGE:
19115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_ALIASED_POINT_SIZE_RANGE:
19215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_DEPTH_RANGE:
19315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_SMOOTH_LINE_WIDTH_RANGE:
19415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_SMOOTH_POINT_SIZE_RANGE:
19515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            needed = 2;
19615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            break;
19715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
19815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_CURRENT_NORMAL:
19915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_POINT_DISTANCE_ATTENUATION:
20015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            needed = 3;
20115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            break;
20215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
20315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_COLOR_CLEAR_VALUE:
20415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_COLOR_WRITEMASK:
20515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_CURRENT_COLOR:
20615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_CURRENT_TEXTURE_COORDS:
20715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_FOG_COLOR:
20815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_LIGHT_MODEL_AMBIENT:
20915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_SCISSOR_BOX:
21015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_VIEWPORT:
21115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            needed = 4;
21215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            break;
21315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
21415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_MODELVIEW_MATRIX:
21515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_PROJECTION_MATRIX:
21615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_TEXTURE_MATRIX:
21715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            needed = 16;
21815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            break;
21915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
22015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_COMPRESSED_TEXTURE_FORMATS:
22115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
22215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            break;
22315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
22415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian#endif
22515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    return needed;
226560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
227560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
22815284dee8efe6b4d1441ab040962077614b5061aMathias Agopiantemplate <typename JTYPEARRAY, typename CTYPE, void GET(GLenum, CTYPE*)>
22915284dee8efe6b4d1441ab040962077614b5061aMathias Agopianstatic void
23015284dee8efe6b4d1441ab040962077614b5061aMathias Agopianget
23115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian  (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
23215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
23315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType;
23415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage;
23515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    CTYPE *params_base = (CTYPE *) 0;
23615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _remaining;
23715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    CTYPE *params = (CTYPE *) 0;
23815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    int _needed = 0;
23915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
24015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (!params_ref) {
24115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
24215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
24315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "params == null";
24415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
24515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
24615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (offset < 0) {
24715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
24815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
24915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "offset < 0";
25015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
25115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
25215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    _remaining = _env->GetArrayLength(params_ref) - offset;
25315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    _needed = getNeededCount(pname);
25415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    // if we didn't find this pname, we just assume the user passed
25515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    // an array of the right size -- this might happen with extensions
25615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    // or if we forget an enum here.
25715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < _needed) {
25815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
25915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
26015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < needed";
26115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
26215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
26315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    params_base = (CTYPE *)
26415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
26515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    params = params_base + offset;
26615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
26715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    GET(
26815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        (GLenum)pname,
26915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        (CTYPE *)params
27015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    );
27115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
27215284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
27315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (params_base) {
27415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
27515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            _exception ? JNI_ABORT: 0);
27615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
27715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
27815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
27915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
28015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian}
28115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
28215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
28315284dee8efe6b4d1441ab040962077614b5061aMathias Agopiantemplate <typename CTYPE, void GET(GLenum, CTYPE*)>
28415284dee8efe6b4d1441ab040962077614b5061aMathias Agopianstatic void
28515284dee8efe6b4d1441ab040962077614b5061aMathias Agopiangetarray
28615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
28715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
28815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType;
28915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage;
29015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jarray _array = (jarray) 0;
29115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _bufferOffset = (jint) 0;
29215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _remaining;
29315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    CTYPE *params = (CTYPE *) 0;
29415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    int _needed = 0;
29515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
29615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    params = (CTYPE *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
29715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    _needed = getNeededCount(pname);
29815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    // if we didn't find this pname, we just assume the user passed
29915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    // an array of the right size -- this might happen with extensions
30015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    // or if we forget an enum here.
30115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_needed>0 && _remaining < _needed) {
30215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
30315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
30415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < needed";
30515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
30615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
30715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (params == NULL) {
30815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
30915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        params = (CTYPE *) (_paramsBase + _bufferOffset);
31015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
31115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    GET(
31215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        (GLenum)pname,
31315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        (CTYPE *)params
31415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    );
31515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
31615284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
31715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_array) {
31815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
31915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
32015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
32115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
32215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
323560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
324560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
325560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich// --------------------------------------------------------------------------
326560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glActiveTexture ( GLenum texture ) */
327560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
328560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glActiveTexture__I
329560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint texture) {
330560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glActiveTexture(
331560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)texture
332560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
333560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
334560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
335560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glAttachShader ( GLuint program, GLuint shader ) */
336560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
337560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glAttachShader__II
338560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint shader) {
339560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glAttachShader(
340560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
341560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader
342560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
343560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
344560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
345560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBindAttribLocation ( GLuint program, GLuint index, const char *name ) */
346560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
347560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBindAttribLocation__IILjava_lang_String_2
348560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint index, jstring name) {
3492545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
35015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
35115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
352560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    const char* _nativename = 0;
353560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
354560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!name) {
355428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes        _exception = 1;
3562545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
3572545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "name == null";
358560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
359560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
360560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _nativename = _env->GetStringUTFChars(name, 0);
361560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
362560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBindAttribLocation(
363560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
364560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
365560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (char *)_nativename
366560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
367560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
368560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
369560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_nativename) {
370560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleaseStringUTFChars(name, _nativename);
371560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
372560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3732545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
3742545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
3752545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
376560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
377560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
378560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBindBuffer ( GLenum target, GLuint buffer ) */
379560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
380560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBindBuffer__II
381560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint buffer) {
382560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBindBuffer(
383560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
384560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)buffer
385560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
386560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
387560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
388560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBindFramebuffer ( GLenum target, GLuint framebuffer ) */
389560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
390560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBindFramebuffer__II
391560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint framebuffer) {
392560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBindFramebuffer(
393560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
394560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)framebuffer
395560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
396560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
397560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
398560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBindRenderbuffer ( GLenum target, GLuint renderbuffer ) */
399560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
400560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBindRenderbuffer__II
401560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint renderbuffer) {
402560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBindRenderbuffer(
403560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
404560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)renderbuffer
405560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
406560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
407560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
408560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBindTexture ( GLenum target, GLuint texture ) */
409560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
410560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBindTexture__II
411560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint texture) {
412560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBindTexture(
413560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
414560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)texture
415560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
416560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
417560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
418560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBlendColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
419560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
420560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBlendColor__FFFF
421560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
422560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBlendColor(
423560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)red,
424560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)green,
425560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)blue,
426560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)alpha
427560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
428560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
429560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
430560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBlendEquation ( GLenum mode ) */
431560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
432560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBlendEquation__I
433560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint mode) {
43473108675c944ab4ee89631dced23566b12341b66Jack Palevich    glBlendEquation(
43573108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)mode
43673108675c944ab4ee89631dced23566b12341b66Jack Palevich    );
437560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
438560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
439560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBlendEquationSeparate ( GLenum modeRGB, GLenum modeAlpha ) */
440560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
441560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBlendEquationSeparate__II
442560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint modeRGB, jint modeAlpha) {
44373108675c944ab4ee89631dced23566b12341b66Jack Palevich    glBlendEquationSeparate(
44473108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)modeRGB,
44573108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)modeAlpha
44673108675c944ab4ee89631dced23566b12341b66Jack Palevich    );
447560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
448560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
449560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */
450560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
451560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBlendFunc__II
452560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) {
453560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBlendFunc(
454560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)sfactor,
455560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)dfactor
456560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
457560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
458560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
459560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBlendFuncSeparate ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) */
460560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
461560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBlendFuncSeparate__IIII
462560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) {
46373108675c944ab4ee89631dced23566b12341b66Jack Palevich    glBlendFuncSeparate(
46473108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)srcRGB,
46573108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)dstRGB,
46673108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)srcAlpha,
46773108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)dstAlpha
46873108675c944ab4ee89631dced23566b12341b66Jack Palevich    );
469560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
470560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
471560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */
472560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
473560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBufferData__IILjava_nio_Buffer_2I
474560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) {
4752545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
47615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
47715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
478560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
47917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
480560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
481560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *data = (GLvoid *) 0;
482560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
483560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (data_buf) {
48417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
485560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        if (_remaining < size) {
4862545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer            _exception = 1;
4872545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer            _exceptionType = "java/lang/IllegalArgumentException";
4882545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer            _exceptionMessage = "remaining() < size < needed";
489560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            goto exit;
490560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        }
491560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
49237c9b49ab5eb5a676370fd7081db0967c38e97a6Thomas Tafertshofer    if (data_buf && data == NULL) {
49317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
49417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        data = (GLvoid *) (_dataBase + _bufferOffset);
49517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
496560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBufferData(
497560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
498560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizeiptr)size,
499560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)data,
500560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)usage
501560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
502560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
503560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
504560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
505560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, data, JNI_FALSE);
506560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
5082545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
5092545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
510560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
511560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
512560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */
513560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
514560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glBufferSubData__IIILjava_nio_Buffer_2
515560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) {
5162545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
51715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
51815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
519560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
52017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
521560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
522560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *data = (GLvoid *) 0;
523560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
52417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
525560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < size) {
5262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
5272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
5282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < size < needed";
529560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
530560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
53117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (data == NULL) {
53217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
53317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        data = (GLvoid *) (_dataBase + _bufferOffset);
53417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
535560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glBufferSubData(
536560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
537560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLintptr)offset,
538560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizeiptr)size,
539560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)data
540560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
541560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
542560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
543560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
544560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, data, JNI_FALSE);
545560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
5472545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
5482545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
549560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
550560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
551560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLenum glCheckFramebufferStatus ( GLenum target ) */
552560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jint
553560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCheckFramebufferStatus__I
554560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target) {
555560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum _returnValue;
556560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glCheckFramebufferStatus(
557560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target
558560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
559428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes    return (jint)_returnValue;
560560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
561560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
562560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glClear ( GLbitfield mask ) */
563560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
564560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glClear__I
565560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint mask) {
566560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glClear(
567560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLbitfield)mask
568560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
569560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
570560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
571560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
572560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
573560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glClearColor__FFFF
574560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
575560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glClearColor(
576560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)red,
577560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)green,
578560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)blue,
579560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)alpha
580560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
581560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
582560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
583560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glClearDepthf ( GLclampf depth ) */
584560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
585560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glClearDepthf__F
586560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jfloat depth) {
587560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glClearDepthf(
588560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)depth
589560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
590560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
591560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
592560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glClearStencil ( GLint s ) */
593560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
594560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glClearStencil__I
595560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint s) {
596560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glClearStencil(
597560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)s
598560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
599560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
600560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
601560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */
602560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
603560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glColorMask__ZZZZ
604560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) {
605560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glColorMask(
606560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)red,
607560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)green,
608560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)blue,
609560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)alpha
610560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
611560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
612560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
613560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glCompileShader ( GLuint shader ) */
614560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
615560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCompileShader__I
616560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shader) {
617560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glCompileShader(
618560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader
619560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
620560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
621560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
622560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */
623560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
624560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2
625560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) {
626560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
62717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
628560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
629560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *data = (GLvoid *) 0;
630560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
63117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
63217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (data == NULL) {
63317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
63417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        data = (GLvoid *) (_dataBase + _bufferOffset);
63517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
636560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glCompressedTexImage2D(
637560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
638560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)level,
639560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)internalformat,
640560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
641560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height,
642560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)border,
643560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)imageSize,
644560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)data
645560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
646560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
647560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, data, JNI_FALSE);
648560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
649560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
650560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
651560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */
652560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
653560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
654560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) {
655560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
65617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
657560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
658560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *data = (GLvoid *) 0;
659560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
66017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
66117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (data == NULL) {
66217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
66317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        data = (GLvoid *) (_dataBase + _bufferOffset);
66417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
665560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glCompressedTexSubImage2D(
666560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
667560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)level,
668560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)xoffset,
669560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)yoffset,
670560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
671560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height,
672560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)format,
673560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)imageSize,
674560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)data
675560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
676560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
677560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, data, JNI_FALSE);
678560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
679560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
680560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
681560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */
682560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
683560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCopyTexImage2D__IIIIIIII
684560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) {
685560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glCopyTexImage2D(
686560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
687560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)level,
688560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)internalformat,
689560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
690560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y,
691560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
692560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height,
693560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)border
694560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
695560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
696560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
697560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */
698560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
699560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCopyTexSubImage2D__IIIIIIII
700560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) {
701560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glCopyTexSubImage2D(
702560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
703560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)level,
704560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)xoffset,
705560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)yoffset,
706560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
707560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y,
708560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
709560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height
710560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
711560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
712560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
713560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLuint glCreateProgram ( void ) */
714560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jint
715560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCreateProgram__
716560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this) {
717560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint _returnValue;
718560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glCreateProgram();
719428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes    return (jint)_returnValue;
720560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
721560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
722560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLuint glCreateShader ( GLenum type ) */
723560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jint
724560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCreateShader__I
725560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint type) {
726560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint _returnValue;
727560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glCreateShader(
728560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)type
729560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
730428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes    return (jint)_returnValue;
731560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
732560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
733560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glCullFace ( GLenum mode ) */
734560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
735560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glCullFace__I
736560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint mode) {
737560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glCullFace(
738560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)mode
739560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
740560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
741560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
742560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
743560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
744560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteBuffers__I_3II
745560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
7462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
74715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
74815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
749560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *buffers_base = (GLuint *) 0;
750560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
751560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *buffers = (GLuint *) 0;
752560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
753560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!buffers_ref) {
7542545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
7552545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
7562545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "buffers == null";
757560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
758560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
759560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
7602545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
7612545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
7622545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
763560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
764560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
765560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(buffers_ref) - offset;
766560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
7672545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
7682545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
7692545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < n < needed";
770560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
771560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
772560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    buffers_base = (GLuint *)
773560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
774560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    buffers = buffers_base + offset;
775560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
776560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteBuffers(
777560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
778560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)buffers
779560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
780560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
781560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
782560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (buffers_base) {
783560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
784560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
785560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
7862545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
7872545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
7882545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
789560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
790560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
791560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
792560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
793560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteBuffers__ILjava_nio_IntBuffer_2
794560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
7952545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
79615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
79715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
798560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
79917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
800560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
801560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *buffers = (GLuint *) 0;
802560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
80317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset);
804560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
8052545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
8062545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
8072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < n < needed";
808560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
809560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
81017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (buffers == NULL) {
81117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
81217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        buffers = (GLuint *) (_buffersBase + _bufferOffset);
81317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
814560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteBuffers(
815560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
816560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)buffers
817560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
818560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
819560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
820560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
821560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, buffers, JNI_FALSE);
822560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
8232545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
8242545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
8252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
826560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
827560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
828560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */
829560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
830560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteFramebuffers__I_3II
831560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
8322545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
83315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
83415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
835560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *framebuffers_base = (GLuint *) 0;
836560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
837560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *framebuffers = (GLuint *) 0;
838560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
839560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!framebuffers_ref) {
8402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
8412545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
8422545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "framebuffers == null";
843560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
844560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
845560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
8462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
8472545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
8482545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
849560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
850560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
851560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
85215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < n) {
85315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
85415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
85515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < n < needed";
85615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
85715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
858560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    framebuffers_base = (GLuint *)
859560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0);
860560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    framebuffers = framebuffers_base + offset;
861560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
862560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteFramebuffers(
863560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
864560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)framebuffers
865560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
866560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
867560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
868560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (framebuffers_base) {
869560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base,
870560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
871560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
8722545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
8732545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
8742545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
875560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
876560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
877560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */
878560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
879560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteFramebuffers__ILjava_nio_IntBuffer_2
880560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
88115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
88215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
88315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
884560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
88517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
886560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
887560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *framebuffers = (GLuint *) 0;
888560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
88917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining, &_bufferOffset);
89015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < n) {
89115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
89215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
89315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < n < needed";
89415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
89515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
89617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (framebuffers == NULL) {
89717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _framebuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
89817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
89917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
900560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteFramebuffers(
901560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
902560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)framebuffers
903560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
90415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
90515284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
906560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
907560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, framebuffers, JNI_FALSE);
908560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
90915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
91015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
91115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
912560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
913560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
914560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteProgram ( GLuint program ) */
915560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
916560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteProgram__I
917560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program) {
918560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteProgram(
919560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program
920560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
921560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
922560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
923560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */
924560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
925560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteRenderbuffers__I_3II
926560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
9272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
92815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
92915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
930560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *renderbuffers_base = (GLuint *) 0;
931560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
932560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *renderbuffers = (GLuint *) 0;
933560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
934560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!renderbuffers_ref) {
9352545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
9362545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
9372545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "renderbuffers == null";
938560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
939560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
940560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
9412545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
9422545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
9432545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
944560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
945560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
946560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
94715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < n) {
94815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
94915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
95015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < n < needed";
95115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
95215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
953560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    renderbuffers_base = (GLuint *)
954560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0);
955560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    renderbuffers = renderbuffers_base + offset;
956560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
957560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteRenderbuffers(
958560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
959560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)renderbuffers
960560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
961560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
962560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
963560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (renderbuffers_base) {
964560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base,
965560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
966560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
9672545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
9682545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
9692545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
970560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
971560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
972560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */
973560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
974560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2
975560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
97615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
97715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
97815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
979560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
98017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
981560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
982560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *renderbuffers = (GLuint *) 0;
983560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
98417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining, &_bufferOffset);
98515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < n) {
98615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
98715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
98815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < n < needed";
98915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
99015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
99117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (renderbuffers == NULL) {
99217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _renderbuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
99317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
99417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
995560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteRenderbuffers(
996560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
997560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)renderbuffers
998560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
99915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
100015284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
1001560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
1002560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, renderbuffers, JNI_FALSE);
1003560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
100415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
100515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
100615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
1007560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1008560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1009560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteShader ( GLuint shader ) */
1010560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1011560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteShader__I
1012560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shader) {
1013560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteShader(
1014560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader
1015560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1016560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1017560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1018560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
1019560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1020560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteTextures__I_3II
1021560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
10222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
102315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
102415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
1025560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *textures_base = (GLuint *) 0;
1026560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1027560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *textures = (GLuint *) 0;
1028560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1029560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!textures_ref) {
10302545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
10312545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
10322545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "textures == null";
1033560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1034560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1035560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
10362545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
10372545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
10382545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
1039560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1040560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1041560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(textures_ref) - offset;
1042560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
10432545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
10442545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
10452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < n < needed";
1046560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1047560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1048560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    textures_base = (GLuint *)
1049560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
1050560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    textures = textures_base + offset;
1051560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1052560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteTextures(
1053560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1054560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)textures
1055560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1056560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1057560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1058560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (textures_base) {
1059560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
1060560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
1061560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
10622545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
10632545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
10642545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1065560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1066560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1067560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
1068560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1069560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDeleteTextures__ILjava_nio_IntBuffer_2
1070560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
10712545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
107215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
107315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
1074560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
107517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1076560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1077560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *textures = (GLuint *) 0;
1078560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
107917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset);
1080560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
10812545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
10822545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
10832545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < n < needed";
1084560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1085560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
108617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (textures == NULL) {
108717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
108817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        textures = (GLuint *) (_texturesBase + _bufferOffset);
108917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1090560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDeleteTextures(
1091560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1092560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)textures
1093560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1094560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1095560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1096560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
1097560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, textures, JNI_FALSE);
1098560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
10992545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
11002545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
11012545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1102560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1103560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1104560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDepthFunc ( GLenum func ) */
1105560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1106560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDepthFunc__I
1107560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint func) {
1108560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDepthFunc(
1109560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)func
1110560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1111560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1112560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1113560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDepthMask ( GLboolean flag ) */
1114560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1115560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDepthMask__Z
1116560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jboolean flag) {
1117560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDepthMask(
1118560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)flag
1119560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1120560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1121560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1122560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */
1123560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1124560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDepthRangef__FF
1125560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) {
1126560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDepthRangef(
1127560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)zNear,
1128560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)zFar
1129560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1130560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1131560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1132560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDetachShader ( GLuint program, GLuint shader ) */
1133560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1134560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDetachShader__II
1135560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint shader) {
1136560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDetachShader(
1137560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
1138560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader
1139560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1140560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1141560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1142560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDisable ( GLenum cap ) */
1143560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1144560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDisable__I
1145560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint cap) {
1146560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDisable(
1147560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)cap
1148560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1149560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1150560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1151560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDisableVertexAttribArray ( GLuint index ) */
1152560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1153560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDisableVertexAttribArray__I
1154560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint index) {
1155560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDisableVertexAttribArray(
1156560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index
1157560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1158560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1159560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1160560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */
1161560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1162560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDrawArrays__III
1163560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) {
1164560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDrawArrays(
1165560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)mode,
1166560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)first,
1167560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count
1168560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1169560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1170560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1171224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */
1172224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevichstatic void
1173224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevichandroid_glDrawElements__IIII
1174224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich  (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) {
11752545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
117615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
117715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
1178224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich    glDrawElements(
1179224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLenum)mode,
1180224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLsizei)count,
1181224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLenum)type,
1182428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes        (GLvoid *)offset
1183224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich    );
11842545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
11852545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
11862545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1187224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich}
1188224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich
1189560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */
1190560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1191560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glDrawElements__IIILjava_nio_Buffer_2
1192560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) {
11932545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
119415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
119515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
1196560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
119717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1198560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1199560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *indices = (GLvoid *) 0;
1200560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
120117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining, &_bufferOffset);
1202560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < count) {
12032545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
12042545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
12052545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < count < needed";
1206560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1207560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
120817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (indices == NULL) {
120917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
121017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        indices = (GLvoid *) (_indicesBase + _bufferOffset);
121117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1212560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glDrawElements(
1213560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)mode,
1214560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
1215560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)type,
1216560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)indices
1217560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1218560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1219560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1220560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
1221560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, indices, JNI_FALSE);
1222560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
12232545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
12242545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
12252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1226560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1227560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1228560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glEnable ( GLenum cap ) */
1229560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1230560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glEnable__I
1231560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint cap) {
1232560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glEnable(
1233560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)cap
1234560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1235560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1236560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1237560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glEnableVertexAttribArray ( GLuint index ) */
1238560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1239560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glEnableVertexAttribArray__I
1240560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint index) {
1241560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glEnableVertexAttribArray(
1242560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index
1243560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1244560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1245560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1246560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glFinish ( void ) */
1247560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1248560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glFinish__
1249560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this) {
1250560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glFinish();
1251560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1252560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1253560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glFlush ( void ) */
1254560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1255560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glFlush__
1256560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this) {
1257560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glFlush();
1258560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1259560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1260560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glFramebufferRenderbuffer ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) */
1261560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1262560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glFramebufferRenderbuffer__IIII
1263560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint renderbuffertarget, jint renderbuffer) {
1264560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glFramebufferRenderbuffer(
1265560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
1266560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)attachment,
1267560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)renderbuffertarget,
1268560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)renderbuffer
1269560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1270560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1271560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1272560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glFramebufferTexture2D ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) */
1273560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1274560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glFramebufferTexture2D__IIIII
1275560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint textarget, jint texture, jint level) {
1276560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glFramebufferTexture2D(
1277560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
1278560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)attachment,
1279560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)textarget,
1280560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)texture,
1281560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)level
1282560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1283560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1284560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1285560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glFrontFace ( GLenum mode ) */
1286560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1287560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glFrontFace__I
1288560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint mode) {
1289560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glFrontFace(
1290560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)mode
1291560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1292560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1293560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1294560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
1295560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1296560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenBuffers__I_3II
1297560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
1298560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
129915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
130015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
1301560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *buffers_base = (GLuint *) 0;
1302560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1303560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *buffers = (GLuint *) 0;
1304560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1305560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!buffers_ref) {
1306560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
13072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
13082545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "buffers == null";
1309560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1310560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1311560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
1312560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
13132545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
13142545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
1315560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1316560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1317560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(buffers_ref) - offset;
1318560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
1319560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
13202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
13212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < n < needed";
1322560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1323560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1324560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    buffers_base = (GLuint *)
1325560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
1326560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    buffers = buffers_base + offset;
1327560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1328560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenBuffers(
1329560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1330560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)buffers
1331560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1332560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1333560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1334560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (buffers_base) {
1335560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
1336560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1337560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
13382545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
13392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
13402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1341560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1342560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1343560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
1344560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1345560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenBuffers__ILjava_nio_IntBuffer_2
1346560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
1347560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
134815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
134915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
1350560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
135117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1352560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1353560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *buffers = (GLuint *) 0;
1354560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
135517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset);
1356560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
1357560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
13582545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
13592545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < n < needed";
1360560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1361560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
136217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (buffers == NULL) {
136317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
136417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        buffers = (GLuint *) (_buffersBase + _bufferOffset);
136517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1366560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenBuffers(
1367560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1368560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)buffers
1369560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1370560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1371560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1372560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
1373560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, buffers, _exception ? JNI_FALSE : JNI_TRUE);
1374560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
13752545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
13762545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
13772545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1378560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1379560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1380560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenerateMipmap ( GLenum target ) */
1381560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1382560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenerateMipmap__I
1383560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target) {
1384560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenerateMipmap(
1385560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target
1386560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1387560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1388560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1389560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */
1390560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1391560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenFramebuffers__I_3II
1392560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
1393560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
139415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
139515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
1396560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *framebuffers_base = (GLuint *) 0;
1397560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1398560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *framebuffers = (GLuint *) 0;
1399560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1400560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!framebuffers_ref) {
1401560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
14022545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
14032545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "framebuffers == null";
1404560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1405560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1406560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
1407560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
14082545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
14092545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
1410560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1411560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1412560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
141315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < n) {
141415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
141515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
141615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < n < needed";
141715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
141815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
1419560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    framebuffers_base = (GLuint *)
1420560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0);
1421560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    framebuffers = framebuffers_base + offset;
1422560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1423560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenFramebuffers(
1424560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1425560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)framebuffers
1426560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1427560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1428560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1429560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (framebuffers_base) {
1430560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base,
1431560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1432560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
14332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
14342545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
14352545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1436560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1437560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1438560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */
1439560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1440560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenFramebuffers__ILjava_nio_IntBuffer_2
1441560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
144215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
144315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
144415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
1445560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
144617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1447560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1448560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *framebuffers = (GLuint *) 0;
1449560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
145017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining, &_bufferOffset);
145115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < n) {
145215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
145315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
145415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < n < needed";
145515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
145615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
145717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (framebuffers == NULL) {
145817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _framebuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
145917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
146017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1461560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenFramebuffers(
1462560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1463560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)framebuffers
1464560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
146515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
146615284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
1467560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
146815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        releasePointer(_env, _array, framebuffers, _exception ? JNI_FALSE : JNI_TRUE);
146915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
147015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
147115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
1472560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1473560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1474560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1475560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */
1476560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1477560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenRenderbuffers__I_3II
1478560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
1479560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
148015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
148115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
1482560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *renderbuffers_base = (GLuint *) 0;
1483560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1484560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *renderbuffers = (GLuint *) 0;
1485560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1486560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!renderbuffers_ref) {
1487560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
14882545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
14892545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "renderbuffers == null";
1490560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1491560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1492560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
1493560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
14942545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
14952545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
1496560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1497560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1498560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
149915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < n) {
150015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
150115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
150215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < n < needed";
150315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
150415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
1505560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    renderbuffers_base = (GLuint *)
1506560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0);
1507560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    renderbuffers = renderbuffers_base + offset;
1508560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1509560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenRenderbuffers(
1510560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1511560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)renderbuffers
1512560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1513560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1514560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1515560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (renderbuffers_base) {
1516560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base,
1517560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1518560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
15192545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
15202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
15212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1522560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1523560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1524560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */
1525560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1526560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenRenderbuffers__ILjava_nio_IntBuffer_2
1527560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
152815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
152915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
153015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
1531560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
153217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1533560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1534560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *renderbuffers = (GLuint *) 0;
1535560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
153617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining, &_bufferOffset);
153715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < n) {
153815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
153915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
154015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < n < needed";
154115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
154215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
154317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (renderbuffers == NULL) {
154417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _renderbuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
154517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
154617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1547560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenRenderbuffers(
1548560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1549560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)renderbuffers
1550560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
155115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
155215284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
1553560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
155415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        releasePointer(_env, _array, renderbuffers, _exception ? JNI_FALSE : JNI_TRUE);
155515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
155615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
155715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
1558560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1559560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1560560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1561560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1562560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1563560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenTextures__I_3II
1564560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
1565560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
156615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
156715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
1568560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *textures_base = (GLuint *) 0;
1569560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1570560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *textures = (GLuint *) 0;
1571560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1572560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!textures_ref) {
1573560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
15742545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
15752545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "textures == null";
1576560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1577560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1578560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
1579560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
15802545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
15812545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
1582560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1583560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1584560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(textures_ref) - offset;
1585560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
1586560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
15872545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
15882545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < n < needed";
1589560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1590560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1591560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    textures_base = (GLuint *)
1592560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
1593560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    textures = textures_base + offset;
1594560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1595560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenTextures(
1596560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1597560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)textures
1598560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1599560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1600560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1601560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (textures_base) {
1602560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
1603560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1604560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
16052545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
16062545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
16072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1608560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1609560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1610560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1611560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1612560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGenTextures__ILjava_nio_IntBuffer_2
1613560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
1614560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
161515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
161615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
1617560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
161817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
1619560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
1620560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *textures = (GLuint *) 0;
1621560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
162217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset);
1623560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < n) {
1624560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
16252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
16262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < n < needed";
1627560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1628560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
162917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (textures == NULL) {
163017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
163117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        textures = (GLuint *) (_texturesBase + _bufferOffset);
163217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1633560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGenTextures(
1634560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
1635560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)textures
1636560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1637560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1638560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1639560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
1640560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, textures, _exception ? JNI_FALSE : JNI_TRUE);
1641560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
16422545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
16432545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
16442545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1645560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1646560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1647560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1648560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1649560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetActiveAttrib__III_3II_3II_3II_3BI
1650560814f6b11abe83ff0c4ed18cac015c276b3181Jack 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) {
1651560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
16522545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    const char * _exceptionType;
16532545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    const char * _exceptionMessage;
1654560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length_base = (GLsizei *) 0;
1655560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _lengthRemaining;
1656560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length = (GLsizei *) 0;
1657560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *size_base = (GLint *) 0;
1658560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _sizeRemaining;
1659560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *size = (GLint *) 0;
1660560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum *type_base = (GLenum *) 0;
1661560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _typeRemaining;
1662560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum *type = (GLenum *) 0;
1663560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    char *name_base = (char *) 0;
1664560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _nameRemaining;
1665560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    char *name = (char *) 0;
1666560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1667560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!length_ref) {
1668560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
16692545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
16702545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length == null";
1671560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1672560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1673560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (lengthOffset < 0) {
1674560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
16752545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
16762545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "lengthOffset < 0";
1677560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1678560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1679560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
1680560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    length_base = (GLsizei *)
1681560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
1682560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    length = length_base + lengthOffset;
1683560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1684560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!size_ref) {
1685560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
16862545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
16872545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "size == null";
1688560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1689560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1690560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (sizeOffset < 0) {
1691560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
16922545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
16932545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "sizeOffset < 0";
1694560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1695560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1696560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
1697560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    size_base = (GLint *)
1698560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
1699560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    size = size_base + sizeOffset;
1700560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1701560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!type_ref) {
1702560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
17032545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
17042545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "type == null";
1705560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1706560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1707560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (typeOffset < 0) {
1708560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
17092545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
17102545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "typeOffset < 0";
1711560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1712560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1713560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
1714560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    type_base = (GLenum *)
1715560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
1716560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    type = type_base + typeOffset;
1717560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1718560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!name_ref) {
1719560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
17202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
17212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "name == null";
1722560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1723560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1724560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (nameOffset < 0) {
1725560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
17262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
17272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "nameOffset < 0";
1728560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
1729560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1730560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
1731560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    name_base = (char *)
1732560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0);
1733560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    name = name_base + nameOffset;
1734560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1735560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetActiveAttrib(
1736560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
1737560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
1738560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)bufsize,
1739560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)length,
1740560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)size,
1741560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum *)type,
1742560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (char *)name
1743560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
1744560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1745560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
1746560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (name_base) {
1747560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(name_ref, name_base,
1748560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1749560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1750560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (type_base) {
1751560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
1752560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1753560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1754560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (size_base) {
1755560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
1756560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1757560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1758560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (length_base) {
1759560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
1760560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
1761560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
17622545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
17632545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
17642545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
1765560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1766560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1767560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1768560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1769560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
1770560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
1771560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _lengthArray = (jarray) 0;
177217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _lengthBufferOffset = (jint) 0;
1773560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _sizeArray = (jarray) 0;
177417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _sizeBufferOffset = (jint) 0;
1775560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _typeArray = (jarray) 0;
177617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _typeBufferOffset = (jint) 0;
1777560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _lengthRemaining;
1778560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length = (GLsizei *) 0;
1779560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _sizeRemaining;
1780560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *size = (GLint *) 0;
1781560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _typeRemaining;
1782560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum *type = (GLenum *) 0;
1783560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
178417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
178517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
178617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
178717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (length == NULL) {
178817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0);
178917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
179017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
179117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (size == NULL) {
179217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
179317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        size = (GLint *) (_sizeBase + _sizeBufferOffset);
179417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
179517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (type == NULL) {
179617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
179717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        type = (GLenum *) (_typeBase + _typeBufferOffset);
179817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
1799560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetActiveAttrib(
1800560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
1801560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
1802560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)bufsize,
1803560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)length,
1804560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)size,
1805560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum *)type,
1806560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (char *)name
1807560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
180817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (_typeArray) {
180917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        releasePointer(_env, _typeArray, type, JNI_TRUE);
1810560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1811560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_sizeArray) {
18122545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        releasePointer(_env, _sizeArray, size, JNI_TRUE);
1813560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
181417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (_lengthArray) {
181517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        releasePointer(_env, _lengthArray, length, JNI_TRUE);
1816560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
1817560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
1818560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1819dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1820dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferstatic jstring
1821dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferandroid_glGetActiveAttrib1
1822dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer  (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
1823dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _exception = 0;
1824dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    const char * _exceptionType;
1825dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    const char * _exceptionMessage;
1826dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint *size_base = (GLint *) 0;
1827dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _sizeRemaining;
1828dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint *size = (GLint *) 0;
1829dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLenum *type_base = (GLenum *) 0;
1830dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _typeRemaining;
1831dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLenum *type = (GLenum *) 0;
1832dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
1833dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jstring result = 0;
1834dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
1835dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint len = 0;
1836dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
1837dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!len) {
1838dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return _env->NewStringUTF("");
1839dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1840dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    char* buf = (char*) malloc(len);
1841dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
1842dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf == NULL) {
1843dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
1844dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return NULL;
1845dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1846dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!size_ref) {
1847dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
1848dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
1849dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "size == null";
1850dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
1851dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1852dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (sizeOffset < 0) {
1853dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
1854dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
1855dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "sizeOffset < 0";
1856dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
1857dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1858dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
1859dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    size_base = (GLint *)
1860dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
1861dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    size = size_base + sizeOffset;
1862dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
1863dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!type_ref) {
1864dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
1865dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
1866dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "type == null";
1867dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
1868dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1869dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (typeOffset < 0) {
1870dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
1871dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
1872dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "typeOffset < 0";
1873dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
1874dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1875dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
1876dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    type_base = (GLenum *)
1877dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
1878dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    type = type_base + typeOffset;
1879dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
1880dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetActiveAttrib(
1881dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)program,
1882dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)index,
1883dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLsizei)len,
1884dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        NULL,
1885dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLint *)size,
1886dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLenum *)type,
1887dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (char *)buf
1888dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    );
1889dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferexit:
1890dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (type_base) {
1891dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
1892dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer            _exception ? JNI_ABORT: 0);
1893dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1894dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (size_base) {
1895dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
1896dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer            _exception ? JNI_ABORT: 0);
1897dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1898dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_exception != 1) {
1899dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        result = _env->NewStringUTF(buf);
1900dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1901dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf) {
1902dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        free(buf);
1903dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1904dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_exception) {
1905dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
1906dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1907dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (result == 0) {
1908dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        result = _env->NewStringUTF("");
1909dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1910dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
1911dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    return result;
1912dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer}
1913dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
1914dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1915dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferstatic jstring
1916dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferandroid_glGetActiveAttrib2
1917dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer  (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
1918dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jarray _sizeArray = (jarray) 0;
1919dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _sizeBufferOffset = (jint) 0;
1920dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jarray _typeArray = (jarray) 0;
1921dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _typeBufferOffset = (jint) 0;
1922dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _lengthRemaining;
1923dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLsizei *length = (GLsizei *) 0;
1924dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _sizeRemaining;
1925dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint *size = (GLint *) 0;
1926dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _typeRemaining;
1927dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLenum *type = (GLenum *) 0;
1928dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
1929dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jstring result = 0;
1930dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
1931dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint len = 0;
1932dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
1933dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!len) {
1934dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return _env->NewStringUTF("");
1935dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1936dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    char* buf = (char*) malloc(len);
1937dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
1938dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf == NULL) {
1939dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
1940dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return NULL;
1941dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1942dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
1943dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
1944dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
1945dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (size == NULL) {
1946dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
1947dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        size = (GLint *) (_sizeBase + _sizeBufferOffset);
1948dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1949dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (type == NULL) {
1950dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
1951dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        type = (GLenum *) (_typeBase + _typeBufferOffset);
1952dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1953dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetActiveAttrib(
1954dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)program,
1955dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)index,
1956dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLsizei)len,
1957dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        NULL,
1958dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLint *)size,
1959dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLenum *)type,
1960dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (char *)buf
1961dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    );
1962dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
1963dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_typeArray) {
1964dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        releasePointer(_env, _typeArray, type, JNI_TRUE);
1965dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1966dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_sizeArray) {
1967dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        releasePointer(_env, _sizeArray, size, JNI_TRUE);
1968dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1969dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    result = _env->NewStringUTF(buf);
1970dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf) {
1971dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        free(buf);
1972dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
1973dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    return result;
1974dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer}
1975560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1976560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
1977560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetActiveUniform__III_3II_3II_3II_3BI
1978560814f6b11abe83ff0c4ed18cac015c276b3181Jack 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) {
1979560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
19802545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    const char * _exceptionType;
19812545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    const char * _exceptionMessage;
1982560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length_base = (GLsizei *) 0;
1983560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _lengthRemaining;
1984560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length = (GLsizei *) 0;
1985560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *size_base = (GLint *) 0;
1986560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _sizeRemaining;
1987560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *size = (GLint *) 0;
1988560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum *type_base = (GLenum *) 0;
1989560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _typeRemaining;
1990560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum *type = (GLenum *) 0;
1991560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    char *name_base = (char *) 0;
1992560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _nameRemaining;
1993560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    char *name = (char *) 0;
1994560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
1995560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!length_ref) {
1996560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
19972545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
19982545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length == null";
1999560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2000560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2001560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (lengthOffset < 0) {
2002560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
20032545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
20042545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "lengthOffset < 0";
2005560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2006560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2007560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
2008560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    length_base = (GLsizei *)
2009560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
2010560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    length = length_base + lengthOffset;
2011560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2012560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!size_ref) {
2013560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
20142545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
20152545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "size == null";
2016560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2017560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2018560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (sizeOffset < 0) {
2019560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
20202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
20212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "sizeOffset < 0";
2022560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2023560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2024560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2025560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    size_base = (GLint *)
2026560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
2027560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    size = size_base + sizeOffset;
2028560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2029560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!type_ref) {
2030560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
20312545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
20322545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "type == null";
2033560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2034560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2035560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (typeOffset < 0) {
2036560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
20372545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
20382545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "typeOffset < 0";
2039560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2040560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2041560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2042560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    type_base = (GLenum *)
2043560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
2044560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    type = type_base + typeOffset;
2045560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2046560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!name_ref) {
2047560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
20482545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
20492545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "name == null";
2050560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2051560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2052560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (nameOffset < 0) {
2053560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
20542545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
20552545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "nameOffset < 0";
2056560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2057560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2058560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
2059560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    name_base = (char *)
2060560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0);
2061560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    name = name_base + nameOffset;
2062560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2063560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetActiveUniform(
2064560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
2065560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
2066560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)bufsize,
2067560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)length,
2068560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)size,
2069560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum *)type,
2070560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (char *)name
2071560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
2072560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2073560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
2074560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (name_base) {
2075560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(name_ref, name_base,
2076560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2077560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2078560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (type_base) {
2079560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
2080560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2081560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2082560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (size_base) {
2083560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
2084560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2085560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2086560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (length_base) {
2087560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
2088560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2089560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
20902545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
20912545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
20922545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2093560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2094560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2095560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2096560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2097560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
2098560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
2099560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _lengthArray = (jarray) 0;
210017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _lengthBufferOffset = (jint) 0;
2101560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _sizeArray = (jarray) 0;
210217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _sizeBufferOffset = (jint) 0;
2103560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _typeArray = (jarray) 0;
210417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _typeBufferOffset = (jint) 0;
2105560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _lengthRemaining;
2106560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length = (GLsizei *) 0;
2107560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _sizeRemaining;
2108560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *size = (GLint *) 0;
2109560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _typeRemaining;
2110560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum *type = (GLenum *) 0;
2111560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
211217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
211317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
211417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
211517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (length == NULL) {
211617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0);
211717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
211817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
211917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (size == NULL) {
212017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
212117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        size = (GLint *) (_sizeBase + _sizeBufferOffset);
212217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
212317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (type == NULL) {
212417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
212517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        type = (GLenum *) (_typeBase + _typeBufferOffset);
212617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
2127560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetActiveUniform(
2128560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
2129560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
2130560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)bufsize,
2131560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)length,
2132560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)size,
2133560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum *)type,
2134560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (char *)name
2135560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
213617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (_typeArray) {
213717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        releasePointer(_env, _typeArray, type, JNI_TRUE);
2138560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2139560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_sizeArray) {
21402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        releasePointer(_env, _sizeArray, size, JNI_TRUE);
2141560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
214217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (_lengthArray) {
214317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        releasePointer(_env, _lengthArray, length, JNI_TRUE);
2144560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2145560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2146560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2147dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2148dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferstatic jstring
2149dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferandroid_glGetActiveUniform1
2150dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer  (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
2151dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _exception = 0;
2152dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    const char * _exceptionType;
2153dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    const char * _exceptionMessage;
2154dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2155dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint *size_base = (GLint *) 0;
2156dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _sizeRemaining;
2157dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint *size = (GLint *) 0;
2158dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2159dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLenum *type_base = (GLenum *) 0;
2160dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _typeRemaining;
2161dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLenum *type = (GLenum *) 0;
2162dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2163dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jstring result = 0;
2164dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2165dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint len = 0;
2166dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
2167dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!len) {
2168dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return _env->NewStringUTF("");
2169dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2170dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    char* buf = (char*) malloc(len);
2171dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2172dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf == NULL) {
2173dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2174dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return NULL;
2175dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2176dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2177dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!size_ref) {
2178dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
2179dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
2180dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "size == null";
2181dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
2182dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2183dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (sizeOffset < 0) {
2184dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
2185dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
2186dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "sizeOffset < 0";
2187dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
2188dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2189dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2190dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    size_base = (GLint *)
2191dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
2192dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    size = size_base + sizeOffset;
2193dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2194dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!type_ref) {
2195dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
2196dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
2197dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "type == null";
2198dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
2199dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2200dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (typeOffset < 0) {
2201dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exception = 1;
2202dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
2203dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _exceptionMessage = "typeOffset < 0";
2204dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        goto exit;
2205dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2206dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2207dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    type_base = (GLenum *)
2208dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
2209dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    type = type_base + typeOffset;
2210dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2211dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetActiveUniform(
2212dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)program,
2213dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)index,
2214dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLsizei)len,
2215dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        NULL,
2216dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLint *)size,
2217dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLenum *)type,
2218dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (char *)buf
2219dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    );
2220dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2221dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferexit:
2222dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (type_base) {
2223dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
2224dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer            _exception ? JNI_ABORT: 0);
2225dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2226dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (size_base) {
2227dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
2228dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer            _exception ? JNI_ABORT: 0);
2229dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2230dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_exception != 1) {
2231dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        result = _env->NewStringUTF(buf);
2232dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2233dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf) {
2234dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        free(buf);
2235dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2236dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_exception) {
2237dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
2238dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2239dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (result == 0) {
2240dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        result = _env->NewStringUTF("");
2241dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2242dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    return result;
2243dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer}
2244dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2245dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2246dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferstatic jstring
2247dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferandroid_glGetActiveUniform2
2248dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer  (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
2249dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jarray _sizeArray = (jarray) 0;
2250dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _sizeBufferOffset = (jint) 0;
2251dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jarray _typeArray = (jarray) 0;
2252dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _typeBufferOffset = (jint) 0;
2253dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _sizeRemaining;
2254dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint *size = (GLint *) 0;
2255dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jint _typeRemaining;
2256dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLenum *type = (GLenum *) 0;
2257dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2258dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jstring result = 0;
2259dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint len = 0;
2260dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
2261dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!len) {
2262dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return _env->NewStringUTF("");
2263dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2264dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    char* buf = (char*) malloc(len);
2265dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2266dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf == NULL) {
2267dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2268dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return NULL;
2269dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2270dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2271dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
2272dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
2273dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2274dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (size == NULL) {
2275dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
2276dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        size = (GLint *) (_sizeBase + _sizeBufferOffset);
2277dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2278dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (type == NULL) {
2279dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
2280dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        type = (GLenum *) (_typeBase + _typeBufferOffset);
2281dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2282dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetActiveUniform(
2283dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)program,
2284dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLuint)index,
2285dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        len,
2286dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        NULL,
2287dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLint *)size,
2288dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (GLenum *)type,
2289dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        (char *)buf
2290dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    );
2291dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer
2292dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_typeArray) {
2293dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        releasePointer(_env, _typeArray, type, JNI_TRUE);
2294dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2295dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (_sizeArray) {
2296dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        releasePointer(_env, _sizeArray, size, JNI_TRUE);
2297dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2298dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    result = _env->NewStringUTF(buf);
2299dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf) {
2300dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        free(buf);
2301dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
2302dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    return result;
2303dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer}
2304560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */
2305560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2306560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetAttachedShaders__II_3II_3II
2307560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint maxcount, jintArray count_ref, jint countOffset, jintArray shaders_ref, jint shadersOffset) {
2308560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
230915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
231015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
2311560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *count_base = (GLsizei *) 0;
2312560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _countRemaining;
2313560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *count = (GLsizei *) 0;
2314560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *shaders_base = (GLuint *) 0;
2315560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _shadersRemaining;
2316560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *shaders = (GLuint *) 0;
2317560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2318560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!count_ref) {
2319560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
23202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
23212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "count == null";
2322560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2323560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2324560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (countOffset < 0) {
2325560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
23262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
23272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "countOffset < 0";
2328560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2329560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2330560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _countRemaining = _env->GetArrayLength(count_ref) - countOffset;
233115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_countRemaining < 1) {
233215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
233315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
233415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - countOffset < 1 < needed";
233515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
233615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
2337560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    count_base = (GLsizei *)
2338560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(count_ref, (jboolean *)0);
2339560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    count = count_base + countOffset;
2340560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2341560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!shaders_ref) {
2342560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
23432545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
23442545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "shaders == null";
2345560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2346560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2347560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (shadersOffset < 0) {
2348560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
23492545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
23502545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "shadersOffset < 0";
2351560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2352560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2353560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _shadersRemaining = _env->GetArrayLength(shaders_ref) - shadersOffset;
235415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_shadersRemaining < maxcount) {
235515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
235615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
235715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - shadersOffset < maxcount < needed";
235815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
235915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
2360560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    shaders_base = (GLuint *)
2361560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(shaders_ref, (jboolean *)0);
2362560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    shaders = shaders_base + shadersOffset;
2363560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2364560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetAttachedShaders(
2365560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
2366560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)maxcount,
2367560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)count,
2368560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)shaders
2369560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
2370560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2371560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
2372560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (shaders_base) {
2373560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(shaders_ref, shaders_base,
2374560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2375560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2376560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (count_base) {
2377560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(count_ref, count_base,
2378560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2379560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
23802545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
23812545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
23822545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2383560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2384560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2385560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */
2386560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2387560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
2388560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint maxcount, jobject count_buf, jobject shaders_buf) {
238915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
239015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
239115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
2392560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _countArray = (jarray) 0;
239317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _countBufferOffset = (jint) 0;
2394560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _shadersArray = (jarray) 0;
239517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _shadersBufferOffset = (jint) 0;
2396560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _countRemaining;
2397560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *count = (GLsizei *) 0;
2398560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _shadersRemaining;
2399560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *shaders = (GLuint *) 0;
2400560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
240115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (count_buf) {
240215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        count = (GLsizei *)getPointer(_env, count_buf, &_countArray, &_countRemaining, &_countBufferOffset);
240315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        if (_countRemaining < 1) {
240415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            _exception = 1;
240515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            _exceptionType = "java/lang/IllegalArgumentException";
240615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            _exceptionMessage = "remaining() < 1 < needed";
240715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            goto exit;
240815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        }
240915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
241015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (shaders_buf) {
241115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        shaders = (GLuint *)getPointer(_env, shaders_buf, &_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
241215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        if (_shadersRemaining < maxcount) {
241315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            _exception = 1;
241415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            _exceptionType = "java/lang/IllegalArgumentException";
241515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            _exceptionMessage = "remaining() < maxcount < needed";
241615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            goto exit;
241715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        }
241815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
241915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (count_buf && count == NULL) {
242015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        char * _countBase = (char *)_env->GetPrimitiveArrayCritical(_countArray, (jboolean *) 0);
242115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        count = (GLsizei *) (_countBase + _countBufferOffset);
242215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
242315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (shaders_buf && shaders == NULL) {
242415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        char * _shadersBase = (char *)_env->GetPrimitiveArrayCritical(_shadersArray, (jboolean *) 0);
242517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        shaders = (GLuint *) (_shadersBase + _shadersBufferOffset);
242617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
2427560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetAttachedShaders(
2428560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
2429560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)maxcount,
2430560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)count,
2431560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)shaders
2432560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
243315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
243415284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
2435560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_shadersArray) {
243615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        releasePointer(_env, _shadersArray, shaders, _exception ? JNI_FALSE : JNI_TRUE);
243717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
243817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (_countArray) {
243915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        releasePointer(_env, _countArray, count, _exception ? JNI_FALSE : JNI_TRUE);
244015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
244115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
244215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
2443560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2444560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2445560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
244689be00bcda2b5965757e83bdf70a650b64373045Mathias Agopian/* GLint glGetAttribLocation ( GLuint program, const char *name ) */
2447560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jint
2448560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetAttribLocation__ILjava_lang_String_2
2449560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jstring name) {
24502545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
245115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
245215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
245389be00bcda2b5965757e83bdf70a650b64373045Mathias Agopian    GLint _returnValue = 0;
2454560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    const char* _nativename = 0;
2455560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2456560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!name) {
2457428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes        _exception = 1;
24582545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
24592545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "name == null";
2460560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2461560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2462560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _nativename = _env->GetStringUTFChars(name, 0);
2463560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2464560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glGetAttribLocation(
2465560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
2466560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (char *)_nativename
2467560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
2468560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2469560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
2470560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_nativename) {
2471560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleaseStringUTFChars(name, _nativename);
2472560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2473560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
24742545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
24752545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
24762545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2477428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes    return (jint)_returnValue;
2478560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2479560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2480560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
2481560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2482560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetBooleanv__I_3ZI
2483560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
248415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    get<jbooleanArray, GLboolean, glGetBooleanv>(_env, _this, pname, params_ref, offset);
2485560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2486560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2487560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
2488560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2489560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetBooleanv__ILjava_nio_IntBuffer_2
2490560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
249115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    getarray<GLboolean, glGetBooleanv>(_env, _this, pname, params_buf);
2492560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2493560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2494560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2495560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetBufferParameteriv__II_3II
2496560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
249773108675c944ab4ee89631dced23566b12341b66Jack Palevich    jint _exception = 0;
249815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
249915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
250073108675c944ab4ee89631dced23566b12341b66Jack Palevich    GLint *params_base = (GLint *) 0;
250173108675c944ab4ee89631dced23566b12341b66Jack Palevich    jint _remaining;
250273108675c944ab4ee89631dced23566b12341b66Jack Palevich    GLint *params = (GLint *) 0;
250373108675c944ab4ee89631dced23566b12341b66Jack Palevich
250473108675c944ab4ee89631dced23566b12341b66Jack Palevich    if (!params_ref) {
250573108675c944ab4ee89631dced23566b12341b66Jack Palevich        _exception = 1;
25062545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
25072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
250873108675c944ab4ee89631dced23566b12341b66Jack Palevich        goto exit;
250973108675c944ab4ee89631dced23566b12341b66Jack Palevich    }
251073108675c944ab4ee89631dced23566b12341b66Jack Palevich    if (offset < 0) {
251173108675c944ab4ee89631dced23566b12341b66Jack Palevich        _exception = 1;
25122545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
25132545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
251473108675c944ab4ee89631dced23566b12341b66Jack Palevich        goto exit;
251573108675c944ab4ee89631dced23566b12341b66Jack Palevich    }
251673108675c944ab4ee89631dced23566b12341b66Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
251773108675c944ab4ee89631dced23566b12341b66Jack Palevich    if (_remaining < 1) {
251873108675c944ab4ee89631dced23566b12341b66Jack Palevich        _exception = 1;
25192545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
25202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < 1 < needed";
252173108675c944ab4ee89631dced23566b12341b66Jack Palevich        goto exit;
252273108675c944ab4ee89631dced23566b12341b66Jack Palevich    }
252373108675c944ab4ee89631dced23566b12341b66Jack Palevich    params_base = (GLint *)
252473108675c944ab4ee89631dced23566b12341b66Jack Palevich        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
252573108675c944ab4ee89631dced23566b12341b66Jack Palevich    params = params_base + offset;
252673108675c944ab4ee89631dced23566b12341b66Jack Palevich
252773108675c944ab4ee89631dced23566b12341b66Jack Palevich    glGetBufferParameteriv(
252873108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)target,
252973108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)pname,
253073108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLint *)params
253173108675c944ab4ee89631dced23566b12341b66Jack Palevich    );
253273108675c944ab4ee89631dced23566b12341b66Jack Palevich
253373108675c944ab4ee89631dced23566b12341b66Jack Palevichexit:
253473108675c944ab4ee89631dced23566b12341b66Jack Palevich    if (params_base) {
253573108675c944ab4ee89631dced23566b12341b66Jack Palevich        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
253673108675c944ab4ee89631dced23566b12341b66Jack Palevich            _exception ? JNI_ABORT: 0);
253773108675c944ab4ee89631dced23566b12341b66Jack Palevich    }
25382545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
25392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
25402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2541560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2542560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2543560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2544560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2545560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
2546560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
254773108675c944ab4ee89631dced23566b12341b66Jack Palevich    jint _exception = 0;
254815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
254915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
255073108675c944ab4ee89631dced23566b12341b66Jack Palevich    jarray _array = (jarray) 0;
255117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
255273108675c944ab4ee89631dced23566b12341b66Jack Palevich    jint _remaining;
255373108675c944ab4ee89631dced23566b12341b66Jack Palevich    GLint *params = (GLint *) 0;
255473108675c944ab4ee89631dced23566b12341b66Jack Palevich
255517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
255673108675c944ab4ee89631dced23566b12341b66Jack Palevich    if (_remaining < 1) {
255773108675c944ab4ee89631dced23566b12341b66Jack Palevich        _exception = 1;
25582545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
25592545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < 1 < needed";
256073108675c944ab4ee89631dced23566b12341b66Jack Palevich        goto exit;
256173108675c944ab4ee89631dced23566b12341b66Jack Palevich    }
256217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
256317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
256417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
256517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
256673108675c944ab4ee89631dced23566b12341b66Jack Palevich    glGetBufferParameteriv(
256773108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)target,
256873108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLenum)pname,
256973108675c944ab4ee89631dced23566b12341b66Jack Palevich        (GLint *)params
257073108675c944ab4ee89631dced23566b12341b66Jack Palevich    );
257173108675c944ab4ee89631dced23566b12341b66Jack Palevich
257273108675c944ab4ee89631dced23566b12341b66Jack Palevichexit:
257373108675c944ab4ee89631dced23566b12341b66Jack Palevich    if (_array) {
257473108675c944ab4ee89631dced23566b12341b66Jack Palevich        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
257573108675c944ab4ee89631dced23566b12341b66Jack Palevich    }
25762545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
25772545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
25782545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2579560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2580560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2581560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLenum glGetError ( void ) */
2582560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jint
2583560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetError__
2584560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this) {
2585560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLenum _returnValue;
2586560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glGetError();
2587428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes    return (jint)_returnValue;
2588560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2589560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2590560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
2591560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2592560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetFloatv__I_3FI
2593560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
259415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    get<jfloatArray, GLfloat, glGetFloatv>(_env, _this, pname, params_ref, offset);
2595560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2596560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2597560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
2598560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2599560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetFloatv__ILjava_nio_FloatBuffer_2
2600560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
260115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    getarray<GLfloat, glGetFloatv>(_env, _this, pname, params_buf);
2602560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2603560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
2604560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2605560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetFramebufferAttachmentParameteriv__III_3II
2606560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jintArray params_ref, jint offset) {
2607560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
260815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
260915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
2610560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
2611560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
2612560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
2613560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2614560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
2615560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
26162545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
26172545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
2618560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2619560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2620560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
2621560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
26222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
26232545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
2624560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2625560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2626560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
2627560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
2628560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2629560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
2630560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2631560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetFramebufferAttachmentParameteriv(
2632560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
2633560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)attachment,
2634560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
2635560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
2636560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
2637560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2638560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
2639560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
2640560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2641560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2642560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
26432545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
26442545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
26452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2646560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2647560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2648560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
2649560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2650560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2
2651560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) {
2652560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
265317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
2654560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
2655560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
2656560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
265717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
265817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
265917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
266017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
266117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
2662560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetFramebufferAttachmentParameteriv(
2663560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
2664560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)attachment,
2665560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
2666560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
2667560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
2668560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
26692545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        releasePointer(_env, _array, params, JNI_TRUE);
2670560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2671560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2672560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2673560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetIntegerv ( GLenum pname, GLint *params ) */
2674560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2675560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetIntegerv__I_3II
2676560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
267715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    get<jintArray, GLint, glGetIntegerv>(_env, _this, pname, params_ref, offset);
2678560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2679560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2680560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetIntegerv ( GLenum pname, GLint *params ) */
2681560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2682560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetIntegerv__ILjava_nio_IntBuffer_2
2683560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
268415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    getarray<GLint, glGetIntegerv>(_env, _this, pname, params_buf);
2685560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2686560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2687560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2688560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2689560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetProgramiv__II_3II
2690560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint pname, jintArray params_ref, jint offset) {
2691560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
269215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
269315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
2694560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
2695560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
2696560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
2697560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2698560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
2699560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
27002545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
27012545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
2702560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2703560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2704560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
2705560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
27062545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
27072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
2708560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2709560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2710560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
271115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < 1) {
271215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
271315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
271415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < 1 < needed";
271515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
271615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
2717560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
2718560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2719560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
2720560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2721560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetProgramiv(
2722560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
2723560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
2724560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
2725560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
2726560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2727560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
2728560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
2729560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2730560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2731560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
27322545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
27332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
27342545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2735560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2736560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2737560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2738560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2739560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetProgramiv__IILjava_nio_IntBuffer_2
2740560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint pname, jobject params_buf) {
274115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
274215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
274315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
2744560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
274517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
2746560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
2747560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
2748560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
274917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
275015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < 1) {
275115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
275215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
275315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
275415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
275515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
275617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
275717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
275817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
275917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
2760560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetProgramiv(
2761560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
2762560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
2763560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
2764560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
276515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
276615284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
2767560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
276815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
276915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
277015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
277115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
2772560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2773560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2774560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
277524ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes#include <stdlib.h>
2776560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2777560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetProgramInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
277824ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughesstatic jstring android_glGetProgramInfoLog(JNIEnv *_env, jobject, jint shader) {
2779560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint infoLen = 0;
2780560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
278124ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    if (!infoLen) {
278224ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        return _env->NewStringUTF("");
2783560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
278424ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    char* buf = (char*) malloc(infoLen);
278524ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    if (buf == NULL) {
278624ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
278724ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        return NULL;
2788560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
278924ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    glGetProgramInfoLog(shader, infoLen, NULL, buf);
279024ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    jstring result = _env->NewStringUTF(buf);
279124ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    free(buf);
279224ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    return result;
2793560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2794560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2795560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2796560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetRenderbufferParameteriv__II_3II
2797560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
2798560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
279915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
280015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
2801560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
2802560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
2803560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
2804560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2805560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
2806560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
28072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
28082545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
2809560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2810560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2811560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
2812560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
28132545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
28142545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
2815560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2816560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2817560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
281815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < 1) {
281915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
282015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
282115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < 1 < needed";
282215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
282315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
2824560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
2825560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2826560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
2827560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2828560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetRenderbufferParameteriv(
2829560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
2830560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
2831560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
2832560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
2833560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2834560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
2835560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
2836560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2837560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2838560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
28392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
28402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
28412545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2842560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2843560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2844560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2845560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2846560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2
2847560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
284815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
284915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
285015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
2851560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
285217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
2853560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
2854560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
2855560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
285617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
285715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < 1) {
285815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
285915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
286015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
286115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
286215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
286317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
286417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
286517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
286617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
2867560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetRenderbufferParameteriv(
2868560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
2869560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
2870560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
2871560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
287215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
287315284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
2874560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
287515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
287615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
287715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
287815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
2879560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2880560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2881560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2882560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
2883560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2884560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetShaderiv__II_3II
2885560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shader, jint pname, jintArray params_ref, jint offset) {
2886560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
288715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
288815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
2889560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
2890560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
2891560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
2892560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2893560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
2894560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
28952545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
28962545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
2897560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2898560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2899560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
2900560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
29012545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
29022545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
2903560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
2904560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2905560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
290615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < 1) {
290715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
290815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
290915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < 1 < needed";
291015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
291115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
2912560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
2913560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
2914560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
2915560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2916560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetShaderiv(
2917560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader,
2918560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
2919560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
2920560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
2921560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2922560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
2923560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
2924560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
2925560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
2926560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
29272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
29282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
29292545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
2930560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2931560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2932560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
2933560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2934560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetShaderiv__IILjava_nio_IntBuffer_2
2935560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shader, jint pname, jobject params_buf) {
293615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
293715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
293815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
2939560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
294017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
2941560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
2942560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
2943560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
294417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
294515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < 1) {
294615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
294715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
294815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
294915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
295015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
295117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
295217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
295317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
295417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
2955560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetShaderiv(
2956560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader,
2957560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
2958560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
2959560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
296015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
296115284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
2962560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
296315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
296415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
296515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
296615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
2967560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
2968560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2969560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
297024ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes#include <stdlib.h>
2971560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
2972560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetShaderInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
297324ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughesstatic jstring android_glGetShaderInfoLog(JNIEnv *_env, jobject, jint shader) {
2974560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint infoLen = 0;
2975560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
297624ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    if (!infoLen) {
297724ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        return _env->NewStringUTF("");
2978560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
297924ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    char* buf = (char*) malloc(infoLen);
298024ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    if (buf == NULL) {
298124ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
298224ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        return NULL;
2983560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
298424ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    glGetShaderInfoLog(shader, infoLen, NULL, buf);
298524ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    jstring result = _env->NewStringUTF(buf);
298624ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    free(buf);
298724ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    return result;
2988560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
2989560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
2990560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
2991560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetShaderPrecisionFormat__II_3II_3II
2992560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jintArray range_ref, jint rangeOffset, jintArray precision_ref, jint precisionOffset) {
2993560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
299415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
299515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
2996560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *range_base = (GLint *) 0;
2997560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _rangeRemaining;
2998560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *range = (GLint *) 0;
2999560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *precision_base = (GLint *) 0;
3000560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _precisionRemaining;
3001560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *precision = (GLint *) 0;
3002560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3003560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!range_ref) {
3004560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
30052545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
30062545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "range == null";
3007560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3008560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3009560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (rangeOffset < 0) {
3010560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
30112545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
30122545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "rangeOffset < 0";
3013560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3014560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3015560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _rangeRemaining = _env->GetArrayLength(range_ref) - rangeOffset;
301615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_rangeRemaining < 1) {
301715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
301815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
301915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - rangeOffset < 1 < needed";
302015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
302115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
3022560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    range_base = (GLint *)
3023560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(range_ref, (jboolean *)0);
3024560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    range = range_base + rangeOffset;
3025560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3026560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!precision_ref) {
3027560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
30282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
30292545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "precision == null";
3030560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3031560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3032560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (precisionOffset < 0) {
3033560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
30342545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
30352545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "precisionOffset < 0";
3036560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3037560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3038560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _precisionRemaining = _env->GetArrayLength(precision_ref) - precisionOffset;
303915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_precisionRemaining < 1) {
304015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
304115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
304215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - precisionOffset < 1 < needed";
304315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
304415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
3045560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    precision_base = (GLint *)
3046560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(precision_ref, (jboolean *)0);
3047560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    precision = precision_base + precisionOffset;
3048560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3049560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetShaderPrecisionFormat(
3050560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)shadertype,
3051560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)precisiontype,
3052560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)range,
3053560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)precision
3054560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3055560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3056560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3057560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (precision_base) {
3058560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(precision_ref, precision_base,
3059560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3060560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3061560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (range_base) {
3062560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(range_ref, range_base,
3063560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3064560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
30652545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
30662545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
30672545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3068560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3069560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3070560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
3071560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3072560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
3073560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jobject range_buf, jobject precision_buf) {
307415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
307515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
307615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
3077560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _rangeArray = (jarray) 0;
307817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _rangeBufferOffset = (jint) 0;
3079560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _precisionArray = (jarray) 0;
308017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _precisionBufferOffset = (jint) 0;
3081560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _rangeRemaining;
3082560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *range = (GLint *) 0;
3083560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _precisionRemaining;
3084560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *precision = (GLint *) 0;
3085560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
308617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    range = (GLint *)getPointer(_env, range_buf, &_rangeArray, &_rangeRemaining, &_rangeBufferOffset);
308715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_rangeRemaining < 1) {
308815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
308915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
309015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
309115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
309215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
309317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    precision = (GLint *)getPointer(_env, precision_buf, &_precisionArray, &_precisionRemaining, &_precisionBufferOffset);
309415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_precisionRemaining < 1) {
309515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
309615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
309715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
309815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
309915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
310017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (range == NULL) {
310117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _rangeBase = (char *)_env->GetPrimitiveArrayCritical(_rangeArray, (jboolean *) 0);
310217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        range = (GLint *) (_rangeBase + _rangeBufferOffset);
310317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
310417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (precision == NULL) {
310517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _precisionBase = (char *)_env->GetPrimitiveArrayCritical(_precisionArray, (jboolean *) 0);
310617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        precision = (GLint *) (_precisionBase + _precisionBufferOffset);
310717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3108560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetShaderPrecisionFormat(
3109560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)shadertype,
3110560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)precisiontype,
3111560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)range,
3112560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)precision
3113560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
311415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
311515284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
3116560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_precisionArray) {
311715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        releasePointer(_env, _precisionArray, precision, _exception ? JNI_FALSE : JNI_TRUE);
311817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
311917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (_rangeArray) {
312015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        releasePointer(_env, _rangeArray, range, _exception ? JNI_FALSE : JNI_TRUE);
312115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
312215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
312315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
3124560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3125560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3126560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3127560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3128560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3129560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetShaderSource__II_3II_3BI
3130560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jintArray length_ref, jint lengthOffset, jbyteArray source_ref, jint sourceOffset) {
3131560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
31322545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    const char * _exceptionType;
31332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    const char * _exceptionMessage;
3134560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length_base = (GLsizei *) 0;
3135560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _lengthRemaining;
3136560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length = (GLsizei *) 0;
3137560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    char *source_base = (char *) 0;
3138560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _sourceRemaining;
3139560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    char *source = (char *) 0;
3140560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3141560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!length_ref) {
3142560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
31432545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
31442545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length == null";
3145560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3146560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3147560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (lengthOffset < 0) {
3148560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
31492545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
31502545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "lengthOffset < 0";
3151560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3152560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3153560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
3154560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    length_base = (GLsizei *)
3155560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
3156560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    length = length_base + lengthOffset;
3157560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3158560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!source_ref) {
3159560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
31602545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
31612545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "source == null";
3162560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3163560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3164560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (sourceOffset < 0) {
3165560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
31662545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
31672545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "sourceOffset < 0";
3168560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3169560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3170560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _sourceRemaining = _env->GetArrayLength(source_ref) - sourceOffset;
3171560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    source_base = (char *)
3172560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(source_ref, (jboolean *)0);
3173560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    source = source_base + sourceOffset;
3174560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3175560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetShaderSource(
3176560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader,
3177560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)bufsize,
3178560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)length,
3179560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (char *)source
3180560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3181560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3182560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3183560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (source_base) {
3184560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(source_ref, source_base,
3185560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3186560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3187560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (length_base) {
3188560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
3189560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3190560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
31912545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
31922545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
31932545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3194560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3195560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3196560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3197560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3198560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetShaderSource__IILjava_nio_IntBuffer_2B
3199560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jobject length_buf, jbyte source) {
3200560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
320117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3202560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3203560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLsizei *length = (GLsizei *) 0;
3204560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
320517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    length = (GLsizei *)getPointer(_env, length_buf, &_array, &_remaining, &_bufferOffset);
320617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (length == NULL) {
320717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
320817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        length = (GLsizei *) (_lengthBase + _bufferOffset);
320917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3210560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetShaderSource(
3211560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader,
3212560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)bufsize,
3213560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei *)length,
3214560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (char *)source
3215560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3216560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
32172545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        releasePointer(_env, _array, length, JNI_TRUE);
3218560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3219560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3220560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3221dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3222dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshoferstatic jstring android_glGetShaderSource(JNIEnv *_env, jobject, jint shader) {
3223dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    GLint shaderLen = 0;
3224dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetShaderiv((GLuint)shader, GL_SHADER_SOURCE_LENGTH, &shaderLen);
3225dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (!shaderLen) {
3226dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return _env->NewStringUTF("");
3227dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
3228dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    char* buf = (char*) malloc(shaderLen);
3229dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    if (buf == NULL) {
3230dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
3231dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer        return NULL;
3232dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    }
3233dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    glGetShaderSource(shader, shaderLen, NULL, buf);
3234dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    jstring result = _env->NewStringUTF(buf);
3235dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    free(buf);
3236dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer    return result;
3237dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer}
3238560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* const GLubyte * glGetString ( GLenum name ) */
323924ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughesstatic jstring android_glGetString(JNIEnv* _env, jobject, jint name) {
324024ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    const char* chars = (const char*) glGetString((GLenum) name);
324124ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes    return _env->NewStringUTF(chars);
3242560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3243560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
3244560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3245560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetTexParameterfv__II_3FI
3246560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
3247560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
324815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
324915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
3250560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params_base = (GLfloat *) 0;
3251560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3252560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
3253560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3254560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
3255560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
32562545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
32572545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
3258560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3259560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3260560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
3261560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
32622545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
32632545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
3264560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3265560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3266560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
3267560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
3268560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
32692545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
32702545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < 1 < needed";
3271560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3272560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3273560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLfloat *)
3274560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3275560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
3276560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3277560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetTexParameterfv(
3278560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
3279560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3280560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
3281560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3282560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3283560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3284560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
3285560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3286560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3287560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
32882545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
32892545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
32902545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3291560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3292560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3293560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
3294560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3295560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetTexParameterfv__IILjava_nio_FloatBuffer_2
3296560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3297560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
329815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
329915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
3300560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
330117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3302560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3303560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
3304560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
330517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
3306560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
3307560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
33082545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
33092545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < 1 < needed";
3310560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3311560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
331217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
331317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
331417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLfloat *) (_paramsBase + _bufferOffset);
331517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3316560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetTexParameterfv(
3317560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
3318560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3319560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
3320560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3321560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3322560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3323560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
3324560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3325560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
33262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
33272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
33282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3329560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3330560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3331560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3332560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3333560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetTexParameteriv__II_3II
3334560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
3335560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
333615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
333715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
3338560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
3339560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3340560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3341560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3342560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
3343560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
33442545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
33452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
3346560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3347560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3348560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
3349560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
33502545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
33512545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
3352560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3353560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3354560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
3355560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
3356560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
33572545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
33582545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < 1 < needed";
3359560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3360560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3361560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
3362560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3363560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
3364560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3365560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetTexParameteriv(
3366560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
3367560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3368560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3369560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3370560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3371560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3372560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
3373560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3374560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3375560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
33762545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
33772545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
33782545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3379560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3380560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3381560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3382560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3383560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetTexParameteriv__IILjava_nio_IntBuffer_2
3384560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3385560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
338615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
338715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
3388560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
338917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3390560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3391560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3392560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
339317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
3394560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
3395560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
33962545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
33972545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < 1 < needed";
3398560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3399560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
340017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
340117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
340217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
340317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3404560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetTexParameteriv(
3405560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
3406560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3407560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3408560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3409560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3410560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3411560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
3412560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
3413560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
34142545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
34152545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
34162545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3417560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3418560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3419560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3420560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3421560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetUniformfv__II_3FI
3422560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint location, jfloatArray params_ref, jint offset) {
3423560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
342415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
342515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
3426560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params_base = (GLfloat *) 0;
3427560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3428560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
3429560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3430560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
3431560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
34322545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
34332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
3434560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3435560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3436560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
3437560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
34382545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
34392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
3440560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3441560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3442560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
344315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < 1) {
344415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
344515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
344615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < 1 < needed";
344715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
344815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
3449560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLfloat *)
3450560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3451560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
3452560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3453560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetUniformfv(
3454560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
3455560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
3456560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
3457560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3458560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3459560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3460560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
3461560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3462560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3463560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
34642545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
34652545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
34662545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3467560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3468560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3469560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3470560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3471560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetUniformfv__IILjava_nio_FloatBuffer_2
3472560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
347315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
347415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
347515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
3476560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
347717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3478560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3479560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
3480560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
348117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
348215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < 1) {
348315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
348415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
348515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
348615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
348715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
348817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
348917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
349017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLfloat *) (_paramsBase + _bufferOffset);
349117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3492560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetUniformfv(
3493560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
3494560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
3495560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
3496560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
349715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
349815284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
3499560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
350015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
350115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
350215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
350315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
3504560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3505560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3506560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3507560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3508560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3509560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetUniformiv__II_3II
3510560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint location, jintArray params_ref, jint offset) {
3511560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
351215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
351315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
3514560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
3515560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3516560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3517560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3518560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
3519560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
35202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
35212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
3522560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3523560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3524560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
3525560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
35262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
35272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
3528560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3529560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3530560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
353115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < 1) {
353215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
353315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
353415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < 1 < needed";
353515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
353615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
3537560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
3538560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3539560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
3540560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3541560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetUniformiv(
3542560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
3543560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
3544560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3545560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3546560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3547560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3548560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
3549560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3550560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3551560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
35522545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
35532545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
35542545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3555560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3556560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3557560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3558560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3559560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetUniformiv__IILjava_nio_IntBuffer_2
3560560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
356115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
356215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
356315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
3564560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
356517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3566560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3567560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3568560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
356917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
357015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < 1) {
357115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
357215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
357315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
357415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
357515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
357617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
357717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
357817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
357917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3580560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetUniformiv(
3581560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
3582560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
3583560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3584560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
358515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
358615284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
3587560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
358815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
358915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
359015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
359115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
3592560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3593560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3594560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
359589be00bcda2b5965757e83bdf70a650b64373045Mathias Agopian/* GLint glGetUniformLocation ( GLuint program, const char *name ) */
3596560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jint
3597560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetUniformLocation__ILjava_lang_String_2
3598560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program, jstring name) {
35992545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
360015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
360115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
360289be00bcda2b5965757e83bdf70a650b64373045Mathias Agopian    GLint _returnValue = 0;
3603560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    const char* _nativename = 0;
3604560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3605560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!name) {
3606428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes        _exception = 1;
36072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
36082545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "name == null";
3609560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3610560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3611560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _nativename = _env->GetStringUTFChars(name, 0);
3612560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3613560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glGetUniformLocation(
3614560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program,
3615560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (char *)_nativename
3616560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3617560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3618560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3619560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_nativename) {
3620560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleaseStringUTFChars(name, _nativename);
3621560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3622560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
36232545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
36242545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
36252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3626428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes    return (jint)_returnValue;
3627560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3628560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3629560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3630560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3631560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetVertexAttribfv__II_3FI
3632560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint index, jint pname, jfloatArray params_ref, jint offset) {
3633560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
363415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
363515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
3636560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params_base = (GLfloat *) 0;
3637560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3638560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
3639560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3640560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
3641560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
36422545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
36432545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
3644560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3645560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3646560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
3647560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
36482545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
36492545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
3650560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3651560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3652560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
365315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    int _needed;
365415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    switch (pname) {
365515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian#if defined(GL_CURRENT_VERTEX_ATTRIB)
365615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_CURRENT_VERTEX_ATTRIB:
365715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
365815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            _needed = 4;
365915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            break;
366015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        default:
366115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            _needed = 1;
366215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            break;
366315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
366415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < _needed) {
366515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
366615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
366715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < needed";
366815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
366915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
3670560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLfloat *)
3671560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3672560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
3673560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3674560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetVertexAttribfv(
3675560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
3676560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3677560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
3678560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3679560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3680560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3681560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
3682560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3683560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3684560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
36852545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
36862545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
36872545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3688560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3689560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3690560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3691560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3692560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2
3693560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
369415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
369515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
369615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
3697560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
369817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3699560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3700560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
3701560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
370217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
370315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    int _needed;
370415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    switch (pname) {
370515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian#if defined(GL_CURRENT_VERTEX_ATTRIB)
370615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_CURRENT_VERTEX_ATTRIB:
370715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
370815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            _needed = 4;
370915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            break;
371015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        default:
371115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            _needed = 1;
371215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            break;
371315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
371415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < _needed) {
371515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
371615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
371715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < needed";
371815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
371915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
372017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
372117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
372217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLfloat *) (_paramsBase + _bufferOffset);
372317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3724560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetVertexAttribfv(
3725560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
3726560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3727560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
3728560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
372915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
373015284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
3731560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
373215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
373315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
373415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
373515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
3736560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3737560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3738560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3739560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
3740560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3741560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetVertexAttribiv__II_3II
3742560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint index, jint pname, jintArray params_ref, jint offset) {
3743560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _exception = 0;
374415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
374515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
3746560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
3747560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3748560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3749560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3750560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
3751560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
37522545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
37532545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
3754560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3755560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3756560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
3757560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _exception = 1;
37582545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
37592545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
3760560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
3761560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3762560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
376315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    int _needed;
376415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    switch (pname) {
376515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian#if defined(GL_CURRENT_VERTEX_ATTRIB)
376615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_CURRENT_VERTEX_ATTRIB:
376715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
376815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            _needed = 4;
376915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            break;
377015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        default:
377115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            _needed = 1;
377215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            break;
377315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
377415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < _needed) {
377515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
377615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
377715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < needed";
377815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
377915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
3780560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
3781560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
3782560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
3783560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3784560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetVertexAttribiv(
3785560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
3786560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3787560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3788560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3789560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3790560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
3791560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
3792560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
3793560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            _exception ? JNI_ABORT: 0);
3794560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
37952545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
37962545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
37972545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
3798560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3799560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3800560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
3801560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3802560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glGetVertexAttribiv__IILjava_nio_IntBuffer_2
3803560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
380415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
380515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
380615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
3807560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
380817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3809560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3810560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
3811560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
381217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
381315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    int _needed;
381415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    switch (pname) {
381515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian#if defined(GL_CURRENT_VERTEX_ATTRIB)
381615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        case GL_CURRENT_VERTEX_ATTRIB:
381715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
381815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            _needed = 4;
381915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            break;
382015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        default:
382115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            _needed = 1;
382215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            break;
382315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
382415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < _needed) {
382515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
382615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
382715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < needed";
382815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
382915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
383017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
383117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
383217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
383317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3834560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glGetVertexAttribiv(
3835560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)index,
3836560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3837560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
3838560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
383915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
384015284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
3841560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
384215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
384315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
384415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
384515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
3846560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
3847560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3848560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3849560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glHint ( GLenum target, GLenum mode ) */
3850560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3851560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glHint__II
3852560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint mode) {
3853560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glHint(
3854560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
3855560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)mode
3856560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3857560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3858560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3859560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLboolean glIsBuffer ( GLuint buffer ) */
3860560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jboolean
3861560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glIsBuffer__I
3862560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint buffer) {
3863560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLboolean _returnValue;
3864560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glIsBuffer(
3865560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)buffer
3866560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3867428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes    return (jboolean)_returnValue;
3868560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3869560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3870560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLboolean glIsEnabled ( GLenum cap ) */
3871560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jboolean
3872560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glIsEnabled__I
3873560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint cap) {
3874560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLboolean _returnValue;
3875560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glIsEnabled(
3876560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)cap
3877560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3878428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes    return (jboolean)_returnValue;
3879560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3880560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3881560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLboolean glIsFramebuffer ( GLuint framebuffer ) */
3882560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jboolean
3883560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glIsFramebuffer__I
3884560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint framebuffer) {
3885560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLboolean _returnValue;
3886560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glIsFramebuffer(
3887560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)framebuffer
3888560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3889428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes    return (jboolean)_returnValue;
3890560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3891560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3892560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLboolean glIsProgram ( GLuint program ) */
3893560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jboolean
3894560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glIsProgram__I
3895560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program) {
3896560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLboolean _returnValue;
3897560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glIsProgram(
3898560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program
3899560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3900428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes    return (jboolean)_returnValue;
3901560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3902560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3903560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLboolean glIsRenderbuffer ( GLuint renderbuffer ) */
3904560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jboolean
3905560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glIsRenderbuffer__I
3906560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint renderbuffer) {
3907560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLboolean _returnValue;
3908560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glIsRenderbuffer(
3909560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)renderbuffer
3910560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3911428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes    return (jboolean)_returnValue;
3912560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3913560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3914560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLboolean glIsShader ( GLuint shader ) */
3915560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jboolean
3916560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glIsShader__I
3917560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint shader) {
3918560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLboolean _returnValue;
3919560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glIsShader(
3920560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)shader
3921560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3922428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes    return (jboolean)_returnValue;
3923560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3924560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3925560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* GLboolean glIsTexture ( GLuint texture ) */
3926560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic jboolean
3927560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glIsTexture__I
3928560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint texture) {
3929560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLboolean _returnValue;
3930560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _returnValue = glIsTexture(
3931560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)texture
3932560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3933428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes    return (jboolean)_returnValue;
3934560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3935560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3936560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glLineWidth ( GLfloat width ) */
3937560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3938560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glLineWidth__F
3939560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jfloat width) {
3940560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glLineWidth(
3941560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)width
3942560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3943560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3944560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3945560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glLinkProgram ( GLuint program ) */
3946560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3947560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glLinkProgram__I
3948560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program) {
3949560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glLinkProgram(
3950560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program
3951560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3952560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3953560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3954560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glPixelStorei ( GLenum pname, GLint param ) */
3955560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3956560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glPixelStorei__II
3957560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint pname, jint param) {
3958560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glPixelStorei(
3959560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
3960560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)param
3961560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3962560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3963560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3964560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glPolygonOffset ( GLfloat factor, GLfloat units ) */
3965560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3966560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glPolygonOffset__FF
3967560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) {
3968560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glPolygonOffset(
3969560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)factor,
3970560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)units
3971560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3972560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
3973560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
3974560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */
3975560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
3976560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glReadPixels__IIIIIILjava_nio_Buffer_2
3977560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) {
3978560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
397917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
3980560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
3981560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *pixels = (GLvoid *) 0;
3982560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
398317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
398417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (pixels == NULL) {
398517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
398617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
398717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
3988560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glReadPixels(
3989560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
3990560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y,
3991560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
3992560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height,
3993560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)format,
3994560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)type,
3995560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)pixels
3996560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
3997560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
39982545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        releasePointer(_env, _array, pixels, JNI_TRUE);
3999560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4000560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4001560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4002560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glReleaseShaderCompiler ( void ) */
4003560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4004560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glReleaseShaderCompiler__
4005560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this) {
4006560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glReleaseShaderCompiler();
4007560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4008560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4009560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glRenderbufferStorage ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) */
4010560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4011560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glRenderbufferStorage__IIII
4012560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint width, jint height) {
4013560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glRenderbufferStorage(
4014560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4015560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)internalformat,
4016560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
4017560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height
4018560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4019560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4020560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4021560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glSampleCoverage ( GLclampf value, GLboolean invert ) */
4022560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4023560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glSampleCoverage__FZ
4024560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) {
4025560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glSampleCoverage(
4026560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLclampf)value,
4027560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)invert
4028560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4029560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4030560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4031560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */
4032560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4033560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glScissor__IIII
4034560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
4035560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glScissor(
4036560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
4037560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y,
4038560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
4039560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height
4040560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4041560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4042560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4043560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
4044560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4045560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glShaderBinary__I_3IIILjava_nio_Buffer_2I
4046560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jintArray shaders_ref, jint offset, jint binaryformat, jobject binary_buf, jint length) {
40472545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
404815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
404915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
4050560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
405117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4052560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *shaders_base = (GLuint *) 0;
4053560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _shadersRemaining;
4054560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *shaders = (GLuint *) 0;
4055560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _binaryRemaining;
4056560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *binary = (GLvoid *) 0;
4057560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4058560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!shaders_ref) {
40592545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
40602545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
40612545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "shaders == null";
4062560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4063560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4064560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
40652545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
40662545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
40672545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
4068560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4069560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4070560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _shadersRemaining = _env->GetArrayLength(shaders_ref) - offset;
4071560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    shaders_base = (GLuint *)
4072560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(shaders_ref, (jboolean *)0);
4073560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    shaders = shaders_base + offset;
4074560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
407517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    binary = (GLvoid *)getPointer(_env, binary_buf, &_array, &_binaryRemaining, &_bufferOffset);
407615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_binaryRemaining < length) {
407715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
407815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
407915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < length < needed";
408015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
408115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
408217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (binary == NULL) {
408317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
408417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        binary = (GLvoid *) (_binaryBase + _bufferOffset);
408517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4086560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glShaderBinary(
4087560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
4088560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)shaders,
4089560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)binaryformat,
4090560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)binary,
4091560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)length
4092560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4093560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4094560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4095560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
4096560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, binary, JNI_FALSE);
4097560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4098560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (shaders_base) {
4099560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(shaders_ref, shaders_base,
4100560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
4101560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
41022545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
41032545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
41042545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4105560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4106560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4107560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
4108560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4109560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I
4110560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint n, jobject shaders_buf, jint binaryformat, jobject binary_buf, jint length) {
411115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
411215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
411315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
4114560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _shadersArray = (jarray) 0;
411517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _shadersBufferOffset = (jint) 0;
4116560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _binaryArray = (jarray) 0;
411717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _binaryBufferOffset = (jint) 0;
4118560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _shadersRemaining;
4119560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLuint *shaders = (GLuint *) 0;
4120560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _binaryRemaining;
4121560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *binary = (GLvoid *) 0;
4122560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
412317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    shaders = (GLuint *)getPointer(_env, shaders_buf, &_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
412417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    binary = (GLvoid *)getPointer(_env, binary_buf, &_binaryArray, &_binaryRemaining, &_binaryBufferOffset);
412515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_binaryRemaining < length) {
412615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
412715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
412815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < length < needed";
412915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
413015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
413117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (shaders == NULL) {
413217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _shadersBase = (char *)_env->GetPrimitiveArrayCritical(_shadersArray, (jboolean *) 0);
413317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        shaders = (GLuint *) (_shadersBase + _shadersBufferOffset);
413417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
413517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (binary == NULL) {
413617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_binaryArray, (jboolean *) 0);
413717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        binary = (GLvoid *) (_binaryBase + _binaryBufferOffset);
413817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4139560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glShaderBinary(
4140560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)n,
4141560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint *)shaders,
4142560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)binaryformat,
4143560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)binary,
4144560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)length
4145560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
414615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
414715284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
4148560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_binaryArray) {
414917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        releasePointer(_env, _binaryArray, binary, JNI_FALSE);
415017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
415117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (_shadersArray) {
415217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        releasePointer(_env, _shadersArray, shaders, JNI_FALSE);
4153560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
415415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
415515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
415615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
4157560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4158560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4159560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4160560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint * length ) */
4161560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic
4162560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichvoid
4163560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glShaderSource
4164560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    (JNIEnv *_env, jobject _this, jint shader, jstring string) {
4165560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4166560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!string) {
416724ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes        jniThrowException(_env, "java/lang/IllegalArgumentException", "string == null");
4168560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        return;
4169560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4170560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4171560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    const char* nativeString = _env->GetStringUTFChars(string, 0);
4172560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    const char* strings[] = {nativeString};
4173560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glShaderSource(shader, 1, strings, 0);
4174560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _env->ReleaseStringUTFChars(string, nativeString);
4175560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4176560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */
4177560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4178560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glStencilFunc__III
4179560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) {
4180560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glStencilFunc(
4181560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)func,
4182560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)ref,
4183560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)mask
4184560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4185560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4186560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4187560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glStencilFuncSeparate ( GLenum face, GLenum func, GLint ref, GLuint mask ) */
4188560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4189560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glStencilFuncSeparate__IIII
4190560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint face, jint func, jint ref, jint mask) {
4191560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glStencilFuncSeparate(
4192560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)face,
4193560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)func,
4194560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)ref,
4195560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)mask
4196560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4197560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4198560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4199560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glStencilMask ( GLuint mask ) */
4200560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4201560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glStencilMask__I
4202560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint mask) {
4203560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glStencilMask(
4204560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)mask
4205560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4206560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4207560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4208560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glStencilMaskSeparate ( GLenum face, GLuint mask ) */
4209560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4210560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glStencilMaskSeparate__II
4211560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint face, jint mask) {
4212560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glStencilMaskSeparate(
4213560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)face,
4214560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)mask
4215560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4216560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4217560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4218560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */
4219560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4220560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glStencilOp__III
4221560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) {
4222560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glStencilOp(
4223560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)fail,
4224560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)zfail,
4225560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)zpass
4226560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4227560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4228560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4229560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) */
4230560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4231560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glStencilOpSeparate__IIII
4232560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint face, jint fail, jint zfail, jint zpass) {
4233560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glStencilOpSeparate(
4234560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)face,
4235560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)fail,
4236560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)zfail,
4237560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)zpass
4238560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4239560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4240560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4241560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */
4242560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4243560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexImage2D__IIIIIIIILjava_nio_Buffer_2
4244560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) {
4245560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
424617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4247560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4248560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *pixels = (GLvoid *) 0;
4249560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4250560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (pixels_buf) {
425117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
425217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
425337c9b49ab5eb5a676370fd7081db0967c38e97a6Thomas Tafertshofer    if (pixels_buf && pixels == NULL) {
425417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
425517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
4256560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4257560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexImage2D(
4258560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4259560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)level,
4260560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)internalformat,
4261560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
4262560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height,
4263560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)border,
4264560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)format,
4265560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)type,
4266560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)pixels
4267560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4268560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
4269560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, pixels, JNI_FALSE);
4270560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4271560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4272560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4273560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */
4274560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4275560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexParameterf__IIF
4276560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
4277560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexParameterf(
4278560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4279560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4280560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)param
4281560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4282560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4283560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4284560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
4285560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4286560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexParameterfv__II_3FI
4287560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
42882545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
428915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
429015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
4291560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params_base = (GLfloat *) 0;
4292560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4293560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
4294560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4295560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
42962545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
42972545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
42982545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
4299560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4300560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4301560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
43022545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
43032545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
43042545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
4305560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4306560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4307560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
4308560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
43092545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
43102545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
43112545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < 1 < needed";
4312560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4313560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4314560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLfloat *)
4315560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
4316560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
4317560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4318560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexParameterfv(
4319560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4320560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4321560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
4322560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4323560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4324560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4325560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
4326560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
4327560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
4328560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
43292545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
43302545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
43312545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4332560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4333560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4334560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
4335560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4336560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexParameterfv__IILjava_nio_FloatBuffer_2
4337560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
43382545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
433915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
434015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
4341560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
434217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4343560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4344560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *params = (GLfloat *) 0;
4345560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
434617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
4347560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
43482545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
43492545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
43502545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < 1 < needed";
4351560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4352560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
435317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
435417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
435517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLfloat *) (_paramsBase + _bufferOffset);
435617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4357560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexParameterfv(
4358560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4359560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4360560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)params
4361560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4362560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4363560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4364560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
4365560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, params, JNI_FALSE);
4366560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
43672545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
43682545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
43692545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4370560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4371560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4372560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */
4373560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4374560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexParameteri__III
4375560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
4376560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexParameteri(
4377560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4378560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4379560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)param
4380560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4381560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4382560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4383560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
4384560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4385560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexParameteriv__II_3II
4386560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
43872545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
438815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
438915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
4390560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params_base = (GLint *) 0;
4391560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4392560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
4393560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4394560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!params_ref) {
43952545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
43962545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
43972545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
4398560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4399560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4400560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
44012545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
44022545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
44032545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
4404560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4405560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4406560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(params_ref) - offset;
4407560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
44082545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
44092545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
44102545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < 1 < needed";
4411560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4412560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4413560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params_base = (GLint *)
4414560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
4415560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    params = params_base + offset;
4416560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4417560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexParameteriv(
4418560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4419560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4420560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
4421560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4422560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4423560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4424560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (params_base) {
4425560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
4426560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
4427560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
44282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
44292545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
44302545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4431560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4432560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4433560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
4434560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4435560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexParameteriv__IILjava_nio_IntBuffer_2
4436560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
44372545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
443815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
443915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
4440560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
444117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4442560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4443560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *params = (GLint *) 0;
4444560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
444517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
4446560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_remaining < 1) {
44472545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
44482545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
44492545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < 1 < needed";
4450560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4451560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
445217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
445317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
445417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLint *) (_paramsBase + _bufferOffset);
445517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4456560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexParameteriv(
4457560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4458560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)pname,
4459560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)params
4460560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4461560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4462560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4463560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
4464560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, params, JNI_FALSE);
4465560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
44662545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
44672545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
44682545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4469560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4470560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4471560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */
4472560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4473560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
4474560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) {
4475560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
447617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4477560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4478560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *pixels = (GLvoid *) 0;
4479560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4480560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (pixels_buf) {
448117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
448217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
448337c9b49ab5eb5a676370fd7081db0967c38e97a6Thomas Tafertshofer    if (pixels_buf && pixels == NULL) {
448417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
448517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
4486560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4487560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glTexSubImage2D(
4488560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)target,
4489560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)level,
4490560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)xoffset,
4491560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)yoffset,
4492560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
4493560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height,
4494560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)format,
4495560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)type,
4496560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)pixels
4497560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4498560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
4499560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, pixels, JNI_FALSE);
4500560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4501560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4502560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4503560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform1f ( GLint location, GLfloat x ) */
4504560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4505560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform1f__IF
4506560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jfloat x) {
4507560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform1f(
4508560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4509560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x
4510560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4511560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4512560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4513560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
4514560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4515560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform1fv__II_3FI
4516560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
45172545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
451815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
451915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
4520560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v_base = (GLfloat *) 0;
4521560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4522560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
4523560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4524560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
45252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
45262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
45272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
4528560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4529560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4530560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
45312545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
45322545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
45332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
4534560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4535560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4536560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
453715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count) {
453815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
453915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
454015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < count < needed";
454115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
454215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
4543560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLfloat *)
4544560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4545560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
4546560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4547560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform1fv(
4548560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4549560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
4550560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
4551560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4552560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4553560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4554560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
4555560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4556560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
4557560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
45582545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
45592545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
45602545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4561560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4562560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4563560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
4564560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4565560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform1fv__IILjava_nio_FloatBuffer_2
4566560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
456715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
456815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
456915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
4570560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
457117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4572560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4573560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
4574560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
457517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
457615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count) {
457715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
457815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
457915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < count < needed";
458015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
458115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
458217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
458317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
458417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLfloat *) (_vBase + _bufferOffset);
458517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4586560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform1fv(
4587560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4588560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
4589560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
4590560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
459115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
459215284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
4593560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
4594560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, v, JNI_FALSE);
4595560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
459615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
459715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
459815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
4599560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4600560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4601560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform1i ( GLint location, GLint x ) */
4602560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4603560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform1i__II
4604560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint x) {
4605560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform1i(
4606560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4607560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x
4608560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4609560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4610560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4611560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
4612560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4613560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform1iv__II_3II
4614560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
46152545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
461615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
461715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
4618560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v_base = (GLint *) 0;
4619560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4620560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
4621560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4622560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
46232545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
46242545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
46252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
4626560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4627560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4628560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
46292545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
46302545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
46312545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
4632560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4633560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4634560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
463515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count) {
463615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
463715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
463815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < count < needed";
463915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
464015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
4641560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLint *)
4642560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4643560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
4644560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4645560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform1iv(
4646560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4647560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
4648560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
4649560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4650560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4651560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4652560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
4653560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4654560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
4655560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
46562545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
46572545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
46582545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4659560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4660560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4661560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
4662560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4663560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform1iv__IILjava_nio_IntBuffer_2
4664560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
466515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
466615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
466715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
4668560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
466917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4670560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4671560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
4672560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
467317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
467415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count) {
467515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
467615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
467715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < count < needed";
467815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
467915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
468017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
468117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
468217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLint *) (_vBase + _bufferOffset);
468317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4684560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform1iv(
4685560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4686560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
4687560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
4688560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
468915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
469015284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
4691560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
4692560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, v, JNI_FALSE);
4693560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
469415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
469515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
469615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
4697560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4698560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4699560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform2f ( GLint location, GLfloat x, GLfloat y ) */
4700560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4701560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform2f__IFF
4702560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y) {
4703560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform2f(
4704560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4705560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x,
4706560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)y
4707560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4708560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4709560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4710560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
4711560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4712560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform2fv__II_3FI
4713560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
47142545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
471515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
471615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
4717560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v_base = (GLfloat *) 0;
4718560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4719560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
4720560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4721560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
47222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
47232545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
47242545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
4725560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4726560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4727560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
47282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
47292545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
47302545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
4731560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4732560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4733560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
473415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count*2) {
473515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
473615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
473715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < count*2 < needed";
473815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
473915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
4740560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLfloat *)
4741560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4742560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
4743560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4744560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform2fv(
4745560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4746560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
4747560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
4748560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4749560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4750560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4751560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
4752560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4753560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
4754560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
47552545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
47562545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
47572545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4758560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4759560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4760560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
4761560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4762560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform2fv__IILjava_nio_FloatBuffer_2
4763560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
476415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
476515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
476615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
4767560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
476817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4769560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4770560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
4771560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
477217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
477315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count*2) {
477415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
477515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
477615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < count*2 < needed";
477715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
477815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
477917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
478017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
478117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLfloat *) (_vBase + _bufferOffset);
478217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4783560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform2fv(
4784560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4785560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
4786560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
4787560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
478815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
478915284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
4790560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
4791560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, v, JNI_FALSE);
4792560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
479315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
479415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
479515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
4796560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4797560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4798560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform2i ( GLint location, GLint x, GLint y ) */
4799560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4800560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform2i__III
4801560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint x, jint y) {
4802560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform2i(
4803560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4804560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
4805560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y
4806560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4807560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4808560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4809560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
4810560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4811560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform2iv__II_3II
4812560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
48132545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
481415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
481515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
4816560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v_base = (GLint *) 0;
4817560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4818560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
4819560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4820560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
48212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
48222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
48232545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
4824560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4825560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4826560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
48272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
48282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
48292545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
4830560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4831560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4832560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
483315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count*2) {
483415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
483515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
483615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < count*2 < needed";
483715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
483815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
4839560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLint *)
4840560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4841560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
4842560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4843560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform2iv(
4844560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4845560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
4846560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
4847560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4848560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4849560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4850560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
4851560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4852560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
4853560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
48542545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
48552545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
48562545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4857560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4858560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4859560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
4860560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4861560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform2iv__IILjava_nio_IntBuffer_2
4862560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
486315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
486415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
486515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
4866560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
486717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4868560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4869560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
4870560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
487117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
487215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count*2) {
487315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
487415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
487515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < count*2 < needed";
487615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
487715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
487817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
487917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
488017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLint *) (_vBase + _bufferOffset);
488117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4882560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform2iv(
4883560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4884560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
4885560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
4886560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
488715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
488815284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
4889560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
4890560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, v, JNI_FALSE);
4891560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
489215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
489315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
489415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
4895560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4896560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4897560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z ) */
4898560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4899560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform3f__IFFF
4900560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z) {
4901560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform3f(
4902560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4903560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x,
4904560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)y,
4905560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)z
4906560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4907560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4908560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4909560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
4910560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4911560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform3fv__II_3FI
4912560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
49132545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
491415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
491515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
4916560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v_base = (GLfloat *) 0;
4917560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4918560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
4919560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4920560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
49212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
49222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
49232545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
4924560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4925560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4926560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
49272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
49282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
49292545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
4930560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
4931560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
4932560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
493315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count*3) {
493415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
493515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
493615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < count*3 < needed";
493715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
493815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
4939560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLfloat *)
4940560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
4941560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
4942560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4943560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform3fv(
4944560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4945560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
4946560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
4947560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
4948560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4949560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
4950560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
4951560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
4952560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
4953560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
49542545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
49552545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
49562545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
4957560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4958560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4959560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
4960560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4961560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform3fv__IILjava_nio_FloatBuffer_2
4962560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
496315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
496415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
496515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
4966560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
496717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4968560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
4969560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
4970560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
497117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
497215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count*3) {
497315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
497415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
497515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < count*3 < needed";
497615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
497715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
497817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
497917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
498017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLfloat *) (_vBase + _bufferOffset);
498117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4982560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform3fv(
4983560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
4984560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
4985560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
4986560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
498715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
498815284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
4989560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
4990560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, v, JNI_FALSE);
4991560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
499215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
499315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
499415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
4995560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
4996560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
4997560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform3i ( GLint location, GLint x, GLint y, GLint z ) */
4998560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
4999560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform3i__IIII
5000560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z) {
5001560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform3i(
5002560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5003560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
5004560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y,
5005560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)z
5006560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5007560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5008560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5009560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
5010560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5011560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform3iv__II_3II
5012560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
50132545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
501415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
501515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5016560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v_base = (GLint *) 0;
5017560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5018560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
5019560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5020560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
50212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
50222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
50232545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
5024560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5025560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5026560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
50272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
50282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
50292545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5030560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5031560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5032560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
503315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count*3) {
503415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
503515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
503615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < count*3 < needed";
503715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
503815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
5039560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLint *)
5040560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
5041560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
5042560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5043560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform3iv(
5044560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5045560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5046560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
5047560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5048560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5049560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5050560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
5051560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
5052560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5053560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
50542545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
50552545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
50562545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5057560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5058560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5059560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
5060560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5061560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform3iv__IILjava_nio_IntBuffer_2
5062560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
506315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
506415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
506515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5066560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
506717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5068560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5069560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
5070560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
507117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
507215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count*3) {
507315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
507415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
507515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < count*3 < needed";
507615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
507715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
507817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
507917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
508017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLint *) (_vBase + _bufferOffset);
508117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5082560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform3iv(
5083560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5084560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5085560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
5086560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
508715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
508815284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
5089560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
5090560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, v, JNI_FALSE);
5091560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
509215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
509315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
509415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
5095560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5096560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5097560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
5098560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5099560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform4f__IFFFF
5100560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z, jfloat w) {
5101560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform4f(
5102560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5103560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x,
5104560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)y,
5105560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)z,
5106560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)w
5107560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5108560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5109560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5110560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
5111560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5112560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform4fv__II_3FI
5113560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
51142545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
511515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
511615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5117560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v_base = (GLfloat *) 0;
5118560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5119560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
5120560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5121560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
51222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
51232545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
51242545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
5125560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5126560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5127560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
51282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
51292545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
51302545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5131560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5132560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5133560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
513415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count*4) {
513515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
513615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
513715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < count*4 < needed";
513815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
513915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
5140560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLfloat *)
5141560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
5142560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
5143560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5144560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform4fv(
5145560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5146560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5147560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
5148560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5149560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5150560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5151560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
5152560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
5153560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5154560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
51552545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
51562545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
51572545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5158560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5159560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5160560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
5161560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5162560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform4fv__IILjava_nio_FloatBuffer_2
5163560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
516415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
516515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
516615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5167560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
516817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5169560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5170560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *v = (GLfloat *) 0;
5171560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
517217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
517315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count*4) {
517415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
517515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
517615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < count*4 < needed";
517715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
517815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
517917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
518017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
518117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLfloat *) (_vBase + _bufferOffset);
518217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5183560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform4fv(
5184560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5185560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5186560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)v
5187560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
518815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
518915284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
5190560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
5191560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, v, JNI_FALSE);
5192560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
519315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
519415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
519515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
5196560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5197560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5198560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w ) */
5199560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5200560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform4i__IIIII
5201560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z, jint w) {
5202560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform4i(
5203560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5204560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
5205560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y,
5206560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)z,
5207560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)w
5208560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5209560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5210560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5211560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
5212560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5213560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform4iv__II_3II
5214560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
52152545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
521615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
521715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5218560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v_base = (GLint *) 0;
5219560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5220560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
5221560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5222560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!v_ref) {
52232545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
52242545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
52252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "v == null";
5226560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5227560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5228560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
52292545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
52302545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
52312545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5232560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5233560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5234560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(v_ref) - offset;
523515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count*4) {
523615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
523715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
523815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < count*4 < needed";
523915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
524015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
5241560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v_base = (GLint *)
5242560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
5243560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    v = v_base + offset;
5244560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5245560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform4iv(
5246560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5247560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5248560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
5249560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5250560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5251560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5252560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (v_base) {
5253560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
5254560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5255560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
52562545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
52572545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
52582545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5259560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5260560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5261560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
5262560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5263560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniform4iv__IILjava_nio_IntBuffer_2
5264560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
526515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
526615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
526715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5268560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
526917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5270560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5271560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLint *v = (GLint *) 0;
5272560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
527317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
527415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count*4) {
527515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
527615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
527715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < count*4 < needed";
527815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
527915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
528017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (v == NULL) {
528117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
528217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        v = (GLint *) (_vBase + _bufferOffset);
528317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5284560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniform4iv(
5285560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5286560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5287560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint *)v
5288560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
528915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
529015284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
5291560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
5292560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, v, JNI_FALSE);
5293560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
529415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
529515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
529615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
5297560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5298560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5299560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5300560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5301560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniformMatrix2fv__IIZ_3FI
5302560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
53032545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
530415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
530515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5306560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value_base = (GLfloat *) 0;
5307560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5308560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value = (GLfloat *) 0;
5309560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5310560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!value_ref) {
53112545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
53122545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
53132545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "value == null";
5314560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5315560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5316560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
53172545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
53182545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
53192545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5320560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5321560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5322560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(value_ref) - offset;
532315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count*4) {
532415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
532515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
532615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < count*4 < needed";
532715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
532815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
5329560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    value_base = (GLfloat *)
5330560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
5331560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    value = value_base + offset;
5332560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5333560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniformMatrix2fv(
5334560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5335560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5336560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)transpose,
5337560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)value
5338560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5339560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5340560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5341560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (value_base) {
5342560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
5343560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5344560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
53452545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
53462545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
53472545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5348560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5349560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5350560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5351560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5352560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2
5353560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
535415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
535515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
535615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5357560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
535817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5359560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5360560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value = (GLfloat *) 0;
5361560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
536217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
536315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count*4) {
536415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
536515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
536615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < count*4 < needed";
536715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
536815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
536917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (value == NULL) {
537017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
537117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        value = (GLfloat *) (_valueBase + _bufferOffset);
537217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5373560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniformMatrix2fv(
5374560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5375560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5376560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)transpose,
5377560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)value
5378560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
537915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
538015284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
5381560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
5382560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, value, JNI_FALSE);
5383560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
538415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
538515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
538615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
5387560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5388560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5389560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5390560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5391560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniformMatrix3fv__IIZ_3FI
5392560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
53932545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
539415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
539515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5396560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value_base = (GLfloat *) 0;
5397560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5398560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value = (GLfloat *) 0;
5399560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5400560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!value_ref) {
54012545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
54022545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
54032545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "value == null";
5404560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5405560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5406560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
54072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
54082545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
54092545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5410560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5411560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5412560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(value_ref) - offset;
541315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count*9) {
541415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
541515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
541615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < count*9 < needed";
541715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
541815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
5419560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    value_base = (GLfloat *)
5420560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
5421560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    value = value_base + offset;
5422560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5423560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniformMatrix3fv(
5424560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5425560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5426560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)transpose,
5427560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)value
5428560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5429560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5430560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5431560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (value_base) {
5432560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
5433560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5434560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
54352545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
54362545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
54372545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5438560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5439560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5440560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5441560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5442560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2
5443560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
544415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
544515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
544615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5447560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
544817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5449560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5450560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value = (GLfloat *) 0;
5451560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
545217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
545315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count*9) {
545415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
545515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
545615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < count*9 < needed";
545715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
545815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
545917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (value == NULL) {
546017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
546117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        value = (GLfloat *) (_valueBase + _bufferOffset);
546217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5463560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniformMatrix3fv(
5464560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5465560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5466560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)transpose,
5467560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)value
5468560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
546915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
547015284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
5471560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
5472560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, value, JNI_FALSE);
5473560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
547415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
547515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
547615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
5477560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5478560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5479560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5480560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5481560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniformMatrix4fv__IIZ_3FI
5482560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
54832545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
548415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
548515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5486560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value_base = (GLfloat *) 0;
5487560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5488560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value = (GLfloat *) 0;
5489560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5490560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!value_ref) {
54912545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
54922545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
54932545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "value == null";
5494560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5495560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5496560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
54972545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
54982545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
54992545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5500560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5501560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5502560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(value_ref) - offset;
550315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count*16) {
550415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
550515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
550615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < count*16 < needed";
550715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
550815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
5509560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    value_base = (GLfloat *)
5510560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
5511560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    value = value_base + offset;
5512560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5513560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniformMatrix4fv(
5514560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5515560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5516560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)transpose,
5517560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)value
5518560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5519560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5520560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5521560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (value_base) {
5522560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
5523560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5524560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
55252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
55262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
55272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5528560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5529560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5530560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5531560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5532560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2
5533560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
553415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
553515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
553615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5537560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
553817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5539560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5540560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *value = (GLfloat *) 0;
5541560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
554217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
554315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < count*16) {
554415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
554515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
554615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < count*16 < needed";
554715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
554815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
554917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (value == NULL) {
555017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
555117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        value = (GLfloat *) (_valueBase + _bufferOffset);
555217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5553560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUniformMatrix4fv(
5554560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)location,
5555560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)count,
5556560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)transpose,
5557560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)value
5558560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
555915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
556015284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
5561560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
5562560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, value, JNI_FALSE);
5563560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
556415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
556515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
556615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
5567560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5568560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5569560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glUseProgram ( GLuint program ) */
5570560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5571560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glUseProgram__I
5572560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program) {
5573560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glUseProgram(
5574560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program
5575560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5576560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5577560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5578560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glValidateProgram ( GLuint program ) */
5579560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5580560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glValidateProgram__I
5581560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint program) {
5582560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glValidateProgram(
5583560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)program
5584560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5585560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5586560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5587560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib1f ( GLuint indx, GLfloat x ) */
5588560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5589560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib1f__IF
5590560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloat x) {
5591560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib1f(
5592560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
5593560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x
5594560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5595560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5596560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5597560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
5598560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5599560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib1fv__I_3FI
5600560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
56012545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
560215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
560315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5604560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values_base = (GLfloat *) 0;
5605560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5606560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
5607560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5608560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!values_ref) {
56092545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
56102545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
56112545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "values == null";
5612560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5613560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5614560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
56152545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
56162545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
56172545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5618560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5619560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5620560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(values_ref) - offset;
562115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < 1) {
562215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
562315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
562415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < 1 < needed";
562515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
562615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
5627560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values_base = (GLfloat *)
5628560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
5629560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values = values_base + offset;
5630560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5631560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib1fv(
5632560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
5633560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
5634560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5635560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5636560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5637560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (values_base) {
5638560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
5639560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5640560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
56412545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
56422545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
56432545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5644560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5645560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5646560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
5647560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5648560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2
5649560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
565015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
565115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
565215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5653560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
565417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5655560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5656560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
5657560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
565817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset);
565915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < 1) {
566015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
566115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
566215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < 1 < needed";
566315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
566415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
566517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (values == NULL) {
566617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
566717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        values = (GLfloat *) (_valuesBase + _bufferOffset);
566817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5669560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib1fv(
5670560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
5671560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
5672560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
567315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
567415284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
5675560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
5676560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, values, JNI_FALSE);
5677560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
567815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
567915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
568015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
5681560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5682560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5683560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib2f ( GLuint indx, GLfloat x, GLfloat y ) */
5684560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5685560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib2f__IFF
5686560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y) {
5687560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib2f(
5688560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
5689560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x,
5690560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)y
5691560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5692560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5693560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5694560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
5695560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5696560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib2fv__I_3FI
5697560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
56982545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
569915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
570015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5701560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values_base = (GLfloat *) 0;
5702560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5703560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
5704560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5705560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!values_ref) {
57062545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
57072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
57082545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "values == null";
5709560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5710560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5711560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
57122545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
57132545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
57142545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5715560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5716560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5717560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(values_ref) - offset;
571815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < 2) {
571915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
572015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
572115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < 2 < needed";
572215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
572315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
5724560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values_base = (GLfloat *)
5725560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
5726560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values = values_base + offset;
5727560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5728560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib2fv(
5729560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
5730560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
5731560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5732560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5733560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5734560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (values_base) {
5735560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
5736560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5737560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
57382545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
57392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
57402545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5741560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5742560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5743560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
5744560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5745560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2
5746560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
574715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
574815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
574915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5750560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
575117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5752560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5753560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
5754560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
575517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset);
575615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < 2) {
575715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
575815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
575915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < 2 < needed";
576015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
576115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
576217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (values == NULL) {
576317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
576417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        values = (GLfloat *) (_valuesBase + _bufferOffset);
576517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5766560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib2fv(
5767560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
5768560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
5769560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
577015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
577115284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
5772560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
5773560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, values, JNI_FALSE);
5774560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
577515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
577615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
577715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
5778560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5779560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5780560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib3f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z ) */
5781560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5782560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib3f__IFFF
5783560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z) {
5784560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib3f(
5785560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
5786560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x,
5787560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)y,
5788560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)z
5789560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5790560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5791560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5792560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
5793560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5794560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib3fv__I_3FI
5795560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
57962545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
579715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
579815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5799560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values_base = (GLfloat *) 0;
5800560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5801560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
5802560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5803560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!values_ref) {
58042545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
58052545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
58062545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "values == null";
5807560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5808560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5809560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
58102545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
58112545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
58122545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5813560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5814560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5815560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(values_ref) - offset;
581615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < 3) {
581715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
581815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
581915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < 3 < needed";
582015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
582115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
5822560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values_base = (GLfloat *)
5823560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
5824560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values = values_base + offset;
5825560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5826560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib3fv(
5827560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
5828560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
5829560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5830560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5831560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5832560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (values_base) {
5833560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
5834560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5835560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
58362545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
58372545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
58382545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5839560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5840560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5841560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
5842560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5843560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2
5844560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
584515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
584615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
584715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5848560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
584917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5850560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5851560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
5852560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
585317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset);
585415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < 3) {
585515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
585615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
585715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < 3 < needed";
585815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
585915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
586017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (values == NULL) {
586117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
586217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        values = (GLfloat *) (_valuesBase + _bufferOffset);
586317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5864560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib3fv(
5865560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
5866560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
5867560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
586815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
586915284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
5870560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
5871560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, values, JNI_FALSE);
5872560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
587315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
587415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
587515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
5876560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5877560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5878560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib4f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
5879560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5880560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib4f__IFFFF
5881560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z, jfloat w) {
5882560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib4f(
5883560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
5884560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)x,
5885560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)y,
5886560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)z,
5887560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat)w
5888560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5889560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5890560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5891560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
5892560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5893560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib4fv__I_3FI
5894560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
58952545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
589615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
589715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5898560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values_base = (GLfloat *) 0;
5899560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5900560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
5901560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5902560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (!values_ref) {
59032545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
59042545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
59052545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "values == null";
5906560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5907560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5908560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (offset < 0) {
59092545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
59102545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
59112545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5912560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        goto exit;
5913560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
5914560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    _remaining = _env->GetArrayLength(values_ref) - offset;
591515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < 4) {
591615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
591715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
591815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "length - offset < 4 < needed";
591915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
592015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
5921560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values_base = (GLfloat *)
5922560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
5923560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    values = values_base + offset;
5924560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5925560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib4fv(
5926560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
5927560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
5928560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
5929560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5930560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichexit:
5931560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (values_base) {
5932560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
5933560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            JNI_ABORT);
5934560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
59352545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
59362545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
59372545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5938560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5939560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5940560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
5941560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5942560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2
5943560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
594415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    jint _exception = 0;
594515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
594615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5947560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
594817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5949560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5950560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLfloat *values = (GLfloat *) 0;
5951560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
595217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset);
595315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_remaining < 4) {
595415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exception = 1;
595515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionType = "java/lang/IllegalArgumentException";
595615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        _exceptionMessage = "remaining() < 4 < needed";
595715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        goto exit;
595815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
595917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (values == NULL) {
596017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
596117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        values = (GLfloat *) (_valuesBase + _bufferOffset);
596217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
5963560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttrib4fv(
5964560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
5965560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLfloat *)values
5966560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
596715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian
596815284dee8efe6b4d1441ab040962077614b5061aMathias Agopianexit:
5969560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (_array) {
5970560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        releasePointer(_env, _array, values, JNI_FALSE);
5971560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
597215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    if (_exception) {
597315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian        jniThrowException(_env, _exceptionType, _exceptionMessage);
597415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    }
5975560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
5976560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
5977224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint offset ) */
5978224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevichstatic void
5979224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevichandroid_glVertexAttribPointer__IIIZII
5980224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich  (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jint offset) {
5981224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich    glVertexAttribPointer(
5982224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLuint)indx,
5983224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLint)size,
5984224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLenum)type,
5985224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLboolean)normalized,
5986224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich        (GLsizei)stride,
5987428d3fcbe3596b18549cdada9fc68a29f159a946Elliott Hughes        (GLvoid *)offset
5988224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich    );
5989224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich}
5990224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich
5991560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr ) */
5992560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
5993560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I
5994560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jobject ptr_buf, jint remaining) {
5995560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jarray _array = (jarray) 0;
599617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5997560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    jint _remaining;
5998560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    GLvoid *ptr = (GLvoid *) 0;
5999560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6000560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    if (ptr_buf) {
6001560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        ptr = (GLvoid *) getDirectBufferPointer(_env, ptr_buf);
6002560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        if ( ! ptr ) {
6003560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich            return;
6004560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        }
6005560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    }
6006560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glVertexAttribPointerBounds(
6007560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLuint)indx,
6008560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)size,
6009560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLenum)type,
6010560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLboolean)normalized,
6011560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)stride,
6012560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLvoid *)ptr,
6013560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)remaining
6014560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
6015560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6016560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6017560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich/* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */
6018560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic void
6019560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichandroid_glViewport__IIII
6020560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
6021560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    glViewport(
6022560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)x,
6023560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLint)y,
6024560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)width,
6025560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich        (GLsizei)height
6026560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    );
6027560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6028560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6029560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic const char *classPathName = "android/opengl/GLES20";
6030560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6031560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichstatic JNINativeMethod methods[] = {
6032560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"_nativeClassInit", "()V", (void*)nativeClassInit },
6033560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I },
6034560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glAttachShader", "(II)V", (void *) android_glAttachShader__II },
6035560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBindAttribLocation", "(IILjava/lang/String;)V", (void *) android_glBindAttribLocation__IILjava_lang_String_2 },
6036560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II },
6037560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBindFramebuffer", "(II)V", (void *) android_glBindFramebuffer__II },
6038560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBindRenderbuffer", "(II)V", (void *) android_glBindRenderbuffer__II },
6039560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBindTexture", "(II)V", (void *) android_glBindTexture__II },
6040560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBlendColor", "(FFFF)V", (void *) android_glBlendColor__FFFF },
6041560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBlendEquation", "(I)V", (void *) android_glBlendEquation__I },
6042560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBlendEquationSeparate", "(II)V", (void *) android_glBlendEquationSeparate__II },
6043560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II },
6044560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBlendFuncSeparate", "(IIII)V", (void *) android_glBlendFuncSeparate__IIII },
6045560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I },
6046560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 },
6047560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCheckFramebufferStatus", "(I)I", (void *) android_glCheckFramebufferStatus__I },
6048560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glClear", "(I)V", (void *) android_glClear__I },
6049560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF },
6050560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F },
6051560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glClearStencil", "(I)V", (void *) android_glClearStencil__I },
6052560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ },
6053560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCompileShader", "(I)V", (void *) android_glCompileShader__I },
6054560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 },
6055560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
6056560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII },
6057560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII },
6058560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCreateProgram", "()I", (void *) android_glCreateProgram__ },
6059560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCreateShader", "(I)I", (void *) android_glCreateShader__I },
6060560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glCullFace", "(I)V", (void *) android_glCullFace__I },
6061560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II },
6062560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 },
6063560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteFramebuffers", "(I[II)V", (void *) android_glDeleteFramebuffers__I_3II },
6064560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2 },
6065560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteProgram", "(I)V", (void *) android_glDeleteProgram__I },
6066560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteRenderbuffers", "(I[II)V", (void *) android_glDeleteRenderbuffers__I_3II },
6067560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2 },
6068560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteShader", "(I)V", (void *) android_glDeleteShader__I },
6069560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II },
6070560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 },
6071560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I },
6072560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z },
6073560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF },
6074560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDetachShader", "(II)V", (void *) android_glDetachShader__II },
6075560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDisable", "(I)V", (void *) android_glDisable__I },
6076560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDisableVertexAttribArray", "(I)V", (void *) android_glDisableVertexAttribArray__I },
6077560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III },
6078224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich{"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII },
6079560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 },
6080560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glEnable", "(I)V", (void *) android_glEnable__I },
6081560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glEnableVertexAttribArray", "(I)V", (void *) android_glEnableVertexAttribArray__I },
6082560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glFinish", "()V", (void *) android_glFinish__ },
6083560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glFlush", "()V", (void *) android_glFlush__ },
6084560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glFramebufferRenderbuffer", "(IIII)V", (void *) android_glFramebufferRenderbuffer__IIII },
6085560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glFramebufferTexture2D", "(IIIII)V", (void *) android_glFramebufferTexture2D__IIIII },
6086560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glFrontFace", "(I)V", (void *) android_glFrontFace__I },
6087560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II },
6088560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 },
6089560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenerateMipmap", "(I)V", (void *) android_glGenerateMipmap__I },
6090560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenFramebuffers", "(I[II)V", (void *) android_glGenFramebuffers__I_3II },
6091560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenFramebuffers__ILjava_nio_IntBuffer_2 },
6092560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenRenderbuffers", "(I[II)V", (void *) android_glGenRenderbuffers__I_3II },
6093560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenRenderbuffers__ILjava_nio_IntBuffer_2 },
6094560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II },
6095560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 },
6096560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetActiveAttrib", "(III[II[II[II[BI)V", (void *) android_glGetActiveAttrib__III_3II_3II_3II_3BI },
6097560814f6b11abe83ff0c4ed18cac015c276b3181Jack 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 },
6098dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer{"glGetActiveAttrib", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveAttrib1 },
6099dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer{"glGetActiveAttrib", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveAttrib2 },
6100560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetActiveUniform", "(III[II[II[II[BI)V", (void *) android_glGetActiveUniform__III_3II_3II_3II_3BI },
6101dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer{"glGetActiveUniform", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveUniform1 },
6102560814f6b11abe83ff0c4ed18cac015c276b3181Jack 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 },
6103dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer{"glGetActiveUniform", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveUniform2 },
6104560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetAttachedShaders", "(II[II[II)V", (void *) android_glGetAttachedShaders__II_3II_3II },
6105560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetAttachedShaders", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
6106560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetAttribLocation", "(ILjava/lang/String;)I", (void *) android_glGetAttribLocation__ILjava_lang_String_2 },
6107560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI },
6108560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 },
6109560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II },
6110560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 },
6111560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetError", "()I", (void *) android_glGetError__ },
6112560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI },
6113560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 },
6114560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetFramebufferAttachmentParameteriv", "(III[II)V", (void *) android_glGetFramebufferAttachmentParameteriv__III_3II },
6115560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetFramebufferAttachmentParameteriv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2 },
6116560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II },
6117560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 },
6118560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetProgramiv", "(II[II)V", (void *) android_glGetProgramiv__II_3II },
6119560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetProgramiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetProgramiv__IILjava_nio_IntBuffer_2 },
6120560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetProgramInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetProgramInfoLog },
6121560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetRenderbufferParameteriv", "(II[II)V", (void *) android_glGetRenderbufferParameteriv__II_3II },
6122560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetRenderbufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2 },
6123560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetShaderiv", "(II[II)V", (void *) android_glGetShaderiv__II_3II },
6124560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetShaderiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetShaderiv__IILjava_nio_IntBuffer_2 },
6125560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetShaderInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetShaderInfoLog },
6126560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetShaderPrecisionFormat", "(II[II[II)V", (void *) android_glGetShaderPrecisionFormat__II_3II_3II },
6127560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetShaderPrecisionFormat", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
6128560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetShaderSource", "(II[II[BI)V", (void *) android_glGetShaderSource__II_3II_3BI },
6129560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetShaderSource", "(IILjava/nio/IntBuffer;B)V", (void *) android_glGetShaderSource__IILjava_nio_IntBuffer_2B },
6130dd06946252be852aa53eb6142a119b0fccc83cd1Thomas Tafertshofer{"glGetShaderSource", "(I)Ljava/lang/String;", (void *) android_glGetShaderSource },
6131560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString },
6132560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI },
6133560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 },
6134560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II },
6135560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 },
6136560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetUniformfv", "(II[FI)V", (void *) android_glGetUniformfv__II_3FI },
6137560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetUniformfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetUniformfv__IILjava_nio_FloatBuffer_2 },
6138560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetUniformiv", "(II[II)V", (void *) android_glGetUniformiv__II_3II },
6139560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetUniformiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetUniformiv__IILjava_nio_IntBuffer_2 },
6140560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetUniformLocation", "(ILjava/lang/String;)I", (void *) android_glGetUniformLocation__ILjava_lang_String_2 },
6141560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetVertexAttribfv", "(II[FI)V", (void *) android_glGetVertexAttribfv__II_3FI },
6142560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetVertexAttribfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2 },
6143560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetVertexAttribiv", "(II[II)V", (void *) android_glGetVertexAttribiv__II_3II },
6144560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glGetVertexAttribiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2 },
6145560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glHint", "(II)V", (void *) android_glHint__II },
6146560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I },
6147560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I },
6148560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glIsFramebuffer", "(I)Z", (void *) android_glIsFramebuffer__I },
6149560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glIsProgram", "(I)Z", (void *) android_glIsProgram__I },
6150560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glIsRenderbuffer", "(I)Z", (void *) android_glIsRenderbuffer__I },
6151560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glIsShader", "(I)Z", (void *) android_glIsShader__I },
6152560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glIsTexture", "(I)Z", (void *) android_glIsTexture__I },
6153560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glLineWidth", "(F)V", (void *) android_glLineWidth__F },
6154560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glLinkProgram", "(I)V", (void *) android_glLinkProgram__I },
6155560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II },
6156560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF },
6157560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 },
6158560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glReleaseShaderCompiler", "()V", (void *) android_glReleaseShaderCompiler__ },
6159560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glRenderbufferStorage", "(IIII)V", (void *) android_glRenderbufferStorage__IIII },
6160560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ },
6161560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glScissor", "(IIII)V", (void *) android_glScissor__IIII },
6162560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glShaderBinary", "(I[IIILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__I_3IIILjava_nio_Buffer_2I },
6163560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glShaderBinary", "(ILjava/nio/IntBuffer;ILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I },
6164560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glShaderSource", "(ILjava/lang/String;)V", (void *) android_glShaderSource },
6165560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III },
6166560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glStencilFuncSeparate", "(IIII)V", (void *) android_glStencilFuncSeparate__IIII },
6167560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glStencilMask", "(I)V", (void *) android_glStencilMask__I },
6168560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glStencilMaskSeparate", "(II)V", (void *) android_glStencilMaskSeparate__II },
6169560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glStencilOp", "(III)V", (void *) android_glStencilOp__III },
6170560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glStencilOpSeparate", "(IIII)V", (void *) android_glStencilOpSeparate__IIII },
6171560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 },
6172560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF },
6173560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI },
6174560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 },
6175560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III },
6176560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II },
6177560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 },
6178560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
6179560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform1f", "(IF)V", (void *) android_glUniform1f__IF },
6180560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform1fv", "(II[FI)V", (void *) android_glUniform1fv__II_3FI },
6181560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform1fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform1fv__IILjava_nio_FloatBuffer_2 },
6182560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform1i", "(II)V", (void *) android_glUniform1i__II },
6183560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform1iv", "(II[II)V", (void *) android_glUniform1iv__II_3II },
6184560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform1iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform1iv__IILjava_nio_IntBuffer_2 },
6185560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform2f", "(IFF)V", (void *) android_glUniform2f__IFF },
6186560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform2fv", "(II[FI)V", (void *) android_glUniform2fv__II_3FI },
6187560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform2fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform2fv__IILjava_nio_FloatBuffer_2 },
6188560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform2i", "(III)V", (void *) android_glUniform2i__III },
6189560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform2iv", "(II[II)V", (void *) android_glUniform2iv__II_3II },
6190560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform2iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform2iv__IILjava_nio_IntBuffer_2 },
6191560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform3f", "(IFFF)V", (void *) android_glUniform3f__IFFF },
6192560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform3fv", "(II[FI)V", (void *) android_glUniform3fv__II_3FI },
6193560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform3fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform3fv__IILjava_nio_FloatBuffer_2 },
6194560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform3i", "(IIII)V", (void *) android_glUniform3i__IIII },
6195560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform3iv", "(II[II)V", (void *) android_glUniform3iv__II_3II },
6196560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform3iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform3iv__IILjava_nio_IntBuffer_2 },
6197560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform4f", "(IFFFF)V", (void *) android_glUniform4f__IFFFF },
6198560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform4fv", "(II[FI)V", (void *) android_glUniform4fv__II_3FI },
6199560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform4fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform4fv__IILjava_nio_FloatBuffer_2 },
6200560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform4i", "(IIIII)V", (void *) android_glUniform4i__IIIII },
6201560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform4iv", "(II[II)V", (void *) android_glUniform4iv__II_3II },
6202560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniform4iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform4iv__IILjava_nio_IntBuffer_2 },
6203560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniformMatrix2fv", "(IIZ[FI)V", (void *) android_glUniformMatrix2fv__IIZ_3FI },
6204560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniformMatrix2fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2 },
6205560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniformMatrix3fv", "(IIZ[FI)V", (void *) android_glUniformMatrix3fv__IIZ_3FI },
6206560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniformMatrix3fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2 },
6207560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniformMatrix4fv", "(IIZ[FI)V", (void *) android_glUniformMatrix4fv__IIZ_3FI },
6208560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUniformMatrix4fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2 },
6209560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glUseProgram", "(I)V", (void *) android_glUseProgram__I },
6210560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glValidateProgram", "(I)V", (void *) android_glValidateProgram__I },
6211560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib1f", "(IF)V", (void *) android_glVertexAttrib1f__IF },
6212560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib1fv", "(I[FI)V", (void *) android_glVertexAttrib1fv__I_3FI },
6213560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib1fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2 },
6214560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib2f", "(IFF)V", (void *) android_glVertexAttrib2f__IFF },
6215560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib2fv", "(I[FI)V", (void *) android_glVertexAttrib2fv__I_3FI },
6216560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib2fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2 },
6217560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib3f", "(IFFF)V", (void *) android_glVertexAttrib3f__IFFF },
6218560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib3fv", "(I[FI)V", (void *) android_glVertexAttrib3fv__I_3FI },
6219560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib3fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2 },
6220560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib4f", "(IFFFF)V", (void *) android_glVertexAttrib4f__IFFFF },
6221560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib4fv", "(I[FI)V", (void *) android_glVertexAttrib4fv__I_3FI },
6222560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttrib4fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2 },
6223224107a421e2611b15d1ec736df54bca9ee3e78dJack Palevich{"glVertexAttribPointer", "(IIIZII)V", (void *) android_glVertexAttribPointer__IIIZII },
6224560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glVertexAttribPointerBounds", "(IIIZILjava/nio/Buffer;I)V", (void *) android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I },
6225560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{"glViewport", "(IIII)V", (void *) android_glViewport__IIII },
6226560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich};
6227560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich
6228560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevichint register_android_opengl_jni_GLES20(JNIEnv *_env)
6229560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich{
6230560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    int err;
6231560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
6232560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich    return err;
6233560814f6b11abe83ff0c4ed18cac015c276b3181Jack Palevich}
6234