summaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2005-11-09 23:40:33 +0000
committerKenneth Russel <[email protected]>2005-11-09 23:40:33 +0000
commitc3f4b1c7ccdd682f772fb0bdb67e3dd292ba9c06 (patch)
tree21f58338f25e986abe3c984ce1b6025552501367 /src/classes/com/sun
parent221199afb57829adac29f3b2988453b67331a324 (diff)
Made public API changes discussed with expert group to make core JOGL
API more toolkit-agnostic: 1. Decoupled instantiation of GLCanvas and GLJPanel objects from the GLDrawableFactory. GLCanvas and GLJPanel's constructors are now public and the associated factory methods have been removed from the GLDrawableFactory. 2. Changed the signature of GLDrawableFactory. chooseGraphicsConfiguration() to accept and return marker AbstractGraphicsDevice and AbstractGraphicsConfiguration interfaces, respectively. Defined new AWTGraphicsDevice and AWTGraphicsConfiguration wrapper classes simply wrapping the associated objects. An SWT port could define similar wrapper classes for its data types. 3. Allowed overriding of the specific GLDrawableFactory subclass instantiated through GLDrawableFactory.getFactory() by setting the system property "opengl.factory.class.name". For example, an SWT port might swap itself in by specifying the following system property on the command line: -Dopengl.factory.class.name=com.ibm.swt.opengl.SWTGLDrawableFactory Tested on Solaris/SPARC. Also fixed breakage on Solaris/SPARC due to recent split of jogl native library into jogl and jogl_awt pieces. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@431 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun')
-rw-r--r--src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawableFactory.java8
-rw-r--r--src/classes/com/sun/opengl/impl/windows/WindowsGLDrawableFactory.java8
-rw-r--r--src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java19
3 files changed, 20 insertions, 15 deletions
diff --git a/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawableFactory.java
index 9b351798c..22f550456 100644
--- a/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawableFactory.java
+++ b/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawableFactory.java
@@ -41,8 +41,6 @@ package com.sun.opengl.impl.macosx;
import java.awt.Component;
import java.awt.EventQueue;
-import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsDevice;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
@@ -54,9 +52,9 @@ public class MacOSXGLDrawableFactory extends GLDrawableFactoryImpl {
NativeLibLoader.loadCore();
}
- public GraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities,
- GLCapabilitiesChooser chooser,
- GraphicsDevice device) {
+ public AbstractGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities,
+ GLCapabilitiesChooser chooser,
+ AbstractGraphicsDevice device) {
return null;
}
diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawableFactory.java
index ac56d9469..4649ba8d0 100644
--- a/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawableFactory.java
+++ b/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawableFactory.java
@@ -40,8 +40,6 @@
package com.sun.opengl.impl.windows;
import java.awt.Component;
-import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsDevice;
import java.awt.Rectangle;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
@@ -64,9 +62,9 @@ public class WindowsGLDrawableFactory extends GLDrawableFactoryImpl {
NativeLibLoader.loadCore();
}
- public GraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities,
- GLCapabilitiesChooser chooser,
- GraphicsDevice device) {
+ public AbstractGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities,
+ GLCapabilitiesChooser chooser,
+ AbstractGraphicsDevice device) {
return null;
}
diff --git a/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java b/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java
index 133431824..64b4d437c 100644
--- a/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java
+++ b/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java
@@ -78,17 +78,26 @@ public class X11GLDrawableFactory extends GLDrawableFactoryImpl {
private static final int MAX_ATTRIBS = 128;
- public GraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities,
- GLCapabilitiesChooser chooser,
- GraphicsDevice device) {
+ public AbstractGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities,
+ GLCapabilitiesChooser chooser,
+ AbstractGraphicsDevice absDevice) {
if (capabilities == null) {
capabilities = new GLCapabilities();
}
if (chooser == null) {
chooser = new DefaultGLCapabilitiesChooser();
}
- if (device == null) {
+ GraphicsDevice device = null;
+ if (absDevice != null &&
+ !(absDevice instanceof AWTGraphicsDevice)) {
+ throw new GLException("This GLDrawableFactory accepts only AWTGraphicsDevice objects");
+ }
+
+ if ((absDevice == null) ||
+ (((AWTGraphicsDevice) absDevice).getGraphicsDevice() == null)) {
device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
+ } else {
+ device = ((AWTGraphicsDevice) absDevice).getGraphicsDevice();
}
int screen = X11SunJDKReflection.graphicsDeviceGetScreen(device);
@@ -142,7 +151,7 @@ public class X11GLDrawableFactory extends GLDrawableFactoryImpl {
GraphicsConfiguration config = configs[i];
if (config != null) {
if (X11SunJDKReflection.graphicsConfigurationGetVisualID(config) == visualID) {
- return config;
+ return new AWTGraphicsConfiguration(config);
}
}
}