aboutsummaryrefslogtreecommitdiffstats
path: root/gl4java/drawable/SunJDK13GLDrawableFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'gl4java/drawable/SunJDK13GLDrawableFactory.java')
-rwxr-xr-xgl4java/drawable/SunJDK13GLDrawableFactory.java74
1 files changed, 74 insertions, 0 deletions
diff --git a/gl4java/drawable/SunJDK13GLDrawableFactory.java b/gl4java/drawable/SunJDK13GLDrawableFactory.java
new file mode 100755
index 0000000..bc707d8
--- /dev/null
+++ b/gl4java/drawable/SunJDK13GLDrawableFactory.java
@@ -0,0 +1,74 @@
+package gl4java.drawable;
+
+import java.awt.*;
+import gl4java.*;
+import gl4java.awt.*;
+
+/** A GLDrawableFactory which works with Sun's JDK 1.3 or greater. */
+
+public abstract class SunJDK13GLDrawableFactory extends GLDrawableFactory {
+
+ public GLAnimCanvas createGLAnimCanvas(GLCapabilities capabilities,
+ int width,
+ int height,
+ String glName,
+ String gluName)
+ {
+ GLCapabilities own = null;
+ try {
+ own = (GLCapabilities) capabilities.clone();
+ } catch (Exception ex) { System.out.println(ex); own=capabilities; }
+
+ GraphicsConfiguration config = getGraphicsConfiguration(own);
+ if (config == null) {
+ return null;
+ }
+ return new GLAnimCanvas(config, own,
+ width, height, glName, gluName);
+ }
+
+ public GLCanvas createGLCanvas(GLCapabilities capabilities,
+ int width,
+ int height,
+ String glName,
+ String gluName)
+ {
+ GLCapabilities own = null;
+ try {
+ own = (GLCapabilities) capabilities.clone();
+ } catch (Exception ex) { System.out.println(ex); own=capabilities; }
+
+ GraphicsConfiguration config = getGraphicsConfiguration(own);
+ if (config == null) {
+ return null;
+ }
+ return new GLCanvas(config, own,
+ width, height, glName, gluName);
+ }
+
+ /** Returns the GraphicsConfiguration most closely matching the
+ specified set of GLCapabilities, or null if there was no
+ matching visual.
+
+ @param capabilities the requested set of OpenGL capabilities of
+ the canvas
+ @return a GraphicsConfiguration supporting the set of specified capabilities,
+ or null if there was no matching visual
+ */
+ public GraphicsConfiguration getGraphicsConfiguration
+ (GLCapabilities capabilities)
+ {
+ return getGraphicsConfiguration(capabilities,
+ GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice());
+ }
+
+ //----------------------------------------------------------------------
+ // Internals only below this point
+ //
+
+ /** The choice of the GraphicsDevice is not yet exported to
+ clients. */
+ abstract GraphicsConfiguration
+ getGraphicsConfiguration(GLCapabilities capabilities,
+ GraphicsDevice device);
+}