OpenGL on MacOS X (again)

G

Gavin Kistner

I'm trying to get Ruby/OpenGL working for just me on my MacOS X box;
I've looked at various things people have helpfully written in the past
on the topic ( ruby-talk:89025 ) but unfortunately that was then, and
the instructions don't seem to work for me on the current version of
the opengl library.

I'd really appreciate it if someone who has Ruby/OpenGL working on
Panther could write up a set of instructions for dummies; not just "you
might want to get the Apple GLUT src" but "Here's a url to the GLUT
src; download it, and run ... to get it compiled BEFORE the next step."
Or whatever.

I really did try to apply the hacks listed in that thread to the
current (0.32f) source, but I simply have no idea what I'm doing when
it comes to getting other's packages to compile properly.

Help, please? :)
 
J

john casu

: I'm trying to get Ruby/OpenGL working for just me on my MacOS X box;
: I've looked at various things people have helpfully written in the past
: on the topic ( ruby-talk:89025 ) but unfortunately that was then, and
: the instructions don't seem to work for me on the current version of
: the opengl library.

: I'd really appreciate it if someone who has Ruby/OpenGL working on
: Panther could write up a set of instructions for dummies; not just "you
: might want to get the Apple GLUT src" but "Here's a url to the GLUT
: src; download it, and run ... to get it compiled BEFORE the next step."
: Or whatever.

It would be nice if there were a binding that didn't use GLUT, because for
the most part it's unnecessary.

btw, I have similar issues with the ruby opengl bindings on Linux (I'm using
accelerated non mesa openGL on my box), and I just gave up trying to get
this to work properly.

To be fair, most scripting languages have issues with vendor supplied
openGL libs.


: I really did try to apply the hacks listed in that thread to the
: current (0.32f) source, but I simply have no idea what I'm doing when
: it comes to getting other's packages to compile properly.

: Help, please? :)
: --
: (-, /\ \/ / /\/
 
J

James Edward Gray II

I'm trying to get Ruby/OpenGL working for just me on my MacOS X box;

I'm extremely interested in this as well. Please keep us looped, if
you solve it.

James Edward Gray II
 
V

Vincent Isambart

Hi,

I just build Ruby/OpenGL 0.32f with glut on my Mac. Just replace the
content of its extconf.rb with what's beneath (starting with
#---extconf.rb). I just tested it on my Mac (Ruby 1.9 CVS, Mac OS X
10.3.5, last developer tools), but it should work. I you have any
problem with it, do not hesitate :eek:). To test it, just do: ruby
extconf.rb && make
Then try a sample: ruby sample/wrap.rb
If it works, you can then install it: sudo make install
I hope it helps ^o^
Some of it was inspired from stuff available on ruby-talk. The harder
part was to know that you have to add '-framework Foundation' not to
have an Objective-C error: 'objc: failed objc_getClass(NSObject) for
GLUTApplication->isa->isa'
Bye,
Vincent Isambart

#---extconf.rb
require 'mkmf'

File.unlink('Makefile') if File.exist?('Makefile')
File.unlink('Makefile.ogl') if File.exist?('Makefile.ogl')
File.unlink('Makefile.glut') if File.exist?('Makefile.glut')

$CFLAGS = '-I. -I/System/Library/Frameworks/OpenGL.framework/Headers
-I/System/Library/Frameworks/GLUT.framework/Headers'
$LDFLAGS = '-L/System/Library/Frameworks/OpenGL.framework/Libraries
-framework GLUT -framework Foundation'
Dir.mkdir('GL') unless File.exist?('GL')
File.symlink('/System/Library/Frameworks/OpenGL.framework/Headers/
gl.h', 'GL/gl.h') unless File.exist?('GL/gl.h')
File.symlink('/System/Library/Frameworks/OpenGL.framework/Headers/
glu.h', 'GL/glu.h') unless File.exist?('GL/glu.h')
File.symlink('/System/Library/Frameworks/GLUT.framework/Headers/
glut.h', 'GL/glut.h') unless File.exist?('GL/glut.h')

$objs = ['glu.o', 'ogl.o', 'rbogl.o']
create_makefile("opengl")
File.rename('Makefile', 'Makefile.ogl')

$objs = ['glut.o']
create_makefile("glut")
File.rename('Makefile', 'Makefile.glut')

modules = "glut.#{CONFIG['DLEXT']} opengl.#{CONFIG['DLEXT']}"

open('Makefile', 'w') {|f|
v = $nmake ? '{$(srcdir)}' : ''
f.write <<"MAKEFILE"
SHELL = /bin/sh
srcdir = #{$srcdir}
VPATH = $(srcdir)

all: #{modules}

opengl.#{CONFIG['DLEXT']}: #{v}rbogl.c #{v}ogl.c #{v}glu.c #{v}rbogl.h
@echo Now Making opengl extend module
@$(MAKE) -f Makefile.ogl

glut.#{CONFIG['DLEXT']}: #{v}glut.c
@echo Now Making glut extend module
@$(MAKE) -f Makefile.glut

clean:
@$(MAKE) -f Makefile.ogl clean
@$(MAKE) -f Makefile.glut clean

distclean:
@$(MAKE) -f Makefile.ogl distclean
@$(MAKE) -f Makefile.glut distclean

install: #{modules}
@$(MAKE) -f Makefile.ogl install
@$(MAKE) -f Makefile.glut install

site-install: #{modules}
@$(MAKE) -f Makefile.ogl site-install
@$(MAKE) -f Makefile.glut site-install
MAKEFILE
}
 
V

Vincent Isambart

Hi,

The previous version of Ruby/OpenGL was not working with Ruby/GtkGLExt,
only with GLUT. Here comes a better version of extconf.rb that will
correct this problem. Forget the previous version - use this one ^o^

Vincent Isambart
#-------extconf.rb
require 'mkmf'

File.unlink('Makefile') if File.exist?('Makefile')
File.unlink('Makefile.ogl') if File.exist?('Makefile.ogl')
File.unlink('Makefile.glut') if File.exist?('Makefile.glut')

Dir.mkdir('GL') unless File.exist?('GL')
File.symlink('/System/Library/Frameworks/OpenGL.framework/Headers/
gl.h', 'GL/gl.h') unless File.exist?('GL/gl.h')
File.symlink('/System/Library/Frameworks/OpenGL.framework/Headers/
glu.h', 'GL/glu.h') unless File.exist?('GL/glu.h')
File.symlink('/System/Library/Frameworks/GLUT.framework/Headers/
glut.h', 'GL/glut.h') unless File.exist?('GL/glut.h')

$CFLAGS = '-I. -I/System/Library/Frameworks/OpenGL.framework/Headers
-I/System/Library/Frameworks/GLUT.framework/Headers'
$LDFLAGS = '-L/System/Library/Frameworks/OpenGL.framework/Libraries
-lGL -lGLU'
$objs = ['glu.o', 'ogl.o', 'rbogl.o']
create_makefile("opengl")
File.rename('Makefile', 'Makefile.ogl')

$LDFLAGS = '-L/System/Library/Frameworks/OpenGL.framework/Libraries
-framework GLUT -framework Foundation'
$objs = ['glut.o']
create_makefile("glut")
File.rename('Makefile', 'Makefile.glut')

modules = "glut.#{CONFIG['DLEXT']} opengl.#{CONFIG['DLEXT']}"

open('Makefile', 'w') {|f|
v = $nmake ? '{$(srcdir)}' : ''
f.write <<"MAKEFILE"
SHELL = /bin/sh
srcdir = #{$srcdir}
VPATH = $(srcdir)

all: #{modules}

opengl.#{CONFIG['DLEXT']}: #{v}rbogl.c #{v}ogl.c #{v}glu.c #{v}rbogl.h
@echo Now Making opengl extend module
@$(MAKE) -f Makefile.ogl

glut.#{CONFIG['DLEXT']}: #{v}glut.c
@echo Now Making glut extend module
@$(MAKE) -f Makefile.glut

clean:
@$(MAKE) -f Makefile.ogl clean
@$(MAKE) -f Makefile.glut clean

distclean:
@$(MAKE) -f Makefile.ogl distclean
@$(MAKE) -f Makefile.glut distclean

install: #{modules}
@$(MAKE) -f Makefile.ogl install
@$(MAKE) -f Makefile.glut install

site-install: #{modules}
@$(MAKE) -f Makefile.ogl site-install
@$(MAKE) -f Makefile.glut site-install
MAKEFILE
}
 
M

Michal 'hramrach' Suchanek

Hi,

The previous version of Ruby/OpenGL was not working with Ruby/GtkGLExt,
only with GLUT. Here comes a better version of extconf.rb that will
correct this problem. Forget the previous version - use this one ^o^

Great, this one works.
But the mail got somewhat wrepped so one has to unwrap it before loading
into ruby.

The freeglut version starts up much faster but the surface demo does not
work with it.

It is nice to have both :)

Thanks

Michal Suchanek
 
J

James Edward Gray II

Hi,

I just build Ruby/OpenGL 0.32f with glut on my Mac. Just replace the
content of its extconf.rb with what's beneath (starting with
#---extconf.rb). I just tested it on my Mac (Ruby 1.9 CVS, Mac OS X
10.3.5, last developer tools), but it should work. I you have any
problem with it, do not hesitate :eek:). To test it, just do: ruby
extconf.rb && make
Then try a sample: ruby sample/wrap.rb
If it works, you can then install it: sudo make install
I hope it helps ^o^

I'm going to try this at some point this weekend, but just to be clear,
all that is needed is Ruby and Mac OS X.3.5? You didn't install any
glut library, for example?

Thanks much for the tips.

James Edward Gray II
 
V

Vincent Isambart

Hi,

I'm going to try this at some point this weekend, but just to be
clear, all that is needed is Ruby and Mac OS X.3.5? You didn't
install any glut library, for example?

My extconf.rb uses the GLUT from Apple (framework in
/System/Library/Frameworks/GLUT.framework).
You where asking for something simple, and having to compile a library
is not so simple (it can depend on whether you have fink/opendarwin or
not, where you want to install it, whether you have/want to use
X11...).
As there is already a version of GLUT on Mac OS X, I chose to use this
one ^o^

Vincent Isambart
 
J

James Edward Gray II

My extconf.rb uses the GLUT from Apple (framework in
/System/Library/Frameworks/GLUT.framework).
You where asking for something simple, and having to compile a library
is not so simple (it can depend on whether you have fink/opendarwin or
not, where you want to install it, whether you have/want to use
X11...).
As there is already a version of GLUT on Mac OS X, I chose to use this
one ^o^

Actually, it was me who asked initially, but I do appreciate all your
help. :)

I followed your steps today flawlessly. Works great. Thanks for all
the great help.

James Edward Gray II
 
D

David Ross

How is the OpenGL performance for Ruby bindings on
MacOSX? Just curious.

--David Ross

Actually, it was me who asked initially, but I do
appreciate all your
help. :)

I followed your steps today flawlessly. Works
great. Thanks for all
the great help.

James Edward Gray II




__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail
 
J

James Edward Gray II

How is the OpenGL performance for Ruby bindings on
MacOSX? Just curious.

I didn't run any benchmarks, but it seemed downright zippy from my very
simple playing around on my Dual 2.0Ghz G5. Take that with a huge
grain of salt, obviously.

James Edward Gray II
 
M

Michal 'hramrach' Suchanek

How is the OpenGL performance for Ruby bindings on
MacOSX? Just curious.
Do you know about something like ruby-glxgears?
I can only say that the demos that run with the bindings can take a few
seconds to display in x11 and quite some time to display in an aqua window.
But I have nothing that would do some work continuously.
On an g3 500Mhz iMac with an ATI card.

Thanks

Michal Suchanek
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top