summaryrefslogtreecommitdiffstats
path: root/src/demos/es2/RedSquare.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/demos/es2/RedSquare.java')
-rwxr-xr-xsrc/demos/es2/RedSquare.java21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/demos/es2/RedSquare.java b/src/demos/es2/RedSquare.java
index 4b80c1c..cd3042c 100755
--- a/src/demos/es2/RedSquare.java
+++ b/src/demos/es2/RedSquare.java
@@ -11,7 +11,7 @@ import com.sun.opengl.util.glsl.*;
import com.sun.javafx.newt.*;
import com.sun.javafx.newt.opengl.*;
-public class RedSquare extends Thread implements MouseListener, GLEventListener {
+public class RedSquare extends Thread implements WindowListener, MouseListener, GLEventListener {
private GLWindow window;
private GLProfile glp;
@@ -24,6 +24,18 @@ public class RedSquare extends Thread implements MouseListener, GLEventListener
super();
}
+ public void windowResized(WindowEvent e) { }
+
+ public void windowMoved(WindowEvent e) { }
+
+ public void windowGainedFocus(WindowEvent e) { }
+
+ public void windowLostFocus(WindowEvent e) { }
+
+ public void windowDestroyNotify(WindowEvent e) {
+ quit = true;
+ }
+
public void mouseClicked(MouseEvent e) {
System.out.println(glp+" mouseevent: "+e);
switch(e.getClickCount()) {
@@ -57,11 +69,6 @@ public class RedSquare extends Thread implements MouseListener, GLEventListener
System.err.println(glp+" RedSquare.start()");
try {
GLCapabilities caps = new GLCapabilities(glp);
- // For emulation library, use 16 bpp
- caps.setRedBits(5);
- caps.setGreenBits(6);
- caps.setBlueBits(5);
- caps.setDepthBits(16);
Window nWindow = null;
if(0!=(type&USE_AWT)) {
@@ -71,6 +78,7 @@ public class RedSquare extends Thread implements MouseListener, GLEventListener
}
window = GLWindow.create(nWindow, caps);
+ window.addWindowListener(this);
window.addMouseListener(this);
window.addGLEventListener(this);
// window.setEventHandlerMode(GLWindow.EVENT_HANDLER_GL_CURRENT); // default
@@ -222,7 +230,6 @@ public class RedSquare extends Thread implements MouseListener, GLEventListener
st=null;
pmvMatrix.destroy();
pmvMatrix=null;
- quit=true;
System.out.println(glp+" RedSquare.dispose: fin");
}