From 4581df6ef6109ed71671e6409b66e40647a4c90e Mon Sep 17 00:00:00 2001 From: benfry Date: Sun, 19 Dec 2004 22:39:29 +0000 Subject: [PATCH] got opengl working again using alternate threading/component model --- processing/app/PdeBase.java | 66 ++++----- processing/app/PdeRuntime.java | 9 +- processing/build/macosx/make.sh | 11 ++ .../build/windows/launcher/launcher.cpp | 17 ++- .../build/windows/launcher/processing.exe | Bin 123829 -> 123829 bytes processing/core/PApplet.java | 125 +++++++++++++----- processing/core/PGraphics.java | 8 ++ 7 files changed, 160 insertions(+), 76 deletions(-) diff --git a/processing/app/PdeBase.java b/processing/app/PdeBase.java index d3c86515d..111bbeb36 100644 --- a/processing/app/PdeBase.java +++ b/processing/app/PdeBase.java @@ -17,8 +17,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -39,11 +39,11 @@ import com.apple.mrj.*; /** * Primary role of this class is for platform identification and - * general interaction with the system (launching URLs, loading + * general interaction with the system (launching URLs, loading * files and images, etc) that comes from that. */ public class PdeBase { - static final String VERSION = "0072 Alpha"; + static final String VERSION = "0075 Alpha"; PdeEditor editor; @@ -104,7 +104,7 @@ public class PdeBase { } else { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } - } catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } @@ -159,13 +159,13 @@ public class PdeBase { /** - * Given the reference filename from the keywords list, + * Given the reference filename from the keywords list, * builds a URL and passes it to openURL. */ static public void showReference(String referenceFile) { String currentDir = System.getProperty("user.dir"); - openURL(currentDir + File.separator + - "reference" + File.separator + + openURL(currentDir + File.separator + + "reference" + File.separator + referenceFile + ".html"); } @@ -173,24 +173,24 @@ public class PdeBase { /** * Implements the cross-platform headache of opening URLs */ - static public void openURL(String url) { + static public void openURL(String url) { //System.out.println("opening url " + url); try { if (platform == WINDOWS) { - // this is not guaranteed to work, because who knows if the + // this is not guaranteed to work, because who knows if the // path will always be c:\progra~1 et al. also if the user has - // a different browser set as their default (which would + // a different browser set as their default (which would // include me) it'd be annoying to be dropped into ie. - //Runtime.getRuntime().exec("c:\\progra~1\\intern~1\\iexplore " - // + currentDir + //Runtime.getRuntime().exec("c:\\progra~1\\intern~1\\iexplore " + // + currentDir - // the following uses a shell execute to launch the .html file + // the following uses a shell execute to launch the .html file // note that under cygwin, the .html files have to be chmodded +x // after they're unpacked from the zip file. i don't know why, - // and don't understand what this does in terms of windows - // permissions. without the chmod, the command prompt says + // and don't understand what this does in terms of windows + // permissions. without the chmod, the command prompt says // "Access is denied" in both cygwin and the "dos" prompt. - //Runtime.getRuntime().exec("cmd /c " + currentDir + "\\reference\\" + + //Runtime.getRuntime().exec("cmd /c " + currentDir + "\\reference\\" + // referenceFile + ".html"); if (url.startsWith("http://")) { // open dos prompt, give it 'start' command, which will @@ -248,13 +248,13 @@ public class PdeBase { } catch (IOException e) { PdeBase.showWarning("Could not open URL", "An error occurred while trying to open\n" + url, e); - + //e.printStackTrace(); } } - /** + /** * Implements the other cross-platform headache of opening * a folder in the machine's native file browser. */ @@ -296,7 +296,7 @@ public class PdeBase { /** * Non-fatal error message with optional stack trace side dish. */ - static public void showWarning(String title, String message, + static public void showWarning(String title, String message, Exception e) { if (title == null) title = "Warning"; JOptionPane.showMessageDialog(new Frame(), message, title, @@ -312,7 +312,7 @@ public class PdeBase { * This is an error that can't be recovered. Use showWarning() * for errors that allow P5 to continue running. */ - static public void showError(String title, String message, + static public void showError(String title, String message, Exception e) { if (title == null) title = "Error"; JOptionPane.showMessageDialog(new Frame(), message, title, @@ -346,21 +346,21 @@ public class PdeBase { tracker.addImage(image, 0); try { tracker.waitForAll(); - } catch (InterruptedException e) { } + } catch (InterruptedException e) { } return image; } - static public InputStream getStream(String filename) + static public InputStream getStream(String filename) throws IOException { - if ((PdeBase.platform == PdeBase.MACOSX) || + if ((PdeBase.platform == PdeBase.MACOSX) || (PdeBase.platform == PdeBase.MACOS9)) { // macos doesn't seem to think that files in the lib folder // are part of the resources, unlike windows or linux. - // actually, this is only the case when running as a .app, + // actually, this is only the case when running as a .app, // since it works fine from run.sh, but not Processing.app return new FileInputStream("lib/" + filename); - } + } // all other, more reasonable operating systems //return cls.getResource(filename).openStream(); @@ -411,7 +411,7 @@ public class PdeBase { /** * Grab the contents of a file as a string. */ - static public String loadFile(File file) throws IOException { + static public String loadFile(File file) throws IOException { // empty code file.. no worries, might be getting filled up later if (file.length() == 0) return ""; @@ -432,7 +432,7 @@ public class PdeBase { /** * Spew the contents of a String object out to a file. */ - static public void saveFile(String str, + static public void saveFile(String str, File file) throws IOException { ByteArrayInputStream bis = new ByteArrayInputStream(str.getBytes()); @@ -451,7 +451,7 @@ public class PdeBase { } - static public void copyDir(File sourceDir, + static public void copyDir(File sourceDir, File targetDir) throws IOException { targetDir.mkdirs(); String files[] = sourceDir.list(); @@ -482,9 +482,9 @@ public class PdeBase { /** - * Recursively remove all files within a directory, + * Recursively remove all files within a directory, * used with removeDir(), or when the contents of a dir - * should be removed, but not the directory itself. + * should be removed, but not the directory itself. * (i.e. when cleaning temp files from lib/build) */ static public void removeDescendants(File dir) { @@ -510,8 +510,8 @@ public class PdeBase { /** - * Calculate the size of the contents of a folder. - * Used to determine whether sketches are empty or not. + * Calculate the size of the contents of a folder. + * Used to determine whether sketches are empty or not. * Note that the function calls itself recursively. */ static public int calcFolderSize(File folder) { diff --git a/processing/app/PdeRuntime.java b/processing/app/PdeRuntime.java index 4cb0e54e9..3d2361f35 100644 --- a/processing/app/PdeRuntime.java +++ b/processing/app/PdeRuntime.java @@ -333,18 +333,18 @@ public class PdeRuntime implements PdeMessageConsumer { //System.out.println("killing external process"); try { - System.out.println("writing to stop process"); + //System.out.println("writing to stop process"); processOutput.write('s'); - System.out.println("written"); + //System.out.println("written"); processOutput.flush(); - System.out.println("flushing"); + //System.out.println("flushing"); } catch (IOException e) { //System.err.println("error stopping external applet"); //e.printStackTrace(); close(); } - System.out.println("out"); + //System.out.println("out"); } } @@ -411,6 +411,7 @@ public class PdeRuntime implements PdeMessageConsumer { // always shove out the mesage, since it might not fall under // the same setup as we're expecting System.err.print(s); + System.err.flush(); // if s.length <=2, ignore it because that probably means // that it's just the platform line-terminators. diff --git a/processing/build/macosx/make.sh b/processing/build/macosx/make.sh index c3d8c07c0..c43add80e 100755 --- a/processing/build/macosx/make.sh +++ b/processing/build/macosx/make.sh @@ -167,5 +167,16 @@ mkdir -p ../../build/macosx/work/libraries/particles/library/ cp library/particles.jar ../../build/macosx/work/libraries/particles/library/ +# OPENGL LIBRARY +echo Building OpenGL library... +cd ../../lib/opengl +../../build/macosx/work/jikes -target 1.1 +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/macosx/work/libraries/opengl/library/ +cp library/opengl.jar ../../build/macosx/work/libraries/opengl/library/ + + echo echo Done. \ No newline at end of file diff --git a/processing/build/windows/launcher/launcher.cpp b/processing/build/windows/launcher/launcher.cpp index f5f1e6b53..92dfc7bda 100644 --- a/processing/build/windows/launcher/launcher.cpp +++ b/processing/build/windows/launcher/launcher.cpp @@ -137,18 +137,19 @@ WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow) //"\"" // begin quote //"'" - "%s" - "%s" - //"%s" + "%s" // local jre or blank + "%s" // qtjava path - //"%s\\lib\\comm.jar;" "%s\\lib;" "%s\\lib\\build;" "%s\\lib\\pde.jar;" "%s\\lib\\core.jar;" "%s\\lib\\mrj.jar;" "%s\\lib\\oro.jar;" - "%s\\lib\\antlr.jar;", + "%s\\lib\\antlr.jar;" + + "%s", // original CLASSPATH + //"C:\\WINNT\\system32\\QTJava.zip;" // worthless //"C:\\WINDOWS\\system32\\QTJava.zip;" @@ -161,11 +162,9 @@ WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow) //local_jre_installed ? "java\\lib\\rt.jar;java\\lib\\jaws.jar;" : "", local_jre_installed ? "java\\lib\\rt.jar;" : "", qtjava_path, - //env_classpath, - - // the next several %s args loaddir, loaddir, loaddir, loaddir, - loaddir, loaddir, loaddir); + loaddir, loaddir, loaddir, + env_classpath); //MessageBox(NULL, cp, // "it's twoo! it's twoo!", MB_OK); diff --git a/processing/build/windows/launcher/processing.exe b/processing/build/windows/launcher/processing.exe index e4cd8337ec588f1f6d9982f8d140e7e2b7499234..ddaaa46e2cc7f0447f58334da616518cc17a45d1 100755 GIT binary patch delta 5492 zcma)A4OEm>8oqZJhd~Esh#xKd8DUWO1f(b$2Ej*Jn>)0? z+IME>1WxU3PqoF-HLWd3QV~-pNJcah@u$?YN6XyCGoBNzE>dc<&-={}Lo$1ub7sE# zJrbe+*q3Pib-;VS4<`kj(4(KaUx$X71ZUeeq1^-7|}mt$ z@eFf(Jej11@|NNFMYWeKZmp#zUSggb2F7YHX+5t-GX{*AC1y`D;ny*Lz@0llii&NX z#iT5@7##UmaM8PGTeMnOc>Xhru_iM{^)C7GjaJpwjDYpMa*_fg`(q|$ti`h%X7(f^ zYJWT@r`X4li?S5_T&rTRcwP_VU2;-5pGW*3Y%uVwAgfpkqUb%lbU-pyKQ-eq_E^dY zC4sJ9nP<^@HjhB&ogUvvT#&?M%+vAFq)>&%Cs^l+>z;={w2AS47$&2dX2Z0;Uw++l90_}0 zQTnr;l=#-{SLpK2#cVh?gn!T@1s8wk{IhO+>K6Daxtr{{CUwPfHz`_+hw`FkkdViE zXP0gU&vV|;jkS3;P*Rr+yOtsksOkkP8zZ$OD=?fEZQ zrISowfG7Cl0NR;VV(2O@Es_&JTLJ+n1_71i(vjh+?=`;aQs(5ohSs9S_sj)B8Itbb z$*2puLBK%(1p<%^HID&6y~|i%rvV{braDhYPqw{Q-(5YTZJIxtzFi9BVb6Voa(f4r zr6Cf5%2raTg9;u!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