aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/javax/media/opengl/X11GraphicsDevice.java
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2008-12-20 08:58:00 +0000
committerKenneth Russel <[email protected]>2008-12-20 08:58:00 +0000
commit6eda9476e8168bacdeb1854540d89bd9db0d5029 (patch)
tree692317f9924638836b16bf83a9cefe0c1047bb66 /src/classes/javax/media/opengl/X11GraphicsDevice.java
parent14a94c810910f88d3b7214ae9be5027dc74df39f (diff)
Factored out the remaining toolkit, and specifically AWT, dependencies
from GLDrawableFactory implementations into NativeWindowFactory implementations. These dependencies were the up-front selection of the GraphicsConfiguration and the locking and unlocking of the toolkit, which are both currently needed only on X11 platforms due to how OpenGL and the window system interact there. Added X11GraphicsDevice and X11GraphicsConfiguration classes which are intended to be used by Newt or potentially other third-party window toolkits. Unified the separate NativeWindow and AWT GLDrawableFactory implementations in the GLDrawableFactory class. Exposed the toolkit locking mechanism through the NativeWindowFactory and introduced the concept of a default NativeWindowFactory which is used by the X11 drawable and context implementations. Removed unnecessary toolkit locking calls from Mac OS X and Windows drawable and context implementations. Added a registration mechanism for new NativeWindowFactories, allowing third parties to plug in new window toolkits orthogonally to the OpenGL drawable and context code. The public APIs for the NativeWindowFactory and the GLDrawableFactory, in particular how they are fetched, changed as a result of these refactorings. Updated all uses. Fixed bug in X11OffscreenGLXDrawable introduced during last set of changes. Tested demos on Solaris, Mac OS X and Windows. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1824 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/javax/media/opengl/X11GraphicsDevice.java')
-rw-r--r--src/classes/javax/media/opengl/X11GraphicsDevice.java53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/classes/javax/media/opengl/X11GraphicsDevice.java b/src/classes/javax/media/opengl/X11GraphicsDevice.java
new file mode 100644
index 000000000..1a8900f31
--- /dev/null
+++ b/src/classes/javax/media/opengl/X11GraphicsDevice.java
@@ -0,0 +1,53 @@
+/*
+ * 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 javax.media.opengl;
+
+/** Encapsulates a graphics device, or screen, on X11
+ platforms. Objects of this type are passed to {@link
+ NativeWindowFactory#chooseGraphicsConfiguration
+ NativeWindowFactory.chooseGraphicsConfiguration()} on X11
+ platforms when toolkits other than the AWT are being used. */
+
+public class X11GraphicsDevice implements AbstractGraphicsDevice {
+ private int screen;
+
+ /** Constructs a new X11GraphicsDevice corresponding to the given screen. */
+ public X11GraphicsDevice(int screen) {
+ this.screen = screen;
+ }
+
+ /** Returns the screen that this graphics device object represents. */
+ public int getScreen() {
+ return screen;
+ }
+}