diff options
author | Jean-Baptiste Queru <jbq@google.com> | 2009-05-20 11:28:04 -0700 |
---|---|---|
committer | Jean-Baptiste Queru <jbq@google.com> | 2009-05-20 11:28:04 -0700 |
commit | 843ef36f7b96cc19ea7d2996b7c8661b41ec3452 (patch) | |
tree | 560e1648c99a93986f8b7deef851ef8bb8029db7 /core/jni | |
parent | 358d23017d0d6c4636eb7599ae7a9b48108899a3 (diff) | |
download | frameworks_base-843ef36f7b96cc19ea7d2996b7c8661b41ec3452.zip frameworks_base-843ef36f7b96cc19ea7d2996b7c8661b41ec3452.tar.gz frameworks_base-843ef36f7b96cc19ea7d2996b7c8661b41ec3452.tar.bz2 |
donut snapshot
Diffstat (limited to 'core/jni')
23 files changed, 9852 insertions, 312 deletions
diff --git a/core/jni/Android.mk b/core/jni/Android.mk index 18f2878..4839b6f 100644 --- a/core/jni/Android.mk +++ b/core/jni/Android.mk @@ -21,6 +21,10 @@ LOCAL_SRC_FILES:= \ CursorWindow.cpp \ com_google_android_gles_jni_EGLImpl.cpp \ com_google_android_gles_jni_GLImpl.cpp.arm \ + android_opengl_GLES10.cpp \ + android_opengl_GLES10Ext.cpp \ + android_opengl_GLES11.cpp \ + android_opengl_GLES11Ext.cpp \ android_database_CursorWindow.cpp \ android_database_SQLiteDebug.cpp \ android_database_SQLiteDatabase.cpp \ @@ -112,7 +116,8 @@ LOCAL_SRC_FILES:= \ android_ddm_DdmHandleNativeHeap.cpp \ android_location_GpsLocationProvider.cpp \ com_android_internal_os_ZygoteInit.cpp \ - com_android_internal_graphics_NativeUtils.cpp + com_android_internal_graphics_NativeUtils.cpp \ + android_backup_FileBackupHelper.cpp LOCAL_C_INCLUDES += \ $(JNI_H_INCLUDE) \ @@ -125,6 +130,7 @@ LOCAL_C_INCLUDES += \ external/skia/include/core \ external/skia/include/effects \ external/skia/include/images \ + external/skia/src/ports \ external/skia/include/utils \ external/sqlite/dist \ external/sqlite/android \ diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index f4643f4..aa6450d 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -30,6 +30,7 @@ #include <SkGraphics.h> #include <SkImageDecoder.h> +#include <SkImageRef_GlobalPool.h> #include "jni.h" #include "JNIHelp.h" @@ -66,6 +67,10 @@ extern int register_android_graphics_Typeface(JNIEnv* env); extern int register_com_google_android_gles_jni_EGLImpl(JNIEnv* env); extern int register_com_google_android_gles_jni_GLImpl(JNIEnv* env); +extern int register_android_opengl_jni_GLES10(JNIEnv* env); +extern int register_android_opengl_jni_GLES10Ext(JNIEnv* env); +extern int register_android_opengl_jni_GLES11(JNIEnv* env); +extern int register_android_opengl_jni_GLES11Ext(JNIEnv* env); extern int register_android_hardware_Camera(JNIEnv *env); @@ -150,6 +155,7 @@ extern int register_android_ddm_DdmHandleNativeHeap(JNIEnv *env); extern int register_com_android_internal_os_ZygoteInit(JNIEnv* env); extern int register_android_util_Base64(JNIEnv* env); extern int register_android_location_GpsLocationProvider(JNIEnv* env); +extern int register_android_backup_FileBackupHelper(JNIEnv *env); static AndroidRuntime* gCurRuntime = NULL; @@ -224,6 +230,13 @@ AndroidRuntime::AndroidRuntime() // this sets our preference for 16bit images during decode // in case the src is opaque and 24bit SkImageDecoder::SetDeviceConfig(SkBitmap::kRGB_565_Config); + // This cache is shared between browser native images, and java "purgeable" + // bitmaps. This globalpool is for images that do not either use the java + // heap, or are not backed by ashmem. See BitmapFactory.cpp for the key + // java call site. + SkImageRef_GlobalPool::SetRAMBudget(512 * 1024); + // There is also a global font cache, but its budget is specified in code + // see SkFontHost_android.cpp // Pre-allocate enough space to hold a fair number of options. mOptions.setCapacity(20); @@ -1042,6 +1055,10 @@ static const RegJNIRec gRegJNI[] = { REG_JNI(register_android_view_ViewRoot), REG_JNI(register_com_google_android_gles_jni_EGLImpl), REG_JNI(register_com_google_android_gles_jni_GLImpl), + REG_JNI(register_android_opengl_jni_GLES10), + REG_JNI(register_android_opengl_jni_GLES10Ext), + REG_JNI(register_android_opengl_jni_GLES11), + REG_JNI(register_android_opengl_jni_GLES11Ext), REG_JNI(register_android_graphics_Bitmap), REG_JNI(register_android_graphics_BitmapFactory), @@ -1109,6 +1126,7 @@ static const RegJNIRec gRegJNI[] = { REG_JNI(register_android_ddm_DdmHandleNativeHeap), REG_JNI(register_android_util_Base64), REG_JNI(register_android_location_GpsLocationProvider), + REG_JNI(register_android_backup_FileBackupHelper), }; /* diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp index 332b01c..1fd15d6 100644 --- a/core/jni/android/graphics/BitmapFactory.cpp +++ b/core/jni/android/graphics/BitmapFactory.cpp @@ -1,6 +1,8 @@ #define LOG_TAG "BitmapFactory" #include "SkImageDecoder.h" +#include "SkImageRef_ashmem.h" +#include "SkImageRef_GlobalPool.h" #include "SkPixelRef.h" #include "SkStream.h" #include "GraphicsJNI.h" @@ -19,9 +21,12 @@ static jfieldID gOptions_justBoundsFieldID; static jfieldID gOptions_sampleSizeFieldID; static jfieldID gOptions_configFieldID; static jfieldID gOptions_ditherFieldID; +static jfieldID gOptions_purgeableFieldID; +static jfieldID gOptions_shareableFieldID; static jfieldID gOptions_widthFieldID; static jfieldID gOptions_heightFieldID; static jfieldID gOptions_mimeFieldID; +static jfieldID gOptions_mCancelID; static jclass gFileDescriptor_class; static jfieldID gFileDescriptor_descriptor; @@ -32,8 +37,6 @@ static jfieldID gFileDescriptor_descriptor; #define TRACE_BITMAP(code) #endif -//#define MIN_SIZE_TO_USE_MMAP (4*1024) - /////////////////////////////////////////////////////////////////////////////// class AutoDecoderCancel { @@ -204,12 +207,16 @@ class AssetStreamAdaptor : public SkStream { public: AssetStreamAdaptor(Asset* a) : fAsset(a) {} - virtual bool rewind() { + virtual bool rewind() { off_t pos = fAsset->seek(0, SEEK_SET); - return pos != (off_t)-1; + if (pos == (off_t)-1) { + SkDebugf("----- fAsset->seek(rewind) failed\n"); + return false; + } + return true; } - virtual size_t read(void* buffer, size_t size) { + virtual size_t read(void* buffer, size_t size) { ssize_t amount; if (NULL == buffer) { @@ -221,15 +228,20 @@ public: off_t oldOffset = fAsset->seek(0, SEEK_CUR); if (-1 == oldOffset) { + SkDebugf("---- fAsset->seek(oldOffset) failed\n"); return 0; } off_t newOffset = fAsset->seek(size, SEEK_CUR); if (-1 == newOffset) { + SkDebugf("---- fAsset->seek(%d) failed\n", size); return 0; } amount = newOffset - oldOffset; } else { amount = fAsset->read(buffer, size); + if (amount <= 0) { + SkDebugf("---- fAsset->read(%d) returned %d\n", size, amount); + } } if (amount < 0) { @@ -278,13 +290,46 @@ static jstring getMimeTypeString(JNIEnv* env, SkImageDecoder::Format format) { return jstr; } -static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding, - jobject options) { +static bool optionsPurgeable(JNIEnv* env, jobject options) { + return options != NULL && + env->GetBooleanField(options, gOptions_purgeableFieldID); +} + +static bool optionsShareable(JNIEnv* env, jobject options) { + return options != NULL && + env->GetBooleanField(options, gOptions_shareableFieldID); +} + +static jobject nullObjectReturn(const char msg[]) { + if (msg) { + SkDebugf("--- %s\n", msg); + } + return NULL; +} + +static SkPixelRef* installPixelRef(SkBitmap* bitmap, SkStream* stream, + int sampleSize) { + SkPixelRef* pr; + // only use ashmem for large images, since mmaps come at a price + if (bitmap->getSize() >= 32 * 65536) { + pr = new SkImageRef_ashmem(stream, bitmap->config(), sampleSize); + } else { + pr = new SkImageRef_GlobalPool(stream, bitmap->config(), sampleSize); + } + bitmap->setPixelRef(pr)->unref(); + return pr; +} +// since we "may" create a purgeable imageref, we require the stream be ref'able +// i.e. dynamically allocated, since its lifetime may exceed the current stack +// frame. +static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding, + jobject options, bool allowPurgeable) { int sampleSize = 1; SkImageDecoder::Mode mode = SkImageDecoder::kDecodePixels_Mode; SkBitmap::Config prefConfig = SkBitmap::kNo_Config; bool doDither = true; + bool isPurgeable = allowPurgeable && optionsPurgeable(env, options); if (NULL != options) { sampleSize = env->GetIntField(options, gOptions_sampleSizeFieldID); @@ -303,14 +348,14 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding, SkImageDecoder* decoder = SkImageDecoder::Factory(stream); if (NULL == decoder) { - return NULL; + return nullObjectReturn("SkImageDecoder::Factory returned null"); } decoder->setSampleSize(sampleSize); decoder->setDitherImage(doDither); NinePatchPeeker peeker; - JavaPixelAllocator allocator(env); + JavaPixelAllocator javaAllocator(env); SkBitmap* bitmap = new SkBitmap; Res_png_9patch dummy9Patch; @@ -318,14 +363,27 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding, SkAutoTDelete<SkBitmap> adb(bitmap); decoder->setPeeker(&peeker); - decoder->setAllocator(&allocator); - + if (!isPurgeable) { + decoder->setAllocator(&javaAllocator); + } + AutoDecoderCancel adc(options, decoder); - if (!decoder->decode(stream, bitmap, prefConfig, mode)) { - return NULL; + // To fix the race condition in case "requestCancelDecode" + // happens earlier than AutoDecoderCancel object is added + // to the gAutoDecoderCancelMutex linked list. + if (NULL != options && env->GetBooleanField(options, gOptions_mCancelID)) { + return nullObjectReturn("gOptions_mCancelID");; } - + + SkImageDecoder::Mode decodeMode = mode; + if (isPurgeable) { + decodeMode = SkImageDecoder::kDecodeBounds_Mode; + } + if (!decoder->decode(stream, bitmap, prefConfig, decodeMode)) { + return nullObjectReturn("decoder->decode returned false"); + } + // update options (if any) if (NULL != options) { env->SetIntField(options, gOptions_widthFieldID, bitmap->width()); @@ -336,7 +394,7 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding, env->SetObjectField(options, gOptions_mimeFieldID, getMimeTypeString(env, decoder->getFormat())); } - + // if we're in justBounds mode, return now (skip the java bitmap) if (SkImageDecoder::kDecodeBounds_Mode == mode) { return NULL; @@ -347,12 +405,12 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding, size_t ninePatchArraySize = peeker.fPatch->serializedSize(); ninePatchChunk = env->NewByteArray(ninePatchArraySize); if (NULL == ninePatchChunk) { - return NULL; + return nullObjectReturn("ninePatchChunk == null"); } jbyte* array = (jbyte*)env->GetPrimitiveArrayCritical(ninePatchChunk, NULL); if (NULL == array) { - return NULL; + return nullObjectReturn("primitive array == null"); } peeker.fPatch->serialize(array); env->ReleasePrimitiveArrayCritical(ninePatchChunk, array, 0); @@ -372,12 +430,18 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding, GraphicsJNI::set_jrect(env, padding, -1, -1, -1, -1); } } - - // promise we will never change our pixels (great for sharing and pictures) - SkPixelRef* ref = bitmap->pixelRef(); - SkASSERT(ref); - ref->setImmutable(); + SkPixelRef* pr; + if (isPurgeable) { + pr = installPixelRef(bitmap, stream, sampleSize); + } else { + // if we get here, we're in kDecodePixels_Mode and will therefore + // already have a pixelref installed. + pr = bitmap->pixelRef(); + } + // promise we will never change our pixels (great for sharing and pictures) + pr->setImmutable(); + // now create the java bitmap return GraphicsJNI::createBitmap(env, bitmap, false, ninePatchChunk); } @@ -390,7 +454,8 @@ static jobject nativeDecodeStream(JNIEnv* env, jobject clazz, SkStream* stream = CreateJavaInputStreamAdaptor(env, is, storage); if (stream) { - bitmap = doDecode(env, stream, padding, options); + // for now we don't allow purgeable with java inputstreams + bitmap = doDecode(env, stream, padding, options, false); stream->unref(); } return bitmap; @@ -431,52 +496,96 @@ static jobject nativeDecodeFileDescriptor(JNIEnv* env, jobject clazz, jint descriptor = env->GetIntField(fileDescriptor, gFileDescriptor_descriptor); - -#ifdef MIN_SIZE_TO_USE_MMAP - // First try to use mmap - size_t size = getFDSize(descriptor); - if (size >= MIN_SIZE_TO_USE_MMAP) { - void* addr = mmap(NULL, size, PROT_READ, MAP_PRIVATE, descriptor, 0); -// SkDebugf("-------- mmap returned %p %d\n", addr, size); - if (MAP_FAILED != addr) { - SkMemoryStream strm(addr, size); - jobject obj = doDecode(env, &strm, padding, bitmapFactoryOptions); - munmap(addr, size); - return obj; + + bool isPurgeable = optionsPurgeable(env, bitmapFactoryOptions); + bool isShareable = optionsShareable(env, bitmapFactoryOptions); + bool weOwnTheFD = false; + if (isPurgeable && isShareable) { + int newFD = ::dup(descriptor); + if (-1 != newFD) { + weOwnTheFD = true; + descriptor = newFD; } } -#endif - // we pass false for closeWhenDone, since the caller owns the descriptor - SkFDStream file(descriptor, false); - if (!file.isValid()) { + SkFDStream* stream = new SkFDStream(descriptor, weOwnTheFD); + SkAutoUnref aur(stream); + if (!stream->isValid()) { return NULL; } - - /* Restore our offset when we leave, so the caller doesn't have to. - This is a real feature, so we can be called more than once with the - same descriptor. + + /* Restore our offset when we leave, so we can be called more than once + with the same descriptor. This is only required if we didn't dup the + file descriptor, but it is OK to do it all the time. */ AutoFDSeek as(descriptor); - return doDecode(env, &file, padding, bitmapFactoryOptions); + return doDecode(env, stream, padding, bitmapFactoryOptions, true); +} + +/* make a deep copy of the asset, and return it as a stream, or NULL if there + was an error. + */ +static SkStream* copyAssetToStream(Asset* asset) { + // if we could "ref/reopen" the asset, we may not need to copy it here + off_t size = asset->seek(0, SEEK_SET); + if ((off_t)-1 == size) { + SkDebugf("---- copyAsset: asset rewind failed\n"); + return NULL; + } + + size = asset->getLength(); + if (size <= 0) { + SkDebugf("---- copyAsset: asset->getLength() returned %d\n", size); + return NULL; + } + + SkStream* stream = new SkMemoryStream(size); + void* data = const_cast<void*>(stream->getMemoryBase()); + off_t len = asset->read(data, size); + if (len != size) { + SkDebugf("---- copyAsset: asset->read(%d) returned %d\n", size, len); + delete stream; + stream = NULL; + } + return stream; } static jobject nativeDecodeAsset(JNIEnv* env, jobject clazz, jint native_asset, // Asset jobject padding, // Rect jobject options) { // BitmapFactory$Options - AssetStreamAdaptor mystream((Asset*)native_asset); - - return doDecode(env, &mystream, padding, options); + SkStream* stream; + Asset* asset = reinterpret_cast<Asset*>(native_asset); + + if (optionsPurgeable(env, options)) { + // if we could "ref/reopen" the asset, we may not need to copy it here + // and we could assume optionsShareable, since assets are always RO + stream = copyAssetToStream(asset); + if (NULL == stream) { + return NULL; + } + } else { + // since we know we'll be done with the asset when we return, we can + // just use a simple wrapper + stream = new AssetStreamAdaptor(asset); + } + SkAutoUnref aur(stream); + return doDecode(env, stream, padding, options, true); } static jobject nativeDecodeByteArray(JNIEnv* env, jobject, jbyteArray byteArray, int offset, int length, jobject options) { - AutoJavaByteArray ar(env, byteArray); - SkMemoryStream stream(ar.ptr() + offset, length); - - return doDecode(env, &stream, NULL, options); + /* If optionsShareable() we could decide to just wrap the java array and + share it, but that means adding a globalref to the java array object + and managing its lifetime. For now we just always copy the array's data + if optionsPurgeable(). + */ + AutoJavaByteArray ar(env, byteArray); + SkStream* stream = new SkMemoryStream(ar.ptr() + offset, length, + optionsPurgeable(env, options)); + SkAutoUnref aur(stream); + return doDecode(env, stream, NULL, options, true); } static void nativeRequestCancel(JNIEnv*, jobject joptions) { @@ -585,9 +694,12 @@ int register_android_graphics_BitmapFactory(JNIEnv* env) { gOptions_configFieldID = getFieldIDCheck(env, gOptions_class, "inPreferredConfig", "Landroid/graphics/Bitmap$Config;"); gOptions_ditherFieldID = getFieldIDCheck(env, gOptions_class, "inDither", "Z"); + gOptions_purgeableFieldID = getFieldIDCheck(env, gOptions_class, "inPurgeable", "Z"); + gOptions_shareableFieldID = getFieldIDCheck(env, gOptions_class, "inInputShareable", "Z"); gOptions_widthFieldID = getFieldIDCheck(env, gOptions_class, "outWidth", "I"); gOptions_heightFieldID = getFieldIDCheck(env, gOptions_class, "outHeight", "I"); gOptions_mimeFieldID = getFieldIDCheck(env, gOptions_class, "outMimeType", "Ljava/lang/String;"); + gOptions_mCancelID = getFieldIDCheck(env, gOptions_class, "mCancel", "Z"); gFileDescriptor_class = make_globalref(env, "java/io/FileDescriptor"); gFileDescriptor_descriptor = getFieldIDCheck(env, gFileDescriptor_class, "descriptor", "I"); diff --git a/core/jni/android/graphics/Canvas.cpp b/core/jni/android/graphics/Canvas.cpp index 605e4b8..93d68cb 100644 --- a/core/jni/android/graphics/Canvas.cpp +++ b/core/jni/android/graphics/Canvas.cpp @@ -21,6 +21,8 @@ #include "SkCanvas.h" #include "SkDevice.h" #include "SkGLCanvas.h" +#include "SkGraphics.h" +#include "SkImageRef_GlobalPool.h" #include "SkShader.h" #include "SkTemplates.h" @@ -58,8 +60,11 @@ public: return new SkGLCanvas; } - static void freeGlCaches(JNIEnv* env, jobject) { + static void freeCaches(JNIEnv* env, jobject) { + // these are called in no particular order SkGLCanvas::DeleteAllTextures(); + SkImageRef_GlobalPool::SetRAMUsed(0); + SkGraphics::SetFontCacheUsed(0); } static jboolean isOpaque(JNIEnv* env, jobject jcanvas) { @@ -717,8 +722,7 @@ public: jsize textCount = env->GetArrayLength(text); SkScalar x_ = SkFloatToScalar(x); SkScalar y_ = SkFloatToScalar(y); - textArray += index; - canvas->drawText(textArray, count << 1, x_, y_, *paint); + canvas->drawText(textArray + index, count << 1, x_, y_, *paint); env->ReleaseCharArrayElements(text, textArray, 0); } @@ -762,8 +766,7 @@ public: posPtr[indx].fX = SkFloatToScalar(posArray[indx << 1]); posPtr[indx].fY = SkFloatToScalar(posArray[(indx << 1) + 1]); } - textArray += index; - canvas->drawPosText(textArray, count << 1, posPtr, *paint); + canvas->drawPosText(textArray + index, count << 1, posPtr, *paint); if (text) { env->ReleaseCharArrayElements(text, textArray, 0); } @@ -933,7 +936,7 @@ static JNINativeMethod gCanvasMethods[] = { (void*) SkCanvasGlue::drawTextOnPath__StringPathFFPaint}, {"native_drawPicture", "(II)V", (void*) SkCanvasGlue::drawPicture}, - {"freeGlCaches", "()V", (void*) SkCanvasGlue::freeGlCaches} + {"freeCaches", "()V", (void*) SkCanvasGlue::freeCaches} }; #include <android_runtime/AndroidRuntime.h> diff --git a/core/jni/android/graphics/Region.cpp b/core/jni/android/graphics/Region.cpp index 00d6cd9..1dc0314 100644 --- a/core/jni/android/graphics/Region.cpp +++ b/core/jni/android/graphics/Region.cpp @@ -102,6 +102,36 @@ static void Region_translate(JNIEnv* env, jobject region, int x, int y, jobject rgn->translate(x, y); } +// Scale the rectangle by given scale and set the reuslt to the dst. +static void scale_rect(SkIRect* dst, const SkIRect& src, float scale) { + dst->fLeft = (int)::roundf(src.fLeft * scale); + dst->fTop = (int)::roundf(src.fTop * scale); + dst->fRight = (int)::roundf(src.fRight * scale); + dst->fBottom = (int)::roundf(src.fBottom * scale); +} + +// Scale the region by given scale and set the reuslt to the dst. +// dest and src can be the same region instance. +static void scale_rgn(SkRegion* dst, const SkRegion& src, float scale) { + SkRegion tmp; + SkRegion::Iterator iter(src); + + for (; !iter.done(); iter.next()) { + SkIRect r; + scale_rect(&r, iter.rect(), scale); + tmp.op(r, SkRegion::kUnion_Op); + } + dst->swap(tmp); +} + +static void Region_scale(JNIEnv* env, jobject region, jfloat scale, jobject dst) { + SkRegion* rgn = GetSkRegion(env, region); + if (dst) + scale_rgn(GetSkRegion(env, dst), *rgn, scale); + else + scale_rgn(rgn, *rgn, scale); +} + //////////////////////////////////////////////////////////////////////////////////////////////////////////// #include "Parcel.h" @@ -139,6 +169,13 @@ static jboolean Region_writeToParcel(JNIEnv* env, jobject clazz, const SkRegion* //////////////////////////////////////////////////////////////////////////////////////////////////////////// +static jboolean Region_equals(JNIEnv* env, jobject clazz, const SkRegion *r1, const SkRegion* r2) +{ + return (jboolean) (*r1 == *r2); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + struct RgnIterPair { SkRegion fRgn; // a copy of the caller's region SkRegion::Iterator fIter; // an iterator acting upon the copy (fRgn) @@ -206,10 +243,12 @@ static JNINativeMethod gRegionMethods[] = { { "quickContains", "(IIII)Z", (void*)Region_quickContains }, { "quickReject", "(IIII)Z", (void*)Region_quickRejectIIII }, { "quickReject", "(Landroid/graphics/Region;)Z", (void*)Region_quickRejectRgn }, + { "scale", "(FLandroid/graphics/Region;)V", (void*)Region_scale }, { "translate", "(IILandroid/graphics/Region;)V", (void*)Region_translate }, // parceling methods { "nativeCreateFromParcel", "(Landroid/os/Parcel;)I", (void*)Region_createFromParcel }, - { "nativeWriteToParcel", "(ILandroid/os/Parcel;)Z", (void*)Region_writeToParcel } + { "nativeWriteToParcel", "(ILandroid/os/Parcel;)Z", (void*)Region_writeToParcel }, + { "nativeEquals", "(II)Z", (void*)Region_equals }, }; int register_android_graphics_Region(JNIEnv* env); diff --git a/core/jni/android/graphics/Typeface.cpp b/core/jni/android/graphics/Typeface.cpp index e951431..21dde63 100644 --- a/core/jni/android/graphics/Typeface.cpp +++ b/core/jni/android/graphics/Typeface.cpp @@ -133,6 +133,14 @@ static SkTypeface* Typeface_createFromAsset(JNIEnv* env, jobject, return SkTypeface::CreateFromStream(new AssetStream(asset, true)); } +static SkTypeface* Typeface_createFromFile(JNIEnv* env, jobject, jstring jpath) { + NPE_CHECK_RETURN_ZERO(env, jpath); + + AutoJavaStringToUTF8 str(env, jpath); + + return SkTypeface::CreateFromFile(str.c_str()); +} + /////////////////////////////////////////////////////////////////////////////// static JNINativeMethod gTypefaceMethods[] = { @@ -140,9 +148,10 @@ static JNINativeMethod gTypefaceMethods[] = { { "nativeCreateFromTypeface", "(II)I", (void*)Typeface_createFromTypeface }, { "nativeUnref", "(I)V", (void*)Typeface_unref }, { "nativeGetStyle", "(I)I", (void*)Typeface_getStyle }, - { "nativeCreateFromAsset", - "(Landroid/content/res/AssetManager;Ljava/lang/String;)I", - (void*)Typeface_createFromAsset } + { "nativeCreateFromAsset", "(Landroid/content/res/AssetManager;Ljava/lang/String;)I", + (void*)Typeface_createFromAsset }, + { "nativeCreateFromFile", "(Ljava/lang/String;)I", + (void*)Typeface_createFromFile } }; int register_android_graphics_Typeface(JNIEnv* env); @@ -153,4 +162,3 @@ int register_android_graphics_Typeface(JNIEnv* env) gTypefaceMethods, SK_ARRAY_COUNT(gTypefaceMethods)); } - diff --git a/core/jni/android_backup_FileBackupHelper.cpp b/core/jni/android_backup_FileBackupHelper.cpp new file mode 100644 index 0000000..c6de3a5 --- /dev/null +++ b/core/jni/android_backup_FileBackupHelper.cpp @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define LOG_TAG "FileBackupHelper_native" +#include <utils/Log.h> + +#include "JNIHelp.h" +#include <android_runtime/AndroidRuntime.h> + +#include <utils/backup_helpers.h> + +namespace android +{ + +static jfieldID s_descriptorField = 0; + +static int +performBackup_native(JNIEnv* env, jobject clazz, jstring basePath, jobject oldState, jobject data, + jobject newState, jobjectArray files) +{ + int err; + + // all parameters have already been checked against null + LOGD("oldState=%p newState=%p data=%p\n", oldState, newState, data); + int oldStateFD = oldState != NULL ? env->GetIntField(oldState, s_descriptorField) : -1; + int newStateFD = env->GetIntField(newState, s_descriptorField); + int dataFD = env->GetIntField(data, s_descriptorField); + + char const* basePathUTF = env->GetStringUTFChars(basePath, NULL); + LOGD("basePathUTF=\"%s\"\n", basePathUTF); + const int fileCount = env->GetArrayLength(files); + char const** filesUTF = (char const**)malloc(sizeof(char*)*fileCount); + for (int i=0; i<fileCount; i++) { + filesUTF[i] = env->GetStringUTFChars((jstring)env->GetObjectArrayElement(files, i), NULL); + } + + err = back_up_files(oldStateFD, dataFD, newStateFD, basePathUTF, filesUTF, fileCount); + + for (int i=0; i<fileCount; i++) { + env->ReleaseStringUTFChars((jstring)env->GetObjectArrayElement(files, i), filesUTF[i]); + } + free(filesUTF); + env->ReleaseStringUTFChars(basePath, basePathUTF); + + return err; +} + +static const JNINativeMethod g_methods[] = { + { "performBackup_native", + "(Ljava/lang/String;Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;" + "Ljava/io/FileDescriptor;[Ljava/lang/String;)I", + (void*)performBackup_native }, +}; + +int register_android_backup_FileBackupHelper(JNIEnv* env) +{ + LOGD("register_android_backup_FileBackupHelper"); + + jclass clazz; + + clazz = env->FindClass("java/io/FileDescriptor"); + LOG_FATAL_IF(clazz == NULL, "Unable to find class java.io.FileDescriptor"); + s_descriptorField = env->GetFieldID(clazz, "descriptor", "I"); + LOG_FATAL_IF(s_descriptorField == NULL, + "Unable to find descriptor field in java.io.FileDescriptor"); + + return AndroidRuntime::registerNativeMethods(env, "android/backup/FileBackupHelper", + g_methods, NELEM(g_methods)); +} + +} diff --git a/core/jni/android_bluetooth_common.cpp b/core/jni/android_bluetooth_common.cpp index c81af1ce..0b8a604 100644 --- a/core/jni/android_bluetooth_common.cpp +++ b/core/jni/android_bluetooth_common.cpp @@ -46,8 +46,9 @@ jfieldID get_field(JNIEnv *env, jclass clazz, const char *member, } typedef struct { - void (*user_cb)(DBusMessage *, void *); + void (*user_cb)(DBusMessage *, void *, void *); void *user; + void *nat; JNIEnv *env; } dbus_async_call_t; @@ -63,7 +64,7 @@ void dbus_func_args_async_callback(DBusPendingCall *call, void *data) { if (msg) { if (req->user_cb) { // The user may not deref the message object. - req->user_cb(msg, req->user); + req->user_cb(msg, req->user, req->nat); } dbus_message_unref(msg); } @@ -74,11 +75,14 @@ void dbus_func_args_async_callback(DBusPendingCall *call, void *data) { free(req); } -dbus_bool_t dbus_func_args_async_valist(JNIEnv *env, +static dbus_bool_t dbus_func_args_async_valist(JNIEnv *env, DBusConnection *conn, int timeout_ms, - void (*user_cb)(DBusMessage *, void *), + void (*user_cb)(DBusMessage *, + void *, + void*), void *user, + void *nat, const char *path, const char *ifc, const char *func, @@ -111,6 +115,7 @@ dbus_bool_t dbus_func_args_async_valist(JNIEnv *env, pending->env = env; pending->user_cb = user_cb; pending->user = user; + pending->nat = nat; //pending->method = msg; reply = dbus_connection_send_with_reply(conn, msg, @@ -132,8 +137,9 @@ done: dbus_bool_t dbus_func_args_async(JNIEnv *env, DBusConnection *conn, int timeout_ms, - void (*reply)(DBusMessage *, void *), + void (*reply)(DBusMessage *, void *, void*), void *user, + void *nat, const char *path, const char *ifc, const char *func, @@ -144,7 +150,7 @@ dbus_bool_t dbus_func_args_async(JNIEnv *env, va_start(lst, first_arg_type); ret = dbus_func_args_async_valist(env, conn, timeout_ms, - reply, user, + reply, user, nat, path, ifc, func, first_arg_type, lst); va_end(lst); diff --git a/core/jni/android_bluetooth_common.h b/core/jni/android_bluetooth_common.h index c30ba22..69092dd 100644 --- a/core/jni/android_bluetooth_common.h +++ b/core/jni/android_bluetooth_common.h @@ -24,7 +24,9 @@ #include "utils/Log.h" #include <errno.h> +#include <pthread.h> #include <stdint.h> +#include <sys/poll.h> #ifdef HAVE_BLUETOOTH #include <dbus/dbus.h> @@ -45,6 +47,9 @@ namespace android { #define BTADDR_SIZE 18 // size of BT address character array (including null) +// size of the dbus event loops pollfd structure, hopefully never to be grown +#define DEFAULT_INITIAL_POLLFD_COUNT 8 + jfieldID get_field(JNIEnv *env, jclass clazz, const char *member, @@ -63,29 +68,33 @@ jfieldID get_field(JNIEnv *env, struct event_loop_native_data_t { DBusConnection *conn; - /* These variables are set in waitForAndDispatchEventNative() and are - valid only within the scope of this function. At any other time, they - are NULL. */ + + /* protects the thread */ + pthread_mutex_t thread_mutex; + pthread_t thread; + /* our comms socket */ + /* mem for the list of sockets to listen to */ + struct pollfd *pollData; + int pollMemberCount; + int pollDataSize; + /* mem for matching set of dbus watch ptrs */ + DBusWatch **watchData; + /* pair of sockets for event loop control, Reader and Writer */ + int controlFdR; + int controlFdW; + /* our vm and env Version for future env generation */ + JavaVM *vm; + int envVer; + /* reference to our java self */ jobject me; - JNIEnv *env; }; -dbus_bool_t dbus_func_args_async_valist(JNIEnv *env, - DBusConnection *conn, - int timeout_ms, - void (*reply)(DBusMessage *, void *), - void *user, - const char *path, - const char *ifc, - const char *func, - int first_arg_type, - va_list args); - dbus_bool_t dbus_func_args_async(JNIEnv *env, DBusConnection *conn, int timeout_ms, - void (*reply)(DBusMessage *, void *), + void (*reply)(DBusMessage *, void *, void *), void *user, + void *nat, const char *path, const char *ifc, const char *func, diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp index f6cd211..c107993 100644 --- a/core/jni/android_hardware_Camera.cpp +++ b/core/jni/android_hardware_Camera.cpp @@ -108,7 +108,8 @@ static void android_hardware_Camera_native_setup(JNIEnv *env, jobject thiz, jobj sp<Camera> camera = Camera::connect(); if (camera == NULL) { - jniThrowException(env, "java/lang/RuntimeException", "Out of memory"); + jniThrowException(env, "java/lang/RuntimeException", + "Fail to connect to camera service"); return; } diff --git a/core/jni/android_location_GpsLocationProvider.cpp b/core/jni/android_location_GpsLocationProvider.cpp index f0b35e9..004b0e3 100644 --- a/core/jni/android_location_GpsLocationProvider.cpp +++ b/core/jni/android_location_GpsLocationProvider.cpp @@ -31,29 +31,33 @@ static pthread_cond_t sEventCond = PTHREAD_COND_INITIALIZER; static jmethodID method_reportLocation; static jmethodID method_reportStatus; static jmethodID method_reportSvStatus; +static jmethodID method_reportAGpsStatus; static jmethodID method_xtraDownloadRequest; static const GpsInterface* sGpsInterface = NULL; static const GpsXtraInterface* sGpsXtraInterface = NULL; -static const GpsSuplInterface* sGpsSuplInterface = NULL; +static const AGpsInterface* sAGpsInterface = NULL; // data written to by GPS callbacks static GpsLocation sGpsLocation; static GpsStatus sGpsStatus; static GpsSvStatus sGpsSvStatus; +static AGpsStatus sAGpsStatus; // a copy of the data shared by android_location_GpsLocationProvider_wait_for_event // and android_location_GpsLocationProvider_read_status static GpsLocation sGpsLocationCopy; static GpsStatus sGpsStatusCopy; static GpsSvStatus sGpsSvStatusCopy; +static AGpsStatus sAGpsStatusCopy; enum CallbackType { kLocation = 1, kStatus = 2, kSvStatus = 4, - kXtraDownloadRequest = 8, - kDisableRequest = 16, + kAGpsStatus = 8, + kXtraDownloadRequest = 16, + kDisableRequest = 32, }; static int sPendingCallbacks; @@ -92,6 +96,17 @@ static void sv_status_callback(GpsSvStatus* sv_status) pthread_mutex_unlock(&sEventMutex); } +static void agps_status_callback(AGpsStatus* agps_status) +{ + pthread_mutex_lock(&sEventMutex); + + sPendingCallbacks |= kAGpsStatus; + memcpy(&sAGpsStatus, agps_status, sizeof(AGpsStatus)); + + pthread_cond_signal(&sEventCond); + pthread_mutex_unlock(&sEventMutex); +} + GpsCallbacks sGpsCallbacks = { location_callback, status_callback, @@ -111,11 +126,15 @@ GpsXtraCallbacks sGpsXtraCallbacks = { download_request_callback, }; +AGpsCallbacks sAGpsCallbacks = { + agps_status_callback, +}; static void android_location_GpsLocationProvider_class_init_native(JNIEnv* env, jclass clazz) { method_reportLocation = env->GetMethodID(clazz, "reportLocation", "(IDDDFFFJ)V"); method_reportStatus = env->GetMethodID(clazz, "reportStatus", "(I)V"); method_reportSvStatus = env->GetMethodID(clazz, "reportSvStatus", "()V"); + method_reportAGpsStatus = env->GetMethodID(clazz, "reportAGpsStatus", "(II)V"); method_xtraDownloadRequest = env->GetMethodID(clazz, "xtraDownloadRequest", "()V"); } @@ -129,7 +148,14 @@ static jboolean android_location_GpsLocationProvider_init(JNIEnv* env, jobject o { if (!sGpsInterface) sGpsInterface = gps_get_interface(); - return (sGpsInterface && sGpsInterface->init(&sGpsCallbacks) == 0); + if (!sGpsInterface || sGpsInterface->init(&sGpsCallbacks) != 0) + return false; + + if (!sAGpsInterface) + sAGpsInterface = (const AGpsInterface*)sGpsInterface->get_extension(AGPS_INTERFACE); + if (sAGpsInterface) + sAGpsInterface->init(&sAGpsCallbacks); + return true; } static void android_location_GpsLocationProvider_disable(JNIEnv* env, jobject obj) @@ -161,12 +187,6 @@ static jboolean android_location_GpsLocationProvider_stop(JNIEnv* env, jobject o return (sGpsInterface->stop() == 0); } -static void android_location_GpsLocationProvider_set_fix_frequency(JNIEnv* env, jobject obj, jint fixFrequency) -{ - if (sGpsInterface->set_fix_frequency) - sGpsInterface->set_fix_frequency(fixFrequency); -} - static void android_location_GpsLocationProvider_delete_aiding_data(JNIEnv* env, jobject obj, jint flags) { sGpsInterface->delete_aiding_data(flags); @@ -186,6 +206,7 @@ static void android_location_GpsLocationProvider_wait_for_event(JNIEnv* env, job memcpy(&sGpsLocationCopy, &sGpsLocation, sizeof(sGpsLocationCopy)); memcpy(&sGpsStatusCopy, &sGpsStatus, sizeof(sGpsStatusCopy)); memcpy(&sGpsSvStatusCopy, &sGpsSvStatus, sizeof(sGpsSvStatusCopy)); + memcpy(&sAGpsStatusCopy, &sAGpsStatus, sizeof(sAGpsStatusCopy)); pthread_mutex_unlock(&sEventMutex); if (pendingCallbacks & kLocation) { @@ -201,6 +222,9 @@ static void android_location_GpsLocationProvider_wait_for_event(JNIEnv* env, job if (pendingCallbacks & kSvStatus) { env->CallVoidMethod(obj, method_reportSvStatus); } + if (pendingCallbacks & kAGpsStatus) { + env->CallVoidMethod(obj, method_reportAGpsStatus, sAGpsStatusCopy.type, sAGpsStatusCopy.status); + } if (pendingCallbacks & kXtraDownloadRequest) { env->CallVoidMethod(obj, method_xtraDownloadRequest); } @@ -269,51 +293,72 @@ static void android_location_GpsLocationProvider_inject_xtra_data(JNIEnv* env, j env->ReleaseByteArrayElements(data, bytes, 0); } -static void android_location_GpsLocationProvider_set_supl_server(JNIEnv* env, jobject obj, - jint addr, jint port) +static void android_location_GpsLocationProvider_agps_data_conn_open(JNIEnv* env, jobject obj, jstring apn) { - if (!sGpsSuplInterface) { - sGpsSuplInterface = (const GpsSuplInterface*)sGpsInterface->get_extension(GPS_SUPL_INTERFACE); + if (!sAGpsInterface) { + sAGpsInterface = (const AGpsInterface*)sGpsInterface->get_extension(AGPS_INTERFACE); } - if (sGpsSuplInterface) { - sGpsSuplInterface->set_server(addr, port); - } -} - -static void android_location_GpsLocationProvider_set_supl_apn(JNIEnv* env, jobject obj, jstring apn) -{ - if (!sGpsSuplInterface) { - sGpsSuplInterface = (const GpsSuplInterface*)sGpsInterface->get_extension(GPS_SUPL_INTERFACE); - } - if (sGpsSuplInterface) { + if (sAGpsInterface) { if (apn == NULL) { jniThrowException(env, "java/lang/IllegalArgumentException", NULL); return; } const char *apnStr = env->GetStringUTFChars(apn, NULL); - sGpsSuplInterface->set_apn(apnStr); + sAGpsInterface->data_conn_open(apnStr); env->ReleaseStringUTFChars(apn, apnStr); } } +static void android_location_GpsLocationProvider_agps_data_conn_closed(JNIEnv* env, jobject obj) +{ + if (!sAGpsInterface) { + sAGpsInterface = (const AGpsInterface*)sGpsInterface->get_extension(AGPS_INTERFACE); + } + if (sAGpsInterface) { + sAGpsInterface->data_conn_closed(); + } +} + +static void android_location_GpsLocationProvider_agps_data_conn_failed(JNIEnv* env, jobject obj) +{ + if (!sAGpsInterface) { + sAGpsInterface = (const AGpsInterface*)sGpsInterface->get_extension(AGPS_INTERFACE); + } + if (sAGpsInterface) { + sAGpsInterface->data_conn_failed(); + } +} + +static void android_location_GpsLocationProvider_set_agps_server(JNIEnv* env, jobject obj, + jint type, jint addr, jint port) +{ + if (!sAGpsInterface) { + sAGpsInterface = (const AGpsInterface*)sGpsInterface->get_extension(AGPS_INTERFACE); + } + if (sAGpsInterface) { + sAGpsInterface->set_server(type, addr, port); + } +} + static JNINativeMethod sMethods[] = { /* name, signature, funcPtr */ {"class_init_native", "()V", (void *)android_location_GpsLocationProvider_class_init_native}, - {"native_is_supported", "()Z", (void*)android_location_GpsLocationProvider_is_supported}, - {"native_init", "()Z", (void*)android_location_GpsLocationProvider_init}, - {"native_disable", "()V", (void*)android_location_GpsLocationProvider_disable}, - {"native_cleanup", "()V", (void*)android_location_GpsLocationProvider_cleanup}, - {"native_start", "(IZI)Z", (void*)android_location_GpsLocationProvider_start}, - {"native_stop", "()Z", (void*)android_location_GpsLocationProvider_stop}, - {"native_set_fix_frequency", "(I)V", (void*)android_location_GpsLocationProvider_set_fix_frequency}, - {"native_delete_aiding_data", "(I)V", (void*)android_location_GpsLocationProvider_delete_aiding_data}, - {"native_wait_for_event", "()V", (void*)android_location_GpsLocationProvider_wait_for_event}, - {"native_read_sv_status", "([I[F[F[F[I)I", (void*)android_location_GpsLocationProvider_read_sv_status}, - {"native_inject_time", "(JJI)V", (void*)android_location_GpsLocationProvider_inject_time}, - {"native_supports_xtra", "()Z", (void*)android_location_GpsLocationProvider_supports_xtra}, - {"native_inject_xtra_data", "([BI)V", (void*)android_location_GpsLocationProvider_inject_xtra_data}, - {"native_set_supl_server", "(II)V", (void*)android_location_GpsLocationProvider_set_supl_server}, - {"native_set_supl_apn", "(Ljava/lang/String;)V", (void*)android_location_GpsLocationProvider_set_supl_apn}, + {"native_is_supported", "()Z", (void*)android_location_GpsLocationProvider_is_supported}, + {"native_init", "()Z", (void*)android_location_GpsLocationProvider_init}, + {"native_disable", "()V", (void*)android_location_GpsLocationProvider_disable}, + {"native_cleanup", "()V", (void*)android_location_GpsLocationProvider_cleanup}, + {"native_start", "(IZI)Z", (void*)android_location_GpsLocationProvider_start}, + {"native_stop", "()Z", (void*)android_location_GpsLocationProvider_stop}, + {"native_delete_aiding_data", "(I)V", (void*)android_location_GpsLocationProvider_delete_aiding_data}, + {"native_wait_for_event", "()V", (void*)android_location_GpsLocationProvider_wait_for_event}, + {"native_read_sv_status", "([I[F[F[F[I)I", (void*)android_location_GpsLocationProvider_read_sv_status}, + {"native_inject_time", "(JJI)V", (void*)android_location_GpsLocationProvider_inject_time}, + {"native_supports_xtra", "()Z", (void*)android_location_GpsLocationProvider_supports_xtra}, + {"native_inject_xtra_data", "([BI)V", (void*)android_location_GpsLocationProvider_inject_xtra_data}, + {"native_agps_data_conn_open", "(Ljava/lang/String;)V", (void*)android_location_GpsLocationProvider_agps_data_conn_open}, + {"native_agps_data_conn_closed", "()V", (void*)android_location_GpsLocationProvider_agps_data_conn_closed}, + {"native_agps_data_conn_failed", "()V", (void*)android_location_GpsLocationProvider_agps_data_conn_failed}, + {"native_set_agps_server", "(III)V", (void*)android_location_GpsLocationProvider_set_agps_server}, }; int register_android_location_GpsLocationProvider(JNIEnv* env) diff --git a/core/jni/android_media_AudioTrack.cpp b/core/jni/android_media_AudioTrack.cpp index b8d6586..42ada54 100644 --- a/core/jni/android_media_AudioTrack.cpp +++ b/core/jni/android_media_AudioTrack.cpp @@ -335,7 +335,7 @@ android_media_AudioTrack_start(JNIEnv *env, jobject thiz) jniThrowException(env, "java/lang/IllegalStateException", "Unable to retrieve AudioTrack pointer for start()"); } - + lpTrack->start(); } @@ -433,6 +433,45 @@ static void android_media_AudioTrack_native_release(JNIEnv *env, jobject thiz) // ---------------------------------------------------------------------------- +jint writeToTrack(AudioTrack* pTrack, jint audioFormat, jbyte* data, + jint offsetInBytes, jint sizeInBytes) { + // give the data to the native AudioTrack object (the data starts at the offset) + ssize_t written = 0; + // regular write() or copy the data to the AudioTrack's shared memory? + if (pTrack->sharedBuffer() == 0) { + written = pTrack->write(data + offsetInBytes, sizeInBytes); + } else { + if (audioFormat == javaAudioTrackFields.PCM16) { + // writing to shared memory, check for capacity + if ((size_t)sizeInBytes > pTrack->sharedBuffer()->size()) { + sizeInBytes = pTrack->sharedBuffer()->size(); + } + memcpy(pTrack->sharedBuffer()->pointer(), data + offsetInBytes, sizeInBytes); + written = sizeInBytes; + } else if (audioFormat == javaAudioTrackFields.PCM8) { + // data contains 8bit data we need to expand to 16bit before copying + // to the shared memory + // writing to shared memory, check for capacity, + // note that input data will occupy 2X the input space due to 8 to 16bit conversion + if (((size_t)sizeInBytes)*2 > pTrack->sharedBuffer()->size()) { + sizeInBytes = pTrack->sharedBuffer()->size() / 2; + } + int count = sizeInBytes; + int16_t *dst = (int16_t *)pTrack->sharedBuffer()->pointer(); + const int8_t *src = (const int8_t *)(data + offsetInBytes); + while(count--) { + *dst++ = (int16_t)(*src++^0x80) << 8; + } + // even though we wrote 2*sizeInBytes, we only report sizeInBytes as written to hide + // the 8bit mixer restriction from the user of this function + written = sizeInBytes; + } + } + return written; + +} + +// ---------------------------------------------------------------------------- static jint android_media_AudioTrack_native_write(JNIEnv *env, jobject thiz, jbyteArray javaAudioData, jint offsetInBytes, jint sizeInBytes, @@ -461,35 +500,13 @@ static jint android_media_AudioTrack_native_write(JNIEnv *env, jobject thiz, return 0; } - // give the data to the native AudioTrack object (the data starts at the offset) - ssize_t written = 0; - // regular write() or copy the data to the AudioTrack's shared memory? - if (lpTrack->sharedBuffer() == 0) { - written = lpTrack->write(cAudioData + offsetInBytes, sizeInBytes); - } else { - if (javaAudioFormat == javaAudioTrackFields.PCM16) { - memcpy(lpTrack->sharedBuffer()->pointer(), cAudioData + offsetInBytes, sizeInBytes); - written = sizeInBytes; - } else if (javaAudioFormat == javaAudioTrackFields.PCM8) { - // cAudioData contains 8bit data we need to expand to 16bit before copying - // to the shared memory - int count = sizeInBytes; - int16_t *dst = (int16_t *)lpTrack->sharedBuffer()->pointer(); - const int8_t *src = (const int8_t *)(cAudioData + offsetInBytes); - while(count--) { - *dst++ = (int16_t)(*src++^0x80) << 8; - } - // even though we wrote 2*sizeInBytes, we only report sizeInBytes as written to hide - // the 8bit mixer restriction from the user of this function - written = sizeInBytes; - } - } + jint written = writeToTrack(lpTrack, javaAudioFormat, cAudioData, offsetInBytes, sizeInBytes); env->ReleasePrimitiveArrayCritical(javaAudioData, cAudioData, 0); //LOGV("write wrote %d (tried %d) bytes in the native AudioTrack with offset %d", // (int)written, (int)(sizeInBytes), (int)offsetInBytes); - return (int)written; + return written; } diff --git a/core/jni/android_net_wifi_Wifi.cpp b/core/jni/android_net_wifi_Wifi.cpp index fcab813..25670df 100644 --- a/core/jni/android_net_wifi_Wifi.cpp +++ b/core/jni/android_net_wifi_Wifi.cpp @@ -291,6 +291,7 @@ static jboolean android_net_wifi_startPacketFiltering(JNIEnv* env, jobject clazz { return doBooleanCommand("DRIVER RXFILTER-ADD 0", "OK") && doBooleanCommand("DRIVER RXFILTER-ADD 1", "OK") + && doBooleanCommand("DRIVER RXFILTER-ADD 3", "OK") && doBooleanCommand("DRIVER RXFILTER-START", "OK"); } @@ -298,6 +299,7 @@ static jboolean android_net_wifi_stopPacketFiltering(JNIEnv* env, jobject clazz) { jboolean result = doBooleanCommand("DRIVER RXFILTER-STOP", "OK"); if (result) { + (void)doBooleanCommand("DRIVER RXFILTER-REMOVE 3", "OK"); (void)doBooleanCommand("DRIVER RXFILTER-REMOVE 1", "OK"); (void)doBooleanCommand("DRIVER RXFILTER-REMOVE 0", "OK"); } diff --git a/core/jni/android_opengl_GLES10.cpp b/core/jni/android_opengl_GLES10.cpp new file mode 100644 index 0000000..482d8eb --- /dev/null +++ b/core/jni/android_opengl_GLES10.cpp @@ -0,0 +1,3556 @@ +/* +** +** Copyright 2009, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +// This source file is automatically generated + +#include <android_runtime/AndroidRuntime.h> +#include <utils/misc.h> + +#include <assert.h> +#include <GLES/gl.h> +#include <GLES/glext.h> + +/* special calls implemented in Android's GLES wrapper used to more + * efficiently bound-check passed arrays */ +extern "C" { +GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride, + const GLvoid *ptr, GLsizei count); +GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride, + const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); +} + +static int initialized = 0; + +static jclass nioAccessClass; +static jclass bufferClass; +static jclass OOMEClass; +static jclass UOEClass; +static jclass IAEClass; +static jclass AIOOBEClass; +static jmethodID getBasePointerID; +static jmethodID getBaseArrayID; +static jmethodID getBaseArrayOffsetID; +static jfieldID positionID; +static jfieldID limitID; +static jfieldID elementSizeShiftID; + +/* Cache method IDs each time the class is loaded. */ + +static void +nativeClassInitBuffer(JNIEnv *_env) +{ + jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); + nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); + + jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); + bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); + + getBasePointerID = _env->GetStaticMethodID(nioAccessClass, + "getBasePointer", "(Ljava/nio/Buffer;)J"); + getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); + getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); + + positionID = _env->GetFieldID(bufferClass, "position", "I"); + limitID = _env->GetFieldID(bufferClass, "limit", "I"); + elementSizeShiftID = + _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); +} + +static void +nativeClassInit(JNIEnv *_env, jclass glImplClass) +{ + nativeClassInitBuffer(_env); + + jclass IAEClassLocal = + _env->FindClass("java/lang/IllegalArgumentException"); + jclass OOMEClassLocal = + _env->FindClass("java/lang/OutOfMemoryError"); + jclass UOEClassLocal = + _env->FindClass("java/lang/UnsupportedOperationException"); + jclass AIOOBEClassLocal = + _env->FindClass("java/lang/ArrayIndexOutOfBoundsException"); + + IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal); + OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal); + UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal); + AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal); +} + +static void * +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +{ + jint position; + jint limit; + jint elementSizeShift; + jlong pointer; + jint offset; + void *data; + + position = _env->GetIntField(buffer, positionID); + limit = _env->GetIntField(buffer, limitID); + elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + *remaining = (limit - position) << elementSizeShift; + pointer = _env->CallStaticLongMethod(nioAccessClass, + getBasePointerID, buffer); + if (pointer != 0L) { + *array = NULL; + return (void *) (jint) pointer; + } + + *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, + getBaseArrayID, buffer); + offset = _env->CallStaticIntMethod(nioAccessClass, + getBaseArrayOffsetID, buffer); + data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); + + return (void *) ((char *) data + offset); +} + +static void +releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) +{ + _env->ReleasePrimitiveArrayCritical(array, data, + commit ? 0 : JNI_ABORT); +} + +static int +getNumCompressedTextureFormats() { + int numCompressedTextureFormats = 0; + glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats); + return numCompressedTextureFormats; +} + +// -------------------------------------------------------------------------- + +/* void glActiveTexture ( GLenum texture ) */ +static void +android_glActiveTexture__I + (JNIEnv *_env, jobject _this, jint texture) { + glActiveTexture( + (GLenum)texture + ); +} + +/* void glAlphaFunc ( GLenum func, GLclampf ref ) */ +static void +android_glAlphaFunc__IF + (JNIEnv *_env, jobject _this, jint func, jfloat ref) { + glAlphaFunc( + (GLenum)func, + (GLclampf)ref + ); +} + +/* void glAlphaFuncx ( GLenum func, GLclampx ref ) */ +static void +android_glAlphaFuncx__II + (JNIEnv *_env, jobject _this, jint func, jint ref) { + glAlphaFuncx( + (GLenum)func, + (GLclampx)ref + ); +} + +/* void glBindTexture ( GLenum target, GLuint texture ) */ +static void +android_glBindTexture__II + (JNIEnv *_env, jobject _this, jint target, jint texture) { + glBindTexture( + (GLenum)target, + (GLuint)texture + ); +} + +/* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */ +static void +android_glBlendFunc__II + (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) { + glBlendFunc( + (GLenum)sfactor, + (GLenum)dfactor + ); +} + +/* void glClear ( GLbitfield mask ) */ +static void +android_glClear__I + (JNIEnv *_env, jobject _this, jint mask) { + glClear( + (GLbitfield)mask + ); +} + +/* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */ +static void +android_glClearColor__FFFF + (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) { + glClearColor( + (GLclampf)red, + (GLclampf)green, + (GLclampf)blue, + (GLclampf)alpha + ); +} + +/* void glClearColorx ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha ) */ +static void +android_glClearColorx__IIII + (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) { + glClearColorx( + (GLclampx)red, + (GLclampx)green, + (GLclampx)blue, + (GLclampx)alpha + ); +} + +/* void glClearDepthf ( GLclampf depth ) */ +static void +android_glClearDepthf__F + (JNIEnv *_env, jobject _this, jfloat depth) { + glClearDepthf( + (GLclampf)depth + ); +} + +/* void glClearDepthx ( GLclampx depth ) */ +static void +android_glClearDepthx__I + (JNIEnv *_env, jobject _this, jint depth) { + glClearDepthx( + (GLclampx)depth + ); +} + +/* void glClearStencil ( GLint s ) */ +static void +android_glClearStencil__I + (JNIEnv *_env, jobject _this, jint s) { + glClearStencil( + (GLint)s + ); +} + +/* void glClientActiveTexture ( GLenum texture ) */ +static void +android_glClientActiveTexture__I + (JNIEnv *_env, jobject _this, jint texture) { + glClientActiveTexture( + (GLenum)texture + ); +} + +/* void glColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) */ +static void +android_glColor4f__FFFF + (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) { + glColor4f( + (GLfloat)red, + (GLfloat)green, + (GLfloat)blue, + (GLfloat)alpha + ); +} + +/* void glColor4x ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha ) */ +static void +android_glColor4x__IIII + (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) { + glColor4x( + (GLfixed)red, + (GLfixed)green, + (GLfixed)blue, + (GLfixed)alpha + ); +} + +/* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */ +static void +android_glColorMask__ZZZZ + (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) { + glColorMask( + (GLboolean)red, + (GLboolean)green, + (GLboolean)blue, + (GLboolean)alpha + ); +} + +/* void glColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */ +static void +android_glColorPointerBounds__IIILjava_nio_Buffer_2I + (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *pointer = (GLvoid *) 0; + + if (pointer_buf) { + pointer = (GLvoid *) _env->GetDirectBufferAddress(pointer_buf); + if ( ! pointer ) { + _env->ThrowNew(IAEClass, "Must use a native order direct Buffer"); + return; + } + } + glColorPointerBounds( + (GLint)size, + (GLenum)type, + (GLsizei)stride, + (GLvoid *)pointer, + (GLsizei)remaining + ); +} + +/* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */ +static void +android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 + (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *data = (GLvoid *) 0; + + data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); + glCompressedTexImage2D( + (GLenum)target, + (GLint)level, + (GLenum)internalformat, + (GLsizei)width, + (GLsizei)height, + (GLint)border, + (GLsizei)imageSize, + (GLvoid *)data + ); + if (_array) { + releasePointer(_env, _array, data, JNI_FALSE); + } +} + +/* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */ +static void +android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 + (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *data = (GLvoid *) 0; + + data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); + glCompressedTexSubImage2D( + (GLenum)target, + (GLint)level, + (GLint)xoffset, + (GLint)yoffset, + (GLsizei)width, + (GLsizei)height, + (GLenum)format, + (GLsizei)imageSize, + (GLvoid *)data + ); + if (_array) { + releasePointer(_env, _array, data, JNI_FALSE); + } +} + +/* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */ +static void +android_glCopyTexImage2D__IIIIIIII + (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) { + glCopyTexImage2D( + (GLenum)target, + (GLint)level, + (GLenum)internalformat, + (GLint)x, + (GLint)y, + (GLsizei)width, + (GLsizei)height, + (GLint)border + ); +} + +/* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */ +static void +android_glCopyTexSubImage2D__IIIIIIII + (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) { + glCopyTexSubImage2D( + (GLenum)target, + (GLint)level, + (GLint)xoffset, + (GLint)yoffset, + (GLint)x, + (GLint)y, + (GLsizei)width, + (GLsizei)height + ); +} + +/* void glCullFace ( GLenum mode ) */ +static void +android_glCullFace__I + (JNIEnv *_env, jobject _this, jint mode) { + glCullFace( + (GLenum)mode + ); +} + +/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */ +static void +android_glDeleteTextures__I_3II + (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) { + GLuint *textures_base = (GLuint *) 0; + jint _remaining; + GLuint *textures = (GLuint *) 0; + + if (!textures_ref) { + _env->ThrowNew(IAEClass, "textures == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(textures_ref) - offset; + if (_remaining < n) { + _env->ThrowNew(IAEClass, "length - offset < n"); + goto exit; + } + textures_base = (GLuint *) + _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0); + textures = textures_base + offset; + + glDeleteTextures( + (GLsizei)n, + (GLuint *)textures + ); + +exit: + if (textures_base) { + _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base, + JNI_ABORT); + } +} + +/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */ +static void +android_glDeleteTextures__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLuint *textures = (GLuint *) 0; + + textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining); + if (_remaining < n) { + _env->ThrowNew(IAEClass, "remaining() < n"); + goto exit; + } + glDeleteTextures( + (GLsizei)n, + (GLuint *)textures + ); + +exit: + if (_array) { + releasePointer(_env, _array, textures, JNI_FALSE); + } +} + +/* void glDepthFunc ( GLenum func ) */ +static void +android_glDepthFunc__I + (JNIEnv *_env, jobject _this, jint func) { + glDepthFunc( + (GLenum)func + ); +} + +/* void glDepthMask ( GLboolean flag ) */ +static void +android_glDepthMask__Z + (JNIEnv *_env, jobject _this, jboolean flag) { + glDepthMask( + (GLboolean)flag + ); +} + +/* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */ +static void +android_glDepthRangef__FF + (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) { + glDepthRangef( + (GLclampf)zNear, + (GLclampf)zFar + ); +} + +/* void glDepthRangex ( GLclampx zNear, GLclampx zFar ) */ +static void +android_glDepthRangex__II + (JNIEnv *_env, jobject _this, jint zNear, jint zFar) { + glDepthRangex( + (GLclampx)zNear, + (GLclampx)zFar + ); +} + +/* void glDisable ( GLenum cap ) */ +static void +android_glDisable__I + (JNIEnv *_env, jobject _this, jint cap) { + glDisable( + (GLenum)cap + ); +} + +/* void glDisableClientState ( GLenum array ) */ +static void +android_glDisableClientState__I + (JNIEnv *_env, jobject _this, jint array) { + glDisableClientState( + (GLenum)array + ); +} + +/* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */ +static void +android_glDrawArrays__III + (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) { + glDrawArrays( + (GLenum)mode, + (GLint)first, + (GLsizei)count + ); +} + +/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */ +static void +android_glDrawElements__IIILjava_nio_Buffer_2 + (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *indices = (GLvoid *) 0; + + indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining); + if (_remaining < count) { + _env->ThrowNew(AIOOBEClass, "remaining() < count"); + goto exit; + } + glDrawElements( + (GLenum)mode, + (GLsizei)count, + (GLenum)type, + (GLvoid *)indices + ); + +exit: + if (_array) { + releasePointer(_env, _array, indices, JNI_FALSE); + } +} + +/* void glEnable ( GLenum cap ) */ +static void +android_glEnable__I + (JNIEnv *_env, jobject _this, jint cap) { + glEnable( + (GLenum)cap + ); +} + +/* void glEnableClientState ( GLenum array ) */ +static void +android_glEnableClientState__I + (JNIEnv *_env, jobject _this, jint array) { + glEnableClientState( + (GLenum)array + ); +} + +/* void glFinish ( void ) */ +static void +android_glFinish__ + (JNIEnv *_env, jobject _this) { + glFinish(); +} + +/* void glFlush ( void ) */ +static void +android_glFlush__ + (JNIEnv *_env, jobject _this) { + glFlush(); +} + +/* void glFogf ( GLenum pname, GLfloat param ) */ +static void +android_glFogf__IF + (JNIEnv *_env, jobject _this, jint pname, jfloat param) { + glFogf( + (GLenum)pname, + (GLfloat)param + ); +} + +/* void glFogfv ( GLenum pname, const GLfloat *params ) */ +static void +android_glFogfv__I_3FI + (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { + GLfloat *params_base = (GLfloat *) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + int _needed; + switch (pname) { +#if defined(GL_FOG_MODE) + case GL_FOG_MODE: +#endif // defined(GL_FOG_MODE) +#if defined(GL_FOG_DENSITY) + case GL_FOG_DENSITY: +#endif // defined(GL_FOG_DENSITY) +#if defined(GL_FOG_START) + case GL_FOG_START: +#endif // defined(GL_FOG_START) +#if defined(GL_FOG_END) + case GL_FOG_END: +#endif // defined(GL_FOG_END) + _needed = 1; + break; +#if defined(GL_FOG_COLOR) + case GL_FOG_COLOR: +#endif // defined(GL_FOG_COLOR) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "length - offset < needed"); + goto exit; + } + params_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glFogfv( + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glFogfv ( GLenum pname, const GLfloat *params ) */ +static void +android_glFogfv__ILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + int _needed; + switch (pname) { +#if defined(GL_FOG_MODE) + case GL_FOG_MODE: +#endif // defined(GL_FOG_MODE) +#if defined(GL_FOG_DENSITY) + case GL_FOG_DENSITY: +#endif // defined(GL_FOG_DENSITY) +#if defined(GL_FOG_START) + case GL_FOG_START: +#endif // defined(GL_FOG_START) +#if defined(GL_FOG_END) + case GL_FOG_END: +#endif // defined(GL_FOG_END) + _needed = 1; + break; +#if defined(GL_FOG_COLOR) + case GL_FOG_COLOR: +#endif // defined(GL_FOG_COLOR) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "remaining() < needed"); + goto exit; + } + glFogfv( + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glFogx ( GLenum pname, GLfixed param ) */ +static void +android_glFogx__II + (JNIEnv *_env, jobject _this, jint pname, jint param) { + glFogx( + (GLenum)pname, + (GLfixed)param + ); +} + +/* void glFogxv ( GLenum pname, const GLfixed *params ) */ +static void +android_glFogxv__I_3II + (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + int _needed; + switch (pname) { +#if defined(GL_FOG_MODE) + case GL_FOG_MODE: +#endif // defined(GL_FOG_MODE) +#if defined(GL_FOG_DENSITY) + case GL_FOG_DENSITY: +#endif // defined(GL_FOG_DENSITY) +#if defined(GL_FOG_START) + case GL_FOG_START: +#endif // defined(GL_FOG_START) +#if defined(GL_FOG_END) + case GL_FOG_END: +#endif // defined(GL_FOG_END) + _needed = 1; + break; +#if defined(GL_FOG_COLOR) + case GL_FOG_COLOR: +#endif // defined(GL_FOG_COLOR) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "length - offset < needed"); + goto exit; + } + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glFogxv( + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glFogxv ( GLenum pname, const GLfixed *params ) */ +static void +android_glFogxv__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + int _needed; + switch (pname) { +#if defined(GL_FOG_MODE) + case GL_FOG_MODE: +#endif // defined(GL_FOG_MODE) +#if defined(GL_FOG_DENSITY) + case GL_FOG_DENSITY: +#endif // defined(GL_FOG_DENSITY) +#if defined(GL_FOG_START) + case GL_FOG_START: +#endif // defined(GL_FOG_START) +#if defined(GL_FOG_END) + case GL_FOG_END: +#endif // defined(GL_FOG_END) + _needed = 1; + break; +#if defined(GL_FOG_COLOR) + case GL_FOG_COLOR: +#endif // defined(GL_FOG_COLOR) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "remaining() < needed"); + goto exit; + } + glFogxv( + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glFrontFace ( GLenum mode ) */ +static void +android_glFrontFace__I + (JNIEnv *_env, jobject _this, jint mode) { + glFrontFace( + (GLenum)mode + ); +} + +/* void glFrustumf ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */ +static void +android_glFrustumf__FFFFFF + (JNIEnv *_env, jobject _this, jfloat left, jfloat right, jfloat bottom, jfloat top, jfloat zNear, jfloat zFar) { + glFrustumf( + (GLfloat)left, + (GLfloat)right, + (GLfloat)bottom, + (GLfloat)top, + (GLfloat)zNear, + (GLfloat)zFar + ); +} + +/* void glFrustumx ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) */ +static void +android_glFrustumx__IIIIII + (JNIEnv *_env, jobject _this, jint left, jint right, jint bottom, jint top, jint zNear, jint zFar) { + glFrustumx( + (GLfixed)left, + (GLfixed)right, + (GLfixed)bottom, + (GLfixed)top, + (GLfixed)zNear, + (GLfixed)zFar + ); +} + +/* void glGenTextures ( GLsizei n, GLuint *textures ) */ +static void +android_glGenTextures__I_3II + (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) { + jint _exception = 0; + GLuint *textures_base = (GLuint *) 0; + jint _remaining; + GLuint *textures = (GLuint *) 0; + + if (!textures_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "textures == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(textures_ref) - offset; + if (_remaining < n) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - offset < n"); + goto exit; + } + textures_base = (GLuint *) + _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0); + textures = textures_base + offset; + + glGenTextures( + (GLsizei)n, + (GLuint *)textures + ); + +exit: + if (textures_base) { + _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGenTextures ( GLsizei n, GLuint *textures ) */ +static void +android_glGenTextures__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLuint *textures = (GLuint *) 0; + + textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining); + if (_remaining < n) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < n"); + goto exit; + } + glGenTextures( + (GLsizei)n, + (GLuint *)textures + ); + +exit: + if (_array) { + releasePointer(_env, _array, textures, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* GLenum glGetError ( void ) */ +static jint +android_glGetError__ + (JNIEnv *_env, jobject _this) { + GLenum _returnValue; + _returnValue = glGetError(); + return _returnValue; +} + +/* void glGetIntegerv ( GLenum pname, GLint *params ) */ +static void +android_glGetIntegerv__I_3II + (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLint *params_base = (GLint *) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + int _needed; + switch (pname) { +#if defined(GL_ALPHA_BITS) + case GL_ALPHA_BITS: +#endif // defined(GL_ALPHA_BITS) +#if defined(GL_ALPHA_TEST_FUNC) + case GL_ALPHA_TEST_FUNC: +#endif // defined(GL_ALPHA_TEST_FUNC) +#if defined(GL_ALPHA_TEST_REF) + case GL_ALPHA_TEST_REF: +#endif // defined(GL_ALPHA_TEST_REF) +#if defined(GL_BLEND_DST) + case GL_BLEND_DST: +#endif // defined(GL_BLEND_DST) +#if defined(GL_BLUE_BITS) + case GL_BLUE_BITS: +#endif // defined(GL_BLUE_BITS) +#if defined(GL_COLOR_ARRAY_BUFFER_BINDING) + case GL_COLOR_ARRAY_BUFFER_BINDING: +#endif // defined(GL_COLOR_ARRAY_BUFFER_BINDING) +#if defined(GL_COLOR_ARRAY_SIZE) + case GL_COLOR_ARRAY_SIZE: +#endif // defined(GL_COLOR_ARRAY_SIZE) +#if defined(GL_COLOR_ARRAY_STRIDE) + case GL_COLOR_ARRAY_STRIDE: +#endif // defined(GL_COLOR_ARRAY_STRIDE) +#if defined(GL_COLOR_ARRAY_TYPE) + case GL_COLOR_ARRAY_TYPE: +#endif // defined(GL_COLOR_ARRAY_TYPE) +#if defined(GL_CULL_FACE) + case GL_CULL_FACE: +#endif // defined(GL_CULL_FACE) +#if defined(GL_DEPTH_BITS) + case GL_DEPTH_BITS: +#endif // defined(GL_DEPTH_BITS) +#if defined(GL_DEPTH_CLEAR_VALUE) + case GL_DEPTH_CLEAR_VALUE: +#endif // defined(GL_DEPTH_CLEAR_VALUE) +#if defined(GL_DEPTH_FUNC) + case GL_DEPTH_FUNC: +#endif // defined(GL_DEPTH_FUNC) +#if defined(GL_DEPTH_WRITEMASK) + case GL_DEPTH_WRITEMASK: +#endif // defined(GL_DEPTH_WRITEMASK) +#if defined(GL_FOG_DENSITY) + case GL_FOG_DENSITY: +#endif // defined(GL_FOG_DENSITY) +#if defined(GL_FOG_END) + case GL_FOG_END: +#endif // defined(GL_FOG_END) +#if defined(GL_FOG_MODE) + case GL_FOG_MODE: +#endif // defined(GL_FOG_MODE) +#if defined(GL_FOG_START) + case GL_FOG_START: +#endif // defined(GL_FOG_START) +#if defined(GL_FRONT_FACE) + case GL_FRONT_FACE: +#endif // defined(GL_FRONT_FACE) +#if defined(GL_GREEN_BITS) + case GL_GREEN_BITS: +#endif // defined(GL_GREEN_BITS) +#if defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES) + case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: +#endif // defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES) +#if defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES) + case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: +#endif // defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES) +#if defined(GL_LIGHT_MODEL_COLOR_CONTROL) + case GL_LIGHT_MODEL_COLOR_CONTROL: +#endif // defined(GL_LIGHT_MODEL_COLOR_CONTROL) +#if defined(GL_LIGHT_MODEL_LOCAL_VIEWER) + case GL_LIGHT_MODEL_LOCAL_VIEWER: +#endif // defined(GL_LIGHT_MODEL_LOCAL_VIEWER) +#if defined(GL_LIGHT_MODEL_TWO_SIDE) + case GL_LIGHT_MODEL_TWO_SIDE: +#endif // defined(GL_LIGHT_MODEL_TWO_SIDE) +#if defined(GL_LINE_SMOOTH_HINT) + case GL_LINE_SMOOTH_HINT: +#endif // defined(GL_LINE_SMOOTH_HINT) +#if defined(GL_LINE_WIDTH) + case GL_LINE_WIDTH: +#endif // defined(GL_LINE_WIDTH) +#if defined(GL_LOGIC_OP_MODE) + case GL_LOGIC_OP_MODE: +#endif // defined(GL_LOGIC_OP_MODE) +#if defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES) + case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES: +#endif // defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES) +#if defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES) + case GL_MATRIX_INDEX_ARRAY_SIZE_OES: +#endif // defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES) +#if defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES) + case GL_MATRIX_INDEX_ARRAY_STRIDE_OES: +#endif // defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES) +#if defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES) + case GL_MATRIX_INDEX_ARRAY_TYPE_OES: +#endif // defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES) +#if defined(GL_MATRIX_MODE) + case GL_MATRIX_MODE: +#endif // defined(GL_MATRIX_MODE) +#if defined(GL_MAX_CLIP_PLANES) + case GL_MAX_CLIP_PLANES: +#endif // defined(GL_MAX_CLIP_PLANES) +#if defined(GL_MAX_ELEMENTS_INDICES) + case GL_MAX_ELEMENTS_INDICES: +#endif // defined(GL_MAX_ELEMENTS_INDICES) +#if defined(GL_MAX_ELEMENTS_VERTICES) + case GL_MAX_ELEMENTS_VERTICES: +#endif // defined(GL_MAX_ELEMENTS_VERTICES) +#if defined(GL_MAX_LIGHTS) + case GL_MAX_LIGHTS: +#endif // defined(GL_MAX_LIGHTS) +#if defined(GL_MAX_MODELVIEW_STACK_DEPTH) + case GL_MAX_MODELVIEW_STACK_DEPTH: +#endif // defined(GL_MAX_MODELVIEW_STACK_DEPTH) +#if defined(GL_MAX_PALETTE_MATRICES_OES) + case GL_MAX_PALETTE_MATRICES_OES: +#endif // defined(GL_MAX_PALETTE_MATRICES_OES) +#if defined(GL_MAX_PROJECTION_STACK_DEPTH) + case GL_MAX_PROJECTION_STACK_DEPTH: +#endif // defined(GL_MAX_PROJECTION_STACK_DEPTH) +#if defined(GL_MAX_TEXTURE_SIZE) + case GL_MAX_TEXTURE_SIZE: +#endif // defined(GL_MAX_TEXTURE_SIZE) +#if defined(GL_MAX_TEXTURE_STACK_DEPTH) + case GL_MAX_TEXTURE_STACK_DEPTH: +#endif // defined(GL_MAX_TEXTURE_STACK_DEPTH) +#if defined(GL_MAX_TEXTURE_UNITS) + case GL_MAX_TEXTURE_UNITS: +#endif // defined(GL_MAX_TEXTURE_UNITS) +#if defined(GL_MAX_VERTEX_UNITS_OES) + case GL_MAX_VERTEX_UNITS_OES: +#endif // defined(GL_MAX_VERTEX_UNITS_OES) +#if defined(GL_MODELVIEW_STACK_DEPTH) + case GL_MODELVIEW_STACK_DEPTH: +#endif // defined(GL_MODELVIEW_STACK_DEPTH) +#if defined(GL_NORMAL_ARRAY_BUFFER_BINDING) + case GL_NORMAL_ARRAY_BUFFER_BINDING: +#endif // defined(GL_NORMAL_ARRAY_BUFFER_BINDING) +#if defined(GL_NORMAL_ARRAY_STRIDE) + case GL_NORMAL_ARRAY_STRIDE: +#endif // defined(GL_NORMAL_ARRAY_STRIDE) +#if defined(GL_NORMAL_ARRAY_TYPE) + case GL_NORMAL_ARRAY_TYPE: +#endif // defined(GL_NORMAL_ARRAY_TYPE) +#if defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS) + case GL_NUM_COMPRESSED_TEXTURE_FORMATS: +#endif // defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS) +#if defined(GL_PACK_ALIGNMENT) + case GL_PACK_ALIGNMENT: +#endif // defined(GL_PACK_ALIGNMENT) +#if defined(GL_PERSPECTIVE_CORRECTION_HINT) + case GL_PERSPECTIVE_CORRECTION_HINT: +#endif // defined(GL_PERSPECTIVE_CORRECTION_HINT) +#if defined(GL_POINT_SIZE) + case GL_POINT_SIZE: +#endif // defined(GL_POINT_SIZE) +#if defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES) + case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES: +#endif // defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES) +#if defined(GL_POINT_SIZE_ARRAY_STRIDE_OES) + case GL_POINT_SIZE_ARRAY_STRIDE_OES: +#endif // defined(GL_POINT_SIZE_ARRAY_STRIDE_OES) +#if defined(GL_POINT_SIZE_ARRAY_TYPE_OES) + case GL_POINT_SIZE_ARRAY_TYPE_OES: +#endif // defined(GL_POINT_SIZE_ARRAY_TYPE_OES) +#if defined(GL_POINT_SMOOTH_HINT) + case GL_POINT_SMOOTH_HINT: +#endif // defined(GL_POINT_SMOOTH_HINT) +#if defined(GL_POLYGON_OFFSET_FACTOR) + case GL_POLYGON_OFFSET_FACTOR: +#endif // defined(GL_POLYGON_OFFSET_FACTOR) +#if defined(GL_POLYGON_OFFSET_UNITS) + case GL_POLYGON_OFFSET_UNITS: +#endif // defined(GL_POLYGON_OFFSET_UNITS) +#if defined(GL_PROJECTION_STACK_DEPTH) + case GL_PROJECTION_STACK_DEPTH: +#endif // defined(GL_PROJECTION_STACK_DEPTH) +#if defined(GL_RED_BITS) + case GL_RED_BITS: +#endif // defined(GL_RED_BITS) +#if defined(GL_SHADE_MODEL) + case GL_SHADE_MODEL: +#endif // defined(GL_SHADE_MODEL) +#if defined(GL_STENCIL_BITS) + case GL_STENCIL_BITS: +#endif // defined(GL_STENCIL_BITS) +#if defined(GL_STENCIL_CLEAR_VALUE) + case GL_STENCIL_CLEAR_VALUE: +#endif // defined(GL_STENCIL_CLEAR_VALUE) +#if defined(GL_STENCIL_FAIL) + case GL_STENCIL_FAIL: +#endif // defined(GL_STENCIL_FAIL) +#if defined(GL_STENCIL_FUNC) + case GL_STENCIL_FUNC: +#endif // defined(GL_STENCIL_FUNC) +#if defined(GL_STENCIL_PASS_DEPTH_FAIL) + case GL_STENCIL_PASS_DEPTH_FAIL: +#endif // defined(GL_STENCIL_PASS_DEPTH_FAIL) +#if defined(GL_STENCIL_PASS_DEPTH_PASS) + case GL_STENCIL_PASS_DEPTH_PASS: +#endif // defined(GL_STENCIL_PASS_DEPTH_PASS) +#if defined(GL_STENCIL_REF) + case GL_STENCIL_REF: +#endif // defined(GL_STENCIL_REF) +#if defined(GL_STENCIL_VALUE_MASK) + case GL_STENCIL_VALUE_MASK: +#endif // defined(GL_STENCIL_VALUE_MASK) +#if defined(GL_STENCIL_WRITEMASK) + case GL_STENCIL_WRITEMASK: +#endif // defined(GL_STENCIL_WRITEMASK) +#if defined(GL_SUBPIXEL_BITS) + case GL_SUBPIXEL_BITS: +#endif // defined(GL_SUBPIXEL_BITS) +#if defined(GL_TEXTURE_BINDING_2D) + case GL_TEXTURE_BINDING_2D: +#endif // defined(GL_TEXTURE_BINDING_2D) +#if defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING) + case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING: +#endif // defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING) +#if defined(GL_TEXTURE_COORD_ARRAY_SIZE) + case GL_TEXTURE_COORD_ARRAY_SIZE: +#endif // defined(GL_TEXTURE_COORD_ARRAY_SIZE) +#if defined(GL_TEXTURE_COORD_ARRAY_STRIDE) + case GL_TEXTURE_COORD_ARRAY_STRIDE: +#endif // defined(GL_TEXTURE_COORD_ARRAY_STRIDE) +#if defined(GL_TEXTURE_COORD_ARRAY_TYPE) + case GL_TEXTURE_COORD_ARRAY_TYPE: +#endif // defined(GL_TEXTURE_COORD_ARRAY_TYPE) +#if defined(GL_TEXTURE_STACK_DEPTH) + case GL_TEXTURE_STACK_DEPTH: +#endif // defined(GL_TEXTURE_STACK_DEPTH) +#if defined(GL_UNPACK_ALIGNMENT) + case GL_UNPACK_ALIGNMENT: +#endif // defined(GL_UNPACK_ALIGNMENT) +#if defined(GL_VERTEX_ARRAY_BUFFER_BINDING) + case GL_VERTEX_ARRAY_BUFFER_BINDING: +#endif // defined(GL_VERTEX_ARRAY_BUFFER_BINDING) +#if defined(GL_VERTEX_ARRAY_SIZE) + case GL_VERTEX_ARRAY_SIZE: +#endif // defined(GL_VERTEX_ARRAY_SIZE) +#if defined(GL_VERTEX_ARRAY_STRIDE) + case GL_VERTEX_ARRAY_STRIDE: +#endif // defined(GL_VERTEX_ARRAY_STRIDE) +#if defined(GL_VERTEX_ARRAY_TYPE) + case GL_VERTEX_ARRAY_TYPE: +#endif // defined(GL_VERTEX_ARRAY_TYPE) +#if defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES) + case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES: +#endif // defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES) +#if defined(GL_WEIGHT_ARRAY_SIZE_OES) + case GL_WEIGHT_ARRAY_SIZE_OES: +#endif // defined(GL_WEIGHT_ARRAY_SIZE_OES) +#if defined(GL_WEIGHT_ARRAY_STRIDE_OES) + case GL_WEIGHT_ARRAY_STRIDE_OES: +#endif // defined(GL_WEIGHT_ARRAY_STRIDE_OES) +#if defined(GL_WEIGHT_ARRAY_TYPE_OES) + case GL_WEIGHT_ARRAY_TYPE_OES: +#endif // defined(GL_WEIGHT_ARRAY_TYPE_OES) + _needed = 1; + break; +#if defined(GL_ALIASED_POINT_SIZE_RANGE) + case GL_ALIASED_POINT_SIZE_RANGE: +#endif // defined(GL_ALIASED_POINT_SIZE_RANGE) +#if defined(GL_ALIASED_LINE_WIDTH_RANGE) + case GL_ALIASED_LINE_WIDTH_RANGE: +#endif // defined(GL_ALIASED_LINE_WIDTH_RANGE) +#if defined(GL_DEPTH_RANGE) + case GL_DEPTH_RANGE: +#endif // defined(GL_DEPTH_RANGE) +#if defined(GL_MAX_VIEWPORT_DIMS) + case GL_MAX_VIEWPORT_DIMS: +#endif // defined(GL_MAX_VIEWPORT_DIMS) +#if defined(GL_SMOOTH_LINE_WIDTH_RANGE) + case GL_SMOOTH_LINE_WIDTH_RANGE: +#endif // defined(GL_SMOOTH_LINE_WIDTH_RANGE) +#if defined(GL_SMOOTH_POINT_SIZE_RANGE) + case GL_SMOOTH_POINT_SIZE_RANGE: +#endif // defined(GL_SMOOTH_POINT_SIZE_RANGE) + _needed = 2; + break; +#if defined(GL_COLOR_CLEAR_VALUE) + case GL_COLOR_CLEAR_VALUE: +#endif // defined(GL_COLOR_CLEAR_VALUE) +#if defined(GL_COLOR_WRITEMASK) + case GL_COLOR_WRITEMASK: +#endif // defined(GL_COLOR_WRITEMASK) +#if defined(GL_FOG_COLOR) + case GL_FOG_COLOR: +#endif // defined(GL_FOG_COLOR) +#if defined(GL_LIGHT_MODEL_AMBIENT) + case GL_LIGHT_MODEL_AMBIENT: +#endif // defined(GL_LIGHT_MODEL_AMBIENT) +#if defined(GL_SCISSOR_BOX) + case GL_SCISSOR_BOX: +#endif // defined(GL_SCISSOR_BOX) +#if defined(GL_VIEWPORT) + case GL_VIEWPORT: +#endif // defined(GL_VIEWPORT) + _needed = 4; + break; +#if defined(GL_MODELVIEW_MATRIX) + case GL_MODELVIEW_MATRIX: +#endif // defined(GL_MODELVIEW_MATRIX) +#if defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES) + case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES: +#endif // defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES) +#if defined(GL_PROJECTION_MATRIX) + case GL_PROJECTION_MATRIX: +#endif // defined(GL_PROJECTION_MATRIX) +#if defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES) + case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES: +#endif // defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES) +#if defined(GL_TEXTURE_MATRIX) + case GL_TEXTURE_MATRIX: +#endif // defined(GL_TEXTURE_MATRIX) +#if defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES) + case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES: +#endif // defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES) + _needed = 16; + break; +#if defined(GL_COMPRESSED_TEXTURE_FORMATS) + case GL_COMPRESSED_TEXTURE_FORMATS: +#endif // defined(GL_COMPRESSED_TEXTURE_FORMATS) + _needed = getNumCompressedTextureFormats(); + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - offset < needed"); + goto exit; + } + params_base = (GLint *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetIntegerv( + (GLenum)pname, + (GLint *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetIntegerv ( GLenum pname, GLint *params ) */ +static void +android_glGetIntegerv__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + int _needed; + switch (pname) { +#if defined(GL_ALPHA_BITS) + case GL_ALPHA_BITS: +#endif // defined(GL_ALPHA_BITS) +#if defined(GL_ALPHA_TEST_FUNC) + case GL_ALPHA_TEST_FUNC: +#endif // defined(GL_ALPHA_TEST_FUNC) +#if defined(GL_ALPHA_TEST_REF) + case GL_ALPHA_TEST_REF: +#endif // defined(GL_ALPHA_TEST_REF) +#if defined(GL_BLEND_DST) + case GL_BLEND_DST: +#endif // defined(GL_BLEND_DST) +#if defined(GL_BLUE_BITS) + case GL_BLUE_BITS: +#endif // defined(GL_BLUE_BITS) +#if defined(GL_COLOR_ARRAY_BUFFER_BINDING) + case GL_COLOR_ARRAY_BUFFER_BINDING: +#endif // defined(GL_COLOR_ARRAY_BUFFER_BINDING) +#if defined(GL_COLOR_ARRAY_SIZE) + case GL_COLOR_ARRAY_SIZE: +#endif // defined(GL_COLOR_ARRAY_SIZE) +#if defined(GL_COLOR_ARRAY_STRIDE) + case GL_COLOR_ARRAY_STRIDE: +#endif // defined(GL_COLOR_ARRAY_STRIDE) +#if defined(GL_COLOR_ARRAY_TYPE) + case GL_COLOR_ARRAY_TYPE: +#endif // defined(GL_COLOR_ARRAY_TYPE) +#if defined(GL_CULL_FACE) + case GL_CULL_FACE: +#endif // defined(GL_CULL_FACE) +#if defined(GL_DEPTH_BITS) + case GL_DEPTH_BITS: +#endif // defined(GL_DEPTH_BITS) +#if defined(GL_DEPTH_CLEAR_VALUE) + case GL_DEPTH_CLEAR_VALUE: +#endif // defined(GL_DEPTH_CLEAR_VALUE) +#if defined(GL_DEPTH_FUNC) + case GL_DEPTH_FUNC: +#endif // defined(GL_DEPTH_FUNC) +#if defined(GL_DEPTH_WRITEMASK) + case GL_DEPTH_WRITEMASK: +#endif // defined(GL_DEPTH_WRITEMASK) +#if defined(GL_FOG_DENSITY) + case GL_FOG_DENSITY: +#endif // defined(GL_FOG_DENSITY) +#if defined(GL_FOG_END) + case GL_FOG_END: +#endif // defined(GL_FOG_END) +#if defined(GL_FOG_MODE) + case GL_FOG_MODE: +#endif // defined(GL_FOG_MODE) +#if defined(GL_FOG_START) + case GL_FOG_START: +#endif // defined(GL_FOG_START) +#if defined(GL_FRONT_FACE) + case GL_FRONT_FACE: +#endif // defined(GL_FRONT_FACE) +#if defined(GL_GREEN_BITS) + case GL_GREEN_BITS: +#endif // defined(GL_GREEN_BITS) +#if defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES) + case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: +#endif // defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES) +#if defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES) + case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: +#endif // defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES) +#if defined(GL_LIGHT_MODEL_COLOR_CONTROL) + case GL_LIGHT_MODEL_COLOR_CONTROL: +#endif // defined(GL_LIGHT_MODEL_COLOR_CONTROL) +#if defined(GL_LIGHT_MODEL_LOCAL_VIEWER) + case GL_LIGHT_MODEL_LOCAL_VIEWER: +#endif // defined(GL_LIGHT_MODEL_LOCAL_VIEWER) +#if defined(GL_LIGHT_MODEL_TWO_SIDE) + case GL_LIGHT_MODEL_TWO_SIDE: +#endif // defined(GL_LIGHT_MODEL_TWO_SIDE) +#if defined(GL_LINE_SMOOTH_HINT) + case GL_LINE_SMOOTH_HINT: +#endif // defined(GL_LINE_SMOOTH_HINT) +#if defined(GL_LINE_WIDTH) + case GL_LINE_WIDTH: +#endif // defined(GL_LINE_WIDTH) +#if defined(GL_LOGIC_OP_MODE) + case GL_LOGIC_OP_MODE: +#endif // defined(GL_LOGIC_OP_MODE) +#if defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES) + case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES: +#endif // defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES) +#if defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES) + case GL_MATRIX_INDEX_ARRAY_SIZE_OES: +#endif // defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES) +#if defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES) + case GL_MATRIX_INDEX_ARRAY_STRIDE_OES: +#endif // defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES) +#if defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES) + case GL_MATRIX_INDEX_ARRAY_TYPE_OES: +#endif // defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES) +#if defined(GL_MATRIX_MODE) + case GL_MATRIX_MODE: +#endif // defined(GL_MATRIX_MODE) +#if defined(GL_MAX_CLIP_PLANES) + case GL_MAX_CLIP_PLANES: +#endif // defined(GL_MAX_CLIP_PLANES) +#if defined(GL_MAX_ELEMENTS_INDICES) + case GL_MAX_ELEMENTS_INDICES: +#endif // defined(GL_MAX_ELEMENTS_INDICES) +#if defined(GL_MAX_ELEMENTS_VERTICES) + case GL_MAX_ELEMENTS_VERTICES: +#endif // defined(GL_MAX_ELEMENTS_VERTICES) +#if defined(GL_MAX_LIGHTS) + case GL_MAX_LIGHTS: +#endif // defined(GL_MAX_LIGHTS) +#if defined(GL_MAX_MODELVIEW_STACK_DEPTH) + case GL_MAX_MODELVIEW_STACK_DEPTH: +#endif // defined(GL_MAX_MODELVIEW_STACK_DEPTH) +#if defined(GL_MAX_PALETTE_MATRICES_OES) + case GL_MAX_PALETTE_MATRICES_OES: +#endif // defined(GL_MAX_PALETTE_MATRICES_OES) +#if defined(GL_MAX_PROJECTION_STACK_DEPTH) + case GL_MAX_PROJECTION_STACK_DEPTH: +#endif // defined(GL_MAX_PROJECTION_STACK_DEPTH) +#if defined(GL_MAX_TEXTURE_SIZE) + case GL_MAX_TEXTURE_SIZE: +#endif // defined(GL_MAX_TEXTURE_SIZE) +#if defined(GL_MAX_TEXTURE_STACK_DEPTH) + case GL_MAX_TEXTURE_STACK_DEPTH: +#endif // defined(GL_MAX_TEXTURE_STACK_DEPTH) +#if defined(GL_MAX_TEXTURE_UNITS) + case GL_MAX_TEXTURE_UNITS: +#endif // defined(GL_MAX_TEXTURE_UNITS) +#if defined(GL_MAX_VERTEX_UNITS_OES) + case GL_MAX_VERTEX_UNITS_OES: +#endif // defined(GL_MAX_VERTEX_UNITS_OES) +#if defined(GL_MODELVIEW_STACK_DEPTH) + case GL_MODELVIEW_STACK_DEPTH: +#endif // defined(GL_MODELVIEW_STACK_DEPTH) +#if defined(GL_NORMAL_ARRAY_BUFFER_BINDING) + case GL_NORMAL_ARRAY_BUFFER_BINDING: +#endif // defined(GL_NORMAL_ARRAY_BUFFER_BINDING) +#if defined(GL_NORMAL_ARRAY_STRIDE) + case GL_NORMAL_ARRAY_STRIDE: +#endif // defined(GL_NORMAL_ARRAY_STRIDE) +#if defined(GL_NORMAL_ARRAY_TYPE) + case GL_NORMAL_ARRAY_TYPE: +#endif // defined(GL_NORMAL_ARRAY_TYPE) +#if defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS) + case GL_NUM_COMPRESSED_TEXTURE_FORMATS: +#endif // defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS) +#if defined(GL_PACK_ALIGNMENT) + case GL_PACK_ALIGNMENT: +#endif // defined(GL_PACK_ALIGNMENT) +#if defined(GL_PERSPECTIVE_CORRECTION_HINT) + case GL_PERSPECTIVE_CORRECTION_HINT: +#endif // defined(GL_PERSPECTIVE_CORRECTION_HINT) +#if defined(GL_POINT_SIZE) + case GL_POINT_SIZE: +#endif // defined(GL_POINT_SIZE) +#if defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES) + case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES: +#endif // defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES) +#if defined(GL_POINT_SIZE_ARRAY_STRIDE_OES) + case GL_POINT_SIZE_ARRAY_STRIDE_OES: +#endif // defined(GL_POINT_SIZE_ARRAY_STRIDE_OES) +#if defined(GL_POINT_SIZE_ARRAY_TYPE_OES) + case GL_POINT_SIZE_ARRAY_TYPE_OES: +#endif // defined(GL_POINT_SIZE_ARRAY_TYPE_OES) +#if defined(GL_POINT_SMOOTH_HINT) + case GL_POINT_SMOOTH_HINT: +#endif // defined(GL_POINT_SMOOTH_HINT) +#if defined(GL_POLYGON_OFFSET_FACTOR) + case GL_POLYGON_OFFSET_FACTOR: +#endif // defined(GL_POLYGON_OFFSET_FACTOR) +#if defined(GL_POLYGON_OFFSET_UNITS) + case GL_POLYGON_OFFSET_UNITS: +#endif // defined(GL_POLYGON_OFFSET_UNITS) +#if defined(GL_PROJECTION_STACK_DEPTH) + case GL_PROJECTION_STACK_DEPTH: +#endif // defined(GL_PROJECTION_STACK_DEPTH) +#if defined(GL_RED_BITS) + case GL_RED_BITS: +#endif // defined(GL_RED_BITS) +#if defined(GL_SHADE_MODEL) + case GL_SHADE_MODEL: +#endif // defined(GL_SHADE_MODEL) +#if defined(GL_STENCIL_BITS) + case GL_STENCIL_BITS: +#endif // defined(GL_STENCIL_BITS) +#if defined(GL_STENCIL_CLEAR_VALUE) + case GL_STENCIL_CLEAR_VALUE: +#endif // defined(GL_STENCIL_CLEAR_VALUE) +#if defined(GL_STENCIL_FAIL) + case GL_STENCIL_FAIL: +#endif // defined(GL_STENCIL_FAIL) +#if defined(GL_STENCIL_FUNC) + case GL_STENCIL_FUNC: +#endif // defined(GL_STENCIL_FUNC) +#if defined(GL_STENCIL_PASS_DEPTH_FAIL) + case GL_STENCIL_PASS_DEPTH_FAIL: +#endif // defined(GL_STENCIL_PASS_DEPTH_FAIL) +#if defined(GL_STENCIL_PASS_DEPTH_PASS) + case GL_STENCIL_PASS_DEPTH_PASS: +#endif // defined(GL_STENCIL_PASS_DEPTH_PASS) +#if defined(GL_STENCIL_REF) + case GL_STENCIL_REF: +#endif // defined(GL_STENCIL_REF) +#if defined(GL_STENCIL_VALUE_MASK) + case GL_STENCIL_VALUE_MASK: +#endif // defined(GL_STENCIL_VALUE_MASK) +#if defined(GL_STENCIL_WRITEMASK) + case GL_STENCIL_WRITEMASK: +#endif // defined(GL_STENCIL_WRITEMASK) +#if defined(GL_SUBPIXEL_BITS) + case GL_SUBPIXEL_BITS: +#endif // defined(GL_SUBPIXEL_BITS) +#if defined(GL_TEXTURE_BINDING_2D) + case GL_TEXTURE_BINDING_2D: +#endif // defined(GL_TEXTURE_BINDING_2D) +#if defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING) + case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING: +#endif // defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING) +#if defined(GL_TEXTURE_COORD_ARRAY_SIZE) + case GL_TEXTURE_COORD_ARRAY_SIZE: +#endif // defined(GL_TEXTURE_COORD_ARRAY_SIZE) +#if defined(GL_TEXTURE_COORD_ARRAY_STRIDE) + case GL_TEXTURE_COORD_ARRAY_STRIDE: +#endif // defined(GL_TEXTURE_COORD_ARRAY_STRIDE) +#if defined(GL_TEXTURE_COORD_ARRAY_TYPE) + case GL_TEXTURE_COORD_ARRAY_TYPE: +#endif // defined(GL_TEXTURE_COORD_ARRAY_TYPE) +#if defined(GL_TEXTURE_STACK_DEPTH) + case GL_TEXTURE_STACK_DEPTH: +#endif // defined(GL_TEXTURE_STACK_DEPTH) +#if defined(GL_UNPACK_ALIGNMENT) + case GL_UNPACK_ALIGNMENT: +#endif // defined(GL_UNPACK_ALIGNMENT) +#if defined(GL_VERTEX_ARRAY_BUFFER_BINDING) + case GL_VERTEX_ARRAY_BUFFER_BINDING: +#endif // defined(GL_VERTEX_ARRAY_BUFFER_BINDING) +#if defined(GL_VERTEX_ARRAY_SIZE) + case GL_VERTEX_ARRAY_SIZE: +#endif // defined(GL_VERTEX_ARRAY_SIZE) +#if defined(GL_VERTEX_ARRAY_STRIDE) + case GL_VERTEX_ARRAY_STRIDE: +#endif // defined(GL_VERTEX_ARRAY_STRIDE) +#if defined(GL_VERTEX_ARRAY_TYPE) + case GL_VERTEX_ARRAY_TYPE: +#endif // defined(GL_VERTEX_ARRAY_TYPE) +#if defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES) + case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES: +#endif // defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES) +#if defined(GL_WEIGHT_ARRAY_SIZE_OES) + case GL_WEIGHT_ARRAY_SIZE_OES: +#endif // defined(GL_WEIGHT_ARRAY_SIZE_OES) +#if defined(GL_WEIGHT_ARRAY_STRIDE_OES) + case GL_WEIGHT_ARRAY_STRIDE_OES: +#endif // defined(GL_WEIGHT_ARRAY_STRIDE_OES) +#if defined(GL_WEIGHT_ARRAY_TYPE_OES) + case GL_WEIGHT_ARRAY_TYPE_OES: +#endif // defined(GL_WEIGHT_ARRAY_TYPE_OES) + _needed = 1; + break; +#if defined(GL_ALIASED_POINT_SIZE_RANGE) + case GL_ALIASED_POINT_SIZE_RANGE: +#endif // defined(GL_ALIASED_POINT_SIZE_RANGE) +#if defined(GL_ALIASED_LINE_WIDTH_RANGE) + case GL_ALIASED_LINE_WIDTH_RANGE: +#endif // defined(GL_ALIASED_LINE_WIDTH_RANGE) +#if defined(GL_DEPTH_RANGE) + case GL_DEPTH_RANGE: +#endif // defined(GL_DEPTH_RANGE) +#if defined(GL_MAX_VIEWPORT_DIMS) + case GL_MAX_VIEWPORT_DIMS: +#endif // defined(GL_MAX_VIEWPORT_DIMS) +#if defined(GL_SMOOTH_LINE_WIDTH_RANGE) + case GL_SMOOTH_LINE_WIDTH_RANGE: +#endif // defined(GL_SMOOTH_LINE_WIDTH_RANGE) +#if defined(GL_SMOOTH_POINT_SIZE_RANGE) + case GL_SMOOTH_POINT_SIZE_RANGE: +#endif // defined(GL_SMOOTH_POINT_SIZE_RANGE) + _needed = 2; + break; +#if defined(GL_COLOR_CLEAR_VALUE) + case GL_COLOR_CLEAR_VALUE: +#endif // defined(GL_COLOR_CLEAR_VALUE) +#if defined(GL_COLOR_WRITEMASK) + case GL_COLOR_WRITEMASK: +#endif // defined(GL_COLOR_WRITEMASK) +#if defined(GL_FOG_COLOR) + case GL_FOG_COLOR: +#endif // defined(GL_FOG_COLOR) +#if defined(GL_LIGHT_MODEL_AMBIENT) + case GL_LIGHT_MODEL_AMBIENT: +#endif // defined(GL_LIGHT_MODEL_AMBIENT) +#if defined(GL_SCISSOR_BOX) + case GL_SCISSOR_BOX: +#endif // defined(GL_SCISSOR_BOX) +#if defined(GL_VIEWPORT) + case GL_VIEWPORT: +#endif // defined(GL_VIEWPORT) + _needed = 4; + break; +#if defined(GL_MODELVIEW_MATRIX) + case GL_MODELVIEW_MATRIX: +#endif // defined(GL_MODELVIEW_MATRIX) +#if defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES) + case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES: +#endif // defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES) +#if defined(GL_PROJECTION_MATRIX) + case GL_PROJECTION_MATRIX: +#endif // defined(GL_PROJECTION_MATRIX) +#if defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES) + case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES: +#endif // defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES) +#if defined(GL_TEXTURE_MATRIX) + case GL_TEXTURE_MATRIX: +#endif // defined(GL_TEXTURE_MATRIX) +#if defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES) + case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES: +#endif // defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES) + _needed = 16; + break; +#if defined(GL_COMPRESSED_TEXTURE_FORMATS) + case GL_COMPRESSED_TEXTURE_FORMATS: +#endif // defined(GL_COMPRESSED_TEXTURE_FORMATS) + _needed = getNumCompressedTextureFormats(); + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < needed"); + goto exit; + } + glGetIntegerv( + (GLenum)pname, + (GLint *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +#include <string.h> + +/* const GLubyte * glGetString ( GLenum name ) */ +static +jstring +android_glGetString + (JNIEnv *_env, jobject _this, jint name) { + const char * chars = (const char *)glGetString((GLenum)name); + jstring output = _env->NewStringUTF(chars); + return output; +} +/* void glHint ( GLenum target, GLenum mode ) */ +static void +android_glHint__II + (JNIEnv *_env, jobject _this, jint target, jint mode) { + glHint( + (GLenum)target, + (GLenum)mode + ); +} + +/* void glLightModelf ( GLenum pname, GLfloat param ) */ +static void +android_glLightModelf__IF + (JNIEnv *_env, jobject _this, jint pname, jfloat param) { + glLightModelf( + (GLenum)pname, + (GLfloat)param + ); +} + +/* void glLightModelfv ( GLenum pname, const GLfloat *params ) */ +static void +android_glLightModelfv__I_3FI + (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { + GLfloat *params_base = (GLfloat *) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + int _needed; + switch (pname) { +#if defined(GL_LIGHT_MODEL_TWO_SIDE) + case GL_LIGHT_MODEL_TWO_SIDE: +#endif // defined(GL_LIGHT_MODEL_TWO_SIDE) + _needed = 1; + break; +#if defined(GL_LIGHT_MODEL_AMBIENT) + case GL_LIGHT_MODEL_AMBIENT: +#endif // defined(GL_LIGHT_MODEL_AMBIENT) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "length - offset < needed"); + goto exit; + } + params_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glLightModelfv( + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glLightModelfv ( GLenum pname, const GLfloat *params ) */ +static void +android_glLightModelfv__ILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + int _needed; + switch (pname) { +#if defined(GL_LIGHT_MODEL_TWO_SIDE) + case GL_LIGHT_MODEL_TWO_SIDE: +#endif // defined(GL_LIGHT_MODEL_TWO_SIDE) + _needed = 1; + break; +#if defined(GL_LIGHT_MODEL_AMBIENT) + case GL_LIGHT_MODEL_AMBIENT: +#endif // defined(GL_LIGHT_MODEL_AMBIENT) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "remaining() < needed"); + goto exit; + } + glLightModelfv( + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glLightModelx ( GLenum pname, GLfixed param ) */ +static void +android_glLightModelx__II + (JNIEnv *_env, jobject _this, jint pname, jint param) { + glLightModelx( + (GLenum)pname, + (GLfixed)param + ); +} + +/* void glLightModelxv ( GLenum pname, const GLfixed *params ) */ +static void +android_glLightModelxv__I_3II + (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + int _needed; + switch (pname) { +#if defined(GL_LIGHT_MODEL_TWO_SIDE) + case GL_LIGHT_MODEL_TWO_SIDE: +#endif // defined(GL_LIGHT_MODEL_TWO_SIDE) + _needed = 1; + break; +#if defined(GL_LIGHT_MODEL_AMBIENT) + case GL_LIGHT_MODEL_AMBIENT: +#endif // defined(GL_LIGHT_MODEL_AMBIENT) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "length - offset < needed"); + goto exit; + } + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glLightModelxv( + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glLightModelxv ( GLenum pname, const GLfixed *params ) */ +static void +android_glLightModelxv__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + int _needed; + switch (pname) { +#if defined(GL_LIGHT_MODEL_TWO_SIDE) + case GL_LIGHT_MODEL_TWO_SIDE: +#endif // defined(GL_LIGHT_MODEL_TWO_SIDE) + _needed = 1; + break; +#if defined(GL_LIGHT_MODEL_AMBIENT) + case GL_LIGHT_MODEL_AMBIENT: +#endif // defined(GL_LIGHT_MODEL_AMBIENT) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "remaining() < needed"); + goto exit; + } + glLightModelxv( + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glLightf ( GLenum light, GLenum pname, GLfloat param ) */ +static void +android_glLightf__IIF + (JNIEnv *_env, jobject _this, jint light, jint pname, jfloat param) { + glLightf( + (GLenum)light, + (GLenum)pname, + (GLfloat)param + ); +} + +/* void glLightfv ( GLenum light, GLenum pname, const GLfloat *params ) */ +static void +android_glLightfv__II_3FI + (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) { + GLfloat *params_base = (GLfloat *) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + int _needed; + switch (pname) { +#if defined(GL_SPOT_EXPONENT) + case GL_SPOT_EXPONENT: +#endif // defined(GL_SPOT_EXPONENT) +#if defined(GL_SPOT_CUTOFF) + case GL_SPOT_CUTOFF: +#endif // defined(GL_SPOT_CUTOFF) +#if defined(GL_CONSTANT_ATTENUATION) + case GL_CONSTANT_ATTENUATION: +#endif // defined(GL_CONSTANT_ATTENUATION) +#if defined(GL_LINEAR_ATTENUATION) + case GL_LINEAR_ATTENUATION: +#endif // defined(GL_LINEAR_ATTENUATION) +#if defined(GL_QUADRATIC_ATTENUATION) + case GL_QUADRATIC_ATTENUATION: +#endif // defined(GL_QUADRATIC_ATTENUATION) + _needed = 1; + break; +#if defined(GL_SPOT_DIRECTION) + case GL_SPOT_DIRECTION: +#endif // defined(GL_SPOT_DIRECTION) + _needed = 3; + break; +#if defined(GL_AMBIENT) + case GL_AMBIENT: +#endif // defined(GL_AMBIENT) +#if defined(GL_DIFFUSE) + case GL_DIFFUSE: +#endif // defined(GL_DIFFUSE) +#if defined(GL_SPECULAR) + case GL_SPECULAR: +#endif // defined(GL_SPECULAR) +#if defined(GL_EMISSION) + case GL_EMISSION: +#endif // defined(GL_EMISSION) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "length - offset < needed"); + goto exit; + } + params_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glLightfv( + (GLenum)light, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glLightfv ( GLenum light, GLenum pname, const GLfloat *params ) */ +static void +android_glLightfv__IILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + int _needed; + switch (pname) { +#if defined(GL_SPOT_EXPONENT) + case GL_SPOT_EXPONENT: +#endif // defined(GL_SPOT_EXPONENT) +#if defined(GL_SPOT_CUTOFF) + case GL_SPOT_CUTOFF: +#endif // defined(GL_SPOT_CUTOFF) +#if defined(GL_CONSTANT_ATTENUATION) + case GL_CONSTANT_ATTENUATION: +#endif // defined(GL_CONSTANT_ATTENUATION) +#if defined(GL_LINEAR_ATTENUATION) + case GL_LINEAR_ATTENUATION: +#endif // defined(GL_LINEAR_ATTENUATION) +#if defined(GL_QUADRATIC_ATTENUATION) + case GL_QUADRATIC_ATTENUATION: +#endif // defined(GL_QUADRATIC_ATTENUATION) + _needed = 1; + break; +#if defined(GL_SPOT_DIRECTION) + case GL_SPOT_DIRECTION: +#endif // defined(GL_SPOT_DIRECTION) + _needed = 3; + break; +#if defined(GL_AMBIENT) + case GL_AMBIENT: +#endif // defined(GL_AMBIENT) +#if defined(GL_DIFFUSE) + case GL_DIFFUSE: +#endif // defined(GL_DIFFUSE) +#if defined(GL_SPECULAR) + case GL_SPECULAR: +#endif // defined(GL_SPECULAR) +#if defined(GL_EMISSION) + case GL_EMISSION: +#endif // defined(GL_EMISSION) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "remaining() < needed"); + goto exit; + } + glLightfv( + (GLenum)light, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glLightx ( GLenum light, GLenum pname, GLfixed param ) */ +static void +android_glLightx__III + (JNIEnv *_env, jobject _this, jint light, jint pname, jint param) { + glLightx( + (GLenum)light, + (GLenum)pname, + (GLfixed)param + ); +} + +/* void glLightxv ( GLenum light, GLenum pname, const GLfixed *params ) */ +static void +android_glLightxv__II_3II + (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) { + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + int _needed; + switch (pname) { +#if defined(GL_SPOT_EXPONENT) + case GL_SPOT_EXPONENT: +#endif // defined(GL_SPOT_EXPONENT) +#if defined(GL_SPOT_CUTOFF) + case GL_SPOT_CUTOFF: +#endif // defined(GL_SPOT_CUTOFF) +#if defined(GL_CONSTANT_ATTENUATION) + case GL_CONSTANT_ATTENUATION: +#endif // defined(GL_CONSTANT_ATTENUATION) +#if defined(GL_LINEAR_ATTENUATION) + case GL_LINEAR_ATTENUATION: +#endif // defined(GL_LINEAR_ATTENUATION) +#if defined(GL_QUADRATIC_ATTENUATION) + case GL_QUADRATIC_ATTENUATION: +#endif // defined(GL_QUADRATIC_ATTENUATION) + _needed = 1; + break; +#if defined(GL_SPOT_DIRECTION) + case GL_SPOT_DIRECTION: +#endif // defined(GL_SPOT_DIRECTION) + _needed = 3; + break; +#if defined(GL_AMBIENT) + case GL_AMBIENT: +#endif // defined(GL_AMBIENT) +#if defined(GL_DIFFUSE) + case GL_DIFFUSE: +#endif // defined(GL_DIFFUSE) +#if defined(GL_SPECULAR) + case GL_SPECULAR: +#endif // defined(GL_SPECULAR) +#if defined(GL_EMISSION) + case GL_EMISSION: +#endif // defined(GL_EMISSION) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "length - offset < needed"); + goto exit; + } + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glLightxv( + (GLenum)light, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glLightxv ( GLenum light, GLenum pname, const GLfixed *params ) */ +static void +android_glLightxv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + int _needed; + switch (pname) { +#if defined(GL_SPOT_EXPONENT) + case GL_SPOT_EXPONENT: +#endif // defined(GL_SPOT_EXPONENT) +#if defined(GL_SPOT_CUTOFF) + case GL_SPOT_CUTOFF: +#endif // defined(GL_SPOT_CUTOFF) +#if defined(GL_CONSTANT_ATTENUATION) + case GL_CONSTANT_ATTENUATION: +#endif // defined(GL_CONSTANT_ATTENUATION) +#if defined(GL_LINEAR_ATTENUATION) + case GL_LINEAR_ATTENUATION: +#endif // defined(GL_LINEAR_ATTENUATION) +#if defined(GL_QUADRATIC_ATTENUATION) + case GL_QUADRATIC_ATTENUATION: +#endif // defined(GL_QUADRATIC_ATTENUATION) + _needed = 1; + break; +#if defined(GL_SPOT_DIRECTION) + case GL_SPOT_DIRECTION: +#endif // defined(GL_SPOT_DIRECTION) + _needed = 3; + break; +#if defined(GL_AMBIENT) + case GL_AMBIENT: +#endif // defined(GL_AMBIENT) +#if defined(GL_DIFFUSE) + case GL_DIFFUSE: +#endif // defined(GL_DIFFUSE) +#if defined(GL_SPECULAR) + case GL_SPECULAR: +#endif // defined(GL_SPECULAR) +#if defined(GL_EMISSION) + case GL_EMISSION: +#endif // defined(GL_EMISSION) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "remaining() < needed"); + goto exit; + } + glLightxv( + (GLenum)light, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glLineWidth ( GLfloat width ) */ +static void +android_glLineWidth__F + (JNIEnv *_env, jobject _this, jfloat width) { + glLineWidth( + (GLfloat)width + ); +} + +/* void glLineWidthx ( GLfixed width ) */ +static void +android_glLineWidthx__I + (JNIEnv *_env, jobject _this, jint width) { + glLineWidthx( + (GLfixed)width + ); +} + +/* void glLoadIdentity ( void ) */ +static void +android_glLoadIdentity__ + (JNIEnv *_env, jobject _this) { + glLoadIdentity(); +} + +/* void glLoadMatrixf ( const GLfloat *m ) */ +static void +android_glLoadMatrixf___3FI + (JNIEnv *_env, jobject _this, jfloatArray m_ref, jint offset) { + GLfloat *m_base = (GLfloat *) 0; + jint _remaining; + GLfloat *m = (GLfloat *) 0; + + if (!m_ref) { + _env->ThrowNew(IAEClass, "m == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(m_ref) - offset; + m_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0); + m = m_base + offset; + + glLoadMatrixf( + (GLfloat *)m + ); + +exit: + if (m_base) { + _env->ReleasePrimitiveArrayCritical(m_ref, m_base, + JNI_ABORT); + } +} + +/* void glLoadMatrixf ( const GLfloat *m ) */ +static void +android_glLoadMatrixf__Ljava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jobject m_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *m = (GLfloat *) 0; + + m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining); + glLoadMatrixf( + (GLfloat *)m + ); + if (_array) { + releasePointer(_env, _array, m, JNI_FALSE); + } +} + +/* void glLoadMatrixx ( const GLfixed *m ) */ +static void +android_glLoadMatrixx___3II + (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) { + GLfixed *m_base = (GLfixed *) 0; + jint _remaining; + GLfixed *m = (GLfixed *) 0; + + if (!m_ref) { + _env->ThrowNew(IAEClass, "m == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(m_ref) - offset; + m_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0); + m = m_base + offset; + + glLoadMatrixx( + (GLfixed *)m + ); + +exit: + if (m_base) { + _env->ReleasePrimitiveArrayCritical(m_ref, m_base, + JNI_ABORT); + } +} + +/* void glLoadMatrixx ( const GLfixed *m ) */ +static void +android_glLoadMatrixx__Ljava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jobject m_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *m = (GLfixed *) 0; + + m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining); + glLoadMatrixx( + (GLfixed *)m + ); + if (_array) { + releasePointer(_env, _array, m, JNI_FALSE); + } +} + +/* void glLogicOp ( GLenum opcode ) */ +static void +android_glLogicOp__I + (JNIEnv *_env, jobject _this, jint opcode) { + glLogicOp( + (GLenum)opcode + ); +} + +/* void glMaterialf ( GLenum face, GLenum pname, GLfloat param ) */ +static void +android_glMaterialf__IIF + (JNIEnv *_env, jobject _this, jint face, jint pname, jfloat param) { + glMaterialf( + (GLenum)face, + (GLenum)pname, + (GLfloat)param + ); +} + +/* void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) */ +static void +android_glMaterialfv__II_3FI + (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) { + GLfloat *params_base = (GLfloat *) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + int _needed; + switch (pname) { +#if defined(GL_SHININESS) + case GL_SHININESS: +#endif // defined(GL_SHININESS) + _needed = 1; + break; +#if defined(GL_AMBIENT) + case GL_AMBIENT: +#endif // defined(GL_AMBIENT) +#if defined(GL_DIFFUSE) + case GL_DIFFUSE: +#endif // defined(GL_DIFFUSE) +#if defined(GL_SPECULAR) + case GL_SPECULAR: +#endif // defined(GL_SPECULAR) +#if defined(GL_EMISSION) + case GL_EMISSION: +#endif // defined(GL_EMISSION) +#if defined(GL_AMBIENT_AND_DIFFUSE) + case GL_AMBIENT_AND_DIFFUSE: +#endif // defined(GL_AMBIENT_AND_DIFFUSE) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "length - offset < needed"); + goto exit; + } + params_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glMaterialfv( + (GLenum)face, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) */ +static void +android_glMaterialfv__IILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + int _needed; + switch (pname) { +#if defined(GL_SHININESS) + case GL_SHININESS: +#endif // defined(GL_SHININESS) + _needed = 1; + break; +#if defined(GL_AMBIENT) + case GL_AMBIENT: +#endif // defined(GL_AMBIENT) +#if defined(GL_DIFFUSE) + case GL_DIFFUSE: +#endif // defined(GL_DIFFUSE) +#if defined(GL_SPECULAR) + case GL_SPECULAR: +#endif // defined(GL_SPECULAR) +#if defined(GL_EMISSION) + case GL_EMISSION: +#endif // defined(GL_EMISSION) +#if defined(GL_AMBIENT_AND_DIFFUSE) + case GL_AMBIENT_AND_DIFFUSE: +#endif // defined(GL_AMBIENT_AND_DIFFUSE) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "remaining() < needed"); + goto exit; + } + glMaterialfv( + (GLenum)face, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glMaterialx ( GLenum face, GLenum pname, GLfixed param ) */ +static void +android_glMaterialx__III + (JNIEnv *_env, jobject _this, jint face, jint pname, jint param) { + glMaterialx( + (GLenum)face, + (GLenum)pname, + (GLfixed)param + ); +} + +/* void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params ) */ +static void +android_glMaterialxv__II_3II + (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) { + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + int _needed; + switch (pname) { +#if defined(GL_SHININESS) + case GL_SHININESS: +#endif // defined(GL_SHININESS) + _needed = 1; + break; +#if defined(GL_AMBIENT) + case GL_AMBIENT: +#endif // defined(GL_AMBIENT) +#if defined(GL_DIFFUSE) + case GL_DIFFUSE: +#endif // defined(GL_DIFFUSE) +#if defined(GL_SPECULAR) + case GL_SPECULAR: +#endif // defined(GL_SPECULAR) +#if defined(GL_EMISSION) + case GL_EMISSION: +#endif // defined(GL_EMISSION) +#if defined(GL_AMBIENT_AND_DIFFUSE) + case GL_AMBIENT_AND_DIFFUSE: +#endif // defined(GL_AMBIENT_AND_DIFFUSE) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "length - offset < needed"); + goto exit; + } + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glMaterialxv( + (GLenum)face, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params ) */ +static void +android_glMaterialxv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + int _needed; + switch (pname) { +#if defined(GL_SHININESS) + case GL_SHININESS: +#endif // defined(GL_SHININESS) + _needed = 1; + break; +#if defined(GL_AMBIENT) + case GL_AMBIENT: +#endif // defined(GL_AMBIENT) +#if defined(GL_DIFFUSE) + case GL_DIFFUSE: +#endif // defined(GL_DIFFUSE) +#if defined(GL_SPECULAR) + case GL_SPECULAR: +#endif // defined(GL_SPECULAR) +#if defined(GL_EMISSION) + case GL_EMISSION: +#endif // defined(GL_EMISSION) +#if defined(GL_AMBIENT_AND_DIFFUSE) + case GL_AMBIENT_AND_DIFFUSE: +#endif // defined(GL_AMBIENT_AND_DIFFUSE) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "remaining() < needed"); + goto exit; + } + glMaterialxv( + (GLenum)face, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glMatrixMode ( GLenum mode ) */ +static void +android_glMatrixMode__I + (JNIEnv *_env, jobject _this, jint mode) { + glMatrixMode( + (GLenum)mode + ); +} + +/* void glMultMatrixf ( const GLfloat *m ) */ +static void +android_glMultMatrixf___3FI + (JNIEnv *_env, jobject _this, jfloatArray m_ref, jint offset) { + GLfloat *m_base = (GLfloat *) 0; + jint _remaining; + GLfloat *m = (GLfloat *) 0; + + if (!m_ref) { + _env->ThrowNew(IAEClass, "m == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(m_ref) - offset; + m_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0); + m = m_base + offset; + + glMultMatrixf( + (GLfloat *)m + ); + +exit: + if (m_base) { + _env->ReleasePrimitiveArrayCritical(m_ref, m_base, + JNI_ABORT); + } +} + +/* void glMultMatrixf ( const GLfloat *m ) */ +static void +android_glMultMatrixf__Ljava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jobject m_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *m = (GLfloat *) 0; + + m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining); + glMultMatrixf( + (GLfloat *)m + ); + if (_array) { + releasePointer(_env, _array, m, JNI_FALSE); + } +} + +/* void glMultMatrixx ( const GLfixed *m ) */ +static void +android_glMultMatrixx___3II + (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) { + GLfixed *m_base = (GLfixed *) 0; + jint _remaining; + GLfixed *m = (GLfixed *) 0; + + if (!m_ref) { + _env->ThrowNew(IAEClass, "m == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(m_ref) - offset; + m_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0); + m = m_base + offset; + + glMultMatrixx( + (GLfixed *)m + ); + +exit: + if (m_base) { + _env->ReleasePrimitiveArrayCritical(m_ref, m_base, + JNI_ABORT); + } +} + +/* void glMultMatrixx ( const GLfixed *m ) */ +static void +android_glMultMatrixx__Ljava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jobject m_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *m = (GLfixed *) 0; + + m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining); + glMultMatrixx( + (GLfixed *)m + ); + if (_array) { + releasePointer(_env, _array, m, JNI_FALSE); + } +} + +/* void glMultiTexCoord4f ( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ) */ +static void +android_glMultiTexCoord4f__IFFFF + (JNIEnv *_env, jobject _this, jint target, jfloat s, jfloat t, jfloat r, jfloat q) { + glMultiTexCoord4f( + (GLenum)target, + (GLfloat)s, + (GLfloat)t, + (GLfloat)r, + (GLfloat)q + ); +} + +/* void glMultiTexCoord4x ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q ) */ +static void +android_glMultiTexCoord4x__IIIII + (JNIEnv *_env, jobject _this, jint target, jint s, jint t, jint r, jint q) { + glMultiTexCoord4x( + (GLenum)target, + (GLfixed)s, + (GLfixed)t, + (GLfixed)r, + (GLfixed)q + ); +} + +/* void glNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz ) */ +static void +android_glNormal3f__FFF + (JNIEnv *_env, jobject _this, jfloat nx, jfloat ny, jfloat nz) { + glNormal3f( + (GLfloat)nx, + (GLfloat)ny, + (GLfloat)nz + ); +} + +/* void glNormal3x ( GLfixed nx, GLfixed ny, GLfixed nz ) */ +static void +android_glNormal3x__III + (JNIEnv *_env, jobject _this, jint nx, jint ny, jint nz) { + glNormal3x( + (GLfixed)nx, + (GLfixed)ny, + (GLfixed)nz + ); +} + +/* void glNormalPointer ( GLenum type, GLsizei stride, const GLvoid *pointer ) */ +static void +android_glNormalPointerBounds__IILjava_nio_Buffer_2I + (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *pointer = (GLvoid *) 0; + + if (pointer_buf) { + pointer = (GLvoid *) _env->GetDirectBufferAddress(pointer_buf); + if ( ! pointer ) { + _env->ThrowNew(IAEClass, "Must use a native order direct Buffer"); + return; + } + } + glNormalPointerBounds( + (GLenum)type, + (GLsizei)stride, + (GLvoid *)pointer, + (GLsizei)remaining + ); +} + +/* void glOrthof ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */ +static void +android_glOrthof__FFFFFF + (JNIEnv *_env, jobject _this, jfloat left, jfloat right, jfloat bottom, jfloat top, jfloat zNear, jfloat zFar) { + glOrthof( + (GLfloat)left, + (GLfloat)right, + (GLfloat)bottom, + (GLfloat)top, + (GLfloat)zNear, + (GLfloat)zFar + ); +} + +/* void glOrthox ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) */ +static void +android_glOrthox__IIIIII + (JNIEnv *_env, jobject _this, jint left, jint right, jint bottom, jint top, jint zNear, jint zFar) { + glOrthox( + (GLfixed)left, + (GLfixed)right, + (GLfixed)bottom, + (GLfixed)top, + (GLfixed)zNear, + (GLfixed)zFar + ); +} + +/* void glPixelStorei ( GLenum pname, GLint param ) */ +static void +android_glPixelStorei__II + (JNIEnv *_env, jobject _this, jint pname, jint param) { + glPixelStorei( + (GLenum)pname, + (GLint)param + ); +} + +/* void glPointSize ( GLfloat size ) */ +static void +android_glPointSize__F + (JNIEnv *_env, jobject _this, jfloat size) { + glPointSize( + (GLfloat)size + ); +} + +/* void glPointSizex ( GLfixed size ) */ +static void +android_glPointSizex__I + (JNIEnv *_env, jobject _this, jint size) { + glPointSizex( + (GLfixed)size + ); +} + +/* void glPolygonOffset ( GLfloat factor, GLfloat units ) */ +static void +android_glPolygonOffset__FF + (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) { + glPolygonOffset( + (GLfloat)factor, + (GLfloat)units + ); +} + +/* void glPolygonOffsetx ( GLfixed factor, GLfixed units ) */ +static void +android_glPolygonOffsetx__II + (JNIEnv *_env, jobject _this, jint factor, jint units) { + glPolygonOffsetx( + (GLfixed)factor, + (GLfixed)units + ); +} + +/* void glPopMatrix ( void ) */ +static void +android_glPopMatrix__ + (JNIEnv *_env, jobject _this) { + glPopMatrix(); +} + +/* void glPushMatrix ( void ) */ +static void +android_glPushMatrix__ + (JNIEnv *_env, jobject _this) { + glPushMatrix(); +} + +/* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */ +static void +android_glReadPixels__IIIIIILjava_nio_Buffer_2 + (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *pixels = (GLvoid *) 0; + + pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining); + glReadPixels( + (GLint)x, + (GLint)y, + (GLsizei)width, + (GLsizei)height, + (GLenum)format, + (GLenum)type, + (GLvoid *)pixels + ); + if (_array) { + releasePointer(_env, _array, pixels, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) */ +static void +android_glRotatef__FFFF + (JNIEnv *_env, jobject _this, jfloat angle, jfloat x, jfloat y, jfloat z) { + glRotatef( + (GLfloat)angle, + (GLfloat)x, + (GLfloat)y, + (GLfloat)z + ); +} + +/* void glRotatex ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z ) */ +static void +android_glRotatex__IIII + (JNIEnv *_env, jobject _this, jint angle, jint x, jint y, jint z) { + glRotatex( + (GLfixed)angle, + (GLfixed)x, + (GLfixed)y, + (GLfixed)z + ); +} + +/* void glSampleCoverage ( GLclampf value, GLboolean invert ) */ +static void +android_glSampleCoverage__FZ + (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) { + glSampleCoverage( + (GLclampf)value, + (GLboolean)invert + ); +} + +/* void glSampleCoveragex ( GLclampx value, GLboolean invert ) */ +static void +android_glSampleCoveragex__IZ + (JNIEnv *_env, jobject _this, jint value, jboolean invert) { + glSampleCoveragex( + (GLclampx)value, + (GLboolean)invert + ); +} + +/* void glScalef ( GLfloat x, GLfloat y, GLfloat z ) */ +static void +android_glScalef__FFF + (JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat z) { + glScalef( + (GLfloat)x, + (GLfloat)y, + (GLfloat)z + ); +} + +/* void glScalex ( GLfixed x, GLfixed y, GLfixed z ) */ +static void +android_glScalex__III + (JNIEnv *_env, jobject _this, jint x, jint y, jint z) { + glScalex( + (GLfixed)x, + (GLfixed)y, + (GLfixed)z + ); +} + +/* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */ +static void +android_glScissor__IIII + (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) { + glScissor( + (GLint)x, + (GLint)y, + (GLsizei)width, + (GLsizei)height + ); +} + +/* void glShadeModel ( GLenum mode ) */ +static void +android_glShadeModel__I + (JNIEnv *_env, jobject _this, jint mode) { + glShadeModel( + (GLenum)mode + ); +} + +/* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */ +static void +android_glStencilFunc__III + (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) { + glStencilFunc( + (GLenum)func, + (GLint)ref, + (GLuint)mask + ); +} + +/* void glStencilMask ( GLuint mask ) */ +static void +android_glStencilMask__I + (JNIEnv *_env, jobject _this, jint mask) { + glStencilMask( + (GLuint)mask + ); +} + +/* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */ +static void +android_glStencilOp__III + (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) { + glStencilOp( + (GLenum)fail, + (GLenum)zfail, + (GLenum)zpass + ); +} + +/* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */ +static void +android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I + (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *pointer = (GLvoid *) 0; + + if (pointer_buf) { + pointer = (GLvoid *) _env->GetDirectBufferAddress(pointer_buf); + if ( ! pointer ) { + _env->ThrowNew(IAEClass, "Must use a native order direct Buffer"); + return; + } + } + glTexCoordPointerBounds( + (GLint)size, + (GLenum)type, + (GLsizei)stride, + (GLvoid *)pointer, + (GLsizei)remaining + ); +} + +/* void glTexEnvf ( GLenum target, GLenum pname, GLfloat param ) */ +static void +android_glTexEnvf__IIF + (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) { + glTexEnvf( + (GLenum)target, + (GLenum)pname, + (GLfloat)param + ); +} + +/* void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) */ +static void +android_glTexEnvfv__II_3FI + (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) { + GLfloat *params_base = (GLfloat *) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + int _needed; + switch (pname) { +#if defined(GL_TEXTURE_ENV_MODE) + case GL_TEXTURE_ENV_MODE: +#endif // defined(GL_TEXTURE_ENV_MODE) +#if defined(GL_COMBINE_RGB) + case GL_COMBINE_RGB: +#endif // defined(GL_COMBINE_RGB) +#if defined(GL_COMBINE_ALPHA) + case GL_COMBINE_ALPHA: +#endif // defined(GL_COMBINE_ALPHA) + _needed = 1; + break; +#if defined(GL_TEXTURE_ENV_COLOR) + case GL_TEXTURE_ENV_COLOR: +#endif // defined(GL_TEXTURE_ENV_COLOR) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "length - offset < needed"); + goto exit; + } + params_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glTexEnvfv( + (GLenum)target, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) */ +static void +android_glTexEnvfv__IILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + int _needed; + switch (pname) { +#if defined(GL_TEXTURE_ENV_MODE) + case GL_TEXTURE_ENV_MODE: +#endif // defined(GL_TEXTURE_ENV_MODE) +#if defined(GL_COMBINE_RGB) + case GL_COMBINE_RGB: +#endif // defined(GL_COMBINE_RGB) +#if defined(GL_COMBINE_ALPHA) + case GL_COMBINE_ALPHA: +#endif // defined(GL_COMBINE_ALPHA) + _needed = 1; + break; +#if defined(GL_TEXTURE_ENV_COLOR) + case GL_TEXTURE_ENV_COLOR: +#endif // defined(GL_TEXTURE_ENV_COLOR) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "remaining() < needed"); + goto exit; + } + glTexEnvfv( + (GLenum)target, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glTexEnvx ( GLenum target, GLenum pname, GLfixed param ) */ +static void +android_glTexEnvx__III + (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) { + glTexEnvx( + (GLenum)target, + (GLenum)pname, + (GLfixed)param + ); +} + +/* void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params ) */ +static void +android_glTexEnvxv__II_3II + (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + int _needed; + switch (pname) { +#if defined(GL_TEXTURE_ENV_MODE) + case GL_TEXTURE_ENV_MODE: +#endif // defined(GL_TEXTURE_ENV_MODE) +#if defined(GL_COMBINE_RGB) + case GL_COMBINE_RGB: +#endif // defined(GL_COMBINE_RGB) +#if defined(GL_COMBINE_ALPHA) + case GL_COMBINE_ALPHA: +#endif // defined(GL_COMBINE_ALPHA) + _needed = 1; + break; +#if defined(GL_TEXTURE_ENV_COLOR) + case GL_TEXTURE_ENV_COLOR: +#endif // defined(GL_TEXTURE_ENV_COLOR) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "length - offset < needed"); + goto exit; + } + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glTexEnvxv( + (GLenum)target, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params ) */ +static void +android_glTexEnvxv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + int _needed; + switch (pname) { +#if defined(GL_TEXTURE_ENV_MODE) + case GL_TEXTURE_ENV_MODE: +#endif // defined(GL_TEXTURE_ENV_MODE) +#if defined(GL_COMBINE_RGB) + case GL_COMBINE_RGB: +#endif // defined(GL_COMBINE_RGB) +#if defined(GL_COMBINE_ALPHA) + case GL_COMBINE_ALPHA: +#endif // defined(GL_COMBINE_ALPHA) + _needed = 1; + break; +#if defined(GL_TEXTURE_ENV_COLOR) + case GL_TEXTURE_ENV_COLOR: +#endif // defined(GL_TEXTURE_ENV_COLOR) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "remaining() < needed"); + goto exit; + } + glTexEnvxv( + (GLenum)target, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */ +static void +android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 + (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *pixels = (GLvoid *) 0; + + if (pixels_buf) { + pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining); + } + glTexImage2D( + (GLenum)target, + (GLint)level, + (GLint)internalformat, + (GLsizei)width, + (GLsizei)height, + (GLint)border, + (GLenum)format, + (GLenum)type, + (GLvoid *)pixels + ); + if (_array) { + releasePointer(_env, _array, pixels, JNI_FALSE); + } +} + +/* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */ +static void +android_glTexParameterf__IIF + (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) { + glTexParameterf( + (GLenum)target, + (GLenum)pname, + (GLfloat)param + ); +} + +/* void glTexParameterx ( GLenum target, GLenum pname, GLfixed param ) */ +static void +android_glTexParameterx__III + (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) { + glTexParameterx( + (GLenum)target, + (GLenum)pname, + (GLfixed)param + ); +} + +/* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */ +static void +android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 + (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *pixels = (GLvoid *) 0; + + if (pixels_buf) { + pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining); + } + glTexSubImage2D( + (GLenum)target, + (GLint)level, + (GLint)xoffset, + (GLint)yoffset, + (GLsizei)width, + (GLsizei)height, + (GLenum)format, + (GLenum)type, + (GLvoid *)pixels + ); + if (_array) { + releasePointer(_env, _array, pixels, JNI_FALSE); + } +} + +/* void glTranslatef ( GLfloat x, GLfloat y, GLfloat z ) */ +static void +android_glTranslatef__FFF + (JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat z) { + glTranslatef( + (GLfloat)x, + (GLfloat)y, + (GLfloat)z + ); +} + +/* void glTranslatex ( GLfixed x, GLfixed y, GLfixed z ) */ +static void +android_glTranslatex__III + (JNIEnv *_env, jobject _this, jint x, jint y, jint z) { + glTranslatex( + (GLfixed)x, + (GLfixed)y, + (GLfixed)z + ); +} + +/* void glVertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */ +static void +android_glVertexPointerBounds__IIILjava_nio_Buffer_2I + (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *pointer = (GLvoid *) 0; + + if (pointer_buf) { + pointer = (GLvoid *) _env->GetDirectBufferAddress(pointer_buf); + if ( ! pointer ) { + _env->ThrowNew(IAEClass, "Must use a native order direct Buffer"); + return; + } + } + glVertexPointerBounds( + (GLint)size, + (GLenum)type, + (GLsizei)stride, + (GLvoid *)pointer, + (GLsizei)remaining + ); +} + +/* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */ +static void +android_glViewport__IIII + (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) { + glViewport( + (GLint)x, + (GLint)y, + (GLsizei)width, + (GLsizei)height + ); +} + +static const char *classPathName = "android/opengl/GLES10"; + +static JNINativeMethod methods[] = { +{"_nativeClassInit", "()V", (void*)nativeClassInit }, +{"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I }, +{"glAlphaFunc", "(IF)V", (void *) android_glAlphaFunc__IF }, +{"glAlphaFuncx", "(II)V", (void *) android_glAlphaFuncx__II }, +{"glBindTexture", "(II)V", (void *) android_glBindTexture__II }, +{"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II }, +{"glClear", "(I)V", (void *) android_glClear__I }, +{"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF }, +{"glClearColorx", "(IIII)V", (void *) android_glClearColorx__IIII }, +{"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F }, +{"glClearDepthx", "(I)V", (void *) android_glClearDepthx__I }, +{"glClearStencil", "(I)V", (void *) android_glClearStencil__I }, +{"glClientActiveTexture", "(I)V", (void *) android_glClientActiveTexture__I }, +{"glColor4f", "(FFFF)V", (void *) android_glColor4f__FFFF }, +{"glColor4x", "(IIII)V", (void *) android_glColor4x__IIII }, +{"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ }, +{"glColorPointerBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glColorPointerBounds__IIILjava_nio_Buffer_2I }, +{"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 }, +{"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 }, +{"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII }, +{"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII }, +{"glCullFace", "(I)V", (void *) android_glCullFace__I }, +{"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II }, +{"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 }, +{"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I }, +{"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z }, +{"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF }, +{"glDepthRangex", "(II)V", (void *) android_glDepthRangex__II }, +{"glDisable", "(I)V", (void *) android_glDisable__I }, +{"glDisableClientState", "(I)V", (void *) android_glDisableClientState__I }, +{"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III }, +{"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 }, +{"glEnable", "(I)V", (void *) android_glEnable__I }, +{"glEnableClientState", "(I)V", (void *) android_glEnableClientState__I }, +{"glFinish", "()V", (void *) android_glFinish__ }, +{"glFlush", "()V", (void *) android_glFlush__ }, +{"glFogf", "(IF)V", (void *) android_glFogf__IF }, +{"glFogfv", "(I[FI)V", (void *) android_glFogfv__I_3FI }, +{"glFogfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glFogfv__ILjava_nio_FloatBuffer_2 }, +{"glFogx", "(II)V", (void *) android_glFogx__II }, +{"glFogxv", "(I[II)V", (void *) android_glFogxv__I_3II }, +{"glFogxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glFogxv__ILjava_nio_IntBuffer_2 }, +{"glFrontFace", "(I)V", (void *) android_glFrontFace__I }, +{"glFrustumf", "(FFFFFF)V", (void *) android_glFrustumf__FFFFFF }, +{"glFrustumx", "(IIIIII)V", (void *) android_glFrustumx__IIIIII }, +{"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II }, +{"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 }, +{"glGetError", "()I", (void *) android_glGetError__ }, +{"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II }, +{"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 }, +{"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString }, +{"glHint", "(II)V", (void *) android_glHint__II }, +{"glLightModelf", "(IF)V", (void *) android_glLightModelf__IF }, +{"glLightModelfv", "(I[FI)V", (void *) android_glLightModelfv__I_3FI }, +{"glLightModelfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glLightModelfv__ILjava_nio_FloatBuffer_2 }, +{"glLightModelx", "(II)V", (void *) android_glLightModelx__II }, +{"glLightModelxv", "(I[II)V", (void *) android_glLightModelxv__I_3II }, +{"glLightModelxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glLightModelxv__ILjava_nio_IntBuffer_2 }, +{"glLightf", "(IIF)V", (void *) android_glLightf__IIF }, +{"glLightfv", "(II[FI)V", (void *) android_glLightfv__II_3FI }, +{"glLightfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glLightfv__IILjava_nio_FloatBuffer_2 }, +{"glLightx", "(III)V", (void *) android_glLightx__III }, +{"glLightxv", "(II[II)V", (void *) android_glLightxv__II_3II }, +{"glLightxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glLightxv__IILjava_nio_IntBuffer_2 }, +{"glLineWidth", "(F)V", (void *) android_glLineWidth__F }, +{"glLineWidthx", "(I)V", (void *) android_glLineWidthx__I }, +{"glLoadIdentity", "()V", (void *) android_glLoadIdentity__ }, +{"glLoadMatrixf", "([FI)V", (void *) android_glLoadMatrixf___3FI }, +{"glLoadMatrixf", "(Ljava/nio/FloatBuffer;)V", (void *) android_glLoadMatrixf__Ljava_nio_FloatBuffer_2 }, +{"glLoadMatrixx", "([II)V", (void *) android_glLoadMatrixx___3II }, +{"glLoadMatrixx", "(Ljava/nio/IntBuffer;)V", (void *) android_glLoadMatrixx__Ljava_nio_IntBuffer_2 }, +{"glLogicOp", "(I)V", (void *) android_glLogicOp__I }, +{"glMaterialf", "(IIF)V", (void *) android_glMaterialf__IIF }, +{"glMaterialfv", "(II[FI)V", (void *) android_glMaterialfv__II_3FI }, +{"glMaterialfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glMaterialfv__IILjava_nio_FloatBuffer_2 }, +{"glMaterialx", "(III)V", (void *) android_glMaterialx__III }, +{"glMaterialxv", "(II[II)V", (void *) android_glMaterialxv__II_3II }, +{"glMaterialxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glMaterialxv__IILjava_nio_IntBuffer_2 }, +{"glMatrixMode", "(I)V", (void *) android_glMatrixMode__I }, +{"glMultMatrixf", "([FI)V", (void *) android_glMultMatrixf___3FI }, +{"glMultMatrixf", "(Ljava/nio/FloatBuffer;)V", (void *) android_glMultMatrixf__Ljava_nio_FloatBuffer_2 }, +{"glMultMatrixx", "([II)V", (void *) android_glMultMatrixx___3II }, +{"glMultMatrixx", "(Ljava/nio/IntBuffer;)V", (void *) android_glMultMatrixx__Ljava_nio_IntBuffer_2 }, +{"glMultiTexCoord4f", "(IFFFF)V", (void *) android_glMultiTexCoord4f__IFFFF }, +{"glMultiTexCoord4x", "(IIIII)V", (void *) android_glMultiTexCoord4x__IIIII }, +{"glNormal3f", "(FFF)V", (void *) android_glNormal3f__FFF }, +{"glNormal3x", "(III)V", (void *) android_glNormal3x__III }, +{"glNormalPointerBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glNormalPointerBounds__IILjava_nio_Buffer_2I }, +{"glOrthof", "(FFFFFF)V", (void *) android_glOrthof__FFFFFF }, +{"glOrthox", "(IIIIII)V", (void *) android_glOrthox__IIIIII }, +{"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II }, +{"glPointSize", "(F)V", (void *) android_glPointSize__F }, +{"glPointSizex", "(I)V", (void *) android_glPointSizex__I }, +{"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF }, +{"glPolygonOffsetx", "(II)V", (void *) android_glPolygonOffsetx__II }, +{"glPopMatrix", "()V", (void *) android_glPopMatrix__ }, +{"glPushMatrix", "()V", (void *) android_glPushMatrix__ }, +{"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 }, +{"glRotatef", "(FFFF)V", (void *) android_glRotatef__FFFF }, +{"glRotatex", "(IIII)V", (void *) android_glRotatex__IIII }, +{"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ }, +{"glSampleCoveragex", "(IZ)V", (void *) android_glSampleCoveragex__IZ }, +{"glScalef", "(FFF)V", (void *) android_glScalef__FFF }, +{"glScalex", "(III)V", (void *) android_glScalex__III }, +{"glScissor", "(IIII)V", (void *) android_glScissor__IIII }, +{"glShadeModel", "(I)V", (void *) android_glShadeModel__I }, +{"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III }, +{"glStencilMask", "(I)V", (void *) android_glStencilMask__I }, +{"glStencilOp", "(III)V", (void *) android_glStencilOp__III }, +{"glTexCoordPointerBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I }, +{"glTexEnvf", "(IIF)V", (void *) android_glTexEnvf__IIF }, +{"glTexEnvfv", "(II[FI)V", (void *) android_glTexEnvfv__II_3FI }, +{"glTexEnvfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexEnvfv__IILjava_nio_FloatBuffer_2 }, +{"glTexEnvx", "(III)V", (void *) android_glTexEnvx__III }, +{"glTexEnvxv", "(II[II)V", (void *) android_glTexEnvxv__II_3II }, +{"glTexEnvxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexEnvxv__IILjava_nio_IntBuffer_2 }, +{"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 }, +{"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF }, +{"glTexParameterx", "(III)V", (void *) android_glTexParameterx__III }, +{"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 }, +{"glTranslatef", "(FFF)V", (void *) android_glTranslatef__FFF }, +{"glTranslatex", "(III)V", (void *) android_glTranslatex__III }, +{"glVertexPointerBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glVertexPointerBounds__IIILjava_nio_Buffer_2I }, +{"glViewport", "(IIII)V", (void *) android_glViewport__IIII }, +}; + +int register_android_opengl_jni_GLES10(JNIEnv *_env) +{ + int err; + err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods)); + return err; +} diff --git a/core/jni/android_opengl_GLES10Ext.cpp b/core/jni/android_opengl_GLES10Ext.cpp new file mode 100644 index 0000000..f17ef21 --- /dev/null +++ b/core/jni/android_opengl_GLES10Ext.cpp @@ -0,0 +1,250 @@ +/* +** +** Copyright 2009, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +// This source file is automatically generated + +#include <android_runtime/AndroidRuntime.h> +#include <utils/misc.h> + +#include <assert.h> +#include <GLES/gl.h> +#include <GLES/glext.h> + +static int initialized = 0; + +static jclass nioAccessClass; +static jclass bufferClass; +static jclass OOMEClass; +static jclass UOEClass; +static jclass IAEClass; +static jclass AIOOBEClass; +static jmethodID getBasePointerID; +static jmethodID getBaseArrayID; +static jmethodID getBaseArrayOffsetID; +static jfieldID positionID; +static jfieldID limitID; +static jfieldID elementSizeShiftID; + +/* Cache method IDs each time the class is loaded. */ + +static void +nativeClassInitBuffer(JNIEnv *_env) +{ + jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); + nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); + + jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); + bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); + + getBasePointerID = _env->GetStaticMethodID(nioAccessClass, + "getBasePointer", "(Ljava/nio/Buffer;)J"); + getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); + getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); + + positionID = _env->GetFieldID(bufferClass, "position", "I"); + limitID = _env->GetFieldID(bufferClass, "limit", "I"); + elementSizeShiftID = + _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); +} + + +static void +nativeClassInit(JNIEnv *_env, jclass glImplClass) +{ + nativeClassInitBuffer(_env); + + jclass IAEClassLocal = + _env->FindClass("java/lang/IllegalArgumentException"); + jclass OOMEClassLocal = + _env->FindClass("java/lang/OutOfMemoryError"); + jclass UOEClassLocal = + _env->FindClass("java/lang/UnsupportedOperationException"); + jclass AIOOBEClassLocal = + _env->FindClass("java/lang/ArrayIndexOutOfBoundsException"); + + IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal); + OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal); + UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal); + AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal); +} + +static void * +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +{ + jint position; + jint limit; + jint elementSizeShift; + jlong pointer; + jint offset; + void *data; + + position = _env->GetIntField(buffer, positionID); + limit = _env->GetIntField(buffer, limitID); + elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + *remaining = (limit - position) << elementSizeShift; + pointer = _env->CallStaticLongMethod(nioAccessClass, + getBasePointerID, buffer); + if (pointer != 0L) { + *array = NULL; + return (void *) (jint) pointer; + } + + *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, + getBaseArrayID, buffer); + offset = _env->CallStaticIntMethod(nioAccessClass, + getBaseArrayOffsetID, buffer); + data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); + + return (void *) ((char *) data + offset); +} + + +static void +releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) +{ + _env->ReleasePrimitiveArrayCritical(array, data, + commit ? 0 : JNI_ABORT); +} + +// -------------------------------------------------------------------------- + +/* GLbitfield glQueryMatrixxOES ( GLfixed *mantissa, GLint *exponent ) */ +static jint +android_glQueryMatrixxOES___3II_3II + (JNIEnv *_env, jobject _this, jintArray mantissa_ref, jint mantissaOffset, jintArray exponent_ref, jint exponentOffset) { + jint _exception = 0; + GLbitfield _returnValue = -1; + GLfixed *mantissa_base = (GLfixed *) 0; + jint _mantissaRemaining; + GLfixed *mantissa = (GLfixed *) 0; + GLint *exponent_base = (GLint *) 0; + jint _exponentRemaining; + GLint *exponent = (GLint *) 0; + + if (!mantissa_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "mantissa == null"); + goto exit; + } + if (mantissaOffset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "mantissaOffset < 0"); + goto exit; + } + _mantissaRemaining = _env->GetArrayLength(mantissa_ref) - mantissaOffset; + if (_mantissaRemaining < 16) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - mantissaOffset < 16"); + goto exit; + } + mantissa_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(mantissa_ref, (jboolean *)0); + mantissa = mantissa_base + mantissaOffset; + + if (!exponent_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "exponent == null"); + goto exit; + } + if (exponentOffset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "exponentOffset < 0"); + goto exit; + } + _exponentRemaining = _env->GetArrayLength(exponent_ref) - exponentOffset; + if (_exponentRemaining < 16) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - exponentOffset < 16"); + goto exit; + } + exponent_base = (GLint *) + _env->GetPrimitiveArrayCritical(exponent_ref, (jboolean *)0); + exponent = exponent_base + exponentOffset; + + _returnValue = glQueryMatrixxOES( + (GLfixed *)mantissa, + (GLint *)exponent + ); + +exit: + if (exponent_base) { + _env->ReleasePrimitiveArrayCritical(exponent_ref, exponent_base, + _exception ? JNI_ABORT: 0); + } + if (mantissa_base) { + _env->ReleasePrimitiveArrayCritical(mantissa_ref, mantissa_base, + _exception ? JNI_ABORT: 0); + } + return _returnValue; +} + +/* GLbitfield glQueryMatrixxOES ( GLfixed *mantissa, GLint *exponent ) */ +static jint +android_glQueryMatrixxOES__Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jobject mantissa_buf, jobject exponent_buf) { + jint _exception = 0; + jarray _mantissaArray = (jarray) 0; + jarray _exponentArray = (jarray) 0; + GLbitfield _returnValue = -1; + jint _mantissaRemaining; + GLfixed *mantissa = (GLfixed *) 0; + jint _exponentRemaining; + GLint *exponent = (GLint *) 0; + + mantissa = (GLfixed *)getPointer(_env, mantissa_buf, &_mantissaArray, &_mantissaRemaining); + if (_mantissaRemaining < 16) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < 16"); + goto exit; + } + exponent = (GLint *)getPointer(_env, exponent_buf, &_exponentArray, &_exponentRemaining); + if (_exponentRemaining < 16) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < 16"); + goto exit; + } + _returnValue = glQueryMatrixxOES( + (GLfixed *)mantissa, + (GLint *)exponent + ); + +exit: + if (_mantissaArray) { + releasePointer(_env, _mantissaArray, exponent, _exception ? JNI_FALSE : JNI_TRUE); + } + if (_exponentArray) { + releasePointer(_env, _exponentArray, mantissa, _exception ? JNI_FALSE : JNI_TRUE); + } + return _returnValue; +} + +static const char *classPathName = "android/opengl/GLES10Ext"; + +static JNINativeMethod methods[] = { +{"_nativeClassInit", "()V", (void*)nativeClassInit }, +{"glQueryMatrixxOES", "([II[II)I", (void *) android_glQueryMatrixxOES___3II_3II }, +{"glQueryMatrixxOES", "(Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;)I", (void *) android_glQueryMatrixxOES__Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 }, +}; + +int register_android_opengl_jni_GLES10Ext(JNIEnv *_env) +{ + int err; + err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods)); + return err; +} diff --git a/core/jni/android_opengl_GLES11.cpp b/core/jni/android_opengl_GLES11.cpp new file mode 100644 index 0000000..ed8dfc8 --- /dev/null +++ b/core/jni/android_opengl_GLES11.cpp @@ -0,0 +1,2465 @@ +/* +** +** Copyright 2009, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +// This source file is automatically generated + +#include <android_runtime/AndroidRuntime.h> +#include <utils/misc.h> + +#include <assert.h> +#include <GLES/gl.h> +#include <GLES/glext.h> + +static int initialized = 0; + +static jclass nioAccessClass; +static jclass bufferClass; +static jclass OOMEClass; +static jclass UOEClass; +static jclass IAEClass; +static jclass AIOOBEClass; +static jmethodID getBasePointerID; +static jmethodID getBaseArrayID; +static jmethodID getBaseArrayOffsetID; +static jfieldID positionID; +static jfieldID limitID; +static jfieldID elementSizeShiftID; + +/* Cache method IDs each time the class is loaded. */ + +static void +nativeClassInitBuffer(JNIEnv *_env) +{ + jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); + nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); + + jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); + bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); + + getBasePointerID = _env->GetStaticMethodID(nioAccessClass, + "getBasePointer", "(Ljava/nio/Buffer;)J"); + getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); + getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); + + positionID = _env->GetFieldID(bufferClass, "position", "I"); + limitID = _env->GetFieldID(bufferClass, "limit", "I"); + elementSizeShiftID = + _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); +} + + +static void +nativeClassInit(JNIEnv *_env, jclass glImplClass) +{ + nativeClassInitBuffer(_env); + + jclass IAEClassLocal = + _env->FindClass("java/lang/IllegalArgumentException"); + jclass OOMEClassLocal = + _env->FindClass("java/lang/OutOfMemoryError"); + jclass UOEClassLocal = + _env->FindClass("java/lang/UnsupportedOperationException"); + jclass AIOOBEClassLocal = + _env->FindClass("java/lang/ArrayIndexOutOfBoundsException"); + + IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal); + OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal); + UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal); + AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal); +} + +static void * +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +{ + jint position; + jint limit; + jint elementSizeShift; + jlong pointer; + jint offset; + void *data; + + position = _env->GetIntField(buffer, positionID); + limit = _env->GetIntField(buffer, limitID); + elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + *remaining = (limit - position) << elementSizeShift; + pointer = _env->CallStaticLongMethod(nioAccessClass, + getBasePointerID, buffer); + if (pointer != 0L) { + *array = NULL; + return (void *) (jint) pointer; + } + + *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, + getBaseArrayID, buffer); + offset = _env->CallStaticIntMethod(nioAccessClass, + getBaseArrayOffsetID, buffer); + data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); + + return (void *) ((char *) data + offset); +} + + +static void +releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) +{ + _env->ReleasePrimitiveArrayCritical(array, data, + commit ? 0 : JNI_ABORT); +} + +// -------------------------------------------------------------------------- + +/* void glBindBuffer ( GLenum target, GLuint buffer ) */ +static void +android_glBindBuffer__II + (JNIEnv *_env, jobject _this, jint target, jint buffer) { + glBindBuffer( + (GLenum)target, + (GLuint)buffer + ); +} + +/* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */ +static void +android_glBufferData__IILjava_nio_Buffer_2I + (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *data = (GLvoid *) 0; + + if (data_buf) { + data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); + } + glBufferData( + (GLenum)target, + (GLsizeiptr)size, + (GLvoid *)data, + (GLenum)usage + ); + if (_array) { + releasePointer(_env, _array, data, JNI_FALSE); + } +} + +/* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */ +static void +android_glBufferSubData__IIILjava_nio_Buffer_2 + (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *data = (GLvoid *) 0; + + data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); + glBufferSubData( + (GLenum)target, + (GLintptr)offset, + (GLsizeiptr)size, + (GLvoid *)data + ); + if (_array) { + releasePointer(_env, _array, data, JNI_FALSE); + } +} + +/* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */ +static void +android_glClipPlanef__I_3FI + (JNIEnv *_env, jobject _this, jint plane, jfloatArray equation_ref, jint offset) { + GLfloat *equation_base = (GLfloat *) 0; + jint _remaining; + GLfloat *equation = (GLfloat *) 0; + + if (!equation_ref) { + _env->ThrowNew(IAEClass, "equation == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(equation_ref) - offset; + equation_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0); + equation = equation_base + offset; + + glClipPlanef( + (GLenum)plane, + (GLfloat *)equation + ); + +exit: + if (equation_base) { + _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base, + JNI_ABORT); + } +} + +/* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */ +static void +android_glClipPlanef__ILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *equation = (GLfloat *) 0; + + equation = (GLfloat *)getPointer(_env, equation_buf, &_array, &_remaining); + glClipPlanef( + (GLenum)plane, + (GLfloat *)equation + ); + if (_array) { + releasePointer(_env, _array, equation, JNI_FALSE); + } +} + +/* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */ +static void +android_glClipPlanex__I_3II + (JNIEnv *_env, jobject _this, jint plane, jintArray equation_ref, jint offset) { + GLfixed *equation_base = (GLfixed *) 0; + jint _remaining; + GLfixed *equation = (GLfixed *) 0; + + if (!equation_ref) { + _env->ThrowNew(IAEClass, "equation == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(equation_ref) - offset; + equation_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0); + equation = equation_base + offset; + + glClipPlanex( + (GLenum)plane, + (GLfixed *)equation + ); + +exit: + if (equation_base) { + _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base, + JNI_ABORT); + } +} + +/* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */ +static void +android_glClipPlanex__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *equation = (GLfixed *) 0; + + equation = (GLfixed *)getPointer(_env, equation_buf, &_array, &_remaining); + glClipPlanex( + (GLenum)plane, + (GLfixed *)equation + ); + if (_array) { + releasePointer(_env, _array, equation, JNI_FALSE); + } +} + +/* void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) */ +static void +android_glColor4ub__BBBB + (JNIEnv *_env, jobject _this, jbyte red, jbyte green, jbyte blue, jbyte alpha) { + glColor4ub( + (GLubyte)red, + (GLubyte)green, + (GLubyte)blue, + (GLubyte)alpha + ); +} + +/* void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */ +static void +android_glColorPointer__IIII + (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) { + glColorPointer( + (GLint)size, + (GLenum)type, + (GLsizei)stride, + (const GLvoid *)offset + ); +} + +/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */ +static void +android_glDeleteBuffers__I_3II + (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) { + GLuint *buffers_base = (GLuint *) 0; + jint _remaining; + GLuint *buffers = (GLuint *) 0; + + if (!buffers_ref) { + _env->ThrowNew(IAEClass, "buffers == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(buffers_ref) - offset; + if (_remaining < n) { + _env->ThrowNew(IAEClass, "length - offset < n"); + goto exit; + } + buffers_base = (GLuint *) + _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0); + buffers = buffers_base + offset; + + glDeleteBuffers( + (GLsizei)n, + (GLuint *)buffers + ); + +exit: + if (buffers_base) { + _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base, + JNI_ABORT); + } +} + +/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */ +static void +android_glDeleteBuffers__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLuint *buffers = (GLuint *) 0; + + buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining); + if (_remaining < n) { + _env->ThrowNew(IAEClass, "remaining() < n"); + goto exit; + } + glDeleteBuffers( + (GLsizei)n, + (GLuint *)buffers + ); + +exit: + if (_array) { + releasePointer(_env, _array, buffers, JNI_FALSE); + } +} + +/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */ +static void +android_glDrawElements__IIII + (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) { + glDrawElements( + (GLenum)mode, + (GLsizei)count, + (GLenum)type, + (const GLvoid *)offset + ); +} + +/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */ +static void +android_glGenBuffers__I_3II + (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) { + jint _exception = 0; + GLuint *buffers_base = (GLuint *) 0; + jint _remaining; + GLuint *buffers = (GLuint *) 0; + + if (!buffers_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "buffers == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(buffers_ref) - offset; + if (_remaining < n) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - offset < n"); + goto exit; + } + buffers_base = (GLuint *) + _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0); + buffers = buffers_base + offset; + + glGenBuffers( + (GLsizei)n, + (GLuint *)buffers + ); + +exit: + if (buffers_base) { + _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */ +static void +android_glGenBuffers__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLuint *buffers = (GLuint *) 0; + + buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining); + if (_remaining < n) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < n"); + goto exit; + } + glGenBuffers( + (GLsizei)n, + (GLuint *)buffers + ); + +exit: + if (_array) { + releasePointer(_env, _array, buffers, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ +static void +android_glGetBooleanv__I_3ZI + (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) { + jint _exception = 0; + GLboolean *params_base = (GLboolean *) 0; + jint _remaining; + GLboolean *params = (GLboolean *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLboolean *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetBooleanv( + (GLenum)pname, + (GLboolean *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ +static void +android_glGetBooleanv__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLboolean *params = (GLboolean *) 0; + + params = (GLboolean *)getPointer(_env, params_buf, &_array, &_remaining); + glGetBooleanv( + (GLenum)pname, + (GLboolean *)params + ); + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ +static void +android_glGetBufferParameteriv__II_3II + (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + _env->ThrowNew(UOEClass, + "glGetBufferParameteriv"); +} + +/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ +static void +android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + _env->ThrowNew(UOEClass, + "glGetBufferParameteriv"); +} + +/* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */ +static void +android_glGetClipPlanef__I_3FI + (JNIEnv *_env, jobject _this, jint pname, jfloatArray eqn_ref, jint offset) { + jint _exception = 0; + GLfloat *eqn_base = (GLfloat *) 0; + jint _remaining; + GLfloat *eqn = (GLfloat *) 0; + + if (!eqn_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "eqn == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(eqn_ref) - offset; + eqn_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0); + eqn = eqn_base + offset; + + glGetClipPlanef( + (GLenum)pname, + (GLfloat *)eqn + ); + +exit: + if (eqn_base) { + _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */ +static void +android_glGetClipPlanef__ILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *eqn = (GLfloat *) 0; + + eqn = (GLfloat *)getPointer(_env, eqn_buf, &_array, &_remaining); + glGetClipPlanef( + (GLenum)pname, + (GLfloat *)eqn + ); + if (_array) { + releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */ +static void +android_glGetClipPlanex__I_3II + (JNIEnv *_env, jobject _this, jint pname, jintArray eqn_ref, jint offset) { + jint _exception = 0; + GLfixed *eqn_base = (GLfixed *) 0; + jint _remaining; + GLfixed *eqn = (GLfixed *) 0; + + if (!eqn_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "eqn == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(eqn_ref) - offset; + eqn_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0); + eqn = eqn_base + offset; + + glGetClipPlanex( + (GLenum)pname, + (GLfixed *)eqn + ); + +exit: + if (eqn_base) { + _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */ +static void +android_glGetClipPlanex__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *eqn = (GLfixed *) 0; + + eqn = (GLfixed *)getPointer(_env, eqn_buf, &_array, &_remaining); + glGetClipPlanex( + (GLenum)pname, + (GLfixed *)eqn + ); + if (_array) { + releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetFixedv ( GLenum pname, GLfixed *params ) */ +static void +android_glGetFixedv__I_3II + (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetFixedv( + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetFixedv ( GLenum pname, GLfixed *params ) */ +static void +android_glGetFixedv__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + glGetFixedv( + (GLenum)pname, + (GLfixed *)params + ); + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetFloatv ( GLenum pname, GLfloat *params ) */ +static void +android_glGetFloatv__I_3FI + (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + GLfloat *params_base = (GLfloat *) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetFloatv( + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetFloatv ( GLenum pname, GLfloat *params ) */ +static void +android_glGetFloatv__ILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + glGetFloatv( + (GLenum)pname, + (GLfloat *)params + ); + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */ +static void +android_glGetLightfv__II_3FI + (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + GLfloat *params_base = (GLfloat *) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + int _needed; + switch (pname) { +#if defined(GL_SPOT_EXPONENT) + case GL_SPOT_EXPONENT: +#endif // defined(GL_SPOT_EXPONENT) +#if defined(GL_SPOT_CUTOFF) + case GL_SPOT_CUTOFF: +#endif // defined(GL_SPOT_CUTOFF) +#if defined(GL_CONSTANT_ATTENUATION) + case GL_CONSTANT_ATTENUATION: +#endif // defined(GL_CONSTANT_ATTENUATION) +#if defined(GL_LINEAR_ATTENUATION) + case GL_LINEAR_ATTENUATION: +#endif // defined(GL_LINEAR_ATTENUATION) +#if defined(GL_QUADRATIC_ATTENUATION) + case GL_QUADRATIC_ATTENUATION: +#endif // defined(GL_QUADRATIC_ATTENUATION) + _needed = 1; + break; +#if defined(GL_SPOT_DIRECTION) + case GL_SPOT_DIRECTION: +#endif // defined(GL_SPOT_DIRECTION) + _needed = 3; + break; +#if defined(GL_AMBIENT) + case GL_AMBIENT: +#endif // defined(GL_AMBIENT) +#if defined(GL_DIFFUSE) + case GL_DIFFUSE: +#endif // defined(GL_DIFFUSE) +#if defined(GL_SPECULAR) + case GL_SPECULAR: +#endif // defined(GL_SPECULAR) +#if defined(GL_EMISSION) + case GL_EMISSION: +#endif // defined(GL_EMISSION) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - offset < needed"); + goto exit; + } + params_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetLightfv( + (GLenum)light, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */ +static void +android_glGetLightfv__IILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + int _needed; + switch (pname) { +#if defined(GL_SPOT_EXPONENT) + case GL_SPOT_EXPONENT: +#endif // defined(GL_SPOT_EXPONENT) +#if defined(GL_SPOT_CUTOFF) + case GL_SPOT_CUTOFF: +#endif // defined(GL_SPOT_CUTOFF) +#if defined(GL_CONSTANT_ATTENUATION) + case GL_CONSTANT_ATTENUATION: +#endif // defined(GL_CONSTANT_ATTENUATION) +#if defined(GL_LINEAR_ATTENUATION) + case GL_LINEAR_ATTENUATION: +#endif // defined(GL_LINEAR_ATTENUATION) +#if defined(GL_QUADRATIC_ATTENUATION) + case GL_QUADRATIC_ATTENUATION: +#endif // defined(GL_QUADRATIC_ATTENUATION) + _needed = 1; + break; +#if defined(GL_SPOT_DIRECTION) + case GL_SPOT_DIRECTION: +#endif // defined(GL_SPOT_DIRECTION) + _needed = 3; + break; +#if defined(GL_AMBIENT) + case GL_AMBIENT: +#endif // defined(GL_AMBIENT) +#if defined(GL_DIFFUSE) + case GL_DIFFUSE: +#endif // defined(GL_DIFFUSE) +#if defined(GL_SPECULAR) + case GL_SPECULAR: +#endif // defined(GL_SPECULAR) +#if defined(GL_EMISSION) + case GL_EMISSION: +#endif // defined(GL_EMISSION) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < needed"); + goto exit; + } + glGetLightfv( + (GLenum)light, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */ +static void +android_glGetLightxv__II_3II + (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + int _needed; + switch (pname) { +#if defined(GL_SPOT_EXPONENT) + case GL_SPOT_EXPONENT: +#endif // defined(GL_SPOT_EXPONENT) +#if defined(GL_SPOT_CUTOFF) + case GL_SPOT_CUTOFF: +#endif // defined(GL_SPOT_CUTOFF) +#if defined(GL_CONSTANT_ATTENUATION) + case GL_CONSTANT_ATTENUATION: +#endif // defined(GL_CONSTANT_ATTENUATION) +#if defined(GL_LINEAR_ATTENUATION) + case GL_LINEAR_ATTENUATION: +#endif // defined(GL_LINEAR_ATTENUATION) +#if defined(GL_QUADRATIC_ATTENUATION) + case GL_QUADRATIC_ATTENUATION: +#endif // defined(GL_QUADRATIC_ATTENUATION) + _needed = 1; + break; +#if defined(GL_SPOT_DIRECTION) + case GL_SPOT_DIRECTION: +#endif // defined(GL_SPOT_DIRECTION) + _needed = 3; + break; +#if defined(GL_AMBIENT) + case GL_AMBIENT: +#endif // defined(GL_AMBIENT) +#if defined(GL_DIFFUSE) + case GL_DIFFUSE: +#endif // defined(GL_DIFFUSE) +#if defined(GL_SPECULAR) + case GL_SPECULAR: +#endif // defined(GL_SPECULAR) +#if defined(GL_EMISSION) + case GL_EMISSION: +#endif // defined(GL_EMISSION) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - offset < needed"); + goto exit; + } + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetLightxv( + (GLenum)light, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */ +static void +android_glGetLightxv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + int _needed; + switch (pname) { +#if defined(GL_SPOT_EXPONENT) + case GL_SPOT_EXPONENT: +#endif // defined(GL_SPOT_EXPONENT) +#if defined(GL_SPOT_CUTOFF) + case GL_SPOT_CUTOFF: +#endif // defined(GL_SPOT_CUTOFF) +#if defined(GL_CONSTANT_ATTENUATION) + case GL_CONSTANT_ATTENUATION: +#endif // defined(GL_CONSTANT_ATTENUATION) +#if defined(GL_LINEAR_ATTENUATION) + case GL_LINEAR_ATTENUATION: +#endif // defined(GL_LINEAR_ATTENUATION) +#if defined(GL_QUADRATIC_ATTENUATION) + case GL_QUADRATIC_ATTENUATION: +#endif // defined(GL_QUADRATIC_ATTENUATION) + _needed = 1; + break; +#if defined(GL_SPOT_DIRECTION) + case GL_SPOT_DIRECTION: +#endif // defined(GL_SPOT_DIRECTION) + _needed = 3; + break; +#if defined(GL_AMBIENT) + case GL_AMBIENT: +#endif // defined(GL_AMBIENT) +#if defined(GL_DIFFUSE) + case GL_DIFFUSE: +#endif // defined(GL_DIFFUSE) +#if defined(GL_SPECULAR) + case GL_SPECULAR: +#endif // defined(GL_SPECULAR) +#if defined(GL_EMISSION) + case GL_EMISSION: +#endif // defined(GL_EMISSION) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < needed"); + goto exit; + } + glGetLightxv( + (GLenum)light, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */ +static void +android_glGetMaterialfv__II_3FI + (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + GLfloat *params_base = (GLfloat *) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + int _needed; + switch (pname) { +#if defined(GL_SHININESS) + case GL_SHININESS: +#endif // defined(GL_SHININESS) + _needed = 1; + break; +#if defined(GL_AMBIENT) + case GL_AMBIENT: +#endif // defined(GL_AMBIENT) +#if defined(GL_DIFFUSE) + case GL_DIFFUSE: +#endif // defined(GL_DIFFUSE) +#if defined(GL_SPECULAR) + case GL_SPECULAR: +#endif // defined(GL_SPECULAR) +#if defined(GL_EMISSION) + case GL_EMISSION: +#endif // defined(GL_EMISSION) +#if defined(GL_AMBIENT_AND_DIFFUSE) + case GL_AMBIENT_AND_DIFFUSE: +#endif // defined(GL_AMBIENT_AND_DIFFUSE) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - offset < needed"); + goto exit; + } + params_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetMaterialfv( + (GLenum)face, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */ +static void +android_glGetMaterialfv__IILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + int _needed; + switch (pname) { +#if defined(GL_SHININESS) + case GL_SHININESS: +#endif // defined(GL_SHININESS) + _needed = 1; + break; +#if defined(GL_AMBIENT) + case GL_AMBIENT: +#endif // defined(GL_AMBIENT) +#if defined(GL_DIFFUSE) + case GL_DIFFUSE: +#endif // defined(GL_DIFFUSE) +#if defined(GL_SPECULAR) + case GL_SPECULAR: +#endif // defined(GL_SPECULAR) +#if defined(GL_EMISSION) + case GL_EMISSION: +#endif // defined(GL_EMISSION) +#if defined(GL_AMBIENT_AND_DIFFUSE) + case GL_AMBIENT_AND_DIFFUSE: +#endif // defined(GL_AMBIENT_AND_DIFFUSE) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < needed"); + goto exit; + } + glGetMaterialfv( + (GLenum)face, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */ +static void +android_glGetMaterialxv__II_3II + (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + int _needed; + switch (pname) { +#if defined(GL_SHININESS) + case GL_SHININESS: +#endif // defined(GL_SHININESS) + _needed = 1; + break; +#if defined(GL_AMBIENT) + case GL_AMBIENT: +#endif // defined(GL_AMBIENT) +#if defined(GL_DIFFUSE) + case GL_DIFFUSE: +#endif // defined(GL_DIFFUSE) +#if defined(GL_SPECULAR) + case GL_SPECULAR: +#endif // defined(GL_SPECULAR) +#if defined(GL_EMISSION) + case GL_EMISSION: +#endif // defined(GL_EMISSION) +#if defined(GL_AMBIENT_AND_DIFFUSE) + case GL_AMBIENT_AND_DIFFUSE: +#endif // defined(GL_AMBIENT_AND_DIFFUSE) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - offset < needed"); + goto exit; + } + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetMaterialxv( + (GLenum)face, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */ +static void +android_glGetMaterialxv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + int _needed; + switch (pname) { +#if defined(GL_SHININESS) + case GL_SHININESS: +#endif // defined(GL_SHININESS) + _needed = 1; + break; +#if defined(GL_AMBIENT) + case GL_AMBIENT: +#endif // defined(GL_AMBIENT) +#if defined(GL_DIFFUSE) + case GL_DIFFUSE: +#endif // defined(GL_DIFFUSE) +#if defined(GL_SPECULAR) + case GL_SPECULAR: +#endif // defined(GL_SPECULAR) +#if defined(GL_EMISSION) + case GL_EMISSION: +#endif // defined(GL_EMISSION) +#if defined(GL_AMBIENT_AND_DIFFUSE) + case GL_AMBIENT_AND_DIFFUSE: +#endif // defined(GL_AMBIENT_AND_DIFFUSE) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < needed"); + goto exit; + } + glGetMaterialxv( + (GLenum)face, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */ +static void +android_glGetTexEnvfv__II_3FI + (JNIEnv *_env, jobject _this, jint env, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + GLfloat *params_base = (GLfloat *) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + int _needed; + switch (pname) { +#if defined(GL_TEXTURE_ENV_MODE) + case GL_TEXTURE_ENV_MODE: +#endif // defined(GL_TEXTURE_ENV_MODE) +#if defined(GL_COMBINE_RGB) + case GL_COMBINE_RGB: +#endif // defined(GL_COMBINE_RGB) +#if defined(GL_COMBINE_ALPHA) + case GL_COMBINE_ALPHA: +#endif // defined(GL_COMBINE_ALPHA) + _needed = 1; + break; +#if defined(GL_TEXTURE_ENV_COLOR) + case GL_TEXTURE_ENV_COLOR: +#endif // defined(GL_TEXTURE_ENV_COLOR) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - offset < needed"); + goto exit; + } + params_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetTexEnvfv( + (GLenum)env, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */ +static void +android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + int _needed; + switch (pname) { +#if defined(GL_TEXTURE_ENV_MODE) + case GL_TEXTURE_ENV_MODE: +#endif // defined(GL_TEXTURE_ENV_MODE) +#if defined(GL_COMBINE_RGB) + case GL_COMBINE_RGB: +#endif // defined(GL_COMBINE_RGB) +#if defined(GL_COMBINE_ALPHA) + case GL_COMBINE_ALPHA: +#endif // defined(GL_COMBINE_ALPHA) + _needed = 1; + break; +#if defined(GL_TEXTURE_ENV_COLOR) + case GL_TEXTURE_ENV_COLOR: +#endif // defined(GL_TEXTURE_ENV_COLOR) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < needed"); + goto exit; + } + glGetTexEnvfv( + (GLenum)env, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */ +static void +android_glGetTexEnviv__II_3II + (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLint *params_base = (GLint *) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + int _needed; + switch (pname) { +#if defined(GL_TEXTURE_ENV_MODE) + case GL_TEXTURE_ENV_MODE: +#endif // defined(GL_TEXTURE_ENV_MODE) +#if defined(GL_COMBINE_RGB) + case GL_COMBINE_RGB: +#endif // defined(GL_COMBINE_RGB) +#if defined(GL_COMBINE_ALPHA) + case GL_COMBINE_ALPHA: +#endif // defined(GL_COMBINE_ALPHA) + _needed = 1; + break; +#if defined(GL_TEXTURE_ENV_COLOR) + case GL_TEXTURE_ENV_COLOR: +#endif // defined(GL_TEXTURE_ENV_COLOR) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - offset < needed"); + goto exit; + } + params_base = (GLint *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetTexEnviv( + (GLenum)env, + (GLenum)pname, + (GLint *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */ +static void +android_glGetTexEnviv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + int _needed; + switch (pname) { +#if defined(GL_TEXTURE_ENV_MODE) + case GL_TEXTURE_ENV_MODE: +#endif // defined(GL_TEXTURE_ENV_MODE) +#if defined(GL_COMBINE_RGB) + case GL_COMBINE_RGB: +#endif // defined(GL_COMBINE_RGB) +#if defined(GL_COMBINE_ALPHA) + case GL_COMBINE_ALPHA: +#endif // defined(GL_COMBINE_ALPHA) + _needed = 1; + break; +#if defined(GL_TEXTURE_ENV_COLOR) + case GL_TEXTURE_ENV_COLOR: +#endif // defined(GL_TEXTURE_ENV_COLOR) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < needed"); + goto exit; + } + glGetTexEnviv( + (GLenum)env, + (GLenum)pname, + (GLint *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */ +static void +android_glGetTexEnvxv__II_3II + (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + int _needed; + switch (pname) { +#if defined(GL_TEXTURE_ENV_MODE) + case GL_TEXTURE_ENV_MODE: +#endif // defined(GL_TEXTURE_ENV_MODE) +#if defined(GL_COMBINE_RGB) + case GL_COMBINE_RGB: +#endif // defined(GL_COMBINE_RGB) +#if defined(GL_COMBINE_ALPHA) + case GL_COMBINE_ALPHA: +#endif // defined(GL_COMBINE_ALPHA) + _needed = 1; + break; +#if defined(GL_TEXTURE_ENV_COLOR) + case GL_TEXTURE_ENV_COLOR: +#endif // defined(GL_TEXTURE_ENV_COLOR) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - offset < needed"); + goto exit; + } + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetTexEnvxv( + (GLenum)env, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */ +static void +android_glGetTexEnvxv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + int _needed; + switch (pname) { +#if defined(GL_TEXTURE_ENV_MODE) + case GL_TEXTURE_ENV_MODE: +#endif // defined(GL_TEXTURE_ENV_MODE) +#if defined(GL_COMBINE_RGB) + case GL_COMBINE_RGB: +#endif // defined(GL_COMBINE_RGB) +#if defined(GL_COMBINE_ALPHA) + case GL_COMBINE_ALPHA: +#endif // defined(GL_COMBINE_ALPHA) + _needed = 1; + break; +#if defined(GL_TEXTURE_ENV_COLOR) + case GL_TEXTURE_ENV_COLOR: +#endif // defined(GL_TEXTURE_ENV_COLOR) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < needed"); + goto exit; + } + glGetTexEnvxv( + (GLenum)env, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */ +static void +android_glGetTexParameterfv__II_3FI + (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + GLfloat *params_base = (GLfloat *) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + if (_remaining < 1) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - offset < 1"); + goto exit; + } + params_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetTexParameterfv( + (GLenum)target, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */ +static void +android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + if (_remaining < 1) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < 1"); + goto exit; + } + glGetTexParameterfv( + (GLenum)target, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */ +static void +android_glGetTexParameteriv__II_3II + (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLint *params_base = (GLint *) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + if (_remaining < 1) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - offset < 1"); + goto exit; + } + params_base = (GLint *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetTexParameteriv( + (GLenum)target, + (GLenum)pname, + (GLint *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */ +static void +android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + if (_remaining < 1) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < 1"); + goto exit; + } + glGetTexParameteriv( + (GLenum)target, + (GLenum)pname, + (GLint *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */ +static void +android_glGetTexParameterxv__II_3II + (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + if (_remaining < 1) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - offset < 1"); + goto exit; + } + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetTexParameterxv( + (GLenum)target, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */ +static void +android_glGetTexParameterxv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + if (_remaining < 1) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < 1"); + goto exit; + } + glGetTexParameterxv( + (GLenum)target, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* GLboolean glIsBuffer ( GLuint buffer ) */ +static jboolean +android_glIsBuffer__I + (JNIEnv *_env, jobject _this, jint buffer) { + GLboolean _returnValue; + _returnValue = glIsBuffer( + (GLuint)buffer + ); + return _returnValue; +} + +/* GLboolean glIsEnabled ( GLenum cap ) */ +static jboolean +android_glIsEnabled__I + (JNIEnv *_env, jobject _this, jint cap) { + GLboolean _returnValue; + _returnValue = glIsEnabled( + (GLenum)cap + ); + return _returnValue; +} + +/* GLboolean glIsTexture ( GLuint texture ) */ +static jboolean +android_glIsTexture__I + (JNIEnv *_env, jobject _this, jint texture) { + GLboolean _returnValue; + _returnValue = glIsTexture( + (GLuint)texture + ); + return _returnValue; +} + +/* void glNormalPointer ( GLenum type, GLsizei stride, GLint offset ) */ +static void +android_glNormalPointer__III + (JNIEnv *_env, jobject _this, jint type, jint stride, jint offset) { + glNormalPointer( + (GLenum)type, + (GLsizei)stride, + (const GLvoid *)offset + ); +} + +/* void glPointParameterf ( GLenum pname, GLfloat param ) */ +static void +android_glPointParameterf__IF + (JNIEnv *_env, jobject _this, jint pname, jfloat param) { + glPointParameterf( + (GLenum)pname, + (GLfloat)param + ); +} + +/* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */ +static void +android_glPointParameterfv__I_3FI + (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { + GLfloat *params_base = (GLfloat *) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + if (_remaining < 1) { + _env->ThrowNew(IAEClass, "length - offset < 1"); + goto exit; + } + params_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glPointParameterfv( + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */ +static void +android_glPointParameterfv__ILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + if (_remaining < 1) { + _env->ThrowNew(IAEClass, "remaining() < 1"); + goto exit; + } + glPointParameterfv( + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glPointParameterx ( GLenum pname, GLfixed param ) */ +static void +android_glPointParameterx__II + (JNIEnv *_env, jobject _this, jint pname, jint param) { + glPointParameterx( + (GLenum)pname, + (GLfixed)param + ); +} + +/* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */ +static void +android_glPointParameterxv__I_3II + (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + if (_remaining < 1) { + _env->ThrowNew(IAEClass, "length - offset < 1"); + goto exit; + } + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glPointParameterxv( + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */ +static void +android_glPointParameterxv__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + if (_remaining < 1) { + _env->ThrowNew(IAEClass, "remaining() < 1"); + goto exit; + } + glPointParameterxv( + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) */ +static void +android_glPointSizePointerOES__IILjava_nio_Buffer_2 + (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *pointer = (GLvoid *) 0; + + pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining); + glPointSizePointerOES( + (GLenum)type, + (GLsizei)stride, + (GLvoid *)pointer + ); + if (_array) { + releasePointer(_env, _array, pointer, JNI_FALSE); + } +} + +/* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */ +static void +android_glTexCoordPointer__IIII + (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) { + glTexCoordPointer( + (GLint)size, + (GLenum)type, + (GLsizei)stride, + (const GLvoid *)offset + ); +} + +/* void glTexEnvi ( GLenum target, GLenum pname, GLint param ) */ +static void +android_glTexEnvi__III + (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) { + glTexEnvi( + (GLenum)target, + (GLenum)pname, + (GLint)param + ); +} + +/* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */ +static void +android_glTexEnviv__II_3II + (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + GLint *params_base = (GLint *) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + int _needed; + switch (pname) { +#if defined(GL_TEXTURE_ENV_MODE) + case GL_TEXTURE_ENV_MODE: +#endif // defined(GL_TEXTURE_ENV_MODE) +#if defined(GL_COMBINE_RGB) + case GL_COMBINE_RGB: +#endif // defined(GL_COMBINE_RGB) +#if defined(GL_COMBINE_ALPHA) + case GL_COMBINE_ALPHA: +#endif // defined(GL_COMBINE_ALPHA) + _needed = 1; + break; +#if defined(GL_TEXTURE_ENV_COLOR) + case GL_TEXTURE_ENV_COLOR: +#endif // defined(GL_TEXTURE_ENV_COLOR) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "length - offset < needed"); + goto exit; + } + params_base = (GLint *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glTexEnviv( + (GLenum)target, + (GLenum)pname, + (GLint *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */ +static void +android_glTexEnviv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + int _needed; + switch (pname) { +#if defined(GL_TEXTURE_ENV_MODE) + case GL_TEXTURE_ENV_MODE: +#endif // defined(GL_TEXTURE_ENV_MODE) +#if defined(GL_COMBINE_RGB) + case GL_COMBINE_RGB: +#endif // defined(GL_COMBINE_RGB) +#if defined(GL_COMBINE_ALPHA) + case GL_COMBINE_ALPHA: +#endif // defined(GL_COMBINE_ALPHA) + _needed = 1; + break; +#if defined(GL_TEXTURE_ENV_COLOR) + case GL_TEXTURE_ENV_COLOR: +#endif // defined(GL_TEXTURE_ENV_COLOR) + _needed = 4; + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _env->ThrowNew(IAEClass, "remaining() < needed"); + goto exit; + } + glTexEnviv( + (GLenum)target, + (GLenum)pname, + (GLint *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */ +static void +android_glTexParameterfv__II_3FI + (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) { + GLfloat *params_base = (GLfloat *) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + if (_remaining < 1) { + _env->ThrowNew(IAEClass, "length - offset < 1"); + goto exit; + } + params_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glTexParameterfv( + (GLenum)target, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */ +static void +android_glTexParameterfv__IILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + if (_remaining < 1) { + _env->ThrowNew(IAEClass, "remaining() < 1"); + goto exit; + } + glTexParameterfv( + (GLenum)target, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */ +static void +android_glTexParameteri__III + (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) { + glTexParameteri( + (GLenum)target, + (GLenum)pname, + (GLint)param + ); +} + +/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */ +static void +android_glTexParameteriv__II_3II + (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + GLint *params_base = (GLint *) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + if (_remaining < 1) { + _env->ThrowNew(IAEClass, "length - offset < 1"); + goto exit; + } + params_base = (GLint *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glTexParameteriv( + (GLenum)target, + (GLenum)pname, + (GLint *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */ +static void +android_glTexParameteriv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + if (_remaining < 1) { + _env->ThrowNew(IAEClass, "remaining() < 1"); + goto exit; + } + glTexParameteriv( + (GLenum)target, + (GLenum)pname, + (GLint *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */ +static void +android_glTexParameterxv__II_3II + (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + if (_remaining < 1) { + _env->ThrowNew(IAEClass, "length - offset < 1"); + goto exit; + } + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glTexParameterxv( + (GLenum)target, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */ +static void +android_glTexParameterxv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + if (_remaining < 1) { + _env->ThrowNew(IAEClass, "remaining() < 1"); + goto exit; + } + glTexParameterxv( + (GLenum)target, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */ +static void +android_glVertexPointer__IIII + (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) { + glVertexPointer( + (GLint)size, + (GLenum)type, + (GLsizei)stride, + (const GLvoid *)offset + ); +} + +static const char *classPathName = "android/opengl/GLES11"; + +static JNINativeMethod methods[] = { +{"_nativeClassInit", "()V", (void*)nativeClassInit }, +{"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II }, +{"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I }, +{"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 }, +{"glClipPlanef", "(I[FI)V", (void *) android_glClipPlanef__I_3FI }, +{"glClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glClipPlanef__ILjava_nio_FloatBuffer_2 }, +{"glClipPlanex", "(I[II)V", (void *) android_glClipPlanex__I_3II }, +{"glClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glClipPlanex__ILjava_nio_IntBuffer_2 }, +{"glColor4ub", "(BBBB)V", (void *) android_glColor4ub__BBBB }, +{"glColorPointer", "(IIII)V", (void *) android_glColorPointer__IIII }, +{"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II }, +{"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 }, +{"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII }, +{"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II }, +{"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 }, +{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI }, +{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 }, +{"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II }, +{"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 }, +{"glGetClipPlanef", "(I[FI)V", (void *) android_glGetClipPlanef__I_3FI }, +{"glGetClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetClipPlanef__ILjava_nio_FloatBuffer_2 }, +{"glGetClipPlanex", "(I[II)V", (void *) android_glGetClipPlanex__I_3II }, +{"glGetClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetClipPlanex__ILjava_nio_IntBuffer_2 }, +{"glGetFixedv", "(I[II)V", (void *) android_glGetFixedv__I_3II }, +{"glGetFixedv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetFixedv__ILjava_nio_IntBuffer_2 }, +{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI }, +{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 }, +{"glGetLightfv", "(II[FI)V", (void *) android_glGetLightfv__II_3FI }, +{"glGetLightfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetLightfv__IILjava_nio_FloatBuffer_2 }, +{"glGetLightxv", "(II[II)V", (void *) android_glGetLightxv__II_3II }, +{"glGetLightxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetLightxv__IILjava_nio_IntBuffer_2 }, +{"glGetMaterialfv", "(II[FI)V", (void *) android_glGetMaterialfv__II_3FI }, +{"glGetMaterialfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetMaterialfv__IILjava_nio_FloatBuffer_2 }, +{"glGetMaterialxv", "(II[II)V", (void *) android_glGetMaterialxv__II_3II }, +{"glGetMaterialxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetMaterialxv__IILjava_nio_IntBuffer_2 }, +{"glGetTexEnvfv", "(II[FI)V", (void *) android_glGetTexEnvfv__II_3FI }, +{"glGetTexEnvfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2 }, +{"glGetTexEnviv", "(II[II)V", (void *) android_glGetTexEnviv__II_3II }, +{"glGetTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnviv__IILjava_nio_IntBuffer_2 }, +{"glGetTexEnvxv", "(II[II)V", (void *) android_glGetTexEnvxv__II_3II }, +{"glGetTexEnvxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnvxv__IILjava_nio_IntBuffer_2 }, +{"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI }, +{"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 }, +{"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II }, +{"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 }, +{"glGetTexParameterxv", "(II[II)V", (void *) android_glGetTexParameterxv__II_3II }, +{"glGetTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameterxv__IILjava_nio_IntBuffer_2 }, +{"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I }, +{"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I }, +{"glIsTexture", "(I)Z", (void *) android_glIsTexture__I }, +{"glNormalPointer", "(III)V", (void *) android_glNormalPointer__III }, +{"glPointParameterf", "(IF)V", (void *) android_glPointParameterf__IF }, +{"glPointParameterfv", "(I[FI)V", (void *) android_glPointParameterfv__I_3FI }, +{"glPointParameterfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glPointParameterfv__ILjava_nio_FloatBuffer_2 }, +{"glPointParameterx", "(II)V", (void *) android_glPointParameterx__II }, +{"glPointParameterxv", "(I[II)V", (void *) android_glPointParameterxv__I_3II }, +{"glPointParameterxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glPointParameterxv__ILjava_nio_IntBuffer_2 }, +{"glPointSizePointerOES", "(IILjava/nio/Buffer;)V", (void *) android_glPointSizePointerOES__IILjava_nio_Buffer_2 }, +{"glTexCoordPointer", "(IIII)V", (void *) android_glTexCoordPointer__IIII }, +{"glTexEnvi", "(III)V", (void *) android_glTexEnvi__III }, +{"glTexEnviv", "(II[II)V", (void *) android_glTexEnviv__II_3II }, +{"glTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexEnviv__IILjava_nio_IntBuffer_2 }, +{"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI }, +{"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 }, +{"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III }, +{"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II }, +{"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 }, +{"glTexParameterxv", "(II[II)V", (void *) android_glTexParameterxv__II_3II }, +{"glTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameterxv__IILjava_nio_IntBuffer_2 }, +{"glVertexPointer", "(IIII)V", (void *) android_glVertexPointer__IIII }, +}; + +int register_android_opengl_jni_GLES11(JNIEnv *_env) +{ + int err; + err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods)); + return err; +} diff --git a/core/jni/android_opengl_GLES11Ext.cpp b/core/jni/android_opengl_GLES11Ext.cpp new file mode 100644 index 0000000..6f3495c --- /dev/null +++ b/core/jni/android_opengl_GLES11Ext.cpp @@ -0,0 +1,2461 @@ +/* +** +** Copyright 2009, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +// This source file is automatically generated + +#include <android_runtime/AndroidRuntime.h> +#include <utils/misc.h> + +#include <assert.h> +#include <GLES/gl.h> +#include <GLES/glext.h> + +static int initialized = 0; + +static jclass nioAccessClass; +static jclass bufferClass; +static jclass OOMEClass; +static jclass UOEClass; +static jclass IAEClass; +static jclass AIOOBEClass; +static jmethodID getBasePointerID; +static jmethodID getBaseArrayID; +static jmethodID getBaseArrayOffsetID; +static jfieldID positionID; +static jfieldID limitID; +static jfieldID elementSizeShiftID; + +/* Cache method IDs each time the class is loaded. */ + +static void +nativeClassInitBuffer(JNIEnv *_env) +{ + jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); + nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); + + jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); + bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); + + getBasePointerID = _env->GetStaticMethodID(nioAccessClass, + "getBasePointer", "(Ljava/nio/Buffer;)J"); + getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); + getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); + + positionID = _env->GetFieldID(bufferClass, "position", "I"); + limitID = _env->GetFieldID(bufferClass, "limit", "I"); + elementSizeShiftID = + _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); +} + + +static void +nativeClassInit(JNIEnv *_env, jclass glImplClass) +{ + nativeClassInitBuffer(_env); + + jclass IAEClassLocal = + _env->FindClass("java/lang/IllegalArgumentException"); + jclass OOMEClassLocal = + _env->FindClass("java/lang/OutOfMemoryError"); + jclass UOEClassLocal = + _env->FindClass("java/lang/UnsupportedOperationException"); + jclass AIOOBEClassLocal = + _env->FindClass("java/lang/ArrayIndexOutOfBoundsException"); + + IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal); + OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal); + UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal); + AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal); +} + +static void * +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +{ + jint position; + jint limit; + jint elementSizeShift; + jlong pointer; + jint offset; + void *data; + + position = _env->GetIntField(buffer, positionID); + limit = _env->GetIntField(buffer, limitID); + elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + *remaining = (limit - position) << elementSizeShift; + pointer = _env->CallStaticLongMethod(nioAccessClass, + getBasePointerID, buffer); + if (pointer != 0L) { + *array = NULL; + return (void *) (jint) pointer; + } + + *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, + getBaseArrayID, buffer); + offset = _env->CallStaticIntMethod(nioAccessClass, + getBaseArrayOffsetID, buffer); + data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); + + return (void *) ((char *) data + offset); +} + + +static void +releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) +{ + _env->ReleasePrimitiveArrayCritical(array, data, + commit ? 0 : JNI_ABORT); +} + +// -------------------------------------------------------------------------- + +/* void glBlendEquationSeparateOES ( GLenum modeRGB, GLenum modeAlpha ) */ +static void +android_glBlendEquationSeparateOES__II + (JNIEnv *_env, jobject _this, jint modeRGB, jint modeAlpha) { + glBlendEquationSeparateOES( + (GLenum)modeRGB, + (GLenum)modeAlpha + ); +} + +/* void glBlendFuncSeparateOES ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) */ +static void +android_glBlendFuncSeparateOES__IIII + (JNIEnv *_env, jobject _this, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) { + glBlendFuncSeparateOES( + (GLenum)srcRGB, + (GLenum)dstRGB, + (GLenum)srcAlpha, + (GLenum)dstAlpha + ); +} + +/* void glBlendEquationOES ( GLenum mode ) */ +static void +android_glBlendEquationOES__I + (JNIEnv *_env, jobject _this, jint mode) { + glBlendEquationOES( + (GLenum)mode + ); +} + +/* void glDrawTexsOES ( GLshort x, GLshort y, GLshort z, GLshort width, GLshort height ) */ +static void +android_glDrawTexsOES__SSSSS + (JNIEnv *_env, jobject _this, jshort x, jshort y, jshort z, jshort width, jshort height) { + glDrawTexsOES( + (GLshort)x, + (GLshort)y, + (GLshort)z, + (GLshort)width, + (GLshort)height + ); +} + +/* void glDrawTexiOES ( GLint x, GLint y, GLint z, GLint width, GLint height ) */ +static void +android_glDrawTexiOES__IIIII + (JNIEnv *_env, jobject _this, jint x, jint y, jint z, jint width, jint height) { + glDrawTexiOES( + (GLint)x, + (GLint)y, + (GLint)z, + (GLint)width, + (GLint)height + ); +} + +/* void glDrawTexxOES ( GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height ) */ +static void +android_glDrawTexxOES__IIIII + (JNIEnv *_env, jobject _this, jint x, jint y, jint z, jint width, jint height) { + glDrawTexxOES( + (GLfixed)x, + (GLfixed)y, + (GLfixed)z, + (GLfixed)width, + (GLfixed)height + ); +} + +/* void glDrawTexsvOES ( const GLshort *coords ) */ +static void +android_glDrawTexsvOES___3SI + (JNIEnv *_env, jobject _this, jshortArray coords_ref, jint offset) { + GLshort *coords_base = (GLshort *) 0; + jint _remaining; + GLshort *coords = (GLshort *) 0; + + if (!coords_ref) { + _env->ThrowNew(IAEClass, "coords == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(coords_ref) - offset; + if (_remaining < 5) { + _env->ThrowNew(IAEClass, "length - offset < 5"); + goto exit; + } + coords_base = (GLshort *) + _env->GetPrimitiveArrayCritical(coords_ref, (jboolean *)0); + coords = coords_base + offset; + + glDrawTexsvOES( + (GLshort *)coords + ); + +exit: + if (coords_base) { + _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base, + JNI_ABORT); + } +} + +/* void glDrawTexsvOES ( const GLshort *coords ) */ +static void +android_glDrawTexsvOES__Ljava_nio_ShortBuffer_2 + (JNIEnv *_env, jobject _this, jobject coords_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLshort *coords = (GLshort *) 0; + + coords = (GLshort *)getPointer(_env, coords_buf, &_array, &_remaining); + if (_remaining < 5) { + _env->ThrowNew(IAEClass, "remaining() < 5"); + goto exit; + } + glDrawTexsvOES( + (GLshort *)coords + ); + +exit: + if (_array) { + releasePointer(_env, _array, coords, JNI_FALSE); + } +} + +/* void glDrawTexivOES ( const GLint *coords ) */ +static void +android_glDrawTexivOES___3II + (JNIEnv *_env, jobject _this, jintArray coords_ref, jint offset) { + GLint *coords_base = (GLint *) 0; + jint _remaining; + GLint *coords = (GLint *) 0; + + if (!coords_ref) { + _env->ThrowNew(IAEClass, "coords == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(coords_ref) - offset; + if (_remaining < 5) { + _env->ThrowNew(IAEClass, "length - offset < 5"); + goto exit; + } + coords_base = (GLint *) + _env->GetPrimitiveArrayCritical(coords_ref, (jboolean *)0); + coords = coords_base + offset; + + glDrawTexivOES( + (GLint *)coords + ); + +exit: + if (coords_base) { + _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base, + JNI_ABORT); + } +} + +/* void glDrawTexivOES ( const GLint *coords ) */ +static void +android_glDrawTexivOES__Ljava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jobject coords_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLint *coords = (GLint *) 0; + + coords = (GLint *)getPointer(_env, coords_buf, &_array, &_remaining); + if (_remaining < 5) { + _env->ThrowNew(IAEClass, "remaining() < 5"); + goto exit; + } + glDrawTexivOES( + (GLint *)coords + ); + +exit: + if (_array) { + releasePointer(_env, _array, coords, JNI_FALSE); + } +} + +/* void glDrawTexxvOES ( const GLfixed *coords ) */ +static void +android_glDrawTexxvOES___3II + (JNIEnv *_env, jobject _this, jintArray coords_ref, jint offset) { + GLfixed *coords_base = (GLfixed *) 0; + jint _remaining; + GLfixed *coords = (GLfixed *) 0; + + if (!coords_ref) { + _env->ThrowNew(IAEClass, "coords == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(coords_ref) - offset; + if (_remaining < 5) { + _env->ThrowNew(IAEClass, "length - offset < 5"); + goto exit; + } + coords_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(coords_ref, (jboolean *)0); + coords = coords_base + offset; + + glDrawTexxvOES( + (GLfixed *)coords + ); + +exit: + if (coords_base) { + _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base, + JNI_ABORT); + } +} + +/* void glDrawTexxvOES ( const GLfixed *coords ) */ +static void +android_glDrawTexxvOES__Ljava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jobject coords_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *coords = (GLfixed *) 0; + + coords = (GLfixed *)getPointer(_env, coords_buf, &_array, &_remaining); + if (_remaining < 5) { + _env->ThrowNew(IAEClass, "remaining() < 5"); + goto exit; + } + glDrawTexxvOES( + (GLfixed *)coords + ); + +exit: + if (_array) { + releasePointer(_env, _array, coords, JNI_FALSE); + } +} + +/* void glDrawTexfOES ( GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height ) */ +static void +android_glDrawTexfOES__FFFFF + (JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat z, jfloat width, jfloat height) { + glDrawTexfOES( + (GLfloat)x, + (GLfloat)y, + (GLfloat)z, + (GLfloat)width, + (GLfloat)height + ); +} + +/* void glDrawTexfvOES ( const GLfloat *coords ) */ +static void +android_glDrawTexfvOES___3FI + (JNIEnv *_env, jobject _this, jfloatArray coords_ref, jint offset) { + GLfloat *coords_base = (GLfloat *) 0; + jint _remaining; + GLfloat *coords = (GLfloat *) 0; + + if (!coords_ref) { + _env->ThrowNew(IAEClass, "coords == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(coords_ref) - offset; + if (_remaining < 5) { + _env->ThrowNew(IAEClass, "length - offset < 5"); + goto exit; + } + coords_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(coords_ref, (jboolean *)0); + coords = coords_base + offset; + + glDrawTexfvOES( + (GLfloat *)coords + ); + +exit: + if (coords_base) { + _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base, + JNI_ABORT); + } +} + +/* void glDrawTexfvOES ( const GLfloat *coords ) */ +static void +android_glDrawTexfvOES__Ljava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jobject coords_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *coords = (GLfloat *) 0; + + coords = (GLfloat *)getPointer(_env, coords_buf, &_array, &_remaining); + if (_remaining < 5) { + _env->ThrowNew(IAEClass, "remaining() < 5"); + goto exit; + } + glDrawTexfvOES( + (GLfloat *)coords + ); + +exit: + if (_array) { + releasePointer(_env, _array, coords, JNI_FALSE); + } +} + +/* void glEGLImageTargetTexture2DOES ( GLenum target, GLeglImageOES image ) */ +static void +android_glEGLImageTargetTexture2DOES__ILjava_nio_Buffer_2 + (JNIEnv *_env, jobject _this, jint target, jobject image_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLeglImageOES image = (GLeglImageOES) 0; + + image = (GLeglImageOES)getPointer(_env, image_buf, &_array, &_remaining); + glEGLImageTargetTexture2DOES( + (GLenum)target, + (GLeglImageOES)image + ); + if (_array) { + releasePointer(_env, _array, image, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glEGLImageTargetRenderbufferStorageOES ( GLenum target, GLeglImageOES image ) */ +static void +android_glEGLImageTargetRenderbufferStorageOES__ILjava_nio_Buffer_2 + (JNIEnv *_env, jobject _this, jint target, jobject image_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLeglImageOES image = (GLeglImageOES) 0; + + image = (GLeglImageOES)getPointer(_env, image_buf, &_array, &_remaining); + glEGLImageTargetRenderbufferStorageOES( + (GLenum)target, + (GLeglImageOES)image + ); + if (_array) { + releasePointer(_env, _array, image, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glAlphaFuncxOES ( GLenum func, GLclampx ref ) */ +static void +android_glAlphaFuncxOES__II + (JNIEnv *_env, jobject _this, jint func, jint ref) { + glAlphaFuncxOES( + (GLenum)func, + (GLclampx)ref + ); +} + +/* void glClearColorxOES ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha ) */ +static void +android_glClearColorxOES__IIII + (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) { + glClearColorxOES( + (GLclampx)red, + (GLclampx)green, + (GLclampx)blue, + (GLclampx)alpha + ); +} + +/* void glClearDepthxOES ( GLclampx depth ) */ +static void +android_glClearDepthxOES__I + (JNIEnv *_env, jobject _this, jint depth) { + glClearDepthxOES( + (GLclampx)depth + ); +} + +/* void glClipPlanexOES ( GLenum plane, const GLfixed *equation ) */ +static void +android_glClipPlanexOES__I_3II + (JNIEnv *_env, jobject _this, jint plane, jintArray equation_ref, jint offset) { + GLfixed *equation_base = (GLfixed *) 0; + jint _remaining; + GLfixed *equation = (GLfixed *) 0; + + if (!equation_ref) { + _env->ThrowNew(IAEClass, "equation == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(equation_ref) - offset; + equation_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0); + equation = equation_base + offset; + + glClipPlanexOES( + (GLenum)plane, + (GLfixed *)equation + ); + +exit: + if (equation_base) { + _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base, + JNI_ABORT); + } +} + +/* void glClipPlanexOES ( GLenum plane, const GLfixed *equation ) */ +static void +android_glClipPlanexOES__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *equation = (GLfixed *) 0; + + equation = (GLfixed *)getPointer(_env, equation_buf, &_array, &_remaining); + glClipPlanexOES( + (GLenum)plane, + (GLfixed *)equation + ); + if (_array) { + releasePointer(_env, _array, equation, JNI_FALSE); + } +} + +/* void glColor4xOES ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha ) */ +static void +android_glColor4xOES__IIII + (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) { + glColor4xOES( + (GLfixed)red, + (GLfixed)green, + (GLfixed)blue, + (GLfixed)alpha + ); +} + +/* void glDepthRangexOES ( GLclampx zNear, GLclampx zFar ) */ +static void +android_glDepthRangexOES__II + (JNIEnv *_env, jobject _this, jint zNear, jint zFar) { + glDepthRangexOES( + (GLclampx)zNear, + (GLclampx)zFar + ); +} + +/* void glFogxOES ( GLenum pname, GLfixed param ) */ +static void +android_glFogxOES__II + (JNIEnv *_env, jobject _this, jint pname, jint param) { + glFogxOES( + (GLenum)pname, + (GLfixed)param + ); +} + +/* void glFogxvOES ( GLenum pname, const GLfixed *params ) */ +static void +android_glFogxvOES__I_3II + (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glFogxvOES( + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glFogxvOES ( GLenum pname, const GLfixed *params ) */ +static void +android_glFogxvOES__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + glFogxvOES( + (GLenum)pname, + (GLfixed *)params + ); + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glFrustumxOES ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) */ +static void +android_glFrustumxOES__IIIIII + (JNIEnv *_env, jobject _this, jint left, jint right, jint bottom, jint top, jint zNear, jint zFar) { + glFrustumxOES( + (GLfixed)left, + (GLfixed)right, + (GLfixed)bottom, + (GLfixed)top, + (GLfixed)zNear, + (GLfixed)zFar + ); +} + +/* void glGetClipPlanexOES ( GLenum pname, GLfixed *eqn ) */ +static void +android_glGetClipPlanexOES__I_3II + (JNIEnv *_env, jobject _this, jint pname, jintArray eqn_ref, jint offset) { + jint _exception = 0; + GLfixed *eqn_base = (GLfixed *) 0; + jint _remaining; + GLfixed *eqn = (GLfixed *) 0; + + if (!eqn_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "eqn == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(eqn_ref) - offset; + if (_remaining < 4) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - offset < 4"); + goto exit; + } + eqn_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0); + eqn = eqn_base + offset; + + glGetClipPlanexOES( + (GLenum)pname, + (GLfixed *)eqn + ); + +exit: + if (eqn_base) { + _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetClipPlanexOES ( GLenum pname, GLfixed *eqn ) */ +static void +android_glGetClipPlanexOES__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *eqn = (GLfixed *) 0; + + eqn = (GLfixed *)getPointer(_env, eqn_buf, &_array, &_remaining); + if (_remaining < 4) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < 4"); + goto exit; + } + glGetClipPlanexOES( + (GLenum)pname, + (GLfixed *)eqn + ); + +exit: + if (_array) { + releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetFixedvOES ( GLenum pname, GLfixed *params ) */ +static void +android_glGetFixedvOES__I_3II + (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetFixedvOES( + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetFixedvOES ( GLenum pname, GLfixed *params ) */ +static void +android_glGetFixedvOES__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + glGetFixedvOES( + (GLenum)pname, + (GLfixed *)params + ); + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetLightxvOES ( GLenum light, GLenum pname, GLfixed *params ) */ +static void +android_glGetLightxvOES__II_3II + (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetLightxvOES( + (GLenum)light, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetLightxvOES ( GLenum light, GLenum pname, GLfixed *params ) */ +static void +android_glGetLightxvOES__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + glGetLightxvOES( + (GLenum)light, + (GLenum)pname, + (GLfixed *)params + ); + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetMaterialxvOES ( GLenum face, GLenum pname, GLfixed *params ) */ +static void +android_glGetMaterialxvOES__II_3II + (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetMaterialxvOES( + (GLenum)face, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetMaterialxvOES ( GLenum face, GLenum pname, GLfixed *params ) */ +static void +android_glGetMaterialxvOES__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + glGetMaterialxvOES( + (GLenum)face, + (GLenum)pname, + (GLfixed *)params + ); + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetTexEnvxvOES ( GLenum env, GLenum pname, GLfixed *params ) */ +static void +android_glGetTexEnvxvOES__II_3II + (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetTexEnvxvOES( + (GLenum)env, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetTexEnvxvOES ( GLenum env, GLenum pname, GLfixed *params ) */ +static void +android_glGetTexEnvxvOES__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + glGetTexEnvxvOES( + (GLenum)env, + (GLenum)pname, + (GLfixed *)params + ); + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetTexParameterxvOES ( GLenum target, GLenum pname, GLfixed *params ) */ +static void +android_glGetTexParameterxvOES__II_3II + (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetTexParameterxvOES( + (GLenum)target, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetTexParameterxvOES ( GLenum target, GLenum pname, GLfixed *params ) */ +static void +android_glGetTexParameterxvOES__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + glGetTexParameterxvOES( + (GLenum)target, + (GLenum)pname, + (GLfixed *)params + ); + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glLightModelxOES ( GLenum pname, GLfixed param ) */ +static void +android_glLightModelxOES__II + (JNIEnv *_env, jobject _this, jint pname, jint param) { + glLightModelxOES( + (GLenum)pname, + (GLfixed)param + ); +} + +/* void glLightModelxvOES ( GLenum pname, const GLfixed *params ) */ +static void +android_glLightModelxvOES__I_3II + (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glLightModelxvOES( + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glLightModelxvOES ( GLenum pname, const GLfixed *params ) */ +static void +android_glLightModelxvOES__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + glLightModelxvOES( + (GLenum)pname, + (GLfixed *)params + ); + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glLightxOES ( GLenum light, GLenum pname, GLfixed param ) */ +static void +android_glLightxOES__III + (JNIEnv *_env, jobject _this, jint light, jint pname, jint param) { + glLightxOES( + (GLenum)light, + (GLenum)pname, + (GLfixed)param + ); +} + +/* void glLightxvOES ( GLenum light, GLenum pname, const GLfixed *params ) */ +static void +android_glLightxvOES__II_3II + (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) { + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glLightxvOES( + (GLenum)light, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glLightxvOES ( GLenum light, GLenum pname, const GLfixed *params ) */ +static void +android_glLightxvOES__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + glLightxvOES( + (GLenum)light, + (GLenum)pname, + (GLfixed *)params + ); + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glLineWidthxOES ( GLfixed width ) */ +static void +android_glLineWidthxOES__I + (JNIEnv *_env, jobject _this, jint width) { + glLineWidthxOES( + (GLfixed)width + ); +} + +/* void glLoadMatrixxOES ( const GLfixed *m ) */ +static void +android_glLoadMatrixxOES___3II + (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) { + GLfixed *m_base = (GLfixed *) 0; + jint _remaining; + GLfixed *m = (GLfixed *) 0; + + if (!m_ref) { + _env->ThrowNew(IAEClass, "m == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(m_ref) - offset; + m_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0); + m = m_base + offset; + + glLoadMatrixxOES( + (GLfixed *)m + ); + +exit: + if (m_base) { + _env->ReleasePrimitiveArrayCritical(m_ref, m_base, + JNI_ABORT); + } +} + +/* void glLoadMatrixxOES ( const GLfixed *m ) */ +static void +android_glLoadMatrixxOES__Ljava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jobject m_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *m = (GLfixed *) 0; + + m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining); + glLoadMatrixxOES( + (GLfixed *)m + ); + if (_array) { + releasePointer(_env, _array, m, JNI_FALSE); + } +} + +/* void glMaterialxOES ( GLenum face, GLenum pname, GLfixed param ) */ +static void +android_glMaterialxOES__III + (JNIEnv *_env, jobject _this, jint face, jint pname, jint param) { + glMaterialxOES( + (GLenum)face, + (GLenum)pname, + (GLfixed)param + ); +} + +/* void glMaterialxvOES ( GLenum face, GLenum pname, const GLfixed *params ) */ +static void +android_glMaterialxvOES__II_3II + (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) { + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glMaterialxvOES( + (GLenum)face, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glMaterialxvOES ( GLenum face, GLenum pname, const GLfixed *params ) */ +static void +android_glMaterialxvOES__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + glMaterialxvOES( + (GLenum)face, + (GLenum)pname, + (GLfixed *)params + ); + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glMultMatrixxOES ( const GLfixed *m ) */ +static void +android_glMultMatrixxOES___3II + (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) { + GLfixed *m_base = (GLfixed *) 0; + jint _remaining; + GLfixed *m = (GLfixed *) 0; + + if (!m_ref) { + _env->ThrowNew(IAEClass, "m == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(m_ref) - offset; + m_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0); + m = m_base + offset; + + glMultMatrixxOES( + (GLfixed *)m + ); + +exit: + if (m_base) { + _env->ReleasePrimitiveArrayCritical(m_ref, m_base, + JNI_ABORT); + } +} + +/* void glMultMatrixxOES ( const GLfixed *m ) */ +static void +android_glMultMatrixxOES__Ljava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jobject m_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *m = (GLfixed *) 0; + + m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining); + glMultMatrixxOES( + (GLfixed *)m + ); + if (_array) { + releasePointer(_env, _array, m, JNI_FALSE); + } +} + +/* void glMultiTexCoord4xOES ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q ) */ +static void +android_glMultiTexCoord4xOES__IIIII + (JNIEnv *_env, jobject _this, jint target, jint s, jint t, jint r, jint q) { + glMultiTexCoord4xOES( + (GLenum)target, + (GLfixed)s, + (GLfixed)t, + (GLfixed)r, + (GLfixed)q + ); +} + +/* void glNormal3xOES ( GLfixed nx, GLfixed ny, GLfixed nz ) */ +static void +android_glNormal3xOES__III + (JNIEnv *_env, jobject _this, jint nx, jint ny, jint nz) { + glNormal3xOES( + (GLfixed)nx, + (GLfixed)ny, + (GLfixed)nz + ); +} + +/* void glOrthoxOES ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) */ +static void +android_glOrthoxOES__IIIIII + (JNIEnv *_env, jobject _this, jint left, jint right, jint bottom, jint top, jint zNear, jint zFar) { + glOrthoxOES( + (GLfixed)left, + (GLfixed)right, + (GLfixed)bottom, + (GLfixed)top, + (GLfixed)zNear, + (GLfixed)zFar + ); +} + +/* void glPointParameterxOES ( GLenum pname, GLfixed param ) */ +static void +android_glPointParameterxOES__II + (JNIEnv *_env, jobject _this, jint pname, jint param) { + glPointParameterxOES( + (GLenum)pname, + (GLfixed)param + ); +} + +/* void glPointParameterxvOES ( GLenum pname, const GLfixed *params ) */ +static void +android_glPointParameterxvOES__I_3II + (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glPointParameterxvOES( + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glPointParameterxvOES ( GLenum pname, const GLfixed *params ) */ +static void +android_glPointParameterxvOES__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + glPointParameterxvOES( + (GLenum)pname, + (GLfixed *)params + ); + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glPointSizexOES ( GLfixed size ) */ +static void +android_glPointSizexOES__I + (JNIEnv *_env, jobject _this, jint size) { + glPointSizexOES( + (GLfixed)size + ); +} + +/* void glPolygonOffsetxOES ( GLfixed factor, GLfixed units ) */ +static void +android_glPolygonOffsetxOES__II + (JNIEnv *_env, jobject _this, jint factor, jint units) { + glPolygonOffsetxOES( + (GLfixed)factor, + (GLfixed)units + ); +} + +/* void glRotatexOES ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z ) */ +static void +android_glRotatexOES__IIII + (JNIEnv *_env, jobject _this, jint angle, jint x, jint y, jint z) { + glRotatexOES( + (GLfixed)angle, + (GLfixed)x, + (GLfixed)y, + (GLfixed)z + ); +} + +/* void glSampleCoveragexOES ( GLclampx value, GLboolean invert ) */ +static void +android_glSampleCoveragexOES__IZ + (JNIEnv *_env, jobject _this, jint value, jboolean invert) { + glSampleCoveragexOES( + (GLclampx)value, + (GLboolean)invert + ); +} + +/* void glScalexOES ( GLfixed x, GLfixed y, GLfixed z ) */ +static void +android_glScalexOES__III + (JNIEnv *_env, jobject _this, jint x, jint y, jint z) { + glScalexOES( + (GLfixed)x, + (GLfixed)y, + (GLfixed)z + ); +} + +/* void glTexEnvxOES ( GLenum target, GLenum pname, GLfixed param ) */ +static void +android_glTexEnvxOES__III + (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) { + glTexEnvxOES( + (GLenum)target, + (GLenum)pname, + (GLfixed)param + ); +} + +/* void glTexEnvxvOES ( GLenum target, GLenum pname, const GLfixed *params ) */ +static void +android_glTexEnvxvOES__II_3II + (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glTexEnvxvOES( + (GLenum)target, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glTexEnvxvOES ( GLenum target, GLenum pname, const GLfixed *params ) */ +static void +android_glTexEnvxvOES__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + glTexEnvxvOES( + (GLenum)target, + (GLenum)pname, + (GLfixed *)params + ); + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glTexParameterxOES ( GLenum target, GLenum pname, GLfixed param ) */ +static void +android_glTexParameterxOES__III + (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) { + glTexParameterxOES( + (GLenum)target, + (GLenum)pname, + (GLfixed)param + ); +} + +/* void glTexParameterxvOES ( GLenum target, GLenum pname, const GLfixed *params ) */ +static void +android_glTexParameterxvOES__II_3II + (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glTexParameterxvOES( + (GLenum)target, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glTexParameterxvOES ( GLenum target, GLenum pname, const GLfixed *params ) */ +static void +android_glTexParameterxvOES__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + glTexParameterxvOES( + (GLenum)target, + (GLenum)pname, + (GLfixed *)params + ); + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glTranslatexOES ( GLfixed x, GLfixed y, GLfixed z ) */ +static void +android_glTranslatexOES__III + (JNIEnv *_env, jobject _this, jint x, jint y, jint z) { + glTranslatexOES( + (GLfixed)x, + (GLfixed)y, + (GLfixed)z + ); +} + +/* GLboolean glIsRenderbufferOES ( GLuint renderbuffer ) */ +static jboolean +android_glIsRenderbufferOES__I + (JNIEnv *_env, jobject _this, jint renderbuffer) { + _env->ThrowNew(UOEClass, + "glIsRenderbufferOES"); + return JNI_FALSE; +} + +/* void glBindRenderbufferOES ( GLenum target, GLuint renderbuffer ) */ +static void +android_glBindRenderbufferOES__II + (JNIEnv *_env, jobject _this, jint target, jint renderbuffer) { + _env->ThrowNew(UOEClass, + "glBindRenderbufferOES"); +} + +/* void glDeleteRenderbuffersOES ( GLsizei n, const GLuint *renderbuffers ) */ +static void +android_glDeleteRenderbuffersOES__I_3II + (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) { + _env->ThrowNew(UOEClass, + "glDeleteRenderbuffersOES"); +} + +/* void glDeleteRenderbuffersOES ( GLsizei n, const GLuint *renderbuffers ) */ +static void +android_glDeleteRenderbuffersOES__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) { + _env->ThrowNew(UOEClass, + "glDeleteRenderbuffersOES"); +} + +/* void glGenRenderbuffersOES ( GLsizei n, GLuint *renderbuffers ) */ +static void +android_glGenRenderbuffersOES__I_3II + (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) { + _env->ThrowNew(UOEClass, + "glGenRenderbuffersOES"); +} + +/* void glGenRenderbuffersOES ( GLsizei n, GLuint *renderbuffers ) */ +static void +android_glGenRenderbuffersOES__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) { + _env->ThrowNew(UOEClass, + "glGenRenderbuffersOES"); +} + +/* void glRenderbufferStorageOES ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) */ +static void +android_glRenderbufferStorageOES__IIII + (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint width, jint height) { + _env->ThrowNew(UOEClass, + "glRenderbufferStorageOES"); +} + +/* void glGetRenderbufferParameterivOES ( GLenum target, GLenum pname, GLint *params ) */ +static void +android_glGetRenderbufferParameterivOES__II_3II + (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + _env->ThrowNew(UOEClass, + "glGetRenderbufferParameterivOES"); +} + +/* void glGetRenderbufferParameterivOES ( GLenum target, GLenum pname, GLint *params ) */ +static void +android_glGetRenderbufferParameterivOES__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + _env->ThrowNew(UOEClass, + "glGetRenderbufferParameterivOES"); +} + +/* GLboolean glIsFramebufferOES ( GLuint framebuffer ) */ +static jboolean +android_glIsFramebufferOES__I + (JNIEnv *_env, jobject _this, jint framebuffer) { + _env->ThrowNew(UOEClass, + "glIsFramebufferOES"); + return JNI_FALSE; +} + +/* void glBindFramebufferOES ( GLenum target, GLuint framebuffer ) */ +static void +android_glBindFramebufferOES__II + (JNIEnv *_env, jobject _this, jint target, jint framebuffer) { + _env->ThrowNew(UOEClass, + "glBindFramebufferOES"); +} + +/* void glDeleteFramebuffersOES ( GLsizei n, const GLuint *framebuffers ) */ +static void +android_glDeleteFramebuffersOES__I_3II + (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) { + _env->ThrowNew(UOEClass, + "glDeleteFramebuffersOES"); +} + +/* void glDeleteFramebuffersOES ( GLsizei n, const GLuint *framebuffers ) */ +static void +android_glDeleteFramebuffersOES__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) { + _env->ThrowNew(UOEClass, + "glDeleteFramebuffersOES"); +} + +/* void glGenFramebuffersOES ( GLsizei n, GLuint *framebuffers ) */ +static void +android_glGenFramebuffersOES__I_3II + (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) { + _env->ThrowNew(UOEClass, + "glGenFramebuffersOES"); +} + +/* void glGenFramebuffersOES ( GLsizei n, GLuint *framebuffers ) */ +static void +android_glGenFramebuffersOES__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) { + _env->ThrowNew(UOEClass, + "glGenFramebuffersOES"); +} + +/* GLenum glCheckFramebufferStatusOES ( GLenum target ) */ +static jint +android_glCheckFramebufferStatusOES__I + (JNIEnv *_env, jobject _this, jint target) { + _env->ThrowNew(UOEClass, + "glCheckFramebufferStatusOES"); + return 0; +} + +/* void glFramebufferRenderbufferOES ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) */ +static void +android_glFramebufferRenderbufferOES__IIII + (JNIEnv *_env, jobject _this, jint target, jint attachment, jint renderbuffertarget, jint renderbuffer) { + _env->ThrowNew(UOEClass, + "glFramebufferRenderbufferOES"); +} + +/* void glFramebufferTexture2DOES ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) */ +static void +android_glFramebufferTexture2DOES__IIIII + (JNIEnv *_env, jobject _this, jint target, jint attachment, jint textarget, jint texture, jint level) { + _env->ThrowNew(UOEClass, + "glFramebufferTexture2DOES"); +} + +/* void glGetFramebufferAttachmentParameterivOES ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */ +static void +android_glGetFramebufferAttachmentParameterivOES__III_3II + (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jintArray params_ref, jint offset) { + _env->ThrowNew(UOEClass, + "glGetFramebufferAttachmentParameterivOES"); +} + +/* void glGetFramebufferAttachmentParameterivOES ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */ +static void +android_glGetFramebufferAttachmentParameterivOES__IIILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) { + _env->ThrowNew(UOEClass, + "glGetFramebufferAttachmentParameterivOES"); +} + +/* void glGenerateMipmapOES ( GLenum target ) */ +static void +android_glGenerateMipmapOES__I + (JNIEnv *_env, jobject _this, jint target) { + _env->ThrowNew(UOEClass, + "glGenerateMipmapOES"); +} + +/* void glCurrentPaletteMatrixOES ( GLuint matrixpaletteindex ) */ +static void +android_glCurrentPaletteMatrixOES__I + (JNIEnv *_env, jobject _this, jint matrixpaletteindex) { + _env->ThrowNew(UOEClass, + "glCurrentPaletteMatrixOES"); +} + +/* void glLoadPaletteFromModelViewMatrixOES ( void ) */ +static void +android_glLoadPaletteFromModelViewMatrixOES__ + (JNIEnv *_env, jobject _this) { + _env->ThrowNew(UOEClass, + "glLoadPaletteFromModelViewMatrixOES"); +} + +/* void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */ +static void +android_glMatrixIndexPointerOES__IIILjava_nio_Buffer_2 + (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf) { + _env->ThrowNew(UOEClass, + "glMatrixIndexPointerOES"); +} + +/* void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */ +static void +android_glWeightPointerOES__IIILjava_nio_Buffer_2 + (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf) { + _env->ThrowNew(UOEClass, + "glWeightPointerOES"); +} + +/* void glDepthRangefOES ( GLclampf zNear, GLclampf zFar ) */ +static void +android_glDepthRangefOES__FF + (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) { + glDepthRangefOES( + (GLclampf)zNear, + (GLclampf)zFar + ); +} + +/* void glFrustumfOES ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */ +static void +android_glFrustumfOES__FFFFFF + (JNIEnv *_env, jobject _this, jfloat left, jfloat right, jfloat bottom, jfloat top, jfloat zNear, jfloat zFar) { + glFrustumfOES( + (GLfloat)left, + (GLfloat)right, + (GLfloat)bottom, + (GLfloat)top, + (GLfloat)zNear, + (GLfloat)zFar + ); +} + +/* void glOrthofOES ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */ +static void +android_glOrthofOES__FFFFFF + (JNIEnv *_env, jobject _this, jfloat left, jfloat right, jfloat bottom, jfloat top, jfloat zNear, jfloat zFar) { + glOrthofOES( + (GLfloat)left, + (GLfloat)right, + (GLfloat)bottom, + (GLfloat)top, + (GLfloat)zNear, + (GLfloat)zFar + ); +} + +/* void glClipPlanefOES ( GLenum plane, const GLfloat *equation ) */ +static void +android_glClipPlanefOES__I_3FI + (JNIEnv *_env, jobject _this, jint plane, jfloatArray equation_ref, jint offset) { + GLfloat *equation_base = (GLfloat *) 0; + jint _remaining; + GLfloat *equation = (GLfloat *) 0; + + if (!equation_ref) { + _env->ThrowNew(IAEClass, "equation == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(equation_ref) - offset; + equation_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0); + equation = equation_base + offset; + + glClipPlanefOES( + (GLenum)plane, + (GLfloat *)equation + ); + +exit: + if (equation_base) { + _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base, + JNI_ABORT); + } +} + +/* void glClipPlanefOES ( GLenum plane, const GLfloat *equation ) */ +static void +android_glClipPlanefOES__ILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *equation = (GLfloat *) 0; + + equation = (GLfloat *)getPointer(_env, equation_buf, &_array, &_remaining); + glClipPlanefOES( + (GLenum)plane, + (GLfloat *)equation + ); + if (_array) { + releasePointer(_env, _array, equation, JNI_FALSE); + } +} + +/* void glGetClipPlanefOES ( GLenum pname, GLfloat *eqn ) */ +static void +android_glGetClipPlanefOES__I_3FI + (JNIEnv *_env, jobject _this, jint pname, jfloatArray eqn_ref, jint offset) { + jint _exception = 0; + GLfloat *eqn_base = (GLfloat *) 0; + jint _remaining; + GLfloat *eqn = (GLfloat *) 0; + + if (!eqn_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "eqn == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(eqn_ref) - offset; + if (_remaining < 4) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - offset < 4"); + goto exit; + } + eqn_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0); + eqn = eqn_base + offset; + + glGetClipPlanefOES( + (GLenum)pname, + (GLfloat *)eqn + ); + +exit: + if (eqn_base) { + _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetClipPlanefOES ( GLenum pname, GLfloat *eqn ) */ +static void +android_glGetClipPlanefOES__ILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *eqn = (GLfloat *) 0; + + eqn = (GLfloat *)getPointer(_env, eqn_buf, &_array, &_remaining); + if (_remaining < 4) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < 4"); + goto exit; + } + glGetClipPlanefOES( + (GLenum)pname, + (GLfloat *)eqn + ); + +exit: + if (_array) { + releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glClearDepthfOES ( GLclampf depth ) */ +static void +android_glClearDepthfOES__F + (JNIEnv *_env, jobject _this, jfloat depth) { + glClearDepthfOES( + (GLclampf)depth + ); +} + +/* void glTexGenfOES ( GLenum coord, GLenum pname, GLfloat param ) */ +static void +android_glTexGenfOES__IIF + (JNIEnv *_env, jobject _this, jint coord, jint pname, jfloat param) { + glTexGenfOES( + (GLenum)coord, + (GLenum)pname, + (GLfloat)param + ); +} + +/* void glTexGenfvOES ( GLenum coord, GLenum pname, const GLfloat *params ) */ +static void +android_glTexGenfvOES__II_3FI + (JNIEnv *_env, jobject _this, jint coord, jint pname, jfloatArray params_ref, jint offset) { + GLfloat *params_base = (GLfloat *) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glTexGenfvOES( + (GLenum)coord, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glTexGenfvOES ( GLenum coord, GLenum pname, const GLfloat *params ) */ +static void +android_glTexGenfvOES__IILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + glTexGenfvOES( + (GLenum)coord, + (GLenum)pname, + (GLfloat *)params + ); + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glTexGeniOES ( GLenum coord, GLenum pname, GLint param ) */ +static void +android_glTexGeniOES__III + (JNIEnv *_env, jobject _this, jint coord, jint pname, jint param) { + glTexGeniOES( + (GLenum)coord, + (GLenum)pname, + (GLint)param + ); +} + +/* void glTexGenivOES ( GLenum coord, GLenum pname, const GLint *params ) */ +static void +android_glTexGenivOES__II_3II + (JNIEnv *_env, jobject _this, jint coord, jint pname, jintArray params_ref, jint offset) { + GLint *params_base = (GLint *) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLint *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glTexGenivOES( + (GLenum)coord, + (GLenum)pname, + (GLint *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glTexGenivOES ( GLenum coord, GLenum pname, const GLint *params ) */ +static void +android_glTexGenivOES__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + glTexGenivOES( + (GLenum)coord, + (GLenum)pname, + (GLint *)params + ); + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glTexGenxOES ( GLenum coord, GLenum pname, GLfixed param ) */ +static void +android_glTexGenxOES__III + (JNIEnv *_env, jobject _this, jint coord, jint pname, jint param) { + glTexGenxOES( + (GLenum)coord, + (GLenum)pname, + (GLfixed)param + ); +} + +/* void glTexGenxvOES ( GLenum coord, GLenum pname, const GLfixed *params ) */ +static void +android_glTexGenxvOES__II_3II + (JNIEnv *_env, jobject _this, jint coord, jint pname, jintArray params_ref, jint offset) { + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glTexGenxvOES( + (GLenum)coord, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glTexGenxvOES ( GLenum coord, GLenum pname, const GLfixed *params ) */ +static void +android_glTexGenxvOES__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + glTexGenxvOES( + (GLenum)coord, + (GLenum)pname, + (GLfixed *)params + ); + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glGetTexGenfvOES ( GLenum coord, GLenum pname, GLfloat *params ) */ +static void +android_glGetTexGenfvOES__II_3FI + (JNIEnv *_env, jobject _this, jint coord, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + GLfloat *params_base = (GLfloat *) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetTexGenfvOES( + (GLenum)coord, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetTexGenfvOES ( GLenum coord, GLenum pname, GLfloat *params ) */ +static void +android_glGetTexGenfvOES__IILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + glGetTexGenfvOES( + (GLenum)coord, + (GLenum)pname, + (GLfloat *)params + ); + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetTexGenivOES ( GLenum coord, GLenum pname, GLint *params ) */ +static void +android_glGetTexGenivOES__II_3II + (JNIEnv *_env, jobject _this, jint coord, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLint *params_base = (GLint *) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLint *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetTexGenivOES( + (GLenum)coord, + (GLenum)pname, + (GLint *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetTexGenivOES ( GLenum coord, GLenum pname, GLint *params ) */ +static void +android_glGetTexGenivOES__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + glGetTexGenivOES( + (GLenum)coord, + (GLenum)pname, + (GLint *)params + ); + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetTexGenxvOES ( GLenum coord, GLenum pname, GLfixed *params ) */ +static void +android_glGetTexGenxvOES__II_3II + (JNIEnv *_env, jobject _this, jint coord, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLfixed *params_base = (GLfixed *) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLfixed *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetTexGenxvOES( + (GLenum)coord, + (GLenum)pname, + (GLfixed *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetTexGenxvOES ( GLenum coord, GLenum pname, GLfixed *params ) */ +static void +android_glGetTexGenxvOES__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfixed *params = (GLfixed *) 0; + + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + glGetTexGenxvOES( + (GLenum)coord, + (GLenum)pname, + (GLfixed *)params + ); + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +static const char *classPathName = "android/opengl/GLES11Ext"; + +static JNINativeMethod methods[] = { +{"_nativeClassInit", "()V", (void*)nativeClassInit }, +{"glBlendEquationSeparateOES", "(II)V", (void *) android_glBlendEquationSeparateOES__II }, +{"glBlendFuncSeparateOES", "(IIII)V", (void *) android_glBlendFuncSeparateOES__IIII }, +{"glBlendEquationOES", "(I)V", (void *) android_glBlendEquationOES__I }, +{"glDrawTexsOES", "(SSSSS)V", (void *) android_glDrawTexsOES__SSSSS }, +{"glDrawTexiOES", "(IIIII)V", (void *) android_glDrawTexiOES__IIIII }, +{"glDrawTexxOES", "(IIIII)V", (void *) android_glDrawTexxOES__IIIII }, +{"glDrawTexsvOES", "([SI)V", (void *) android_glDrawTexsvOES___3SI }, +{"glDrawTexsvOES", "(Ljava/nio/ShortBuffer;)V", (void *) android_glDrawTexsvOES__Ljava_nio_ShortBuffer_2 }, +{"glDrawTexivOES", "([II)V", (void *) android_glDrawTexivOES___3II }, +{"glDrawTexivOES", "(Ljava/nio/IntBuffer;)V", (void *) android_glDrawTexivOES__Ljava_nio_IntBuffer_2 }, +{"glDrawTexxvOES", "([II)V", (void *) android_glDrawTexxvOES___3II }, +{"glDrawTexxvOES", "(Ljava/nio/IntBuffer;)V", (void *) android_glDrawTexxvOES__Ljava_nio_IntBuffer_2 }, +{"glDrawTexfOES", "(FFFFF)V", (void *) android_glDrawTexfOES__FFFFF }, +{"glDrawTexfvOES", "([FI)V", (void *) android_glDrawTexfvOES___3FI }, +{"glDrawTexfvOES", "(Ljava/nio/FloatBuffer;)V", (void *) android_glDrawTexfvOES__Ljava_nio_FloatBuffer_2 }, +{"glEGLImageTargetTexture2DOES", "(ILjava/nio/Buffer;)V", (void *) android_glEGLImageTargetTexture2DOES__ILjava_nio_Buffer_2 }, +{"glEGLImageTargetRenderbufferStorageOES", "(ILjava/nio/Buffer;)V", (void *) android_glEGLImageTargetRenderbufferStorageOES__ILjava_nio_Buffer_2 }, +{"glAlphaFuncxOES", "(II)V", (void *) android_glAlphaFuncxOES__II }, +{"glClearColorxOES", "(IIII)V", (void *) android_glClearColorxOES__IIII }, +{"glClearDepthxOES", "(I)V", (void *) android_glClearDepthxOES__I }, +{"glClipPlanexOES", "(I[II)V", (void *) android_glClipPlanexOES__I_3II }, +{"glClipPlanexOES", "(ILjava/nio/IntBuffer;)V", (void *) android_glClipPlanexOES__ILjava_nio_IntBuffer_2 }, +{"glColor4xOES", "(IIII)V", (void *) android_glColor4xOES__IIII }, +{"glDepthRangexOES", "(II)V", (void *) android_glDepthRangexOES__II }, +{"glFogxOES", "(II)V", (void *) android_glFogxOES__II }, +{"glFogxvOES", "(I[II)V", (void *) android_glFogxvOES__I_3II }, +{"glFogxvOES", "(ILjava/nio/IntBuffer;)V", (void *) android_glFogxvOES__ILjava_nio_IntBuffer_2 }, +{"glFrustumxOES", "(IIIIII)V", (void *) android_glFrustumxOES__IIIIII }, +{"glGetClipPlanexOES", "(I[II)V", (void *) android_glGetClipPlanexOES__I_3II }, +{"glGetClipPlanexOES", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetClipPlanexOES__ILjava_nio_IntBuffer_2 }, +{"glGetFixedvOES", "(I[II)V", (void *) android_glGetFixedvOES__I_3II }, +{"glGetFixedvOES", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetFixedvOES__ILjava_nio_IntBuffer_2 }, +{"glGetLightxvOES", "(II[II)V", (void *) android_glGetLightxvOES__II_3II }, +{"glGetLightxvOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetLightxvOES__IILjava_nio_IntBuffer_2 }, +{"glGetMaterialxvOES", "(II[II)V", (void *) android_glGetMaterialxvOES__II_3II }, +{"glGetMaterialxvOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetMaterialxvOES__IILjava_nio_IntBuffer_2 }, +{"glGetTexEnvxvOES", "(II[II)V", (void *) android_glGetTexEnvxvOES__II_3II }, +{"glGetTexEnvxvOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnvxvOES__IILjava_nio_IntBuffer_2 }, +{"glGetTexParameterxvOES", "(II[II)V", (void *) android_glGetTexParameterxvOES__II_3II }, +{"glGetTexParameterxvOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameterxvOES__IILjava_nio_IntBuffer_2 }, +{"glLightModelxOES", "(II)V", (void *) android_glLightModelxOES__II }, +{"glLightModelxvOES", "(I[II)V", (void *) android_glLightModelxvOES__I_3II }, +{"glLightModelxvOES", "(ILjava/nio/IntBuffer;)V", (void *) android_glLightModelxvOES__ILjava_nio_IntBuffer_2 }, +{"glLightxOES", "(III)V", (void *) android_glLightxOES__III }, +{"glLightxvOES", "(II[II)V", (void *) android_glLightxvOES__II_3II }, +{"glLightxvOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glLightxvOES__IILjava_nio_IntBuffer_2 }, +{"glLineWidthxOES", "(I)V", (void *) android_glLineWidthxOES__I }, +{"glLoadMatrixxOES", "([II)V", (void *) android_glLoadMatrixxOES___3II }, +{"glLoadMatrixxOES", "(Ljava/nio/IntBuffer;)V", (void *) android_glLoadMatrixxOES__Ljava_nio_IntBuffer_2 }, +{"glMaterialxOES", "(III)V", (void *) android_glMaterialxOES__III }, +{"glMaterialxvOES", "(II[II)V", (void *) android_glMaterialxvOES__II_3II }, +{"glMaterialxvOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glMaterialxvOES__IILjava_nio_IntBuffer_2 }, +{"glMultMatrixxOES", "([II)V", (void *) android_glMultMatrixxOES___3II }, +{"glMultMatrixxOES", "(Ljava/nio/IntBuffer;)V", (void *) android_glMultMatrixxOES__Ljava_nio_IntBuffer_2 }, +{"glMultiTexCoord4xOES", "(IIIII)V", (void *) android_glMultiTexCoord4xOES__IIIII }, +{"glNormal3xOES", "(III)V", (void *) android_glNormal3xOES__III }, +{"glOrthoxOES", "(IIIIII)V", (void *) android_glOrthoxOES__IIIIII }, +{"glPointParameterxOES", "(II)V", (void *) android_glPointParameterxOES__II }, +{"glPointParameterxvOES", "(I[II)V", (void *) android_glPointParameterxvOES__I_3II }, +{"glPointParameterxvOES", "(ILjava/nio/IntBuffer;)V", (void *) android_glPointParameterxvOES__ILjava_nio_IntBuffer_2 }, +{"glPointSizexOES", "(I)V", (void *) android_glPointSizexOES__I }, +{"glPolygonOffsetxOES", "(II)V", (void *) android_glPolygonOffsetxOES__II }, +{"glRotatexOES", "(IIII)V", (void *) android_glRotatexOES__IIII }, +{"glSampleCoveragexOES", "(IZ)V", (void *) android_glSampleCoveragexOES__IZ }, +{"glScalexOES", "(III)V", (void *) android_glScalexOES__III }, +{"glTexEnvxOES", "(III)V", (void *) android_glTexEnvxOES__III }, +{"glTexEnvxvOES", "(II[II)V", (void *) android_glTexEnvxvOES__II_3II }, +{"glTexEnvxvOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexEnvxvOES__IILjava_nio_IntBuffer_2 }, +{"glTexParameterxOES", "(III)V", (void *) android_glTexParameterxOES__III }, +{"glTexParameterxvOES", "(II[II)V", (void *) android_glTexParameterxvOES__II_3II }, +{"glTexParameterxvOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameterxvOES__IILjava_nio_IntBuffer_2 }, +{"glTranslatexOES", "(III)V", (void *) android_glTranslatexOES__III }, +{"glIsRenderbufferOES", "(I)Z", (void *) android_glIsRenderbufferOES__I }, +{"glBindRenderbufferOES", "(II)V", (void *) android_glBindRenderbufferOES__II }, +{"glDeleteRenderbuffersOES", "(I[II)V", (void *) android_glDeleteRenderbuffersOES__I_3II }, +{"glDeleteRenderbuffersOES", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteRenderbuffersOES__ILjava_nio_IntBuffer_2 }, +{"glGenRenderbuffersOES", "(I[II)V", (void *) android_glGenRenderbuffersOES__I_3II }, +{"glGenRenderbuffersOES", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenRenderbuffersOES__ILjava_nio_IntBuffer_2 }, +{"glRenderbufferStorageOES", "(IIII)V", (void *) android_glRenderbufferStorageOES__IIII }, +{"glGetRenderbufferParameterivOES", "(II[II)V", (void *) android_glGetRenderbufferParameterivOES__II_3II }, +{"glGetRenderbufferParameterivOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetRenderbufferParameterivOES__IILjava_nio_IntBuffer_2 }, +{"glIsFramebufferOES", "(I)Z", (void *) android_glIsFramebufferOES__I }, +{"glBindFramebufferOES", "(II)V", (void *) android_glBindFramebufferOES__II }, +{"glDeleteFramebuffersOES", "(I[II)V", (void *) android_glDeleteFramebuffersOES__I_3II }, +{"glDeleteFramebuffersOES", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteFramebuffersOES__ILjava_nio_IntBuffer_2 }, +{"glGenFramebuffersOES", "(I[II)V", (void *) android_glGenFramebuffersOES__I_3II }, +{"glGenFramebuffersOES", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenFramebuffersOES__ILjava_nio_IntBuffer_2 }, +{"glCheckFramebufferStatusOES", "(I)I", (void *) android_glCheckFramebufferStatusOES__I }, +{"glFramebufferRenderbufferOES", "(IIII)V", (void *) android_glFramebufferRenderbufferOES__IIII }, +{"glFramebufferTexture2DOES", "(IIIII)V", (void *) android_glFramebufferTexture2DOES__IIIII }, +{"glGetFramebufferAttachmentParameterivOES", "(III[II)V", (void *) android_glGetFramebufferAttachmentParameterivOES__III_3II }, +{"glGetFramebufferAttachmentParameterivOES", "(IIILjava/nio/IntBuffer;)V", (void *) android_glGetFramebufferAttachmentParameterivOES__IIILjava_nio_IntBuffer_2 }, +{"glGenerateMipmapOES", "(I)V", (void *) android_glGenerateMipmapOES__I }, +{"glCurrentPaletteMatrixOES", "(I)V", (void *) android_glCurrentPaletteMatrixOES__I }, +{"glLoadPaletteFromModelViewMatrixOES", "()V", (void *) android_glLoadPaletteFromModelViewMatrixOES__ }, +{"glMatrixIndexPointerOES", "(IIILjava/nio/Buffer;)V", (void *) android_glMatrixIndexPointerOES__IIILjava_nio_Buffer_2 }, +{"glWeightPointerOES", "(IIILjava/nio/Buffer;)V", (void *) android_glWeightPointerOES__IIILjava_nio_Buffer_2 }, +{"glDepthRangefOES", "(FF)V", (void *) android_glDepthRangefOES__FF }, +{"glFrustumfOES", "(FFFFFF)V", (void *) android_glFrustumfOES__FFFFFF }, +{"glOrthofOES", "(FFFFFF)V", (void *) android_glOrthofOES__FFFFFF }, +{"glClipPlanefOES", "(I[FI)V", (void *) android_glClipPlanefOES__I_3FI }, +{"glClipPlanefOES", "(ILjava/nio/FloatBuffer;)V", (void *) android_glClipPlanefOES__ILjava_nio_FloatBuffer_2 }, +{"glGetClipPlanefOES", "(I[FI)V", (void *) android_glGetClipPlanefOES__I_3FI }, +{"glGetClipPlanefOES", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetClipPlanefOES__ILjava_nio_FloatBuffer_2 }, +{"glClearDepthfOES", "(F)V", (void *) android_glClearDepthfOES__F }, +{"glTexGenfOES", "(IIF)V", (void *) android_glTexGenfOES__IIF }, +{"glTexGenfvOES", "(II[FI)V", (void *) android_glTexGenfvOES__II_3FI }, +{"glTexGenfvOES", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexGenfvOES__IILjava_nio_FloatBuffer_2 }, +{"glTexGeniOES", "(III)V", (void *) android_glTexGeniOES__III }, +{"glTexGenivOES", "(II[II)V", (void *) android_glTexGenivOES__II_3II }, +{"glTexGenivOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexGenivOES__IILjava_nio_IntBuffer_2 }, +{"glTexGenxOES", "(III)V", (void *) android_glTexGenxOES__III }, +{"glTexGenxvOES", "(II[II)V", (void *) android_glTexGenxvOES__II_3II }, +{"glTexGenxvOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexGenxvOES__IILjava_nio_IntBuffer_2 }, +{"glGetTexGenfvOES", "(II[FI)V", (void *) android_glGetTexGenfvOES__II_3FI }, +{"glGetTexGenfvOES", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexGenfvOES__IILjava_nio_FloatBuffer_2 }, +{"glGetTexGenivOES", "(II[II)V", (void *) android_glGetTexGenivOES__II_3II }, +{"glGetTexGenivOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexGenivOES__IILjava_nio_IntBuffer_2 }, +{"glGetTexGenxvOES", "(II[II)V", (void *) android_glGetTexGenxvOES__II_3II }, +{"glGetTexGenxvOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexGenxvOES__IILjava_nio_IntBuffer_2 }, +}; + +int register_android_opengl_jni_GLES11Ext(JNIEnv *_env) +{ + int err; + err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods)); + return err; +} diff --git a/core/jni/android_os_ParcelFileDescriptor.cpp b/core/jni/android_os_ParcelFileDescriptor.cpp index 971f87c..848a57a 100644 --- a/core/jni/android_os_ParcelFileDescriptor.cpp +++ b/core/jni/android_os_ParcelFileDescriptor.cpp @@ -1,19 +1,18 @@ -/* //device/libs/android_runtime/android_os_ParcelFileDescriptor.cpp -** -** Copyright 2008, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ //#define LOG_NDEBUG 0 diff --git a/core/jni/android_server_BluetoothA2dpService.cpp b/core/jni/android_server_BluetoothA2dpService.cpp index 062f893..fe94642 100644 --- a/core/jni/android_server_BluetoothA2dpService.cpp +++ b/core/jni/android_server_BluetoothA2dpService.cpp @@ -45,19 +45,19 @@ static jmethodID method_onSinkPlaying; static jmethodID method_onSinkStopped; typedef struct { - JNIEnv *env; + JavaVM *vm; + int envVer; DBusConnection *conn; jobject me; // for callbacks to java } native_data_t; static native_data_t *nat = NULL; // global native data -extern event_loop_native_data_t *event_loop_nat; // for the event loop JNIEnv #endif #ifdef HAVE_BLUETOOTH -static void onConnectSinkResult(DBusMessage *msg, void *user); -static void onDisconnectSinkResult(DBusMessage *msg, void *user); +static void onConnectSinkResult(DBusMessage *msg, void *user, void *nat); +static void onDisconnectSinkResult(DBusMessage *msg, void *user, void *nat); #endif /* Returns true on success (even if adapter is present but disabled). @@ -71,7 +71,8 @@ static bool initNative(JNIEnv* env, jobject object) { LOGE("%s: out of memory!", __FUNCTION__); return false; } - nat->env = env; + env->GetJavaVM( &(nat->vm) ); + nat->envVer = env->GetVersion(); nat->me = env->NewGlobalRef(object); DBusError err; @@ -175,7 +176,8 @@ static jboolean connectSinkNative(JNIEnv *env, jobject object, jstring path) { bool ret = dbus_func_args_async(env, nat->conn, -1, - onConnectSinkResult, (void *)c_path_copy, c_path, + onConnectSinkResult, (void *)c_path_copy, nat, + c_path, "org.bluez.audio.Sink", "Connect", DBUS_TYPE_INVALID); @@ -202,7 +204,8 @@ static jboolean disconnectSinkNative(JNIEnv *env, jobject object, bool ret = dbus_func_args_async(env, nat->conn, -1, - onDisconnectSinkResult, (void *)c_path_copy, c_path, + onDisconnectSinkResult, (void *)c_path_copy, nat, + c_path, "org.bluez.audio.Sink", "Disconnect", DBUS_TYPE_INVALID); env->ReleaseStringUTFChars(path, c_path); @@ -233,13 +236,19 @@ static jboolean isSinkConnectedNative(JNIEnv *env, jobject object, jstring path) } #ifdef HAVE_BLUETOOTH -static void onConnectSinkResult(DBusMessage *msg, void *user) { +static void onConnectSinkResult(DBusMessage *msg, void *user, void *natData) { LOGV(__FUNCTION__); char *c_path = (char *)user; DBusError err; + JNIEnv *env; + + if (nat->vm->GetEnv((void**)&env, nat->envVer) < 0) { + LOGE("%s: error finding Env for our VM\n", __FUNCTION__); + return; + } + dbus_error_init(&err); - JNIEnv *env = event_loop_nat->env; LOGV("... path = %s", c_path); if (dbus_set_error_from_message(&err, msg)) { @@ -258,13 +267,19 @@ static void onConnectSinkResult(DBusMessage *msg, void *user) { free(c_path); } -static void onDisconnectSinkResult(DBusMessage *msg, void *user) { +static void onDisconnectSinkResult(DBusMessage *msg, void *user, void *natData) { LOGV(__FUNCTION__); char *c_path = (char *)user; DBusError err; + JNIEnv *env; + + if (nat->vm->GetEnv((void**)&env, nat->envVer) < 0) { + LOGE("%s: error finding Env for our VM\n", __FUNCTION__); + return; + } + dbus_error_init(&err); - JNIEnv *env = event_loop_nat->env; LOGV("... path = %s", c_path); if (dbus_set_error_from_message(&err, msg)) { diff --git a/core/jni/android_server_BluetoothDeviceService.cpp b/core/jni/android_server_BluetoothDeviceService.cpp index a0e0b84..b6e9798 100644 --- a/core/jni/android_server_BluetoothDeviceService.cpp +++ b/core/jni/android_server_BluetoothDeviceService.cpp @@ -50,6 +50,7 @@ namespace android { // We initialize these variables when we load class // android.server.BluetoothDeviceService static jfieldID field_mNativeData; +static jfieldID field_mEventLoop; typedef struct { JNIEnv *env; @@ -57,8 +58,10 @@ typedef struct { const char *adapter; // dbus object name of the local adapter } native_data_t; -void onCreateBondingResult(DBusMessage *msg, void *user); -void onGetRemoteServiceChannelResult(DBusMessage *msg, void *user); +extern event_loop_native_data_t *get_EventLoop_native_data(JNIEnv *, + jobject); +void onCreateBondingResult(DBusMessage *msg, void *user, void *nat); +void onGetRemoteServiceChannelResult(DBusMessage *msg, void *user, void *nat); /** Get native data stored in the opaque (Java code maintained) pointer mNativeData * Perform quick sanity check, if there are any problems return NULL @@ -78,6 +81,8 @@ static void classInitNative(JNIEnv* env, jclass clazz) { LOGV(__FUNCTION__); #ifdef HAVE_BLUETOOTH field_mNativeData = get_field(env, clazz, "mNativeData", "I"); + field_mEventLoop = get_field(env, clazz, "mEventLoop", + "Landroid/server/BluetoothEventLoop;"); #endif } @@ -472,14 +477,19 @@ static jboolean createBondingNative(JNIEnv *env, jobject object, LOGV(__FUNCTION__); #ifdef HAVE_BLUETOOTH native_data_t *nat = get_native_data(env, object); - if (nat) { + jobject eventLoop = env->GetObjectField(object, field_mEventLoop); + struct event_loop_native_data_t *eventLoopNat = + get_EventLoop_native_data(env, eventLoop); + + if (nat && eventLoopNat) { const char *c_address = env->GetStringUTFChars(address, NULL); LOGV("... address = %s", c_address); char *context_address = (char *)calloc(BTADDR_SIZE, sizeof(char)); strlcpy(context_address, c_address, BTADDR_SIZE); // for callback bool ret = dbus_func_args_async(env, nat->conn, (int)timeout_ms, onCreateBondingResult, // callback - context_address, // user data + context_address, + eventLoopNat, nat->adapter, DBUS_CLASS_NAME, "CreateBonding", DBUS_TYPE_STRING, &c_address, @@ -856,7 +866,10 @@ static jboolean getRemoteServiceChannelNative(JNIEnv *env, jobject object, #ifdef HAVE_BLUETOOTH LOGV(__FUNCTION__); native_data_t *nat = get_native_data(env, object); - if (nat) { + jobject eventLoop = env->GetObjectField(object, field_mEventLoop); + struct event_loop_native_data_t *eventLoopNat = + get_EventLoop_native_data(env, eventLoop); + if (nat && eventLoopNat) { const char *c_address = env->GetStringUTFChars(address, NULL); char *context_address = (char *)calloc(BTADDR_SIZE, sizeof(char)); strlcpy(context_address, c_address, BTADDR_SIZE); @@ -866,6 +879,7 @@ static jboolean getRemoteServiceChannelNative(JNIEnv *env, jobject object, bool ret = dbus_func_args_async(env, nat->conn, 20000, // ms onGetRemoteServiceChannelResult, context_address, + eventLoopNat, nat->adapter, DBUS_CLASS_NAME, "GetRemoteServiceChannel", DBUS_TYPE_STRING, &c_address, diff --git a/core/jni/android_server_BluetoothEventLoop.cpp b/core/jni/android_server_BluetoothEventLoop.cpp index c03bab6..7c5da5b 100644 --- a/core/jni/android_server_BluetoothEventLoop.cpp +++ b/core/jni/android_server_BluetoothEventLoop.cpp @@ -18,6 +18,7 @@ #include "android_bluetooth_common.h" #include "android_runtime/AndroidRuntime.h" +#include "cutils/sockets.h" #include "JNIHelp.h" #include "jni.h" #include "utils/Log.h" @@ -65,14 +66,15 @@ static jmethodID method_onRestartRequired; typedef event_loop_native_data_t native_data_t; -// Only valid during waitForAndDispatchEventNative() -native_data_t *event_loop_nat; - static inline native_data_t * get_native_data(JNIEnv *env, jobject object) { return (native_data_t *)(env->GetIntField(object, field_mNativeData)); } +native_data_t *get_EventLoop_native_data(JNIEnv *env, jobject object) { + return get_native_data(env, object); +} + #endif static void classInitNative(JNIEnv* env, jclass clazz) { LOGV(__FUNCTION__); @@ -115,6 +117,10 @@ static void initializeNativeDataNative(JNIEnv* env, jobject object) { LOGE("%s: out of memory!", __FUNCTION__); return; } + memset(nat, 0, sizeof(native_data_t)); + + pthread_mutex_init(&(nat->thread_mutex), NULL); + env->SetIntField(object, field_mNativeData, (jint)nat); { @@ -135,6 +141,9 @@ static void cleanupNativeDataNative(JNIEnv* env, jobject object) { #ifdef HAVE_BLUETOOTH native_data_t *nat = (native_data_t *)env->GetIntField(object, field_mNativeData); + + pthread_mutex_destroy(&(nat->thread_mutex)); + if (nat) { free(nat); } @@ -151,13 +160,11 @@ static DBusHandlerResult agent_event_filter(DBusConnection *conn, static const DBusObjectPathVTable agent_vtable = { NULL, agent_event_filter, NULL, NULL, NULL, NULL }; -#endif -static jboolean setUpEventLoopNative(JNIEnv *env, jobject object) { -#ifdef HAVE_BLUETOOTH + +static jboolean setUpEventLoop(native_data_t *nat) { LOGV(__FUNCTION__); dbus_threads_init_default(); - native_data_t *nat = get_native_data(env, object); DBusError err; dbus_error_init(&err); @@ -207,7 +214,7 @@ static jboolean setUpEventLoopNative(JNIEnv *env, jobject object) { // Add an object handler for passkey agent method calls const char *path = "/android/bluetooth/Agent"; if (!dbus_connection_register_object_path(nat->conn, path, - &agent_vtable, NULL)) { + &agent_vtable, nat)) { LOGE("%s: Can't register object path %s for agent!", __FUNCTION__, path); return JNI_FALSE; @@ -217,7 +224,7 @@ static jboolean setUpEventLoopNative(JNIEnv *env, jobject object) { // trying for 10 seconds. int attempt; for (attempt = 0; attempt < 1000; attempt++) { - DBusMessage *reply = dbus_func_args_error(env, nat->conn, &err, + DBusMessage *reply = dbus_func_args_error(NULL, nat->conn, &err, BLUEZ_DBUS_BASE_PATH, "org.bluez.Security", "RegisterDefaultPasskeyAgent", DBUS_TYPE_STRING, &path, @@ -245,7 +252,7 @@ static jboolean setUpEventLoopNative(JNIEnv *env, jobject object) { } // Now register the Auth agent - DBusMessage *reply = dbus_func_args_error(env, nat->conn, &err, + DBusMessage *reply = dbus_func_args_error(NULL, nat->conn, &err, BLUEZ_DBUS_BASE_PATH, "org.bluez.Security", "RegisterDefaultAuthorizationAgent", DBUS_TYPE_STRING, &path, @@ -259,14 +266,11 @@ static jboolean setUpEventLoopNative(JNIEnv *env, jobject object) { return JNI_TRUE; } -#endif return JNI_FALSE; } -static void tearDownEventLoopNative(JNIEnv *env, jobject object) { +static void tearDownEventLoop(native_data_t *nat) { LOGV(__FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); if (nat != NULL && nat->conn != NULL) { DBusError err; @@ -274,14 +278,14 @@ static void tearDownEventLoopNative(JNIEnv *env, jobject object) { const char *path = "/android/bluetooth/Agent"; DBusMessage *reply = - dbus_func_args(env, nat->conn, BLUEZ_DBUS_BASE_PATH, + dbus_func_args(NULL, nat->conn, BLUEZ_DBUS_BASE_PATH, "org.bluez.Security", "UnregisterDefaultPasskeyAgent", DBUS_TYPE_STRING, &path, DBUS_TYPE_INVALID); if (reply) dbus_message_unref(reply); reply = - dbus_func_args(env, nat->conn, BLUEZ_DBUS_BASE_PATH, + dbus_func_args(NULL, nat->conn, BLUEZ_DBUS_BASE_PATH, "org.bluez.Security", "UnregisterDefaultAuthorizationAgent", DBUS_TYPE_STRING, &path, DBUS_TYPE_INVALID); @@ -322,7 +326,308 @@ static void tearDownEventLoopNative(JNIEnv *env, jobject object) { dbus_connection_remove_filter(nat->conn, event_filter, nat); } -#endif +} + + +#define EVENT_LOOP_EXIT 1 +#define EVENT_LOOP_ADD 2 +#define EVENT_LOOP_REMOVE 3 + +dbus_bool_t dbusAddWatch(DBusWatch *watch, void *data) { + native_data_t *nat = (native_data_t *)data; + + if (dbus_watch_get_enabled(watch)) { + // note that we can't just send the watch and inspect it later + // because we may get a removeWatch call before this data is reacted + // to by our eventloop and remove this watch.. reading the add first + // and then inspecting the recently deceased watch would be bad. + char control = EVENT_LOOP_ADD; + write(nat->controlFdW, &control, sizeof(char)); + + int fd = dbus_watch_get_fd(watch); + write(nat->controlFdW, &fd, sizeof(int)); + + unsigned int flags = dbus_watch_get_flags(watch); + write(nat->controlFdW, &flags, sizeof(unsigned int)); + + write(nat->controlFdW, &watch, sizeof(DBusWatch*)); + } + return true; +} + +void dbusRemoveWatch(DBusWatch *watch, void *data) { + native_data_t *nat = (native_data_t *)data; + + char control = EVENT_LOOP_REMOVE; + write(nat->controlFdW, &control, sizeof(char)); + + int fd = dbus_watch_get_fd(watch); + write(nat->controlFdW, &fd, sizeof(int)); + + unsigned int flags = dbus_watch_get_flags(watch); + write(nat->controlFdW, &flags, sizeof(unsigned int)); +} + +void dbusToggleWatch(DBusWatch *watch, void *data) { + if (dbus_watch_get_enabled(watch)) { + dbusAddWatch(watch, data); + } else { + dbusRemoveWatch(watch, data); + } +} + +static void handleWatchAdd(native_data_t *nat) { + DBusWatch *watch; + int newFD; + unsigned int flags; + + read(nat->controlFdR, &newFD, sizeof(int)); + read(nat->controlFdR, &flags, sizeof(unsigned int)); + read(nat->controlFdR, &watch, sizeof(DBusWatch *)); + int events = (flags & DBUS_WATCH_READABLE ? POLLIN : 0) + | (flags & DBUS_WATCH_WRITABLE ? POLLOUT : 0); + + for (int y = 0; y<nat->pollMemberCount; y++) { + if ((nat->pollData[y].fd == newFD) && + (nat->pollData[y].events == events)) { + LOGV("DBusWatch duplicate add"); + return; + } + } + if (nat->pollMemberCount == nat->pollDataSize) { + LOGV("Bluetooth EventLoop poll struct growing"); + struct pollfd *temp = (struct pollfd *)malloc( + sizeof(struct pollfd) * (nat->pollMemberCount+1)); + if (!temp) { + return; + } + memcpy(temp, nat->pollData, sizeof(struct pollfd) * + nat->pollMemberCount); + free(nat->pollData); + nat->pollData = temp; + DBusWatch **temp2 = (DBusWatch **)malloc(sizeof(DBusWatch *) * + (nat->pollMemberCount+1)); + if (!temp2) { + return; + } + memcpy(temp2, nat->watchData, sizeof(DBusWatch *) * + nat->pollMemberCount); + free(nat->watchData); + nat->watchData = temp2; + nat->pollDataSize++; + } + nat->pollData[nat->pollMemberCount].fd = newFD; + nat->pollData[nat->pollMemberCount].revents = 0; + nat->pollData[nat->pollMemberCount].events = events; + nat->watchData[nat->pollMemberCount] = watch; + nat->pollMemberCount++; +} + +static void handleWatchRemove(native_data_t *nat) { + int removeFD; + unsigned int flags; + + read(nat->controlFdR, &removeFD, sizeof(int)); + read(nat->controlFdR, &flags, sizeof(unsigned int)); + int events = (flags & DBUS_WATCH_READABLE ? POLLIN : 0) + | (flags & DBUS_WATCH_WRITABLE ? POLLOUT : 0); + + for (int y = 0; y < nat->pollMemberCount; y++) { + if ((nat->pollData[y].fd == removeFD) && + (nat->pollData[y].events == events)) { + int newCount = --nat->pollMemberCount; + // copy the last live member over this one + nat->pollData[y].fd = nat->pollData[newCount].fd; + nat->pollData[y].events = nat->pollData[newCount].events; + nat->pollData[y].revents = nat->pollData[newCount].revents; + nat->watchData[y] = nat->watchData[newCount]; + return; + } + } + LOGW("WatchRemove given with unknown watch"); +} + +static void *eventLoopMain(void *ptr) { + native_data_t *nat = (native_data_t *)ptr; + JNIEnv *env; + + JavaVMAttachArgs args; + char name[] = "BT EventLoop"; + args.version = nat->envVer; + args.name = name; + args.group = NULL; + + nat->vm->AttachCurrentThread(&env, &args); + + dbus_connection_set_watch_functions(nat->conn, dbusAddWatch, + dbusRemoveWatch, dbusToggleWatch, ptr, NULL); + + while (1) { + for (int i = 0; i < nat->pollMemberCount; i++) { + if (!nat->pollData[i].revents) { + continue; + } + if (nat->pollData[i].fd == nat->controlFdR) { + char data; + while (recv(nat->controlFdR, &data, sizeof(char), MSG_DONTWAIT) + != -1) { + switch (data) { + case EVENT_LOOP_EXIT: + { + dbus_connection_set_watch_functions(nat->conn, + NULL, NULL, NULL, NULL, NULL); + tearDownEventLoop(nat); + nat->vm->DetachCurrentThread(); + shutdown(nat->controlFdR,SHUT_RDWR); + return NULL; + } + case EVENT_LOOP_ADD: + { + handleWatchAdd(nat); + break; + } + case EVENT_LOOP_REMOVE: + { + handleWatchRemove(nat); + break; + } + } + } + } else { + int event = nat->pollData[i].revents; + int flags = (event & POLLIN ? DBUS_WATCH_READABLE : 0) | + (event & POLLOUT ? DBUS_WATCH_WRITABLE : 0); + dbus_watch_handle(nat->watchData[i], event); + nat->pollData[i].revents = 0; + // can only do one - it may have caused a 'remove' + break; + } + } + while (dbus_connection_dispatch(nat->conn) == + DBUS_DISPATCH_DATA_REMAINS) { + } + + poll(nat->pollData, nat->pollMemberCount, -1); + } +} +#endif // HAVE_BLUETOOTH + +static jboolean startEventLoopNative(JNIEnv *env, jobject object) { + jboolean result = JNI_FALSE; +#ifdef HAVE_BLUETOOTH + event_loop_native_data_t *nat = get_native_data(env, object); + + pthread_mutex_lock(&(nat->thread_mutex)); + + if (nat->pollData) { + LOGW("trying to start EventLoop a second time!"); + pthread_mutex_unlock( &(nat->thread_mutex) ); + return JNI_FALSE; + } + + nat->pollData = (struct pollfd *)malloc(sizeof(struct pollfd) * + DEFAULT_INITIAL_POLLFD_COUNT); + if (!nat->pollData) { + LOGE("out of memory error starting EventLoop!"); + goto done; + } + + nat->watchData = (DBusWatch **)malloc(sizeof(DBusWatch *) * + DEFAULT_INITIAL_POLLFD_COUNT); + if (!nat->watchData) { + LOGE("out of memory error starting EventLoop!"); + goto done; + } + + memset(nat->pollData, 0, sizeof(struct pollfd) * + DEFAULT_INITIAL_POLLFD_COUNT); + memset(nat->watchData, 0, sizeof(DBusWatch *) * + DEFAULT_INITIAL_POLLFD_COUNT); + nat->pollDataSize = DEFAULT_INITIAL_POLLFD_COUNT; + nat->pollMemberCount = 1; + + if (socketpair(AF_LOCAL, SOCK_STREAM, 0, &(nat->controlFdR))) { + LOGE("Error getting BT control socket"); + goto done; + } + nat->pollData[0].fd = nat->controlFdR; + nat->pollData[0].events = POLLIN; + + env->GetJavaVM( &(nat->vm) ); + nat->envVer = env->GetVersion(); + + nat->me = env->NewGlobalRef(object); + + if (setUpEventLoop(nat) != JNI_TRUE) { + LOGE("failure setting up Event Loop!"); + goto done; + } + + pthread_create(&(nat->thread), NULL, eventLoopMain, nat); + result = JNI_TRUE; + +done: + if (JNI_FALSE == result) { + if (nat->controlFdW || nat->controlFdR) { + shutdown(nat->controlFdW, SHUT_RDWR); + nat->controlFdW = 0; + nat->controlFdR = 0; + } + if (nat->me) env->DeleteGlobalRef(nat->me); + nat->me = NULL; + if (nat->pollData) free(nat->pollData); + nat->pollData = NULL; + if (nat->watchData) free(nat->watchData); + nat->watchData = NULL; + nat->pollDataSize = 0; + nat->pollMemberCount = 0; + } + + pthread_mutex_unlock(&(nat->thread_mutex)); +#endif // HAVE_BLUETOOTH + return result; +} + +static void stopEventLoopNative(JNIEnv *env, jobject object) { +#ifdef HAVE_BLUETOOTH + native_data_t *nat = get_native_data(env, object); + + pthread_mutex_lock(&(nat->thread_mutex)); + if (nat->pollData) { + char data = EVENT_LOOP_EXIT; + ssize_t t = write(nat->controlFdW, &data, sizeof(char)); + void *ret; + pthread_join(nat->thread, &ret); + + env->DeleteGlobalRef(nat->me); + nat->me = NULL; + free(nat->pollData); + nat->pollData = NULL; + free(nat->watchData); + nat->watchData = NULL; + nat->pollDataSize = 0; + nat->pollMemberCount = 0; + shutdown(nat->controlFdW, SHUT_RDWR); + nat->controlFdW = 0; + nat->controlFdR = 0; + } + pthread_mutex_unlock(&(nat->thread_mutex)); +#endif // HAVE_BLUETOOTH +} + +static jboolean isEventLoopRunningNative(JNIEnv *env, jobject object) { + jboolean result = JNI_FALSE; +#ifdef HAVE_BLUETOOTH + native_data_t *nat = get_native_data(env, object); + + pthread_mutex_lock(&(nat->thread_mutex)); + if (nat->pollData) { + result = JNI_TRUE; + } + pthread_mutex_unlock(&(nat->thread_mutex)); + +#endif // HAVE_BLUETOOTH + return result; } #ifdef HAVE_BLUETOOTH @@ -338,7 +643,7 @@ static DBusHandlerResult event_filter(DBusConnection *conn, DBusMessage *msg, dbus_error_init(&err); nat = (native_data_t *)data; - env = nat->env; + nat->vm->GetEnv((void**)&env, nat->envVer); if (dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_SIGNAL) { LOGV("%s: not interested (not a signal).", __FUNCTION__); return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; @@ -556,11 +861,9 @@ static DBusHandlerResult event_filter(DBusConnection *conn, DBusMessage *msg, // Called by dbus during WaitForAndDispatchEventNative() static DBusHandlerResult agent_event_filter(DBusConnection *conn, DBusMessage *msg, void *data) { - native_data_t *nat = event_loop_nat; + native_data_t *nat = (native_data_t *)data; JNIEnv *env; - - - env = nat->env; + nat->vm->GetEnv((void**)&env, nat->envVer); if (dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_METHOD_CALL) { LOGV("%s: not interested (not a method call).", __FUNCTION__); return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; @@ -730,27 +1033,6 @@ static DBusHandlerResult agent_event_filter(DBusConnection *conn, } #endif -static jboolean waitForAndDispatchEventNative(JNIEnv *env, jobject object, - jint timeout_ms) { -#ifdef HAVE_BLUETOOTH - //LOGV("%s: %8d (pid %d tid %d)",__FUNCTION__, time(NULL), getpid(), gettid()); // too chatty - native_data_t *nat = get_native_data(env, object); - if (nat != NULL && nat->conn != NULL) { - jboolean ret; - nat->me = object; - nat->env = env; - event_loop_nat = nat; - ret = dbus_connection_read_write_dispatch_greedy(nat->conn, - timeout_ms) == TRUE ? - JNI_TRUE : JNI_FALSE; - event_loop_nat = NULL; - nat->me = NULL; - nat->env = NULL; - return ret; - } -#endif - return JNI_FALSE; -} #ifdef HAVE_BLUETOOTH //TODO: Unify result codes in a header @@ -761,13 +1043,16 @@ static jboolean waitForAndDispatchEventNative(JNIEnv *env, jobject object, #define BOND_RESULT_AUTH_CANCELED 3 #define BOND_RESULT_REMOTE_DEVICE_DOWN 4 #define BOND_RESULT_DISCOVERY_IN_PROGRESS 5 -void onCreateBondingResult(DBusMessage *msg, void *user) { + +void onCreateBondingResult(DBusMessage *msg, void *user, void *n) { LOGV(__FUNCTION__); + native_data_t *nat = (native_data_t *)n; const char *address = (const char *)user; DBusError err; dbus_error_init(&err); - JNIEnv *env = event_loop_nat->env; + JNIEnv *env; + nat->vm->GetEnv((void**)&env, nat->envVer); LOGV("... address = %s", address); @@ -809,7 +1094,7 @@ void onCreateBondingResult(DBusMessage *msg, void *user) { } } - env->CallVoidMethod(event_loop_nat->me, + env->CallVoidMethod(nat->me, method_onCreateBondingResult, env->NewStringUTF(address), result); @@ -818,13 +1103,17 @@ done: free(user); } -void onGetRemoteServiceChannelResult(DBusMessage *msg, void *user) { +void onGetRemoteServiceChannelResult(DBusMessage *msg, void *user, void *n) { LOGV(__FUNCTION__); const char *address = (const char *) user; + native_data_t *nat = (native_data_t *) n; + DBusError err; dbus_error_init(&err); - JNIEnv *env = event_loop_nat->env; + JNIEnv *env; + nat->vm->GetEnv((void**)&env, nat->envVer); + jint channel = -2; LOGV("... address = %s", address); @@ -839,7 +1128,7 @@ void onGetRemoteServiceChannelResult(DBusMessage *msg, void *user) { } done: - env->CallVoidMethod(event_loop_nat->me, + env->CallVoidMethod(nat->me, method_onGetRemoteServiceChannelResult, env->NewStringUTF(address), channel); @@ -852,9 +1141,9 @@ static JNINativeMethod sMethods[] = { {"classInitNative", "()V", (void *)classInitNative}, {"initializeNativeDataNative", "()V", (void *)initializeNativeDataNative}, {"cleanupNativeDataNative", "()V", (void *)cleanupNativeDataNative}, - {"setUpEventLoopNative", "()Z", (void *)setUpEventLoopNative}, - {"tearDownEventLoopNative", "()V", (void *)tearDownEventLoopNative}, - {"waitForAndDispatchEventNative", "(I)Z", (void *)waitForAndDispatchEventNative} + {"startEventLoopNative", "()V", (void *)startEventLoopNative}, + {"stopEventLoopNative", "()V", (void *)stopEventLoopNative}, + {"isEventLoopRunningNative", "()Z", (void *)isEventLoopRunningNative} }; int register_android_server_BluetoothEventLoop(JNIEnv *env) { diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp index 3feccde..d760feb 100644 --- a/core/jni/android_util_Process.cpp +++ b/core/jni/android_util_Process.cpp @@ -50,6 +50,16 @@ pid_t gettid() { return syscall(__NR_gettid);} #undef __KERNEL__ #endif +#define ENABLE_CGROUP_ERR_LOGGING 0 + +/* + * List of cgroup names which map to ANDROID_TGROUP_ values in Thread.h + * and Process.java + * These names are used to construct the path to the cgroup control dir + */ + +static const char *cgroup_names[] = { NULL, "bg_non_interactive", "fg_boost" }; + using namespace android; static void signalExceptionForPriorityError(JNIEnv* env, jobject obj, int err) @@ -73,6 +83,28 @@ static void signalExceptionForPriorityError(JNIEnv* env, jobject obj, int err) } } +static void signalExceptionForGroupError(JNIEnv* env, jobject obj, int err) +{ + switch (err) { + case EINVAL: + jniThrowException(env, "java/lang/IllegalArgumentException", NULL); + break; + case ESRCH: + jniThrowException(env, "java/lang/IllegalArgumentException", "Given thread does not exist"); + break; + case EPERM: + jniThrowException(env, "java/lang/SecurityException", "No permission to modify given thread"); + break; + case EACCES: + jniThrowException(env, "java/lang/SecurityException", "No permission to set to given group"); + break; + default: + jniThrowException(env, "java/lang/RuntimeException", "Unknown error"); + break; + } +} + + static void fakeProcessEntry(void* arg) { String8* cls = (String8*)arg; @@ -164,9 +196,55 @@ jint android_os_Process_getGidForName(JNIEnv* env, jobject clazz, jstring name) return -1; } +static int add_pid_to_cgroup(int pid, int grp) +{ + FILE *fp; + char path[255]; + int rc; + + sprintf(path, "/dev/cpuctl/%s/tasks", (cgroup_names[grp] ? cgroup_names[grp] : "")); + + if (!(fp = fopen(path, "w"))) { +#if ENABLE_CGROUP_ERR_LOGGING + LOGW("Unable to open %s (%s)\n", path, strerror(errno)); +#endif + return -errno; + } + + rc = fprintf(fp, "%d", pid); + fclose(fp); + + if (rc < 0) { +#if ENABLE_CGROUP_ERR_LOGGING + LOGW("Unable to move pid %d to cgroup %s (%s)\n", pid, + (cgroup_names[grp] ? cgroup_names[grp] : "<default>"), + strerror(errno)); +#endif + } + + return (rc < 0) ? errno : 0; +} + +void android_os_Process_setThreadGroup(JNIEnv* env, jobject clazz, int pid, jint grp) +{ + if (grp > ANDROID_TGROUP_MAX || grp < 0) { + signalExceptionForGroupError(env, clazz, EINVAL); + return; + } + + if (add_pid_to_cgroup(pid, grp)) + signalExceptionForGroupError(env, clazz, errno); +} + void android_os_Process_setThreadPriority(JNIEnv* env, jobject clazz, jint pid, jint pri) { + if (pri == ANDROID_PRIORITY_BACKGROUND) { + add_pid_to_cgroup(pid, ANDROID_TGROUP_BG_NONINTERACT); + } else if (getpriority(PRIO_PROCESS, pid) == ANDROID_PRIORITY_BACKGROUND) { + add_pid_to_cgroup(pid, ANDROID_TGROUP_DEFAULT); + } + if (setpriority(PRIO_PROCESS, pid, pri) < 0) { signalExceptionForPriorityError(env, clazz, errno); } @@ -516,39 +594,10 @@ enum { PROC_OUT_FLOAT = 0x4000, }; -jboolean android_os_Process_readProcFile(JNIEnv* env, jobject clazz, - jstring file, jintArray format, jobjectArray outStrings, - jlongArray outLongs, jfloatArray outFloats) +jboolean android_os_Process_parseProcLineArray(JNIEnv* env, jobject clazz, + char* buffer, jint startIndex, jint endIndex, jintArray format, + jobjectArray outStrings, jlongArray outLongs, jfloatArray outFloats) { - if (file == NULL || format == NULL) { - jniThrowException(env, "java/lang/NullPointerException", NULL); - return JNI_FALSE; - } - - const char* file8 = env->GetStringUTFChars(file, NULL); - if (file8 == NULL) { - jniThrowException(env, "java/lang/OutOfMemoryError", NULL); - return JNI_FALSE; - } - int fd = open(file8, O_RDONLY); - env->ReleaseStringUTFChars(file, file8); - - if (fd < 0) { - //LOGW("Unable to open process file: %s\n", file8); - return JNI_FALSE; - } - - char buffer[256]; - const int len = read(fd, buffer, sizeof(buffer)-1); - close(fd); - - if (len < 0) { - //LOGW("Unable to open process file: %s fd=%d\n", file8, fd); - return JNI_FALSE; - } - buffer[len] = 0; - - //LOGI("Process file %s: %s\n", file8, buffer); const jsize NF = env->GetArrayLength(format); const jsize NS = outStrings ? env->GetArrayLength(outStrings) : 0; @@ -575,7 +624,7 @@ jboolean android_os_Process_readProcFile(JNIEnv* env, jobject clazz, return JNI_FALSE; } - jsize i = 0; + jsize i = startIndex; jsize di = 0; jboolean res = JNI_TRUE; @@ -587,30 +636,30 @@ jboolean android_os_Process_readProcFile(JNIEnv* env, jobject clazz, } const char term = (char)(mode&PROC_TERM_MASK); const jsize start = i; - if (i >= len) { + if (i >= endIndex) { res = JNI_FALSE; break; } jsize end = -1; if ((mode&PROC_PARENS) != 0) { - while (buffer[i] != ')' && i < len) { + while (buffer[i] != ')' && i < endIndex) { i++; } end = i; i++; } - while (buffer[i] != term && i < len) { + while (buffer[i] != term && i < endIndex) { i++; } if (end < 0) { end = i; } - if (i < len) { + if (i < endIndex) { i++; if ((mode&PROC_COMBINE) != 0) { - while (buffer[i] == term && i < len) { + while (buffer[i] == term && i < endIndex) { i++; } } @@ -649,6 +698,58 @@ jboolean android_os_Process_readProcFile(JNIEnv* env, jobject clazz, return res; } +jboolean android_os_Process_parseProcLine(JNIEnv* env, jobject clazz, + jbyteArray buffer, jint startIndex, jint endIndex, jintArray format, + jobjectArray outStrings, jlongArray outLongs, jfloatArray outFloats) +{ + jbyte* bufferArray = env->GetByteArrayElements(buffer, NULL); + + jboolean result = android_os_Process_parseProcLineArray(env, clazz, + (char*) bufferArray, startIndex, endIndex, format, outStrings, + outLongs, outFloats); + + env->ReleaseByteArrayElements(buffer, bufferArray, 0); + + return result; +} + +jboolean android_os_Process_readProcFile(JNIEnv* env, jobject clazz, + jstring file, jintArray format, jobjectArray outStrings, + jlongArray outLongs, jfloatArray outFloats) +{ + if (file == NULL || format == NULL) { + jniThrowException(env, "java/lang/NullPointerException", NULL); + return JNI_FALSE; + } + + const char* file8 = env->GetStringUTFChars(file, NULL); + if (file8 == NULL) { + jniThrowException(env, "java/lang/OutOfMemoryError", NULL); + return JNI_FALSE; + } + int fd = open(file8, O_RDONLY); + env->ReleaseStringUTFChars(file, file8); + + if (fd < 0) { + //LOGW("Unable to open process file: %s\n", file8); + return JNI_FALSE; + } + + char buffer[256]; + const int len = read(fd, buffer, sizeof(buffer)-1); + close(fd); + + if (len < 0) { + //LOGW("Unable to open process file: %s fd=%d\n", file8, fd); + return JNI_FALSE; + } + buffer[len] = 0; + + return android_os_Process_parseProcLineArray(env, clazz, buffer, 0, len, + format, outStrings, outLongs, outFloats); + +} + void android_os_Process_setApplicationObject(JNIEnv* env, jobject clazz, jobject binderObject) { @@ -718,6 +819,7 @@ static const JNINativeMethod methods[] = { {"setThreadPriority", "(II)V", (void*)android_os_Process_setThreadPriority}, {"setThreadPriority", "(I)V", (void*)android_os_Process_setCallingThreadPriority}, {"getThreadPriority", "(I)I", (void*)android_os_Process_getThreadPriority}, + {"setThreadGroup", "(II)V", (void*)android_os_Process_setThreadGroup}, {"setOomAdj", "(II)Z", (void*)android_os_Process_setOomAdj}, {"setArgV0", "(Ljava/lang/String;)V", (void*)android_os_Process_setArgV0}, {"setUid", "(I)I", (void*)android_os_Process_setUid}, @@ -728,6 +830,7 @@ static const JNINativeMethod methods[] = { {"readProcLines", "(Ljava/lang/String;[Ljava/lang/String;[J)V", (void*)android_os_Process_readProcLines}, {"getPids", "(Ljava/lang/String;[I)[I", (void*)android_os_Process_getPids}, {"readProcFile", "(Ljava/lang/String;[I[Ljava/lang/String;[J[F)Z", (void*)android_os_Process_readProcFile}, + {"parseProcLine", "([BII[I[Ljava/lang/String;[J[F)Z", (void*)android_os_Process_parseProcLine}, {"getElapsedCpuTime", "()J", (void*)android_os_Process_getElapsedCpuTime}, {"getPss", "(I)J", (void*)android_os_Process_getPss}, //{"setApplicationObject", "(Landroid/os/IBinder;)V", (void*)android_os_Process_setApplicationObject}, @@ -746,4 +849,3 @@ int register_android_os_Process(JNIEnv* env) env, kProcessPathName, methods, NELEM(methods)); } - diff --git a/core/jni/com_google_android_gles_jni_GLImpl.cpp b/core/jni/com_google_android_gles_jni_GLImpl.cpp index 9b09c9b..11822e0 100644 --- a/core/jni/com_google_android_gles_jni_GLImpl.cpp +++ b/core/jni/com_google_android_gles_jni_GLImpl.cpp @@ -22,11 +22,20 @@ #include <assert.h> #include <GLES/gl.h> +#include <GLES/glext.h> -#include <private/opengles/gl_context.h> - -#define _NUM_COMPRESSED_TEXTURE_FORMATS \ - (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS) +/* special calls implemented in Android's GLES wrapper used to more + * efficiently bound-check passed arrays */ +extern "C" { +GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride, + const GLvoid *ptr, GLsizei count); +GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride, + const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); +} static int initialized = 0; @@ -45,7 +54,7 @@ static jfieldID elementSizeShiftID; /* Cache method IDs each time the class is loaded. */ -void +static void nativeClassInitBuffer(JNIEnv *_env) { jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); @@ -67,7 +76,6 @@ nativeClassInitBuffer(JNIEnv *_env) _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); } - static void nativeClassInit(JNIEnv *_env, jclass glImplClass) { @@ -118,7 +126,6 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) return (void *) ((char *) data + offset); } - static void releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) { @@ -126,6 +133,13 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) commit ? 0 : JNI_ABORT); } +static int +getNumCompressedTextureFormats() { + int numCompressedTextureFormats = 0; + glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats); + return numCompressedTextureFormats; +} + // -------------------------------------------------------------------------- /* void glActiveTexture ( GLenum texture ) */ @@ -290,7 +304,13 @@ android_glColorPointerBounds__IIILjava_nio_Buffer_2I jint _remaining; GLvoid *pointer = (GLvoid *) 0; - pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining); + if (pointer_buf) { + pointer = (GLvoid *) _env->GetDirectBufferAddress(pointer_buf); + if ( ! pointer ) { + _env->ThrowNew(IAEClass, "Must use a native order direct Buffer"); + return; + } + } glColorPointerBounds( (GLint)size, (GLenum)type, @@ -298,9 +318,6 @@ android_glColorPointerBounds__IIILjava_nio_Buffer_2I (GLvoid *)pointer, (GLsizei)remaining ); - if (_array) { - releasePointer(_env, _array, pointer, JNI_FALSE); - } } /* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */ @@ -1022,6 +1039,12 @@ android_glGetIntegerv__I_3II #if defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES) case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: #endif // defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES) +#if defined(GL_LIGHT_MODEL_COLOR_CONTROL) + case GL_LIGHT_MODEL_COLOR_CONTROL: +#endif // defined(GL_LIGHT_MODEL_COLOR_CONTROL) +#if defined(GL_LIGHT_MODEL_LOCAL_VIEWER) + case GL_LIGHT_MODEL_LOCAL_VIEWER: +#endif // defined(GL_LIGHT_MODEL_LOCAL_VIEWER) #if defined(GL_LIGHT_MODEL_TWO_SIDE) case GL_LIGHT_MODEL_TWO_SIDE: #endif // defined(GL_LIGHT_MODEL_TWO_SIDE) @@ -1236,6 +1259,12 @@ android_glGetIntegerv__I_3II #if defined(GL_COLOR_WRITEMASK) case GL_COLOR_WRITEMASK: #endif // defined(GL_COLOR_WRITEMASK) +#if defined(GL_FOG_COLOR) + case GL_FOG_COLOR: +#endif // defined(GL_FOG_COLOR) +#if defined(GL_LIGHT_MODEL_AMBIENT) + case GL_LIGHT_MODEL_AMBIENT: +#endif // defined(GL_LIGHT_MODEL_AMBIENT) #if defined(GL_SCISSOR_BOX) case GL_SCISSOR_BOX: #endif // defined(GL_SCISSOR_BOX) @@ -1267,13 +1296,7 @@ android_glGetIntegerv__I_3II #if defined(GL_COMPRESSED_TEXTURE_FORMATS) case GL_COMPRESSED_TEXTURE_FORMATS: #endif // defined(GL_COMPRESSED_TEXTURE_FORMATS) -#if defined(GL_FOG_COLOR) - case GL_FOG_COLOR: -#endif // defined(GL_FOG_COLOR) -#if defined(GL_LIGHT_MODEL_AMBIENT) - case GL_LIGHT_MODEL_AMBIENT: -#endif // defined(GL_LIGHT_MODEL_AMBIENT) - _needed = _NUM_COMPRESSED_TEXTURE_FORMATS; + _needed = getNumCompressedTextureFormats(); break; default: _needed = 0; @@ -1378,6 +1401,12 @@ android_glGetIntegerv__ILjava_nio_IntBuffer_2 #if defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES) case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: #endif // defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES) +#if defined(GL_LIGHT_MODEL_COLOR_CONTROL) + case GL_LIGHT_MODEL_COLOR_CONTROL: +#endif // defined(GL_LIGHT_MODEL_COLOR_CONTROL) +#if defined(GL_LIGHT_MODEL_LOCAL_VIEWER) + case GL_LIGHT_MODEL_LOCAL_VIEWER: +#endif // defined(GL_LIGHT_MODEL_LOCAL_VIEWER) #if defined(GL_LIGHT_MODEL_TWO_SIDE) case GL_LIGHT_MODEL_TWO_SIDE: #endif // defined(GL_LIGHT_MODEL_TWO_SIDE) @@ -1592,6 +1621,12 @@ android_glGetIntegerv__ILjava_nio_IntBuffer_2 #if defined(GL_COLOR_WRITEMASK) case GL_COLOR_WRITEMASK: #endif // defined(GL_COLOR_WRITEMASK) +#if defined(GL_FOG_COLOR) + case GL_FOG_COLOR: +#endif // defined(GL_FOG_COLOR) +#if defined(GL_LIGHT_MODEL_AMBIENT) + case GL_LIGHT_MODEL_AMBIENT: +#endif // defined(GL_LIGHT_MODEL_AMBIENT) #if defined(GL_SCISSOR_BOX) case GL_SCISSOR_BOX: #endif // defined(GL_SCISSOR_BOX) @@ -1623,13 +1658,7 @@ android_glGetIntegerv__ILjava_nio_IntBuffer_2 #if defined(GL_COMPRESSED_TEXTURE_FORMATS) case GL_COMPRESSED_TEXTURE_FORMATS: #endif // defined(GL_COMPRESSED_TEXTURE_FORMATS) -#if defined(GL_FOG_COLOR) - case GL_FOG_COLOR: -#endif // defined(GL_FOG_COLOR) -#if defined(GL_LIGHT_MODEL_AMBIENT) - case GL_LIGHT_MODEL_AMBIENT: -#endif // defined(GL_LIGHT_MODEL_AMBIENT) - _needed = _NUM_COMPRESSED_TEXTURE_FORMATS; + _needed = getNumCompressedTextureFormats(); break; default: _needed = 0; @@ -1654,6 +1683,7 @@ exit: #include <string.h> /* const GLubyte * glGetString ( GLenum name ) */ +static jstring android_glGetString (JNIEnv *_env, jobject _this, jint name) { @@ -2748,16 +2778,19 @@ android_glNormalPointerBounds__IILjava_nio_Buffer_2I jint _remaining; GLvoid *pointer = (GLvoid *) 0; - pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining); + if (pointer_buf) { + pointer = (GLvoid *) _env->GetDirectBufferAddress(pointer_buf); + if ( ! pointer ) { + _env->ThrowNew(IAEClass, "Must use a native order direct Buffer"); + return; + } + } glNormalPointerBounds( (GLenum)type, (GLsizei)stride, (GLvoid *)pointer, (GLsizei)remaining ); - if (_array) { - releasePointer(_env, _array, pointer, JNI_FALSE); - } } /* void glOrthof ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */ @@ -3000,7 +3033,13 @@ android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I jint _remaining; GLvoid *pointer = (GLvoid *) 0; - pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining); + if (pointer_buf) { + pointer = (GLvoid *) _env->GetDirectBufferAddress(pointer_buf); + if ( ! pointer ) { + _env->ThrowNew(IAEClass, "Must use a native order direct Buffer"); + return; + } + } glTexCoordPointerBounds( (GLint)size, (GLenum)type, @@ -3008,9 +3047,6 @@ android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I (GLvoid *)pointer, (GLsizei)remaining ); - if (_array) { - releasePointer(_env, _array, pointer, JNI_FALSE); - } } /* void glTexEnvf ( GLenum target, GLenum pname, GLfloat param ) */ @@ -3355,7 +3391,13 @@ android_glVertexPointerBounds__IIILjava_nio_Buffer_2I jint _remaining; GLvoid *pointer = (GLvoid *) 0; - pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining); + if (pointer_buf) { + pointer = (GLvoid *) _env->GetDirectBufferAddress(pointer_buf); + if ( ! pointer ) { + _env->ThrowNew(IAEClass, "Must use a native order direct Buffer"); + return; + } + } glVertexPointerBounds( (GLint)size, (GLenum)type, @@ -3363,9 +3405,6 @@ android_glVertexPointerBounds__IIILjava_nio_Buffer_2I (GLvoid *)pointer, (GLsizei)remaining ); - if (_array) { - releasePointer(_env, _array, pointer, JNI_FALSE); - } } /* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */ |