Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > OpenGL and Ruby?

Reply
Thread Tools

OpenGL and Ruby?

 
 
anne001
Guest
Posts: n/a
 
      01-15-2006
I would like to learn a little computer graphics. Courses I have looked
at don't teach maya, zbrush etc, they teach computer programming with
OpenGL.

Can I use OpenGL with Ruby? Do I need to install anything extra (OX
Tiger with ruby1..

If I do need to install OpenGL, is this advice safe to follow on Tiger?

http://groups.google.com/group/comp....2c87a9fd4b729d

How can I go about learning OpenGL and Ruby at the same time? (I have
written a small program in Ruby, I am learning methods, object
structure etc). Is there any documentation on how to use OpenGL from
Ruby?

 
Reply With Quote
 
 
 
 
anne001
Guest
Posts: n/a
 
      01-15-2006
I tried to install openGL for ruby, opengl-0.32f and opengl-0.32g

Ruby-OpenGL Bindings for Mac OS X
=================================
$ ruby extconf.rb

I get an error
can't find header files for ruby. I found a reference which suggests it
is not finding ruby.h?
How do I find ruby.h, and when I find it, what do I do next?

 
Reply With Quote
 
 
 
 
anne001
Guest
Posts: n/a
 
      01-15-2006
the first line of extconf.rb is

require "mkmf", which is also the first line in programming ruby, ed 2
page 277.

If I just run that line, I get the same error message,
ruby
require "mkmf"
can't find header files for ruby.

I am using the ruby that comes with Tiger.

I tried the make, and I found a recent mkmf.log file. But I don't think
the extconf.rb ran all the way, so who knows what make does!

any suggestion?

 
Reply With Quote
 
Gerald Murray
Guest
Posts: n/a
 
      01-15-2006
Requirements for using opengl are the opengl LIBRARIES (libGL,libGLU,
and some applications use glut) and the ruby WRAPPER such as
opengl-0.32
and HEADERS for ruby.

You need the headers from one of:
{first look in the libraries /usr/local/lib/ruby/1.8/i686-linux/ruby.h
(substitute for i686-linux your arch)
Ruby should find it if it is there, but you can use a link to it.}
OR
{If it is not there, and ruby on your system is installed from
packages,
the header files are in a separate package with '-dev' in the name.
Install that package.}
OR
{The headers that are required are in the top directory of the ruby
source
package. You can link/copy the files from the ruby source for the
version you are using.}

Older versions of ruby also used some other files that were provided in

the top directory of the source package.

Regarding the 'who knows what make does', there should never be
a file 'Makefile' in the top directory of a package that contains the
file 'extconf.rb' The purpose of executing 'ruby extconf.rb' is to
verify
that requirements have been met on the system. If all conditions are
met,
then a Makefile is created. If not, there is no Makefile.

I do not know about special considerations for Tiger.

There are many examples in the directory 'sample' of the wrapper.

Best regards
Gerald

 
Reply With Quote
 
anne001
Guest
Posts: n/a
 
      01-16-2006
thank you so much for your response.

I did indeed find ruby.h in
anne-g:/usr/lib/ruby/1.8/universal-darwin8.0

>Ruby should find it if it is there, but you can use a link to it

HOW DO I FIND A LINK TO IT?

and I found mkmf.rb in the usr/lib/ruby/1.8 directory.
I tried to debug mkmf.rb with puts. I found that it was looking for
ruby.h in
/usr/lib/ruby/1.8/powerpc-darwin8.0

I jerryrigged it (using sudo to change the file) to look for ruby.h in
the right directory.

libdir = "/usr/lib/ruby/1.8"
$extmk = libdir != Config::CONFIG["rubylibdir"]
if not $extmk and File.exist?
"/usr/lib/ruby/1.8/universal-darwin8.0/ruby.h"
$hdrdir = $topdir ="/usr/lib/ruby/1.8/universal-darwin8.0"
elsif File.exist? $srcdir + "/ruby.h"
$topdir = Config::CONFIG["compile_dir"]
$hdrdir = $srcdir
else
abort "can't find header files for ruby."
end

this took care of the header file error.

checking for XAllowDeviceEvents() in -lXi... no
checking for XMITMiscGetBugMode() in -lXext... no
checking for XmuAddCloseDisplayHook() in -lXmu... no
checking for XOpenDisplay() in -lX11... no
checking for main() in -lGL... no
checking for main() in -lMesaGL... no
can't create OpenGL module!

I have to figure out if this is also a path problem or if there are
files missing.

http://www.opengl.org/documentation/...entations.html
According to this site, openGL does come with tiger.
http://developer.apple.com/graphicsi...oad/index.html
Mac OS X v10.2 OpenGL CFM Software Development Kit (DMG)
is from 2003. Do I need that?

I wish mkmf.rb did not have this bug in the path, so I did not have to
worry about what it does!
IS THERE A FIX TO MKMF.RB so it won't have this path problem on the
1.8.2 that comes pre-installed on Ruby? If so, where do I find it?

thank you for helping me along

anne

 
Reply With Quote
 
anne001
Guest
Posts: n/a
 
      01-16-2006
oups ignore the previous error messages
the opengl-0.32g folder
does not come with darwin option in the extconf.rb

when I ran the extconf.rb which came with opengl-0.32f modified for
tiger
2005-04-26 :: James Adam <(E-Mail Removed)>
I get the following error.

ruby extconf.rb
checking for main() in -lGL... no
checking for main() in -lMesaGL... no
checking for main() in -lGL... no
can't create OpenGL module!
I did check that opengl frameworks and glut frameworks are in the
directory
system/library/frameworks

again, there seems to be a disconnect, it is looking for lGl when I
have libGL
system/library/frameworks/OpenGL.framework/Libraries anne$ ls
libGL.dylib libGLSystem.dylib
libGLImage.dylib libGLU.dylib
libGLProgrammability.dylib

It seems like the program is looking for a main function in a GL
library. I tried this
puts find_library("ibGL.dylib", func,
"/System/Library/Frameworks/OpenGL.framework/Libraries/")
and get
checking for main() in -libGL.dylib... no
tried without the extension
checking for main() in -libGL... no
tried with the whole name
checking for main() in -llibGL... no

It seems to me the problem is with finding an appropriate extconf.rb to
install the opengl-0.32g onto my Tiger system!
http://blade.nagaokaut.ac.jp/cgi-bin...by-talk/112184
did not work, it was for panther.
Makefile.glut:40: *** missing separator. Stop.
make: *** [glut.bundle] Error 2

but I only found these two extconf, and obviously something is off.
Hope someone out there knows what to do!

 
Reply With Quote
 
Gerald Murray
Guest
Posts: n/a
 
      01-16-2006
on unix, the
checking for ? in -lX11 ..no
means it is trying to test that function using a test program for the
library.
The library may be present, but has no symbols (and headers were not
found.) OR the test program did not find the path to the library.
So either correct the path, or add the header files, usually found in a
package with the same name, but containing '-dev' in its name.

the test for symbols is to use the nm command
nm /usr/lib/libX11.so

regards,
Gerald

 
Reply With Quote
 
anne001
Guest
Posts: n/a
 
      01-16-2006
Thank you for your suggestion. I only saw it now

I followed the instructions on
http://blade.nagaokaut.ac.jp/cgi-bin...uby-talk/90341
without any understanding, but just as indicated

except
1. I kept the beginning of this line
CFLAGS = -fno-common -arch i386 -arch ppc -g -Os -pipe
-I/System/Library/Frameworks/OpenGL.framework/Headers
-I/System/Library/Frameworks/GLUT.framework/Headers
and
2. I replaced powerpc-darwin8.0 to universal-darwin8.0 in the ruby
section.

I got a few warning messages
make
Now Making glut extend module
gcc -fno-common -arch i386 -arch ppc -g -Os -pipe
-I/System/Library/Frameworks/OpenGL.framework/Headers
-I/System/Library/Frameworks/GLUT.framework/Headers -I.
-I/usr/lib/ruby/1.8/universal-darwin8.0
-I/usr/lib/ruby/1.8/universal-darwin8.0 -I. -I. -c glut.c
glut.c: In function 'glut_KeyboardFunc':
glut.c:147: warning: passing argument 1 of 'glutKeyboardFunc' from
incompatible pointer type
glut.c: In function 'glut_KeyboardFunc':
glut.c:147: warning: passing argument 1 of 'glutKeyboardFunc' from
incompatible pointer type
cc -dynamic -bundle -undefined suppress -flat_namespace
-L/usr/lib/ruby/1.8/universal-darwin8.0 -L/usr/lib
-L/System/Library/Frameworks/OpenGL.framework/Libraries -L"/usr/lib" -o
glut.bundle glut.o -ldl -lruby -lGLU -lGL -lobjc -framework GLUT
Now Making opengl extend module
cc -dynamic -bundle -undefined suppress -flat_namespace
-L/usr/lib/ruby/1.8/universal-darwin8.0 -L/usr/lib
-L/System/Library/Frameworks/OpenGL.framework/Libraries -L"/usr/lib" -o
opengl.bundle glu.o ogl.o rbogl.o -ldl -lruby -lGLU -lGL -lobjc
-framework GLUT

robot.rb works with the letter e and s (esc (ascii code 27)) to stop
it.

then I ran sudo make install

I don't know what I have achieved, but since ruby sample/robot.rb
worked!
I should be able to do something with opengl?

I hope this is correct, and that it helps someone else!

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ And TDD/ C++ programming on Android/ String Calculator Kata inC++/ C++and OpenGL on Android with the NDK/c++ Convert Integers to Roman Numerals sterta bole C++ 0 08-27-2012 09:09 PM
povray and opengl install and use? anne001 Ruby 1 01-22-2006 02:02 PM
py2exe and OpenGL problem bigredindian@gmail.com Python 1 09-25-2005 09:30 PM
openGL and 1.5 nos Java 3 03-05-2004 06:32 PM
Help detecting and using Two Mice in Windows OpenGL app? Steve C++ 5 09-29-2003 02:55 PM



Advertisments