jashkenas / ruby-processing

Code as Art, Art as Code. Processing and Ruby are meant for each other.
http://github.com/jashkenas/ruby-processing/wikis
Other
1.28k stars 94 forks source link

rp5 watch does not work with opengl renderers (P2D and P3D sketches) #65

Closed monkstone closed 10 years ago

monkstone commented 11 years ago

This may not be fixable from ruby-processing, since I believe opengl resources do not get properly released in vanilla processing. Anyway if you use a decent editor with macro support (sublime, emacs, vim, jEdit) it is no big deal, as you can have a macro that allows you to "rp5 run" the currently edited sketch with one or two mouse click / key strokes. You could also experiment with an external tool like guard, but unless you are you using it already you will probably waste more time than you could possibly save.

monkstone commented 11 years ago

For linux users (possibly mac) there may be a workaround using a "watch script" similar to this script for vanilla processing watch.

#!/bin/bash                                                                                                                                          
 while inotifywait -e modify /home/foo/sketchbook/$1; do           
ps cax | grep java > /dev/null                                                                                                       
if [ $? -eq 0 ]; then                                                                                                                         
 echo "killing java"                                                                                                                      
 killall java                                                                                                                         
exec -a processing /usr/bin/processing-java --sketch=/home/foo/sketchbook/$1/ --output=/tmp/$1/ --run --force &                 
else                                                                                                                                             
echo "Running the Sketch"                                                                                                                   
exec -a processing /usr/bin/processing-java --sketch=/home/foo/sketchbook/$1/ --output=/tmp/$1 --run --force &                  
fi                                                                                                                                             
done  

requires inotify-tools and incron

monkstone commented 10 years ago

Watch mode should be fixed in the next release (thanks to a fix in vanilla processing that releases PGL). Tested as working in the development branch JRubyArt, and with ruby-processing (using development version of processing-pre-2.1.2).

monkstone commented 10 years ago

Issue nothing to do with ruby-processing, problem came from processing, should be fixed by processing-2.1.2 so I am closing the issue.