[ruby-opengl-devel] opinions on rubygl
jmg3000 at gmail.com
Fri Sep 1 00:26:42 EDT 2006
On 8/31/06, Robert Krimen <grin.k1tt3n at gmail.com> wrote:
> > 2. Naming conventions. Contrary to how the current ruby-opengl does
> > things (which I'd done most of the pushing for):
> > | require 'GL'
> > | include GL
> > | glFooBar( GL_FOO_BAR )
> I think the above style is good, since it's closest to the C library. I
> think the code below is the domain ot a special rubyish wrapper. Following
> the naming trend below could lead to different rubyish shortcuts that, while
> good, would be confusing to people expecting the OpenGL API.
> code that uses rubygl looks more like this:
> | require 'rubygl'
> | include Gl, Glu, Glut
> | foo_bar( :foo_bar )
> The reasoning for using our syntax is to make it as similar to the C
> API as possible to ease the transition for folks who already know the
> C API. Also, it's to make it easier to port your Ruby OpenGL code to C
> if it were to become necessary.
> That said, the rubygl naming is more customary with how things are
> usually done in the Ruby world, and admittedly does look rather
> spiffy. ;)
Hm. It also occurs to me that, if we went for the all lowercase names
without the gl/glu/glut prefixes, when you do that "include Gl, Glu,
Glut", you'd be polluting your namespace quite a bit. For graphics
folks, they may already have methods with names like vertex, material,
draw_pixels, get, scale, rotate, look_at, enable, and so on. Same goes
for the way rubygl turns those constant names into un-prefixed symbols
(:alpha, :rgb, etc.). Looks nice at first, but may turn into a
Yeah, that could actually turn into a mess, and then folks probably
just wouldn't bother with the "include" statement anymore, which
kinda' defeats the purpose of trying to make it so you don't have to
prefix everything with a module name.
More information about the ruby-opengl-devel