aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/linux
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/linux
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/linux')
-rw-r--r--src/classes/linux/javax/media/j3d/J3dGraphicsConfig.java44
-rw-r--r--src/classes/linux/javax/media/j3d/NativeConfigTemplate3D.java295
-rw-r--r--src/classes/linux/javax/media/j3d/NativeScreenInfo.java78
-rw-r--r--src/classes/linux/javax/media/j3d/NativeWSInfo.java64
4 files changed, 0 insertions, 481 deletions
diff --git a/src/classes/linux/javax/media/j3d/J3dGraphicsConfig.java b/src/classes/linux/javax/media/j3d/J3dGraphicsConfig.java
deleted file mode 100644
index 41673f2..0000000
--- a/src/classes/linux/javax/media/j3d/J3dGraphicsConfig.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * $RCSfile$
- *
- * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
- *
- * Use is subject to license terms.
- *
- * $Revision$
- * $Date$
- * $State$
- */
-
-/*
- * Portions of this code were derived from work done by the Blackdown
- * group (www.blackdown.org), who did the initial Linux implementation
- * of the Java 3D API.
- */
-
-package javax.media.j3d;
-
-import sun.awt.*;
-import java.awt.*;
-
-class J3dGraphicsConfig {
-
- static native boolean isValidVisualID(long display, int vid);
-
- J3dGraphicsConfig(GraphicsDevice gd, int pixelFormat) {
- // a dummy class which this constructor should
- // never invoke under Linux
- }
-
- static boolean isValidPixelFormat(GraphicsConfiguration gc) {
- return isValidVisualID(NativeScreenInfo.getStaticDisplay(),
- ((X11GraphicsConfig) gc).getVisual());
- }
-
- static boolean isValidConfig(GraphicsConfiguration gc) {
- // Check to see if a valid FBConfig pointer has been cached.
- Object fbConfigObject = Canvas3D.fbConfigTable.get(gc);
- return ((fbConfigObject != null) &&
- (fbConfigObject instanceof GraphicsConfigInfo));
- }
-}
diff --git a/src/classes/linux/javax/media/j3d/NativeConfigTemplate3D.java b/src/classes/linux/javax/media/j3d/NativeConfigTemplate3D.java
deleted file mode 100644
index 9f1059c..0000000
--- a/src/classes/linux/javax/media/j3d/NativeConfigTemplate3D.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * $RCSfile$
- *
- * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
- *
- * Use is subject to license terms.
- *
- * $Revision$
- * $Date$
- * $State$
- */
-
-/*
- * Portions of this code were derived from work done by the Blackdown
- * group (www.blackdown.org), who did the initial Linux implementation
- * of the Java 3D API.
- */
-
-package javax.media.j3d;
-
-import java.awt.GraphicsDevice;
-import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsConfigTemplate;
-import java.awt.Rectangle;
-import sun.awt.X11GraphicsDevice;
-import sun.awt.X11GraphicsConfig;
-
-class NativeConfigTemplate3D {
- private final static boolean debug = false;
-
- NativeConfigTemplate3D() {
- }
-
- /*
- * This definition should match those in win32 NativeConfigTemplate3D.java
- */
- final static int RED_SIZE = 0;
- final static int GREEN_SIZE = 1;
- final static int BLUE_SIZE = 2;
- final static int ALPHA_SIZE = 3;
- final static int ACCUM_BUFFER = 4;
- final static int DEPTH_SIZE = 5;
- final static int DOUBLEBUFFER = 6;
- final static int STEREO = 7;
- final static int ANTIALIASING = 8;
- final static int STENCIL_SIZE = 9;
- final static int NUM_ITEMS = 10;
-
- // Native method to get an OpenGL visual id and a pointer to the
- // GLXFBConfig structure list itself.
- native int chooseOglVisual(long display, int screen,
- int[] attrList, long[] fbConfig);
-
- // Native method to free an GLXFBConfig struct. This is static since it
- // may need to be called to clean up the Canvas3D fbConfigTable after the
- // NativeConfigTemplate3D has been disposed of.
- static native void freeFBConfig(long fbConfig);
-
- // Native methods to return whether a particular attribute is available
- native boolean isStereoAvailable(long display, int screen, int vid);
- native boolean isDoubleBufferAvailable(long display, int screen, int vid);
- native boolean isSceneAntialiasingAccumAvailable(long display, int screen, int vid);
- native boolean isSceneAntialiasingMultisampleAvailable(long display, int screen, int vid);
- native int getStencilSize(long display, int screen, int vid);
-
-
- /*
- * Chooses the best FBConfig for Java 3D apps.
- */
- GraphicsConfiguration
- getBestConfiguration(GraphicsConfigTemplate3D template,
- GraphicsConfiguration[] gc) {
-
- X11GraphicsDevice gd =
- (X11GraphicsDevice)((X11GraphicsConfig)gc[0]).getDevice();
-
- if (!NativeScreenInfo.isGLX13()) {
- return null;
- }
-
- NativeScreenInfo nativeScreenInfo = new NativeScreenInfo(gd);
-
- long display = nativeScreenInfo.getDisplay();
- int screen = nativeScreenInfo.getScreen();
-
- if (debug) {
- System.out.println(" NativeConfigTemplate3D: using device " + gd);
- System.out.println(" display " + display + " screen " + screen);
- System.out.println(" configuration count: " + gc.length);
- for (int i = 0 ; i < gc.length ; i++) {
- System.out.println(" visual id at index " + i + ": " +
- ((X11GraphicsConfig)gc[i]).getVisual());
- }
- }
-
- Rectangle bounds = gc[0].getBounds();
- if ((bounds.x != 0 || bounds.y != 0) &&
- (! VirtualUniverse.mc.xineramaDisabled)) {
- // Xinerama is being used. The screen needs to be set to 0 since
- // glxChooseFBConfig will not return a valid visual otherwise.
- screen = 0;
- if (debug) {
- System.out.println(" Non-primary Xinerama screen:");
- System.out.println(" bounds = " + bounds);
- System.out.println(" using screen 0 visual");
- }
- }
-
- int[] attrList; // holds the list of attributes to be translated
- // for glxChooseFBConfig call
-
- attrList = new int[NUM_ITEMS];
-
- // assign template values to array
- attrList[RED_SIZE] = template.getRedSize();
- attrList[GREEN_SIZE] = template.getGreenSize();
- attrList[BLUE_SIZE] = template.getBlueSize();
-
- attrList[DEPTH_SIZE] = template.getDepthSize();
- attrList[DOUBLEBUFFER] = template.getDoubleBuffer();
- attrList[STEREO] = template.getStereo();
- attrList[ANTIALIASING] = template.getSceneAntialiasing();
- attrList[STENCIL_SIZE] = template.getStencilSize();
- // System.out.println("NativeConfigTemplate3D : getStencilSize " +
- // attrList[STENCIL_SIZE]);
-
- long[] fbConfig = new long[1];
- int visID = chooseOglVisual(display, screen, attrList, fbConfig);
- if (debug) {
- System.out.println(" chooseOglVisual() returns " + visID);
- System.out.println(" pointer to GLXFBConfig is " + fbConfig[0]);
- System.out.println();
- }
-
- if (visID == 0 || fbConfig[0] == 0) {
- return null; // no valid visual was found
- }
-
- // search list of graphics configurations for config
- // with matching visualId
- GraphicsConfiguration gc1 = null;
- for (int i = 0; i < gc.length; i++)
- if (((X11GraphicsConfig)gc[i]).getVisual() == visID) {
- gc1 = gc[i];
- break;
- }
-
- // TODO: This may or may not be needed for Linux
- // To support disabling Solaris OpenGL Xinerama mode, we need to cache
- // the pointer to the actual GLXFBConfig that glXChooseFBConfig()
- // returns, since this is not cached with X11GraphicsConfig 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(fbConfig[0]);
- gcInfo.setRequestedStencilSize(attrList[STENCIL_SIZE]);
- Canvas3D.fbConfigTable.put(gc1, gcInfo);
- } else {
- freeFBConfig(fbConfig[0]);
- }
- }
-
- return gc1;
- }
-
- /*
- * Determine if a given GraphicsConfiguration object can be used
- * by Java 3D.
- */
- boolean isGraphicsConfigSupported(GraphicsConfigTemplate3D template,
- GraphicsConfiguration gc) {
-
- X11GraphicsDevice gd =
- (X11GraphicsDevice)((X11GraphicsConfig)gc).getDevice();
-
- if (!NativeScreenInfo.isGLX13()) {
- return false;
- }
-
- NativeScreenInfo nativeScreenInfo = new NativeScreenInfo(gd);
-
- long display = nativeScreenInfo.getDisplay();
- int screen = nativeScreenInfo.getScreen();
-
- int[] attrList; // holds the list of attributes to be tramslated
- // for glxChooseVisual call
-
- attrList = new int[NUM_ITEMS];
-
- // assign template values to array
- attrList[RED_SIZE] = template.getRedSize();
- attrList[GREEN_SIZE] = template.getGreenSize();
- attrList[BLUE_SIZE] = template.getBlueSize();
-
- attrList[DEPTH_SIZE] = template.getDepthSize();
- attrList[DOUBLEBUFFER] = template.getDoubleBuffer();
- attrList[STEREO] = template.getStereo();
- attrList[ANTIALIASING] = template.getSceneAntialiasing();
- attrList[STENCIL_SIZE] = template.getStencilSize();
- // System.out.println("NativeConfigTemplate3D : getStencilSize " +
- // attrList[STENCIL_SIZE]);
-
- long[] fbConfig = new long[1];
- int visID = chooseOglVisual(display, screen, attrList, fbConfig);
-
- if (visID == 0 || fbConfig[0] == 0)
- return false; // no valid visual was found
- else
- return true;
- }
-
-
- // Return whether stereo is available.
- boolean hasStereo(Canvas3D c3d) {
- GraphicsConfiguration gc = c3d.graphicsConfiguration;
-
- X11GraphicsDevice gd =
- (X11GraphicsDevice)((X11GraphicsConfig)gc).getDevice();
- NativeScreenInfo nativeScreenInfo = new NativeScreenInfo(gd);
-
- long display = nativeScreenInfo.getDisplay();
- int screen = nativeScreenInfo.getScreen();
- int vid = ((X11GraphicsConfig)gc).getVisual();
-
- return isStereoAvailable(display, screen, vid);
- }
-
-
- // Return the stencil of this canvas.
- int getStencilSize(Canvas3D c3d) {
- GraphicsConfiguration gc = c3d.graphicsConfiguration;
-
- X11GraphicsDevice gd =
- (X11GraphicsDevice)((X11GraphicsConfig)gc).getDevice();
- NativeScreenInfo nativeScreenInfo = new NativeScreenInfo(gd);
-
- long display = nativeScreenInfo.getDisplay();
- int screen = nativeScreenInfo.getScreen();
- int vid = ((X11GraphicsConfig)gc).getVisual();
-
- return getStencilSize(display, screen, vid);
- }
-
- // Return whether a double buffer is available.
- boolean hasDoubleBuffer(Canvas3D c3d) {
- GraphicsConfiguration gc = c3d.graphicsConfiguration;
-
- X11GraphicsDevice gd =
- (X11GraphicsDevice)((X11GraphicsConfig)gc).getDevice();
- NativeScreenInfo nativeScreenInfo = new NativeScreenInfo(gd);
-
- long display = nativeScreenInfo.getDisplay();
- int screen = nativeScreenInfo.getScreen();
- int vid = ((X11GraphicsConfig)gc).getVisual();
-
- return isDoubleBufferAvailable(display, screen, vid);
- }
-
- // Return whether scene antialiasing is available.
- boolean hasSceneAntialiasingAccum(Canvas3D c3d) {
- GraphicsConfiguration gc = c3d.graphicsConfiguration;
-
- X11GraphicsDevice gd =
- (X11GraphicsDevice)((X11GraphicsConfig)gc).getDevice();
- NativeScreenInfo nativeScreenInfo = new NativeScreenInfo(gd);
-
- long display = nativeScreenInfo.getDisplay();
- int screen = nativeScreenInfo.getScreen();
- int vid = ((X11GraphicsConfig)gc).getVisual();
-
- return isSceneAntialiasingAccumAvailable(display, screen, vid);
- }
-
-
- // Return whether scene antialiasing is available.
- boolean hasSceneAntialiasingMultisample(Canvas3D c3d) {
- GraphicsConfiguration gc = c3d.graphicsConfiguration;
-
- X11GraphicsDevice gd =
- (X11GraphicsDevice)((X11GraphicsConfig)gc).getDevice();
- NativeScreenInfo nativeScreenInfo = new NativeScreenInfo(gd);
-
- long display = nativeScreenInfo.getDisplay();
- int screen = nativeScreenInfo.getScreen();
- int vid = ((X11GraphicsConfig)gc).getVisual();
-
- return isSceneAntialiasingMultisampleAvailable(display, screen, vid);
- }
-
- // Ensure that the native libraries are loaded
- static {
- VirtualUniverse.loadLibraries();
- }
-}
diff --git a/src/classes/linux/javax/media/j3d/NativeScreenInfo.java b/src/classes/linux/javax/media/j3d/NativeScreenInfo.java
deleted file mode 100644
index cbf44fe..0000000
--- a/src/classes/linux/javax/media/j3d/NativeScreenInfo.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * $RCSfile$
- *
- * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
- *
- * Use is subject to license terms.
- *
- * $Revision$
- * $Date$
- * $State$
- */
-
-/*
- * Portions of this code were derived from work done by the Blackdown
- * group (www.blackdown.org), who did the initial Linux implementation
- * of the Java 3D API.
- */
-
-package javax.media.j3d;
-
-import java.awt.GraphicsDevice;
-import sun.awt.X11GraphicsDevice;
-
-class NativeScreenInfo {
- private int screen;
- private static long display = 0;
- private static boolean glxChecked = false;
- private static boolean isGLX13;
-
- private native static long openDisplay();
- private native static int getDefaultScreen(long display);
- private native static boolean queryGLX13(long display);
-
- // Fix for issue 20.
- // This method will return true if glx version is 1.3 or higher,
- // else return false.
- synchronized static boolean isGLX13() {
- if (!glxChecked) {
- // Open a new static display connection if one is not already opened.
- getStaticDisplay();
- // Query for glx1.3 support.
- isGLX13 = queryGLX13(display);
- glxChecked = true;
- }
-
- return isGLX13;
- }
-
-
- synchronized static long getStaticDisplay() {
- if (display == 0) {
- display = openDisplay();
- }
- return display;
- }
-
- NativeScreenInfo(GraphicsDevice graphicsDevice) {
- // Open a new static display connection if one is not already opened
- getStaticDisplay();
-
- // Get the screen number
- screen = ((X11GraphicsDevice)graphicsDevice).getScreen();
- }
-
- long getDisplay() {
- return display;
- }
-
- int getScreen() {
- return screen;
- }
-
-
- // Ensure that the native libraries are loaded
- static {
- VirtualUniverse.loadLibraries();
- }
-}
diff --git a/src/classes/linux/javax/media/j3d/NativeWSInfo.java b/src/classes/linux/javax/media/j3d/NativeWSInfo.java
deleted file mode 100644
index 894f2a8..0000000
--- a/src/classes/linux/javax/media/j3d/NativeWSInfo.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * $RCSfile$
- *
- * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
- *
- * Use is subject to license terms.
- *
- * $Revision$
- * $Date$
- * $State$
- */
-
-/*
- * Portions of this code were derived from work done by the Blackdown
- * group (www.blackdown.org), who did the initial Linux implementation
- * of the Java 3D API.
- */
-
-package javax.media.j3d;
-
-import java.awt.*;
-import java.awt.event.*;
-import sun.awt.*;
-import java.lang.reflect.Method;
-
-class NativeWSInfo {
-
- //X11DrawingSurface xds;
- Object xds;
-
- void getCanvasWSParameters(Canvas3D canvas) {
- try {
- Class x11DSclass = Class.forName("sun.awt.X11DrawingSurface");
- Method getDrawable = x11DSclass.getDeclaredMethod("getDrawable", null );
- Method getVisualID = x11DSclass.getDeclaredMethod("getVisualID", null );
-
- //canvas.window = xds.getDrawable();
- //canvas.vid = xds.getVisualID();
-
- canvas.window = ((Integer)getDrawable.invoke( xds, null )).intValue();
- canvas.vid = ((Integer)getVisualID.invoke( xds, null )).intValue();
- } catch( Exception e ) {
- e.printStackTrace();
- }
- }
-
- void getWSDrawingSurface( Object dsi) {
- try {
- //xds = (X11DrawingSurface)dsi.getSurface();
- Class drawingSurfaceInfoClass = Class.forName("sun.awt.DrawingSurfaceInfo");
- Method getSurface = drawingSurfaceInfoClass.getDeclaredMethod( "getSurface", null);
-
- //xds = dsi.getSurface();
- xds = getSurface.invoke( dsi, null );
- } catch( Exception e ) {
- e.printStackTrace();
- }
- }
-
- int getCanvasVid(GraphicsConfiguration gcfg) {
- return (((X11GraphicsConfig)gcfg).getVisual());
- }
-}
-