diff options
author | Kevin Rushforth <[email protected]> | 2005-10-17 22:56:23 +0000 |
---|---|---|
committer | Kevin Rushforth <[email protected]> | 2005-10-17 22:56:23 +0000 |
commit | 356bbf2bd325380e16fd77d34fffd084dc1c0928 (patch) | |
tree | 1d67b61e1a427baa49047341ee825bca9b423553 /src/classes/solaris | |
parent | 68449b2071392af151a75f90610026465c426401 (diff) |
Merged changes from dev-1_4 branch into the main trunk.
NOTE: all 1.4 development will now proceed on the main trunk. The dev-1_4 branch is closed.
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@445 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/classes/solaris')
-rw-r--r-- | src/classes/solaris/javax/media/j3d/J3dGraphicsConfig.java | 5 | ||||
-rw-r--r-- | src/classes/solaris/javax/media/j3d/NativeConfigTemplate3D.java | 43 |
2 files changed, 36 insertions, 12 deletions
diff --git a/src/classes/solaris/javax/media/j3d/J3dGraphicsConfig.java b/src/classes/solaris/javax/media/j3d/J3dGraphicsConfig.java index ab4f06d..855271b 100644 --- a/src/classes/solaris/javax/media/j3d/J3dGraphicsConfig.java +++ b/src/classes/solaris/javax/media/j3d/J3dGraphicsConfig.java @@ -30,11 +30,10 @@ class J3dGraphicsConfig { } static boolean isValidConfig(GraphicsConfiguration gc) { - // Check to see if a valid fbConfig pointer has been cached. + // Check to see if a valid FBConfig pointer has been cached. Object fbConfigObject = Canvas3D.fbConfigTable.get(gc); return ((fbConfigObject != null) && - (fbConfigObject instanceof Long)); - + (fbConfigObject instanceof GraphicsConfigInfo)); } diff --git a/src/classes/solaris/javax/media/j3d/NativeConfigTemplate3D.java b/src/classes/solaris/javax/media/j3d/NativeConfigTemplate3D.java index fad96ea..f443635 100644 --- a/src/classes/solaris/javax/media/j3d/NativeConfigTemplate3D.java +++ b/src/classes/solaris/javax/media/j3d/NativeConfigTemplate3D.java @@ -35,7 +35,8 @@ class NativeConfigTemplate3D { final static int DOUBLEBUFFER = 6; final static int STEREO = 7; final static int ANTIALIASING = 8; - final static int NUM_ITEMS = 9; + 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. @@ -52,7 +53,7 @@ class NativeConfigTemplate3D { 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. @@ -110,6 +111,9 @@ class NativeConfigTemplate3D { 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); @@ -137,15 +141,18 @@ class NativeConfigTemplate3D { // 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) - Canvas3D.fbConfigTable.put(gc1, new Long(fbConfig[0])); - else + 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; + } + } + return gc1; } - + /* * Determine if a given GraphicsConfiguration object can be used * by Java 3D. @@ -179,6 +186,9 @@ class NativeConfigTemplate3D { 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); @@ -205,6 +215,21 @@ class NativeConfigTemplate3D { 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; |