aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/win32/javax/media
diff options
context:
space:
mode:
authorKevin Rushforth <[email protected]>2006-09-29 18:04:13 +0000
committerKevin Rushforth <[email protected]>2006-09-29 18:04:13 +0000
commit908d0fbb2ea26226165cd42f12abf0d27e4a3f53 (patch)
tree0258d2293efab8f4eafba39a528a3d2eedd0c3cb /src/classes/win32/javax/media
parent0661a22dd9278b20856b13b08ff22d248119cf6b (diff)
Merged dev-1_5 branch back to MAIN trunk
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@701 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/classes/win32/javax/media')
-rw-r--r--src/classes/win32/javax/media/j3d/J3dGraphicsConfig.java41
-rw-r--r--src/classes/win32/javax/media/j3d/NativeConfigTemplate3D.java32
-rw-r--r--src/classes/win32/javax/media/j3d/NativeScreenInfo.java25
-rw-r--r--src/classes/win32/javax/media/j3d/NativeWSInfo.java69
4 files changed, 24 insertions, 143 deletions
diff --git a/src/classes/win32/javax/media/j3d/J3dGraphicsConfig.java b/src/classes/win32/javax/media/j3d/J3dGraphicsConfig.java
deleted file mode 100644
index 72340e5..0000000
--- a/src/classes/win32/javax/media/j3d/J3dGraphicsConfig.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * $RCSfile$
- *
- * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
- *
- * Use is subject to license terms.
- *
- * $Revision$
- * $Date$
- * $State$
- */
-
-package javax.media.j3d;
-
-import sun.awt.Win32GraphicsConfig;
-import java.awt.*;
-
-class J3dGraphicsConfig extends Win32GraphicsConfig {
-
- private int pixelFormat;
-
- J3dGraphicsConfig(GraphicsDevice gd, int pixelFormat)
- {
- super(gd, pixelFormat);
- this.pixelFormat = pixelFormat;
- }
-
- static boolean isValidPixelFormat(GraphicsConfiguration gc) {
- return (gc instanceof J3dGraphicsConfig);
- }
-
- static boolean isValidConfig(GraphicsConfiguration gc) {
- return isValidPixelFormat(gc);
- }
-
- int getPixelFormat() {
- return pixelFormat;
- }
-
-
-}
diff --git a/src/classes/win32/javax/media/j3d/NativeConfigTemplate3D.java b/src/classes/win32/javax/media/j3d/NativeConfigTemplate3D.java
index 7253c5a..c198e31 100644
--- a/src/classes/win32/javax/media/j3d/NativeConfigTemplate3D.java
+++ b/src/classes/win32/javax/media/j3d/NativeConfigTemplate3D.java
@@ -44,7 +44,7 @@ class NativeConfigTemplate3D {
choosePixelFormat(long ctx, int screen, int[] attrList, long[] pFormatInfo);
// Native method to free an PixelFormatInfo struct. This is static since it
- // may need to be called to clean up the Canvas3D fbConfigTable after the
+ // may need to be called to clean up the Canvas3D graphicsConfigTable after the
// NativeConfigTemplate3D has been disposed of.
static native void freePixelFormatInfo(long pFormatInfo);
@@ -91,8 +91,8 @@ class NativeConfigTemplate3D {
attrList[STENCIL_SIZE] = template.getStencilSize();
// System.out.println("NativeConfigTemplate3D : getStencilSize " +
// attrList[STENCIL_SIZE]);
- NativeScreenInfo nativeScreenInfo = new NativeScreenInfo(gd);
- int screen = nativeScreenInfo.getScreen();
+
+ int screen = NativeScreenInfo.getScreen(gd);
long[] pFormatInfo = new long[1];
@@ -118,17 +118,15 @@ class NativeConfigTemplate3D {
// Fix to issue 104 --
// Pass in 0 for pixel format to the AWT.
// ATI driver will lockup pixelFormat, if it is passed to AWT.
- GraphicsConfiguration gc1 = new J3dGraphicsConfig(gd, 0);
-
- // We need to cache the offScreen pixelformat that glXChoosePixelFormat()
- // returns, since this is not cached with J3dGraphicsConfig and there
- // are no public constructors to allow us to extend it.
- synchronized (Canvas3D.fbConfigTable) {
- if (Canvas3D.fbConfigTable.get(gc1) == null) {
- GraphicsConfigInfo gcInfo = new GraphicsConfigInfo();
- gcInfo.setFBConfig(pFormatInfo[0]);
- gcInfo.setRequestedStencilSize(attrList[STENCIL_SIZE]);
- Canvas3D.fbConfigTable.put(gc1, gcInfo);
+ GraphicsConfiguration gc1 = Win32GraphicsConfig.getConfig(gd, 0);
+
+ // We need to cache the GraphicsTemplate3D and the private
+ // pixel format info.
+ synchronized (Canvas3D.graphicsConfigTable) {
+ if (Canvas3D.graphicsConfigTable.get(gc1) == null) {
+ GraphicsConfigInfo gcInfo = new GraphicsConfigInfo(template);
+ gcInfo.setPrivateData(new Long(pFormatInfo[0]));
+ Canvas3D.graphicsConfigTable.put(gc1, gcInfo);
} else {
freePixelFormatInfo(pFormatInfo[0]);
}
@@ -174,8 +172,7 @@ class NativeConfigTemplate3D {
// System.out.println("NativeConfigTemplate3D : getStencilSize " +
// attrList[STENCIL_SIZE]);
- NativeScreenInfo nativeScreenInfo = new NativeScreenInfo(gd);
- int screen = nativeScreenInfo.getScreen();
+ int screen = NativeScreenInfo.getScreen(gd);
long[] pFormatInfo = new long[1];
@@ -220,8 +217,7 @@ class NativeConfigTemplate3D {
Win32GraphicsDevice gd =
(Win32GraphicsDevice)((Win32GraphicsConfig)gc).getDevice();
- NativeScreenInfo nativeScreenInfo = new NativeScreenInfo(gd);
- int screen = nativeScreenInfo.getScreen();
+ int screen = NativeScreenInfo.getScreen(gd);
/* Fix to issue 77 */
return isSceneAntialiasingMultisampleAvailable(c3d.fbConfig, c3d.offScreen, screen);
}
diff --git a/src/classes/win32/javax/media/j3d/NativeScreenInfo.java b/src/classes/win32/javax/media/j3d/NativeScreenInfo.java
index 2156b8f..9652b7a 100644
--- a/src/classes/win32/javax/media/j3d/NativeScreenInfo.java
+++ b/src/classes/win32/javax/media/j3d/NativeScreenInfo.java
@@ -16,18 +16,20 @@ import java.awt.GraphicsDevice;
import sun.awt.Win32GraphicsDevice;
class NativeScreenInfo {
- private int display = 0;
- private int screen = 0;
-
+ private static final long display = 0; // unused for Win32
private static boolean wglARBChecked = false;
private static boolean isWglARB;
- private native static boolean queryWglARB();
+ private static native boolean queryWglARB();
+
+ private NativeScreenInfo() {
+ throw new AssertionError("constructor should never be called");
+ }
// This method will return true if wglGetExtensionsStringARB is supported,
// else return false
- synchronized static boolean isWglARB() {
+ static synchronized boolean isWglARB() {
if (!wglARBChecked) {
// Query for wglGetExtensionsStringARB support.
@@ -37,21 +39,14 @@ class NativeScreenInfo {
return isWglARB;
}
- NativeScreenInfo(GraphicsDevice graphicsDevice) {
- // Get the screen number
- screen = ((sun.awt.Win32GraphicsDevice)graphicsDevice).getScreen();
- display = screen;
- }
-
- int getDisplay() {
+ static long getDisplay() {
return display;
}
- int getScreen() {
- return screen;
+ static int getScreen(GraphicsDevice graphicsDevice) {
+ return ((Win32GraphicsDevice)graphicsDevice).getScreen();
}
-
// Ensure that the native libraries are loaded
static {
VirtualUniverse.loadLibraries();
diff --git a/src/classes/win32/javax/media/j3d/NativeWSInfo.java b/src/classes/win32/javax/media/j3d/NativeWSInfo.java
deleted file mode 100644
index aca9c26..0000000
--- a/src/classes/win32/javax/media/j3d/NativeWSInfo.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * $RCSfile$
- *
- * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
- *
- * Use is subject to license terms.
- *
- * $Revision$
- * $Date$
- * $State$
- */
-
-package javax.media.j3d;
-
-import java.awt.*;
-import java.awt.event.*;
-import sun.awt.*;
-import java.lang.reflect.Method;
-
-class NativeWSInfo {
-
- //Win32DrawingSurface wds;
- Object wds;
-
- void getCanvasWSParameters(Canvas3D canvas) {
- //canvas.window = wds.getHDC();
- try {
- Class win32DSclass = Class.forName("sun.awt.Win32DrawingSurface");
- Method getHDC = win32DSclass.getDeclaredMethod("getHDC", null );
-
- canvas.window = ((Integer)getHDC.invoke( wds, null )).intValue();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- void getWSDrawingSurface(Object dsi) {
- //wds = (Win32DrawingSurface)dsi.getSurface();
- int hwnd =0;
-
- try {
- Class drawingSurfaceInfoClass = Class.forName("sun.awt.DrawingSurfaceInfo");
- Method getSurface = drawingSurfaceInfoClass.getDeclaredMethod( "getSurface", null);
-
- wds = getSurface.invoke( dsi, null );
-
- Class win32DSclass = Class.forName("sun.awt.Win32DrawingSurface");
- Method getHWnd = win32DSclass.getDeclaredMethod("getHWnd", null );
- hwnd = ((Integer)getHWnd.invoke( wds, null )).intValue();
- } catch( Exception e ) {
- e.printStackTrace();
- }
-
- // note: dsi lock is called from the caller of this method
- // Workaround for bug 4169320
- //dsi.lock();
- //subclass(wds.getHWnd());
- subclass(hwnd);
- //dsi.unlock();
- }
-
- // Used in workaround for bug 4169320: Resizing a Java 3D canvas
- // on Win95 crashes the application
- private native void subclass(int hWnd);
-
- int getCanvasVid(GraphicsConfiguration gcfg) {
- return ((J3dGraphicsConfig) gcfg).getPixelFormat();
- }
-}