From 90496a6135d0964af2e2fa0b81a349a7bf54b8b9 Mon Sep 17 00:00:00 2001 From: benfry Date: Tue, 9 Nov 2004 21:48:36 +0000 Subject: [PATCH] working on opengl --- build/windows/make.sh | 11 +++++++++++ core/PApplet.java | 32 ++++++++++++++++++++------------ core/PGraphics.java | 2 +- core/todo.txt | 2 ++ 4 files changed, 34 insertions(+), 13 deletions(-) diff --git a/build/windows/make.sh b/build/windows/make.sh index 02427a65b..52275319c 100755 --- a/build/windows/make.sh +++ b/build/windows/make.sh @@ -188,3 +188,14 @@ zip -r0q library/particles.jar simong rm -rf simong mkdir -p ../../build/windows/work/libraries/particles/library/ cp library/particles.jar ../../build/windows/work/libraries/particles/library/ + + +# OPENGL LIBRARY +echo Building OpenGL library... +cd ../../lib/opengl +../../build/windows/work/jikes +D -classpath "library\\jogl.jar;$CLASSPATH" -d . *.java +rm -f library/opengl.jar +zip -r0q library/opengl.jar processing +rm -rf processing +mkdir -p ../../build/windows/work/libraries/opengl/library/ +cp library/opengl.jar ../../build/windows/work/libraries/opengl/library/ diff --git a/core/PApplet.java b/core/PApplet.java index 57f6a1509..efe727174 100644 --- a/core/PApplet.java +++ b/core/PApplet.java @@ -175,12 +175,7 @@ public class PApplet extends Applet // can/may be resized later //g = new PGraphics(DEFAULT_WIDTH, DEFAULT_HEIGHT); - initg(); - - addMouseListener(this); - addMouseMotionListener(this); - addKeyListener(this); - addFocusListener(this); + initGraphics(); // send tab keys through to the PApplet try { @@ -190,8 +185,8 @@ public class PApplet extends Applet Component.class.getMethod("setFocusTraversalKeysEnabled", new Class[] { Boolean.TYPE }); defocus.invoke(this, new Object[] { Boolean.FALSE }); - } else { - System.out.println(jdkVersion); + //} else { + //System.out.println(jdkVersion); } } catch (Exception e) { } // oh well @@ -250,8 +245,14 @@ public class PApplet extends Applet // override for subclasses (i.e. opengl) // so that init() doesn't have to be replicated - public void initg() { + public void initGraphics() { g = new PGraphics(DEFAULT_WIDTH, DEFAULT_HEIGHT); + + // 0073: moved here so that can be overridden for PAppletGL + addMouseListener(this); + addMouseMotionListener(this); + addKeyListener(this); + addFocusListener(this); } @@ -915,12 +916,19 @@ public class PApplet extends Applet // and i run the block. + public void focusGained() { } + public void focusGained(FocusEvent e) { focused = true; + focusGained(); } + + public void focusLost() { } + public void focusLost(FocusEvent e) { focused = false; + focusLost(); } @@ -4172,7 +4180,7 @@ public class PApplet extends Applet } - public void copy(int sx1, int sy1, int sx2, int sy2, + public void copy(int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2) { g.copy(sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2); } @@ -4199,13 +4207,13 @@ public class PApplet extends Applet } - public void blend(int sx1, int sy1, int sx2, int sy2, + public void blend(int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2, int mode) { g.blend(sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, mode); } - public void blend(PImage src, int sx1, int sy1, int sx2, int sy2, + public void blend(PImage src, int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2, int mode) { g.blend(src, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, mode); } diff --git a/core/PGraphics.java b/core/PGraphics.java index 79b78a3e6..46e79682a 100644 --- a/core/PGraphics.java +++ b/core/PGraphics.java @@ -1507,7 +1507,7 @@ public class PGraphics extends PImage case CONCAVE_POLYGON: case CONVEX_POLYGON: { - triangulate_polygon(); + triangulate_polygon(); } break; } diff --git a/core/todo.txt b/core/todo.txt index 5e0721f9d..f23775cbf 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -1,4 +1,6 @@ 0073 +X added focusGained() and focusLost() +_ add to preprocessor _ image("blah.jpg"); _ loadImage() is broken on some machines