From 48d458b7946506fc0de597c68267f46d3936c56d Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 28 Jun 2008 20:15:07 +0000 Subject: optional forced newt-awt usage git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@253 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4 --- src/demos/es1/RedSquare.java | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/demos') diff --git a/src/demos/es1/RedSquare.java b/src/demos/es1/RedSquare.java index fe69983..9280762 100755 --- a/src/demos/es1/RedSquare.java +++ b/src/demos/es1/RedSquare.java @@ -13,6 +13,7 @@ public class RedSquare implements MouseListener { public boolean toggleFS = false; public void mouseClicked(MouseEvent e) { + System.out.println("mouseevent: "+e); switch(e.getClickCount()) { case 1: toggleFS=true; @@ -39,9 +40,21 @@ public class RedSquare implements MouseListener { System.out.println("RedSquare.main()"); GLProfile.setProfileGL2ES1(); try { - Display display = NewtFactory.createDisplay(null); // local display - Screen screen = NewtFactory.createScreen(display, 0); // screen 0 - Window window = NewtFactory.createWindow(screen, 0); // dummy VisualID + Display display; + Screen screen; + Window window; + + if(args.length>=1 && args[0].equals("-awt")) { + display = NewtFactory.createDisplay(NewtFactory.AWT, null); // local display + screen = NewtFactory.createScreen(NewtFactory.AWT, display, 0); // screen 0 + window = NewtFactory.createWindow(NewtFactory.AWT, screen, 0); // dummy VisualID + } else { + display = NewtFactory.createDisplay(null); // local display + screen = NewtFactory.createScreen(display, 0); // screen 0 + window = NewtFactory.createWindow(screen, 0); // dummy VisualID + } + + System.out.println("Created Window: "+window); RedSquare ml = new RedSquare(); window.addMouseListener(ml); @@ -54,6 +67,7 @@ public class RedSquare implements MouseListener { // Hook this into EGL GLDrawableFactory factory = GLDrawableFactory.getFactory(window); + System.out.println("Drawable Factory: "+factory); GLCapabilities caps = new GLCapabilities(); // For emulation library, use 16 bpp caps.setRedBits(5); @@ -63,6 +77,7 @@ public class RedSquare implements MouseListener { GLDrawable drawable = factory.createGLDrawable(window, caps, null); window.setVisible(true); drawable.setRealized(true); + System.out.println("Drawable: "+drawable); GLContext context = drawable.createContext(null); System.out.println("Created context: " + context); int res = context.makeCurrent(); @@ -162,6 +177,7 @@ public class RedSquare implements MouseListener { context.destroy(); drawable.destroy(); factory.shutdown(); + //window.close(); System.out.println("RedSquare shut down cleanly."); } catch (Throwable t) { t.printStackTrace(); -- cgit v1.2.3