diff options
Diffstat (limited to 'src/jogl/native')
-rw-r--r-- | src/jogl/native/GLDebugMessageHandler.c | 181 | ||||
-rw-r--r-- | src/jogl/native/JoglCommon.c | 55 | ||||
-rw-r--r-- | src/jogl/native/JoglCommon.h | 15 | ||||
-rw-r--r-- | src/jogl/native/macosx/ContextUpdater.h | 8 | ||||
-rw-r--r-- | src/jogl/native/macosx/ContextUpdater.m | 74 | ||||
-rw-r--r-- | src/jogl/native/macosx/MacOSXWindowSystemInterface.m | 692 | ||||
-rw-r--r-- | src/jogl/native/openmax/omx_tool.c | 12 |
7 files changed, 644 insertions, 393 deletions
diff --git a/src/jogl/native/GLDebugMessageHandler.c b/src/jogl/native/GLDebugMessageHandler.c new file mode 100644 index 000000000..22a7433f9 --- /dev/null +++ b/src/jogl/native/GLDebugMessageHandler.c @@ -0,0 +1,181 @@ + +#include "jogamp_opengl_GLDebugMessageHandler.h" +#include "JoglCommon.h" + +#include <GL/gl.h> +#include <GL/glext.h> + +static jmethodID glDebugMessageARB = NULL; // int source, int type, int id, int severity, String msg +static jmethodID glDebugMessageAMD = NULL; // int id, int category, int severity, String msg + +typedef void (GLAPIENTRY* _local_PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const GLvoid *userParam); +typedef void (GLAPIENTRY* _local_GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); + +typedef void (GLAPIENTRY* _local_PFNGLDEBUGMESSAGECALLBACKAMDPROC) (GLDEBUGPROCAMD callback, const GLvoid *userParam); +typedef void (GLAPIENTRY* _local_GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); + +/* + * Class: jogamp_opengl_GLDebugMessageHandler + * Method: initIDs0 + * Signature: (V)Z + */ +JNIEXPORT jboolean JNICALL Java_jogamp_opengl_GLDebugMessageHandler_initIDs0 + (JNIEnv *env, jclass clazz) +{ + JoglCommon_init(env); + + glDebugMessageARB = (*env)->GetMethodID(env, clazz, "glDebugMessageARB", "(IIIILjava/lang/String;)V"); + glDebugMessageAMD = (*env)->GetMethodID(env, clazz, "glDebugMessageAMD", "(IIILjava/lang/String;)V"); + + if ( NULL == glDebugMessageARB || NULL == glDebugMessageAMD ) { + return JNI_FALSE; + } + return JNI_TRUE; +} + +typedef struct { + JavaVM *vm; + int version; + JNIEnv *env; + jobject obj; + int extType; +} DebugHandlerType; + + +// GLDEBUGARB(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); +static void GLDebugMessageARBCallback(GLenum source, GLenum type, GLuint id, GLenum severity, + GLsizei length, const GLchar *message, GLvoid *userParam) { + DebugHandlerType * handle = (DebugHandlerType*) (intptr_t) userParam; + JavaVM *vm = handle->vm; + int version = handle->version; + jobject obj = handle->obj; + JNIEnv *curEnv = NULL; + JNIEnv *newEnv = NULL; + int envRes ; + + // retrieve this thread's JNIEnv curEnv - or detect it's detached + envRes = (*vm)->GetEnv(vm, (void **) &curEnv, version) ; + if( JNI_EDETACHED == envRes ) { + // detached thread - attach to JVM + if( JNI_OK != ( envRes = (*vm)->AttachCurrentThread(vm, (void**) &newEnv, NULL) ) ) { + fprintf(stderr, "GLDebugMessageARBCallback: can't attach thread: %d\n", envRes); + return; + } + curEnv = newEnv; + } else if( JNI_OK != envRes ) { + // oops .. + fprintf(stderr, "GLDebugMessageARBCallback: can't GetEnv: %d\n", envRes); + return; + } + (*curEnv)->CallVoidMethod(curEnv, obj, glDebugMessageARB, + (jint) source, (jint) type, (jint) id, (jint) severity, + (*curEnv)->NewStringUTF(curEnv, message)); + if( NULL != newEnv ) { + // detached attached thread + (*vm)->DetachCurrentThread(vm); + } +} + +// GLDEBUGAMD(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); +static void GLDebugMessageAMDCallback(GLuint id, GLenum category, GLenum severity, + GLsizei length, const GLchar *message, GLvoid *userParam) { + DebugHandlerType * handle = (DebugHandlerType*) (intptr_t) userParam; + JavaVM *vm = handle->vm; + int version = handle->version; + jobject obj = handle->obj; + JNIEnv *curEnv = NULL; + JNIEnv *newEnv = NULL; + int envRes ; + + // retrieve this thread's JNIEnv curEnv - or detect it's detached + envRes = (*vm)->GetEnv(vm, (void **) &curEnv, version) ; + if( JNI_EDETACHED == envRes ) { + // detached thread - attach to JVM + if( JNI_OK != ( envRes = (*vm)->AttachCurrentThread(vm, (void**) &newEnv, NULL) ) ) { + fprintf(stderr, "GLDebugMessageAMDCallback: can't attach thread: %d\n", envRes); + return; + } + curEnv = newEnv; + } else if( JNI_OK != envRes ) { + // oops .. + fprintf(stderr, "GLDebugMessageAMDCallback: can't GetEnv: %d\n", envRes); + return; + } + (*curEnv)->CallVoidMethod(curEnv, obj, glDebugMessageAMD, + (jint) id, (jint) category, (jint) severity, + (*curEnv)->NewStringUTF(curEnv, message)); + if( NULL != newEnv ) { + // detached attached thread + (*vm)->DetachCurrentThread(vm); + } +} + + +/* + * Class: jogamp_opengl_GLDebugMessageHandler + * Method: register0 + * Signature: (JI)J + */ +JNIEXPORT jlong JNICALL Java_jogamp_opengl_GLDebugMessageHandler_register0 + (JNIEnv *env, jobject obj, jlong procAddress, jint extType) +{ + JavaVM *vm; + DebugHandlerType * handle = malloc(sizeof(DebugHandlerType)); + if(0 != (*env)->GetJavaVM(env, &vm)) { + vm = NULL; + JoglCommon_throwNewRuntimeException(env, "GetJavaVM failed"); + } + handle->vm = vm; + handle->version = (*env)->GetVersion(env); + handle->env = env; + handle->obj = (*env)->NewGlobalRef(env, obj); + handle->extType = extType; + + if(jogamp_opengl_GLDebugMessageHandler_EXT_ARB == extType) { + _local_PFNGLDEBUGMESSAGECALLBACKARBPROC ptr_glDebugMessageCallbackARB; + ptr_glDebugMessageCallbackARB = (_local_PFNGLDEBUGMESSAGECALLBACKARBPROC) (intptr_t) procAddress; + ptr_glDebugMessageCallbackARB((_local_GLDEBUGPROCARB)GLDebugMessageARBCallback, handle); + } else if(jogamp_opengl_GLDebugMessageHandler_EXT_AMD == extType) { + _local_PFNGLDEBUGMESSAGECALLBACKAMDPROC ptr_glDebugMessageCallbackAMD; + ptr_glDebugMessageCallbackAMD = (_local_PFNGLDEBUGMESSAGECALLBACKAMDPROC) (intptr_t) procAddress; + ptr_glDebugMessageCallbackAMD((_local_GLDEBUGPROCAMD)GLDebugMessageAMDCallback, handle); + } else { + JoglCommon_throwNewRuntimeException(env, "unsupported extension type %d", extType); + } + + return (jlong) (intptr_t) handle; +} + +/* + * Class: jogamp_opengl_GLDebugMessageHandler + * Method: unregister0 + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_jogamp_opengl_GLDebugMessageHandler_unregister0 + (JNIEnv *env, jobject obj, jlong procAddress, jlong jhandle) +{ + DebugHandlerType * handle = (DebugHandlerType*) (intptr_t) jhandle; + + if(env != handle->env) { + JoglCommon_throwNewRuntimeException(env, "wrong handle (env doesn't match)"); + } + if(JNI_FALSE == (*env)->IsSameObject(env, obj, handle->obj)) { + JoglCommon_throwNewRuntimeException(env, "wrong handle (obj doesn't match)"); + } + + if(jogamp_opengl_GLDebugMessageHandler_EXT_ARB == handle->extType) { + _local_PFNGLDEBUGMESSAGECALLBACKARBPROC ptr_glDebugMessageCallbackARB; + ptr_glDebugMessageCallbackARB = (_local_PFNGLDEBUGMESSAGECALLBACKARBPROC) (intptr_t) procAddress; + ptr_glDebugMessageCallbackARB((_local_GLDEBUGPROCARB)NULL, NULL); + } else if(jogamp_opengl_GLDebugMessageHandler_EXT_AMD == handle->extType) { + _local_PFNGLDEBUGMESSAGECALLBACKAMDPROC ptr_glDebugMessageCallbackAMD; + ptr_glDebugMessageCallbackAMD = (_local_PFNGLDEBUGMESSAGECALLBACKAMDPROC) (intptr_t) procAddress; + ptr_glDebugMessageCallbackAMD((_local_GLDEBUGPROCAMD)NULL, NULL); + } else { + JoglCommon_throwNewRuntimeException(env, "unsupported extension type %d", handle->extType); + } + + (*env)->DeleteGlobalRef(env, handle->obj); + free(handle); +} + diff --git a/src/jogl/native/JoglCommon.c b/src/jogl/native/JoglCommon.c new file mode 100644 index 000000000..16f60e4e7 --- /dev/null +++ b/src/jogl/native/JoglCommon.c @@ -0,0 +1,55 @@ + +#include "JoglCommon.h" + +static const char * const ClazzNameRuntimeException = "java/lang/RuntimeException"; +static jclass runtimeExceptionClz=NULL; + +void JoglCommon_FatalError(JNIEnv *env, const char* msg, ...) +{ + char buffer[512]; + va_list ap; + + va_start(ap, msg); + vsnprintf(buffer, sizeof(buffer), msg, ap); + va_end(ap); + + fprintf(stderr, "%s\n", buffer); + (*env)->FatalError(env, buffer); +} + +void JoglCommon_throwNewRuntimeException(JNIEnv *env, const char* msg, ...) +{ + char buffer[512]; + va_list ap; + + va_start(ap, msg); + vsnprintf(buffer, sizeof(buffer), msg, ap); + va_end(ap); + + (*env)->ThrowNew(env, runtimeExceptionClz, buffer); +} + +void JoglCommon_init(JNIEnv *env) { + if(NULL==runtimeExceptionClz) { + jclass c = (*env)->FindClass(env, ClazzNameRuntimeException); + if(NULL==c) { + JoglCommon_FatalError(env, "JOGL: can't find %s", ClazzNameRuntimeException); + } + runtimeExceptionClz = (jclass)(*env)->NewGlobalRef(env, c); + (*env)->DeleteLocalRef(env, c); + if(NULL==runtimeExceptionClz) { + JoglCommon_FatalError(env, "JOGL: can't use %s", ClazzNameRuntimeException); + } + } +} + +jchar* JoglCommon_GetNullTerminatedStringChars(JNIEnv* env, jstring str) +{ + jchar* strChars = NULL; + strChars = calloc((*env)->GetStringLength(env, str) + 1, sizeof(jchar)); + if (strChars != NULL) { + (*env)->GetStringRegion(env, str, 0, (*env)->GetStringLength(env, str), strChars); + } + return strChars; +} + diff --git a/src/jogl/native/JoglCommon.h b/src/jogl/native/JoglCommon.h new file mode 100644 index 000000000..d82b445ce --- /dev/null +++ b/src/jogl/native/JoglCommon.h @@ -0,0 +1,15 @@ + +#ifndef JOGL_COMMON_H +#define JOGL_COMMON_H 1 + +#include <jni.h> +#include <stdlib.h> + +void JoglCommon_init(JNIEnv *env); + +jchar* JoglCommon_GetNullTerminatedStringChars(JNIEnv* env, jstring str); + +void JoglCommon_FatalError(JNIEnv *env, const char* msg, ...); +void JoglCommon_throwNewRuntimeException(JNIEnv *env, const char* msg, ...); + +#endif diff --git a/src/jogl/native/macosx/ContextUpdater.h b/src/jogl/native/macosx/ContextUpdater.h index e8b757fac..f8ce93def 100644 --- a/src/jogl/native/macosx/ContextUpdater.h +++ b/src/jogl/native/macosx/ContextUpdater.h @@ -15,11 +15,11 @@ This notification is sent whenever an NSView that has an attached NSSurface chan //#define DEBUG_GL_LOCKS #ifdef DEBUG_GL_LOCKS - #define LOCK_GL(func, line) [ContextUpdater lockInFunction:func atLine:line]; - #define UNLOCK_GL(func, line) [ContextUpdater unlockInFunction:func atLine:line]; + #define LOCK_GL(func, line) [ContextUpdater lockInFunction:func atLine:line]; + #define UNLOCK_GL(func, line) [ContextUpdater unlockInFunction:func atLine:line]; #else - #define LOCK_GL(func, line) [ContextUpdater lock]; - #define UNLOCK_GL(func, line) [ContextUpdater unlock]; + #define LOCK_GL(func, line) [ContextUpdater lock]; + #define UNLOCK_GL(func, line) [ContextUpdater unlock]; #endif // gznote: OpenGL NOT thread safe - need to sync on update and paints diff --git a/src/jogl/native/macosx/ContextUpdater.m b/src/jogl/native/macosx/ContextUpdater.m index 587782c98..859697722 100644 --- a/src/jogl/native/macosx/ContextUpdater.m +++ b/src/jogl/native/macosx/ContextUpdater.m @@ -10,74 +10,74 @@ static pthread_mutex_t resourceLock = PTHREAD_MUTEX_INITIALIZER; static void printLockDebugInfo(char *message, char *func, int line) { - fprintf(stderr, "%s in function: \"%s\" at line: %d\n", message, func, line); - fflush(stderr); + fprintf(stderr, "%s in function: \"%s\" at line: %d\n", message, func, line); + fflush(stderr); } + (void) lock { - if (theContext != NULL) - { - pthread_mutex_lock(&resourceLock); - } + if (theContext != NULL) + { + pthread_mutex_lock(&resourceLock); + } } + (void) lockInFunction:(char *)func atLine:(int)line { - if (theContext != NULL) - { - printLockDebugInfo("locked ", func, line); - [self lock]; - } + if (theContext != NULL) + { + printLockDebugInfo("locked ", func, line); + [self lock]; + } } + (void) unlock { - if (theContext != NULL) - { - pthread_mutex_unlock(&resourceLock); - } + if (theContext != NULL) + { + pthread_mutex_unlock(&resourceLock); + } } + (void) unlockInFunction:(char *)func atLine:(int)line { - if (theContext != NULL) - { - printLockDebugInfo("unlocked", func, line); - [self unlock]; - } + if (theContext != NULL) + { + printLockDebugInfo("unlocked", func, line); + [self unlock]; + } } - (void) registerFor:(NSOpenGLContext *)context with: (NSView *)view { - if (view != NULL) - { - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(update:) name:NSViewGlobalFrameDidChangeNotification object: view]; - theContext = context; - } + if (view != NULL) + { + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(update:) name:NSViewGlobalFrameDidChangeNotification object: view]; + theContext = context; + } } - (void) update:(NSNotification *)notification { - [ContextUpdater lock]; - - [theContext update]; - - [ContextUpdater unlock]; + [ContextUpdater lock]; + + [theContext update]; + + [ContextUpdater unlock]; } - (id) init -{ - theContext = NULL; - - return [super init]; +{ + theContext = NULL; + + return [super init]; } - (void) dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:self]; - - [super dealloc]; + [[NSNotificationCenter defaultCenter] removeObserver:self]; + + [super dealloc]; } @end
\ No newline at end of file diff --git a/src/jogl/native/macosx/MacOSXWindowSystemInterface.m b/src/jogl/native/macosx/MacOSXWindowSystemInterface.m index cbfea6d71..9a7356b7c 100644 --- a/src/jogl/native/macosx/MacOSXWindowSystemInterface.m +++ b/src/jogl/native/macosx/MacOSXWindowSystemInterface.m @@ -5,7 +5,7 @@ #include <AvailabilityMacros.h> #ifndef MAC_OS_X_VERSION_10_3 - #error building JOGL requires Mac OS X 10.3 or greater + #error building JOGL requires Mac OS X 10.3 or greater #endif #ifndef MAC_OS_X_VERSION_10_4 @@ -44,45 +44,45 @@ struct _RendererInfo { - long id; // kCGLRPRendererID - long displayMask; // kCGLRPDisplayMask - - long accelerated; // kCGLRPAccelerated - - long window; // kCGLRPWindow - long fullscreen; // kCGLRPFullScreen - long multiscreen; // kCGLRPMultiScreen - long offscreen; // kCGLRPOffScreen - long floatPixels; // see kCGLRPColorModes - long stereo; // kCGLRPBufferModes - - long auxBuffers; // kCGLRPMaxAuxBuffers - long sampleBuffers; // kCGLRPMaxSampleBuffers - long samples; // kCGLRPMaxSamples - long samplesModes; // kCGLRPSampleModes - long multiSample; // see kCGLRPSampleModes - long superSample; // see kCGLRPSampleModes - long alphaSample; // kCGLRPSampleAlpha - - long colorModes; // kCGLRPColorModes - long colorRGBSizeMAX; - long colorASizeMAX; - long colorFloatRGBSizeMAX; - long colorFloatASizeMAX; - long colorFloatRGBSizeMIN; - long colorFloatASizeMIN; - long colorModesCount; - long colorFloatModesCount; - long depthModes; // kCGLRPDepthModes - long depthSizeMAX; - long depthModesCount; - long stencilModes; // kCGLRPStencilModes - long stencilSizeMAX; - long stencilModesCount; - long accumModes; // kCGLRPAccumModes - long accumRGBSizeMAX; - long accumASizeMAX; - long accumModesCount; + long id; // kCGLRPRendererID + long displayMask; // kCGLRPDisplayMask + + long accelerated; // kCGLRPAccelerated + + long window; // kCGLRPWindow + long fullscreen; // kCGLRPFullScreen + long multiscreen; // kCGLRPMultiScreen + long offscreen; // kCGLRPOffScreen + long floatPixels; // see kCGLRPColorModes + long stereo; // kCGLRPBufferModes + + long auxBuffers; // kCGLRPMaxAuxBuffers + long sampleBuffers; // kCGLRPMaxSampleBuffers + long samples; // kCGLRPMaxSamples + long samplesModes; // kCGLRPSampleModes + long multiSample; // see kCGLRPSampleModes + long superSample; // see kCGLRPSampleModes + long alphaSample; // kCGLRPSampleAlpha + + long colorModes; // kCGLRPColorModes + long colorRGBSizeMAX; + long colorASizeMAX; + long colorFloatRGBSizeMAX; + long colorFloatASizeMAX; + long colorFloatRGBSizeMIN; + long colorFloatASizeMIN; + long colorModesCount; + long colorFloatModesCount; + long depthModes; // kCGLRPDepthModes + long depthSizeMAX; + long depthModesCount; + long stencilModes; // kCGLRPStencilModes + long stencilSizeMAX; + long stencilModesCount; + long accumModes; // kCGLRPAccumModes + long accumRGBSizeMAX; + long accumASizeMAX; + long accumModesCount; } typedef RendererInfo; @@ -90,263 +90,263 @@ RendererInfo *gRenderers = NULL; long gRenderersCount = 0; long depthModes[] = { - kCGL0Bit, - kCGL1Bit, - kCGL2Bit, - kCGL3Bit, - kCGL4Bit, - kCGL5Bit, - kCGL6Bit, - kCGL8Bit, - kCGL10Bit, - kCGL12Bit, - kCGL16Bit, - kCGL24Bit, - kCGL32Bit, - kCGL48Bit, - kCGL64Bit, - kCGL96Bit, - kCGL128Bit, - 0 - }; + kCGL0Bit, + kCGL1Bit, + kCGL2Bit, + kCGL3Bit, + kCGL4Bit, + kCGL5Bit, + kCGL6Bit, + kCGL8Bit, + kCGL10Bit, + kCGL12Bit, + kCGL16Bit, + kCGL24Bit, + kCGL32Bit, + kCGL48Bit, + kCGL64Bit, + kCGL96Bit, + kCGL128Bit, + 0 + }; long depthModesBits[] = {0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 24, 32, 48, 64, 96, 128}; long colorModes[] = { - kCGLRGB444Bit, - kCGLARGB4444Bit, - kCGLRGB444A8Bit, - kCGLRGB555Bit, - kCGLARGB1555Bit, - kCGLRGB555A8Bit, - kCGLRGB565Bit, - kCGLRGB565A8Bit, - kCGLRGB888Bit, - kCGLARGB8888Bit, - kCGLRGB888A8Bit, - kCGLRGB101010Bit, - kCGLARGB2101010Bit, - kCGLRGB101010_A8Bit, - kCGLRGB121212Bit, - kCGLARGB12121212Bit, - kCGLRGB161616Bit, - kCGLRGBA16161616Bit, - kCGLRGBFloat64Bit, - kCGLRGBAFloat64Bit, - kCGLRGBFloat128Bit, - kCGLRGBAFloat128Bit, - kCGLRGBFloat256Bit, - kCGLRGBAFloat256Bit, - 0 - }; -long colorModesBitsRGB[] = {4, 4, 4, 5, 5, 5, 5, 5, 8, 8, 8, 10, 10, 10, 12, 12, 16, 16, 16, 16, 32, 32, 64, 64}; -long colorModesBitsA[] = {0, 4, 8, 0, 1, 8, 0, 8, 0, 8, 8, 0, 2, 8, 0, 12, 0, 16, 0, 16, 0, 32, 0, 64}; + kCGLRGB444Bit, + kCGLARGB4444Bit, + kCGLRGB444A8Bit, + kCGLRGB555Bit, + kCGLARGB1555Bit, + kCGLRGB555A8Bit, + kCGLRGB565Bit, + kCGLRGB565A8Bit, + kCGLRGB888Bit, + kCGLARGB8888Bit, + kCGLRGB888A8Bit, + kCGLRGB101010Bit, + kCGLARGB2101010Bit, + kCGLRGB101010_A8Bit, + kCGLRGB121212Bit, + kCGLARGB12121212Bit, + kCGLRGB161616Bit, + kCGLRGBA16161616Bit, + kCGLRGBFloat64Bit, + kCGLRGBAFloat64Bit, + kCGLRGBFloat128Bit, + kCGLRGBAFloat128Bit, + kCGLRGBFloat256Bit, + kCGLRGBAFloat256Bit, + 0 + }; +long colorModesBitsRGB[] = {4, 4, 4, 5, 5, 5, 5, 5, 8, 8, 8, 10, 10, 10, 12, 12, 16, 16, 16, 16, 32, 32, 64, 64}; +long colorModesBitsA[] = {0, 4, 8, 0, 1, 8, 0, 8, 0, 8, 8, 0, 2, 8, 0, 12, 0, 16, 0, 16, 0, 32, 0, 64}; void getRendererInfo() { - if (gRenderersCount == 0) - { - CGLRendererInfoObj info; - CGLError err = CGLQueryRendererInfo(CGDisplayIDToOpenGLDisplayMask(kCGDirectMainDisplay), &info, &gRenderersCount); - if (err == 0 /* kCGLNoError */) - { - // how many renderers are available? - CGLDescribeRenderer(info, 0, kCGLRPRendererCount, &gRenderersCount); - - // allocate our global renderers info - gRenderers = (RendererInfo*)malloc(gRenderersCount*sizeof(RendererInfo)); - memset(gRenderers, 0x00, gRenderersCount*sizeof(RendererInfo)); - - // iterate through the renderers checking for their features - long j; - for (j=0; j<gRenderersCount; j++) - { - RendererInfo *renderer = &gRenderers[j]; - int i; - - CGLDescribeRenderer(info, j, kCGLRPRendererID, &(renderer->id)); - CGLDescribeRenderer(info, j, kCGLRPDisplayMask, &(renderer->displayMask)); - - CGLDescribeRenderer(info, j, kCGLRPAccelerated, &(renderer->accelerated)); - - CGLDescribeRenderer(info, j, kCGLRPWindow, &(renderer->window)); - CGLDescribeRenderer(info, j, kCGLRPFullScreen, &(renderer->fullscreen)); - CGLDescribeRenderer(info, j, kCGLRPMultiScreen, &(renderer->multiscreen)); - CGLDescribeRenderer(info, j, kCGLRPOffScreen, &(renderer->offscreen)); - CGLDescribeRenderer(info, j, kCGLRPColorModes, &(renderer->floatPixels)); - if ((renderer->floatPixels >= kCGLRGBFloat64Bit) != 0) - { - renderer->floatPixels = 1; - } - else - { - renderer->floatPixels = 0; - } - CGLDescribeRenderer(info, j, kCGLRPBufferModes, &(renderer->stereo)); - if ((renderer->stereo & kCGLStereoscopicBit) != 0) - { - renderer->stereo = 1; - } - else - { - renderer->stereo = 0; - } - - CGLDescribeRenderer(info, j, kCGLRPMaxAuxBuffers, &(renderer->auxBuffers)); - CGLDescribeRenderer(info, j, kCGLRPMaxSampleBuffers, &(renderer->sampleBuffers)); - CGLDescribeRenderer(info, j, kCGLRPMaxSamples, &(renderer->samples)); - // The following queries are only legal on 10.4 - // FIXME: should figure out a way to enable them dynamically + if (gRenderersCount == 0) + { + CGLRendererInfoObj info; + CGLError err = CGLQueryRendererInfo(CGDisplayIDToOpenGLDisplayMask(kCGDirectMainDisplay), &info, &gRenderersCount); + if (err == 0 /* kCGLNoError */) + { + // how many renderers are available? + CGLDescribeRenderer(info, 0, kCGLRPRendererCount, &gRenderersCount); + + // allocate our global renderers info + gRenderers = (RendererInfo*)malloc(gRenderersCount*sizeof(RendererInfo)); + memset(gRenderers, 0x00, gRenderersCount*sizeof(RendererInfo)); + + // iterate through the renderers checking for their features + long j; + for (j=0; j<gRenderersCount; j++) + { + RendererInfo *renderer = &gRenderers[j]; + int i; + + CGLDescribeRenderer(info, j, kCGLRPRendererID, &(renderer->id)); + CGLDescribeRenderer(info, j, kCGLRPDisplayMask, &(renderer->displayMask)); + + CGLDescribeRenderer(info, j, kCGLRPAccelerated, &(renderer->accelerated)); + + CGLDescribeRenderer(info, j, kCGLRPWindow, &(renderer->window)); + CGLDescribeRenderer(info, j, kCGLRPFullScreen, &(renderer->fullscreen)); + CGLDescribeRenderer(info, j, kCGLRPMultiScreen, &(renderer->multiscreen)); + CGLDescribeRenderer(info, j, kCGLRPOffScreen, &(renderer->offscreen)); + CGLDescribeRenderer(info, j, kCGLRPColorModes, &(renderer->floatPixels)); + if ((renderer->floatPixels >= kCGLRGBFloat64Bit) != 0) + { + renderer->floatPixels = 1; + } + else + { + renderer->floatPixels = 0; + } + CGLDescribeRenderer(info, j, kCGLRPBufferModes, &(renderer->stereo)); + if ((renderer->stereo & kCGLStereoscopicBit) != 0) + { + renderer->stereo = 1; + } + else + { + renderer->stereo = 0; + } + + CGLDescribeRenderer(info, j, kCGLRPMaxAuxBuffers, &(renderer->auxBuffers)); + CGLDescribeRenderer(info, j, kCGLRPMaxSampleBuffers, &(renderer->sampleBuffers)); + CGLDescribeRenderer(info, j, kCGLRPMaxSamples, &(renderer->samples)); + // The following queries are only legal on 10.4 + // FIXME: should figure out a way to enable them dynamically #ifdef kCGLRPSampleModes - CGLDescribeRenderer(info, j, kCGLRPSampleModes, &(renderer->samplesModes)); - if ((renderer->samplesModes & kCGLSupersampleBit) != 0) - { - renderer->multiSample = 1; - } - if ((renderer->samplesModes & kCGLMultisampleBit) != 0) - { - renderer->superSample = 1; - } - CGLDescribeRenderer(info, j, kCGLRPSampleAlpha, &(renderer->alphaSample)); + CGLDescribeRenderer(info, j, kCGLRPSampleModes, &(renderer->samplesModes)); + if ((renderer->samplesModes & kCGLSupersampleBit) != 0) + { + renderer->multiSample = 1; + } + if ((renderer->samplesModes & kCGLMultisampleBit) != 0) + { + renderer->superSample = 1; + } + CGLDescribeRenderer(info, j, kCGLRPSampleAlpha, &(renderer->alphaSample)); #endif - CGLDescribeRenderer(info, j, kCGLRPColorModes, &(renderer->colorModes)); - i=0; - int floatPixelFormatInitialized = 0; - while (colorModes[i] != 0) - { - if ((renderer->colorModes & colorModes[i]) != 0) - { - // non-float color model - if (colorModes[i] < kCGLRGBFloat64Bit) - { - // look for max color and alpha values - prefer color models that have alpha - if ((colorModesBitsRGB[i] >= renderer->colorRGBSizeMAX) && (colorModesBitsA[i] >= renderer->colorASizeMAX)) - { - renderer->colorRGBSizeMAX = colorModesBitsRGB[i]; - renderer->colorASizeMAX = colorModesBitsA[i]; - } - renderer->colorModesCount++; - } - // float-color model - if (colorModes[i] >= kCGLRGBFloat64Bit) - { - if (floatPixelFormatInitialized == 0) - { - floatPixelFormatInitialized = 1; - - renderer->colorFloatASizeMAX = colorModesBitsA[i]; - renderer->colorFloatRGBSizeMAX = colorModesBitsRGB[i]; - renderer->colorFloatASizeMIN = colorModesBitsA[i]; - renderer->colorFloatRGBSizeMIN = colorModesBitsRGB[i]; - } - // look for max color and alpha values - prefer color models that have alpha - if ((colorModesBitsRGB[i] >= renderer->colorFloatRGBSizeMAX) && (colorModesBitsA[i] >= renderer->colorFloatASizeMAX)) - { - renderer->colorFloatRGBSizeMAX = colorModesBitsRGB[i]; - renderer->colorFloatASizeMAX = colorModesBitsA[i]; - } - // find min color - if (colorModesBitsA[i] < renderer->colorFloatASizeMIN) - { - renderer->colorFloatASizeMIN = colorModesBitsA[i]; - } - // find min alpha color - if (colorModesBitsA[i] < renderer->colorFloatRGBSizeMIN) - { - renderer->colorFloatRGBSizeMIN = colorModesBitsRGB[i]; - } - renderer->colorFloatModesCount++; - } - } - i++; - } - CGLDescribeRenderer(info, j, kCGLRPDepthModes, &(renderer->depthModes)); - i=0; - while (depthModes[i] != 0) - { - if ((renderer->depthModes & depthModes[i]) != 0) - { - renderer->depthSizeMAX = depthModesBits[i]; - renderer->depthModesCount++; - } - i++; - } - CGLDescribeRenderer(info, j, kCGLRPStencilModes, &(renderer->stencilModes)); - i=0; - while (depthModes[i] != 0) - { - if ((renderer->stencilModes & depthModes[i]) != 0) - { - renderer->stencilSizeMAX = depthModesBits[i]; - renderer->stencilModesCount++; - } - i++; - } - CGLDescribeRenderer(info, j, kCGLRPAccumModes, &(renderer->accumModes)); - i=0; - while (colorModes[i] != 0) - { - if ((renderer->accumModes & colorModes[i]) != 0) - { - if ((colorModesBitsRGB[i] >= renderer->accumRGBSizeMAX) && (colorModesBitsA[i] >= renderer->accumASizeMAX)) - { - renderer->accumRGBSizeMAX = colorModesBitsRGB[i]; - renderer->accumASizeMAX = colorModesBitsA[i]; - } - renderer->accumModesCount++; - } - i++; - } - } - } - CGLDestroyRendererInfo (info); - } - + CGLDescribeRenderer(info, j, kCGLRPColorModes, &(renderer->colorModes)); + i=0; + int floatPixelFormatInitialized = 0; + while (colorModes[i] != 0) + { + if ((renderer->colorModes & colorModes[i]) != 0) + { + // non-float color model + if (colorModes[i] < kCGLRGBFloat64Bit) + { + // look for max color and alpha values - prefer color models that have alpha + if ((colorModesBitsRGB[i] >= renderer->colorRGBSizeMAX) && (colorModesBitsA[i] >= renderer->colorASizeMAX)) + { + renderer->colorRGBSizeMAX = colorModesBitsRGB[i]; + renderer->colorASizeMAX = colorModesBitsA[i]; + } + renderer->colorModesCount++; + } + // float-color model + if (colorModes[i] >= kCGLRGBFloat64Bit) + { + if (floatPixelFormatInitialized == 0) + { + floatPixelFormatInitialized = 1; + + renderer->colorFloatASizeMAX = colorModesBitsA[i]; + renderer->colorFloatRGBSizeMAX = colorModesBitsRGB[i]; + renderer->colorFloatASizeMIN = colorModesBitsA[i]; + renderer->colorFloatRGBSizeMIN = colorModesBitsRGB[i]; + } + // look for max color and alpha values - prefer color models that have alpha + if ((colorModesBitsRGB[i] >= renderer->colorFloatRGBSizeMAX) && (colorModesBitsA[i] >= renderer->colorFloatASizeMAX)) + { + renderer->colorFloatRGBSizeMAX = colorModesBitsRGB[i]; + renderer->colorFloatASizeMAX = colorModesBitsA[i]; + } + // find min color + if (colorModesBitsA[i] < renderer->colorFloatASizeMIN) + { + renderer->colorFloatASizeMIN = colorModesBitsA[i]; + } + // find min alpha color + if (colorModesBitsA[i] < renderer->colorFloatRGBSizeMIN) + { + renderer->colorFloatRGBSizeMIN = colorModesBitsRGB[i]; + } + renderer->colorFloatModesCount++; + } + } + i++; + } + CGLDescribeRenderer(info, j, kCGLRPDepthModes, &(renderer->depthModes)); + i=0; + while (depthModes[i] != 0) + { + if ((renderer->depthModes & depthModes[i]) != 0) + { + renderer->depthSizeMAX = depthModesBits[i]; + renderer->depthModesCount++; + } + i++; + } + CGLDescribeRenderer(info, j, kCGLRPStencilModes, &(renderer->stencilModes)); + i=0; + while (depthModes[i] != 0) + { + if ((renderer->stencilModes & depthModes[i]) != 0) + { + renderer->stencilSizeMAX = depthModesBits[i]; + renderer->stencilModesCount++; + } + i++; + } + CGLDescribeRenderer(info, j, kCGLRPAccumModes, &(renderer->accumModes)); + i=0; + while (colorModes[i] != 0) + { + if ((renderer->accumModes & colorModes[i]) != 0) + { + if ((colorModesBitsRGB[i] >= renderer->accumRGBSizeMAX) && (colorModesBitsA[i] >= renderer->accumASizeMAX)) + { + renderer->accumRGBSizeMAX = colorModesBitsRGB[i]; + renderer->accumASizeMAX = colorModesBitsA[i]; + } + renderer->accumModesCount++; + } + i++; + } + } + } + CGLDestroyRendererInfo (info); + } + #if 0 - fprintf(stderr, "gRenderersCount=%ld\n", gRenderersCount); - int j; - for (j=0; j<gRenderersCount; j++) - { - RendererInfo *renderer = &gRenderers[j]; - fprintf(stderr, " id=%ld\n", renderer->id); - fprintf(stderr, " displayMask=%ld\n", renderer->displayMask); - - fprintf(stderr, " accelerated=%ld\n", renderer->accelerated); - - fprintf(stderr, " window=%ld\n", renderer->window); - fprintf(stderr, " fullscreen=%ld\n", renderer->fullscreen); - fprintf(stderr, " multiscreen=%ld\n", renderer->multiscreen); - fprintf(stderr, " offscreen=%ld\n", renderer->offscreen); - fprintf(stderr, " floatPixels=%ld\n", renderer->floatPixels); - fprintf(stderr, " stereo=%ld\n", renderer->stereo); - - fprintf(stderr, " auxBuffers=%ld\n", renderer->auxBuffers); - fprintf(stderr, " sampleBuffers=%ld\n", renderer->sampleBuffers); - fprintf(stderr, " samples=%ld\n", renderer->samples); - fprintf(stderr, " samplesModes=%ld\n", renderer->samplesModes); - fprintf(stderr, " multiSample=%ld\n", renderer->superSample); - fprintf(stderr, " superSample=%ld\n", renderer->superSample); - fprintf(stderr, " alphaSample=%ld\n", renderer->alphaSample); - - fprintf(stderr, " colorModes=%ld\n", renderer->colorModes); - fprintf(stderr, " colorRGBSizeMAX=%ld\n", renderer->colorRGBSizeMAX); - fprintf(stderr, " colorASizeMAX=%ld\n", renderer->colorASizeMAX); - fprintf(stderr, " colorFloatRGBSizeMAX=%ld\n", renderer->colorFloatRGBSizeMAX); - fprintf(stderr, " colorFloatASizeMAX=%ld\n", renderer->colorFloatASizeMAX); - fprintf(stderr, " colorFloatRGBSizeMIN=%ld\n", renderer->colorFloatRGBSizeMIN); - fprintf(stderr, " colorFloatASizeMIN=%ld\n", renderer->colorFloatASizeMIN); - fprintf(stderr, " colorModesCount=%ld\n", renderer->colorModesCount); - fprintf(stderr, " colorFloatModesCount=%ld\n", renderer->colorFloatModesCount); - fprintf(stderr, " depthModes=%ld\n", renderer->depthModes); - fprintf(stderr, " depthSizeMAX=%ld\n", renderer->depthSizeMAX); - fprintf(stderr, " depthModesCount=%ld\n", renderer->depthModesCount); - fprintf(stderr, " stencilModes=%ld\n", renderer->stencilModes); - fprintf(stderr, " stencilSizeMAX=%ld\n", renderer->stencilSizeMAX); - fprintf(stderr, " stencilModesCount=%ld\n", renderer->stencilModesCount); - fprintf(stderr, " accumModes=%ld\n", renderer->accumModes); - fprintf(stderr, " accumRGBSizeMAX=%ld\n", renderer->accumRGBSizeMAX); - fprintf(stderr, " accumASizeMAX=%ld\n", renderer->accumASizeMAX); - fprintf(stderr, " accumModesCount=%ld\n", renderer->accumModesCount); - fprintf(stderr, "\n"); - } + fprintf(stderr, "gRenderersCount=%ld\n", gRenderersCount); + int j; + for (j=0; j<gRenderersCount; j++) + { + RendererInfo *renderer = &gRenderers[j]; + fprintf(stderr, " id=%ld\n", renderer->id); + fprintf(stderr, " displayMask=%ld\n", renderer->displayMask); + + fprintf(stderr, " accelerated=%ld\n", renderer->accelerated); + + fprintf(stderr, " window=%ld\n", renderer->window); + fprintf(stderr, " fullscreen=%ld\n", renderer->fullscreen); + fprintf(stderr, " multiscreen=%ld\n", renderer->multiscreen); + fprintf(stderr, " offscreen=%ld\n", renderer->offscreen); + fprintf(stderr, " floatPixels=%ld\n", renderer->floatPixels); + fprintf(stderr, " stereo=%ld\n", renderer->stereo); + + fprintf(stderr, " auxBuffers=%ld\n", renderer->auxBuffers); + fprintf(stderr, " sampleBuffers=%ld\n", renderer->sampleBuffers); + fprintf(stderr, " samples=%ld\n", renderer->samples); + fprintf(stderr, " samplesModes=%ld\n", renderer->samplesModes); + fprintf(stderr, " multiSample=%ld\n", renderer->superSample); + fprintf(stderr, " superSample=%ld\n", renderer->superSample); + fprintf(stderr, " alphaSample=%ld\n", renderer->alphaSample); + + fprintf(stderr, " colorModes=%ld\n", renderer->colorModes); + fprintf(stderr, " colorRGBSizeMAX=%ld\n", renderer->colorRGBSizeMAX); + fprintf(stderr, " colorASizeMAX=%ld\n", renderer->colorASizeMAX); + fprintf(stderr, " colorFloatRGBSizeMAX=%ld\n", renderer->colorFloatRGBSizeMAX); + fprintf(stderr, " colorFloatASizeMAX=%ld\n", renderer->colorFloatASizeMAX); + fprintf(stderr, " colorFloatRGBSizeMIN=%ld\n", renderer->colorFloatRGBSizeMIN); + fprintf(stderr, " colorFloatASizeMIN=%ld\n", renderer->colorFloatASizeMIN); + fprintf(stderr, " colorModesCount=%ld\n", renderer->colorModesCount); + fprintf(stderr, " colorFloatModesCount=%ld\n", renderer->colorFloatModesCount); + fprintf(stderr, " depthModes=%ld\n", renderer->depthModes); + fprintf(stderr, " depthSizeMAX=%ld\n", renderer->depthSizeMAX); + fprintf(stderr, " depthModesCount=%ld\n", renderer->depthModesCount); + fprintf(stderr, " stencilModes=%ld\n", renderer->stencilModes); + fprintf(stderr, " stencilSizeMAX=%ld\n", renderer->stencilSizeMAX); + fprintf(stderr, " stencilModesCount=%ld\n", renderer->stencilModesCount); + fprintf(stderr, " accumModes=%ld\n", renderer->accumModes); + fprintf(stderr, " accumRGBSizeMAX=%ld\n", renderer->accumRGBSizeMAX); + fprintf(stderr, " accumASizeMAX=%ld\n", renderer->accumASizeMAX); + fprintf(stderr, " accumModesCount=%ld\n", renderer->accumModesCount); + fprintf(stderr, "\n"); + } #endif } @@ -368,7 +368,7 @@ long validateParameter(NSOpenGLPixelFormatAttribute attribute, long value) } } } - + return value; } @@ -472,66 +472,66 @@ void* createContext(void* shareContext, void* pixelFormat, int* viewNotReady) { - getRendererInfo(); - - NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + getRendererInfo(); + + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - NSView *nsView = NULL; + NSView *nsView = NULL; NSObject *nsObj = (NSObject*) view; if( nsObj != NULL && [nsObj isKindOfClass:[NSView class]] ) { nsView = (NSView*)nsObj; } - if (nsView != NULL) - { - Bool viewReady = true; - - if ([nsView lockFocusIfCanDraw] == NO) - { - viewReady = false; - } - else - { - NSRect frame = [nsView frame]; - if ((frame.size.width == 0) || (frame.size.height == 0)) - { - [nsView unlockFocus]; - viewReady = false; - } - } - - if (!viewReady) - { - if (viewNotReady != NULL) - { - *viewNotReady = 1; - } - - // the view is not ready yet - [pool release]; - return NULL; - } - } - - NSOpenGLContext* nsContext = [[NSOpenGLContext alloc] + if (nsView != NULL) + { + Bool viewReady = true; + + if ([nsView lockFocusIfCanDraw] == NO) + { + viewReady = false; + } + else + { + NSRect frame = [nsView frame]; + if ((frame.size.width == 0) || (frame.size.height == 0)) + { + [nsView unlockFocus]; + viewReady = false; + } + } + + if (!viewReady) + { + if (viewNotReady != NULL) + { + *viewNotReady = 1; + } + + // the view is not ready yet + [pool release]; + return NULL; + } + } + + NSOpenGLContext* nsContext = [[NSOpenGLContext alloc] initWithFormat: (NSOpenGLPixelFormat*) pixelFormat shareContext: (NSOpenGLContext*) shareContext]; - + if (nsContext != nil) { if (nsView != nil) { [nsContext setView:nsView]; - [nsView unlockFocus]; + [nsView unlockFocus]; } } - [pool release]; - return nsContext; + [pool release]; + return nsContext; } void * getCurrentContext() { NSOpenGLContext *nsContext = NULL; - + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; nsContext = [NSOpenGLContext currentContext]; [pool release]; @@ -541,7 +541,7 @@ void * getCurrentContext() { void * getCGLContext(void* nsJContext) { NSOpenGLContext *nsContext = (NSOpenGLContext*)nsJContext; void * cglContext = NULL; - + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; cglContext = [nsContext CGLContextObj]; [pool release]; @@ -551,7 +551,7 @@ void * getCGLContext(void* nsJContext) { void * getNSView(void* nsJContext) { NSOpenGLContext *nsContext = (NSOpenGLContext*)nsJContext; void * view = NULL; - + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; view = [nsContext view]; [pool release]; @@ -560,7 +560,7 @@ void * getNSView(void* nsJContext) { Bool makeCurrentContext(void* nsJContext) { NSOpenGLContext *nsContext = (NSOpenGLContext*)nsJContext; - + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; [nsContext makeCurrentContext]; [pool release]; @@ -582,7 +582,7 @@ Bool clearCurrentContext(void* nsJContext) { Bool deleteContext(void* nsJContext) { NSOpenGLContext *nsContext = (NSOpenGLContext*)nsJContext; - + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; [nsContext clearDrawable]; [nsContext release]; @@ -592,7 +592,7 @@ Bool deleteContext(void* nsJContext) { Bool flushBuffer(void* nsJContext) { NSOpenGLContext *nsContext = (NSOpenGLContext*)nsJContext; - + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; [nsContext flushBuffer]; [pool release]; @@ -607,7 +607,7 @@ void setContextOpacity(void* nsJContext, int opacity) { void updateContext(void* nsJContext) { NSOpenGLContext *nsContext = (NSOpenGLContext*)nsJContext; - + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; [nsContext update]; [pool release]; @@ -622,7 +622,7 @@ void copyContext(void* destContext, void* srcContext, int mask) { void* updateContextRegister(void* nsJContext, void* view) { NSOpenGLContext *nsContext = (NSOpenGLContext*)nsJContext; NSView *nsView = (NSView*)view; - + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; ContextUpdater *contextUpdater = [[ContextUpdater alloc] init]; [contextUpdater registerFor:nsContext with:nsView]; @@ -632,7 +632,7 @@ void* updateContextRegister(void* nsJContext, void* view) { void updateContextUnregister(void* updater) { ContextUpdater *contextUpdater = (ContextUpdater *)updater; - + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; [contextUpdater release]; [pool release]; @@ -653,7 +653,7 @@ void* createPBuffer(int renderTarget, int internalFormat, int width, int height) Bool destroyPBuffer(void* buffer) { /* FIXME: not clear whether we need to perform the clearDrawable below */ NSOpenGLPixelBuffer *pBuffer = (NSOpenGLPixelBuffer*)buffer; - + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; /* if (nsContext != NULL) { @@ -662,7 +662,7 @@ Bool destroyPBuffer(void* buffer) { */ [pBuffer release]; [pool release]; - + return true; } @@ -701,21 +701,21 @@ void* getProcAddress(const char *procname) { libGLImage = NSAddImage(libGLStr, options); libGLUImage = NSAddImage(libGLUStr, options); } - + unsigned long options = NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR; char underscoreName[512] = "_"; strcat(underscoreName, procname); - + if (NSIsSymbolNameDefinedInImage(libGLImage, underscoreName) == YES) { NSSymbol sym = NSLookupSymbolInImage(libGLImage, underscoreName, options); return NSAddressOfSymbol(sym); } - - if (NSIsSymbolNameDefinedInImage(libGLUImage, underscoreName) == YES) { + + if (NSIsSymbolNameDefinedInImage(libGLUImage, underscoreName) == YES) { NSSymbol sym = NSLookupSymbolInImage(libGLUImage, underscoreName, options); return NSAddressOfSymbol(sym); } - + if (NSIsSymbolNameDefinedWithHint(underscoreName, "GL")) { NSSymbol sym = NSLookupAndBindSymbol(underscoreName); return NSAddressOfSymbol(sym); diff --git a/src/jogl/native/openmax/omx_tool.c b/src/jogl/native/openmax/omx_tool.c index c6b6494e2..57fa8ad21 100644 --- a/src/jogl/native/openmax/omx_tool.c +++ b/src/jogl/native/openmax/omx_tool.c @@ -199,10 +199,10 @@ static OMX_ERRORTYPE EventHandler( if (pOMXAV->endComponent == hComponent) { DBG_PRINT("\t end component - FIN\n"); - pOMXAV->status = OMXAV_FIN; + pOMXAV->status = OMXAV_FIN; } - } - break; + } + break; case OMX_EventError: { if (nData1 == OMX_ErrorIncorrectStateTransition) @@ -1053,11 +1053,11 @@ void OMXToolBasicAV_SetStream(OMXToolBasicAV_t * pOMXAV, int vBufferNum, const K { OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE oActiveClockType; - INIT_PARAM(oActiveClockType); - oActiveClockType.eClock = (pOMXAV->audioPort != -1) ? + INIT_PARAM(oActiveClockType); + oActiveClockType.eClock = (pOMXAV->audioPort != -1) ? OMX_TIME_RefClockAudio : OMX_TIME_RefClockVideo; OMXSAFEVOID(OMX_SetConfig(pOMXAV->comp[OMXAV_H_CLOCK], OMX_IndexConfigTimeActiveRefClock, - &oActiveClockType)); + &oActiveClockType)); } OMXSAFEVOID(OMX_SendCommand(pOMXAV->comp[OMXAV_H_CLOCK], OMX_CommandPortDisable, (OMX_U32) -1, 0)); |