diff options
author | Kenneth Russel <[email protected]> | 2009-03-19 00:32:21 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2009-03-19 00:32:21 +0000 |
commit | c4cd0db6b9865c97245921d2824bcc4c1541e615 (patch) | |
tree | 6f9df4a383767992fa9ec36d820630bfabedf75a /src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java | |
parent | 23d13ee00ebdf7052299fc65af6f50e43d673e67 (diff) |
Movement of Capabilities class and chooseCapabilities functionality
into NativeWindowFactory introduced an undesirable dependence between
the windowing toolkit, which can be replaced via NativeWindowFactory,
and the library which implements the selection algorithm, for example
OpenGL. This would prevent, for example, an easy SWT port of JOGL.
To fix this, refactored chooseCapabilities into new
GraphicsConfigurationFactory, the default implementation of which is
currently a no-op on X11 platforms, and which is provided by JOGL in a
toolkit-agnostic manner via GLX. Refactored OpenGL portions of
Capabilities class back into GLCapabilities. Reintroduced
GLCapabilitiesChooser interface for compatibility and to avoid having
to import javax.media.nativewindow classes in most user code.
Fixed problem in GLProfile where failures to load native libraries
were being squelched. Reorganized build to have all outputs under
build/ directory.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1884 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java')
-rwxr-xr-x | src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java index 733891009..105ccc6d9 100755 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java @@ -42,7 +42,7 @@ import javax.media.nativewindow.*; import javax.media.opengl.*; public class EGLDrawable extends GLDrawableImpl { - private NWCapabilitiesChooser chooser; + private GLCapabilitiesChooser chooser; private long display; private EGLConfig config; private long surface; @@ -50,8 +50,8 @@ public class EGLDrawable extends GLDrawableImpl { public EGLDrawable(EGLDrawableFactory factory, NativeWindow component, - NWCapabilities requestedCapabilities, - NWCapabilitiesChooser chooser) throws GLException { + GLCapabilities requestedCapabilities, + GLCapabilitiesChooser chooser) throws GLException { super(factory, component, requestedCapabilities, false); this.chooser = chooser; surface=EGL.EGL_NO_SURFACE; @@ -92,7 +92,7 @@ public class EGLDrawable extends GLDrawableImpl { public void setRealized(boolean realized) { if (realized) { - if (NWReflection.instanceOf(component, "com.sun.javafx.newt.kd.KDWindow")) { + if (NWReflection.instanceOf(component, "com.sun.javafx.newt.opengl.kd.KDWindow")) { // KDWindows holds already determined EGL values display = component.getDisplayHandle(); if (display==0) { @@ -101,11 +101,10 @@ public class EGLDrawable extends GLDrawableImpl { if (display == EGL.EGL_NO_DISPLAY) { throw new GLException("KDWindow has EGL_NO_DISPLAY"); } - Long setConfigID = new Long(component.getVisualID()); - if ( 0 <= setConfigID.longValue() && setConfigID.longValue() <= Integer.MAX_VALUE ) { - config = new EGLConfig(display, setConfigID.intValue()); - } else { - throw new GLException("KDWindow has invalid visualID/configID"); + EGLConfig config = (EGLConfig) component.getGraphicsConfiguration(); + int configID = 0; + if (config != null) { + configID = config.getNativeConfigID(); } } else { display = EGL.eglGetDisplay((0!=component.getDisplayHandle())?component.getDisplayHandle():EGL.EGL_DEFAULT_DISPLAY); @@ -115,9 +114,9 @@ public class EGLDrawable extends GLDrawableImpl { if (!EGL.eglInitialize(display, null, null)) { throw new GLException("eglInitialize failed"); } - config = new EGLConfig(display, getRequestedNWCapabilities()); + config = new EGLConfig(display, getRequestedGLCapabilities()); } - setChosenNWCapabilities(config.getCapabilities()); + setChosenGLCapabilities(config.getCapabilities()); } else if (surface != EGL.EGL_NO_SURFACE) { // Destroy the window surface if (!EGL.eglDestroySurface(display, surface)) { |