Update of /cvsroot/jake2/jake2/src/jake2/render/opengl
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv5700/src/jake2/render/opengl
Modified Files:
Jsr231Driver.java
Log Message:
add some context init code from jogl-demos
Index: Jsr231Driver.java
===================================================================
RCS file: /cvsroot/jake2/jake2/src/jake2/render/opengl/Jsr231Driver.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Jsr231Driver.java 22 Nov 2006 22:09:54 -0000 1.4
--- Jsr231Driver.java 23 Nov 2006 18:10:32 -0000 1.5
***************
*** 162,166 ****
window.setIconImage(icon.getImage());
! Display canvas = new Display();
// we want keypressed events for TAB key
canvas.setFocusTraversalKeysEnabled(false);
--- 162,166 ----
window.setIconImage(icon.getImage());
! Display canvas = new Display(new GLCapabilities());
// we want keypressed events for TAB key
canvas.setFocusTraversalKeysEnabled(false);
***************
*** 289,300 ****
// --------------------------------------------------------------------------
! private class Display extends Canvas {
private GLDrawable drawable;
private GLContext context;
! public Display() {
! drawable = GLDrawableFactory.getFactory().getGLDrawable(this,
! new GLCapabilities(), null);
context = drawable.createContext(null);
}
--- 289,300 ----
// --------------------------------------------------------------------------
! private static class Display extends Canvas {
private GLDrawable drawable;
private GLContext context;
! public Display(GLCapabilities capabilities) {
! super(unwrap((AWTGraphicsConfiguration)GLDrawableFactory.getFactory().chooseGraphicsConfiguration(capabilities, null, null)));
! drawable = GLDrawableFactory.getFactory().getGLDrawable(this, capabilities, null);
context = drawable.createContext(null);
}
***************
*** 335,338 ****
--- 335,345 ----
drawable.setRealized(false);
}
+
+ private static GraphicsConfiguration unwrap(AWTGraphicsConfiguration config) {
+ if (config == null) {
+ return null;
+ }
+ return config.getGraphicsConfiguration();
+ }
}
}
|