Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0

Tuesday, 29 July 2014

Ruby-Processing-2.5.1 now available from rubygems.org

If you haven't installed ruby-processing before you will need:-
  1. a recent version of java (7+) 
  2. an installed version of vanilla processing-2.2.1
  3. a recent version of ruby (1.9.3+) preferably jruby-1.7.13 (but MRI ruby is OK)
  4. preferably wget (for downloading jruby-complete)
Recommended order of installation (skip 1 if you've installed ruby-processing recently)

  1. Set the processing root (you could run this sketch in processing ide)
  2. gem install ruby-processing (current version 2.5.1) 
  3. rp5 setup install (to download and install jruby-complete-1.7.13) 
  4. rp5 setup check (to check your setup) if you haven't got a system jruby installed you should set  JRUBY: 'false' in your ~/.rp5rc file 
  5. rp5 setup unpack_samples
  6. cd rp_samples 
  7. rake to to run contributed samples as a Demo
Choice of editor / ide

  • Believe it or not it is possible to use netbeans as a development environment for ruby
  • For a near to ide experience you could use jEdit
  • vim is perfect for console development (examples on this blog posted using syntax/2html.vim)
  • if you are a Mac you might use textmate

The simplest ArcBall sketch (under the hood sketch is translated to 300, 300 & arcball radius is set as 0.8 * height)
load_library :vecmath

############################
# Use mouse drag to rotate
# the arcball. Use mousewheel
# to zoom. Hold down x, y, z
# to constrain rotation axis.
############################

def setup
  size(600, 600, P3D)
  smooth(16)
  ArcBall.init(self, 300, 300)
  fill 180
end

def draw
  background(50)
  box(300, 300, 300)
end

See here for an example of DegLut table usage. Over 300 examples included with the gem, although there is no book for ruby-processing, code examples from Dan Shiffmans Learning Processing and his Nature of Code books have both been translated to work with ruby-processing here and here. If you are new to ruby or processing start with rp_samples/processing_app/basics, if you just want to be impressed, from the rp_samples directory run 'rake shaders', where you will see the level of performance that you might not have thought possible, given how slow ruby is supposed to be (running on gpu so it's a big cheat, but you can do this too see retained_menger.rb sketch).

Some On Line Tutorials (NB: all posted before ruby-processing-2.5.1, where install has changed)

  1. Introductory level (Jeff Casimir)
  2. An Introduction to Ruby Processing (Steve Kinney) 
  3. Drawing with processing and Ruby (Dhaivat Pandya 



No comments:

Post a Comment

Followers

About Me

My photo
I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2