diff options
author | Carsten Weisse <[email protected]> | 2006-11-23 18:10:32 +0000 |
---|---|---|
committer | Carsten Weisse <[email protected]> | 2006-11-23 18:10:32 +0000 |
commit | 73182184a0e925ca319d133b4c3c4b7ee0ee7610 (patch) | |
tree | 0f05a183336d749c2d2d8eb9cb2d16886d0f03cc /src/jake2 | |
parent | aa012c424d5bca2d64333fd1fc9aeb32248f9b8e (diff) |
add some context init code from jogl-demos
Diffstat (limited to 'src/jake2')
-rw-r--r-- | src/jake2/render/opengl/Jsr231Driver.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/jake2/render/opengl/Jsr231Driver.java b/src/jake2/render/opengl/Jsr231Driver.java index 733b3f8..cd874ee 100644 --- a/src/jake2/render/opengl/Jsr231Driver.java +++ b/src/jake2/render/opengl/Jsr231Driver.java @@ -2,7 +2,7 @@ * JoglCommon.java * Copyright (C) 2004 * - * $Id: Jsr231Driver.java,v 1.4 2006-11-22 22:09:54 cawe Exp $ + * $Id: Jsr231Driver.java,v 1.5 2006-11-23 18:10:32 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -161,7 +161,7 @@ public abstract class Jsr231Driver extends Jsr231GL implements GLDriver { ImageIcon icon = new ImageIcon(getClass().getResource("/icon-small.png")); window.setIconImage(icon.getImage()); - Display canvas = new Display(); + Display canvas = new Display(new GLCapabilities()); // we want keypressed events for TAB key canvas.setFocusTraversalKeysEnabled(false); @@ -288,14 +288,14 @@ public abstract class Jsr231Driver extends Jsr231GL implements GLDriver { // -------------------------------------------------------------------------- - private class Display extends Canvas { + private static class Display extends Canvas { private GLDrawable drawable; private GLContext context; - public Display() { - drawable = GLDrawableFactory.getFactory().getGLDrawable(this, - new GLCapabilities(), null); + public Display(GLCapabilities capabilities) { + super(unwrap((AWTGraphicsConfiguration)GLDrawableFactory.getFactory().chooseGraphicsConfiguration(capabilities, null, null))); + drawable = GLDrawableFactory.getFactory().getGLDrawable(this, capabilities, null); context = drawable.createContext(null); } @@ -334,5 +334,12 @@ public abstract class Jsr231Driver extends Jsr231GL implements GLDriver { context.destroy(); drawable.setRealized(false); } + + private static GraphicsConfiguration unwrap(AWTGraphicsConfiguration config) { + if (config == null) { + return null; + } + return config.getGraphicsConfiguration(); + } } } |