From: Hidetoshi NAGAI Date: 2006-09-12T12:09:43+09:00 Subject: Re: Opengl Tk widget for Ruby? From: "mpthompson at gmail.com" Subject: Opengl Tk widget for Ruby? Date: Tue, 12 Sep 2006 09:45:34 +0900 Message-ID: <1158021828.394689.117290@h48g2000cwc.googlegroups.com> > I'm would like to create a unified Ruby on Windows XP that will combine > user interface elements of Ruby/Tk and OpenGL. Using Google I've seen > several year old references to a Togl Tk widget that seemed to wrap > OpenGL as a Tk widget, but all the links to it appear to be dead and I > can't find any references that it ever worked on Windows. There is a section "Windows 95/NT/2000/XP usage" on . However, Togl seems to be integrated into Tcl3D . BTW, Ruby/Tk can handle almost all of Tcl/Tk extensions. If there is no Ruby/Tk's wrapper for a Tcl/Tk extension, you can send Tcl commands to handle the extension with Tk.tk_call(...tokens_of_Tcl_command_line...), and so on. I think that it is not difficult to write your own wrapper. For example, simple Togl wrapper is ----------------------------------------------------------- # # IMPORTANT: NOT TESTED. So, this may not work properly. # TkPackage.require('Togl') class Tk::Togl < TkWindow # By default, the constracter of a widget class (subclass of TkWindow) # uses TkCommandNames[0] as a command to create a widget object. TkCommandNames = ['togl'.freeze].freeze # The following definitions are used to create a widget object # from a widget path string. 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 end # f = TkFrame.new # togl_obj1 = Tk::Togl.new(f, :width=>200, :height=>200, :ident=>'Single', # :rgba=>true, :double=>false, :depth=>true).pack # togl_obj2 = Tk::Togl.new(f, :width=>200, :height=>200, :ident=>'Double', # :sharelist=>'Single', # :rgba=>true, :double=>true, :depth=>true).pack # togl_obj1.bind('B1-Motion', proc{....}) ----------------------------------------------------------- -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)