19066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* //device/libs/android_runtime/com_google_android_gles_jni_GLImpl.cpp
29066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project**
39066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project** Copyright 2006, The Android Open Source Project
49066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project**
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
89066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project**
924ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes**     http://www.apache.org/licenses/LICENSE-2.0
109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project**
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
159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project** limitations under the License.
169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project*/
179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// This source file is automatically generated
199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
2024ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes#include "jni.h"
2124ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes#include "JNIHelp.h"
229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#include <android_runtime/AndroidRuntime.h>
239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#include <utils/misc.h>
249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#include <assert.h>
269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#include <GLES/gl.h>
27be509c9c7de5929d014dfe6d45e71cc8454ede0fJack Palevich#include <GLES/glext.h>
289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
298a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich// Work around differences between the generated name and the actual name.
308a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich
318a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich#define glBlendEquation glBlendEquationOES
328a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich#define glBlendEquationSeparate glBlendEquationSeparateOES
338a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich#define glBlendFuncSeparate glBlendFuncSeparateOES
348a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich#define glGetTexGenfv glGetTexGenfvOES
358a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich#define glGetTexGeniv glGetTexGenivOES
368a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich#define glGetTexGenxv glGetTexGenxvOES
378a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich#define glTexGenf glTexGenfOES
388a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich#define glTexGenfv glTexGenfvOES
398a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich#define glTexGeni glTexGeniOES
408a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich#define glTexGeniv glTexGenivOES
418a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich#define glTexGenx glTexGenxOES
428a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich#define glTexGenxv glTexGenxvOES
438a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich
448a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich
458a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich
468331f72078051cdf5a26230ee819f7ef7f9fcc24Mathias Agopian/* special calls implemented in Android's GLES wrapper used to more
478331f72078051cdf5a26230ee819f7ef7f9fcc24Mathias Agopian * efficiently bound-check passed arrays */
488331f72078051cdf5a26230ee819f7ef7f9fcc24Mathias Agopianextern "C" {
498331f72078051cdf5a26230ee819f7ef7f9fcc24Mathias AgopianGL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
508331f72078051cdf5a26230ee819f7ef7f9fcc24Mathias Agopian        const GLvoid *ptr, GLsizei count);
518331f72078051cdf5a26230ee819f7ef7f9fcc24Mathias AgopianGL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
528331f72078051cdf5a26230ee819f7ef7f9fcc24Mathias Agopian        const GLvoid *pointer, GLsizei count);
538331f72078051cdf5a26230ee819f7ef7f9fcc24Mathias AgopianGL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
548331f72078051cdf5a26230ee819f7ef7f9fcc24Mathias Agopian        GLsizei stride, const GLvoid *pointer, GLsizei count);
558331f72078051cdf5a26230ee819f7ef7f9fcc24Mathias AgopianGL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
568331f72078051cdf5a26230ee819f7ef7f9fcc24Mathias Agopian        GLsizei stride, const GLvoid *pointer, GLsizei count);
57be6eac828f5af8b608c3fa6749330f1dcd6b6206Jack PalevichGL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
58be6eac828f5af8b608c3fa6749330f1dcd6b6206Jack Palevich        GLsizei stride, const GLvoid *pointer, GLsizei count);
59be6eac828f5af8b608c3fa6749330f1dcd6b6206Jack PalevichGL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
60be6eac828f5af8b608c3fa6749330f1dcd6b6206Jack Palevich        GLsizei stride, const GLvoid *pointer, GLsizei count);
61be6eac828f5af8b608c3fa6749330f1dcd6b6206Jack PalevichGL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
62be6eac828f5af8b608c3fa6749330f1dcd6b6206Jack Palevich        GLsizei stride, const GLvoid *pointer, GLsizei count);
638331f72078051cdf5a26230ee819f7ef7f9fcc24Mathias Agopian}
648331f72078051cdf5a26230ee819f7ef7f9fcc24Mathias Agopian
659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic int initialized = 0;
669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic jclass nioAccessClass;
689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic jclass bufferClass;
6991a27ae2fec23b420244258636d2370117e86f5eJack Palevichstatic jclass G11ImplClass;
709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic jmethodID getBasePointerID;
719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic jmethodID getBaseArrayID;
729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic jmethodID getBaseArrayOffsetID;
7391a27ae2fec23b420244258636d2370117e86f5eJack Palevichstatic jmethodID allowIndirectBuffersID;
749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic jfieldID positionID;
759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic jfieldID limitID;
769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic jfieldID elementSizeShiftID;
778a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevichstatic jfieldID haveCheckedExtensionsID;
788a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevichstatic jfieldID have_OES_blend_equation_separateID;
798a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevichstatic jfieldID have_OES_blend_subtractID;
808a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevichstatic jfieldID have_OES_framebuffer_objectID;
818a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevichstatic jfieldID have_OES_texture_cube_mapID;
829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* Cache method IDs each time the class is loaded. */
849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
8527f8002e591b5c579f75b2580183b5d1c4219cd4Jack Palevichstatic void
8624ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott HughesnativeClassInit(JNIEnv *_env, jclass glImplClass)
879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
9491a27ae2fec23b420244258636d2370117e86f5eJack Palevich    jclass g11impClassLocal = _env->FindClass("com/google/android/gles_jni/GLImpl");
9591a27ae2fec23b420244258636d2370117e86f5eJack Palevich    G11ImplClass = (jclass) _env->NewGlobalRef(g11impClassLocal);
968a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich    haveCheckedExtensionsID =  _env->GetFieldID(G11ImplClass, "haveCheckedExtensions", "Z");
978a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich    have_OES_blend_equation_separateID =  _env->GetFieldID(G11ImplClass, "have_OES_blend_equation_separate", "Z");
988a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich    have_OES_blend_subtractID =  _env->GetFieldID(G11ImplClass, "have_OES_blend_subtract", "Z");
998a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich    have_OES_framebuffer_objectID =  _env->GetFieldID(G11ImplClass, "have_OES_framebuffer_object", "Z");
1008a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich    have_OES_texture_cube_mapID =  _env->GetFieldID(G11ImplClass, "have_OES_texture_cube_map", "Z");
10191a27ae2fec23b420244258636d2370117e86f5eJack Palevich
1029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
1039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            "getBasePointer", "(Ljava/nio/Buffer;)J");
1049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
1059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
1069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
1079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
10891a27ae2fec23b420244258636d2370117e86f5eJack Palevich    allowIndirectBuffersID = _env->GetStaticMethodID(g11impClassLocal,
10991a27ae2fec23b420244258636d2370117e86f5eJack Palevich            "allowIndirectBuffers", "(Ljava/lang/String;)Z");
1109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    positionID = _env->GetFieldID(bufferClass, "position", "I");
1119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    limitID = _env->GetFieldID(bufferClass, "limit", "I");
1129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    elementSizeShiftID =
1139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
1149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
1159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void *
11717045a16575ece34cfadb63da4791f115625df78Thomas TafertshofergetPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
1189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
1199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jint position;
1209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jint limit;
1219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jint elementSizeShift;
1229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jlong pointer;
1239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    position = _env->GetIntField(buffer, positionID);
1259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    limit = _env->GetIntField(buffer, limitID);
1269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
1279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    *remaining = (limit - position) << elementSizeShift;
1289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    pointer = _env->CallStaticLongMethod(nioAccessClass,
1299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            getBasePointerID, buffer);
1309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (pointer != 0L) {
1319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        *array = NULL;
13201c26ea89d4bbea3cf550e9328742302dd9a2b25Ashok Bhat        return reinterpret_cast<void *>(pointer);
1339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
13424ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes
1359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
1369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            getBaseArrayID, buffer);
13791a27ae2fec23b420244258636d2370117e86f5eJack Palevich    if (*array == NULL) {
13891a27ae2fec23b420244258636d2370117e86f5eJack Palevich        return (void*) NULL;
13991a27ae2fec23b420244258636d2370117e86f5eJack Palevich    }
14017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    *offset = _env->CallStaticIntMethod(nioAccessClass,
1419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            getBaseArrayOffsetID, buffer);
14224ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes
14317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    return NULL;
1449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
1459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
1479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectreleasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
1489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
1499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    _env->ReleasePrimitiveArrayCritical(array, data,
1509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project					   commit ? 0 : JNI_ABORT);
1519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
1529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
15391a27ae2fec23b420244258636d2370117e86f5eJack Palevichextern "C" {
15491a27ae2fec23b420244258636d2370117e86f5eJack Palevichextern char*  __progname;
15591a27ae2fec23b420244258636d2370117e86f5eJack Palevich}
15691a27ae2fec23b420244258636d2370117e86f5eJack Palevich
15791a27ae2fec23b420244258636d2370117e86f5eJack Palevichstatic bool
15891a27ae2fec23b420244258636d2370117e86f5eJack PalevichallowIndirectBuffers(JNIEnv *_env) {
15991a27ae2fec23b420244258636d2370117e86f5eJack Palevich    static jint sIndirectBufferCompatability;
16091a27ae2fec23b420244258636d2370117e86f5eJack Palevich    if (sIndirectBufferCompatability == 0) {
16191a27ae2fec23b420244258636d2370117e86f5eJack Palevich        jobject appName = _env->NewStringUTF(::__progname);
16291a27ae2fec23b420244258636d2370117e86f5eJack Palevich        sIndirectBufferCompatability = _env->CallStaticBooleanMethod(G11ImplClass, allowIndirectBuffersID, appName) ? 2 : 1;
16391a27ae2fec23b420244258636d2370117e86f5eJack Palevich    }
16491a27ae2fec23b420244258636d2370117e86f5eJack Palevich    return sIndirectBufferCompatability == 2;
16591a27ae2fec23b420244258636d2370117e86f5eJack Palevich}
16691a27ae2fec23b420244258636d2370117e86f5eJack Palevich
16716e7972f0d986eebf846ea8feb50f4435a9c6970Jack Palevichstatic void *
16816e7972f0d986eebf846ea8feb50f4435a9c6970Jack PalevichgetDirectBufferPointer(JNIEnv *_env, jobject buffer) {
16991a27ae2fec23b420244258636d2370117e86f5eJack Palevich    if (!buffer) {
17091a27ae2fec23b420244258636d2370117e86f5eJack Palevich        return NULL;
17191a27ae2fec23b420244258636d2370117e86f5eJack Palevich    }
17291a27ae2fec23b420244258636d2370117e86f5eJack Palevich    void* buf = _env->GetDirectBufferAddress(buffer);
17316e7972f0d986eebf846ea8feb50f4435a9c6970Jack Palevich    if (buf) {
17416e7972f0d986eebf846ea8feb50f4435a9c6970Jack Palevich        jint position = _env->GetIntField(buffer, positionID);
17516e7972f0d986eebf846ea8feb50f4435a9c6970Jack Palevich        jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
17691a27ae2fec23b420244258636d2370117e86f5eJack Palevich        buf = ((char*) buf) + (position << elementSizeShift);
17716e7972f0d986eebf846ea8feb50f4435a9c6970Jack Palevich    } else {
17891a27ae2fec23b420244258636d2370117e86f5eJack Palevich        if (allowIndirectBuffers(_env)) {
17991a27ae2fec23b420244258636d2370117e86f5eJack Palevich            jarray array = 0;
18091a27ae2fec23b420244258636d2370117e86f5eJack Palevich            jint remaining;
18117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer            jint offset;
18217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer            buf = getPointer(_env, buffer, &array, &remaining, &offset);
18391a27ae2fec23b420244258636d2370117e86f5eJack Palevich            if (array) {
18491a27ae2fec23b420244258636d2370117e86f5eJack Palevich                releasePointer(_env, array, buf, 0);
18591a27ae2fec23b420244258636d2370117e86f5eJack Palevich            }
18601994c79f4e39db08a343fc9db23e771e670ef39synergydev            buf = (char*)buf + offset;
18791a27ae2fec23b420244258636d2370117e86f5eJack Palevich        } else {
18824ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes            jniThrowException(_env, "java/lang/IllegalArgumentException",
18924ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes                              "Must use a native order direct Buffer");
19091a27ae2fec23b420244258636d2370117e86f5eJack Palevich        }
19116e7972f0d986eebf846ea8feb50f4435a9c6970Jack Palevich    }
19291a27ae2fec23b420244258636d2370117e86f5eJack Palevich    return buf;
19316e7972f0d986eebf846ea8feb50f4435a9c6970Jack Palevich}
19416e7972f0d986eebf846ea8feb50f4435a9c6970Jack Palevich
195be509c9c7de5929d014dfe6d45e71cc8454ede0fJack Palevichstatic int
196be509c9c7de5929d014dfe6d45e71cc8454ede0fJack PalevichgetNumCompressedTextureFormats() {
197be509c9c7de5929d014dfe6d45e71cc8454ede0fJack Palevich    int numCompressedTextureFormats = 0;
198be509c9c7de5929d014dfe6d45e71cc8454ede0fJack Palevich    glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats);
199be509c9c7de5929d014dfe6d45e71cc8454ede0fJack Palevich    return numCompressedTextureFormats;
200be509c9c7de5929d014dfe6d45e71cc8454ede0fJack Palevich}
201be509c9c7de5929d014dfe6d45e71cc8454ede0fJack Palevich
2028a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich// Check if the extension at the head of pExtensions is pExtension. Note that pExtensions is
2038a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich// terminated by either 0 or space, while pExtension is terminated by 0.
2048a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich
2058a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevichstatic bool
2068a4de4be9ed522c704a45a44a265669e10a8f2ebJack PalevichextensionEqual(const GLubyte* pExtensions, const GLubyte* pExtension) {
2078a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich    while (true) {
2088a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich        char a = *pExtensions++;
2098a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich        char b = *pExtension++;
2108a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich        bool aEnd = a == '\0' || a == ' ';
2118a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich        bool bEnd = b == '\0';
2128a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich        if ( aEnd || bEnd) {
2138a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich            return aEnd == bEnd;
2148a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich        }
2158a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich        if ( a != b ) {
2168a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich            return false;
2178a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich        }
2188a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich    }
2198a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich}
2208a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich
2218a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevichstatic const GLubyte*
2228a4de4be9ed522c704a45a44a265669e10a8f2ebJack PalevichnextExtension(const GLubyte* pExtensions) {
2238a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich    while (true) {
2248a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich        char a = *pExtensions++;
2258a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich        if ( a == '\0') {
2268a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich            return pExtensions-1;
2278a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich        } else if ( a == ' ') {
2288a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich            return pExtensions;
2298a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich        }
2308a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich    }
2318a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich}
23224ce5fb2cc09d0a14406e7b935f8648c5720d27eElliott Hughes
2338a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevichstatic bool
2348a4de4be9ed522c704a45a44a265669e10a8f2ebJack PalevichcheckForExtension(const GLubyte* pExtensions, const GLubyte* pExtension) {
2358a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich    for (;*pExtensions != '\0'; pExtensions = nextExtension(pExtensions)) {
2368a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich        if (extensionEqual(pExtensions, pExtension)) {
2378a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich            return true;
2388a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich        }
2398a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich    }
2408a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich    return false;
2418a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich}
2428a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich
2438a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevichstatic bool
2448a4de4be9ed522c704a45a44a265669e10a8f2ebJack PalevichsupportsExtension(JNIEnv *_env, jobject impl, jfieldID fieldId) {
2458a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich    if (!_env->GetBooleanField(impl, haveCheckedExtensionsID)) {
2468a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich        _env->SetBooleanField(impl, haveCheckedExtensionsID, true);
2478a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich        const GLubyte* sExtensions = glGetString(GL_EXTENSIONS);
2488a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich        _env->SetBooleanField(impl, have_OES_blend_equation_separateID,
2498a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich            checkForExtension(sExtensions, (const GLubyte*) "GL_OES_blend_equation_separate"));
2508a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich        _env->SetBooleanField(impl, have_OES_blend_subtractID,
2518a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich            checkForExtension(sExtensions, (const GLubyte*) "GL_OES_blend_subtract"));
2528a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich        _env->SetBooleanField(impl, have_OES_framebuffer_objectID,
2538a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich            checkForExtension(sExtensions, (const GLubyte*) "GL_OES_framebuffer_object"));
2548a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich        _env->SetBooleanField(impl, have_OES_texture_cube_mapID,
2558a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich            checkForExtension(sExtensions, (const GLubyte*) "GL_OES_texture_cube_map"));
2568a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich    }
2578a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich    return _env->GetBooleanField(impl, fieldId);
2588a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich}
2598a4de4be9ed522c704a45a44a265669e10a8f2ebJack Palevich
2609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// --------------------------------------------------------------------------
2619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glActiveTexture ( GLenum texture ) */
2629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
2639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glActiveTexture__I
2649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint texture) {
2659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glActiveTexture(
2669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)texture
2679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
2689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
2699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
2709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glAlphaFunc ( GLenum func, GLclampf ref ) */
2719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
2729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glAlphaFunc__IF
2739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint func, jfloat ref) {
2749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glAlphaFunc(
2759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)func,
2769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLclampf)ref
2779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
2789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
2799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
2809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glAlphaFuncx ( GLenum func, GLclampx ref ) */
2819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
2829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glAlphaFuncx__II
2839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint func, jint ref) {
2849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glAlphaFuncx(
2859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)func,
2869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLclampx)ref
2879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
2889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
2899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
2909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glBindTexture ( GLenum target, GLuint texture ) */
2919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
2929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glBindTexture__II
2939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint target, jint texture) {
2949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glBindTexture(
2959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)target,
2969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLuint)texture
2979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
2989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
2999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */
3019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
3029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glBlendFunc__II
3039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) {
3049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glBlendFunc(
3059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)sfactor,
3069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)dfactor
3079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
3089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
3099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glClear ( GLbitfield mask ) */
3119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
3129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glClear__I
3139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint mask) {
3149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glClear(
3159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLbitfield)mask
3169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
3179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
3189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
3209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
3219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glClearColor__FFFF
3229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
3239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glClearColor(
3249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLclampf)red,
3259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLclampf)green,
3269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLclampf)blue,
3279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLclampf)alpha
3289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
3299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
3309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glClearColorx ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha ) */
3329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
3339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glClearColorx__IIII
3349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) {
3359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glClearColorx(
3369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLclampx)red,
3379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLclampx)green,
3389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLclampx)blue,
3399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLclampx)alpha
3409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
3419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
3429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glClearDepthf ( GLclampf depth ) */
3449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
3459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glClearDepthf__F
3469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jfloat depth) {
3479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glClearDepthf(
3489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLclampf)depth
3499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
3509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
3519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glClearDepthx ( GLclampx depth ) */
3539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
3549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glClearDepthx__I
3559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint depth) {
3569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glClearDepthx(
3579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLclampx)depth
3589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
3599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
3609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glClearStencil ( GLint s ) */
3629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
3639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glClearStencil__I
3649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint s) {
3659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glClearStencil(
3669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLint)s
3679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
3689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
3699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glClientActiveTexture ( GLenum texture ) */
3719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
3729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glClientActiveTexture__I
3739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint texture) {
3749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glClientActiveTexture(
3759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)texture
3769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
3779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
3789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) */
3809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
3819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glColor4f__FFFF
3829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
3839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glColor4f(
3849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLfloat)red,
3859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLfloat)green,
3869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLfloat)blue,
3879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLfloat)alpha
3889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
3899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
3909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glColor4x ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha ) */
3929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
3939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glColor4x__IIII
3949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) {
3959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glColor4x(
3969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLfixed)red,
3979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLfixed)green,
3989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLfixed)blue,
3999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLfixed)alpha
4009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
4019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
4029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */
4049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
4059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glColorMask__ZZZZ
4069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) {
4079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glColorMask(
4089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLboolean)red,
4099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLboolean)green,
4109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLboolean)blue,
4119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLboolean)alpha
4129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
4139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
4149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
4169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
4179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glColorPointerBounds__IIILjava_nio_Buffer_2I
4189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
4199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jarray _array = (jarray) 0;
42017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jint _remaining;
4229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    GLvoid *pointer = (GLvoid *) 0;
4239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
424e20ea783a12f1031482c3aa01938efe39dcbf0a2Jack Palevich    if (pointer_buf) {
42516e7972f0d986eebf846ea8feb50f4435a9c6970Jack Palevich        pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
426e20ea783a12f1031482c3aa01938efe39dcbf0a2Jack Palevich        if ( ! pointer ) {
427e20ea783a12f1031482c3aa01938efe39dcbf0a2Jack Palevich            return;
428e20ea783a12f1031482c3aa01938efe39dcbf0a2Jack Palevich        }
429e20ea783a12f1031482c3aa01938efe39dcbf0a2Jack Palevich    }
4309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glColorPointerBounds(
4319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLint)size,
4329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)type,
4339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLsizei)stride,
4349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLvoid *)pointer,
4359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLsizei)remaining
4369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
4379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
4389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */
4409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
4419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2
4429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) {
4439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jarray _array = (jarray) 0;
44417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jint _remaining;
4469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    GLvoid *data = (GLvoid *) 0;
4479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
44817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
44917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (data == NULL) {
45017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
45117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        data = (GLvoid *) (_dataBase + _bufferOffset);
45217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glCompressedTexImage2D(
4549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)target,
4559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLint)level,
4569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)internalformat,
4579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLsizei)width,
4589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLsizei)height,
4599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLint)border,
4609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLsizei)imageSize,
4619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLvoid *)data
4629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
4639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (_array) {
4649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        releasePointer(_env, _array, data, JNI_FALSE);
4659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
4669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
4679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */
4699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
4709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
4719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) {
4729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jarray _array = (jarray) 0;
47317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
4749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jint _remaining;
4759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    GLvoid *data = (GLvoid *) 0;
4769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
47717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
47817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (data == NULL) {
47917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
48017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        data = (GLvoid *) (_dataBase + _bufferOffset);
48117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
4829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glCompressedTexSubImage2D(
4839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)target,
4849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLint)level,
4859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLint)xoffset,
4869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLint)yoffset,
4879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLsizei)width,
4889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLsizei)height,
4899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)format,
4909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLsizei)imageSize,
4919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLvoid *)data
4929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
4939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (_array) {
4949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        releasePointer(_env, _array, data, JNI_FALSE);
4959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
4969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
4979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */
4999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
5009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glCopyTexImage2D__IIIIIIII
5019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) {
5029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glCopyTexImage2D(
5039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)target,
5049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLint)level,
5059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)internalformat,
5069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLint)x,
5079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLint)y,
5089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLsizei)width,
5099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLsizei)height,
5109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLint)border
5119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
5129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
5139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */
5159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
5169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glCopyTexSubImage2D__IIIIIIII
5179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) {
5189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glCopyTexSubImage2D(
5199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)target,
5209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLint)level,
5219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLint)xoffset,
5229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLint)yoffset,
5239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLint)x,
5249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLint)y,
5259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLsizei)width,
5269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLsizei)height
5279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
5289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
5299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glCullFace ( GLenum mode ) */
5319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
5329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glCullFace__I
5339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint mode) {
5349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glCullFace(
5359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)mode
5369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
5379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
5389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
5409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
5419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glDeleteTextures__I_3II
5429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
5432545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
54415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
54515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    GLuint *textures_base = (GLuint *) 0;
5479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jint _remaining;
5489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    GLuint *textures = (GLuint *) 0;
5499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (!textures_ref) {
5512545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
5522545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
5532545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "textures == null";
5549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        goto exit;
5559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
5569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (offset < 0) {
5572545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
5582545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
5592545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
5609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        goto exit;
5619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
5629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    _remaining = _env->GetArrayLength(textures_ref) - offset;
5639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (_remaining < n) {
5642545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
5652545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
5662545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < n < needed";
5679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        goto exit;
5689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
5699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    textures_base = (GLuint *)
5709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
5719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    textures = textures_base + offset;
5729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glDeleteTextures(
5749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLsizei)n,
5759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLuint *)textures
5769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
5779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectexit:
5799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (textures_base) {
5809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
5819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            JNI_ABORT);
5829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
5832545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
5842545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
5852545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
5869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
5879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
5899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
5909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glDeleteTextures__ILjava_nio_IntBuffer_2
5919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
5922545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
59315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
59415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
5959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jarray _array = (jarray) 0;
59617045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
5979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jint _remaining;
5989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    GLuint *textures = (GLuint *) 0;
5999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
60017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset);
6019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (_remaining < n) {
6022545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
6032545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
6042545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < n < needed";
6059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        goto exit;
6069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
60717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (textures == NULL) {
60817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
60917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        textures = (GLuint *) (_texturesBase + _bufferOffset);
61017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
6119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glDeleteTextures(
6129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLsizei)n,
6139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLuint *)textures
6149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
6159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectexit:
6179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (_array) {
6189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        releasePointer(_env, _array, textures, JNI_FALSE);
6199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
6202545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
6212545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
6222545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
6239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
6249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glDepthFunc ( GLenum func ) */
6269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
6279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glDepthFunc__I
6289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint func) {
6299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glDepthFunc(
6309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)func
6319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
6329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
6339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glDepthMask ( GLboolean flag ) */
6359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
6369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glDepthMask__Z
6379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jboolean flag) {
6389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glDepthMask(
6399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLboolean)flag
6409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
6419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
6429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */
6449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
6459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glDepthRangef__FF
6469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) {
6479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glDepthRangef(
6489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLclampf)zNear,
6499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLclampf)zFar
6509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
6519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
6529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glDepthRangex ( GLclampx zNear, GLclampx zFar ) */
6549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
6559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glDepthRangex__II
6569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint zNear, jint zFar) {
6579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glDepthRangex(
6589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLclampx)zNear,
6599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLclampx)zFar
6609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
6619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
6629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glDisable ( GLenum cap ) */
6649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
6659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glDisable__I
6669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint cap) {
6679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glDisable(
6689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)cap
6699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
6709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
6719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glDisableClientState ( GLenum array ) */
6739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
6749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glDisableClientState__I
6759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint array) {
6769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glDisableClientState(
6779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)array
6789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
6799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
6809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */
6829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
6839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glDrawArrays__III
6849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) {
6859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glDrawArrays(
6869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)mode,
6879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLint)first,
6889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLsizei)count
6899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
6909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
6919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */
6939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
6949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glDrawElements__IIILjava_nio_Buffer_2
6959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) {
6962545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
69715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
69815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
6999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jarray _array = (jarray) 0;
70017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
7019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jint _remaining;
7029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    GLvoid *indices = (GLvoid *) 0;
7039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
70417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining, &_bufferOffset);
7059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (_remaining < count) {
7062545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
7072545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
7082545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < count < needed";
7099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        goto exit;
7109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
71117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (indices == NULL) {
71217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
71317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        indices = (GLvoid *) (_indicesBase + _bufferOffset);
71417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
7159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glDrawElements(
7169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)mode,
7179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLsizei)count,
7189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)type,
7199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLvoid *)indices
7209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
7219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectexit:
7239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (_array) {
7249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        releasePointer(_env, _array, indices, JNI_FALSE);
7259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
7262545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
7272545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
7282545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
7299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
7309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glEnable ( GLenum cap ) */
7329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
7339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glEnable__I
7349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint cap) {
7359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glEnable(
7369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)cap
7379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
7389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
7399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glEnableClientState ( GLenum array ) */
7419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
7429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glEnableClientState__I
7439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint array) {
7449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glEnableClientState(
7459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)array
7469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
7479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
7489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glFinish ( void ) */
7509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
7519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glFinish__
7529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this) {
7539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glFinish();
7549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
7559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glFlush ( void ) */
7579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
7589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glFlush__
7599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this) {
7609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glFlush();
7619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
7629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glFogf ( GLenum pname, GLfloat param ) */
7649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
7659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glFogf__IF
7669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint pname, jfloat param) {
7679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glFogf(
7689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)pname,
7699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLfloat)param
7709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
7719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
7729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glFogfv ( GLenum pname, const GLfloat *params ) */
7749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
7759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glFogfv__I_3FI
7769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
7772545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
77815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
77915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
7809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    GLfloat *params_base = (GLfloat *) 0;
7819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jint _remaining;
7829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    GLfloat *params = (GLfloat *) 0;
7839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (!params_ref) {
7852545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
7862545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
7872545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
7889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        goto exit;
7899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
7909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (offset < 0) {
7912545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
7922545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
7932545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
7949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        goto exit;
7959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
7969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    _remaining = _env->GetArrayLength(params_ref) - offset;
7979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    int _needed;
7989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    switch (pname) {
7999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#if defined(GL_FOG_MODE)
8009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        case GL_FOG_MODE:
8019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#endif // defined(GL_FOG_MODE)
8029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#if defined(GL_FOG_DENSITY)
8039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        case GL_FOG_DENSITY:
8049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#endif // defined(GL_FOG_DENSITY)
8059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#if defined(GL_FOG_START)
8069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        case GL_FOG_START:
8079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#endif // defined(GL_FOG_START)
8089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#if defined(GL_FOG_END)
8099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        case GL_FOG_END:
8109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#endif // defined(GL_FOG_END)
8119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            _needed = 1;
8129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            break;
8139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#if defined(GL_FOG_COLOR)
8149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        case GL_FOG_COLOR:
8159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#endif // defined(GL_FOG_COLOR)
8169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            _needed = 4;
8179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            break;
8189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        default:
81915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            _needed = 1;
8209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            break;
8219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
8229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (_remaining < _needed) {
8232545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
8242545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
8252545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < needed";
8269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        goto exit;
8279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
8289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    params_base = (GLfloat *)
8299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
8309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    params = params_base + offset;
8319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
8329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glFogfv(
8339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)pname,
8349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLfloat *)params
8359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
8369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
8379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectexit:
8389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (params_base) {
8399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
8409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            JNI_ABORT);
8419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
8422545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
8432545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
8442545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
8459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
8469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
8479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glFogfv ( GLenum pname, const GLfloat *params ) */
8489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
8499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glFogfv__ILjava_nio_FloatBuffer_2
8509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
8512545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
85215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
85315284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
8549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jarray _array = (jarray) 0;
85517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
8569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jint _remaining;
8579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    GLfloat *params = (GLfloat *) 0;
8589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
85917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
8609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    int _needed;
8619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    switch (pname) {
8629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#if defined(GL_FOG_MODE)
8639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        case GL_FOG_MODE:
8649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#endif // defined(GL_FOG_MODE)
8659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#if defined(GL_FOG_DENSITY)
8669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        case GL_FOG_DENSITY:
8679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#endif // defined(GL_FOG_DENSITY)
8689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#if defined(GL_FOG_START)
8699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        case GL_FOG_START:
8709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#endif // defined(GL_FOG_START)
8719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#if defined(GL_FOG_END)
8729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        case GL_FOG_END:
8739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#endif // defined(GL_FOG_END)
8749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            _needed = 1;
8759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            break;
8769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#if defined(GL_FOG_COLOR)
8779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        case GL_FOG_COLOR:
8789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#endif // defined(GL_FOG_COLOR)
8799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            _needed = 4;
8809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            break;
8819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        default:
88215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            _needed = 1;
8839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            break;
8849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
8859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (_remaining < _needed) {
8862545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
8872545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
8882545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < needed";
8899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        goto exit;
8909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
89117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
89217045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
89317045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLfloat *) (_paramsBase + _bufferOffset);
89417045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
8959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glFogfv(
8969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)pname,
8979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLfloat *)params
8989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
8999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
9009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectexit:
9019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (_array) {
9029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        releasePointer(_env, _array, params, JNI_FALSE);
9039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
9042545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
9052545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
9062545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
9079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
9089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
9099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glFogx ( GLenum pname, GLfixed param ) */
9109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
9119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glFogx__II
9129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint pname, jint param) {
9139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glFogx(
9149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)pname,
9159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLfixed)param
9169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
9179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
9189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
9199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glFogxv ( GLenum pname, const GLfixed *params ) */
9209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
9219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glFogxv__I_3II
9229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
9232545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
92415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
92515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
9269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    GLfixed *params_base = (GLfixed *) 0;
9279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jint _remaining;
9289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    GLfixed *params = (GLfixed *) 0;
9299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
9309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (!params_ref) {
9312545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
9322545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
9332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "params == null";
9349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        goto exit;
9359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
9369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (offset < 0) {
9372545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
9382545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
9392545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "offset < 0";
9409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        goto exit;
9419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
9429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    _remaining = _env->GetArrayLength(params_ref) - offset;
9439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    int _needed;
9449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    switch (pname) {
9459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#if defined(GL_FOG_MODE)
9469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        case GL_FOG_MODE:
9479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#endif // defined(GL_FOG_MODE)
9489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#if defined(GL_FOG_DENSITY)
9499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        case GL_FOG_DENSITY:
9509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#endif // defined(GL_FOG_DENSITY)
9519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#if defined(GL_FOG_START)
9529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        case GL_FOG_START:
9539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#endif // defined(GL_FOG_START)
9549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#if defined(GL_FOG_END)
9559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        case GL_FOG_END:
9569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#endif // defined(GL_FOG_END)
9579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            _needed = 1;
9589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            break;
9599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#if defined(GL_FOG_COLOR)
9609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        case GL_FOG_COLOR:
9619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#endif // defined(GL_FOG_COLOR)
9629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            _needed = 4;
9639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            break;
9649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        default:
96515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            _needed = 1;
9669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            break;
9679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
9689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (_remaining < _needed) {
9692545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
9702545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
9712545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "length - offset < needed";
9729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        goto exit;
9739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
9749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    params_base = (GLfixed *)
9759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
9769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    params = params_base + offset;
9779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
9789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glFogxv(
9799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)pname,
9809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLfixed *)params
9819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
9829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
9839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectexit:
9849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (params_base) {
9859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
9869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            JNI_ABORT);
9879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
9882545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
9892545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
9902545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
9919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
9929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
9939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glFogxv ( GLenum pname, const GLfixed *params ) */
9949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
9959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glFogxv__ILjava_nio_IntBuffer_2
9969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
9972545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    jint _exception = 0;
99815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionType = NULL;
99915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian    const char * _exceptionMessage = NULL;
10009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jarray _array = (jarray) 0;
100117045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    jint _bufferOffset = (jint) 0;
10029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    jint _remaining;
10039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    GLfixed *params = (GLfixed *) 0;
10049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
100517045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
10069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    int _needed;
10079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    switch (pname) {
10089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#if defined(GL_FOG_MODE)
10099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        case GL_FOG_MODE:
10109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#endif // defined(GL_FOG_MODE)
10119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#if defined(GL_FOG_DENSITY)
10129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        case GL_FOG_DENSITY:
10139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#endif // defined(GL_FOG_DENSITY)
10149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#if defined(GL_FOG_START)
10159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        case GL_FOG_START:
10169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#endif // defined(GL_FOG_START)
10179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#if defined(GL_FOG_END)
10189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        case GL_FOG_END:
10199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#endif // defined(GL_FOG_END)
10209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            _needed = 1;
10219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            break;
10229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#if defined(GL_FOG_COLOR)
10239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        case GL_FOG_COLOR:
10249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#endif // defined(GL_FOG_COLOR)
10259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            _needed = 4;
10269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            break;
10279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        default:
102815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian            _needed = 1;
10299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            break;
10309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
10319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (_remaining < _needed) {
10322545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exception = 1;
10332545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionType = "java/lang/IllegalArgumentException";
10342545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        _exceptionMessage = "remaining() < needed";
10359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        goto exit;
10369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
103717045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    if (params == NULL) {
103817045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
103917045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer        params = (GLfixed *) (_paramsBase + _bufferOffset);
104017045a16575ece34cfadb63da4791f115625df78Thomas Tafertshofer    }
10419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glFogxv(
10429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)pname,
10439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLfixed *)params
10449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
10459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
10469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectexit:
10479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (_array) {
10489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        releasePointer(_env, _array, params, JNI_FALSE);
10499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
10502545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    if (_exception) {
10512545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer        jniThrowException(_env, _exceptionType, _exceptionMessage);
10522545b32ced69100fe70685b95315c6adf411083bThomas Tafertshofer    }
10539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
10549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
10559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glFrontFace ( GLenum mode ) */
10569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
10579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glFrontFace__I
10589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jint mode) {
10599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glFrontFace(
10609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLenum)mode
10619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
10629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
10639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
10649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glFrustumf ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */
10659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
10669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glFrustumf__FFFFFF
10679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project  (JNIEnv *_env, jobject _this, jfloat left, jfloat right, jfloat bottom, jfloat top, jfloat zNear, jfloat zFar) {
10689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    glFrustumf(
10699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLfloat)left,
10709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLfloat)right,
10719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLfloat)bottom,
10729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLfloat)top,
10739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLfloat)zNear,
10749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        (GLfloat)zFar
10759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    );
10769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
10779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
10789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* void glFrustumx ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) */
10799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic void
10809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectandroid_glFrustumx__IIIIII
1081