summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java44
-rw-r--r--src/demos/proceduralTexturePhysics/Water.java6
2 files changed, 27 insertions, 23 deletions
diff --git a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java
index f4dc264..427d645 100644
--- a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java
+++ b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java
@@ -76,40 +76,32 @@ import javax.swing.JOptionPane;
*/
public class ProceduralTexturePhysics extends Demo {
- public ProceduralTexturePhysics() {
-
+ public static void main(String[] args) {
GLCanvas canvas = new GLCanvas();
- ProceduralTexturePhysics demo = new ProceduralTexturePhysics();
+ final ProceduralTexturePhysics demo = new ProceduralTexturePhysics();
canvas.addGLEventListener(demo);
canvas.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
- dispatchKey(e.getKeyChar());
+ demo.dispatchKey(e.getKeyChar());
}
});
canvas.addMouseListener(new MouseAdapter() {
-
public void mousePressed(MouseEvent e) {
- if (e.getButton() == MouseEvent.BUTTON1 &&
- !e.isAltDown() && !e.isMetaDown()) {
- drawing = true;
- }
+ demo.dispatchMousePress(e);
}
public void mouseReleased(MouseEvent e) {
- if (e.getButton() == MouseEvent.BUTTON1) {
- drawing = false;
- }
+ demo.dispatchMouseRelease(e);
}
});
canvas.addMouseMotionListener(new MouseMotionAdapter() {
public void mouseDragged(MouseEvent e) {
- mousePosX = e.getX();
- mousePosY = e.getY();
+ demo.dispatchMouseDrag(e);
}
});
@@ -398,6 +390,24 @@ public class ProceduralTexturePhysics extends Demo {
}
}
+ private void dispatchMousePress(MouseEvent e) {
+ if (e.getButton() == MouseEvent.BUTTON1 &&
+ !e.isAltDown() && !e.isMetaDown()) {
+ drawing = true;
+ }
+ }
+
+ private void dispatchMouseRelease(MouseEvent e) {
+ if (e.getButton() == MouseEvent.BUTTON1) {
+ drawing = false;
+ }
+ }
+
+ public void dispatchMouseDrag(MouseEvent e) {
+ mousePosX = e.getX();
+ mousePosY = e.getY();
+ }
+
private static void runExit(final Animator animator) {
// Note: calling System.exit() synchronously inside the draw,
// reshape or init callbacks can lead to deadlocks on certain
@@ -412,10 +422,4 @@ public class ProceduralTexturePhysics extends Demo {
}
}).start();
}
-
-
-
- public static void main(String[] args) {
- new ProceduralTexturePhysics();
- }
}
diff --git a/src/demos/proceduralTexturePhysics/Water.java b/src/demos/proceduralTexturePhysics/Water.java
index 9de583d..12d339c 100644
--- a/src/demos/proceduralTexturePhysics/Water.java
+++ b/src/demos/proceduralTexturePhysics/Water.java
@@ -528,9 +528,9 @@ public class Water {
createAndWriteUVOffsets(gl, initialMapDimensions[0], initialMapDimensions[1]);
- checkExtension(gl, "GL_vertex_program");
- checkExtension(gl, "GL_fragment_program");
- checkExtension(gl, "GL_multitexture");
+ checkExtension(gl, "GL_ARB_vertex_program");
+ checkExtension(gl, "GL_ARB_fragment_program");
+ checkExtension(gl, "GL_ARB_multitexture");
///////////////////////////////////////////////////////////////////////////
// UV Offset Vertex Program