[MacRuby-devel] GLUT (second time around)

John Shea johnmacshea at gmail.com
Sun Dec 14 09:37:49 PST 2008


(I accidently sent this from the wrong email account initially)

Hello everyone,

Anyone done any macruby opengl?

I am trying to get Hillegass's opengl example going in MacRuby.

My MacRuby version falls over in the drawRect method of an  
NSOpenGLView subclass, when it hits the glut function calls.

eg: glutSolidTorus(0.3, 1.8, 35 , 31)

It does not have problems with previous open gl methods/functions eg:

   def drawRect(r)
     glClearColor(0.2, 0.4, 0.1, 0.0)
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
     glMatrixMode(GL_MODELVIEW)
     glLoadIdentity
     gluLookAt(@radius * Math::sin(@theta), 0, @radius *  
Math::cos(@theta), 0,0,0,0,1,0)

     lightPosition = [@lightX, 1, 3, 0.0]
     glLightfv(GL_LIGHT0, GL_POSITION, lightPosition)

     if !@displayList
       @displayList = glGenLists(1)
       glNewList(@displayList, GL_COMPILE_AND_EXECUTE)

       glTranslatef(0,0,0)
       glutSolidTorus(0.3, 1.8, 35 , 31) <= error occurs here   
`drawRect': undefined local variable or method `glut' for #<GlissView: 
0x10df210> (NameError)


I am actually uncertain whether it is a MacRuby issue or just that I  
am not loading the glut framework or requiring it properly or  
something else.

Both the OpenGL and GLUT frameworks are in the Xcode project , and i  
do the framework calls:

framework 'Cocoa'
framework 'OpenGL'
framework 'GLUT'

in rb_main.rb. Though in fact it seems to not fall over any earlier if  
i remove the last two framework calls.

I am using macruby version 766.

Any ideas?

cheers and thanks,
John


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20081214/baa4b0ba/attachment.html>


More information about the MacRuby-devel mailing list