From: John Gabriele Date: 2006-07-11T14:55:45+09:00 Subject: Re: [ANN] ruby-opengl On 7/9/06, Bill Kelly wrote: > From: "John Gabriele" > > On 7/7/06, Bill Kelly wrote: > > > From: "John Gabriele" > > >[snip] > > > > I reverted my changes to the method names, so it's back to being > > "ruby-opengl". Please take a 2nd look. > > Awesome! Much appreciated... It's a weight off my mind to > not have to worry about the API changing. > > > BTW, here's one possible way to define the prefixed methods > and constants, if you prefer to work with them that way. > > You could require a file that does something like the > following: > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > require 'opengl' > > class Object > (GL.methods - Object.methods).each do |m| > define_method("gl#{m}") {|*args| GL.send(m, *args)} > end > > (GLU.methods - Object.methods).each do |m| > define_method("glu#{m}") {|*args| GLU.send(m, *args)} > end > end > > GL.constants.each do |c| > Object.const_set("GL_#{c}", GL.const_get(c)) > end > > GLU.constants.each do |c| > Object.const_set("GLU_#{c}", GLU.const_get(c)) > end > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > This should import the GL and GLU methods and constants > into the global namespace, using their traditional > prefixed nomenclature. > > (Note: Only lightly tested... but I think it works.. :) It seems to work! Thanks! I just added it (Ilmari had also offered a solution, which I appreciate very much, but I ended up using yours). Have a look: http://www.simisen.com/cgi-bin/jmg/ruby-opengl.rb I've only tried it so far with samples/smooth.rb. It's late and I *really* have to get to bed. :) Thank you again. This is really shaping up nicely, IMO. The current release is labeled 0.34pre because I'd like to hear from someone running Mac OS X 10.4 if it builds and runs there out-of-the-box. I'd also like to "port" more of the samples over (I figure I'll try to provide at least a good number of samples written in *both* styles). If anyone wants to help with that, be my guest. :) Anne, you're on 10.4 ("Tiger" I suppose -- I don't know the Apple cat-names for them), right? Does this latest release work for you without any tweaking? Thanks, ---John