summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/classes/share/javax/media/j3d/MasterControl.java39
-rw-r--r--src/classes/share/javax/media/j3d/NativePipeline.java39
-rw-r--r--src/classes/share/javax/media/j3d/Pipeline.java51
-rw-r--r--src/native/ogl/OglCheck.c402
-rw-r--r--src/native/ogl/build-windows-i586-gcc.xml23
-rw-r--r--src/native/ogl/build-windows-i586-vc.xml16
6 files changed, 544 insertions, 26 deletions
diff --git a/src/classes/share/javax/media/j3d/MasterControl.java b/src/classes/share/javax/media/j3d/MasterControl.java
index af3d717..418e325 100644
--- a/src/classes/share/javax/media/j3d/MasterControl.java
+++ b/src/classes/share/javax/media/j3d/MasterControl.java
@@ -720,15 +720,23 @@ class MasterControl {
static void loadLibraries() {
assert !librariesLoaded;
- // Set global flags indicating whether we are running on Windows or MacOS
- String osName = getProperty("os.name");
- isWindowsOs = osName != null && osName.startsWith("Windows");
- isMacOs = osName != null && osName.startsWith("Mac");
-
-//KCR: System.err.println("MasterControl.loadLibraries()");
-//KCR: System.err.println(" osName = \"" + osName + "\"" +
-//KCR: ", isWindowsOs = " + isWindowsOs +
-//KCR: ", isMacOs = " + isMacOs);
+ // Get platform system properties
+ String osName = getProperty("os.name").toLowerCase();
+ String sunArchDataModel = getProperty("sun.arch.data.model");
+
+ // Set global flags based on platform architecture
+ isMacOs = osName != null && osName.startsWith("mac");
+ isWindowsOs = osName != null && osName.startsWith("windows");
+ boolean isWindowsVista = isWindowsOs && osName.indexOf("vista") != -1;
+ boolean is64Bit = (sunArchDataModel != null) && sunArchDataModel.equals("64");
+
+// System.err.println("MasterControl.loadLibraries()");
+// System.err.println(" osName [lower-case] = \"" + osName + "\"" +
+// ", sunArchDataModel = " + sunArchDataModel);
+// System.err.println(" is64Bit = " + is64Bit +
+// ", isWindowsOs = " + isWindowsOs +
+// ", isMacOs = " + isMacOs +
+// ", isWindowsVista = " + isWindowsVista);
// Initialize the Pipeline object associated with the
// renderer specified by the "j3d.rend" system property.
@@ -741,11 +749,13 @@ class MasterControl {
Pipeline.Type pipelineType =
isMacOs ? Pipeline.Type.JOGL : Pipeline.Type.NATIVE_OGL;
- String rendStr = getProperty("j3d.rend");
+ final String rendStr = getProperty("j3d.rend");
+ boolean nativeOglRequested = false;
if (rendStr == null) {
// Use default pipeline
} else if (rendStr.equals("ogl") && !isMacOs) {
pipelineType = Pipeline.Type.NATIVE_OGL;
+ nativeOglRequested = true;
} else if (rendStr.equals("d3d") && isWindowsOs) {
pipelineType = Pipeline.Type.NATIVE_D3D;
} else if (rendStr.equals("jogl")) {
@@ -757,7 +767,14 @@ class MasterControl {
// Use default pipeline
}
-//KCR: System.err.println(" using " + pipelineType + " pipeline");
+ // Issue 452 : if we are on 32-bit Windows, then check whether we
+ // can and should use OpenGL. Note that we can't do this on 64-bit
+ // Windows until we have a 64-bit D3D pipeline.
+ if (isWindowsOs && !is64Bit && pipelineType == Pipeline.Type.NATIVE_OGL) {
+ if (!Pipeline.useNativeOgl(isWindowsVista, nativeOglRequested)) {
+ pipelineType = Pipeline.Type.NATIVE_D3D;
+ }
+ }
// Construct the singleton Pipeline instance
Pipeline.createPipeline(pipelineType);
diff --git a/src/classes/share/javax/media/j3d/NativePipeline.java b/src/classes/share/javax/media/j3d/NativePipeline.java
index 63f7e42..97a478a 100644
--- a/src/classes/share/javax/media/j3d/NativePipeline.java
+++ b/src/classes/share/javax/media/j3d/NativePipeline.java
@@ -49,7 +49,32 @@ class NativePipeline extends Pipeline {
* class, we can create one statically.
*/
private static NativeConfigTemplate3D nativeTemplate = new NativeConfigTemplate3D();
-
+
+ // Flag indicating that the ogl-chk library has been loaded
+ private static boolean oglChkLibraryLoaded = false;
+
+ // Method to return the vendor string for the native OpenGL pipeline.
+ // If the native library cannot be loaded, or if GL_VERSION < 1.2
+ // then null is returned.
+ static String getSupportedOglVendor() {
+ if (!oglChkLibraryLoaded) {
+ try {
+ loadLibrary("j3dcore-ogl-chk");
+ } catch (RuntimeException ex) {
+ System.err.println(ex);
+ return null;
+ } catch (Error ex) {
+ System.err.println(ex);
+ return null;
+ }
+ oglChkLibraryLoaded = true;
+ }
+ return getSupportedOglVendorNative();
+ }
+
+ // Native method to return the vendor string
+ private static native String getSupportedOglVendorNative();
+
/**
* Constructor for singleton NativePipeline instance
*/
@@ -110,7 +135,7 @@ class NativePipeline extends Pipeline {
}
}
}
-
+
/**
* Returns true if the Cg library is loaded and available. Note that this
* does not necessarily mean that Cg is supported by the graphics card.
@@ -118,7 +143,7 @@ class NativePipeline extends Pipeline {
boolean isCgLibraryAvailable() {
return cgLibraryAvailable;
}
-
+
/**
* Returns true if the GLSL library is loaded and available. Note that this
* does not necessarily mean that GLSL is supported by the graphics card.
@@ -126,11 +151,11 @@ class NativePipeline extends Pipeline {
boolean isGLSLLibraryAvailable() {
return glslLibraryAvailable;
}
-
+
/**
* Load the specified native library.
*/
- private void loadLibrary(String libName) {
+ private static void loadLibrary(String libName) {
final String libraryName = libName;
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
@@ -140,7 +165,7 @@ class NativePipeline extends Pipeline {
}
});
}
-
+
/**
* Parse the specified System properties containing a PATH and return an
* array of Strings, where each element is an absolute filename consisting of
@@ -3313,5 +3338,5 @@ class NativePipeline extends Pipeline {
void freeDrawingSurfaceNative(Object o) {
DrawingSurfaceObjectAWT.freeDrawingSurface(o);
}
-
+
}
diff --git a/src/classes/share/javax/media/j3d/Pipeline.java b/src/classes/share/javax/media/j3d/Pipeline.java
index e33516c..dd413ef 100644
--- a/src/classes/share/javax/media/j3d/Pipeline.java
+++ b/src/classes/share/javax/media/j3d/Pipeline.java
@@ -43,6 +43,57 @@ abstract class Pipeline {
}
/**
+ * Method to check whether the native OpenGL library can and should be used
+ * on Windows. We will use D3D if OpenGL is unavailable or undesirable.
+ */
+ static boolean useNativeOgl(boolean isWindowsVista, boolean nativeOglRequested) {
+ // Get the OpenGL vendor string.
+ String vendorString = NativePipeline.getSupportedOglVendor();
+
+ // A null vendor string means OpenGL 1.2+ support unavailable.
+ if (vendorString == null) {
+ return false;
+ }
+
+ // If OGL was explicitly requested, we will use it
+ if (nativeOglRequested) {
+ return true;
+ }
+
+ // Check OS type and vendor string to see whether OGL is preferred
+ return preferOgl(isWindowsVista, vendorString);
+ }
+
+ // Returns a flag inticating whether the specified vendor prefers OpenGL.
+ private static boolean preferOgl(boolean isWindowsVista, String vendorString) {
+ // We prefer OpenGL on all Windows/XP cards
+ if (!isWindowsVista) {
+ return true;
+ }
+
+ // List of vendors for which we will prefer to use D3D on Windows Vista
+ // This must be all lower case.
+ final String[] vistaD3dList = {
+ "microsoft",
+ "ati",
+ // TODO: add the following if Intel's OpenGL driver turns out to be buggy on Vista
+ // "intel",
+ };
+ final String lcVendorString = vendorString.toLowerCase();
+
+ // If we are running on Windows Vista, we will check the vendor string
+ // against the list of vendors that prefer D3D on Vista, and return true
+ // *unless* the vendor is in that list.
+ for (int i = 0; i < vistaD3dList.length; i++) {
+ if (lcVendorString.startsWith(vistaD3dList[i])) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
* Initialize the Pipeline. Called exactly once by
* MasterControl.loadLibraries() to create the singleton
* Pipeline object.
diff --git a/src/native/ogl/OglCheck.c b/src/native/ogl/OglCheck.c
new file mode 100644
index 0000000..866612c
--- /dev/null
+++ b/src/native/ogl/OglCheck.c
@@ -0,0 +1,402 @@
+/*
+ * $RCSfile$
+ *
+ * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Use is subject to license terms.
+ *
+ * $Revision$
+ * $Date$
+ * $State$
+ */
+
+#ifdef DEBUG
+/* #define VERBOSE */
+#endif /* DEBUG */
+
+/* This entire file is Windows-only */
+#ifdef WIN32
+
+/* j3dsys.h needs to be included before any other include files to suppres VC warning */
+#include "j3dsys.h"
+
+#include <jni.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include <windows.h>
+
+#include <GL/gl.h>
+#include "wglext.h"
+#include "javax_media_j3d_NativePipeline.h"
+
+
+static void
+printErrorMessage(char *message)
+{
+ DWORD err;
+ char * errString;
+
+ err = GetLastError();
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, err, 0, (LPTSTR)&errString, 0, NULL);
+ fprintf(stderr, "Java 3D ERROR : %s - %s\n", message, errString);
+ LocalFree(errString);
+}
+
+
+/*
+ * A dummy WndProc for dummy window
+ */
+static LONG WINAPI
+WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ /* This function handles any messages that we didn't. */
+ /* (Which is most messages) It belongs to the OS. */
+ return (LONG) DefWindowProc( hWnd, msg, wParam, lParam );
+}
+
+
+static HWND
+createDummyWindow(const char* szAppName)
+{
+ static const char *szTitle = "Dummy Window";
+ WNDCLASS wc; /* windows class sruct */
+
+ HWND hWnd;
+
+ /* Fill in window class structure with parameters that */
+ /* describe the main window. */
+
+ wc.style =
+ CS_HREDRAW | CS_VREDRAW;/* Class style(s). */
+ wc.lpfnWndProc =
+ (WNDPROC)WndProc; /* Window Procedure */
+ wc.cbClsExtra = 0; /* No per-class extra data. */
+ wc.cbWndExtra = 0; /* No per-window extra data. */
+ wc.hInstance =
+ NULL; /* Owner of this class */
+ wc.hIcon = NULL; /* Icon name */
+ wc.hCursor =
+ NULL;/* Cursor */
+ wc.hbrBackground =
+ (HBRUSH)(COLOR_WINDOW+1);/* Default color */
+ wc.lpszMenuName = NULL; /* Menu from .RC */
+ wc.lpszClassName =
+ szAppName; /* Name to register as
+
+ /* Register the window class */
+
+ if(RegisterClass( &wc )==0) {
+ printErrorMessage("createDummyWindow: couldn't register class");
+ return NULL;
+ }
+
+ /* Create a main window for this application instance. */
+
+ hWnd = CreateWindow(
+ szAppName, /* app name */
+ szTitle, /* Text for window title bar */
+ WS_OVERLAPPEDWINDOW/* Window style */
+ /* NEED THESE for OpenGL calls to work!*/
+ | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
+ CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
+ NULL, /* no parent window */
+ NULL, /* Use the window class menu.*/
+ NULL, /* This instance owns this window */
+ NULL /* We don't use any extra data */
+ );
+
+ /* If window could not be created, return zero */
+ if ( !hWnd ){
+ printErrorMessage("createDummyWindow: couldn't create window");
+ UnregisterClass(szAppName, (HINSTANCE)NULL);
+ return NULL;
+ }
+ return hWnd;
+}
+
+
+static PIXELFORMATDESCRIPTOR
+getDummyPFD()
+{
+
+ /* Dummy pixel format. -- Chien */
+ static PIXELFORMATDESCRIPTOR dummy_pfd = {
+ sizeof(PIXELFORMATDESCRIPTOR),
+ 1, /* Version number */
+ PFD_DRAW_TO_WINDOW |
+ PFD_SUPPORT_OPENGL,
+ PFD_TYPE_RGBA,
+ 16, /* 16 bit color depth */
+ 0, 0, 0, /* RGB bits and pixel sizes */
+ 0, 0, 0, /* Do not care about them */
+ 0, 0, /* no alpha buffer info */
+ 0, 0, 0, 0, 0, /* no accumulation buffer */
+ 8, /* 8 bit depth buffer */
+ 0, /* no stencil buffer */
+ 0, /* no auxiliary buffers */
+ PFD_MAIN_PLANE, /* layer type */
+ 0, /* reserved, must be 0 */
+ 0, /* no layer mask */
+ 0, /* no visible mask */
+ 0 /* no damage mask */
+ };
+
+ return dummy_pfd;
+}
+
+
+static BOOL
+isSupportedWGL(const char *extensions, const char *extension_string)
+{
+ /* get the list of supported extensions */
+ const char *p = extensions;
+
+ /* search for extension_string in the list */
+ while(p = strstr(p, extension_string)){
+ const char *q = p + strlen(extension_string);
+
+ /* must be terminated by <space> or <nul> */
+ if(*q == ' ' || *q == '\0') {
+ return TRUE;
+ }
+
+ /* try to find another match */
+ p = q;
+ }
+ return FALSE;
+}
+
+
+/*
+static HDC
+getMonitorDC(int screen)
+{
+ return CreateDC("DISPLAY", NULL, NULL, NULL);
+}
+*/
+
+
+/*
+ * Extract the version numbers from a copy of the version string.
+ * Upon return, numbers[0] contains major version number
+ * numbers[1] contains minor version number
+ * Note that the passed in version string is modified.
+ */
+static void
+extractVersionInfo(char *versionStr, int* numbers)
+{
+ char *majorNumStr;
+ char *minorNumStr;
+
+ numbers[0] = numbers[1] = -1;
+ majorNumStr = strtok(versionStr, (char *)".");
+ minorNumStr = strtok(0, (char *)".");
+ if (majorNumStr != NULL)
+ numbers[0] = atoi(majorNumStr);
+ if (minorNumStr != NULL)
+ numbers[1] = atoi(minorNumStr);
+}
+
+
+/*
+ * get properties from current context
+ */
+static char*
+queryVendorString(HDC hdc, HGLRC hrc)
+{
+ char *glVersion;
+ char *tmpVersionStr;
+ int versionNumbers[2];
+ char *glVendor;
+ char *supportedExtensions;
+ PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB;
+
+ if (!wglMakeCurrent(hdc, hrc)) {
+#ifdef DEBUG
+ printErrorMessage("getSupportedOglVendorNative : Failed in wglMakeCurrent");
+#endif /* DEBUG */
+ return NULL;
+ }
+
+ wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)
+ wglGetProcAddress("wglGetExtensionsStringARB");
+ if (wglGetExtensionsStringARB == NULL) {
+#ifdef DEBUG
+ printErrorMessage("getSupportedOglVendorNative : wglGetExtensionsStringARB not supported\n");
+#endif /* DEBUG */
+ return NULL;
+ }
+
+ /* get the list of supported extensions */
+ supportedExtensions = (char *)wglGetExtensionsStringARB(hdc);
+
+#ifdef VERBOSE
+ fprintf(stderr, "WGL Supported extensions: %s\n",
+ supportedExtensions);
+#endif /* VERBOSE */
+
+ if (supportedExtensions == NULL ||
+ !isSupportedWGL(supportedExtensions, "WGL_ARB_pixel_format") ||
+ wglGetProcAddress("wglChoosePixelFormatARB") == NULL ||
+ wglGetProcAddress("wglGetPixelFormatAttribivARB") == NULL) {
+#ifdef DEBUG
+ printErrorMessage("getSupportedOglVendorNative : wglChoosePixelFormatARB/GetPixelFormatAttribivARB not supported\n");
+#endif /* DEBUG */
+ return NULL;
+ }
+
+ /* Get the OpenGL version */
+ glVersion = (char *)glGetString(GL_VERSION);
+ if (glVersion == NULL) {
+#ifdef DEBUG
+ fprintf(stderr, "JAVA 3D ERROR : glVersion == null\n");
+#endif /* DEBUG */
+ return NULL;
+ }
+
+ /* find out the version, major and minor version number */
+ tmpVersionStr = strdup(glVersion);
+ extractVersionInfo(tmpVersionStr, versionNumbers);
+ free(tmpVersionStr);
+
+#ifdef VERBOSE
+ fprintf(stderr, "GL_VERSION string = %s\n", glVersion);
+ fprintf(stderr, "GL_VERSION (major.minor) = %d.%d\n",
+ versionNumbers[0], versionNumbers[1]);
+#endif /* VERBOSE */
+
+ /*
+ * Check for OpenGL 1.2 or later.
+ */
+ if (versionNumbers[0] < 1 ||
+ (versionNumbers[0] == 1 && versionNumbers[1] < 2)) {
+#ifdef DEBUG
+ fprintf(stderr,
+ "Java 3D ERROR : OpenGL 1.2 or better is required (GL_VERSION=%d.%d)\n",
+ versionNumbers[0], versionNumbers[1]);
+#endif /* DEBUG */
+ return NULL;
+ }
+
+ /* Get the OpenGL vendor */
+ glVendor = (char *)glGetString(GL_VENDOR);
+ if (glVendor == NULL) {
+#ifdef DEBUG
+ fprintf(stderr, "JAVA 3D ERROR : glVendor == null\n");
+#endif /* DEBUG */
+ return NULL;
+ }
+
+#ifdef VERBOSE
+ fprintf(stderr, "GL_VENDOR = %s\n", glVendor);
+#endif /* VERBOSE */
+
+ return glVendor;
+}
+
+
+/*
+ * Class: javax_media_j3d_NativePipeline
+ * Method: getSupportedOglVendorNative
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_javax_media_j3d_NativePipeline_getSupportedOglVendorNative(
+ JNIEnv *env,
+ jclass clazz)
+{
+ static char szAppName[] = "OglCheck";
+
+ static int wglAttrs[] = {
+ WGL_SUPPORT_OPENGL_ARB,
+ TRUE,
+ WGL_ACCELERATION_ARB,
+ WGL_FULL_ACCELERATION_ARB,
+ WGL_DRAW_TO_WINDOW_ARB,
+ TRUE,
+ WGL_RED_BITS_ARB,
+ 4,
+ WGL_GREEN_BITS_ARB,
+ 4,
+ WGL_BLUE_BITS_ARB,
+ 4,
+ WGL_DEPTH_BITS_ARB,
+ 16,
+ };
+
+ HWND hwnd;
+ HGLRC hrc;
+ HDC hdc;
+ int pixelFormat;
+ PIXELFORMATDESCRIPTOR dummy_pfd = getDummyPFD();
+ char *glVendor = NULL;
+ jstring glVendorString = NULL;
+
+ JNIEnv table = *env;
+
+#ifdef VERBOSE
+ fprintf(stderr, "NativePipeline.getSupportedOglVendorNative()\n");
+#endif /* VERBOSE */
+
+ /*
+ * Select any pixel format and bound current context to
+ * it so that we can get the wglChoosePixelFormatARB entry point.
+ * Otherwise wglxxx entry point will always return null.
+ * That's why we need to create a dummy window also.
+ */
+ hwnd = createDummyWindow((const char *)szAppName);
+
+ if (!hwnd) {
+ return NULL;
+ }
+ hdc = GetDC(hwnd);
+
+ pixelFormat = ChoosePixelFormat(hdc, &dummy_pfd);
+
+ if (pixelFormat<1) {
+#ifdef DEBUG
+ printErrorMessage("getSupportedOglVendorNative : Failed in ChoosePixelFormat");
+#endif /* DEBUG */
+ DestroyWindow(hwnd);
+ UnregisterClass(szAppName, (HINSTANCE)NULL);
+ return NULL;
+ }
+
+ if (!SetPixelFormat(hdc, pixelFormat, NULL)) {
+#ifdef DEBUG
+ printErrorMessage("getSupportedOglVendorNative : Failed in SetPixelFormat");
+#endif /* DEBUG */
+ DestroyWindow(hwnd);
+ UnregisterClass(szAppName, (HINSTANCE)NULL);
+ return NULL;
+ }
+
+ hrc = wglCreateContext(hdc);
+ if (!hrc) {
+#ifdef DEBUG
+ printErrorMessage("getSupportedOglVendorNative : Failed in wglCreateContext");
+#endif /* DEBUG */
+ DestroyWindow(hwnd);
+ UnregisterClass(szAppName, (HINSTANCE)NULL);
+ return NULL;
+ }
+
+ /* Check OpenGL extensions & version, and return vendor string */
+ glVendor = queryVendorString(hdc, hrc);
+ if (glVendor != NULL) {
+ glVendorString = table->NewStringUTF(env, glVendor);
+ }
+
+ /* Destroy all dummy objects */
+ ReleaseDC(hwnd, hdc);
+ wglDeleteContext(hrc);
+ DestroyWindow(hwnd);
+ UnregisterClass(szAppName, (HINSTANCE)NULL);
+
+ return glVendorString;
+}
+
+#endif /* WIN32 */
diff --git a/src/native/ogl/build-windows-i586-gcc.xml b/src/native/ogl/build-windows-i586-gcc.xml
index 8cc5edd..4a931f9 100644
--- a/src/native/ogl/build-windows-i586-gcc.xml
+++ b/src/native/ogl/build-windows-i586-gcc.xml
@@ -48,21 +48,34 @@
<property name="oglsrc" location="${src}/native/ogl"/>
- <!-- Compile the c source files-->
<!-- Inhibit all warning for native build. Remove -w to switch warning on -->
+ <!-- Compile the c source files for the core ogl library -->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
<arg line="-w -D_WINGDI_ -D_JNI_IMPLEMENTATION_ -I&quot;${oglsrc}&quot; -I&quot;${javaInclude}&quot; -I&quot;${javaWin32Include}&quot; -I&quot;${javahCoreTarget}&quot; ${bldFlag} -c &quot;${oglsrc}/DrawingSurfaceObjectAWT.c&quot; &quot;${oglsrc}/Canvas3D.c&quot; &quot;${oglsrc}/GraphicsContext3D.c&quot; &quot;${oglsrc}/NativeScreenInfo.c&quot; &quot;${oglsrc}/NativeConfigTemplate3D.c&quot; &quot;${oglsrc}/MasterControl.c&quot; &quot;${oglsrc}/GeometryArrayRetained.c&quot; &quot;${oglsrc}/Attributes.c&quot; &quot;${oglsrc}/CgShaderProgram.c&quot; &quot;${oglsrc}/GLSLShaderProgram.c&quot; &quot;${oglsrc}/Lights.c&quot;"/>
</exec>
- <!-- Create the library file-->
+ <!-- Create the core ogl library file-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
<arg line="-shared -o j3dcore-ogl.dll DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o -Wl,--kill-at -L&quot;${java.home}\..\lib&quot; -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lopengl32 -ljawt"/>
</exec>
- <!-- Copy the copyright library file -->
- <copy file="${build}/${platform}/${bldType}/native/ogl/objs/j3dcore-ogl.dll"
- todir="${build}/${platform}/${bldType}/bin"/>
+ <!-- Compile the c source files for the ogl-chk library -->
+ <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
+ <arg line="-w -D_WINGDI_ -D_JNI_IMPLEMENTATION_ -I&quot;${oglsrc}&quot; -I&quot;${javaInclude}&quot; -I&quot;${javaWin32Include}&quot; -I&quot;${javahCoreTarget}&quot; ${bldFlag} -c &quot;${oglsrc}/OglCheck.c&quot;"/>
+ </exec>
+
+ <!-- Create the ogl-chk library file-->
+ <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
+ <arg line="-shared -o j3dcore-ogl-chk.dll OglCheck.o -Wl,--kill-at -L&quot;${java.home}\..\lib&quot; -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lopengl32"/>
+ </exec>
+
+ <!-- Copy the library files -->
+ <copy todir="${build}/${platform}/${bldType}/bin">
+ <fileset dir="${build}/${platform}/${bldType}/native/ogl/objs"
+ includes="j3dcore-ogl*.dll"
+ />
+ </copy>
</target>
diff --git a/src/native/ogl/build-windows-i586-vc.xml b/src/native/ogl/build-windows-i586-vc.xml
index 9276c72..52e6957 100644
--- a/src/native/ogl/build-windows-i586-vc.xml
+++ b/src/native/ogl/build-windows-i586-vc.xml
@@ -53,16 +53,26 @@
</target>
<target name="compile-ogl">
- <!-- Compile the c source files-->
+ <!-- Compile the c source files for the core ogl library -->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="cl">
<arg line="-I&quot;${oglsrc}&quot; -I&quot;${javaInclude}&quot; -I&quot;${javaWin32Include}&quot; -I&quot;${javahCoreTarget}&quot; -I&quot;${cg.home}\include&quot; -nologo -MT -W3 -EHsc -O2 -FD ${bldFlag} ${cflags.cg} -c &quot;${oglsrc}/DrawingSurfaceObjectAWT.c&quot; &quot;${oglsrc}/Canvas3D.c&quot; &quot;${oglsrc}/GraphicsContext3D.c&quot; &quot;${oglsrc}/NativeScreenInfo.c&quot; &quot;${oglsrc}/NativeConfigTemplate3D.c&quot; &quot;${oglsrc}/MasterControl.c&quot; &quot;${oglsrc}/GeometryArrayRetained.c&quot; &quot;${oglsrc}/Attributes.c&quot; &quot;${oglsrc}/CgShaderProgram.c&quot; &quot;${oglsrc}/GLSLShaderProgram.c&quot; &quot;${oglsrc}/Lights.c&quot;"/>
</exec>
- <!-- Create the library file-->
+ <!-- Create the core ogl library file-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="link">
<arg line="-nologo -dll -subsystem:windows -machine:I386 -out:j3dcore-ogl.dll DrawingSurfaceObjectAWT.obj Canvas3D.obj GraphicsContext3D.obj NativeScreenInfo.obj NativeConfigTemplate3D.obj MasterControl.obj GeometryArrayRetained.obj Attributes.obj CgShaderProgram.obj GLSLShaderProgram.obj Lights.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib delayimp.lib -DELAYLOAD:jawt.dll -LIBPATH:&quot;${java.home}\..\lib&quot; jawt.lib"/>
</exec>
+ <!-- Compile the c source files for the ogl-chk library -->
+ <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="cl">
+ <arg line="-I&quot;${oglsrc}&quot; -I&quot;${javaInclude}&quot; -I&quot;${javaWin32Include}&quot; -I&quot;${javahCoreTarget}&quot; -nologo -MT -W3 -EHsc -O2 -FD ${bldFlag} -c &quot;${oglsrc}/OglCheck.c&quot; "/>
+ </exec>
+
+ <!-- Create the ogl-chk library file-->
+ <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="link">
+ <arg line="-nologo -dll -subsystem:windows -machine:I386 -out:j3dcore-ogl-chk.dll OglCheck.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib delayimp.lib"/>
+ </exec>
+
</target>
@@ -83,7 +93,7 @@
<target name="compile" depends="init,compile-ogl,compile-ogl-cg">
- <!-- Copy the library file -->
+ <!-- Copy the library files -->
<copy todir="${build}/${platform}/${bldType}/bin">
<fileset dir="${build}/${platform}/${bldType}/native/ogl/objs"
includes="j3dcore-ogl*.dll"