I just updated your script a little to show the 1.0 preferred syntax
for doing some things.  What you have works fine, but I just want to
show the newer syntax:

# include Java preferred over require 'java'
include Java

class Hello3d
  # You can import that class into the namespace
  import javax.media.j3d.BranchGroup

  def initialize
    # Or you can just use it long-hand for single use classes
    universe = com.sun.j3d.utils.universe.SimpleUniverse.new
    group = BranchGroup.new
    group.addChild(com.sun.j3d.utils.geometry.ColorCube.new(0.3))
    universe.viewing_platform.setNominalViewingTransform
    universe.addBranchGraph(group)
  end
end

aHello3d = Hello3d.new


On 9/17/07, Suresh Shukla <[EMAIL PROTECTED]> wrote:
> I tried using JRuby with Java 3D
> I thought it will be nice to keep it in JRuby installer under samples
> folder. It works fine and displays a 3D cube.
>
>
> =============== code =============
>
> require 'java'
>
> include_class "com.sun.j3d.utils.universe.SimpleUniverse"
> include_class "com.sun.j3d.utils.geometry.ColorCube"
> include_class "javax.media.j3d.BranchGroup"
>
> class Hello3d
>  def initialize()
>     universe = SimpleUniverse.new()
>     group = BranchGroup.new();
>     group.addChild(ColorCube.new(0.3));
>
> universe.getViewingPlatform().setNominalViewingTransform();
>     universe.addBranchGraph(group);
>  end
> end
>
> aHello3d = Hello3d.new()
>

-Tom

-- 
Blog: http://www.bloglines.com/blog/ThomasEEnebo
Email: [EMAIL PROTECTED] , [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to