OK, I think I got getting Ruby Tk and OpenGL figured out -- at least for the most part. For posterity and the hope it will be useful to someone else I'll go through the steps of how I got it working below. Step 1. I installed ActiveTcl 8.4 <http://www.activestate.com/> and Tcl3D <http://www.tcl3d.org/> installed on my system under the directory 'C:\Ruby\Tcl'. I then made sure the Tcl3D demos ran fine to confirm OpenGL was properly working. Step 2. I added the following lines to my setup.rb file in 'C:\Ruby\lib\ruby\1.8\tkextlib' --------------------------- Tk::AUTO_PATH.list <<= 'C:/Ruby/Tcl/lib/tcl3d0.3.1/tcl3dCg' Tk::AUTO_PATH.list <<= 'C:/Ruby/Tcl/lib/tcl3d0.3.1/tcl3dFTGL' Tk::AUTO_PATH.list <<= 'C:/Ruby/Tcl/lib/tcl3d0.3.1/tcl3dGauges' Tk::AUTO_PATH.list <<= 'C:/Ruby/Tcl/lib/tcl3d0.3.1/tcl3dGl2ps' Tk::AUTO_PATH.list <<= 'C:/Ruby/Tcl/lib/tcl3d0.3.1/tcl3dOde' Tk::AUTO_PATH.list <<= 'C:/Ruby/Tcl/lib/tcl3d0.3.1/tcl3dOgl' Tk::AUTO_PATH.list <<= 'C:/Ruby/Tcl/lib/tcl3d0.3.1/tcl3dSDL' Tk::AUTO_PATH.list <<= 'C:/Ruby/Tcl/lib/tcl3d0.3.1/tcl3dTogl' Tk::AUTO_PATH.list <<= 'C:/Ruby/Tcl/lib/tcl3d0.3.1/tcl3dUtil' --------------------------- Step 3. I created a togl wrapper class in 'togl.rb' as suggested by Hidetoshi NAGAI as shown below: --------------------------- # # Togl wrapper for tcl3d Tk extension. # TkPackage.require('tcl3d') class Tk::Togl < TkWindow TkCommandNames = ['togl'.freeze].freeze WidgetClassName = 'Togl'.freeze WidgetClassNames[WidgetClassName] = self def render tk_send_without_enc('render') self end def swapbuffers tk_send_without_enc('swapbuffers') self end def make_current tk_send_without_enc('makecurrent') self end def post_redisplay tk_send_without_enc('postredisplay') self end end --------------------------- Step 4. I create a simple 'togltest.rb' application to test OpenGL working within Tk togl widget: --------------------------- require 'tk' require 'togl' require 'opengl' def create(toglwin) light_diffuse = [1.0, 0.0, 0.0, 1.0] light_position = [1.0, 1.0, 1.0, 0.0] GL::Light(GL::LIGHT0, GL::DIFFUSE, light_diffuse); GL::Light(GL::LIGHT0, GL::POSITION, light_position); GL::Enable(GL::LIGHT0); GL::Enable(GL::LIGHTING); GL::Enable(GL::DEPTH_TEST); GL::MatrixMode(GL::PROJECTION); GLU::Perspective(40.0, 1.0, 1.0, 10.0); GL::MatrixMode(GL::MODELVIEW); GLU::LookAt(0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0) GL::Translate(0.0, 0.0, -1.0); GL::Rotate(60, 1.0, 0.0, 0.0); GL::Rotate(-20, 0.0, 0.0, 1.0); end def reshape(toglwin, width, height) width = width.to_i height = height.to_i if $glwin $glwin.post_redisplay end end def display(toglwin) n = [ [-1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [1.0, 0.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, 1.0], [0.0, 0.0, -1.0] ] faces = [ [0, 1, 2, 3], [3, 2, 6, 7], [7, 6, 5, 4], [4, 5, 1, 0], [5, 6, 2, 1], [7, 4, 0, 3] ] v = [ [-1, -1,1], [-1, -1,-1], [-1,1,-1], [-1,1,1], [1, -1,1], [1, -1,-1], [1, 1,-1], [1,1,1] ] GL::Clear(GL::COLOR_BUFFER_BIT | GL::DEPTH_BUFFER_BIT); for i in (0..5) GL::Begin(GL::QUADS); GL::Normal(*(n[i])); GL::Vertex(v[faces[i][0]]); GL::Vertex(v[faces[i][1]]); GL::Vertex(v[faces[i][2]]); GL::Vertex(v[faces[i][3]]); GL::End() end $glwin.swapbuffers end $root = TkRoot.new $frame = TkFrame.new($root).pack('fill'=>'both', 'padx'=>10, 'pady'=>10) $glwin = Tk::Togl.new($frame, 'width'=>300, 'height'=>300, 'ident'=>'Single', 'rgba'=>true, 'depth'=>true, 'double'=>true, 'createproc'=>proc {|toglwin| create(toglwin)}, 'displayproc'=>proc {|toglwin| display(toglwin)}, 'reshapeproc'=>proc {|toglwin, width, height| reshape(toglwin, width, height)} ).pack('fill'=>'both') Tk.mainloop --------------------------- That's it. When you run the Ruby Tk application a window with an OpenGL 3D red block should appear. I hope someone else finds this information useful. Mike Thompson