[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Ruby Open GL on OS X?

Talha Syed

10/15/2006 7:01:00 PM

Hi all.

I'm trying to use Ruby to write OpenGL programs for an assignment in a
graphics course.

I was previously using Ruby on Windows, and OGL ran pefectly fine in
that platform. I used the Ruby one click installer for Windows BTW.

I have since bought a mac laptop, and have been unable to find a good
OGL/GLUT binding library, that does not require arcane trickery to
install and use. I also browsed some of the old OpenGL related topics in
this mailing list, but most of the programs they link to are dead links
by now.

So, does anyone know of a good, easy to install OpenGL/GLUT library that
I can use on Mac OS X? Thanks in advance for the replies!

--
Posted via http://www.ruby-....

12 Answers

Joel VanderWerf

10/15/2006 7:28:00 PM

0

Talha Syed wrote:
> So, does anyone know of a good, easy to install OpenGL/GLUT library that
> I can use on Mac OS X? Thanks in advance for the replies!

Did you try this?

http://rb-opengl.darwin...

I'm not on OSX, so I can't verify that it works...

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

jmg3000

10/15/2006 10:56:00 PM

0

On 10/15/06, Talha Syed <talhasy@hotmail.com> wrote:
> Hi all.
>
> [snip]
>
> So, does anyone know of a good, easy to install OpenGL/GLUT library that
> I can use on Mac OS X? Thanks in advance for the replies!

Well, we haven't made a release yet, but you might grab (via svn) and
build the files from http://rubyforge.org/projects/ru... and
give it a shot. I think it should work for Mac OS X.

---John

Joel VanderWerf

10/15/2006 11:59:00 PM

0

John Gabriele wrote:
> On 10/15/06, Talha Syed <talhasy@hotmail.com> wrote:
>> Hi all.
>>
>> [snip]
>>
>> So, does anyone know of a good, easy to install OpenGL/GLUT library that
>> I can use on Mac OS X? Thanks in advance for the replies!
>
> Well, we haven't made a release yet, but you might grab (via svn) and
> build the files from http://rubyforge.org/projects/ru... and
> give it a shot. I think it should work for Mac OS X.

It's good to know someone's maintaining this very useful library.

Do you have any general plans for it, beyond maintenance?

I was browsing the svn tree and saw something that could be improved:
there are some explicit type checks that might not be necessary, such as
this in gl_ClipPlane():

if (TYPE(arg2) == T_ARRAY)
ary2cdbl(arg2, equation, 4);
else
rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg1));

Since ary2cdbl() calls rb_Array() on its arg, conversion is done if the
arg is not an array. It's not a big deal, but it's nice to make an API
as duck-like as possible...

Btw I'm planning on rewriting a 3ds loader (was in c++, and not a free
license) in pure ruby. Do you think it would make sense to include it
with ruby-opengl?

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

jmg3000

10/16/2006 2:18:00 AM

0

On 10/15/06, Joel VanderWerf <vjoel@path.berkeley.edu> wrote:
> John Gabriele wrote:
> > On 10/15/06, Talha Syed <talhasy@hotmail.com> wrote:
> >> Hi all.
> >>
> >> [snip]
> >>
> >> So, does anyone know of a good, easy to install OpenGL/GLUT library that
> >> I can use on Mac OS X? Thanks in advance for the replies!
> >
> > Well, we haven't made a release yet, but you might grab (via svn) and
> > build the files from http://rubyforge.org/projects/ru... and
> > give it a shot. I think it should work for Mac OS X.
>
> It's good to know someone's maintaining this very useful library.
>
> Do you have any general plans for it, beyond maintenance?

Short term plans:
* Use mkrf instead of our own hand-written top-level Rakefile to build
it (this is already partially in-place, but besides waiting for the
next mkrf release, I still don't know how to make rake decend down and
use each of the extension-specific Rakefiles (see the included
build.sh script for the interim kludge)).

Long term:
* Get some scripts together to help us bring it up to date with
current OpenGL (see utils/README).

Not sure whether to make a release before or after we make attempts to
bring it more up to date, since it currently doesn't offer much if
anything beyond Yoshi's last version (except maybe that it builds on
Mac OS X).

> I was browsing the svn tree and saw something that could be improved:
> there are some explicit type checks that might not be necessary, such as
> this in gl_ClipPlane():
>
> if (TYPE(arg2) == T_ARRAY)
> ary2cdbl(arg2, equation, 4);
> else
> rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg1));
>
> Since ary2cdbl() calls rb_Array() on its arg, conversion is done if the
> arg is not an array. It's not a big deal, but it's nice to make an API
> as duck-like as possible...

Thanks for the tip! I'm only now just learning how to make extension
modules, and will file this tip away for future use.

> Btw I'm planning on rewriting a 3ds loader (was in c++, and not a free
> license) in pure ruby. Do you think it would make sense to include it
> with ruby-opengl?

Not sure, but I suspect not. Do you think your loader might merit
having its own RubyForge project?

Anyhow, feel free to bring this up on our project mailing list.
ruby-opengl things are moving kinda' slowly at the moment, as I'm
still learning and also currently job hunting.

---John

Talha Syed

10/18/2006 4:11:00 PM

0

John Gabriele wrote:
> On 10/15/06, Talha Syed <talhasy@hotmail.com> wrote:
>> Hi all.
>>
>> [snip]
>>
>> So, does anyone know of a good, easy to install OpenGL/GLUT library that
>> I can use on Mac OS X? Thanks in advance for the replies!
>
> Well, we haven't made a release yet, but you might grab (via svn) and
> build the files from http://rubyforge.org/projects/ru... and
> give it a shot. I think it should work for Mac OS X.
>
> ---John

Thanks for all the replies.

Man, have I been having a tough time with ruby-opengl. The rakefile
simply aborts with the following error:

--------------------------------
Pro530Rage:~/Desktop/gzz/trunk talhasyed$ rake --trace
(in /Users/talhasyed/Desktop/gzz/trunk)
** Invoke default (first_time)
** Invoke ext/gl/gl.bundle (first_time)
** Invoke ext/gl/gl.o (first_time)
** Invoke ext/gl/gl.c (first_time, not_needed)
** Execute ext/gl/gl.o

============================== compiling: ext/gl/gl.c --> ext/gl/gl.o
cc -g -O2 -pipe -fno-common -I/usr/local/lib/ruby/1.8/i686-darwin8.8.1
-F/System/Library/Frameworks -c -o ext/gl/gl.o ext/gl/gl.c
{standard input}:unknown:FATAL:can't create output file: ext/gl/gl.o
rake aborted!
Command failed with status (1): [cc -g -O2 -pipe -fno-common
-I/usr/local/l...]
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:722:in `sh'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:729:in `sh'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:812:in `sh'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:807:in `sh'
/Users/talhasyed/Desktop/gzz/trunk/rakefile:69
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in
`execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in
`execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in `invoke'
/usr/local/lib/ruby/1.8/thread.rb:135:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:364:in
`invoke_prerequisites'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:999:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:363:in
`invoke_prerequisites'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:356:in `invoke'
/usr/local/lib/ruby/1.8/thread.rb:135:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:364:in
`invoke_prerequisites'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:999:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:363:in
`invoke_prerequisites'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:356:in `invoke'
/usr/local/lib/ruby/1.8/thread.rb:135:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7
/usr/local/bin/rake:18

--------------------------------

I have XCode installed, so cc and gcc should run pefectly. If anyone
does a lot of C, do the above errors ring a bell?

Do Yoshi's bindings work in Mac OSX, because I think I will try those
next.

--
Posted via http://www.ruby-....

Ara.T.Howard

10/18/2006 4:18:00 PM

0

Talha Syed

10/18/2006 4:30:00 PM

0

unknown wrote:
> On Thu, 19 Oct 2006, Talha Syed wrote:
>
>>> build the files from http://rubyforge.org/projects/ru... and
>> Pro530Rage:~/Desktop/gzz/trunk talhasyed$ rake --trace
>> {standard input}:unknown:FATAL:can't create output file: ext/gl/gl.o
>> rake aborted!
>
> this looks like your disk is full and/or you have a permissions error.
> try
> running that command by hand and seeing if there's any more info
>
>
> -a

My bad, I posted the wrong log file in the post. I actually ran rake as
as sudo, and didn't get that error, but another one which said that I
was missing -lGL, which appears to be an OpenGL library.

-------------------------------------------------
Pro530Rage:~/Desktop/ruby-opengl/trunk talhasyed$ sudo rake --trace
(in /Users/talhasyed/Desktop/ruby-opengl/trunk)
** Invoke default (first_time)
** Invoke ext/gl/gl.bundle (first_time)
** Invoke ext/gl/gl.o (first_time, not_needed)
** Invoke ext/gl/gl.c (first_time, not_needed)
** Invoke ext/common/rbogl.o (first_time, not_needed)
** Invoke ext/common/rbogl.h (first_time, not_needed)
** Invoke ext/common/rbogl.c (first_time, not_needed)
** Execute ext/gl/gl.bundle

============================== linking ext/gl/gl.bundle
cc -bundle -lruby -framework GLUT -framework OpenGL -o ext/gl/gl.bundle
ext/gl/gl.o ext/common/rbogl.o -lGL
/usr/bin/ld: can't locate file for: -lGL
collect2: ld returned 1 exit status
rake aborted!
Command failed with status (1): [cc -bundle -lruby -framework GLUT
-framewo...]
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:722:in `sh'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:729:in `sh'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:812:in `sh'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:807:in `sh'
/Users/talhasyed/Desktop/ruby-opengl/trunk/rakefile:76
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in
`execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in
`execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in `invoke'
/usr/local/lib/ruby/1.8/thread.rb:135:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:364:in
`invoke_prerequisites'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:999:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:363:in
`invoke_prerequisites'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:356:in `invoke'
/usr/local/lib/ruby/1.8/thread.rb:135:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7
/usr/local/bin/rake:18
Pro530Rage:~/Desktop/ruby-opengl/trunk talhasyed$
---------------------------------------------

FYI, when running Yoshi's extconf.rb, I get a similar notification about
missing -lGl and some other libraries. Any OpenGl users familiar with
this library, and how to get it?

--
Posted via http://www.ruby-....

ryan.raaum@gmail.com

10/18/2006 5:48:00 PM

0


Talha Syed wrote:
> unknown wrote:
> > On Thu, 19 Oct 2006, Talha Syed wrote:
> >
> >>> build the files from http://rubyforge.org/projects/ru... and
> >> Pro530Rage:~/Desktop/gzz/trunk talhasyed$ rake --trace
> >> {standard input}:unknown:FATAL:can't create output file: ext/gl/gl.o
> >> rake aborted!
> >
> > this looks like your disk is full and/or you have a permissions error.
> > try
> > running that command by hand and seeing if there's any more info
> >
> >
> > -a
>
> My bad, I posted the wrong log file in the post. I actually ran rake as
> as sudo, and didn't get that error, but another one which said that I
> was missing -lGL, which appears to be an OpenGL library.
>
> -------------------------------------------------
> Pro530Rage:~/Desktop/ruby-opengl/trunk talhasyed$ sudo rake --trace
> (in /Users/talhasyed/Desktop/ruby-opengl/trunk)
> ** Invoke default (first_time)
> ** Invoke ext/gl/gl.bundle (first_time)
> ** Invoke ext/gl/gl.o (first_time, not_needed)
> ** Invoke ext/gl/gl.c (first_time, not_needed)
> ** Invoke ext/common/rbogl.o (first_time, not_needed)
> ** Invoke ext/common/rbogl.h (first_time, not_needed)
> ** Invoke ext/common/rbogl.c (first_time, not_needed)
> ** Execute ext/gl/gl.bundle
>
> ============================== linking ext/gl/gl.bundle
> cc -bundle -lruby -framework GLUT -framework OpenGL -o ext/gl/gl.bundle
> ext/gl/gl.o ext/common/rbogl.o -lGL
> /usr/bin/ld: can't locate file for: -lGL
> collect2: ld returned 1 exit status
> rake aborted!
> Command failed with status (1): [cc -bundle -lruby -framework GLUT
> -framewo...]
> /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:722:in `sh'
> /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:729:in `sh'
> /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:812:in `sh'
> /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:807:in `sh'
> /Users/talhasyed/Desktop/ruby-opengl/trunk/rakefile:76
> /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in
> `execute'
> /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in
> `execute'
> /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in `invoke'
> /usr/local/lib/ruby/1.8/thread.rb:135:in `synchronize'
> /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke'
> /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:364:in
> `invoke_prerequisites'
> /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:999:in `each'
> /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:363:in
> `invoke_prerequisites'
> /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:356:in `invoke'
> /usr/local/lib/ruby/1.8/thread.rb:135:in `synchronize'
> /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke'
> /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'
> /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'
> /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7
> /usr/local/bin/rake:18
> Pro530Rage:~/Desktop/ruby-opengl/trunk talhasyed$
> ---------------------------------------------
>
> FYI, when running Yoshi's extconf.rb, I get a similar notification about
> missing -lGl and some other libraries. Any OpenGl users familiar with
> this library, and how to get it?
>
> --
> Posted via http://www.ruby-....

You're going to (at the least) add

/System/Library/Frameworks/OpenGL.framework/Libraries

to your LIBPATH. I assume it's not too difficult to add this to the
rake file, but I'm not really a rake master, so I don't have any great
advice there other than open it up and see if there's someplace obvious
to throw it in.

You may need to make other changes ... but hopefully you can glean them
out of this page:
http://www.macdevcenter.com/pub/a/mac/2005/04/01/o...

Best,

-r

Talha Syed

10/18/2006 5:58:00 PM

0

ryan.raaum@gmail.com wrote:
> Talha Syed wrote:
>> Posted via http://www.ruby-....
>
> You're going to (at the least) add
>
> /System/Library/Frameworks/OpenGL.framework/Libraries
>
> to your LIBPATH. I assume it's not too difficult to add this to the
> rake file, but I'm not really a rake master, so I don't have any great
> advice there other than open it up and see if there's someplace obvious
> to throw it in.
>
> You may need to make other changes ... but hopefully you can glean them
> out of this page:
> http://www.macdevcenter.com/pub/a/mac/2005/04/01/o...
>
> Best,
>
> -r

For now, I've gotten OpenGL working with DarwinPorts (woohoo!). But
thanks for the link - I'll be sure to look into your suggestions on how
to make OpenGL work with a manual/regular installation of Ruby.

--
Posted via http://www.ruby-....

Verno Miller

10/18/2006 6:40:00 PM

0

> Posted by Talha Syed
> on 15.10.2006 21:01
>
> ...
> I have since bought a mac laptop, and have been unable to find a good
> OGL/GLUT binding library, that does not require arcane trickery to
> install and use. I also browsed some of the old OpenGL related topics in
> this mailing list, but most of the programs they link to are dead links
> by now.
>
> So, does anyone know of a good, easy to install OpenGL/GLUT library that
> I can use on Mac OS X? Thanks in advance for the replies!


I've found this cross-platform OpenGL lib that also supports Mac OS X:

http://glfw.source...

--
Posted via http://www.ruby-....