diff options
author | Kevin Rushforth <[email protected]> | 2004-10-22 22:18:16 +0000 |
---|---|---|
committer | Kevin Rushforth <[email protected]> | 2004-10-22 22:18:16 +0000 |
commit | 94b66b7ef4035c453b66a0a80e60c2afbaf310d5 (patch) | |
tree | eefeb6c84818390705ce489c104dd79996beada1 /src/native/ogl | |
parent | e59b32556030f7264798076f12d3a912317cae7e (diff) |
1. Fixed Issue 80 : libj3dcore-ogl.so fails to load on Linux systems without certain GL extensions
2. Added missing file (src/native/share/build-linux-amd64.xml) to CVS repository for amd64 build.
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@61 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/native/ogl')
-rw-r--r-- | src/native/ogl/Canvas3D.c | 129 | ||||
-rw-r--r-- | src/native/ogl/CompressedGeometryRetained.c | 26 | ||||
-rw-r--r-- | src/native/ogl/DrawingSurfaceObjectAWT.c | 11 | ||||
-rw-r--r-- | src/native/ogl/MasterControl.c | 27 | ||||
-rw-r--r-- | src/native/ogl/NativeConfigTemplate3D.c | 25 | ||||
-rw-r--r-- | src/native/ogl/NativeScreenInfo.c | 11 | ||||
-rw-r--r-- | src/native/ogl/build-linux-amd64.xml | 2 | ||||
-rw-r--r-- | src/native/ogl/build-linux-i586.xml | 2 | ||||
-rw-r--r-- | src/native/ogl/build-solaris-sparc-forte.xml | 4 | ||||
-rw-r--r-- | src/native/ogl/build-solaris-sparc-gcc.xml | 4 | ||||
-rw-r--r-- | src/native/ogl/gldefs.h | 50 |
11 files changed, 162 insertions, 129 deletions
diff --git a/src/native/ogl/Canvas3D.c b/src/native/ogl/Canvas3D.c index e440354..d5b31c2 100644 --- a/src/native/ogl/Canvas3D.c +++ b/src/native/ogl/Canvas3D.c @@ -16,15 +16,22 @@ * of the Java 3D API. */ +#if defined(__linux__) +#define _GNU_SOURCE 1 +#endif + #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <jni.h> - #include "gldefs.h" +#if defined(SOLARIS) || defined(__linux__) +#include <dlfcn.h> +#endif + #ifdef DEBUG /* Uncomment the following for VERBOSE debug messages */ /* #define VERBOSE */ @@ -179,19 +186,19 @@ void checkTextureExtensions( ctxInfo->textureExtMask |= javax_media_j3d_Canvas3D_TEXTURE_REGISTER_COMBINERS; #if defined(SOLARIS) || defined(__linux__) ctxInfo->glCombinerInputNV = - (MYPFNGLCOMBINERINPUTNV) glCombinerInputNV; + (MYPFNGLCOMBINERINPUTNV) dlsym(RTLD_DEFAULT, "glCombinerInputNV"); ctxInfo->glFinalCombinerInputNV = - (MYPFNGLFINALCOMBINERINPUTNV) glFinalCombinerInputNV; + (MYPFNGLFINALCOMBINERINPUTNV) dlsym(RTLD_DEFAULT, "glFinalCombinerInputNV"); ctxInfo->glCombinerOutputNV = - (MYPFNGLCOMBINEROUTPUTNV) glCombinerOutputNV; + (MYPFNGLCOMBINEROUTPUTNV) dlsym(RTLD_DEFAULT, "glCombinerOutputNV"); ctxInfo->glCombinerParameterfvNV = - (MYPFNGLCOMBINERPARAMETERFVNV) glCombinerParameterfvNV; + (MYPFNGLCOMBINERPARAMETERFVNV) dlsym(RTLD_DEFAULT, "glCombinerParameterfvNV"); ctxInfo->glCombinerParameterivNV = - (MYPFNGLCOMBINERPARAMETERIVNV) glCombinerParameterivNV; + (MYPFNGLCOMBINERPARAMETERIVNV) dlsym(RTLD_DEFAULT, "glCombinerParameterivNV"); ctxInfo->glCombinerParameterfNV = - (MYPFNGLCOMBINERPARAMETERFNV) glCombinerParameterfNV; + (MYPFNGLCOMBINERPARAMETERFNV) dlsym(RTLD_DEFAULT, "glCombinerParameterfNV"); ctxInfo->glCombinerParameteriNV = - (MYPFNGLCOMBINERPARAMETERINV) glCombinerParameteriNV; + (MYPFNGLCOMBINERPARAMETERINV) dlsym(RTLD_DEFAULT, "glCombinerParameteriNV"); if (ctxInfo->glCombinerInputNV == NULL || ctxInfo->glFinalCombinerInputNV == NULL || ctxInfo->glCombinerOutputNV == NULL || @@ -290,7 +297,7 @@ void checkTextureExtensions( ctxInfo->textureExtMask |= javax_media_j3d_Canvas3D_TEXTURE_SHARPEN; #if defined(SOLARIS) || defined(__linux__) ctxInfo->glSharpenTexFuncSGIS = - (MYPFNGLSHARPENTEXFUNCSGI) glSharpenTexFuncSGIS; + (MYPFNGLSHARPENTEXFUNCSGI) dlsym(RTLD_DEFAULT, "glSharpenTexFuncSGIS"); #endif #ifdef WIN32 ctxInfo->glSharpenTexFuncSGIS = (MYPFNGLSHARPENTEXFUNCSGI) @@ -314,7 +321,7 @@ void checkTextureExtensions( ctxInfo->textureExtMask |= javax_media_j3d_Canvas3D_TEXTURE_DETAIL; #if defined(SOLARIS) || defined(__linux__) ctxInfo->glDetailTexFuncSGIS = - (MYPFNGLDETAILTEXFUNCSGI) glDetailTexFuncSGIS; + (MYPFNGLDETAILTEXFUNCSGI) dlsym(RTLD_DEFAULT, "glDetailTexFuncSGIS"); #endif #ifdef WIN32 ctxInfo->glDetailTexFuncSGIS = (MYPFNGLDETAILTEXFUNCSGI) @@ -333,7 +340,7 @@ void checkTextureExtensions( ctxInfo->textureExtMask |= javax_media_j3d_Canvas3D_TEXTURE_FILTER4; #if defined(SOLARIS) || defined(__linux__) ctxInfo->glTexFilterFuncSGIS = - (MYPFNGLTEXFILTERFUNCSGI) glTexFilterFuncSGIS; + (MYPFNGLTEXFILTERFUNCSGI) dlsym(RTLD_DEFAULT, "glTexFilterFuncSGIS"); #endif #ifdef WIN32 ctxInfo->glTexFilterFuncSGIS = (MYPFNGLTEXFILTERFUNCSGI) @@ -484,8 +491,8 @@ BOOL getPropertiesFromCurrentContext( ctxInfo->texture3DAvailable = JNI_TRUE; ctxInfo->textureExtMask |= javax_media_j3d_Canvas3D_TEXTURE_3D; #if defined(SOLARIS) || defined(__linux__) - ctxInfo->glTexImage3DEXT = (MYPFNGLTEXIMAGE3DPROC )glTexImage3D; - ctxInfo->glTexSubImage3DEXT = (MYPFNGLTEXSUBIMAGE3DPROC )glTexSubImage3D; + ctxInfo->glTexImage3DEXT = (MYPFNGLTEXIMAGE3DPROC )dlsym(RTLD_DEFAULT, "glTexImage3D"); + ctxInfo->glTexSubImage3DEXT = (MYPFNGLTEXSUBIMAGE3DPROC )dlsym(RTLD_DEFAULT, "glTexSubImage3D"); #endif #ifdef WIN32 ctxInfo->glTexImage3DEXT = (MYPFNGLTEXIMAGE3DPROC )wglGetProcAddress("glTexImage3D"); @@ -503,7 +510,7 @@ BOOL getPropertiesFromCurrentContext( ctxInfo->blend_color_ext = JNI_TRUE; ctxInfo->blendFunctionTable[7] = GL_CONSTANT_COLOR; #if defined(SOLARIS) || defined(__linux__) - ctxInfo->glBlendColor = (MYPFNGLBLENDCOLORPROC )glBlendColor; + ctxInfo->glBlendColor = (MYPFNGLBLENDCOLORPROC )dlsym(RTLD_DEFAULT, "glBlendColor"); #endif #ifdef WIN32 ctxInfo->glBlendColor = (MYPFNGLBLENDCOLORPROC )wglGetProcAddress("glBlendColor"); @@ -543,8 +550,8 @@ BOOL getPropertiesFromCurrentContext( ctxInfo->texture_3D_ext_enum = GL_TEXTURE_3D_EXT; ctxInfo->texture_wrap_r_ext_enum = GL_TEXTURE_WRAP_R_EXT; #if defined(SOLARIS) || defined(__linux__) - ctxInfo->glTexImage3DEXT = (MYPFNGLTEXIMAGE3DPROC )glTexImage3DEXT; - ctxInfo->glTexSubImage3DEXT = (MYPFNGLTEXSUBIMAGE3DPROC )glTexSubImage3DEXT; + ctxInfo->glTexImage3DEXT = (MYPFNGLTEXIMAGE3DPROC )dlsym(RTLD_DEFAULT, "glTexImage3DEXT"); + ctxInfo->glTexSubImage3DEXT = (MYPFNGLTEXSUBIMAGE3DPROC )dlsym(RTLD_DEFAULT, "glTexSubImage3DEXT"); /* Fallback to non-EXT variants, needed for older NVIDIA drivers which announce GL_EXT_texture3D but don't have the EXT variants */ @@ -552,9 +559,9 @@ BOOL getPropertiesFromCurrentContext( ctxInfo->glTexSubImage3DEXT == NULL) { ctxInfo->glTexImage3DEXT = - (MYPFNGLTEXIMAGE3DPROC) glTexImage3D; + (MYPFNGLTEXIMAGE3DPROC) dlsym(RTLD_DEFAULT, "glTexImage3D"); ctxInfo->glTexSubImage3DEXT = - (MYPFNGLTEXSUBIMAGE3DPROC) glTexSubImage3D; + (MYPFNGLTEXSUBIMAGE3DPROC) dlsym(RTLD_DEFAULT, "glTexSubImage3D"); if (ctxInfo->glTexImage3DEXT == NULL || ctxInfo->glTexSubImage3DEXT == NULL) { @@ -590,7 +597,7 @@ BOOL getPropertiesFromCurrentContext( if(isExtensionSupported(tmpExtensionStr, "GL_EXT_blend_color")){ ctxInfo->blend_color_ext = JNI_TRUE; #if defined(SOLARIS) || defined(__linux__) - ctxInfo->glBlendColor = (MYPFNGLBLENDCOLOREXTPROC )glBlendColorEXT; + ctxInfo->glBlendColor = (MYPFNGLBLENDCOLOREXTPROC )dlsym(RTLD_DEFAULT, "glBlendColorEXT"); #endif #ifdef WIN32 ctxInfo->glBlendColor = (MYPFNGLBLENDCOLOREXTPROC )wglGetProcAddress("glBlendColorEXT"); @@ -659,9 +666,11 @@ BOOL getPropertiesFromCurrentContext( ctxInfo->arb_transpose_matrix = JNI_TRUE; } +#ifdef OBSOLETE_HW_COMPRESSED_GEOM if(isExtensionSupported(tmpExtensionStr, "GL_SUNX_geometry_compression")) { ctxInfo->geometry_compression_sunx = JNI_TRUE ; } +#endif /* OBSOLETE_HW_COMPRESSED_GEOM */ #if defined(SOLARIS) || defined(__linux__) /* @@ -758,6 +767,7 @@ BOOL getPropertiesFromCurrentContext( ctxInfo->extMask |= javax_media_j3d_Canvas3D_ARB_TRANSPOSE_MATRIX; } +#ifdef OBSOLETE_HW_COMPRESSED_GEOM /* * Check for compressed geometry extensions and see if hardware * acceleration is supported in the runtime environment. @@ -782,7 +792,7 @@ BOOL getPropertiesFromCurrentContext( free(tmp) ; ctxInfo->geometry_compression_accelerated = 1 ; } - +#endif /* OBSOLETE_HW_COMPRESSED_GEOM */ /* Setup GL_EXT_separate_specular_color */ if(ctxInfo->seperate_specular_color) { @@ -892,36 +902,47 @@ BOOL getPropertiesFromCurrentContext( #if defined(SOLARIS) || defined(__linux__) if(ctxInfo->multi_draw_arrays_ext) { - ctxInfo->glMultiDrawArraysEXT = glMultiDrawArraysEXT; - ctxInfo->glMultiDrawElementsEXT = glMultiDrawElementsEXT; + ctxInfo->glMultiDrawArraysEXT = + (MYPFNGLMULTIDRAWARRAYSEXTPROC)dlsym(RTLD_DEFAULT, "glMultiDrawArraysEXT"); + ctxInfo->glMultiDrawElementsEXT = + (MYPFNGLMULTIDRAWELEMENTSEXTPROC)dlsym(RTLD_DEFAULT, "glMultiDrawElementsEXT"); if ((ctxInfo->glMultiDrawArraysEXT == NULL) || (ctxInfo->glMultiDrawElementsEXT == NULL)) { ctxInfo->multi_draw_arrays_ext = JNI_FALSE; } } else if (ctxInfo->multi_draw_arrays_sun) { - ctxInfo->glMultiDrawArraysEXT = glMultiDrawArraysSUN; - ctxInfo->glMultiDrawElementsEXT = glMultiDrawElementsSUN; + ctxInfo->glMultiDrawArraysEXT = + (MYPFNGLMULTIDRAWARRAYSEXTPROC)dlsym(RTLD_DEFAULT, "glMultiDrawArraysSUN"); + ctxInfo->glMultiDrawElementsEXT = + (MYPFNGLMULTIDRAWELEMENTSEXTPROC)dlsym(RTLD_DEFAULT, "glMultiDrawElementsSUN"); if ((ctxInfo->glMultiDrawArraysEXT == NULL) || (ctxInfo->glMultiDrawElementsEXT == NULL)) { ctxInfo->multi_draw_arrays_ext = JNI_FALSE; } } if(ctxInfo->compiled_vertex_array_ext) { - ctxInfo->glLockArraysEXT = glLockArraysEXT; - ctxInfo->glUnlockArraysEXT = glUnlockArraysEXT; + ctxInfo->glLockArraysEXT = + (MYPFNGLLOCKARRAYSEXTPROC)dlsym(RTLD_DEFAULT, "glLockArraysEXT"); + ctxInfo->glUnlockArraysEXT = + (MYPFNGLUNLOCKARRAYSEXTPROC)dlsym(RTLD_DEFAULT, "glUnlockArraysEXT"); if ((ctxInfo->glLockArraysEXT == NULL) || (ctxInfo->glUnlockArraysEXT == NULL)) { ctxInfo->compiled_vertex_array_ext = JNI_FALSE; } - } - + } + if(ctxInfo->arb_multitexture){ - ctxInfo->glClientActiveTextureARB = glClientActiveTextureARB; - ctxInfo->glMultiTexCoord2fvARB = glMultiTexCoord2fvARB; - ctxInfo->glMultiTexCoord3fvARB = glMultiTexCoord3fvARB; - ctxInfo->glMultiTexCoord4fvARB = glMultiTexCoord4fvARB; - ctxInfo->glActiveTextureARB = glActiveTextureARB; + ctxInfo->glClientActiveTextureARB = + (MYPFNGLCLIENTACTIVETEXTUREARBPROC)dlsym(RTLD_DEFAULT, "glClientActiveTextureARB"); + ctxInfo->glMultiTexCoord2fvARB = + (MYPFNGLMULTITEXCOORD2FVARBPROC)dlsym(RTLD_DEFAULT, "glMultiTexCoord2fvARB"); + ctxInfo->glMultiTexCoord3fvARB = + (MYPFNGLMULTITEXCOORD3FVARBPROC)dlsym(RTLD_DEFAULT, "glMultiTexCoord3fvARB"); + ctxInfo->glMultiTexCoord4fvARB = + (MYPFNGLMULTITEXCOORD4FVARBPROC)dlsym(RTLD_DEFAULT, "glMultiTexCoord4fvARB"); + ctxInfo->glActiveTextureARB = + (MYPFNGLACTIVETEXTUREARBPROC)dlsym(RTLD_DEFAULT, "glActiveTextureARB"); if ((ctxInfo->glClientActiveTextureARB == NULL) || (ctxInfo->glMultiTexCoord2fvARB == NULL) || (ctxInfo->glMultiTexCoord3fvARB == NULL) || @@ -931,20 +952,32 @@ BOOL getPropertiesFromCurrentContext( } } if(ctxInfo->arb_transpose_matrix) { - ctxInfo->glLoadTransposeMatrixdARB = glLoadTransposeMatrixdARB; - ctxInfo->glMultTransposeMatrixdARB = glMultTransposeMatrixdARB; + ctxInfo->glLoadTransposeMatrixdARB = + (MYPFNGLLOADTRANSPOSEMATRIXDARBPROC)dlsym(RTLD_DEFAULT, "glLoadTransposeMatrixdARB"); + ctxInfo->glMultTransposeMatrixdARB = + (MYPFNGLMULTTRANSPOSEMATRIXDARBPROC)dlsym(RTLD_DEFAULT, "glMultTransposeMatrixdARB"); if ((ctxInfo->glLoadTransposeMatrixdARB == NULL) || (ctxInfo->glMultTransposeMatrixdARB == NULL)) { ctxInfo->arb_transpose_matrix = JNI_FALSE; } } if(ctxInfo->global_alpha_sun) { - ctxInfo->glGlobalAlphaFactorfSUN = glGlobalAlphaFactorfSUN; + ctxInfo->glGlobalAlphaFactorfSUN = + (MYPFNGLGLOBALALPHAFACTORFSUNPROC)dlsym(RTLD_DEFAULT, "glGlobalAlphaFactorfSUN"); if (ctxInfo->glGlobalAlphaFactorfSUN == NULL) { ctxInfo->global_alpha_sun = JNI_FALSE; } } + if(ctxInfo->videoResizeAvailable) { + ctxInfo->glXVideoResizeSUN = + (MYPFNGLXVIDEORESIZESUN)dlsym(RTLD_DEFAULT, "glXVideoResizeSUN"); + if (ctxInfo->glXVideoResizeSUN == NULL) { + ctxInfo->videoResizeAvailable = JNI_FALSE; + ctxInfo->extMask &= ~javax_media_j3d_Canvas3D_SUN_VIDEO_RESIZE; + } + } + #endif /* Solaris or Linux */ if (stencilSize > 1) { @@ -2525,19 +2558,23 @@ int getTextureColorTableSize( (MYPFNGLGETCOLORTABLEPARAMETERIVPROC)wglGetProcAddress("glGetColorTableParameteriv"); #endif #if defined(SOLARIS) || defined(__linux__) - ctxProperties->glColorTable = glColorTable; - ctxProperties->glGetColorTableParameteriv = glGetColorTableParameteriv; + ctxProperties->glColorTable = + (MYPFNGLCOLORTABLEPROC)dlsym(RTLD_DEFAULT, "glColorTable"); + ctxProperties->glGetColorTableParameteriv = + (MYPFNGLGETCOLORTABLEPARAMETERIVPROC)dlsym(RTLD_DEFAULT, "glGetColorTableParameteriv"); #endif } else if(isExtensionSupported(extensionStr, "GL_SGI_color_table")) { #ifdef WIN32 ctxProperties->glColorTable = (MYPFNGLCOLORTABLEPROC)wglGetProcAddress("glColorTableSGI"); ctxProperties->glGetColorTableParameteriv = - (MYPFNGLGETCOLORTABLEPARAMETERIVPROC)wglGetProcAddress("glGetColorTableParameterivSGI"); + (MYPFNGLGETCOLORTABLEPARAMETERIVPROC)wglGetProcAddress("glGetColorTableParameterivSGI"); #endif #if defined(SOLARIS) || defined(__linux__) - ctxProperties->glColorTable = glColorTableSGI; - ctxProperties->glGetColorTableParameteriv = glGetColorTableParameterivSGI; + ctxProperties->glColorTable = + (MYPFNGLCOLORTABLEPROC)dlsym(RTLD_DEFAULT, "glColorTableSGI"); + ctxProperties->glGetColorTableParameteriv = + (MYPFNGLGETCOLORTABLEPARAMETERIVPROC)dlsym(RTLD_DEFAULT, "glGetColorTableParameterivSGI"); #endif } else { @@ -2566,12 +2603,14 @@ void JNICALL Java_javax_media_j3d_Canvas3D_videoResize( jint win, jfloat dvrFactor) { - #if defined(SOLARIS) || defined(__linux__) + + GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo; + /* Not need to do ext. supported checking. This check is done in java. */ /* fprintf(stderr, "Canvas3D.c -- glXVideoResize -- %d %f\n", win, dvrFactor); */ - glXVideoResizeSUN((Display *)display, (Window)win, (float) dvrFactor); + ctxProperties->glXVideoResizeSUN((Display *)display, (Window)win, (float) dvrFactor); #endif } @@ -3155,6 +3194,10 @@ void initializeCtxInfo(JNIEnv *env , GraphicsContextPropertiesInfo* ctxInfo){ ctxInfo->glSharpenTexFuncSGIS = NULL; ctxInfo->glDetailTexFuncSGIS = NULL; ctxInfo->glTexFilterFuncSGIS = NULL; + +#if defined(SOLARIS) || defined(__linux__) + ctxInfo->glXVideoResizeSUN = NULL; +#endif /* SOLARIS || __linux__ */ } void cleanupCtxInfo(GraphicsContextPropertiesInfo* ctxInfo){ diff --git a/src/native/ogl/CompressedGeometryRetained.c b/src/native/ogl/CompressedGeometryRetained.c index 36ca164..9742707 100644 --- a/src/native/ogl/CompressedGeometryRetained.c +++ b/src/native/ogl/CompressedGeometryRetained.c @@ -14,14 +14,11 @@ #include <jni.h> #include "gldefs.h" -#ifdef SOLARIS +#ifdef OBSOLETE_HW_COMPRESSED_GEOM +/* #if defined(SOLARIS) && defined(__sparc) */ +/* Solaris/Sparc only, all others define this as a noop */ #pragma weak glDrawCompressedGeomSUNX - -#else -static void glDrawCompressedGeomSUNX(GLint size, GLubyte *data) { - fprintf(stderr, "Warning: glDrawCompressedGeomSUNX() not supported\n") ; -} -#endif /* SOLARIS */ +#endif /* OBSOLETE_HW_COMPRESSED_GEOM */ JNIEXPORT @@ -30,8 +27,12 @@ void JNICALL Java_javax_media_j3d_CompressedGeometryRetained_execute jint bufferContents, jint renderFlags, jint offset, jint size, jbyteArray geometry) { + fprintf(stderr, + "JAVA 3D ERROR: call to obsolete CompressedGeometryRetained.execute method\n"); + + +#ifdef OBSOLETE_HW_COMPRESSED_GEOM GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo; - jlong ctx = ctxProperties->context; jbyte *cg = (*env)->GetPrimitiveArrayCritical(env, geometry, 0) ; @@ -40,6 +41,7 @@ void JNICALL Java_javax_media_j3d_CompressedGeometryRetained_execute glDrawCompressedGeomSUNX((GLint)(size + 48), (GLubyte *)cg) ; (*env)->ReleasePrimitiveArrayCritical(env, geometry, cg, 0) ; +#endif /* OBSOLETE_HW_COMPRESSED_GEOM */ } @@ -47,24 +49,28 @@ JNIEXPORT jboolean JNICALL Java_javax_media_j3d_CompressedGeometryRetained_decompressByRef (JNIEnv *env, jobject obj, jlong ctxInfo) { - return JNI_FALSE ; + return JNI_FALSE; } JNIEXPORT jboolean JNICALL Java_javax_media_j3d_CompressedGeometryRetained_decompressHW (JNIEnv *env, jobject obj, jlong ctxInfo, jint majorVersion, jint minorVersion) { + return JNI_FALSE; + + +#ifdef OBSOLETE_HW_COMPRESSED_GEOM /* * Return true if hardware decompression is supported for the given * version number of the compressed geometry. */ GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo; - jlong ctx = ctxProperties->context; return (ctxProperties->geometry_compression_accelerated == 1) && ((majorVersion < ctxProperties->geometry_compression_accelerated_major_version) || ((majorVersion == ctxProperties->geometry_compression_accelerated_major_version) && (minorVersion <= ctxProperties->geometry_compression_accelerated_minor_version))) ; +#endif /* OBSOLETE_HW_COMPRESSED_GEOM */ } diff --git a/src/native/ogl/DrawingSurfaceObjectAWT.c b/src/native/ogl/DrawingSurfaceObjectAWT.c index 71e4376..012f5b9 100644 --- a/src/native/ogl/DrawingSurfaceObjectAWT.c +++ b/src/native/ogl/DrawingSurfaceObjectAWT.c @@ -28,11 +28,7 @@ #endif /* DEBUG */ -#if defined(SOLARIS) || defined(__linux__) -#pragma weak JAWT_GetAWT -#endif - -#ifdef SOLARIS +#if defined(SOLARIS) && defined(__sparc) #pragma weak XDgaGetXineramaInfo /* @@ -43,7 +39,7 @@ * standard or replaced with a fully supported API. */ #include "panoramiXext.h" -#endif /* SOLARIS */ +#endif /* SOLARIS && __sparc */ JNIEXPORT jlong JNICALL @@ -64,6 +60,7 @@ Java_javax_media_j3d_MasterControl_getAWT( fprintf(stderr, "AWT not found\n"); return 0; } + return (jlong)awt; } @@ -114,6 +111,7 @@ Java_javax_media_j3d_DrawingSurfaceObjectAWT_getDrawingSurfaceWindowIdAWT( (JAWT_X11DrawingSurfaceInfo*) dsi->platformInfo; window = (jint)xds->drawable; +#ifdef __sparc if (xineramaDisabled) { XineramaInfo xineramaInfo; @@ -143,6 +141,7 @@ Java_javax_media_j3d_DrawingSurfaceObjectAWT_getDrawingSurfaceWindowIdAWT( fprintf(stderr, "Get Xinerama subwid, screen %d failed\n", screen); } } +#endif /* __sparc */ #endif /* SOLARIS */ #ifdef __linux__ diff --git a/src/native/ogl/MasterControl.c b/src/native/ogl/MasterControl.c index 3f8dcc5..9dd65d9 100644 --- a/src/native/ogl/MasterControl.c +++ b/src/native/ogl/MasterControl.c @@ -44,11 +44,11 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> +#if defined(SOLARIS) && defined(__sparc) #pragma weak glXInitThreadsSUN #pragma weak glXDisableXineramaSUN #pragma weak XPanoramiXQueryExtension -#ifdef SOLARIS extern int glXInitThreadsSUN(); extern int glXDisableXineramaSUN(Display *dpy); @@ -63,7 +63,8 @@ extern int glXDisableXineramaSUN(Display *dpy); */ extern Bool XPanoramiXQueryExtension(Display *dpy, int *event_base, int *error_base); -#endif /* SOLARIS */ +#endif /* SOLARIS && __sparc */ + #endif /* SOLARIS || __linux__ */ /* defined in Canvas3D.c */ @@ -74,23 +75,17 @@ JNIEXPORT jboolean JNICALL Java_javax_media_j3d_MasterControl_initializeJ3D( JNIEnv *env, jobject obj, jboolean disableXinerama) { - jboolean glIsMTSafe = JNI_FALSE; + jboolean glIsMTSafe = JNI_TRUE; -#ifdef WIN32 - glIsMTSafe = JNI_TRUE; - return glIsMTSafe; -#endif /* WIN32 */ + /* Nothing to do for non-sparc-solaris platforms */ -#ifdef __linux__ - glIsMTSafe = JNI_TRUE; - return glIsMTSafe; -#endif /* __linux__ */ - -#ifdef SOLARIS +#if defined(SOLARIS) && defined(__sparc) Display* dpy; int event_base, error_base; const char *glxExtStr = NULL; + glIsMTSafe = JNI_FALSE; + dpy = XOpenDisplay(NULL); glxExtStr = glXGetClientString((Display*)dpy, GLX_EXTENSIONS); @@ -146,7 +141,7 @@ Java_javax_media_j3d_MasterControl_initializeJ3D( DPRINT((stderr, "but Xinerama is not in use.\n")); } } -#endif /* SOLARIS */ +#endif /* SOLARIS && __sparc */ return glIsMTSafe; } @@ -210,6 +205,10 @@ Java_javax_media_j3d_MasterControl_getThreadConcurrency(JNIEnv *env, return (jint) thr_getconcurrency(); #endif /* SOLARIS */ +#ifdef __linux__ + return -1; +#endif /* __linux__ */ + #ifdef WIN32 return -1; #endif /* WIN32 */ diff --git a/src/native/ogl/NativeConfigTemplate3D.c b/src/native/ogl/NativeConfigTemplate3D.c index 3c938dd..ae1ab22 100644 --- a/src/native/ogl/NativeConfigTemplate3D.c +++ b/src/native/ogl/NativeConfigTemplate3D.c @@ -16,6 +16,10 @@ * of the Java 3D API. */ +#if defined(__linux__) +#define _GNU_SOURCE 1 +#endif + #include <jni.h> #include <math.h> #include <stdlib.h> @@ -26,6 +30,7 @@ #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> +#include <dlfcn.h> #endif #ifdef WIN32 @@ -47,7 +52,11 @@ GLXFBConfig *find_S_FBConfigs(jlong display, GLXFBConfig *fbConfigList = NULL; int numFBConfigs, index; - + MYPFNGLXCHOOSEFBCONFIG pGLXChooseFbConfig = NULL; + + pGLXChooseFbConfig = + (MYPFNGLXCHOOSEFBCONFIG) dlsym(RTLD_DEFAULT, "glXChooseFBConfig"); + J3D_ASSERT((sIndex+3) < MAX_GLX_ATTRS_LENGTH); if (sVal == REQUIRED || sVal== PREFERRED) { @@ -57,8 +66,8 @@ GLXFBConfig *find_S_FBConfigs(jlong display, glxAttrs[index++] = True; glxAttrs[index] = None; - fbConfigList = glXChooseFBConfig((Display*)display, screen, - glxAttrs, &numFBConfigs); + fbConfigList = pGLXChooseFbConfig((Display*)display, screen, + glxAttrs, &numFBConfigs); if(fbConfigList != NULL) { return fbConfigList; @@ -85,8 +94,8 @@ GLXFBConfig *find_S_FBConfigs(jlong display, } } */ - fbConfigList = glXChooseFBConfig((Display*)display, screen, - glxAttrs, &numFBConfigs); + fbConfigList = pGLXChooseFbConfig((Display*)display, screen, + glxAttrs, &numFBConfigs); if(fbConfigList != NULL) { return fbConfigList; @@ -99,8 +108,8 @@ GLXFBConfig *find_S_FBConfigs(jlong display, glxAttrs[index++] = True; glxAttrs[index] = None; - fbConfigList = glXChooseFBConfig((Display*)display, screen, - glxAttrs, &numFBConfigs); + fbConfigList = pGLXChooseFbConfig((Display*)display, screen, + glxAttrs, &numFBConfigs); if(fbConfigList != NULL) { return fbConfigList; @@ -270,7 +279,7 @@ jint JNICALL Java_javax_media_j3d_NativeConfigTemplate3D_chooseOglVisual( int status, major, minor; Display *dpy = (Display *) display; - + fbConfigListPtr = (*env)->GetLongArrayElements(env, fbConfigArray, NULL); mx_ptr = (*env)->GetIntArrayElements(env, attrList, NULL); diff --git a/src/native/ogl/NativeScreenInfo.c b/src/native/ogl/NativeScreenInfo.c index 0c588c6..8ea4b17 100644 --- a/src/native/ogl/NativeScreenInfo.c +++ b/src/native/ogl/NativeScreenInfo.c @@ -16,6 +16,10 @@ * of the Java 3D API. */ +#if defined(__linux__) +#define _GNU_SOURCE 1 +#endif + #include <jni.h> #include <math.h> #include <stdio.h> @@ -26,6 +30,7 @@ #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> +#include <dlfcn.h> #endif #ifdef WIN32 @@ -34,8 +39,6 @@ #if defined(SOLARIS) || defined(__linux__) -#pragma weak glXChooseFBConfig - /* * Class: javax_media_j3d_NativeScreenInfo @@ -79,7 +82,7 @@ Java_javax_media_j3d_NativeScreenInfo_queryGLX13( jlong display) { /* Fix for Issue 20 */ - void (*tmpfp)(); + MYPFNGLXCHOOSEFBCONFIG tmpfp; int major, minor; int errorBase, eventBase; Display* dpy = (Display*)display; @@ -111,7 +114,7 @@ Java_javax_media_j3d_NativeScreenInfo_queryGLX13( #elseif - tmpfp = (void (*)())glXChooseFBConfig; + tmpfp = (MYPFNGLXCHOOSEFBCONFIG)dlsym(RTLD_DEFAULT, "glXChooseFBConfig"); if (tmpfp == NULL) { glXQueryVersion(dpy, &major, &minor); diff --git a/src/native/ogl/build-linux-amd64.xml b/src/native/ogl/build-linux-amd64.xml index dc17d2b..cbae9ac 100644 --- a/src/native/ogl/build-linux-amd64.xml +++ b/src/native/ogl/build-linux-amd64.xml @@ -34,7 +34,7 @@ <!-- Create the library file--> <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="ld"> - <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o CompressedGeometryRetained.o GeometryArrayRetained.o Attributes.o Lights.o NativeAPIInfo.o -G -z lazyload -L/usr/X11R6/lib64 -ldl -lGL -lX11 -lXext -lm -lnsl -lc -R/usr/openwin/lib -L${java.home}/lib/amd64 -ljawt -L${java.home}/lib/amd64/server -ljvm -o libj3dcore-ogl.so"/> + <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o CompressedGeometryRetained.o GeometryArrayRetained.o Attributes.o Lights.o NativeAPIInfo.o -G -z defs -L/usr/X11R6/lib64 -ldl -lGL -lX11 -lXext -lm -lnsl -lc -R/usr/openwin/lib -L${java.home}/lib/amd64 -ljawt -L${java.home}/lib/amd64/server -ljvm -o libj3dcore-ogl.so"/> </exec> <!-- Copy the copyright library file --> diff --git a/src/native/ogl/build-linux-i586.xml b/src/native/ogl/build-linux-i586.xml index 1148118..c25613f 100644 --- a/src/native/ogl/build-linux-i586.xml +++ b/src/native/ogl/build-linux-i586.xml @@ -34,7 +34,7 @@ <!-- Create the library file--> <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="ld"> - <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o CompressedGeometryRetained.o GeometryArrayRetained.o Attributes.o Lights.o NativeAPIInfo.o -G -z lazyload -L/usr/X11R6/lib -ldl -lGL -lX11 -lXext -lm -lnsl -lc -R/usr/openwin/lib -L${java.home}/lib/i386 -ljawt -L${java.home}/lib/i386/server -ljvm -o libj3dcore-ogl.so"/> + <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o CompressedGeometryRetained.o GeometryArrayRetained.o Attributes.o Lights.o NativeAPIInfo.o -G -z defs -L/usr/X11R6/lib -ldl -lGL -lX11 -lXext -lm -lnsl -lc -R/usr/openwin/lib -L${java.home}/lib/i386 -ljawt -L${java.home}/lib/i386/server -ljvm -o libj3dcore-ogl.so"/> </exec> <!-- Copy the copyright library file --> diff --git a/src/native/ogl/build-solaris-sparc-forte.xml b/src/native/ogl/build-solaris-sparc-forte.xml index 86d46d7..5652b10 100644 --- a/src/native/ogl/build-solaris-sparc-forte.xml +++ b/src/native/ogl/build-solaris-sparc-forte.xml @@ -35,7 +35,7 @@ <!-- Create the library file--> <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="ld"> - <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o CompressedGeometryRetained.o GeometryArrayRetained.o Attributes.o Lights.o NativeAPIInfo.o -G -z lazyload -L/usr/openwin/lib -ldga -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib -L${java.home}/lib/sparc -ljawt -L${java.home}/lib/sparc/server -ljvm -o libj3dcore-ogl.so"/> + <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o CompressedGeometryRetained.o GeometryArrayRetained.o Attributes.o Lights.o NativeAPIInfo.o -G -z defs -L/usr/openwin/lib -ldga -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib -L${java.home}/lib/sparc -L${java.home}/lib/sparc/motif21 -ljawt -L${java.home}/lib/sparc/server -ljvm -o libj3dcore-ogl.so"/> </exec> <!-- Copy the copyright library file --> @@ -56,7 +56,7 @@ <!-- Create the library file--> <exec dir="${build}/${platform}/${bldType}/native/ogl/objs/sparcv9" executable="ld"> - <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o CompressedGeometryRetained.o GeometryArrayRetained.o Attributes.o Lights.o NativeAPIInfo.o -G -z lazyload -L/usr/openwin/lib/sparcv9 -ldga -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib/sparcv9 -L${java.home}/lib/sparcv9 -ljawt -L${java.home}/lib/sparcv9/server -ljvm -o libj3dcore-ogl.so"/> + <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o CompressedGeometryRetained.o GeometryArrayRetained.o Attributes.o Lights.o NativeAPIInfo.o -G -z defs -L/usr/openwin/lib/sparcv9 -ldga -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib/sparcv9 -L${java.home}/lib/sparcv9 -L${java.home}/lib/sparcv9/motif21 -ljawt -L${java.home}/lib/sparcv9/server -ljvm -o libj3dcore-ogl.so"/> </exec> <!-- Copy the copyright library file --> diff --git a/src/native/ogl/build-solaris-sparc-gcc.xml b/src/native/ogl/build-solaris-sparc-gcc.xml index 33f8ebe..acd9724 100644 --- a/src/native/ogl/build-solaris-sparc-gcc.xml +++ b/src/native/ogl/build-solaris-sparc-gcc.xml @@ -35,7 +35,7 @@ <!-- Create the library file--> <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="ld"> - <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o CompressedGeometryRetained.o GeometryArrayRetained.o Attributes.o Lights.o NativeAPIInfo.o -G -z lazyload -L/usr/openwin/lib -ldga -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib -L${java.home}/lib/sparc -ljawt -L${java.home}/lib/sparc/server -ljvm -o libj3dcore-ogl.so"/> + <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o CompressedGeometryRetained.o GeometryArrayRetained.o Attributes.o Lights.o NativeAPIInfo.o -G -z defs -L/usr/openwin/lib -ldga -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib -L${java.home}/lib/sparc -L${java.home}/lib/sparc/motif21 -ljawt -L${java.home}/lib/sparc/server -ljvm -o libj3dcore-ogl.so"/> </exec> <!-- Copy the copyright library file --> @@ -56,7 +56,7 @@ <!-- Create the library file--> <exec dir="${build}/${platform}/${bldType}/native/ogl/objs/sparcv9" executable="ld"> - <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o CompressedGeometryRetained.o GeometryArrayRetained.o Attributes.o Lights.o NativeAPIInfo.o -G -z lazyload -L/usr/openwin/lib/sparcv9 -ldga -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib/sparcv9 -L${java.home}/lib/sparcv9 -ljawt -L${java.home}/lib/sparcv9/server -ljvm -o libj3dcore-ogl.so"/> + <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o CompressedGeometryRetained.o GeometryArrayRetained.o Attributes.o Lights.o NativeAPIInfo.o -G -z defs -L/usr/openwin/lib/sparcv9 -ldga -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib/sparcv9 -L${java.home}/lib/sparcv9 -L${java.home}/lib/sparcv9/motif21 -ljawt -L${java.home}/lib/sparcv9/server -ljvm -o libj3dcore-ogl.so"/> </exec> <!-- Copy the copyright library file --> diff --git a/src/native/ogl/gldefs.h b/src/native/ogl/gldefs.h index 36e1a2b..f5ce5f6 100644 --- a/src/native/ogl/gldefs.h +++ b/src/native/ogl/gldefs.h @@ -345,46 +345,9 @@ extern void APIENTRY glTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLs #ifndef GLX_SUN_video_resize #define GLX_SUN_video_resize 1 extern int glXVideoResizeSUN( Display *, GLXDrawable, float); -extern int glXgetVideoResizeSUN( Display *, GLXDrawable, float *); #endif -#pragma weak glXVideoResizeSUN -#pragma weak glBlendColor -#pragma weak glBlendColorEXT -#pragma weak glColorTable -#pragma weak glColorTableSGI -#pragma weak glGetColorTableParameterivSGI -#pragma weak glGetColorTableParameteriv -#pragma weak glMultiDrawArraysSUN -#pragma weak glMultiDrawArraysEXT -#pragma weak glMultiDrawElementsSUN -#pragma weak glMultiDrawElementsEXT -#pragma weak glLockArraysEXT -#pragma weak glUnlockArraysEXT -#pragma weak glClientActiveTextureARB -#pragma weak glMultiTexCoord2fvARB -#pragma weak glMultiTexCoord3fvARB -#pragma weak glMultiTexCoord4fvARB -#pragma weak glGlobalAlphaFactorfSUN -#pragma weak glLoadTransposeMatrixdARB -#pragma weak glMultTransposeMatrixdARB -#pragma weak glActiveTextureARB -#pragma weak glCombinerInputNV -#pragma weak glCombinerOutputNV -#pragma weak glFinalCombinerInputNV -#pragma weak glCombinerParameterfvNV -#pragma weak glCombinerParameterivNV -#pragma weak glCombinerParameterfNV -#pragma weak glCombinerParameteriNV -#pragma weak glSharpenTexFuncSGIS -#pragma weak glDetailTexFuncSGIS -#pragma weak glTexFilterFuncSGIS -/* [jk] mostly needed by older NVIDIA drivers */ -#pragma weak glTexImage3DEXT -#pragma weak glTexSubImage3DEXT -#pragma weak glTexImage3D -#pragma weak glTexSubImage3D -#endif /* SOLARIS */ +#endif /* SOLARIS || __linux__ */ #ifndef APIENTRY #define APIENTRY @@ -426,6 +389,12 @@ typedef void (APIENTRY * MYPFNGLSHARPENTEXFUNCSGI) (GLenum target, GLsizei n, co typedef void (APIENTRY * MYPFNGLDETAILTEXFUNCSGI) (GLenum target, GLsizei n, const GLfloat *points); typedef void (APIENTRY * MYPFNGLTEXFILTERFUNCSGI) (GLenum target, GLenum filter, GLsizei n, const GLfloat *points); +#if defined(SOLARIS) || defined(__linux__) +typedef GLXFBConfig * (APIENTRY * MYPFNGLXCHOOSEFBCONFIG) (Display *dpy, int screen, const int *attrib_list, int *nelements); +typedef int (APIENTRY * MYPFNGLXVIDEORESIZESUN) (Display * dpy, GLXDrawable draw, float factor); +#endif /* SOLARIS || __linux__ */ + + /* define the structure to hold the properties of graphics context */ typedef struct { jlong context; @@ -619,6 +588,11 @@ typedef struct { MYPFNGLSHARPENTEXFUNCSGI glSharpenTexFuncSGIS; MYPFNGLDETAILTEXFUNCSGI glDetailTexFuncSGIS; MYPFNGLTEXFILTERFUNCSGI glTexFilterFuncSGIS; + +#if defined(SOLARIS) || defined(__linux__) + MYPFNGLXVIDEORESIZESUN glXVideoResizeSUN; +#endif /* SOLARIS || __linux__ */ + } GraphicsContextPropertiesInfo; |