PerlinNoiseGenerator - how?


I’m currently trying to get my program running well on jruby rather than
MRI, to see if it can solve some issues I’m having with MRI (primarily
to do with garbage collection, but having real threads may turn out to
be very useful too). Part of the program involves perlin noise, and I
have been using a ruby c gem that runs very fast. The perlin_noise gem
based on pure ruby is very slow. Someone recommended I try this:

However, being unfamiliar with both java and jruby, I don’t know how to
get this working. I’ve tried:

require ‘java’

module Java3D
include_package “org.j3d.texture.procedural”

class Generator
include Java3D
def initialize
@test = Java3D::PerlinNoiseGenerator.noise2(4,4)
@test = Java3D::PerlinNoiseGenerator(4,4,4)

Neither of these @test assignments work (I did not try both at once, of
course). Is there something I might be missing?

I’m running this on mac osx, and installed jruby via rvm (jruby-1.7.1).


This is the section of the wiki you need to read:

The bit it looks like you are missing is requiring the jar file.

require ‘path/to/mycode.jar’

I personally prefer java_import over include_package, but that is
just my preference.

Although some errors messages / stack traces of what is going wrong
be useful, as I can only assume this is your issue.


On Thu, Jan 17, 2013 at 3:54 PM, Na Na [email protected] wrote:

class Generator
I’m running this on mac osx, and installed jruby via rvm (jruby-1.7.1).

E: [email protected]

2 Devs from Down Under Podcast

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs