diff options
author | Sven Gothel <[email protected]> | 2008-06-01 08:17:55 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2008-06-01 08:17:55 +0000 |
commit | 806564c9599510db2bb0e2d0e441ca6ad8068aa0 (patch) | |
tree | 1e3c4e827f9f9b64f70af277218728cb107b485e /src/classes/javax | |
parent | 31d1dd9cd0b0d1b5a0dd7ac61dfe88ee214364a8 (diff) |
Refactoring JOGL to partition core windowing, AWT, GL, ES1 and ES2 .. WIP
Compile Clean: X11, noAWT, ES1, no *.impl.x11/win/macosx
See jogl/make/build.xml for new build properties.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1654 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/javax')
12 files changed, 445 insertions, 27 deletions
diff --git a/src/classes/javax/media/opengl/GLAutoDrawable.java b/src/classes/javax/media/opengl/GLAutoDrawable.java index 40e2603c6..688b78879 100644 --- a/src/classes/javax/media/opengl/GLAutoDrawable.java +++ b/src/classes/javax/media/opengl/GLAutoDrawable.java @@ -52,7 +52,7 @@ import javax.media.opengl.glu.*; GLContext for the GLAutoDrawable to be used both by the event based rendering mechanism as well by end users directly. */ -public interface GLAutoDrawable extends GLDrawable /*, FIXME: ComponentEvents */ { +public interface GLAutoDrawable extends GLDrawable { /** * Returns the context associated with this drawable. The returned * context will be synchronized. diff --git a/src/classes/javax/media/opengl/GLDrawable.java b/src/classes/javax/media/opengl/GLDrawable.java index d57ddc0ee..c7f0ef803 100644 --- a/src/classes/javax/media/opengl/GLDrawable.java +++ b/src/classes/javax/media/opengl/GLDrawable.java @@ -136,4 +136,10 @@ public interface GLDrawable { with the drawable; a best attempt is made to return a reasonable value in this case. */ public GLCapabilities getChosenGLCapabilities(); + + public NativeWindow getNativeWindow(); + + public String getProfile(); + + public GLDrawableFactory getFactory(); } diff --git a/src/classes/javax/media/opengl/GLDrawableFactory.java b/src/classes/javax/media/opengl/GLDrawableFactory.java index 3ed34f86e..2c48e3ceb 100644 --- a/src/classes/javax/media/opengl/GLDrawableFactory.java +++ b/src/classes/javax/media/opengl/GLDrawableFactory.java @@ -77,7 +77,8 @@ import com.sun.opengl.impl.*; */ public abstract class GLDrawableFactory { - private static GLDrawableFactory factory; + private static GLDrawableFactory awtFactory; + private static GLDrawableFactory nwFactory; /** The desktop (OpenGL 2.0) profile */ public static final String PROFILE_GL_20 = "GL20"; @@ -91,9 +92,9 @@ public abstract class GLDrawableFactory { private String profile; /** Initializes the sole GLDrawableFactory instance for the given profile. */ - public static void initialize(String profile) throws GLException { - if (factory != null) { - throw new GLException("Already initialized"); + public static void initializeAWTFactory(String profile) throws GLException { + if (awtFactory != null) { + return; } // See if the user is requesting one of the embedded profiles, @@ -101,9 +102,9 @@ public abstract class GLDrawableFactory { if (PROFILE_GLES1.equals(profile) || PROFILE_GLES2.equals(profile)) { try { - Class clazz = Class.forName("com.sun.opengl.impl.egl.EGLDrawableFactory"); + Class clazz = Class.forName("com.sun.opengl.impl.egl.awt.EGLDrawableFactory"); Constructor c = clazz.getDeclaredConstructor(new Class[] { String.class }); - factory = (GLDrawableFactory) c.newInstance(new Object[] { profile }); + awtFactory = (GLDrawableFactory) c.newInstance(new Object[] { profile }); return; } catch (Exception e) { e.printStackTrace(); @@ -118,7 +119,7 @@ public abstract class GLDrawableFactory { String factoryClassName = (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { - return System.getProperty("opengl.factory.class.name"); + return System.getProperty("opengl.awt.factory.class.name"); } }); String osName = System.getProperty("os.name"); @@ -134,6 +135,63 @@ public abstract class GLDrawableFactory { if (factoryClassName != null) { factoryClass = Class.forName(factoryClassName); } else if (osNameLowerCase.startsWith("wind")) { + factoryClass = Class.forName("com.sun.opengl.impl.windows.awt.WindowsAWTGLDrawableFactory"); + } else if (osNameLowerCase.startsWith("mac os x")) { + factoryClass = Class.forName("com.sun.opengl.impl.macosx.awt.MacOSXAWTGLDrawableFactory"); + } else { + // Assume Linux, Solaris, etc. Should probably test for these explicitly. + factoryClass = Class.forName("com.sun.opengl.impl.x11.awt.X11AWTGLDrawableFactory"); + } + + if (factoryClass == null) { + throw new GLException("OS " + osName + " not yet supported"); + } + + Constructor c = factoryClass.getDeclaredConstructor(new Class[] { String.class }); + awtFactory = (GLDrawableFactory) c.newInstance(new Object[] { profile }); + } catch (Exception e) { + throw new GLException(e); + } + } + + /** Initializes the sole GLDrawableFactory instance for the given profile. */ + public static void initializeNWFactory(String profile) throws GLException { + if (nwFactory != null) { + return; + } + + // See if the user is requesting one of the embedded profiles, + // and if so, try to instantiate the EGLDrawableFactory + if (PROFILE_GLES1.equals(profile) || + PROFILE_GLES2.equals(profile)) { + try { + Class clazz = Class.forName("com.sun.opengl.impl.egl.EGLDrawableFactory"); + Constructor c = clazz.getDeclaredConstructor(new Class[] { String.class }); + nwFactory = (GLDrawableFactory) c.newInstance(new Object[] { profile }); + return; + } catch (Exception e) { + e.printStackTrace(); + } + } else if (!PROFILE_GL_20.equals(profile)) { + // We require that the user passes in one of the known profiles + throw new GLException("Unknown or unsupported profile \"" + profile + "\""); + } + + // Use the desktop OpenGL as the fallback always + try { + String factoryClassName = + (String) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return System.getProperty("opengl.factory.class.name"); + } + }); + String osName = System.getProperty("os.name"); + String osNameLowerCase = osName.toLowerCase(); + Class factoryClass = null; + + if (factoryClassName != null) { + factoryClass = Class.forName(factoryClassName); + } else if (osNameLowerCase.startsWith("wind")) { factoryClass = Class.forName("com.sun.opengl.impl.windows.WindowsGLDrawableFactory"); } else if (osNameLowerCase.startsWith("mac os x")) { factoryClass = Class.forName("com.sun.opengl.impl.macosx.MacOSXGLDrawableFactory"); @@ -147,7 +205,8 @@ public abstract class GLDrawableFactory { } Constructor c = factoryClass.getDeclaredConstructor(new Class[] { String.class }); - factory = (GLDrawableFactory) c.newInstance(new Object[] { profile }); + nwFactory = (GLDrawableFactory) c.newInstance(new Object[] { profile }); + return; } catch (Exception e) { throw new GLException(e); } @@ -160,12 +219,34 @@ public abstract class GLDrawableFactory { } /** Returns the sole GLDrawableFactory instance for the specified profile. */ - public static GLDrawableFactory getFactory() { - if (factory == null) { - throw new GLException("Must call initialize() first"); + public static GLDrawableFactory getFactory(String profile, Object target) { + if(null==target) { + throw new IllegalArgumentException("target is null"); } + if(target instanceof NativeWindow) { + return getFactory(profile, false); + } else if (NativeWindowFactory.isAWTComponent(target)) { + return getFactory(profile, true); + } + throw new IllegalArgumentException("Target type is unsupported. Currently supported: \n"+ + "\tjavax.media.opengl.NativeWindow\n"+ + "\tjava.awt.Component\n"); + } - return factory; + public static GLDrawableFactory getFactory(String profile, boolean awt) { + if(awt) { + initializeAWTFactory(profile); + if(awtFactory == null) { + throw new GLException("Could not determine the AWT-GLDrawableFactory"); + } + return awtFactory; + } else { + initializeNWFactory(profile); + if(nwFactory == null) { + throw new GLException("Could not determine the NativeWindow-GLDrawableFactory"); + } + return nwFactory; + } } /** Indicates which profile this GLDrawableFactory was created for. */ @@ -223,14 +304,13 @@ public abstract class GLDrawableFactory { * passed GLCapabilitiesChooser object is null, uses a * DefaultGLCapabilitiesChooser instance. * - * @throws IllegalArgumentException if the passed target is either - * null or its data type is not supported by this GLDrawableFactory. + * @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 getGLDrawable(Object target, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser) + public abstract GLDrawable createGLDrawable(NativeWindow target, + GLCapabilities capabilities, + GLCapabilitiesChooser chooser) throws IllegalArgumentException, GLException; //---------------------------------------------------------------------- diff --git a/src/classes/javax/media/opengl/NativeWindow.java b/src/classes/javax/media/opengl/NativeWindow.java new file mode 100644 index 000000000..98e5edc68 --- /dev/null +++ b/src/classes/javax/media/opengl/NativeWindow.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2003 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. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.opengl; + +public interface NativeWindow { + public static final int LOCK_SURFACE_NOT_READY = 1; + public static final int LOCK_SURFACE_CHANGED = 2; + public static final int LOCK_SUCCESS = 3; + + public boolean lockSurface() throws NativeWindowException ; + public void unlockSurface(); + public boolean isSurfaceLocked(); + + public long getDisplayHandle(); + public long getScreenHandle(); + public int getScreenIndex(); + public long getWindowHandle(); + public long getVisualID(); + + public void setSize(int width, int height); + public void setPosition(int x, int y); + public int getWidth(); + public int getHeight(); + public int getX(); + public int getY(); + + public void setVisible(boolean visible); + public boolean setFullscreen(boolean fullscreen); + public boolean isVisible(); + public boolean isFullscreen(); +} diff --git a/src/classes/javax/media/opengl/NativeWindowException.java b/src/classes/javax/media/opengl/NativeWindowException.java new file mode 100644 index 000000000..cb43d3830 --- /dev/null +++ b/src/classes/javax/media/opengl/NativeWindowException.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2003 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. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.opengl; + +/** A generic exception for OpenGL errors used throughout the binding + as a substitute for {@link RuntimeException}. */ + +public class NativeWindowException extends RuntimeException { + /** Constructs a NativeWindowException object. */ + public NativeWindowException() { + super(); + } + + /** Constructs a NativeWindowException object with the specified detail + message. */ + public NativeWindowException(String message) { + super(message); + } + + /** Constructs a NativeWindowException object with the specified detail + message and root cause. */ + public NativeWindowException(String message, Throwable cause) { + super(message, cause); + } + + /** Constructs a NativeWindowException object with the specified root + cause. */ + public NativeWindowException(Throwable cause) { + super(cause); + } +} diff --git a/src/classes/javax/media/opengl/NativeWindowFactory.java b/src/classes/javax/media/opengl/NativeWindowFactory.java new file mode 100644 index 000000000..c206adb78 --- /dev/null +++ b/src/classes/javax/media/opengl/NativeWindowFactory.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2003 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. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.opengl; + +import java.lang.reflect.*; +import java.security.*; +import com.sun.opengl.impl.*; + +public class NativeWindowFactory { + private static Constructor awtFactory = null; + + /** Initializes the sole NativeWindowFactory instance . */ + private static void initializeAWTFactory() throws GLException { + if (awtFactory == null) { + // Use the desktop OpenGL as the fallback always + try { + String osName = System.getProperty("os.name"); + String osNameLowerCase = osName.toLowerCase(); + Class factoryClass = null; + String factoryClassName = null; + + // Because there are some complications with generating all + // platforms' Java glue code on all platforms (among them that we + // would have to include jawt.h and jawt_md.h in the jogl + // sources, which we currently don't have to do) we break the only + // static dependencies with platform-specific code here using reflection. + + if (osNameLowerCase.startsWith("wind")) { + factoryClassName = "com.sun.opengl.impl.windows.awt.WindowsJAWTWindow"; + } else if (osNameLowerCase.startsWith("mac os x")) { + factoryClassName = "com.sun.opengl.impl.macosx.awt.MacOSXJAWTWindow"; + } else { + // Assume Linux, Solaris, etc. Should probably test for these explicitly. + factoryClassName = "com.sun.opengl.impl.x11.awt.X11JAWTWindow"; + } + + if (factoryClassName == null) { + throw new GLException("OS " + osName + " not yet supported"); + } + factoryClass = Class.forName(factoryClassName); + if (factoryClass == null) { + throw new GLException("Factory " + factoryClassName + " not yet implemented"); + } + + try { + awtFactory = factoryClass.getDeclaredConstructor(new Class[] { Object.class }); + } catch(NoSuchMethodException nsme) {} + + } catch (Exception e) { + throw new GLException(e); + } + } + } + + /** + * Returns true, if the given object is an instance of java.awt.Component. + * This check is performed on a Class.getName() basis, + * hence the independency to the java.awt.* package. + */ + public static boolean isAWTComponent(Object target) { + Class clazz = target.getClass(); + do { + if(clazz.getName().equals("java.awt.Component")) { + return true; + } + clazz = clazz.getSuperclass(); + } while (clazz!=null); + return false; + } + + /** + * Returns a NativeWindow. + * + * @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 static NativeWindow getNativeWindow(Object target) + throws IllegalArgumentException, GLException + { + if(null==target) { + throw new IllegalArgumentException("target is null"); + } + if(target instanceof NativeWindow) { + return (NativeWindow)target; + } + if (isAWTComponent(target)) { + initializeAWTFactory(); + if(awtFactory == null) { + throw new GLException("Could not determine an AWT-NativeWindow constructor"); + } + try { + return (NativeWindow) awtFactory.newInstance(new Object[] { target }); + } catch (Exception ie) { + ie.printStackTrace(); + } + } + throw new IllegalArgumentException("Target type is unsupported. Currently supported: \n"+ + "\tjavax.media.opengl.NativeWindow\n"+ + "\tjava.awt.Component\n"); + } +} + diff --git a/src/classes/javax/media/opengl/awt/AWTGLAutoDrawable.java b/src/classes/javax/media/opengl/awt/AWTGLAutoDrawable.java new file mode 100644 index 000000000..ef5a7f2d7 --- /dev/null +++ b/src/classes/javax/media/opengl/awt/AWTGLAutoDrawable.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2003 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. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.opengl.awt; + +import javax.media.opengl.*; +import javax.media.opengl.glu.*; + +public interface AWTGLAutoDrawable extends GLAutoDrawable, ComponentEvents { +} diff --git a/src/classes/javax/media/opengl/AWTGraphicsConfiguration.java b/src/classes/javax/media/opengl/awt/AWTGraphicsConfiguration.java index 25647fc62..93f39bc27 100644 --- a/src/classes/javax/media/opengl/AWTGraphicsConfiguration.java +++ b/src/classes/javax/media/opengl/awt/AWTGraphicsConfiguration.java @@ -37,8 +37,9 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl; +package javax.media.opengl.awt; +import javax.media.opengl.*; import java.awt.GraphicsConfiguration; /** A wrapper for an AWT GraphicsConfiguration allowing it to be diff --git a/src/classes/javax/media/opengl/AWTGraphicsDevice.java b/src/classes/javax/media/opengl/awt/AWTGraphicsDevice.java index 98c7ef2bf..1073aac72 100644 --- a/src/classes/javax/media/opengl/AWTGraphicsDevice.java +++ b/src/classes/javax/media/opengl/awt/AWTGraphicsDevice.java @@ -37,8 +37,9 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl; +package javax.media.opengl.awt; +import javax.media.opengl.*; import java.awt.GraphicsDevice; /** A wrapper for an AWT GraphicsDevice allowing it to be diff --git a/src/classes/javax/media/opengl/ComponentEvents.java b/src/classes/javax/media/opengl/awt/ComponentEvents.java index bfbbb957b..0c4f63c2d 100644 --- a/src/classes/javax/media/opengl/ComponentEvents.java +++ b/src/classes/javax/media/opengl/awt/ComponentEvents.java @@ -37,8 +37,9 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl; +package javax.media.opengl.awt; +import javax.media.opengl.*; import java.awt.event.*; import java.beans.PropertyChangeListener; diff --git a/src/classes/javax/media/opengl/GLCanvas.java b/src/classes/javax/media/opengl/awt/GLCanvas.java index 42f3e68f3..8b52c6da4 100644 --- a/src/classes/javax/media/opengl/GLCanvas.java +++ b/src/classes/javax/media/opengl/awt/GLCanvas.java @@ -37,7 +37,9 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl; +package javax.media.opengl.awt; + +import javax.media.opengl.*; import java.awt.Canvas; import java.awt.Color; @@ -62,7 +64,7 @@ import com.sun.opengl.impl.*; interfaces when adding a heavyweight doesn't work either because of Z-ordering or LayoutManager problems. */ -public class GLCanvas extends Canvas implements GLAutoDrawable { +public class GLCanvas extends Canvas implements AWTGLAutoDrawable { private static final boolean DEBUG = Debug.debug("GLCanvas"); @@ -105,7 +107,8 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { 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, + public GLCanvas(String profile, + GLCapabilities capabilities, GLCapabilitiesChooser chooser, GLContext shareWith, GraphicsDevice device) { @@ -139,7 +142,9 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { this.glCaps = capabilities; } if (!Beans.isDesignTime()) { - drawable = GLDrawableFactory.getFactory().getGLDrawable(this, capabilities, chooser); + drawable = GLDrawableFactory.getFactory(profile, true).createGLDrawable(profile, + NativeWindowFactory.getNativeWindow(this), + capabilities, chooser); context = (GLContextImpl) drawable.createContext(shareWith); context.setSynchronized(true); } diff --git a/src/classes/javax/media/opengl/GLJPanel.java b/src/classes/javax/media/opengl/awt/GLJPanel.java index 2d4e84d77..4c1df74da 100644 --- a/src/classes/javax/media/opengl/GLJPanel.java +++ b/src/classes/javax/media/opengl/awt/GLJPanel.java @@ -37,7 +37,9 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl; +package javax.media.opengl.awt; + +import javax.media.opengl.*; import java.awt.*; import java.awt.geom.*; @@ -79,7 +81,7 @@ import com.sun.opengl.impl.*; */ -public class GLJPanel extends JPanel implements GLAutoDrawable { +public class GLJPanel extends JPanel implements AWTGLAutoDrawable { private static final boolean DEBUG = Debug.debug("GLJPanel"); private static final boolean VERBOSE = Debug.verbose(); |