From: George Ogata Date: 2006-02-21T11:53:31+09:00 Subject: Re: can opengl work with an object method? "anne001" writes: > I started with robot.rb in the sample folder of opengl-0.32g > > It comes with a display proc: > display = Proc.new {} > > which is called by a glut function > GLUT.DisplayFunc(display); > > When I place the exact same code in a method > class Node > def traversetree > end > end > > upperarm = Node.new > GLUT.DisplayFunc(upperarm.traversetree); > > displays the image in a different size, and does not respond to resize > or keyboard keys > > Any option? It doesn't work because `upperarm.traversetree' calls #traversetree and returns its value, rather than the method itself. If you want the method itself, you need to do `upperarm.method(:traversetree)'. However, it seems GLUT.DisplayFunc won't accept Method objects; only Procs. Do that with Kernel#lambda: GLUT.DisplayFunc(lambda{upperarm.traversetree})