[ruby-opengl-devel] opinions on rubygl
grin.k1tt3n at gmail.com
Thu Aug 31 23:01:45 EDT 2006
> 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. ;)
> 3. Callbacks are handled a bit more simply in rubygl. The rubygl code
> (I think) looks like:
> | display_func do |w, h|
> | viewport ...
> | matrix_mode :projection
> | #...
> | matrix_mode :modelview
> | load_identity
> | end
> compared to how it's done in ruby-opengl:
> | reshape = lambda do |w, h|
> | glViewport( ... )
> | glMatrixMode( GL_PROJECTION )
> | # etc.
> | glMatrixMode( GL_MODELVIEW )
> | glLoadIdentity
> | end
> | glutReshapeFunc( reshape )
> I haven't yet looked closely at how the C code to enable this syntax
> differs from what ruby-opengl has. And, actually, since I'm so new at
> working with extension modules, I don't yet know a whole lot about
> what I'm looking at.
> Discussion welcome.
> ruby-opengl-devel mailing list
> ruby-opengl-devel at rubyforge.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ruby-opengl-devel