[slime-devel] OpenGL Integration into the REPL ?

Joshua Boyd jdboyd at jdboyd.net
Thu Jul 13 22:40:22 UTC 2006

On Thu, Jul 13, 2006 at 08:44:14AM +0100, Sean Charles wrote:
> Hello,
> I am currently developing 'something interesting' using SBCL and  
> OpenGL via Apple X11.
> I have built SBCL and OpenGLUT from source as I am lucky enough to  
> have an Intel 20" iMac and I wanted to make sure I was getting  
> maximum speed i.e. no Rosetta in the way.    My 'project' is coming  
> along but it bugs me that I have to keep stopping and starting the  
> application in order to make changes to the software because once the  
> 'glutMainLoop' gets control the SLIME session doesn't respond anymore.
> I had to slightly modify the cl-opengl package as it has two symbol  
> naming problems concerning the roman fonts but that is the only  
> change I have had to make along with the library.lisp package which  
> needed to be coaxed into loading my OpenGLUT build on an Intel Darwin  
> platform. Apart from that it works very well, the MESADEMOS:GEARS  
> averages about 4900 frames per second much to my disbelief!!!
> I know that SBCL does not currently support threading on the intel  
> iMac which maybe would solve all my problems in one fell swoop.
> Software:
> 	SLIME		CVS latest as of 13-July-2006
> 	SBCL             0.9.13
> 	OpenGLUT   0.6.3
> I have spent a few hours reading the SWANK code trying to see where I  
> can make changes but I am just to new to it, I have used SLIME but  
> never before had a need to modify it and right now it looks a bit  
> intimidating to try and figure out how to do what I would like to do  
> which is basically find a way to make the OpenGL timer function and  
> the display function both to 'keep the SWANK backend alive' by  
> somehow calling whatever is needed to ensure that the SLIME session  
> remains active at the same time as my OpenGL application is running.  
> For me this would be incredibly productive as it means (if I have  
> understood LISP so far [used Smalltalk for about 6 years]) that I can  
> fiddle with my application while it is running and see any changes  
> that affect the display be effected the next time the display is  
> rendered.
> Is this at all possible???
> I would think that a new SWANK back end could be created.
> I have also toyed with the idea of hacking the SBCL source code  
> directly to contain the OpenGL libraries and somehow making the  
> changes at that point but id I thought SWANK / SLIME was big, SBCL is  
> enormous by comparison and I'd rather be coding my application that  
> fiddling with the tools.

Have you considered using glutMainLoopEvent() instead?  It may require
some restructuring of your program (remove glutIdleFunc mainly).

Still, from when glutMainLoopEvent is called until it returns, slime
will still be unresponsive.  However, if you stick
SB-SYS:SERVE-ALL-EVENTS in all of your callback functions, then maybe it
will be good enough.

I'm not an expert on slime, but I do know GLUT pretty well and how to
beat it into playing nicely with other stuff.

More information about the slime-devel mailing list