Giter VIP home page Giter VIP logo

ruby-processing's People

Contributors

arirubinstein avatar endymion avatar fjenett avatar grossbart avatar jandot avatar jashkenas avatar jdan avatar joannecheng avatar jurisgalang avatar martinstannard avatar maxhawkins avatar mchung avatar monkstone avatar murasesyuka avatar nicksieger avatar peterkrenn avatar rick avatar skade avatar yush avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ruby-processing's Issues

Strange requiring behavior

Given this foo.rb:

require 'java'
require 'foo.jar'
Java::Foo::Bar.baz()

This works:

$ rvm jruby
$ ruby foo.rb

This fails:

rp5 run foo.rb

with:

/Users/__/.rvm/gems/jruby-1.5.2/gems/ruby-processing-1.0.9/lib/ruby-processing/app.rb:6:in `const_missing': cannot load Java class foo.Bar (NameError)

Is rp doing something funky with require?

java.lang.ArrayIndexOutOfBoundsException: 0

installed ruby 1.8.7 and ruby-processing (Ubuntu 10.10).
I can't load font whitch I created with Processing 1.2.1 (Tools -> Create Font...). But Processing can load this font. Font file is in 'data/' derectory. And font from examples of Ruby-Processing is normally loaded.
For example:


def setup
  size 400, 100
  @font = load_font 'Ubuntu-Regular-48.vlw'
  @text_en = 'What a wonderful day!'
  no_loop
  fill 0
end

def draw
  background 155
  text_font @fon2, 32
  text @text_en, 30, 60
end

And output

java.lang.ArrayIndexOutOfBoundsException: 0
    at processing.core.PFont.(PFont.java:219)
    at processing.core.PApplet.loadFont(PApplet.java:3615)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:450)
    at org.jruby.javasupport.JavaMethod.tryProxyInvocation(JavaMethod.java:633)
    at org.jruby.javasupport.JavaMethod.invokeDirect(JavaMethod.java:305)
    at org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:50)
    at org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:61)
    at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:310)
    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:149)
    at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
    at org.jruby.ast.InstAsgnNode.interpret(InstAsgnNode.java:95)
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:112)
    at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:124)
    at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144)
    at org.jruby.RubyClass.finvoke(RubyClass.java:549)
    at org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:418)
    at org.jruby.javasupport.proxy.JavaProxyConstructor$2.invoke(JavaProxyConstructor.java:221)
    at org.jruby.proxy.processing.core.PApplet$Proxy0.setup(Unknown Source)
    at processing.core.PApplet.handleDraw(PApplet.java:1403)
    at processing.core.PApplet.run(PApplet.java:1328)
    at java.lang.Thread.run(Thread.java:662)
Exception in thread "Animation Thread" processing/core/PApplet.java:2207:in `die': java.lang.RuntimeException: Could not load font Ubuntu-Regular-48.vlw. Make sure that the font has been copied to the data folder of your sketch. (NativeException)
    from processing/core/PApplet.java:2216:in `die'
    from processing/core/PApplet.java:3618:in `loadFont'
    from font_test.rb:5:in `setup'
    from :1
    ...internal jruby stack elided...
    from processing.core.PApplet.die(PApplet.java:2216)
    from processing.core.PApplet.loadFont(PApplet.java:3618)

Video Capture Error

I'm not sure if this is a bug, or if I just don't have things set up correctly. When I try to execute the first video capture processing sketch from the Learning Processing With Ruby example set (Chapt 16 - 02), I'm getting a processing.video.Capture.init(Unknown Source) error. Here is the full stack trace. I'm able to run the original processing version of this sketch effectively, so I can verify that the non ruby-processing execution of this sketch runs effectively. On the ruby side I'm using JRuby 1.6.2 and the latest gem release of ruby-processing 1.0.11.

rubygems issues

I installed jruby through rvm in leopard OS, then installed ruby-processing and few other gems in that environment.
But whenever I try to load up a gem in my code, it fails to do so:
Eg:
require 'rubygems'
require 'twitter'
/.rvm/gems/jruby-1.4.0/gems/ruby-processing-1.0.8/lib/core/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require': IO error -- jopenssl (LoadError)
Any ideas?(BTW, I did try to load gem using instructions in wiki and bypass rvm all together, and still had the same issue)

Output after 'gem install ruby-processing'

% gem install ruby-processing
Fetching: ruby-processing-1.0.11.gem (100%)
Successfully installed ruby-processing-1.0.11
1 gem installed
Installing ri documentation for ruby-processing-1.0.11...
unable to convert "\xCA" from ASCII-8BIT to UTF-8 for lib/templates/application/Contents/MacOS/JavaApplicationStub, skipping
Installing RDoc documentation for ruby-processing-1.0.11...
unable to convert "\xCA" from ASCII-8BIT to UTF-8 for lib/templates/application/Contents/MacOS/JavaApplicationStub, skipping

Mac OS 10.8.4 / Ruby 1.9.3 / Java 1.7

shape method

There is no way to draw a shape which i load by using load_shape method. Yet i can draw it if i comment out the shape method in the app.rb file of ruby-processing. There must be a proper way to draw SVG shapes.

`rp5 watch` does not work

Running rp5 watch 3dtest.rb starts the sketch but when reloading it does not start again and I get warnings for constants.

I'm just starting out with processing-ruby, so might've done something wrong.

$ rp5 watch 3dtest.rb 
reloading sketch...
./3dtest.rb:1 warning: already initialized constant X_COUNT
./3dtest.rb:2 warning: already initialized constant Y_COUNT

The sketch is fairly simple:

X_COUNT = 50
Y_COUNT = 50

class WaveTest < Processing::App
  load_library :opengl
  include_package "processing.opengl"

  def setup
    size 1280, 768, OPENGL
    color_mode HSB, 360, 100, 100, 100
    no_stroke
    @frame = 0
  end

  def draw
    lights

    rotate_y radians(10)
    rotate_z radians(50)

    @frame+=0.1
    background 255
    scale 10

    (0..Y_COUNT).each do |y|
      begin_shape TRIANGLE_STRIP

      (0...X_COUNT).each do |x|
        z = sin(x-@frame)
        vertex x, y, z
        vertex x, y+1, z
      end

      fill 198, 100, 50, 50
      stroke 198, 0, 0, 10
      end_shape
    end
  end
end

shape gives wrong # of arguments

calling shape with 3 arguments (PShape, int, int) in 1.0.9 gives:

`shape': wrong # of arguments(3 for 1) (ArgumentError)

this is new and used to work back in vers. 1.0.6

error on ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux]

Hi Jeremy,

most recent ruby gives me this:

:334:in `method_missing': undefined method `bin_path' for Gem:Module (NoMethodError)
    from /usr/local/bin/rp5:19:in `'

... rubygems genrates this:

!/usr/bin/env ruby
#
# This file was generated by RubyGems.
#
# The application 'ruby-processing' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

version = ">= 0"

if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
  version = $1
  ARGV.shift
end

gem 'ruby-processing', version
load Gem.bin_path('ruby-processing', 'rp5', version)

any idea on how and what to modify?

Thanx for your great work, Jeremy, really !!

image.get() not working?

I'm trying to read the color of given pixel of an image, just like the pointillism.rb sample sketch should do, but the color is always black.
Can anyone run the sketch rp5 run samples/processing_app/basics/image/pointillism.rb and see if the colors work?

increase memory limit of rp5 sketch

hey sorry if this is a noob question but how do I increase the memory limit rp5 runs with? I need to load lots of images in memory.
Thanks for creating rp5 its really good fun and nice way to learn ruby!

Thomas

Camera examples fail on MacOS X 10.5

(richard garibaldi):~/Projects/ruby-processing/samples% rp5 run processing_app/3D/camera/perspective.rb 
Exception in thread "Animation Thread" processing/core/PApplet.java:1013:in `size': processing.core.PApplet$RendererChangeException: null (NativeException)
from processing/core/PApplet.java:959:in `size'
from sun/reflect/NativeMethodAccessorImpl.java:-2:in `invoke0'
from sun/reflect/NativeMethodAccessorImpl.java:39:in `invoke'
from sun/reflect/DelegatingMethodAccessorImpl.java:25:in `invoke'
from java/lang/reflect/Method.java:585:in `invoke'
from org/jruby/javasupport/JavaMethod.java:298:in `invokeWithExceptionHandling'
from org/jruby/javasupport/JavaMethod.java:259:in `invoke'
from org/jruby/java/invokers/InstanceMethodInvoker.java:67:in `call'
 ... 13 levels...
from processing/core/PApplet.java:1328:in `run'
from java/lang/Thread.java:613:in `run'
from :1
Complete Java stackTrace
processing.core.PApplet$RendererChangeException
at processing.core.PApplet.size(PApplet.java:1013)
at processing.core.PApplet.size(PApplet.java:959)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jruby.javasupport.JavaMethod.invokeWithExceptionHandling(JavaMethod.java:298)
at org.jruby.javasupport.JavaMethod.invoke(JavaMethod.java:259)
at org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:67)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:313)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:192)
at org.jruby.ast.FCallThreeArgNode.interpret(FCallThreeArgNode.java:40)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:101)
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:113)
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:117)
at org.jruby.RubyClass.finvoke(RubyClass.java:449)
at org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:401)
at org.jruby.javasupport.proxy.JavaProxyConstructor$2.invoke(JavaProxyConstructor.java:230)
at org.jruby.proxy.processing.core.PApplet$Proxy0.setup(Unknown Source)
at processing.core.PApplet.handleDraw(PApplet.java:1400)
at processing.core.PApplet.run(PApplet.java:1328)
at java.lang.Thread.run(Thread.java:613)
...internal jruby stack elided...
from processing.core.PApplet.size(PApplet.java:959)
from sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
from sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
from sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
from java.lang.reflect.Method.invoke(Method.java:585)
from org.jruby.javasupport.JavaMethod.invokeWithExceptionHandling(JavaMethod.java:298)
from org.jruby.javasupport.JavaMethod.invoke(JavaMethod.java:259)
from org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:67)
from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:313)
from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:192)
from org.jruby.ast.FCallThreeArgNode.interpret(FCallThreeArgNode.java:40)
from org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
from org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
from org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:101)
from org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:113)
from org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:117)
from org.jruby.RubyClass.finvoke(RubyClass.java:449)
from org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:401)
from org.jruby.javasupport.proxy.JavaProxyConstructor$2.invoke(JavaProxyConstructor.java:230)
from org.jruby.proxy.processing.core.PApplet$Proxy0.setup(Unknown Source)
from processing.core.PApplet.handleDraw(PApplet.java:1400)
from processing.core.PApplet.run(PApplet.java:1328)
from java.lang.Thread.run(Thread.java:613)

windows app export has no ln_s support

Running a windows app export fails with error due to no symbolic link support ln_s support:
This error occurs in both the the dos and cygwin shell.

 $ rp5 app jwishy.rb
 c:/jruby/lib/ruby/1.8/fileutils.rb:338:in `ln_s': symlink() function is unimplemented on this machine (NotImplementedError)
    from c:/jruby/lib/ruby/1.8/fileutils.rb:1411:in `fu_each_src_dest0'
    from c:/jruby/lib/ruby/1.8/fileutils.rb:336:in `ln_s'
    from C:/jruby/lib/ruby/gems/1.8/gems/ruby-processing-1.0.7/lib/ruby-processing/exporters/application_exporter.rb:77:in `symlink_library_into_place'
    from C:/jruby/lib/ruby/gems/1.8/gems/ruby-processing-1.0.7/lib/ruby-processing/exporters/application_exporter.rb:32:in `export!'
    from C:/jruby/lib/ruby/gems/1.8/gems/ruby-processing-1.0.7/lib/ruby-processing/runner.rb:90:in `app'
    from C:/jruby/lib/ruby/gems/1.8/gems/ruby-processing-1.0.7/lib/ruby-processing/runner.rb:44:in `execute!'
    from C:/jruby/lib/ruby/gems/1.8/gems/ruby-processing-1.0.7/lib/ruby-processing/runner.rb:34:in `execute'
    from C:/jruby/lib/ruby/gems/1.8/gems/ruby-processing-1.0.7/bin/rp5:4
    from C:/jruby/lib/ruby/gems/1.8/gems/ruby-processing-1.0.7/bin/rp5:19:in `load'
    from c:\jruby\bin\rp5:19

OpenGL Error on 10.6.5

I'm trying to use OpenGL in a ruby-processing sketch on OS X 10.6.5, but any sketch that tries to set the render_mode to OpenGL just crashes. For example, trying to run the following sketch:
require 'ruby-processing'

class Planets < Processing::App
  load_java_library "opengl"
  include_package "processing.opengl"

  def setup
    render_mode OPENGL
    color RGB, 1.0
  end

  def draw
    background 1.0
  end

end

Planets.new :title => "Planets", :width => 1024, :height => 768

produces this stacktrace:

Exception in thread "Animation Thread" processing/core/PApplet.java:996:in `size': processing.core.PApplet$RendererChangeException: null (NativeException)
  from org.jruby.proxy.processing.core.PApplet$Proxy0:-1:in `__super$size'
  from :1:in `size'
  from /Users/dlp/.rvm/gems/jruby-1.5.2/gems/ruby-processing-1.0.9/lib/ruby-processing/app.rb:216:in `size'
  from /Users/dlp/.rvm/gems/jruby-1.5.2/gems/ruby-processing-1.0.9/lib/ruby-processing/app.rb:223:in `render_mode'
  from ./planets_gh.rb:8:in `setup'
  from :1
  ...internal jruby stack elided...
  from org.jruby.proxy.processing.core.PApplet$Proxy0.__super$size(Unknown Source)

but if I comment out the line that sets the render mode, it works fine.

I'm using ruby-processing 1.0.9, and the opengl java library included with Processing 1.2.1 (the latest version as of 12/28/10). My java -version is:

java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04-307-10M3261)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03-307, mixed mode)

Thanks for your time!

Can I load shared libraries with FFI?

Hi! Is it possible to use additional ruby gems somehow or load shared libraries (.so , .dll) ?

Some time ago I tried that, but had to pack it all into the big jruby-all.jar , so that was unusable with default distribution of ruby-processing.

Applet packaging fails for Firefox on windows

It runs locally, but when it's on a remote server, I get the following plugin error:

java.lang.RuntimeException: Error running script
at org.jruby.JRubyApplet.init(JRubyApplet.java:239)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.jruby.exceptions.RaiseException: no such file to load -- ruby-processing/runners/run
at (unknown).new(<script>:1)
at Kernel.require(<script>:1)
at (unknown).(unknown)(:1)
Exception: java.lang.RuntimeException: Error running script

http://dan.mindfill.com/projects/games/grains/ is where I pasted it.

Also, I'm launching the sketch like

Grains.new :title => "Grains", :width => SCREEN_WIDTH, :height => SCREEN_HEIGHT

so I can easily adjust the constants. This may be what's making the applet export show up in a tiny 100x100 box?

I would be happy to help debug and fix this problem further, but I'm not really sure how to build and develop this gem...

Ruby-Processing on OS X

I'm using Jruby-1.1.5 and Java-1.5.0_22 on Leopard -- perhaps they are incompatible? -- but I am not even able to run any of the examples:

rp5 run samples/getting_started.rb

Error: Some library (perhaps JRuby) was built with a later JVM version.
Please use libraries built with the version you intend to use or an earlier one.
Specify -w for full UnsupportedClassVersionError stack trace

(If this isn't the place for this sort of issue, please let me know.)

trying to run rp5 with --jruby flag

Hi,

im using Rp5 and im trying to run a sketch with --jruby flag

 rp5 run try.rb --jruby

i got two warnings before the sketch aborts without any verbosities

 warning: -J-Xdock:name=Ruby-Processing argument ignored (launched in same VM?)
 warning: -J-Xdock:icon=/Users/migue/.rvm/gems/jruby-1.6.5.1@global/gems/ruby-processing-1.0.11/lib/templates/application/Contents/Resources/sketch.icns argument ignored (launched in same VM?)

without the --jruby flag the program runs fine, im using jruby 1.6.5.1 version
jruby 1.6.5.1 (ruby-1.8.7-p330) (2011-12-27 1bf37c2) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java]

im trying this because i need to include some rubygems in the sketch.

how should i proceed with this ?

regards

New Processing download location

Processing has moved from Google Code, so recent versions as of 2.0.1 can only be downloaded from http://download.processing.org.

The following simple patch works fine for me:

From 5767d19d67589e9f83d8621b9e0f862cc6c9fbb0 Mon Sep 17 00:00:00 2001
From: Tibor Claassen [email protected]
Date: Mon, 24 Jun 2013 21:03:49 +0200
Subject: [PATCH] Use Processing download page


vendors/Rakefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vendors/Rakefile b/vendors/Rakefile
index 4daa4a9..7493d0b 100644
--- a/vendors/Rakefile
+++ b/vendors/Rakefile
@@ -15,7 +15,7 @@ task :download => ["processing-#{PROCESSING_VERSION}-macosx.zip", "jruby-complet

Rakefile tested on MacOSX and linux

file "processing-#{PROCESSING_VERSION}-macosx.zip" do

1.8.3.1

More Carnivore Issues

Hi there, I've followed your advice for getting Carnivore to work (we worked through this issue together about 2 years ago!) but Java is still complaining that the packetEvent method doesn't exist. Do you have any advice? I have no Java experience! Gist (including error message)

undefined method 'get_insets' on OSX

Just installed rp and whenever I try to run one of the samples, I get something like

/Library/Ruby/Gems/1.8/gems/ruby-processing-1.0.8/lib/ruby-processing/app.rb:407:in `display_in_a_window': undefined method `get_insets' for #<Java::JavaxSwing::JFrame:0x197fe9> (NoMethodError)
from /Library/Ruby/Gems/1.8/gems/ruby-processing-1.0.8/lib/ruby-processing/app.rb:376:in `determine_how_to_display'
from /Library/Ruby/Gems/1.8/gems/ruby-processing-1.0.8/lib/ruby-processing/app.rb:177:in `initialize'
from /Library/Ruby/Gems/1.8/gems/ruby-processing-1.0.8/lib/ruby-processing/runners/base.rb:41:in `load_and_run_sketch'
from /Library/Ruby/Gems/1.8/gems/ruby-processing-1.0.8/lib/ruby-processing/runners/run.rb:7

I have tried to use the --jruby option, and prioritized Java SE 5(32-bit & 64-bit), 6(64-bit) and 1.4.2 in turn. none of them changed the result.

Please help.

External library issues [minim] on OSX

http://gist.github.com/67310 and the like seem to be no longer working on OSX 1.0.8. Not sure what to try to fix this as I'm no Java expert.

Adding a working minim sample to the distribution would be awesome...

Anyway, I get:

% rp5 run minim_test.rb
Exception in thread "Animation Thread" minim_test.rb:9:in `setup': no public constructors for Java::DdfMinim::Minim (TypeError)
    from :1
    ...internal jruby stack elided...
    from MinimTest.setup(:1)
    from (unknown).(unknown)(:1)

can't use --jruby

I'm trying to use the --jruby option so I can use some other gems in my sketch.

█▓▒░tony@kiwi░▒▓█ ~/src/ruby-processing(master)$ rp5 --jruby run my_sketch.rb
LoadError: no such file to load -- /home/tony/.rvm/gems/jruby-1.6.3/gems/ruby-processing-1.0.11/lib/core/core
require at org/jruby/RubyKernel.java:1038
(root) at /home/tony/.rvm/gems/jruby-1.6.3/gems/ruby-processing-1.0.11/lib/ruby-processing/app.rb:11
require at org/jruby/RubyKernel.java:1038
(root) at /home/tony/.rvm/gems/jruby-1.6.3/gems/ruby-processing-1.0.11/lib/ruby-processing/app.rb:6
require at org/jruby/RubyKernel.java:1038
(root) at /home/tony/.rvm/gems/jruby-1.6.3/gems/ruby-processing-1.0.11/lib/ruby-processing/runners/run.rb:5

Looks like the core.jar file is being loaded because JRUBY_APPLET is defined. Noticed the core processing libraries were removed in commit 1884cd4. What was the reason for this? Do the core libraries need to be loaded, or is that a mistake?

Exception on Opengl rendering.

I'm on Ubuntu Jaunty with Sun Java 6 and Ruby 1.8

I get this exception when trying to use Opengl

java.lang.IllegalArgumentException: GLDrawableFactory.chooseGraphicsConfiguration() was not used when creating this Component
at com.sun.opengl.impl.x11.X11GLDrawableFactory.getGLDrawable(X11GLDrawableFactory.java:238)
at processing.opengl.PGraphicsOpenGL.allocate(PGraphicsOpenGL.java:190)
at processing.core.PGraphics3D.setSize(PGraphics3D.java:316)
at processing.core.PApplet.makeGraphics(PApplet.java:1165)
at processing.core.PApplet.size(PApplet.java:999)
at processing.core.PApplet.size(PApplet.java:959)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jruby.javasupport.JavaMethod.invokeWithExceptionHandling(JavaMethod.java:298)
at org.jruby.javasupport.JavaMethod.invoke(JavaMethod.java:259)
at org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:67)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:313)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:192)
at org.jruby.ast.FCallThreeArgNode.interpret(FCallThreeArgNode.java:40)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:163)
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:273)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:112)
at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:101)
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:113)
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:117)
at org.jruby.RubyClass.finvoke(RubyClass.java:449)
at org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:401)
at org.jruby.javasupport.proxy.JavaProxyConstructor$2.invoke(JavaProxyConstructor.java:230)
at org.jruby.proxy.processing.core.PApplet$Proxy0.setup(Unknown Source)
at processing.core.PApplet.handleDraw(PApplet.java:1400)
at processing.core.PApplet.run(PApplet.java:1328)
at java.lang.Thread.run(Thread.java:619)
Exception in thread "Animation Thread" processing/core/PApplet.java:1212:in makeGraphics': java.lang.RuntimeException: processing.opengl.PGraphicsOpenGL needs to be updated for the current release of Processing. (NativeException) from processing/core/PApplet.java:999:insize'
from processing/core/PApplet.java:959:in size' from sun/reflect/NativeMethodAccessorImpl.java:-2:ininvoke0'
from sun/reflect/NativeMethodAccessorImpl.java:39:in invoke' from sun/reflect/DelegatingMethodAccessorImpl.java:25:ininvoke'
from java/lang/reflect/Method.java:597:in invoke' from org/jruby/javasupport/JavaMethod.java:298:ininvokeWithExceptionHandling'
from org/jruby/javasupport/JavaMethod.java:259:in invoke' ... 21 levels... from java/lang/Thread.java:619:inrun'
from opengltest.rb:8:in `setup'
from :1
Complete Java stackTrace
java.lang.RuntimeException: processing.opengl.PGraphicsOpenGL needs to be updated for the current release of Processing.
at processing.core.PApplet.makeGraphics(PApplet.java:1212)
at processing.core.PApplet.size(PApplet.java:999)
at processing.core.PApplet.size(PApplet.java:959)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jruby.javasupport.JavaMethod.invokeWithExceptionHandling(JavaMethod.java:298)
at org.jruby.javasupport.JavaMethod.invoke(JavaMethod.java:259)
at org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:67)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:313)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:192)
at org.jruby.ast.FCallThreeArgNode.interpret(FCallThreeArgNode.java:40)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:163)
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:273)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:112)
at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:101)
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:113)
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:117)
at org.jruby.RubyClass.finvoke(RubyClass.java:449)
at org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:401)
at org.jruby.javasupport.proxy.JavaProxyConstructor$2.invoke(JavaProxyConstructor.java:230)
at org.jruby.proxy.processing.core.PApplet$Proxy0.setup(Unknown Source)
at processing.core.PApplet.handleDraw(PApplet.java:1400)
at processing.core.PApplet.run(PApplet.java:1328)
at java.lang.Thread.run(Thread.java:619)
...internal jruby stack elided...
from processing.core.PApplet.size(PApplet.java:999)
from processing.core.PApplet.size(PApplet.java:959)
from sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
from sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
from sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
from java.lang.reflect.Method.invoke(Method.java:597)
from org.jruby.javasupport.JavaMethod.invokeWithExceptionHandling(JavaMethod.java:298)
from org.jruby.javasupport.JavaMethod.invoke(JavaMethod.java:259)
from org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:67)
from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:313)
from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:192)
from org.jruby.ast.FCallThreeArgNode.interpret(FCallThreeArgNode.java:40)
from org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
from org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
from org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:163)
from org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144)
from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:273)
from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:112)
from org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
from org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
from org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:101)
from org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:113)
from org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:117)
from org.jruby.RubyClass.finvoke(RubyClass.java:449)
from org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:401)
from org.jruby.javasupport.proxy.JavaProxyConstructor$2.invoke(JavaProxyConstructor.java:230)
from org.jruby.proxy.processing.core.PApplet$Proxy0.setup(Unknown Source)
from processing.core.PApplet.handleDraw(PApplet.java:1400)
from processing.core.PApplet.run(PApplet.java:1328)
from java.lang.Thread.run(Thread.java:619)

java.lang.SecurityException

Hi, i'm trying to use a ruby gem called grackle in my Processing::App and get the following:
java.lang.SecurityException: class "json.ext.Parser$s_method_0_1$RUBYINVOKER$newInstance"'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(ClassLoader.java:807)
at java.lang.ClassLoader.preDefineClass(ClassLoader.java:488)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:626)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at org.jruby.util.JRubyClassLoader.defineClass(JRubyClassLoader.java:22)
at org.jruby.internal.runtime.methods.InvocationMethodFactory.endClass(InvocationMethodFactory.java:1281)
at at org.jruby.RubyModule.defineAnnotatedMethod(RubyModule.java:762)
at org.jruby.anno.TypePopulator$DefaultTypePopulator.populate(TypePop
......

I am running jruby 1.4 with rvm (same problem with jruby-head).
Is this a common problem ?
Gratefull for all help.

Java 5.0 (1.5) and Ruby-Processing

Seb

I run this code and I get this error message.

kdge$ rp5 run my_app.rb
Error: Some library (perhaps JRuby) was built with a later JVM version.
Please use libraries built with the version you intend to use or an earlier one.
Specify -w for full UnsupportedClassVersionError stack trace

I'm running Java 5.0 (1.5) (single core Leopard mac's are behind the curve).

The "getting-started" wiki page says Java 1.5 works. Has it been dropped?

Thanks,

Seb

shape not working in 1.0.9

I saw issue #25, but didn't have permission to reopen that so here's a new issue. Running the sample code in that issue

def setup
  size(200,200)
  background(255)
  smooth()

end

def draw
star= load_shape("star.svg")
shape(star, 5, 5)

end

results in this stack:

Exception in thread "Animation Thread" /Users/jkk/.rvm/gems/ruby-1.8.7-p334/gems/ruby-processing-1.0.9/lib/ruby-processing/app.rb:259:in shape': wrong # of arguments(3 for 1) (ArgumentError) from test_sketch.rb:11:indraw'
from :1
...internal jruby stack elided...
from Processing::App.shape(test_sketch.rb:11)
from Sketch.draw(:1)
from (unknown).(unknown)(:1)

Paring the shape call back to one arg gets me this

Exception in thread "Animation Thread" /Users/jkk/.rvm/gems/ruby-1.8.7-p334/gems/ruby-processing-1.0.9/lib/ruby-processing/app.rb:259:in shape': no beginShape with arguments matching [class processing.core.PShapeSVG] on object #<Processing::App:Sketch:Test Sketch> (NameError) from test_sketch.rb:11:indraw'
from :1
...internal jruby stack elided...
from Processing::App.shape(test_sketch.rb:11)
from Sketch.draw(:1)
from (unknown).(unknown)(:1)

i definitely have 1.0.9:

gem list | grep processing
ruby-processing (1.0.9)

Failed to run an example

On windows 7, rp5 fails to start because of a space in a directory name (Application data). See pull request for correction.

C:\Code\scketchbook> rp5 run .\samples\anar\extrusion.rb
Errno::ENOENT: No such file or directory - C:/Users/clem/Application Data/Processing
directory? at org/jruby/RubyFileTest.java:102
directory? at org/jruby/RubyFileTest.java:87
directory? at org/jruby/RubyFileTest.java:78
test at org/jruby/RubyKernel.java:1480
find_sketchbook_path at C:/Ruby192/lib/ruby/gems/1.9.1/gems/ruby-processing-1.0.11/lib/ruby-processing/library_loader.rb:137
each at org/jruby/RubyArray.java:1612
find_sketchbook_path at C:/Ruby192/lib/ruby/gems/1.9.1/gems/ruby-processing-1.0.11/lib/ruby-processing/library_loader.rb:129
initialize at C:/Ruby192/lib/ruby/gems/1.9.1/gems/ruby-processing-1.0.11/lib/ruby-processing/library_loader.rb:6
App at C:/Ruby192/lib/ruby/gems/1.9.1/gems/ruby-processing-1.0.11/lib/ruby-processing/app.rb:92
Processing at C:/Ruby192/lib/ruby/gems/1.9.1/gems/ruby-processing-1.0.11/lib/ruby-processing/app.rb:28
(root) at C:/Ruby192/lib/ruby/gems/1.9.1/gems/ruby-processing-1.0.11/lib/ruby-processing/app.rb:18
require at org/jruby/RubyKernel.java:1038
(root) at C:/Ruby192/lib/ruby/gems/1.9.1/gems/ruby-processing-1.0.11/lib/ruby-processing/app.rb:6
require at org/jruby/RubyKernel.java:1038
(root) at C:/Ruby192/lib/ruby/gems/1.9.1/gems/ruby-processing-1.0.11/lib/ruby-processing/runners/run.rb:5

does not work on Ruby 1.9.2 or something

I have installed ruby-processing on Ruby 1.9.2, OSX snow leopard 10.6.6. I keep getting the message:
LoadError: no such file to load — java

on the line:
require 'java' in app.rb file. Any idea why this is happening please?

Best,
Ghassan.

capture_event does not seem to fire for Capture class instance

Here's a sample Sketch to recreate the issue:

require 'ruby-processing'

class Sketch < Processing::App
  load_library :video
  import "processing.video.Capture"

  def setup
    size 640, 480
    @video = Capture.new self, width, height, 32
  end

  def capture_event video
    @video.read
  end

  def draw
    image @video, 0, 0
  end
end

A workaround is to not rely on capture_event method, and just check the Camera#available? return value:

def draw
  @video.read if @video.available?
  image @video, 0, 0
end

Running ruby-processing with JRuby 1.9 mode?

Sorry if I'm missing something obvious, but is there a way to run ruby-processing under JRuby's --1.9 mode for Ruby 1.9 compatibility? There doesn't seem to be a way to pass the --1.9 option in on the command line. Will I need to modify the ruby-processing bootstrapping process? Not sure where to look...

"rp5 app myapp.rb" exporting issue on windows xp

Ruby-Processing can export Mac/Windows/Linux applications:

rp5 app path/to/my_sketch.rb

But here is what I get on windows xp:

rp5 app bird.rb

C:/ruby193/lib/ruby/1.9.1/fileutils.rb:351:in symlink': symlink() function is unimplemented on this machine (NotImp lementedError) from C:/ruby193/lib/ruby/1.9.1/fileutils.rb:351:inblock in ln_s'
from C:/ruby193/lib/ruby/1.9.1/fileutils.rb:1531:in fu_each_src_dest0' from C:/ruby193/lib/ruby/1.9.1/fileutils.rb:349:inln_s'
from C:/ruby193/lib/ruby/gems/1.9.1/gems/ruby-processing-1.0.11/lib/ruby-processing/exporters/application_ex
porter.rb:81:in symlink_library_into_place' from C:/ruby193/lib/ruby/gems/1.9.1/gems/ruby-processing-1.0.11/lib/ruby-processing/exporters/application_ex porter.rb:32:inexport!'
from C:/ruby193/lib/ruby/gems/1.9.1/gems/ruby-processing-1.0.11/lib/ruby-processing/runner.rb:116:in app' from C:/ruby193/lib/ruby/gems/1.9.1/gems/ruby-processing-1.0.11/lib/ruby-processing/runner.rb:69:inexecute
!'
from C:/ruby193/lib/ruby/gems/1.9.1/gems/ruby-processing-1.0.11/lib/ruby-processing/runner.rb:59:in execute ' from C:/ruby193/lib/ruby/gems/1.9.1/gems/ruby-processing-1.0.11/bin/rp5:10:in<top (required)>'
from C:/ruby193/bin/rp5:23:in load' from C:/ruby193/bin/rp5:23:in

'

Any advice ?
ruby -v
ruby 1.9.3p28 (2012-01-28)
jruby -v
jruby 1.7.2 (1.9.3p327) 2013-01-04 302c706 on Java HotSpot(TM) Client VM 1.6.0_31-b05 [Windows XP-x86]

Thanks

abs() is missing from the API

abs() is missing from App and Proxy. I know it's available thru -123.abs but i think since sin(), cos() and others are available it's confusing.

How to load pure ruby libraries?

I'm trying to figure out how to load a pure ruby library into a sketch.
The readme doesn't seem to have an answer, I looked into library_loader.rb and found this comment:

# For pure ruby libraries.
# The library should have an initialization ruby file
# of the same name as the library folder.

But this doesn't help me much. How should the 'library' folder structure look like and how to import the library?

Thanks

runner for mixing different sketches together?

Would it be possible to make a runner that could mix different sketches together in some way? (like the mother project, or napplet)

I'm guessing that is not really possible, and I would need to hack Processing::App. If you have any ideas off the top of your head to get me poking around the code in the right direction, let me know.

'println 1' does not print anything

Noticed this when trying ex 04_08 from the Processing handbook in ruby...

  println 4/3        # Should print "1"                                                 
  println 4.0/3      # Should print "1.3333334"                                         
  println 4/3.0      # Should print "1.3333334"                                         
  println 4.0/3.0    # Should print "1.3333334"      

...but the output is not as expected:

1.3333334
1.3333334
1.3333334

It prints a blank line instead of '1' for println 4/3. Does the same if you pass println an integer

println 1    # Prints a blank line
println 2    # Prints a blank line

puts 4/3 works like you'd expect...

load_pixels does not appear to work for Capture class

Here's a sample sketch to recreat it:

require 'ruby-processing'

class Sketch < Processing::App
  load_library :video
  import "processing.video.Capture"

  def setup
    size 640, 480
    @video = Capture.new self, width, height, 32
  end

  def draw
    @video.read if @video.available? 

    @img = create_image width, height, RGB
    @video.load_pixels
    @img.load_pixels
    @video.pixels.each_with_index do |pixel, index|
      @img.pixels[index] = @video.pixels[index]
    end
    @img.update_pixels

    image(@img, 0, 0) unless @img.nil? 
  end
end

It won't display the last captured frame as expected.

A different behaviour is seen when using JRuby-Complete or installed JRuby for certain sketches

This issue was brought to light by @alexdean, when he tried to use the processing fisica library http://gitorious.org/fisica with ruby processing. He noticed a method missing when using JRuby-Complete, which was not a problem with external JRuby. Further investigation by @monkstone revealed that the missing method was defined (as a public method) in a 'protected' abstract class FDrawable. Re-compiling the fisica with the abstract class declared public 'fixed' the method missing. However @monkstone then sought to ditch jruby-complete, however that caused the GLSL sketches not to run see error.log (plus there are some advantages to providing the jruby-complete from a developer perspective). Anyway now that @monkstone has put this version out there, he turned to the ruby forum for advice:-
see @headius response here:-
http://www.ruby-forum.com/topic/4414942#new
What's needed now is some concise examples that demonstrate the problems and perhaps a fix may be possible from the jruby side, @alexdean, @jashkenas might be interested.

rp5 watch eating up disk space

Whenever I run my sketch (http://pastebin.com/60v0EpfY) some process starts writing to the hard drive, and I haven't specified any parts of my code to perform any writes. Upon closing the process, or it crashing, the hard drive space isn't cleared. I'm still trying to figure this out, but it looks like it ate up around 1GB over the course of 3 days of debugging. Whatever it is writing, it isn't located neither in /tmp/ not ~/tmp. I'd appreciate any help in locating the files it might have written. So far I used du with watch to monitor, as well as iotop and lsof. The output of lsof is here http://pastebin.com/raw.php?i=YrLPsUqU), stripped down to only files touched by the java process.

Any hints in appreciated.

Slider bug with ranges in ControlPanel

Control panel's slider accepts a range as an argument to define the starting and end values. This does not work with ranges that exclude the last value (0...3) because range.end does not distinguish this, instead this has to be checked with range.exclude_end?.

A simple solution I found is to convert the range to an array:

min, max = range.to_a.first * 100, range.to_a.last * 100

But this does not work with float values (0.1...0.8), so I don't really know how to create a patch for this, so an issue it is.

Exporting opengl App fails on linux

When I tried to run the app script it complained failed to load library opengl.
To fix this:-
I created a folder opengl in the library folder, and moved the opengl, jogl & gluegen jars into that folder.
I also copied the native binaries folder (linux64 in my case) to that folder.
Thereafter app script worked fine, both steps were required.

Mouse events don't fire in watch mode

I'm using OS X Lion 10.7.2 with ruby-processing 1.0.11. When I run a sketch with rp5 watch, my mouse_* handlers don't fire, but they do when the same sketch is run with rp5 run.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.