summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2008-06-28 20:15:07 +0000
committerSven Gothel <[email protected]>2008-06-28 20:15:07 +0000
commit48d458b7946506fc0de597c68267f46d3936c56d (patch)
tree75c4e1e7ebbb6c822d5337209e21545e9d9cb3d6 /src
parentd347e888b8bbc189e8844a2ae3c819c39f520c9b (diff)
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
Diffstat (limited to 'src')
-rwxr-xr-xsrc/demos/es1/RedSquare.java22
1 files changed, 19 insertions, 3 deletions
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();