aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/javafx/newt
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes/com/sun/javafx/newt')
-rw-r--r--src/classes/com/sun/javafx/newt/GLWindow.java18
-rwxr-xr-xsrc/classes/com/sun/javafx/newt/NewtFactory.java26
-rwxr-xr-xsrc/classes/com/sun/javafx/newt/Window.java40
-rw-r--r--src/classes/com/sun/javafx/newt/awt/AWTWindow.java5
-rwxr-xr-xsrc/classes/com/sun/javafx/newt/kd/KDDisplay.java60
-rwxr-xr-xsrc/classes/com/sun/javafx/newt/kd/KDScreen.java46
-rwxr-xr-xsrc/classes/com/sun/javafx/newt/kd/KDWindow.java172
-rwxr-xr-xsrc/classes/com/sun/javafx/newt/macosx/MacWindow.java6
-rwxr-xr-xsrc/classes/com/sun/javafx/newt/windows/WindowsWindow.java6
-rwxr-xr-xsrc/classes/com/sun/javafx/newt/x11/X11Window.java5
10 files changed, 352 insertions, 32 deletions
diff --git a/src/classes/com/sun/javafx/newt/GLWindow.java b/src/classes/com/sun/javafx/newt/GLWindow.java
index d66de7149..89886c24f 100644
--- a/src/classes/com/sun/javafx/newt/GLWindow.java
+++ b/src/classes/com/sun/javafx/newt/GLWindow.java
@@ -70,9 +70,8 @@ public class GLWindow extends Window implements GLAutoDrawable {
/** Constructor. Do not call this directly -- use {@link
create()} instead. */
- protected GLWindow(Window window, GLCapabilities caps) {
+ protected GLWindow(Window window) {
this.window = window;
- this.caps = caps;
window.addWindowListener(new WindowListener() {
public void windowResized(WindowEvent e) {
sendReshape = true;
@@ -115,16 +114,16 @@ public class GLWindow extends Window implements GLAutoDrawable {
public static GLWindow create(Window window,
GLCapabilities caps,
boolean undecorated) {
+ if (caps == null) {
+ caps = new GLCapabilities();
+ }
if (window == null) {
Display display = NewtFactory.createDisplay(null); // local display
Screen screen = NewtFactory.createScreen(display, 0); // screen 0
- window = NewtFactory.createWindow(screen, 0, undecorated); // dummy VisualID
- }
- if (caps == null) {
- caps = new GLCapabilities();
+ window = NewtFactory.createWindow(screen, caps, undecorated);
}
- return new GLWindow(window, caps);
+ return new GLWindow(window);
}
public boolean isTerminalObject() {
@@ -132,7 +131,7 @@ public class GLWindow extends Window implements GLAutoDrawable {
return false;
}
- protected void createNative() {
+ protected void createNative(GLCapabilities caps) {
shouldNotCallThis();
}
@@ -236,7 +235,7 @@ public class GLWindow extends Window implements GLAutoDrawable {
window.setVisible(visible);
if (visible && context == null) {
factory = GLDrawableFactory.getFactory(window);
- drawable = factory.createGLDrawable(window, caps, null);
+ drawable = factory.createGLDrawable(window, window.getChosenCapabilities(), null);
window.setVisible(true);
drawable.setRealized(true);
context = drawable.createContext(null);
@@ -337,7 +336,6 @@ public class GLWindow extends Window implements GLAutoDrawable {
private int eventHandlerMode = EVENT_HANDLER_GL_CURRENT;
private GLDrawableFactory factory;
- private GLCapabilities caps;
private GLDrawable drawable;
private GLContext context;
private GLDrawableHelper helper = new GLDrawableHelper();
diff --git a/src/classes/com/sun/javafx/newt/NewtFactory.java b/src/classes/com/sun/javafx/newt/NewtFactory.java
index 4f2ecf569..d277fc65e 100755
--- a/src/classes/com/sun/javafx/newt/NewtFactory.java
+++ b/src/classes/com/sun/javafx/newt/NewtFactory.java
@@ -33,6 +33,7 @@
package com.sun.javafx.newt;
+import javax.media.opengl.GLCapabilities;
import java.util.ArrayList;
import java.util.Iterator;
@@ -54,10 +55,15 @@ public abstract class NewtFactory {
/** Creates a Window of the default type for the current operating system. */
public static String getWindowType() {
- String osName = System.getProperty("os.name");
+ String osName = System.getProperty("newt.ws.name");
+ if(null==osName||osName.length()==0) {
+ osName = System.getProperty("os.name");
+ }
String osNameLowerCase = osName.toLowerCase();
String windowType;
- if (osNameLowerCase.startsWith("wind")) {
+ if (osNameLowerCase.startsWith("kd")) {
+ windowType = KD;
+ } else if (osNameLowerCase.startsWith("wind")) {
windowType = WINDOWS;
} else if (osNameLowerCase.startsWith("mac os x")) {
// For the time being, use the AWT on Mac OS X since
@@ -103,19 +109,19 @@ public abstract class NewtFactory {
/**
* Create a Window entity, incl native creation
*/
- public static Window createWindow(Screen screen, long visualID) {
- return Window.create(getWindowType(), screen, visualID);
+ public static Window createWindow(Screen screen, GLCapabilities caps) {
+ return Window.create(getWindowType(), screen, caps);
}
- public static Window createWindow(Screen screen, long visualID, boolean undecorated) {
- return Window.create(getWindowType(), screen, visualID, undecorated);
+ public static Window createWindow(Screen screen, GLCapabilities 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, long visualID) {
- return Window.create(type, screen, visualID);
+ public static Window createWindow(String type, Screen screen, GLCapabilities caps) {
+ return Window.create(type, screen, caps);
}
/**
@@ -135,10 +141,10 @@ public abstract class NewtFactory {
/**
* Instantiate a Window entity using the native handle.
*/
- public static Window wrapWindow(Screen screen, long visualID,
+ public static Window wrapWindow(Screen screen, GLCapabilities caps, long visualID,
long windowHandle, boolean fullscreen, boolean visible,
int x, int y, int width, int height) {
- return Window.wrapHandle(getWindowType(), screen, visualID,
+ return Window.wrapHandle(getWindowType(), screen, caps, visualID,
windowHandle, fullscreen, visible, x, y, width, height);
}
diff --git a/src/classes/com/sun/javafx/newt/Window.java b/src/classes/com/sun/javafx/newt/Window.java
index 98f4eeeff..a2db7623b 100755
--- a/src/classes/com/sun/javafx/newt/Window.java
+++ b/src/classes/com/sun/javafx/newt/Window.java
@@ -33,6 +33,7 @@
package com.sun.javafx.newt;
+import javax.media.opengl.GLCapabilities;
import javax.media.opengl.NativeWindow;
import javax.media.opengl.NativeWindowException;
@@ -66,19 +67,19 @@ public abstract class Window implements NativeWindow
return windowClass;
}
- protected static Window create(String type, Screen screen, long visualID) {
- return create(type, screen, visualID, false);
+ protected static Window create(String type, Screen screen, GLCapabilities caps) {
+ return create(type, screen, caps, false);
}
- protected static Window create(String type, Screen screen, long visualID, boolean undecorated) {
+ protected static Window create(String type, Screen screen, GLCapabilities caps, boolean undecorated) {
try {
Class windowClass = getWindowClass(type);
Window window = (Window) windowClass.newInstance();
window.invalidate();
window.screen = screen;
- window.visualID = visualID;
+ window.visualID = 0;
window.setUndecorated(undecorated);
- window.createNative();
+ window.createNative(caps);
return window;
} catch (Throwable t) {
t.printStackTrace();
@@ -86,7 +87,7 @@ public abstract class Window implements NativeWindow
}
}
- protected static Window wrapHandle(String type, Screen screen, long visualID,
+ protected static Window wrapHandle(String type, Screen screen, GLCapabilities caps, long visualID,
long windowHandle, boolean fullscreen, boolean visible,
int x, int y, int width, int height)
{
@@ -95,6 +96,7 @@ public abstract class Window implements NativeWindow
Window window = (Window) windowClass.newInstance();
window.invalidate();
window.screen = screen;
+ window.chosenCaps = caps;
window.visualID = visualID;
window.windowHandle = windowHandle;
window.fullscreen=fullscreen;
@@ -113,9 +115,12 @@ public abstract class Window implements NativeWindow
public abstract boolean isTerminalObject();
/**
- * create native windowHandle, ie creates a new native invisible window
+ * Create native windowHandle, ie creates a new native invisible window
+ *
+ * Shall use the capabilities to determine the visualID
+ * and shall set chosenCaps.
*/
- protected abstract void createNative();
+ protected abstract void createNative(GLCapabilities caps);
protected abstract void closeNative();
@@ -154,11 +159,21 @@ public abstract class Window implements NativeWindow
", visible "+isVisible()+
", wrappedWindow "+getWrappedWindow()+
", terminalObject "+isTerminalObject()+
+ ", visualID "+visualID+
+ ", "+chosenCaps+
", screen handle/index "+getScreenHandle()+"/"+getScreenIndex() +
", display handle "+getDisplayHandle()+ "]";
}
protected Screen screen;
+
+ /**
+ * The GLCapabilities shall be used to determine the visualID
+ */
+ protected GLCapabilities chosenCaps;
+ /**
+ * The visualID shall be determined using the GLCapabilities
+ */
protected long visualID;
protected long windowHandle;
protected boolean locked=false;
@@ -223,6 +238,7 @@ public abstract class Window implements NativeWindow
unlockSurface();
screen = null;
visualID = 0;
+ chosenCaps = null;
windowHandle = 0;
locked = false;
fullscreen=false;
@@ -264,6 +280,14 @@ public abstract class Window implements NativeWindow
return windowHandle; // default: return window handle
}
+ public GLCapabilities getChosenCapabilities() {
+ if (chosenCaps == null)
+ return null;
+
+ // Must return a new copy to avoid mutation by end user
+ return (GLCapabilities) chosenCaps.clone();
+ }
+
public long getVisualID() {
return visualID;
}
diff --git a/src/classes/com/sun/javafx/newt/awt/AWTWindow.java b/src/classes/com/sun/javafx/newt/awt/AWTWindow.java
index 6ec1622ac..07510e7a6 100644
--- a/src/classes/com/sun/javafx/newt/awt/AWTWindow.java
+++ b/src/classes/com/sun/javafx/newt/awt/AWTWindow.java
@@ -45,6 +45,7 @@ import java.lang.reflect.InvocationTargetException;
import java.awt.event.*;
import java.util.*;
import com.sun.javafx.newt.Window;
+import javax.media.opengl.GLCapabilities;
/** An implementation of the Newt Window class built using the
AWT. This is provided for convenience of porting to platforms
@@ -93,7 +94,9 @@ public class AWTWindow extends Window {
}
}
- protected void createNative() {
+ protected void createNative(GLCapabilities caps) {
+ chosenCaps = (GLCapabilities) caps.clone(); // FIXME: visualID := f1(caps); caps := f2(visualID)
+ visualID = 0; // n/a
runOnEDT(new Runnable() {
public void run() {
frame = new Frame(getTitle());
diff --git a/src/classes/com/sun/javafx/newt/kd/KDDisplay.java b/src/classes/com/sun/javafx/newt/kd/KDDisplay.java
new file mode 100755
index 000000000..e919daacd
--- /dev/null
+++ b/src/classes/com/sun/javafx/newt/kd/KDDisplay.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ */
+
+package com.sun.javafx.newt.windows;
+
+import com.sun.javafx.newt.*;
+import com.sun.opengl.impl.*;
+import com.sun.opengl.impl.egl.*;
+import javax.media.opengl.GLException;
+
+public class KDDisplay extends Display {
+ static {
+ NativeLibLoader.loadNEWT();
+ }
+
+ public KDDisplay() {
+ }
+
+ protected void createNative() {
+ // FIXME: map name to EGL_*_DISPLAY
+ handle = EGL.eglGetDisplay(EGL.EGL_DEFAULT_DISPLAY);
+ if (handle == EGL.EGL_NO_DISPLAY) {
+ throw new GLException("eglGetDisplay failed");
+ }
+ if (!EGL.eglInitialize(handle, null, null)) {
+ throw new GLException("eglInitialize failed");
+ }
+ }
+}
+
diff --git a/src/classes/com/sun/javafx/newt/kd/KDScreen.java b/src/classes/com/sun/javafx/newt/kd/KDScreen.java
new file mode 100755
index 000000000..2915b1161
--- /dev/null
+++ b/src/classes/com/sun/javafx/newt/kd/KDScreen.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ */
+
+package com.sun.javafx.newt.windows;
+
+import com.sun.javafx.newt.*;
+import com.sun.opengl.impl.*;
+
+public class KDScreen extends Screen {
+ public KDScreen() {
+ }
+
+ protected void createNative() {
+ handle = 0;
+ }
+}
diff --git a/src/classes/com/sun/javafx/newt/kd/KDWindow.java b/src/classes/com/sun/javafx/newt/kd/KDWindow.java
new file mode 100755
index 000000000..7cc4724bc
--- /dev/null
+++ b/src/classes/com/sun/javafx/newt/kd/KDWindow.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ */
+
+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.opengl.GLProfile;
+import javax.media.opengl.NativeWindowException;
+
+public class KDWindow extends Window {
+ private static final String WINDOW_CLASS_NAME = "NewtWindow";
+ // fullscreen size
+ // this will be correct _after_ setting fullscreen on,
+ // but KD has no method to ask for the display size
+ private int fs_width=800, fs_height=480;
+ // non fullscreen dimensions ..
+ private int nfs_width, nfs_height, nfs_x, nfs_y;
+
+ static {
+ NativeLibLoader.loadNEWT();
+
+ if (!initIDs()) {
+ throw new RuntimeException("Failed to initialize jmethodIDs");
+ }
+ }
+
+ public KDWindow() {
+ }
+
+ public final boolean isTerminalObject() {
+ return true;
+ }
+
+ protected void createNative(GLCapabilities caps) {
+ int eglRenderableType;
+ if(GLProfile.isGLES1()) {
+ eglRenderableType = EGL.EGL_OPENGL_ES_BIT;
+ }
+ else if(GLProfile.isGLES2()) {
+ eglRenderableType = EGL.EGL_OPENGL_ES2_BIT;
+ } else {
+ eglRenderableType = EGL.EGL_OPENGL_BIT;
+ }
+ EGLConfig config = new EGLConfig(getDisplayHandle(), caps);
+ visualID = config.getNativeConfigID();
+ chosenCaps = config.getCapabilities();
+
+ windowHandle = CreateWindow(getDisplayHandle(), visualID, eglRenderableType);
+ if (windowHandle == 0) {
+ throw new RuntimeException("Error creating window: "+windowHandle);
+ }
+ nativeWindowHandle = RealizeWindow(windowHandle);
+ if (nativeWindowHandle == 0) {
+ throw new RuntimeException("Error native Window Handle is null");
+ }
+
+ windowHandleClose = windowHandle;
+ }
+
+ protected void closeNative() {
+ if(0!=windowHandleClose) {
+ CloseWindow(windowHandleClose);
+ }
+ }
+
+ public void setVisible(boolean visible) {
+ if(this.visible!=visible) {
+ this.visible=visible;
+ setVisible0(windowHandle, visible);
+ clearEventMask();
+ }
+ }
+
+ public void setSize(int width, int height) {
+ setSize0(windowHandle, width, height);
+ }
+
+ public void setPosition(int x, int y) {
+ // n/a in KD
+ System.err.println("setPosition n/a in KD");
+ }
+
+ public boolean setFullscreen(boolean fullscreen) {
+ if(this.fullscreen!=fullscreen) {
+ this.fullscreen=fullscreen;
+ if(this.fullscreen) {
+ setFullScreen0(windowHandle, true);
+ } else {
+ setFullScreen0(windowHandle, false);
+ setSize0(windowHandle, nfs_width, nfs_height);
+ }
+ }
+ return true;
+ }
+
+ public int getDisplayWidth() {
+ return fs_width;
+ }
+
+ public int getDisplayHeight() {
+ return fs_height;
+ }
+
+ protected void dispatchMessages(int eventMask) {
+ DispatchMessages(windowHandle, eventMask);
+ }
+
+ //----------------------------------------------------------------------
+ // Internals only
+ //
+
+ private static native boolean initIDs();
+ private native long CreateWindow(long displayHandle, long eglConfig, int eglRenderableType);
+ private native long RealizeWindow(long windowHandle);
+ private native int CloseWindow(long windowHandle);
+ private native void setVisible0(long windowHandle, boolean visible);
+ private native void setSize0(long windowHandle, int width, int height);
+ private native void setFullScreen0(long windowHandle, boolean fullscreen);
+ private native void DispatchMessages(long windowHandle, int eventMask);
+
+ private void sizeChanged(int newWidth, int newHeight) {
+ width = newWidth;
+ height = newHeight;
+ if(!fullscreen) {
+ nfs_width=width;
+ nfs_height=height;
+ } else {
+ fs_width = width;
+ fs_height = width;
+ }
+ sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED);
+ }
+
+ private void windowClosed() {
+ }
+
+ private long nativeWindowHandle; // THE KD underlying native window handle
+ private long windowHandleClose;
+}
diff --git a/src/classes/com/sun/javafx/newt/macosx/MacWindow.java b/src/classes/com/sun/javafx/newt/macosx/MacWindow.java
index cebd356c2..8427bb607 100755
--- a/src/classes/com/sun/javafx/newt/macosx/MacWindow.java
+++ b/src/classes/com/sun/javafx/newt/macosx/MacWindow.java
@@ -33,6 +33,8 @@
package com.sun.javafx.newt.macosx;
+import javax.media.opengl.GLCapabilities;
+
import com.sun.javafx.newt.*;
import com.sun.opengl.impl.*;
@@ -51,7 +53,9 @@ public class MacWindow extends Window {
public MacWindow() {
}
- protected final void createNative() {
+ protected final void createNative(GLCapabilities caps) {
+ chosenCaps = (GLCapabilities) caps.clone(); // FIXME: visualID := f1(caps); caps := f2(visualID)
+ visualID = 0; // n/a
}
protected final void closeNative() {
diff --git a/src/classes/com/sun/javafx/newt/windows/WindowsWindow.java b/src/classes/com/sun/javafx/newt/windows/WindowsWindow.java
index e520b8394..e1a1255ff 100755
--- a/src/classes/com/sun/javafx/newt/windows/WindowsWindow.java
+++ b/src/classes/com/sun/javafx/newt/windows/WindowsWindow.java
@@ -33,6 +33,8 @@
package com.sun.javafx.newt.windows;
+import javax.media.opengl.GLCapabilities;
+
import com.sun.javafx.newt.*;
import com.sun.opengl.impl.*;
@@ -64,8 +66,10 @@ public class WindowsWindow extends Window {
return hdc;
}
- protected void createNative() {
+ protected void createNative(GLCapabilities caps) {
long wndClass = getWindowClass();
+ chosenCaps = (GLCapabilities) 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");
diff --git a/src/classes/com/sun/javafx/newt/x11/X11Window.java b/src/classes/com/sun/javafx/newt/x11/X11Window.java
index 395fad8c4..311ba7dae 100755
--- a/src/classes/com/sun/javafx/newt/x11/X11Window.java
+++ b/src/classes/com/sun/javafx/newt/x11/X11Window.java
@@ -35,6 +35,7 @@ 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;
public class X11Window extends Window {
@@ -57,7 +58,9 @@ public class X11Window extends Window {
return true;
}
- protected void createNative() {
+ protected void createNative(GLCapabilities caps) {
+ chosenCaps = (GLCapabilities) 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);