diff options
author | Sven Gothel <[email protected]> | 2009-03-13 11:55:23 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-03-13 11:55:23 +0000 |
commit | a74f1100b11eb3a6944a73eea48bf17d14ede8c1 (patch) | |
tree | 48a1d2e9fb9a7beb0c71ce016104022e79d736d3 | |
parent | 3f0266e5d20216f68f515a943ad647d01e0ff567 (diff) |
New package Native Window Interface 'java.media.nwi',
to loose JOGL dependencies for the moved interfaces, mainly NativeWindow.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1863 232f8b59-042b-4e1e-8c03-345bb8c30851
72 files changed, 411 insertions, 347 deletions
diff --git a/make/build.xml b/make/build.xml index 69155d61f..e1f5f8d38 100644 --- a/make/build.xml +++ b/make/build.xml @@ -1152,7 +1152,7 @@ <!-- Perform the first pass Java compile. --> <javac destdir="${classes}" classpath="${gluegen-rt.jar}" - includes="javax/media/opengl/sub/** javax/media/opengl/GLDrawableFactory.java javax/media/opengl/GLDrawable.java javax/media/opengl/GLContext.java javax/media/opengl/GL.java javax/media/opengl/GL2ES1.java javax/media/opengl/GL2ES2.java javax/media/opengl/GL2.java javax/media/opengl/GLES1.java javax/media/opengl/GLES2.java" + includes="javax/media/nwi/** javax/media/opengl/sub/** javax/media/opengl/GLDrawableFactory.java javax/media/opengl/GLDrawable.java javax/media/opengl/GLContext.java javax/media/opengl/GL.java javax/media/opengl/GL2ES1.java javax/media/opengl/GL2ES2.java javax/media/opengl/GL2.java javax/media/opengl/GLES1.java javax/media/opengl/GLES2.java" fork="yes" memoryMaximumSize="128m" source="1.4" debug="${javacdebug}" debuglevel="${javacdebuglevel}"> @@ -1748,7 +1748,7 @@ <jar manifest="tempversion" destfile="${jogl.core.jar}"> <fileset dir="${classes}" - includes="javax/media/opengl/**, com/sun/gluegen/runtime/**, com/sun/opengl/**" + includes="javax/media/nwi/**, javax/media/opengl/**, com/sun/gluegen/runtime/**, com/sun/opengl/**" excludes="${java.excludes.fixme} ${java.part.egl}, ${java.part.sdk}, ${java.part.glsl}, ${java.part.openmax}, ${java.part.glsl.fixed}, ${java.part.gl2es12.x11}, ${java.part.gl2es12.win}, ${java.part.gl2es12.osx}, ${java.part.gl2es12.dbg}, ${java.part.gl2.x11}, ${java.part.gl2.win}, ${java.part.gl2.osx}, ${java.part.gl2.dbg}, ${java.part.es1}, ${java.part.es1.dbg}, ${java.part.es2}, ${java.part.es2.dbg}, ${java.part.awt}, ${java.part.glutess}, ${java.part.glumipmap}, ${java.part.glugl2}, ${java.part.util} ${java.part.util.awt} ${java.part.util.gl2}, ${java.part.newt}, ${java.part.newt.awt}"/> </jar> <jar manifest="tempversion" destfile="${jogl.gles1.jar}"> @@ -1862,6 +1862,7 @@ </jar> <jar manifest="tempversion" destfile="${jogl.all.jar}"> <fileset dir="${classes}"> + <include name="javax/media/nwi/**" /> <include name="javax/media/opengl/**" /> <include name="com/sun/gluegen/runtime/**" /> <include name="com/sun/opengl/**" /> @@ -1888,6 +1889,7 @@ </copy> <jar manifest="tempversion" destfile="${jogl.jar}"> <fileset dir="${classes}"> + <include name="javax/media/nwi/**" /> <include name="javax/media/opengl/**" /> <include name="com/sun/gluegen/runtime/**" /> <include name="com/sun/opengl/**" /> diff --git a/make/make.jogl.doc.all.sh b/make/make.jogl.doc.all.sh deleted file mode 100644 index 5f6f90368..000000000 --- a/make/make.jogl.doc.all.sh +++ /dev/null @@ -1,5 +0,0 @@ -#! /bin/sh - -. ../../setenv-build-jogl.sh - -ant -v javadoc.dev.all $* 2>&1 | tee make.jogl.doc.all.log diff --git a/make/make.jogl.doc.all.x86_64.sh b/make/make.jogl.doc.all.x86_64.sh new file mode 100644 index 000000000..d6f16c2d4 --- /dev/null +++ b/make/make.jogl.doc.all.x86_64.sh @@ -0,0 +1,7 @@ +#! /bin/sh + +. ../../setenv-build-jogl-x86_64.sh + +ant -v \ + -Drootrel.build=build-x86_64 \ + javadoc.dev.all $* 2>&1 | tee make.jogl.doc.all.x86_64.log diff --git a/make/make.jogl.doc.sh b/make/make.jogl.doc.sh deleted file mode 100644 index 92fd23674..000000000 --- a/make/make.jogl.doc.sh +++ /dev/null @@ -1,5 +0,0 @@ -#! /bin/sh - -. ../../setenv-build-jogl.sh - -ant -v javadoc $* 2>&1 | tee make.jogl.doc.all.log diff --git a/make/make.jogl.doc.x86_64.sh b/make/make.jogl.doc.x86_64.sh new file mode 100644 index 000000000..2ed8e67ec --- /dev/null +++ b/make/make.jogl.doc.x86_64.sh @@ -0,0 +1,7 @@ +#! /bin/sh + +. ../../setenv-build-jogl-x86_64.sh + +ant -v \ + -Drootrel.build=build-x86_64 \ + javadoc $* 2>&1 | tee make.jogl.doc.x86_64.log diff --git a/src/classes/com/sun/javafx/newt/GLWindow.java b/src/classes/com/sun/javafx/newt/GLWindow.java index 23f959799..53943b087 100644 --- a/src/classes/com/sun/javafx/newt/GLWindow.java +++ b/src/classes/com/sun/javafx/newt/GLWindow.java @@ -33,6 +33,7 @@ package com.sun.javafx.newt; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.GLDrawableHelper; @@ -83,7 +84,7 @@ public class GLWindow extends Window implements GLAutoDrawable { } /** Creates a new GLWindow on the local display, screen 0, with a - dummy visual ID, and with the default GLCapabilities. */ + dummy visual ID, and with the default NWCapabilities. */ public static GLWindow create() { return create(null, null); } @@ -96,26 +97,26 @@ public class GLWindow extends Window implements GLAutoDrawable { public static GLWindow create(Window window) { return create(window, null); } - public static GLWindow create(GLCapabilities caps) { + public static GLWindow create(NWCapabilities caps) { return create(caps, false); } /** Creates a new GLWindow on the local display, screen 0, with a - dummy visual ID, and with the given GLCapabilities. */ - public static GLWindow create(GLCapabilities caps, boolean undecorated) { + dummy visual ID, and with the given NWCapabilities. */ + public static GLWindow create(NWCapabilities caps, boolean undecorated) { return create(null, caps, undecorated); } - /** Creates a new GLWindow referring to the given window, and with the given GLCapabilities. */ - public static GLWindow create(Window window, GLCapabilities caps) { + /** Creates a new GLWindow referring to the given window, and with the given NWCapabilities. */ + public static GLWindow create(Window window, NWCapabilities caps) { return create(window, caps, false); } public static GLWindow create(Window window, - GLCapabilities caps, + NWCapabilities caps, boolean undecorated) { if (caps == null) { - caps = new GLCapabilities(); + caps = new NWCapabilities(); } if (window == null) { Display display = NewtFactory.createDisplay(null); // local display @@ -126,7 +127,7 @@ public class GLWindow extends Window implements GLAutoDrawable { return new GLWindow(window); } - protected void createNative(GLCapabilities caps) { + protected void createNative(NWCapabilities caps) { shouldNotCallThis(); } @@ -463,11 +464,11 @@ public class GLWindow extends Window implements GLAutoDrawable { public void setRealized(boolean realized) { } - public GLCapabilities getChosenGLCapabilities() { + public NWCapabilities getChosenNWCapabilities() { if (drawable == null) return null; - return drawable.getChosenGLCapabilities(); + return drawable.getChosenNWCapabilities(); } public NativeWindow getNativeWindow() { @@ -479,6 +480,6 @@ public class GLWindow extends Window implements GLAutoDrawable { // private void shouldNotCallThis() { - throw new RuntimeException("Should not call this"); + throw new NativeWindowException("Should not call this"); } } diff --git a/src/classes/com/sun/javafx/newt/NewtFactory.java b/src/classes/com/sun/javafx/newt/NewtFactory.java index f9f8678af..312c6f825 100755 --- a/src/classes/com/sun/javafx/newt/NewtFactory.java +++ b/src/classes/com/sun/javafx/newt/NewtFactory.java @@ -33,7 +33,7 @@ package com.sun.javafx.newt; -import javax.media.opengl.GLCapabilities; +import javax.media.nwi.NWCapabilities; import java.util.ArrayList; import java.util.Iterator; @@ -124,18 +124,18 @@ public abstract class NewtFactory { /** * Create a Window entity, incl native creation */ - public static Window createWindow(Screen screen, GLCapabilities caps) { + public static Window createWindow(Screen screen, NWCapabilities caps) { return Window.create(getWindowType(), screen, caps); } - public static Window createWindow(Screen screen, GLCapabilities caps, boolean undecorated) { + public static Window createWindow(Screen screen, NWCapabilities caps, boolean undecorated) { return Window.create(getWindowType(), screen, caps, undecorated); } /** * Create a Window entity using the given implementation type, incl native creation */ - public static Window createWindow(String type, Screen screen, GLCapabilities caps) { + public static Window createWindow(String type, Screen screen, NWCapabilities caps) { return Window.create(type, screen, caps); } @@ -156,7 +156,7 @@ public abstract class NewtFactory { /** * Instantiate a Window entity using the native handle. */ - public static Window wrapWindow(Screen screen, GLCapabilities caps, long visualID, + public static Window wrapWindow(Screen screen, NWCapabilities caps, long visualID, long windowHandle, boolean fullscreen, boolean visible, int x, int y, int width, int height) { return Window.wrapHandle(getWindowType(), screen, caps, visualID, diff --git a/src/classes/com/sun/javafx/newt/Window.java b/src/classes/com/sun/javafx/newt/Window.java index 155eda8a3..a1e983c3c 100755 --- a/src/classes/com/sun/javafx/newt/Window.java +++ b/src/classes/com/sun/javafx/newt/Window.java @@ -33,9 +33,9 @@ package com.sun.javafx.newt; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.NativeWindow; -import javax.media.opengl.NativeWindowException; +import javax.media.nwi.NWCapabilities; +import javax.media.nwi.NativeWindow; +import javax.media.nwi.NativeWindowException; import java.util.ArrayList; import java.util.Iterator; @@ -76,16 +76,16 @@ public abstract class Window implements NativeWindow } else if (NewtFactory.AWT.equals(type)) { windowClass = Class.forName("com.sun.javafx.newt.awt.AWTWindow"); } else { - throw new RuntimeException("Unknown window type \"" + type + "\""); + throw new NativeWindowException("Unknown window type \"" + type + "\""); } return windowClass; } - protected static Window create(String type, Screen screen, GLCapabilities caps) { + protected static Window create(String type, Screen screen, NWCapabilities caps) { return create(type, screen, caps, false); } - protected static Window create(String type, Screen screen, GLCapabilities caps, boolean undecorated) { + protected static Window create(String type, Screen screen, NWCapabilities caps, boolean undecorated) { try { Class windowClass = getWindowClass(type); Window window = (Window) windowClass.newInstance(); @@ -97,11 +97,11 @@ public abstract class Window implements NativeWindow return window; } catch (Throwable t) { t.printStackTrace(); - throw new RuntimeException(t); + throw new NativeWindowException(t); } } - protected static Window wrapHandle(String type, Screen screen, GLCapabilities caps, long visualID, + protected static Window wrapHandle(String type, Screen screen, NWCapabilities caps, long visualID, long windowHandle, boolean fullscreen, boolean visible, int x, int y, int width, int height) { @@ -122,7 +122,7 @@ public abstract class Window implements NativeWindow return window; } catch (Throwable t) { t.printStackTrace(); - throw new RuntimeException(t); + throw new NativeWindowException(t); } } @@ -132,7 +132,7 @@ public abstract class Window implements NativeWindow * Shall use the capabilities to determine the visualID * and shall set chosenCaps. */ - protected abstract void createNative(GLCapabilities caps); + protected abstract void createNative(NWCapabilities caps); protected abstract void closeNative(); @@ -176,11 +176,11 @@ public abstract class Window implements NativeWindow protected Screen screen; /** - * The GLCapabilities shall be used to determine the visualID + * The NWCapabilities shall be used to determine the visualID */ - protected GLCapabilities chosenCaps; + protected NWCapabilities chosenCaps; /** - * The visualID shall be determined using the GLCapabilities + * The visualID shall be determined using the NWCapabilities */ protected long visualID; protected long windowHandle; @@ -288,12 +288,12 @@ public abstract class Window implements NativeWindow return windowHandle; // default: return window handle } - public GLCapabilities getChosenCapabilities() { + public NWCapabilities getChosenCapabilities() { if (chosenCaps == null) return null; // Must return a new copy to avoid mutation by end user - return (GLCapabilities) chosenCaps.clone(); + return (NWCapabilities) chosenCaps.clone(); } public long getVisualID() { @@ -377,7 +377,7 @@ public abstract class Window implements NativeWindow ", mod "+modifiers+", pos "+x+"/"+y+", button "+button); } if(button<0||button>MouseEvent.BUTTON_NUMBER) { - throw new RuntimeException("Invalid mouse button number" + button); + throw new NativeWindowException("Invalid mouse button number" + button); } long when = System.currentTimeMillis(); MouseEvent eClicked = null; @@ -455,7 +455,7 @@ public abstract class Window implements NativeWindow l.mouseDragged(e); break; default: - throw new RuntimeException("Unexpected mouse event type " + e.getEventType()); + throw new NativeWindowException("Unexpected mouse event type " + e.getEventType()); } } } @@ -511,7 +511,7 @@ public abstract class Window implements NativeWindow l.keyTyped(e); break; default: - throw new RuntimeException("Unexpected key event type " + e.getEventType()); + throw new NativeWindowException("Unexpected key event type " + e.getEventType()); } } } @@ -563,7 +563,7 @@ public abstract class Window implements NativeWindow l.windowMoved(e); break; default: - throw new RuntimeException("Unexpected window event type " + e.getEventType()); + throw new NativeWindowException("Unexpected window event type " + e.getEventType()); } } } diff --git a/src/classes/com/sun/javafx/newt/awt/AWTWindow.java b/src/classes/com/sun/javafx/newt/awt/AWTWindow.java index ee3e97a38..8badf6d4e 100644 --- a/src/classes/com/sun/javafx/newt/awt/AWTWindow.java +++ b/src/classes/com/sun/javafx/newt/awt/AWTWindow.java @@ -47,7 +47,8 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.util.*; import com.sun.javafx.newt.Window; -import javax.media.opengl.GLCapabilities; +import javax.media.nwi.NWCapabilities; +import javax.media.nwi.NativeWindowException; /** An implementation of the Newt Window class built using the AWT. This is provided for convenience of porting to platforms @@ -74,8 +75,8 @@ public class AWTWindow extends Window { } } - protected void createNative(GLCapabilities caps) { - chosenCaps = (GLCapabilities) caps.clone(); // FIXME: visualID := f1(caps); caps := f2(visualID) + protected void createNative(NWCapabilities caps) { + chosenCaps = (NWCapabilities) caps.clone(); // FIXME: visualID := f1(caps); caps := f2(visualID) visualID = 0; // n/a runOnEDT(new Runnable() { public void run() { @@ -206,7 +207,7 @@ public class AWTWindow extends Window { break; default: - throw new RuntimeException("Unknown event type " + w.getType()); + throw new NativeWindowException("Unknown event type " + w.getType()); } if(DEBUG_MOUSE_EVENT) { System.out.println("dispatchMessages: in event:"+w.getEvent()); @@ -242,7 +243,7 @@ public class AWTWindow extends Window { try { EventQueue.invokeAndWait(r); } catch (Exception e) { - throw new RuntimeException(e); + throw new NativeWindowException(e); } } } diff --git a/src/classes/com/sun/javafx/newt/kd/KDDisplay.java b/src/classes/com/sun/javafx/newt/kd/KDDisplay.java index 92f41bc0b..6128c3e77 100755 --- a/src/classes/com/sun/javafx/newt/kd/KDDisplay.java +++ b/src/classes/com/sun/javafx/newt/kd/KDDisplay.java @@ -36,7 +36,7 @@ package com.sun.javafx.newt.kd; import com.sun.javafx.newt.*; import com.sun.opengl.impl.*; import com.sun.opengl.impl.egl.*; -import javax.media.opengl.GLException; +import javax.media.nwi.NativeWindowException; public class KDDisplay extends Display { static { @@ -50,10 +50,10 @@ public class KDDisplay extends Display { // FIXME: map name to EGL_*_DISPLAY handle = EGL.eglGetDisplay(EGL.EGL_DEFAULT_DISPLAY); if (handle == EGL.EGL_NO_DISPLAY) { - throw new GLException("eglGetDisplay failed"); + throw new NativeWindowException("eglGetDisplay failed"); } if (!EGL.eglInitialize(handle, null, null)) { - throw new GLException("eglInitialize failed"); + throw new NativeWindowException("eglInitialize failed"); } } } diff --git a/src/classes/com/sun/javafx/newt/kd/KDWindow.java b/src/classes/com/sun/javafx/newt/kd/KDWindow.java index 44e297a92..01570e1bb 100755 --- a/src/classes/com/sun/javafx/newt/kd/KDWindow.java +++ b/src/classes/com/sun/javafx/newt/kd/KDWindow.java @@ -36,9 +36,9 @@ package com.sun.javafx.newt.kd; import com.sun.javafx.newt.*; import com.sun.opengl.impl.*; import com.sun.opengl.impl.egl.*; -import javax.media.opengl.GLCapabilities; +import javax.media.nwi.NWCapabilities; import javax.media.opengl.GLProfile; -import javax.media.opengl.NativeWindowException; +import javax.media.nwi.NativeWindowException; public class KDWindow extends Window { private static final String WINDOW_CLASS_NAME = "NewtWindow"; @@ -49,14 +49,14 @@ public class KDWindow extends Window { NativeLibLoader.loadNEWT(); if (!initIDs()) { - throw new RuntimeException("Failed to initialize jmethodIDs"); + throw new NativeWindowException("Failed to initialize jmethodIDs"); } } public KDWindow() { } - protected void createNative(GLCapabilities caps) { + protected void createNative(NWCapabilities caps) { int eglRenderableType; if(GLProfile.isGLES1()) { eglRenderableType = EGL.EGL_OPENGL_ES_BIT; @@ -74,13 +74,13 @@ public class KDWindow extends Window { windowID = ++_windowID; eglWindowHandle = CreateWindow(windowID, getDisplayHandle(), config.getAttributeList()); if (eglWindowHandle == 0) { - throw new RuntimeException("Error creating egl window: "+eglWindowHandle); + throw new NativeWindowException("Error creating egl window: "+eglWindowHandle); } setVisible0(eglWindowHandle, false); /* windowHandle = RealizeWindow(eglWindowHandle); if (0 == windowHandle) { - throw new RuntimeException("Error native Window Handle is null"); + throw new NativeWindowException("Error native Window Handle is null"); } */ windowHandleClose = eglWindowHandle; } @@ -98,7 +98,7 @@ public class KDWindow extends Window { if ( 0==windowHandle ) { windowHandle = RealizeWindow(eglWindowHandle); if (0 == windowHandle) { - throw new RuntimeException("Error native Window Handle is null"); + throw new NativeWindowException("Error native Window Handle is null"); } } clearEventMask(); diff --git a/src/classes/com/sun/javafx/newt/macosx/MacWindow.java b/src/classes/com/sun/javafx/newt/macosx/MacWindow.java index 345ebe0e1..f80f0b3ab 100755 --- a/src/classes/com/sun/javafx/newt/macosx/MacWindow.java +++ b/src/classes/com/sun/javafx/newt/macosx/MacWindow.java @@ -33,7 +33,8 @@ package com.sun.javafx.newt.macosx; -import javax.media.opengl.GLCapabilities; +import javax.media.nwi.NWCapabilities; +import javax.media.nwi.NativeWindowException; import com.sun.javafx.newt.*; import com.sun.opengl.impl.*; @@ -135,15 +136,15 @@ public class MacWindow extends Window { NativeLibLoader.loadNEWT(); if (!initIDs()) { - throw new RuntimeException("Failed to initialize jmethodIDs"); + throw new NativeWindowException("Failed to initialize jmethodIDs"); } } public MacWindow() { } - protected void createNative(GLCapabilities caps) { - chosenCaps = (GLCapabilities) caps.clone(); // FIXME: visualID := f1(caps); caps := f2(visualID) + protected void createNative(NWCapabilities caps) { + chosenCaps = (NWCapabilities) caps.clone(); // FIXME: visualID := f1(caps); caps := f2(visualID) visualID = 0; // n/a } diff --git a/src/classes/com/sun/javafx/newt/windows/WindowsWindow.java b/src/classes/com/sun/javafx/newt/windows/WindowsWindow.java index de05f0951..8b9d635e8 100755 --- a/src/classes/com/sun/javafx/newt/windows/WindowsWindow.java +++ b/src/classes/com/sun/javafx/newt/windows/WindowsWindow.java @@ -33,7 +33,8 @@ package com.sun.javafx.newt.windows; -import javax.media.opengl.GLCapabilities; +import javax.media.nwi.NWCapabilities; +import javax.media.nwi.NativeWindowException; import com.sun.javafx.newt.*; import com.sun.opengl.impl.*; @@ -48,7 +49,7 @@ public class WindowsWindow extends Window { NativeLibLoader.loadNEWT(); if (!initIDs()) { - throw new RuntimeException("Failed to initialize jmethodIDs"); + throw new NativeWindowException("Failed to initialize jmethodIDs"); } } @@ -62,13 +63,13 @@ public class WindowsWindow extends Window { return hdc; } - protected void createNative(GLCapabilities caps) { + protected void createNative(NWCapabilities caps) { long wndClass = getWindowClass(); - chosenCaps = (GLCapabilities) caps.clone(); // FIXME: visualID := f1(caps); caps := f2(visualID) + chosenCaps = (NWCapabilities) caps.clone(); // FIXME: visualID := f1(caps); caps := f2(visualID) visualID = 0; // n/a windowHandle = CreateWindow(WINDOW_CLASS_NAME, getHInstance(), visualID, x, y, width, height); if (windowHandle == 0) { - throw new RuntimeException("Error creating window"); + throw new NativeWindowException("Error creating window"); } windowHandleClose = windowHandle; } @@ -125,7 +126,7 @@ public class WindowsWindow extends Window { if (windowClass == 0) { windowClass = RegisterWindowClass(WINDOW_CLASS_NAME, getHInstance()); if (windowClass == 0) { - throw new RuntimeException("Error while registering window class"); + throw new NativeWindowException("Error while registering window class"); } } return windowClass; @@ -135,7 +136,7 @@ public class WindowsWindow extends Window { if (hInstance == 0) { hInstance = LoadLibraryW("newt"); if (hInstance == 0) { - throw new RuntimeException("Error finding HINSTANCE for \"newt\""); + throw new NativeWindowException("Error finding HINSTANCE for \"newt\""); } } return hInstance; diff --git a/src/classes/com/sun/javafx/newt/x11/X11Window.java b/src/classes/com/sun/javafx/newt/x11/X11Window.java index ee0846e1b..312cc161d 100755 --- a/src/classes/com/sun/javafx/newt/x11/X11Window.java +++ b/src/classes/com/sun/javafx/newt/x11/X11Window.java @@ -35,8 +35,8 @@ package com.sun.javafx.newt.x11; import com.sun.javafx.newt.*; import com.sun.opengl.impl.*; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.NativeWindowException; +import javax.media.nwi.NWCapabilities; +import javax.media.nwi.NativeWindowException; public class X11Window extends Window { private static final String WINDOW_CLASS_NAME = "NewtWindow"; @@ -47,19 +47,19 @@ public class X11Window extends Window { NativeLibLoader.loadNEWT(); if (!initIDs()) { - throw new RuntimeException("Failed to initialize jmethodIDs"); + throw new NativeWindowException("Failed to initialize jmethodIDs"); } } public X11Window() { } - protected void createNative(GLCapabilities caps) { - chosenCaps = (GLCapabilities) caps.clone(); // FIXME: visualID := f1(caps); caps := f2(visualID) + protected void createNative(NWCapabilities caps) { + chosenCaps = (NWCapabilities) caps.clone(); // FIXME: visualID := f1(caps); caps := f2(visualID) visualID = 0; // n/a long w = CreateWindow(getDisplayHandle(), getScreenHandle(), getScreenIndex(), visualID, x, y, width, height); if (w == 0 || w!=windowHandle) { - throw new RuntimeException("Error creating window: "+w); + throw new NativeWindowException("Error creating window: "+w); } windowHandleClose = windowHandle; displayHandleClose = getDisplayHandle(); diff --git a/src/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java b/src/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java index 70aef0dc3..d3906c08f 100644 --- a/src/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java +++ b/src/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java @@ -40,6 +40,7 @@ package com.sun.opengl.impl; import java.nio.*; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.gluegen.runtime.*; @@ -52,8 +53,8 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory implements /** Creates a (typically software-accelerated) offscreen GLDrawable used to implement the fallback rendering path of the GLJPanel. */ - public abstract GLDrawableImpl createOffscreenDrawable(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, + public abstract GLDrawableImpl createOffscreenDrawable(NWCapabilities capabilities, + NWCapabilitiesChooser chooser, int width, int height); diff --git a/src/classes/com/sun/opengl/impl/GLDrawableImpl.java b/src/classes/com/sun/opengl/impl/GLDrawableImpl.java index 0818ac1c4..46c79cf2b 100644 --- a/src/classes/com/sun/opengl/impl/GLDrawableImpl.java +++ b/src/classes/com/sun/opengl/impl/GLDrawableImpl.java @@ -39,19 +39,20 @@ package com.sun.opengl.impl; +import javax.media.nwi.*; import javax.media.opengl.*; public abstract class GLDrawableImpl implements GLDrawable { - private GLCapabilities requestedCapabilities; + private NWCapabilities requestedCapabilities; protected GLDrawableImpl(GLDrawableFactory factory, NativeWindow comp, - GLCapabilities requestedCapabilities, + NWCapabilities requestedCapabilities, boolean realized) { this.factory = factory; this.component = comp; this.requestedCapabilities = - (requestedCapabilities == null) ? null : (GLCapabilities) requestedCapabilities.clone(); + (requestedCapabilities == null) ? null : (NWCapabilities) requestedCapabilities.clone(); this.realized = realized; } @@ -72,20 +73,20 @@ public abstract class GLDrawableImpl implements GLDrawable { return GLContextImpl.toHexString(hex); } - protected GLCapabilities getRequestedGLCapabilities() { + protected NWCapabilities getRequestedNWCapabilities() { return requestedCapabilities; } - public GLCapabilities getChosenGLCapabilities() { + public NWCapabilities getChosenNWCapabilities() { if (chosenCapabilities == null) return null; // Must return a new copy to avoid mutation by end user - return (GLCapabilities) chosenCapabilities.clone(); + return (NWCapabilities) chosenCapabilities.clone(); } - protected void setChosenGLCapabilities(GLCapabilities caps) { - chosenCapabilities = (caps==null) ? null : (GLCapabilities) caps.clone(); + protected void setChosenNWCapabilities(NWCapabilities caps) { + chosenCapabilities = (caps==null) ? null : (NWCapabilities) caps.clone(); } public NativeWindow getNativeWindow() { @@ -99,7 +100,7 @@ public abstract class GLDrawableImpl implements GLDrawable { public void setRealized(boolean realized) { this.realized = realized; if(!realized) { - setChosenGLCapabilities(null); + setChosenNWCapabilities(null); component.invalidate(); } } @@ -140,7 +141,7 @@ public abstract class GLDrawableImpl implements GLDrawable { protected GLDrawableFactory factory; protected NativeWindow component; - private GLCapabilities chosenCapabilities; + private NWCapabilities chosenCapabilities; // Indicates whether the component (if an onscreen context) has been // realized. Plausibly, before the component is realized the JAWT diff --git a/src/classes/com/sun/opengl/impl/GLPbufferImpl.java b/src/classes/com/sun/opengl/impl/GLPbufferImpl.java index 14c218c45..548991365 100644 --- a/src/classes/com/sun/opengl/impl/GLPbufferImpl.java +++ b/src/classes/com/sun/opengl/impl/GLPbufferImpl.java @@ -46,6 +46,7 @@ import java.awt.event.*; import java.beans.PropertyChangeListener; */ +import javax.media.nwi.*; import javax.media.opengl.*; /** Platform-independent class exposing pbuffer functionality to @@ -156,11 +157,11 @@ public class GLPbufferImpl implements GLPbuffer { context.releasePbufferFromTexture(); } - public GLCapabilities getChosenGLCapabilities() { + public NWCapabilities getChosenNWCapabilities() { if (pbufferDrawable == null) return null; - return pbufferDrawable.getChosenGLCapabilities(); + return pbufferDrawable.getChosenNWCapabilities(); } private boolean surfaceLocked = false; diff --git a/src/classes/com/sun/opengl/impl/NativeWindowFactoryImpl.java b/src/classes/com/sun/opengl/impl/NativeWindowFactoryImpl.java index 296ea3a44..c5e5230e4 100644 --- a/src/classes/com/sun/opengl/impl/NativeWindowFactoryImpl.java +++ b/src/classes/com/sun/opengl/impl/NativeWindowFactoryImpl.java @@ -35,6 +35,7 @@ package com.sun.opengl.impl; import java.lang.reflect.*; import java.security.*; +import javax.media.nwi.*; import javax.media.opengl.*; public class NativeWindowFactoryImpl extends NativeWindowFactory { @@ -100,8 +101,8 @@ public class NativeWindowFactoryImpl extends NativeWindowFactory { // All platforms except for X11 perform the OpenGL pixel format // selection lazily - public AbstractGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, + public AbstractGraphicsConfiguration chooseGraphicsConfiguration(NWCapabilities capabilities, + NWCapabilitiesChooser chooser, AbstractGraphicsDevice device) { return null; } diff --git a/src/classes/com/sun/opengl/impl/NullWindow.java b/src/classes/com/sun/opengl/impl/NullWindow.java index 1cd4b4bc2..02a252370 100644 --- a/src/classes/com/sun/opengl/impl/NullWindow.java +++ b/src/classes/com/sun/opengl/impl/NullWindow.java @@ -36,6 +36,7 @@ package com.sun.opengl.impl; +import javax.media.nwi.*; import javax.media.opengl.*; public class NullWindow implements NativeWindow { diff --git a/src/classes/com/sun/opengl/impl/egl/EGLConfig.java b/src/classes/com/sun/opengl/impl/egl/EGLConfig.java index 4948b3a0c..2c03a20a6 100644 --- a/src/classes/com/sun/opengl/impl/egl/EGLConfig.java +++ b/src/classes/com/sun/opengl/impl/egl/EGLConfig.java @@ -36,6 +36,7 @@ package com.sun.opengl.impl.egl; import java.util.*; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; import com.sun.gluegen.runtime.NativeLibrary; @@ -50,7 +51,7 @@ public class EGLConfig { return configID; } - public GLCapabilities getCapabilities() { + public NWCapabilities getCapabilities() { return capabilities; } @@ -82,11 +83,11 @@ public class EGLConfig { if (numConfigs[0] == 0) { throw new GLException("No valid graphics configuration selected from eglChooseConfig"); } - capabilities = new GLCapabilities(); + capabilities = new NWCapabilities(); setup(display, configID, configs[0]); } - public EGLConfig(long display, GLCapabilities caps) { + public EGLConfig(long display, NWCapabilities caps) { int[] attrs = glCapabilities2AttribList(caps); _EGLConfig[] configs = new _EGLConfig[1]; int[] numConfigs = new int[1]; @@ -99,7 +100,7 @@ public class EGLConfig { if (numConfigs[0] == 0) { throw new GLException("No valid graphics configuration selected from eglChooseConfig"); } - capabilities = (GLCapabilities)caps.clone(); + capabilities = (NWCapabilities)caps.clone(); setup(display, -1, configs[0]); } @@ -136,7 +137,7 @@ public class EGLConfig { } } - public static int[] glCapabilities2AttribList(GLCapabilities caps) { + public static int[] glCapabilities2AttribList(NWCapabilities caps) { int[] attrs = new int[] { EGL.EGL_RENDERABLE_TYPE, -1, // FIXME: does this need to be configurable? @@ -166,6 +167,6 @@ public class EGLConfig { } private _EGLConfig _config; private int configID; - private GLCapabilities capabilities; + private NWCapabilities capabilities; } diff --git a/src/classes/com/sun/opengl/impl/egl/EGLContext.java b/src/classes/com/sun/opengl/impl/egl/EGLContext.java index df3bd2a34..b7cfb051e 100755 --- a/src/classes/com/sun/opengl/impl/egl/EGLContext.java +++ b/src/classes/com/sun/opengl/impl/egl/EGLContext.java @@ -35,6 +35,7 @@ package com.sun.opengl.impl.egl; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; import com.sun.gluegen.runtime.ProcAddressTable; diff --git a/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java b/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java index 215c6ed28..3e7df000c 100755 --- a/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java @@ -38,10 +38,11 @@ package com.sun.opengl.impl.egl; import com.sun.opengl.impl.GLDrawableImpl; import com.sun.opengl.impl.GLReflection; +import javax.media.nwi.*; import javax.media.opengl.*; public class EGLDrawable extends GLDrawableImpl { - private GLCapabilitiesChooser chooser; + private NWCapabilitiesChooser chooser; private long display; private EGLConfig config; private long surface; @@ -49,8 +50,8 @@ public class EGLDrawable extends GLDrawableImpl { public EGLDrawable(EGLDrawableFactory factory, NativeWindow component, - GLCapabilities requestedCapabilities, - GLCapabilitiesChooser chooser) throws GLException { + NWCapabilities requestedCapabilities, + NWCapabilitiesChooser chooser) throws GLException { super(factory, component, requestedCapabilities, false); this.chooser = chooser; surface=EGL.EGL_NO_SURFACE; @@ -114,9 +115,9 @@ public class EGLDrawable extends GLDrawableImpl { if (!EGL.eglInitialize(display, null, null)) { throw new GLException("eglInitialize failed"); } - config = new EGLConfig(display, getRequestedGLCapabilities()); + config = new EGLConfig(display, getRequestedNWCapabilities()); } - setChosenGLCapabilities(config.getCapabilities()); + setChosenNWCapabilities(config.getCapabilities()); } else if (surface != EGL.EGL_NO_SURFACE) { // Destroy the window surface if (!EGL.eglDestroySurface(display, surface)) { diff --git a/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java index 37dd6c8fe..6fc009752 100755 --- a/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java @@ -36,6 +36,7 @@ package com.sun.opengl.impl.egl; import java.util.*; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; import com.sun.gluegen.runtime.NativeLibrary; @@ -116,23 +117,23 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } } - public AbstractGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, + public AbstractGraphicsConfiguration chooseGraphicsConfiguration(NWCapabilities capabilities, + NWCapabilitiesChooser chooser, AbstractGraphicsDevice device) { return null; } public GLDrawable createGLDrawable(NativeWindow target, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser) { + NWCapabilities capabilities, + NWCapabilitiesChooser chooser) { target = NativeWindowFactory.getNativeWindow(target); return new EGLDrawable(this, target, capabilities, chooser); } - public GLDrawableImpl createOffscreenDrawable(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, + public GLDrawableImpl createOffscreenDrawable(NWCapabilities capabilities, + NWCapabilitiesChooser chooser, int width, int height) { throw new GLUnsupportedException("Not yet implemented"); @@ -142,8 +143,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { // Not supported on OpenGL ES return false; } - public GLPbuffer createGLPbuffer(final GLCapabilities capabilities, - final GLCapabilitiesChooser chooser, + public GLPbuffer createGLPbuffer(final NWCapabilities capabilities, + final NWCapabilitiesChooser chooser, final int initialWidth, final int initialHeight, final GLContext shareWith) { diff --git a/src/classes/com/sun/opengl/impl/jawt/JAWTWindow.java b/src/classes/com/sun/opengl/impl/jawt/JAWTWindow.java index b1a1d9d8e..ebbb7f666 100644 --- a/src/classes/com/sun/opengl/impl/jawt/JAWTWindow.java +++ b/src/classes/com/sun/opengl/impl/jawt/JAWTWindow.java @@ -40,6 +40,7 @@ import com.sun.opengl.impl.*; import java.awt.Component; import java.awt.GraphicsEnvironment; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; diff --git a/src/classes/com/sun/opengl/impl/jawt/macosx/MacOSXJAWTWindow.java b/src/classes/com/sun/opengl/impl/jawt/macosx/MacOSXJAWTWindow.java index 3646e045f..55c4490db 100644 --- a/src/classes/com/sun/opengl/impl/jawt/macosx/MacOSXJAWTWindow.java +++ b/src/classes/com/sun/opengl/impl/jawt/macosx/MacOSXJAWTWindow.java @@ -46,6 +46,7 @@ import com.sun.opengl.impl.*; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; +import javax.media.nwi.*; import javax.media.opengl.*; import java.security.*; diff --git a/src/classes/com/sun/opengl/impl/jawt/windows/WindowsJAWTWindow.java b/src/classes/com/sun/opengl/impl/jawt/windows/WindowsJAWTWindow.java index 2eddabe76..61da71bea 100644 --- a/src/classes/com/sun/opengl/impl/jawt/windows/WindowsJAWTWindow.java +++ b/src/classes/com/sun/opengl/impl/jawt/windows/WindowsJAWTWindow.java @@ -42,6 +42,7 @@ package com.sun.opengl.impl.jawt.windows; import com.sun.opengl.impl.windows.*; import com.sun.opengl.impl.jawt.*; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; diff --git a/src/classes/com/sun/opengl/impl/jawt/x11/X11JAWTWindow.java b/src/classes/com/sun/opengl/impl/jawt/x11/X11JAWTWindow.java index 4e22babee..d3039844f 100644 --- a/src/classes/com/sun/opengl/impl/jawt/x11/X11JAWTWindow.java +++ b/src/classes/com/sun/opengl/impl/jawt/x11/X11JAWTWindow.java @@ -40,6 +40,7 @@ import com.sun.opengl.impl.x11.*; import com.sun.opengl.impl.jawt.*; import com.sun.opengl.impl.*; +import javax.media.nwi.*; import javax.media.opengl.*; import java.awt.GraphicsDevice; diff --git a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java index 5c1a05e6b..a245b267a 100644 --- a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java +++ b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java @@ -41,6 +41,7 @@ package com.sun.opengl.impl.macosx.cgl; import java.nio.*; import java.util.*; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; import com.sun.gluegen.runtime.ProcAddressTable; @@ -110,7 +111,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl } } int[] viewNotReady = new int[1]; - GLCapabilities capabilities = drawable.getRequestedGLCapabilities(); + NWCapabilities capabilities = drawable.getRequestedNWCapabilities(); int[] iattribs = new int[128]; int[] ivalues = new int[128]; int idx = 0; @@ -139,7 +140,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl long pixelFormat = CGL.createPixelFormat(iattribs, 0, idx, ivalues, 0); if (pixelFormat == 0) { - throw new GLException("Unable to allocate pixel format with requested GLCapabilities"); + throw new GLException("Unable to allocate pixel format with requested NWCapabilities"); } try { // Try to allocate a context with this @@ -167,10 +168,10 @@ public abstract class MacOSXCGLContext extends GLContextImpl // context and not the drawable. However it's a reasonable // approximation to just store the chosen pixel format up in the // drawable since the public API doesn't provide for a different - // GLCapabilities per context. - if (drawable.getChosenGLCapabilities() == null) { + // NWCapabilities per context. + if (drawable.getChosenNWCapabilities() == null) { // Figure out what attributes we really got - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); CGL.queryPixelFormat(pixelFormat, iattribs, 0, idx, ivalues, 0); for (int i = 0; i < idx; i++) { int attr = iattribs[i]; @@ -234,7 +235,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl } } - drawable.setChosenGLCapabilities(caps); + drawable.setChosenNWCapabilities(caps); } diff --git a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java index efce08706..01816b190 100644 --- a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java @@ -39,13 +39,14 @@ package com.sun.opengl.impl.macosx.cgl; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; public abstract class MacOSXCGLDrawable extends GLDrawableImpl { protected static final boolean DEBUG = Debug.debug("MacOSXCGLDrawable"); - protected GLCapabilitiesChooser chooser; + protected NWCapabilitiesChooser chooser; // The Java2D/OpenGL pipeline on OS X uses low-level CGLContextObjs // to represent the contexts for e.g. the Java2D back buffer. When @@ -81,18 +82,18 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { public static final int CGL_MODE = 2; public MacOSXCGLDrawable(GLDrawableFactory factory, NativeWindow comp, boolean realized, - GLCapabilities requestedCapabilities, GLCapabilitiesChooser chooser) { + NWCapabilities requestedCapabilities, NWCapabilitiesChooser chooser) { super(factory, comp, requestedCapabilities, realized); this.chooser = chooser; } // These are public to allow access from a couple of context implementations - public void setChosenGLCapabilities(GLCapabilities caps) { - super.setChosenGLCapabilities(caps); + public void setChosenNWCapabilities(NWCapabilities caps) { + super.setChosenNWCapabilities(caps); } - public GLCapabilities getRequestedGLCapabilities() { - return super.getRequestedGLCapabilities(); + public NWCapabilities getRequestedNWCapabilities() { + return super.getRequestedNWCapabilities(); } protected static String getThreadName() { diff --git a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java index 3352a137c..22b7f368b 100644 --- a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java @@ -42,6 +42,7 @@ package com.sun.opengl.impl.macosx.cgl; import java.lang.reflect.InvocationTargetException; import java.nio.*; import java.util.*; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; @@ -50,30 +51,30 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { super(); } - public AbstractGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, + public AbstractGraphicsConfiguration chooseGraphicsConfiguration(NWCapabilities capabilities, + NWCapabilitiesChooser chooser, AbstractGraphicsDevice device) { return null; } public GLDrawable createGLDrawable(NativeWindow target, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser) { + NWCapabilities capabilities, + NWCapabilitiesChooser chooser) { if (target == null) { throw new IllegalArgumentException("Null target"); } target = NativeWindowFactory.getNativeWindow(target); if (capabilities == null) { - capabilities = new GLCapabilities(); + capabilities = new NWCapabilities(); } if (chooser == null) { - chooser = new DefaultGLCapabilitiesChooser(); + chooser = new DefaultNWCapabilitiesChooser(); } return new MacOSXOnscreenCGLDrawable(this, target, capabilities, chooser); } - public GLDrawableImpl createOffscreenDrawable(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, + public GLDrawableImpl createOffscreenDrawable(NWCapabilities capabilities, + NWCapabilitiesChooser chooser, int width, int height) { return new MacOSXOffscreenCGLDrawable(this, capabilities, width, height); @@ -83,8 +84,8 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { return true; } - public GLPbuffer createGLPbuffer(final GLCapabilities capabilities, - final GLCapabilitiesChooser chooser, + public GLPbuffer createGLPbuffer(final NWCapabilities capabilities, + final NWCapabilitiesChooser chooser, final int initialWidth, final int initialHeight, final GLContext shareWith) { diff --git a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java index a825e1c1e..aaaf38277 100644 --- a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java @@ -39,13 +39,14 @@ package com.sun.opengl.impl.macosx.cgl; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; public class MacOSXOffscreenCGLDrawable extends MacOSXPbufferCGLDrawable { public MacOSXOffscreenCGLDrawable(GLDrawableFactory factory, - GLCapabilities capabilities, + NWCapabilities capabilities, int width, int height) { super(factory, capabilities, width, height); diff --git a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java index 1165e759d..0767f40ee 100644 --- a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java +++ b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java @@ -41,6 +41,7 @@ package com.sun.opengl.impl.macosx.cgl; import java.util.*; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; diff --git a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java index 6a42700f3..e17eee602 100644 --- a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java @@ -43,6 +43,7 @@ import java.lang.ref.WeakReference; import java.security.*; import java.util.*; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; @@ -51,8 +52,8 @@ public class MacOSXOnscreenCGLDrawable extends MacOSXCGLDrawable { new ArrayList(); protected MacOSXOnscreenCGLDrawable(GLDrawableFactory factory, NativeWindow component, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser) { + NWCapabilities capabilities, + NWCapabilitiesChooser chooser) { super(factory, component, false, capabilities, chooser); } diff --git a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java index b128cfcbe..f927731eb 100644 --- a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java +++ b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java @@ -3,6 +3,7 @@ package com.sun.opengl.impl.macosx.cgl; import java.security.*; import java.util.*; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; @@ -80,7 +81,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { // Initialize render-to-texture support if requested GL gl = getGL(); - boolean rect = gl.isGL2() && drawable.getRequestedGLCapabilities().getPbufferRenderToTextureRectangle(); + boolean rect = gl.isGL2() && drawable.getRequestedNWCapabilities().getPbufferRenderToTextureRectangle(); if (rect) { if (!gl.isExtensionAvailable("GL_EXT_texture_rectangle")) { System.err.println("MacOSXPbufferCGLContext: WARNING: GL_EXT_texture_rectangle extension not " + @@ -135,7 +136,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { } protected boolean create() { - GLCapabilities capabilities = drawable.getRequestedGLCapabilities(); + NWCapabilities capabilities = drawable.getRequestedNWCapabilities(); if (capabilities.getPbufferFloatingPointBuffers() && !isTigerOrLater) { throw new GLException("Floating-point pbuffers supported only on OS X 10.4 or later"); @@ -210,7 +211,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { // NSOpenGLContext-based implementation class NSOpenGLImpl implements Impl { public long create() { - GLCapabilities capabilities = drawable.getRequestedGLCapabilities(); + NWCapabilities capabilities = drawable.getRequestedNWCapabilities(); if (capabilities.getPbufferFloatingPointBuffers() && !isTigerOrLater) { throw new GLException("Floating-point pbuffers supported only on OS X 10.4 or later"); @@ -265,7 +266,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { int[] attrs = new int[256]; int i = 0; attrs[i++] = CGL.kCGLPFAPBuffer; - GLCapabilities capabilities = drawable.getRequestedGLCapabilities(); + NWCapabilities capabilities = drawable.getRequestedNWCapabilities(); if (capabilities.getPbufferFloatingPointBuffers()) attrs[i++] = CGL.kCGLPFAColorFloat; if (capabilities.getDoubleBuffered()) diff --git a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java index 067e9d903..b7384798f 100644 --- a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java @@ -39,6 +39,7 @@ package com.sun.opengl.impl.macosx.cgl; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; @@ -55,7 +56,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { // semantic is that contains an NSView protected long pBuffer; - public MacOSXPbufferCGLDrawable(GLDrawableFactory factory, GLCapabilities capabilities, int width, int height) { + public MacOSXPbufferCGLDrawable(GLDrawableFactory factory, NWCapabilities capabilities, int width, int height) { super(factory, new NullWindow(), true, capabilities, null); NullWindow nw = (NullWindow) getNativeWindow(); nw.setSize(width, height); @@ -88,7 +89,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { private void createPbuffer() { NullWindow nw = (NullWindow) getNativeWindow(); int renderTarget; - GLCapabilities capabilities = getRequestedGLCapabilities(); + NWCapabilities capabilities = getRequestedNWCapabilities(); if (GLProfile.isGL2() && capabilities.getPbufferRenderToTextureRectangle()) { renderTarget = GL2.GL_TEXTURE_RECTANGLE; } else { diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java index 85447f00b..888e70ac1 100644 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java @@ -39,6 +39,7 @@ package com.sun.opengl.impl.windows.wgl; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; @@ -46,7 +47,7 @@ public class WindowsDummyWGLDrawable extends WindowsWGLDrawable { private long hwnd, hdc; public WindowsDummyWGLDrawable(GLDrawableFactory factory) { - super(factory, new NullWindow(), true, new GLCapabilities(), null); + super(factory, new NullWindow(), true, new NWCapabilities(), null); // All entries to CreateDummyWindow must synchronize on one object // to avoid accidentally registering the dummy window class twice synchronized (WindowsDummyWGLDrawable.class) { @@ -56,7 +57,7 @@ public class WindowsDummyWGLDrawable extends WindowsWGLDrawable { NullWindow nw = (NullWindow) getNativeWindow(); nw.setSurfaceHandle(hdc); // Choose a (hopefully hardware-accelerated) OpenGL pixel format for this device context - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); caps.setDepthBits(16); PIXELFORMATDESCRIPTOR pfd = glCapabilities2PFD(caps, true); int pixelFormat = WGL.ChoosePixelFormat(hdc, pfd); diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java index 826acc613..0514e1aec 100755 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java @@ -39,13 +39,14 @@ package com.sun.opengl.impl.windows.wgl; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; public class WindowsExternalWGLDrawable extends WindowsWGLDrawable { public WindowsExternalWGLDrawable(GLDrawableFactory factory, NativeWindow component) { - super(factory, component, true, new GLCapabilities(), null); + super(factory, component, true, new NWCapabilities(), null); } public static WindowsExternalWGLDrawable create(GLDrawableFactory factory) { diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java index 03b52be9f..97041ff06 100644 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java @@ -39,6 +39,7 @@ package com.sun.opengl.impl.windows.wgl; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; @@ -47,8 +48,8 @@ public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable { private long hbitmap; public WindowsOffscreenWGLDrawable(GLDrawableFactory factory, - GLCapabilities requestedCapabilities, - GLCapabilitiesChooser chooser, + NWCapabilities requestedCapabilities, + NWCapabilitiesChooser chooser, int width, int height) { super(factory, new NullWindow(), true, requestedCapabilities, chooser); @@ -62,7 +63,7 @@ public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable { private void create() { NullWindow nw = (NullWindow) getNativeWindow(); - GLCapabilities capabilities = getRequestedGLCapabilities(); + NWCapabilities capabilities = getRequestedNWCapabilities(); int width = getWidth(); int height = getHeight(); BITMAPINFO info = BITMAPINFO.create(); @@ -120,7 +121,7 @@ public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable { origbitmap = 0; hbitmap = 0; nw.setSurfaceHandle(0); - setChosenGLCapabilities(null); + setChosenNWCapabilities(null); } } } diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java index 02459f590..7eb96c7dc 100644 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java @@ -41,6 +41,7 @@ package com.sun.opengl.impl.windows.wgl; import java.util.*; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLDrawable.java index 52812f0e9..7c3cea255 100644 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLDrawable.java @@ -39,6 +39,7 @@ package com.sun.opengl.impl.windows.wgl; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; @@ -53,8 +54,8 @@ public class WindowsOnscreenWGLDrawable extends WindowsWGLDrawable { private long profilingSwapBuffersTime; protected WindowsOnscreenWGLDrawable(GLDrawableFactory factory, NativeWindow component, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser) { + NWCapabilities capabilities, + NWCapabilitiesChooser chooser) { super(factory, component, false, capabilities, chooser); } diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java index ac3a5d5c8..e975670b4 100644 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java @@ -39,6 +39,7 @@ package com.sun.opengl.impl.windows.wgl; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; @@ -62,7 +63,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext { public void bindPbufferToTexture() { if (!rtt) { throw new GLException("Shouldn't try to bind a pbuffer to a texture if render-to-texture hasn't been " + - "specified in its GLCapabilities"); + "specified in its NWCapabilities"); } GL gl = getGL(); WGLExt wglExt = getWGLExt(); @@ -80,7 +81,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext { public void releasePbufferFromTexture() { if (!rtt) { throw new GLException("Shouldn't try to bind a pbuffer to a texture if render-to-texture hasn't been " + - "specified in its GLCapabilities"); + "specified in its NWCapabilities"); } if (rtt && hasRTT) { WGLExt wglExt = getWGLExt(); @@ -96,7 +97,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext { System.err.println("WindowsPbufferWGLContext: super.makeCurrentImpl() = " + res); } if (res == CONTEXT_CURRENT_NEW) { - GLCapabilities capabilities = drawable.getRequestedGLCapabilities(); + NWCapabilities capabilities = drawable.getRequestedNWCapabilities(); // Initialize render-to-texture support if requested GL gl = getGL(); diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java index 076031093..74e7c1a85 100644 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java @@ -39,6 +39,7 @@ package com.sun.opengl.impl.windows.wgl; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; @@ -51,7 +52,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { private int floatMode; public WindowsPbufferWGLDrawable(GLDrawableFactory factory, - GLCapabilities requestedCapabilities, + NWCapabilities requestedCapabilities, int width, int height, WindowsWGLDrawable dummyDrawable, @@ -94,7 +95,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { throw new GLException("Error destroying pbuffer: error code " + WGL.GetLastError()); } buffer = 0; - setChosenGLCapabilities(null); + setChosenNWCapabilities(null); } } @@ -124,8 +125,8 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { } // This is public to allow access from PbufferContext - public GLCapabilities getRequestedGLCapabilities() { - return super.getRequestedGLCapabilities(); + public NWCapabilities getRequestedNWCapabilities() { + return super.getRequestedNWCapabilities(); } private void createPbuffer(long parentHdc, WGLExt wglExt) { @@ -135,7 +136,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { int niattribs = 0; int width, height; - GLCapabilities capabilities = getRequestedGLCapabilities(); + NWCapabilities capabilities = getRequestedNWCapabilities(); if (DEBUG) { System.out.println("Pbuffer parentHdc = " + toHexString(parentHdc)); @@ -307,7 +308,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { int[] ivalues = new int[niattribs]; // FIXME: usually prefer to throw exceptions, but failure here is not critical if (wglExt.wglGetPixelFormatAttribiv(parentHdc, pformats[whichFormat], 0, niattribs, iattributes, 0, ivalues, 0)) { - setChosenGLCapabilities(iattributes2GLCapabilities(iattributes, niattribs, ivalues, false)); + setChosenNWCapabilities(iattributes2NWCapabilities(iattributes, niattribs, ivalues, false)); } } diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java index a02634a26..1ce190da3 100644 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java @@ -41,6 +41,7 @@ package com.sun.opengl.impl.windows.wgl; import java.nio.*; import java.util.*; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; import com.sun.gluegen.runtime.ProcAddressTable; diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java index c8965e0db..430270e37 100644 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java @@ -39,13 +39,14 @@ package com.sun.opengl.impl.windows.wgl; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; public abstract class WindowsWGLDrawable extends GLDrawableImpl { protected static final boolean DEBUG = Debug.debug("WindowsWGLDrawable"); - protected GLCapabilitiesChooser chooser; + protected NWCapabilitiesChooser chooser; protected boolean pixelFormatChosen; // Workaround for problems on Intel 82855 cards @@ -56,8 +57,8 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { protected static final int MAX_ATTRIBS = 256; public WindowsWGLDrawable(GLDrawableFactory factory, NativeWindow comp, boolean realized, - GLCapabilities requestedCapabilities, - GLCapabilitiesChooser chooser) { + NWCapabilities requestedCapabilities, + NWCapabilitiesChooser chooser) { super(factory, comp, requestedCapabilities, realized); this.chooser = chooser; } @@ -89,7 +90,7 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { } return NativeWindow.LOCK_SURFACE_NOT_READY; } else { - // Probably a user error in the GLCapabilitiesChooser or similar. + // Probably a user error in the NWCapabilitiesChooser or similar. // Don't propagate non-GLExceptions out because calling code // expects to catch only that exception type throw new GLException(e); @@ -103,8 +104,8 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { protected void choosePixelFormat(boolean onscreen) { PIXELFORMATDESCRIPTOR pfd = null; int pixelFormat = 0; - GLCapabilities chosenCaps = null; - GLCapabilities capabilities = getRequestedGLCapabilities(); + NWCapabilities chosenCaps = null; + NWCapabilities capabilities = getRequestedNWCapabilities(); long hdc = getNativeWindow().getSurfaceHandle(); if (onscreen) { if ((pixelFormat = WGL.GetPixelFormat(hdc)) != 0) { @@ -120,15 +121,15 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { throw new GLException("Unable to describe pixel format " + pixelFormat + " of window set by Java2D/OpenGL pipeline"); } - setChosenGLCapabilities(pfd2GLCapabilities(pfd)); + setChosenNWCapabilities(pfd2NWCapabilities(pfd)); pixelFormatChosen = true; return; } - GLCapabilities[] availableCaps = null; + NWCapabilities[] availableCaps = null; int numFormats = 0; pfd = newPixelFormatDescriptor(); - // Produce a recommended pixel format selection for the GLCapabilitiesChooser. + // Produce a recommended pixel format selection for the NWCapabilitiesChooser. // Use wglChoosePixelFormatARB if user requested multisampling and if we have it available WindowsWGLDrawable dummyDrawable = null; GLContextImpl dummyContext = null; @@ -186,17 +187,17 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { if (recommendedPixelFormat < 0) { System.err.print(getThreadName() + ": wglChoosePixelFormatARB didn't recommend a pixel format"); if (capabilities.getSampleBuffers()) { - System.err.print(" for multisampled GLCapabilities"); + System.err.print(" for multisampled NWCapabilities"); } System.err.println(); } } - // Produce a list of GLCapabilities to give to the - // GLCapabilitiesChooser. + // Produce a list of NWCapabilities to give to the + // NWCapabilitiesChooser. // Use wglGetPixelFormatAttribivARB instead of // DescribePixelFormat to get higher-precision information - // about the pixel format (should make the GLCapabilities + // about the pixel format (should make the NWCapabilities // more precise as well...i.e., remove the // "HardwareAccelerated" bit, which is basically // meaningless, and put in whether it can render to a @@ -212,7 +213,7 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { // Should we be filtering out the pixel formats which aren't // applicable, as we are doing here? - // We don't have enough information in the GLCapabilities to + // We don't have enough information in the NWCapabilities to // represent those that aren't... iattributes[niattribs++] = WGLExt.WGL_DRAW_TO_WINDOW; iattributes[niattribs++] = WGLExt.WGL_ACCELERATION; @@ -235,12 +236,12 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { iattributes[niattribs++] = WGLExt.WGL_SAMPLES; } - availableCaps = new GLCapabilities[numFormats]; + availableCaps = new NWCapabilities[numFormats]; for (int i = 0; i < numFormats; i++) { if (!dummyWGLExt.wglGetPixelFormatAttribiv(hdc, i+1, 0, niattribs, iattributes, 0, iresults, 0)) { throw new GLException("Error getting pixel format attributes for pixel format " + (i + 1) + " of device context"); } - availableCaps[i] = iattributes2GLCapabilities(iattributes, niattribs, iresults, true); + availableCaps[i] = iattributes2NWCapabilities(iattributes, niattribs, iresults, true); } gotAvailableCaps = true; } else { @@ -278,19 +279,19 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { numFormats = WGL.DescribePixelFormat(hdc, 1, 0, null); if (numFormats == 0) { throw new GLException("Unable to enumerate pixel formats of window " + - toHexString(hdc) + " for GLCapabilitiesChooser"); + toHexString(hdc) + " for NWCapabilitiesChooser"); } - availableCaps = new GLCapabilities[numFormats]; + availableCaps = new NWCapabilities[numFormats]; for (int i = 0; i < numFormats; i++) { if (WGL.DescribePixelFormat(hdc, 1 + i, pfd.size(), pfd) == 0) { throw new GLException("Error describing pixel format " + (1 + i) + " of device context"); } - availableCaps[i] = pfd2GLCapabilities(pfd); + availableCaps[i] = pfd2NWCapabilities(pfd); } } // NOTE: officially, should make a copy of all of these - // GLCapabilities to avoid mutation by the end user during the + // NWCapabilities to avoid mutation by the end user during the // chooseCapabilities call, but for the time being, assume they // won't be changed @@ -298,7 +299,7 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { pixelFormat = chooser.chooseCapabilities(capabilities, availableCaps, recommendedPixelFormat); if ((pixelFormat < 0) || (pixelFormat >= numFormats)) { throw new GLException("Invalid result " + pixelFormat + - " from GLCapabilitiesChooser (should be between 0 and " + + " from NWCapabilitiesChooser (should be between 0 and " + (numFormats - 1) + ")"); } if (DEBUG) { @@ -326,19 +327,19 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { } throw new GLException("Unable to set pixel format " + pixelFormat + " for device context " + toHexString(hdc) + ": error code " + lastError); } - // Reuse the previously-constructed GLCapabilities because it + // Reuse the previously-constructed NWCapabilities because it // turns out that using DescribePixelFormat on some pixel formats // (which, for example, support full-scene antialiasing) for some // reason return that they are not OpenGL-capable if (chosenCaps != null) { - setChosenGLCapabilities(chosenCaps); + setChosenNWCapabilities(chosenCaps); } else { - setChosenGLCapabilities(pfd2GLCapabilities(pfd)); + setChosenNWCapabilities(pfd2NWCapabilities(pfd)); } pixelFormatChosen = true; } - protected static PIXELFORMATDESCRIPTOR glCapabilities2PFD(GLCapabilities caps, boolean onscreen) { + protected static PIXELFORMATDESCRIPTOR glCapabilities2PFD(NWCapabilities caps, boolean onscreen) { int colorDepth = (caps.getRedBits() + caps.getGreenBits() + caps.getBlueBits()); @@ -387,11 +388,11 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { return pfd; } - protected static GLCapabilities pfd2GLCapabilities(PIXELFORMATDESCRIPTOR pfd) { + protected static NWCapabilities pfd2NWCapabilities(PIXELFORMATDESCRIPTOR pfd) { if ((pfd.dwFlags() & WGL.PFD_SUPPORT_OPENGL) == 0) { return null; } - GLCapabilities res = new GLCapabilities(); + NWCapabilities res = new NWCapabilities(); res.setRedBits (pfd.cRedBits()); res.setGreenBits (pfd.cGreenBits()); res.setBlueBits (pfd.cBlueBits()); @@ -409,7 +410,7 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { return res; } - protected static boolean glCapabilities2iattributes(GLCapabilities capabilities, + protected static boolean glCapabilities2iattributes(NWCapabilities capabilities, int[] iattributes, WGLExt wglExt, boolean pbuffer, @@ -531,7 +532,7 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { } else { if (!rtt) { // Currently we don't support non-truecolor visuals in the - // GLCapabilities, so we don't offer the option of making + // NWCapabilities, so we don't offer the option of making // color-index pbuffers. iattributes[niattribs++] = WGLExt.WGL_PIXEL_TYPE; iattributes[niattribs++] = WGLExt.WGL_TYPE_RGBA; @@ -564,11 +565,11 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { return true; } - protected static GLCapabilities iattributes2GLCapabilities(int[] iattribs, + protected static NWCapabilities iattributes2NWCapabilities(int[] iattribs, int niattribs, int[] iresults, boolean requireRenderToWindow) { - GLCapabilities res = new GLCapabilities(); + NWCapabilities res = new NWCapabilities(); for (int i = 0; i < niattribs; i++) { int attr = iattribs[i]; switch (attr) { diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java index 4fe0900a6..0911a2988 100644 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java @@ -41,6 +41,7 @@ package com.sun.opengl.impl.windows.wgl; import java.nio.*; import java.util.*; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; import javax.media.opengl.util.BufferUtil; @@ -57,30 +58,30 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { super(); } - public AbstractGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, + public AbstractGraphicsConfiguration chooseGraphicsConfiguration(NWCapabilities capabilities, + NWCapabilitiesChooser chooser, AbstractGraphicsDevice device) { return null; } public GLDrawable createGLDrawable(NativeWindow target, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser) { + NWCapabilities capabilities, + NWCapabilitiesChooser chooser) { if (target == null) { throw new IllegalArgumentException("Null target"); } target = NativeWindowFactory.getNativeWindow(target); if (capabilities == null) { - capabilities = new GLCapabilities(); + capabilities = new NWCapabilities(); } if (chooser == null) { - chooser = new DefaultGLCapabilitiesChooser(); + chooser = new DefaultNWCapabilitiesChooser(); } return new WindowsOnscreenWGLDrawable(this, target, capabilities, chooser); } - public GLDrawableImpl createOffscreenDrawable(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, + public GLDrawableImpl createOffscreenDrawable(NWCapabilities capabilities, + NWCapabilitiesChooser chooser, int width, int height) { return new WindowsOffscreenWGLDrawable(this, capabilities, chooser, width, height); @@ -121,8 +122,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { return canCreateGLPbuffer; } - public GLPbuffer createGLPbuffer(final GLCapabilities capabilities, - final GLCapabilitiesChooser chooser, + public GLPbuffer createGLPbuffer(final NWCapabilities capabilities, + final NWCapabilitiesChooser chooser, final int initialWidth, final int initialHeight, final GLContext shareWith) { diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11ExternalGLXContext.java b/src/classes/com/sun/opengl/impl/x11/glx/X11ExternalGLXContext.java index e4f9f4383..37d49ca44 100755 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11ExternalGLXContext.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11ExternalGLXContext.java @@ -39,6 +39,7 @@ package com.sun.opengl.impl.x11.glx; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; import com.sun.opengl.impl.x11.*; diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11ExternalGLXDrawable.java b/src/classes/com/sun/opengl/impl/x11/glx/X11ExternalGLXDrawable.java index c4dc4c4c0..5496dae90 100755 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11ExternalGLXDrawable.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11ExternalGLXDrawable.java @@ -39,6 +39,7 @@ package com.sun.opengl.impl.x11.glx; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; import com.sun.opengl.impl.x11.*; diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java index 88f11d259..18bb60868 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java @@ -41,6 +41,7 @@ package com.sun.opengl.impl.x11.glx; import java.nio.*; import java.util.*; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; import com.sun.opengl.impl.x11.*; diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java index 96e2d897f..c38c630b7 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java @@ -39,6 +39,7 @@ package com.sun.opengl.impl.x11.glx; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; import com.sun.opengl.impl.x11.*; @@ -46,11 +47,11 @@ import com.sun.opengl.impl.x11.*; public abstract class X11GLXDrawable extends GLDrawableImpl { protected static final boolean DEBUG = Debug.debug("X11GLXDrawable"); - protected GLCapabilitiesChooser chooser; + protected NWCapabilitiesChooser chooser; protected X11GLXDrawable(GLDrawableFactory factory, NativeWindow comp, boolean realized, - GLCapabilities requestedCapabilities, - GLCapabilitiesChooser chooser) { + NWCapabilities requestedCapabilities, + NWCapabilitiesChooser chooser) { super(factory, comp, requestedCapabilities, realized); this.chooser = chooser; } @@ -104,24 +105,24 @@ public abstract class X11GLXDrawable extends GLDrawableImpl { XVisualInfo template = XVisualInfo.create(); template.screen(screen); XVisualInfo[] infos = null; - GLCapabilities[] caps = null; + NWCapabilities[] caps = null; getFactoryImpl().lockToolkit(); try { infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualScreenMask, template, count, 0); if (infos == null) { throw new GLException("Error while enumerating available XVisualInfos"); } - caps = new GLCapabilities[infos.length]; + caps = new NWCapabilities[infos.length]; for (int i = 0; i < infos.length; i++) { - caps[i] = ((X11GLXDrawableFactory)getFactory()).xvi2GLCapabilities(display, infos[i]); + caps[i] = ((X11GLXDrawableFactory)getFactory()).xvi2NWCapabilities(display, infos[i]); } } finally { getFactoryImpl().unlockToolkit(); } - GLCapabilities capabilities = getRequestedGLCapabilities(); + NWCapabilities capabilities = getRequestedNWCapabilities(); int chosen = chooser.chooseCapabilities(capabilities, caps, -1); if (chosen < 0 || chosen >= caps.length) { - throw new GLException("GLCapabilitiesChooser specified invalid index (expected 0.." + (caps.length - 1) + ")"); + throw new GLException("NWCapabilitiesChooser specified invalid index (expected 0.." + (caps.length - 1) + ")"); } if (DEBUG) { System.err.println("Chosen visual (" + chosen + "):"); @@ -129,7 +130,7 @@ public abstract class X11GLXDrawable extends GLDrawableImpl { } vis = infos[chosen]; if (vis == null) { - throw new GLException("GLCapabilitiesChooser chose an invalid visual"); + throw new GLException("NWCapabilitiesChooser chose an invalid visual"); } // FIXME: the storage for the infos array is leaked (should // clean it up somehow when we're done with the visual we're diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java index 9ee93793a..af7030272 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java @@ -39,6 +39,7 @@ package com.sun.opengl.impl.x11.glx; import java.nio.*; import java.security.*; import java.util.*; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.gluegen.runtime.*; import com.sun.gluegen.runtime.opengl.*; @@ -48,7 +49,7 @@ import com.sun.opengl.impl.x11.*; public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { protected static final boolean DEBUG = Debug.debug("X11GLXDrawableFactory"); - // Map for rediscovering the GLCapabilities associated with a + // Map for rediscovering the NWCapabilities associated with a // particular screen and visualID after the fact protected static Map visualToGLCapsMap = Collections.synchronizedMap(new HashMap()); // The screens for which we've already initialized it @@ -91,15 +92,15 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { private static final int MAX_ATTRIBS = 128; - public AbstractGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, + public AbstractGraphicsConfiguration chooseGraphicsConfiguration(NWCapabilities capabilities, + NWCapabilitiesChooser chooser, AbstractGraphicsDevice absDevice) { return null; } public GLDrawable createGLDrawable(NativeWindow target, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser) { + NWCapabilities capabilities, + NWCapabilitiesChooser chooser) { if (target == null) { throw new IllegalArgumentException("Null target"); } @@ -107,9 +108,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return new X11OnscreenGLXDrawable(this, target); } - public void initializeVisualToGLCapabilitiesMap(int screen, + public void initializeVisualToNWCapabilitiesMap(int screen, XVisualInfo[] infos, - GLCapabilities[] caps) { + NWCapabilities[] caps) { Integer key = new Integer(screen); if (!initializedScreenSet.contains(key)) { for (int i = 0; i < infos.length; i++) { @@ -122,13 +123,13 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } } - public GLCapabilities lookupCapabilitiesByScreenAndVisualID(int screenIndex, + public NWCapabilities lookupCapabilitiesByScreenAndVisualID(int screenIndex, long visualID) { - return (GLCapabilities) visualToGLCapsMap.get(new ScreenAndVisualIDKey(screenIndex, visualID)); + return (NWCapabilities) visualToGLCapsMap.get(new ScreenAndVisualIDKey(screenIndex, visualID)); } - public GLDrawableImpl createOffscreenDrawable(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, + public GLDrawableImpl createOffscreenDrawable(NWCapabilities capabilities, + NWCapabilitiesChooser chooser, int width, int height) { return new X11OffscreenGLXDrawable(this, capabilities, chooser, width, height); @@ -178,8 +179,8 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return canCreateGLPbuffer; } - public GLPbuffer createGLPbuffer(final GLCapabilities capabilities, - final GLCapabilitiesChooser chooser, + public GLPbuffer createGLPbuffer(final NWCapabilities capabilities, + final NWCapabilitiesChooser chooser, final int initialWidth, final int initialHeight, final GLContext shareWith) { @@ -227,7 +228,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return res; } - public GLCapabilities xvi2GLCapabilities(long display, XVisualInfo info) { + public NWCapabilities xvi2NWCapabilities(long display, XVisualInfo info) { int[] tmp = new int[1]; int val = glXGetConfig(display, info, GLX.GLX_USE_GL, tmp, 0); if (val == 0) { @@ -239,12 +240,12 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { // Visual does not support RGBA return null; } - GLCapabilities res = new GLCapabilities(); + NWCapabilities res = new NWCapabilities(); res.setDoubleBuffered(glXGetConfig(display, info, GLX.GLX_DOUBLEBUFFER, tmp, 0) != 0); res.setStereo (glXGetConfig(display, info, GLX.GLX_STEREO, tmp, 0) != 0); // Note: use of hardware acceleration is determined by // glXCreateContext, not by the XVisualInfo. Optimistically claim - // that all GLCapabilities have the capability to be hardware + // that all NWCapabilities have the capability to be hardware // accelerated. res.setHardwareAccelerated(true); res.setDepthBits (glXGetConfig(display, info, GLX.GLX_DEPTH_SIZE, tmp, 0)); @@ -264,7 +265,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return res; } - public static int[] glCapabilities2AttribList(GLCapabilities caps, + public static int[] glCapabilities2AttribList(NWCapabilities caps, boolean isMultisampleAvailable, boolean pbuffer, long display, @@ -354,11 +355,11 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return res; } - public static GLCapabilities attribList2GLCapabilities(int[] iattribs, + public static NWCapabilities attribList2NWCapabilities(int[] iattribs, int niattribs, int[] ivalues, boolean pbuffer) { - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); for (int i = 0; i < niattribs; i++) { int attr = iattribs[i]; diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXNativeWindowFactory.java b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXNativeWindowFactory.java index 98ade1c06..ede59b349 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXNativeWindowFactory.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXNativeWindowFactory.java @@ -32,6 +32,7 @@ package com.sun.opengl.impl.x11.glx; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; @@ -44,8 +45,8 @@ import com.sun.opengl.impl.x11.*; abstractions. */ public class X11GLXNativeWindowFactory extends NativeWindowFactoryImpl { - public AbstractGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, + public AbstractGraphicsConfiguration chooseGraphicsConfiguration(NWCapabilities capabilities, + NWCapabilitiesChooser chooser, AbstractGraphicsDevice absDevice) { if (absDevice != null && !(absDevice instanceof X11GraphicsDevice)) { @@ -62,14 +63,14 @@ public class X11GLXNativeWindowFactory extends NativeWindowFactoryImpl { } /** Returns the visual ID of the chosen GraphicsConfiguration. */ - protected long chooseGraphicsConfigurationImpl(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, + protected long chooseGraphicsConfigurationImpl(NWCapabilities capabilities, + NWCapabilitiesChooser chooser, int screen) { if (capabilities == null) { - capabilities = new GLCapabilities(); + capabilities = new NWCapabilities(); } if (chooser == null) { - chooser = new DefaultGLCapabilitiesChooser(); + chooser = new DefaultNWCapabilitiesChooser(); } if (X11Util.isXineramaEnabled()) { @@ -82,7 +83,7 @@ public class X11GLXNativeWindowFactory extends NativeWindowFactoryImpl { int[] attribs = X11GLXDrawableFactory.glCapabilities2AttribList(capabilities, X11Util.isMultisampleAvailable(), false, 0, 0); XVisualInfo[] infos = null; - GLCapabilities[] caps = null; + NWCapabilities[] caps = null; int recommendedIndex = -1; getDefaultFactory().getToolkitLock().lock(); try { @@ -103,9 +104,9 @@ public class X11GLXNativeWindowFactory extends NativeWindowFactoryImpl { if (infos == null) { throw new GLException("Error while enumerating available XVisualInfos"); } - caps = new GLCapabilities[infos.length]; + caps = new NWCapabilities[infos.length]; for (int i = 0; i < infos.length; i++) { - caps[i] = ((X11GLXDrawableFactory) GLDrawableFactory.getFactory()).xvi2GLCapabilities(display, infos[i]); + caps[i] = ((X11GLXDrawableFactory) GLDrawableFactory.getFactory()).xvi2NWCapabilities(display, infos[i]); // Attempt to find the visual chosen by glXChooseVisual if (recommendedVis != null && recommendedVis.visualid() == infos[i].visualid()) { recommendedIndex = i; @@ -116,14 +117,14 @@ public class X11GLXNativeWindowFactory extends NativeWindowFactoryImpl { } // Store these away for later ((X11GLXDrawableFactory) GLDrawableFactory.getFactory()). - initializeVisualToGLCapabilitiesMap(screen, infos, caps); + initializeVisualToNWCapabilitiesMap(screen, infos, caps); int chosen = chooser.chooseCapabilities(capabilities, caps, recommendedIndex); if (chosen < 0 || chosen >= caps.length) { - throw new GLException("GLCapabilitiesChooser specified invalid index (expected 0.." + (caps.length - 1) + ")"); + throw new GLException("NWCapabilitiesChooser specified invalid index (expected 0.." + (caps.length - 1) + ")"); } XVisualInfo vis = infos[chosen]; if (vis == null) { - throw new GLException("GLCapabilitiesChooser chose an invalid visual"); + throw new GLException("NWCapabilitiesChooser chose an invalid visual"); } return vis.visualid(); } diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java b/src/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java index d0d03d06b..68c775323 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java @@ -39,6 +39,7 @@ package com.sun.opengl.impl.x11.glx; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; import com.sun.opengl.impl.x11.*; @@ -48,8 +49,8 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable { private boolean isDoubleBuffered; protected X11OffscreenGLXDrawable(GLDrawableFactory factory, - GLCapabilities requestedCapabilities, - GLCapabilitiesChooser chooser, + NWCapabilities requestedCapabilities, + NWCapabilitiesChooser chooser, int width, int height) { super(factory, new NullWindow(), true, requestedCapabilities, chooser); @@ -90,7 +91,7 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable { ", GLXPixmap " + toHexString(drawable) + ", display " + toHexString(dpy)); } - setChosenGLCapabilities(((X11GLXDrawableFactory)getFactory()).xvi2GLCapabilities(dpy, vis)); + setChosenNWCapabilities(((X11GLXDrawableFactory)getFactory()).xvi2NWCapabilities(dpy, vis)); } finally { getFactoryImpl().unlockToolkit(); } @@ -129,7 +130,7 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable { drawable = 0; pixmap = 0; display = 0; - setChosenGLCapabilities(null); + setChosenNWCapabilities(null); } finally { getFactoryImpl().unlockToolkit(); } diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java b/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java index f1743a8b4..ed6b4018e 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java @@ -41,6 +41,7 @@ package com.sun.opengl.impl.x11.glx; import java.util.*; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; import com.sun.opengl.impl.x11.*; @@ -60,10 +61,10 @@ public class X11OnscreenGLXContext extends X11GLXContext { protected int makeCurrentImpl() throws GLException { int lockRes = drawable.lockSurface(); - if (drawable.getChosenGLCapabilities() == null) { + if (drawable.getChosenNWCapabilities() == null) { X11GLXDrawableFactory factory = (X11GLXDrawableFactory) drawable.getFactory(); NativeWindow window = drawable.getNativeWindow(); - drawable.setChosenGLCapabilities(factory.lookupCapabilitiesByScreenAndVisualID(window.getScreenIndex(), + drawable.setChosenNWCapabilities(factory.lookupCapabilitiesByScreenAndVisualID(window.getScreenIndex(), window.getVisualID())); } boolean exceptionOccurred = false; diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java b/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java index ac228b68a..ee92b82f2 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java @@ -39,6 +39,7 @@ package com.sun.opengl.impl.x11.glx; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; import com.sun.opengl.impl.x11.*; @@ -78,15 +79,15 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable { } // This is public to allow access from the DrawableFactory - protected void setChosenGLCapabilities(GLCapabilities caps) { - super.setChosenGLCapabilities(caps); + protected void setChosenNWCapabilities(NWCapabilities caps) { + super.setChosenNWCapabilities(caps); } public void setRealized(boolean realized) { if (realized) { X11GLXDrawableFactory factory = (X11GLXDrawableFactory) getFactory(); NativeWindow window = getNativeWindow(); - setChosenGLCapabilities(factory.lookupCapabilitiesByScreenAndVisualID(window.getScreenIndex(), + setChosenNWCapabilities(factory.lookupCapabilitiesByScreenAndVisualID(window.getScreenIndex(), window.getVisualID())); } super.setRealized(realized); diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXContext.java b/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXContext.java index a32ee99d7..831fef9fc 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXContext.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXContext.java @@ -39,6 +39,7 @@ package com.sun.opengl.impl.x11.glx; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; import com.sun.opengl.impl.x11.*; diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java b/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java index d720fe7e8..0803075f9 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java @@ -39,6 +39,7 @@ package com.sun.opengl.impl.x11.glx; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; import com.sun.opengl.impl.x11.*; @@ -53,7 +54,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { protected static final int MAX_ATTRIBS = 256; protected X11PbufferGLXDrawable(GLDrawableFactory factory, - GLCapabilities requestedCapabilities, + NWCapabilities requestedCapabilities, int width, int height) { super(factory, new NullWindow(), true, requestedCapabilities, null); if (width <= 0 || height <= 0) { @@ -103,7 +104,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { int screen = X11Lib.DefaultScreen(display); nw.setScreenIndex(screen); - GLCapabilities capabilities = getRequestedGLCapabilities(); + NWCapabilities capabilities = getRequestedNWCapabilities(); if (capabilities.getPbufferRenderToTexture()) { throw new GLException("Render-to-texture pbuffers not supported yet on X11"); @@ -171,7 +172,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { int samplesAttrib = X11Util.isMultisampleAvailable() ? GLX.GLX_SAMPLES: GLX.GLX_RED_SIZE; int floatNV = capabilities.getPbufferFloatingPointBuffers() ? GLXExt.GLX_FLOAT_COMPONENTS_NV : GLX.GLX_RED_SIZE; - // Query the fbconfig to determine its GLCapabilities + // Query the fbconfig to determine its NWCapabilities int[] iattribs = { GLX.GLX_DOUBLEBUFFER, GLX.GLX_STEREO, @@ -192,7 +193,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { int[] ivalues = new int[iattribs.length]; queryFBConfig(display, fbConfig, iattribs, iattribs.length, ivalues); - setChosenGLCapabilities(X11GLXDrawableFactory.attribList2GLCapabilities(iattribs, iattribs.length, ivalues, true)); + setChosenNWCapabilities(X11GLXDrawableFactory.attribList2NWCapabilities(iattribs, iattribs.length, ivalues, true)); // Determine the actual width and height we were able to create. int[] tmp = new int[1]; diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11Util.java b/src/classes/com/sun/opengl/impl/x11/glx/X11Util.java index 480c607a4..3f2c4fe75 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11Util.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11Util.java @@ -32,6 +32,7 @@ package com.sun.opengl.impl.x11.glx; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; diff --git a/src/classes/com/sun/opengl/impl/x11/glx/awt/X11AWTGLXNativeWindowFactory.java b/src/classes/com/sun/opengl/impl/x11/glx/awt/X11AWTGLXNativeWindowFactory.java index 11da7af05..50a246706 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/awt/X11AWTGLXNativeWindowFactory.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/awt/X11AWTGLXNativeWindowFactory.java @@ -35,6 +35,7 @@ package com.sun.opengl.impl.x11.glx.awt; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; +import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.awt.*; @@ -45,8 +46,8 @@ import com.sun.opengl.impl.x11.*; import com.sun.opengl.impl.x11.glx.*; public class X11AWTGLXNativeWindowFactory extends X11GLXNativeWindowFactory { - public AbstractGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, + public AbstractGraphicsConfiguration chooseGraphicsConfiguration(NWCapabilities capabilities, + NWCapabilitiesChooser chooser, AbstractGraphicsDevice absDevice) { GraphicsDevice device = null; if (absDevice != null && diff --git a/src/classes/com/sun/opengl/util/awt/TextRenderer.java b/src/classes/com/sun/opengl/util/awt/TextRenderer.java index 6c9aa578b..4e80dfaa4 100755 --- a/src/classes/com/sun/opengl/util/awt/TextRenderer.java +++ b/src/classes/com/sun/opengl/util/awt/TextRenderer.java @@ -66,6 +66,7 @@ import java.text.*; import java.util.*; +import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.glu.*; import javax.media.opengl.glu.gl2.*; @@ -901,7 +902,7 @@ public class TextRenderer { private void debug() { dbgFrame = new Frame("TextRenderer Debug Output"); - GLCanvas dbgCanvas = new GLCanvas(new GLCapabilities(), null, + GLCanvas dbgCanvas = new GLCanvas(new NWCapabilities(), null, GLContext.getCurrent(), null); dbgCanvas.addGLEventListener(new DebugListener(dbgFrame)); dbgFrame.add(dbgCanvas); diff --git a/src/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java b/src/classes/javax/media/nwi/DefaultNWCapabilitiesChooser.java index 5147ab8b7..1318ea419 100644 --- a/src/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java +++ b/src/classes/javax/media/nwi/DefaultNWCapabilitiesChooser.java @@ -37,23 +37,21 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl; - -import com.sun.opengl.impl.Debug; +package javax.media.nwi; /** <P> The default implementation of the {@link - GLCapabilitiesChooser} interface, which provides consistent visual + NWCapabilitiesChooser} interface, which provides consistent visual selection behavior across platforms. The precise algorithm is deliberately left loosely specified. Some properties are: </P> <UL> <LI> As long as there is at least one available non-null - GLCapabilities which matches the "stereo" option, will return a + NWCapabilities which matches the "stereo" option, will return a valid index. <LI> Attempts to match as closely as possible the given - GLCapabilities, but will select one with fewer capabilities (i.e., + NWCapabilities, but will select one with fewer capabilities (i.e., lower color depth) if necessary. <LI> Prefers hardware-accelerated visuals to @@ -79,11 +77,11 @@ import com.sun.opengl.impl.Debug; </UL> */ -public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { - private static final boolean DEBUG = Debug.debug("DefaultGLCapabilitiesChooser"); +public class DefaultNWCapabilitiesChooser implements NWCapabilitiesChooser { + private static final boolean DEBUG = false; // FIXME: Debug.debug("DefaultNWCapabilitiesChooser"); - public int chooseCapabilities(GLCapabilities desired, - GLCapabilities[] available, + public int chooseCapabilities(NWCapabilities desired, + NWCapabilities[] available, int windowSystemRecommendedChoice) { if (DEBUG) { System.err.println("Desired: " + desired); @@ -120,7 +118,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { } // Compute score for each for (int i = 0; i < scores.length; i++) { - GLCapabilities cur = available[i]; + NWCapabilities cur = available[i]; if (cur == null) { continue; } @@ -159,7 +157,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { if (score == NO_SCORE) { continue; } - GLCapabilities cur = available[i]; + NWCapabilities cur = available[i]; if (cur.getHardwareAccelerated()) { int absScore = Math.abs(score); if (!gotHW || @@ -175,7 +173,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { if (score == NO_SCORE) { continue; } - GLCapabilities cur = available[i]; + NWCapabilities cur = available[i]; if (!cur.getHardwareAccelerated()) { if (score <= 0) { score -= maxAbsoluteHWScore; @@ -215,7 +213,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { } } if (chosenIndex < 0) { - throw new GLException("Unable to select one of the provided GLCapabilities"); + throw new NativeWindowException("Unable to select one of the provided NWCapabilities"); } if (DEBUG) { System.err.println("Chosen index: " + chosenIndex); diff --git a/src/classes/javax/media/opengl/GLCapabilities.java b/src/classes/javax/media/nwi/NWCapabilities.java index 8f89f605c..cc3ebb77c 100644 --- a/src/classes/javax/media/opengl/GLCapabilities.java +++ b/src/classes/javax/media/nwi/NWCapabilities.java @@ -37,14 +37,14 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl; +package javax.media.nwi; /** Specifies a set of OpenGL capabilities that a rendering context must support, such as color depth and whether stereo is enabled. It currently contains the minimal number of routines which allow configuration on all supported window systems. */ -public class GLCapabilities implements Cloneable { +public class NWCapabilities implements Cloneable { private boolean doubleBuffered = true; private boolean stereo = false; private boolean hardwareAccelerated = true; @@ -74,16 +74,16 @@ public class GLCapabilities implements Cloneable { private boolean pbufferRenderToTexture; private boolean pbufferRenderToTextureRectangle; - /** Creates a GLCapabilities object. All attributes are in a default + /** Creates a NWCapabilities object. All attributes are in a default state. */ - public GLCapabilities() {} + public NWCapabilities() {} public Object clone() { try { return super.clone(); } catch (CloneNotSupportedException e) { - throw new GLException(e); + throw new NativeWindowException(e); } } @@ -343,10 +343,10 @@ public class GLCapabilities implements Cloneable { return backgroundOpaque; } - /** Returns a textual representation of this GLCapabilities + /** Returns a textual representation of this NWCapabilities object. */ public String toString() { - return ("GLCapabilities [" + + return ("NWCapabilities [" + "DoubleBuffered: " + doubleBuffered + ", Stereo: " + stereo + ", HardwareAccelerated: " + hardwareAccelerated + diff --git a/src/classes/javax/media/opengl/GLCapabilitiesChooser.java b/src/classes/javax/media/nwi/NWCapabilitiesChooser.java index 9d970ff42..12884c5e2 100644 --- a/src/classes/javax/media/opengl/GLCapabilitiesChooser.java +++ b/src/classes/javax/media/nwi/NWCapabilitiesChooser.java @@ -37,17 +37,17 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl; +package javax.media.nwi; /** Provides a mechanism by which applications can customize the - window type selection for a given {@link GLCapabilities}. + window type selection for a given {@link NWCapabilities}. Developers can implement this interface and pass an instance into the appropriate method of {@link GLDrawableFactory}; the chooser will be called during the OpenGL context creation process. */ -public interface GLCapabilitiesChooser { +public interface NWCapabilitiesChooser { /** Chooses the index (0..available.length - 1) of the {@link - GLCapabilities} most closely matching the desired one from the + NWCapabilities} most closely matching the desired one from the list of all supported. Some of the entries in the <code>available</code> array may be null; the chooser must ignore these. The <em>windowSystemRecommendedChoice</em> @@ -59,9 +59,9 @@ public interface GLCapabilitiesChooser { {@link GLDrawableFactory} when an instance of this class is passed in to one of its factory methods. It should generally not be invoked by users directly, unless it is desired to delegate - the choice to some other GLCapabilitiesChooser object. + the choice to some other NWCapabilitiesChooser object. */ - public int chooseCapabilities(GLCapabilities desired, - GLCapabilities[] available, + public int chooseCapabilities(NWCapabilities desired, + NWCapabilities[] available, int windowSystemRecommendedChoice); } diff --git a/src/classes/javax/media/opengl/NativeWindow.java b/src/classes/javax/media/nwi/NativeWindow.java index f7e09520e..f992c2231 100644 --- a/src/classes/javax/media/opengl/NativeWindow.java +++ b/src/classes/javax/media/nwi/NativeWindow.java @@ -37,7 +37,7 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl; +package javax.media.nwi; /** Provides the mechanism by which the Java / OpenGL binding interacts with windows. A window toolkit such as the AWT may diff --git a/src/classes/javax/media/opengl/NativeWindowException.java b/src/classes/javax/media/nwi/NativeWindowException.java index cb43d3830..bc1a8ddef 100644 --- a/src/classes/javax/media/opengl/NativeWindowException.java +++ b/src/classes/javax/media/nwi/NativeWindowException.java @@ -37,7 +37,7 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl; +package javax.media.nwi; /** A generic exception for OpenGL errors used throughout the binding as a substitute for {@link RuntimeException}. */ diff --git a/src/classes/javax/media/opengl/GLDrawable.java b/src/classes/javax/media/opengl/GLDrawable.java index 50c95e688..c2bbcb860 100644 --- a/src/classes/javax/media/opengl/GLDrawable.java +++ b/src/classes/javax/media/opengl/GLDrawable.java @@ -39,6 +39,8 @@ package javax.media.opengl; +import javax.media.nwi.*; + // FIXME: We need some way to tell when the device upon which the canvas is // being displayed has changed (e.g., the user drags the canvas's parent // window from one screen on multi-screen environment to another, when the @@ -141,7 +143,7 @@ public interface GLDrawable { automatically and should not be called by the end user. */ public void swapBuffers() throws GLException; - /** Fetches the {@link GLCapabilities} corresponding to the chosen + /** Fetches the {@link NWCapabilities} corresponding to the chosen OpenGL capabilities (pixel format / visual) for this drawable. Some drawables, in particular on-screen drawables, may be created lazily; null is returned if the drawable is not @@ -151,7 +153,7 @@ public interface GLDrawable { value in this case. Returns a copy of the passed object. */ - public GLCapabilities getChosenGLCapabilities(); + public NWCapabilities getChosenNWCapabilities(); public NativeWindow getNativeWindow(); diff --git a/src/classes/javax/media/opengl/GLDrawableFactory.java b/src/classes/javax/media/opengl/GLDrawableFactory.java index dbbb42a0e..7ef8bdd58 100644 --- a/src/classes/javax/media/opengl/GLDrawableFactory.java +++ b/src/classes/javax/media/opengl/GLDrawableFactory.java @@ -39,6 +39,8 @@ package javax.media.opengl; +import javax.media.nwi.*; + import java.lang.reflect.*; import java.security.*; import com.sun.opengl.impl.*; @@ -46,21 +48,21 @@ import com.sun.opengl.impl.*; /** <P> Provides a virtual machine- and operating system-independent mechanism for creating {@link GLDrawable}s. </P> - <P> The {@link javax.media.opengl.GLCapabilities} objects passed + <P> The {@link javax.media.opengl.NWCapabilities} objects passed in to the various factory methods are used as a hint for the properties of the returned drawable. The default capabilities selection algorithm (equivalent to passing in a null {@link - GLCapabilitiesChooser}) is described in {@link - DefaultGLCapabilitiesChooser}. Sophisticated applications needing + NWCapabilitiesChooser}) is described in {@link + DefaultNWCapabilitiesChooser}. Sophisticated applications needing to change the selection algorithm may pass in their own {@link - GLCapabilitiesChooser} which can select from the available pixel - formats. The GLCapabilitiesChooser mechanism may not be supported + NWCapabilitiesChooser} which can select from the available pixel + formats. The NWCapabilitiesChooser mechanism may not be supported by all implementations or on all platforms, in which case any - passed GLCapabilitiesChooser will be ignored. </P> + passed NWCapabilitiesChooser will be ignored. </P> <P> Because of the multithreaded nature of the Java platform's Abstract Window Toolkit, it is typically not possible to immediately - reject a given {@link GLCapabilities} as being unsupportable by + reject a given {@link NWCapabilities} as being unsupportable by either returning <code>null</code> from the creation routines or raising a {@link GLException}. The semantics of the rejection process are (unfortunately) left unspecified for now. The current @@ -153,19 +155,19 @@ public abstract class GLDrawableFactory { * Returns a GLDrawable that wraps a platform-specific window system * object, such as an AWT or LCDUI Canvas. On platforms which * support it, selects a pixel format compatible with the supplied - * GLCapabilities, or if the passed GLCapabilities object is null, + * NWCapabilities, or if the passed NWCapabilities object is null, * uses a default set of capabilities. On these platforms, uses - * either the supplied GLCapabilitiesChooser object, or if the - * passed GLCapabilitiesChooser object is null, uses a - * DefaultGLCapabilitiesChooser instance. + * either the supplied NWCapabilitiesChooser object, or if the + * passed NWCapabilitiesChooser object is null, uses a + * DefaultNWCapabilitiesChooser instance. * * @throws IllegalArgumentException if the passed target is null * @throws GLException if any window system-specific errors caused * the creation of the GLDrawable to fail. */ public abstract GLDrawable createGLDrawable(NativeWindow target, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser) + NWCapabilities capabilities, + NWCapabilitiesChooser chooser) throws IllegalArgumentException, GLException; //---------------------------------------------------------------------- @@ -186,8 +188,8 @@ public abstract class GLDrawableFactory { * @throws GLException if any window system-specific errors caused * the creation of the GLPbuffer to fail. */ - public abstract GLPbuffer createGLPbuffer(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, + public abstract GLPbuffer createGLPbuffer(NWCapabilities capabilities, + NWCapabilitiesChooser chooser, int initialWidth, int initialHeight, GLContext shareWith) diff --git a/src/classes/javax/media/opengl/GLPbuffer.java b/src/classes/javax/media/opengl/GLPbuffer.java index 04cf7f0ed..0250365b0 100644 --- a/src/classes/javax/media/opengl/GLPbuffer.java +++ b/src/classes/javax/media/opengl/GLPbuffer.java @@ -59,7 +59,7 @@ public interface GLPbuffer extends GLAutoDrawable { /** Binds this pbuffer to its internal texture target. Only valid to call if offscreen render-to-texture has been specified in the - GLCapabilities for this GLPbuffer. If the + NWCapabilities for this GLPbuffer. If the render-to-texture-rectangle capability has also been specified, this will use e.g. wglBindTexImageARB as its implementation and cause the texture to be bound to e.g. the @@ -82,7 +82,7 @@ public interface GLPbuffer extends GLAutoDrawable { /** Indicates which vendor's extension is being used to support floating point channels in this pbuffer if that capability was - requested in the GLCapabilities during pbuffer creation. Returns + requested in the NWCapabilities during pbuffer creation. Returns one of NV_FLOAT, ATI_FLOAT or APPLE_FLOAT, or throws GLException if floating-point channels were not requested for this pbuffer. This function may only be called once the init method for this diff --git a/src/classes/javax/media/opengl/NativeWindowFactory.java b/src/classes/javax/media/opengl/NativeWindowFactory.java index b80e239ea..c0009444a 100644 --- a/src/classes/javax/media/opengl/NativeWindowFactory.java +++ b/src/classes/javax/media/opengl/NativeWindowFactory.java @@ -32,6 +32,7 @@ package javax.media.opengl; +import javax.media.nwi.*; import java.lang.reflect.*; import java.security.*; import java.util.*; @@ -68,7 +69,7 @@ public abstract class NativeWindowFactory { // make it easier to run this code on mobile devices NativeWindowFactory factory = new NativeWindowFactoryImpl(); - nativeWindowClass = javax.media.opengl.NativeWindow.class; + nativeWindowClass = javax.media.nwi.NativeWindow.class; registerFactory(nativeWindowClass, factory); defaultFactory = factory; @@ -174,7 +175,7 @@ public abstract class NativeWindowFactory { /** * <P> Selects a graphics configuration on the specified graphics - * device compatible with the supplied GLCapabilities. This method + * device compatible with the supplied NWCapabilities. This method * is intended to be used by applications which do not use the * supplied GLCanvas class but instead wrap their own Canvas or * other window toolkit-specific object with a GLDrawable. Some @@ -199,8 +200,8 @@ public abstract class NativeWindowFactory { * the selection of the graphics configuration to fail. */ public abstract AbstractGraphicsConfiguration - chooseGraphicsConfiguration(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, + chooseGraphicsConfiguration(NWCapabilities capabilities, + NWCapabilitiesChooser chooser, AbstractGraphicsDevice device) throws IllegalArgumentException, GLException; diff --git a/src/classes/javax/media/opengl/X11GraphicsConfiguration.java b/src/classes/javax/media/opengl/X11GraphicsConfiguration.java index 95127f2c1..b7784558d 100644 --- a/src/classes/javax/media/opengl/X11GraphicsConfiguration.java +++ b/src/classes/javax/media/opengl/X11GraphicsConfiguration.java @@ -32,6 +32,8 @@ package javax.media.opengl; +import javax.media.nwi.*; + /** Encapsulates a graphics configuration, or OpenGL pixel format, on X11 platforms. Objects of this type are returned from {@link NativeWindowFactory#chooseGraphicsConfiguration diff --git a/src/classes/javax/media/opengl/X11GraphicsDevice.java b/src/classes/javax/media/opengl/X11GraphicsDevice.java index 1a8900f31..31002f1d4 100644 --- a/src/classes/javax/media/opengl/X11GraphicsDevice.java +++ b/src/classes/javax/media/opengl/X11GraphicsDevice.java @@ -32,6 +32,8 @@ package javax.media.opengl; +import javax.media.nwi.*; + /** Encapsulates a graphics device, or screen, on X11 platforms. Objects of this type are passed to {@link NativeWindowFactory#chooseGraphicsConfiguration diff --git a/src/classes/javax/media/opengl/awt/GLCanvas.java b/src/classes/javax/media/opengl/awt/GLCanvas.java index e0d997dc5..42700b9e8 100644 --- a/src/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/classes/javax/media/opengl/awt/GLCanvas.java @@ -40,6 +40,7 @@ package javax.media.opengl.awt; import javax.media.opengl.*; +import javax.media.nwi.*; import java.awt.Canvas; import java.awt.Color; @@ -76,8 +77,8 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable { private boolean sendReshape = false; private GraphicsConfiguration chosen; - private GLCapabilities glCaps; - private GLCapabilitiesChooser glCapChooser; + private NWCapabilities glCaps; + private NWCapabilitiesChooser glCapChooser; static { // Default to the GL2 profile, which is the default on the desktop @@ -96,15 +97,15 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable { /** Creates a new GLCanvas component with the requested set of OpenGL capabilities, using the default OpenGL capabilities selection mechanism, on the default screen device. */ - public GLCanvas(GLCapabilities capabilities) { + public GLCanvas(NWCapabilities capabilities) { this(capabilities, null, null, null); } - /** Creates a new GLCanvas component. The passed GLCapabilities + /** Creates a new GLCanvas component. The passed NWCapabilities specifies the OpenGL capabilities for the component; if null, a - default set of capabilities is used. The GLCapabilitiesChooser + default set of capabilities is used. The NWCapabilitiesChooser specifies the algorithm for selecting one of the available - GLCapabilities for the component; a DefaultGLCapabilitesChooser + NWCapabilities for the component; a DefaultGLCapabilitesChooser is used if null is passed for this argument. The passed GLContext specifies an OpenGL context with which to share textures, display lists and other OpenGL state, and may be null @@ -115,8 +116,8 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable { which to create the GLCanvas; the GLDrawableFactory uses the default screen device of the local GraphicsEnvironment if null is passed for this argument. */ - public GLCanvas(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, + public GLCanvas(NWCapabilities capabilities, + NWCapabilitiesChooser chooser, GLContext shareWith, GraphicsDevice device) { // The platform-specific GLDrawableFactory will only provide a @@ -407,11 +408,11 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable { maybeDoSingleThreadedWorkaround(swapBuffersOnEventDispatchThreadAction, swapBuffersAction); } - public GLCapabilities getChosenGLCapabilities() { + public NWCapabilities getChosenNWCapabilities() { if (drawable == null) return null; - return drawable.getChosenGLCapabilities(); + return drawable.getChosenNWCapabilities(); } public NativeWindow getNativeWindow() { @@ -532,8 +533,8 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable { } } - private static GraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, + private static GraphicsConfiguration chooseGraphicsConfiguration(NWCapabilities capabilities, + NWCapabilitiesChooser chooser, GraphicsDevice device) { // Make GLCanvas behave better in NetBeans GUI builder if (Beans.isDesignTime()) { diff --git a/src/classes/javax/media/opengl/awt/GLJPanel.java b/src/classes/javax/media/opengl/awt/GLJPanel.java index 37f1dfa7b..6711a5ed2 100644 --- a/src/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/classes/javax/media/opengl/awt/GLJPanel.java @@ -40,6 +40,7 @@ package javax.media.opengl.awt; import javax.media.opengl.*; +import javax.media.nwi.*; import java.awt.*; import java.awt.geom.*; @@ -63,7 +64,7 @@ import com.sun.opengl.impl.awt.*; Z-ordering or LayoutManager problems. <P> The GLJPanel can be made transparent by creating it with a - GLCapabilities object with alpha bits specified and calling {@link + NWCapabilities object with alpha bits specified and calling {@link #setOpaque}(false). Pixels with resulting OpenGL alpha values less than 1.0 will be overlaid on any underlying Swing rendering. <P> @@ -90,8 +91,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable { private volatile boolean isInitialized; // Data used for either pbuffers or pixmap-based offscreen surfaces - private GLCapabilities offscreenCaps; - private GLCapabilitiesChooser chooser; + private NWCapabilities offscreenCaps; + private NWCapabilitiesChooser chooser; private GLContext shareWith; // Width of the actual GLJPanel private int panelWidth = 0; @@ -158,33 +159,33 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable { /** Creates a new GLJPanel component with the requested set of OpenGL capabilities, using the default OpenGL capabilities selection mechanism. */ - public GLJPanel(GLCapabilities capabilities) { + public GLJPanel(NWCapabilities capabilities) { this(capabilities, null, null); } - /** Creates a new GLJPanel component. The passed GLCapabilities + /** Creates a new GLJPanel component. The passed NWCapabilities specifies the OpenGL capabilities for the component; if null, a - default set of capabilities is used. The GLCapabilitiesChooser + default set of capabilities is used. The NWCapabilitiesChooser specifies the algorithm for selecting one of the available - GLCapabilities for the component; a DefaultGLCapabilitesChooser + NWCapabilities for the component; a DefaultGLCapabilitesChooser is used if null is passed for this argument. The passed GLContext specifies an OpenGL context with which to share textures, display lists and other OpenGL state, and may be null if sharing is not desired. See the note in the overview documentation on <a href="../../../overview-summary.html#SHARING">context sharing</a>. */ - public GLJPanel(GLCapabilities capabilities, GLCapabilitiesChooser chooser, GLContext shareWith) { + public GLJPanel(NWCapabilities capabilities, NWCapabilitiesChooser chooser, GLContext shareWith) { super(); // Works around problems on many vendors' cards; we don't need a // back buffer for the offscreen surface anyway if (capabilities != null) { - offscreenCaps = (GLCapabilities) capabilities.clone(); + offscreenCaps = (NWCapabilities) capabilities.clone(); } else { - offscreenCaps = new GLCapabilities(); + offscreenCaps = new NWCapabilities(); } offscreenCaps.setDoubleBuffered(false); - this.chooser = ((chooser != null) ? chooser : new DefaultGLCapabilitiesChooser()); + this.chooser = ((chooser != null) ? chooser : new DefaultNWCapabilitiesChooser()); this.shareWith = shareWith; } @@ -391,8 +392,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable { return oglPipelineEnabled; } - public GLCapabilities getChosenGLCapabilities() { - return backend.getChosenGLCapabilities(); + public NWCapabilities getChosenNWCapabilities() { + return backend.getChosenNWCapabilities(); } public NativeWindow getNativeWindow() { @@ -578,8 +579,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable { // Called to get the current backend's GLContext public GLContext getContext(); - // Called to fetch the "real" chosen GLCapabilities for the backend - public GLCapabilities getChosenGLCapabilities(); + // Called to fetch the "real" chosen NWCapabilities for the backend + public NWCapabilities getChosenNWCapabilities(); // Called to handle a reshape event. When this is called, the // OpenGL context associated with the backend is not current, to @@ -815,11 +816,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable { return offscreenContext; } - public GLCapabilities getChosenGLCapabilities() { + public NWCapabilities getChosenNWCapabilities() { if (offscreenDrawable == null) { return null; } - return offscreenDrawable.getChosenGLCapabilities(); + return offscreenDrawable.getChosenNWCapabilities(); } public void handleReshape() { @@ -902,11 +903,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable { return pbuffer.getContext(); } - public GLCapabilities getChosenGLCapabilities() { + public NWCapabilities getChosenNWCapabilities() { if (pbuffer == null) { return null; } - return pbuffer.getChosenGLCapabilities(); + return pbuffer.getChosenNWCapabilities(); } public void handleReshape() { @@ -1069,9 +1070,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable { return joglContext; } - public GLCapabilities getChosenGLCapabilities() { + public NWCapabilities getChosenNWCapabilities() { // FIXME: should do better than this; is it possible to using only platform-independent code? - return new GLCapabilities(); + return new NWCapabilities(); } public void handleReshape() { |