On Sat, Jul 12, 2008 at 10:49 PM, Jose A. Ortega Ruiz jao@gnu.org wrote:
what would be the best way to have an OpenGL/GLUT window open and manipulate it from a (non-blocked) REPL, maybe even while the GLUT main loop is running.
If you are using a multi-threaded Lisp, you can redefine e.g. your glut:display method and GLUT's main loop will pick it up. Otherwise, you'll have to interrupt the loop, redefine things, then resume it.
If you want to try GL commands at the REPL and watch their effect interactively then try something like this:
CL-USER> (let ((glut:*run-main-loop-after-display* nil)) (glut:display-window (make-instance 'glut:window))) NIL CL-USER> (progn (gl:clear-color 1 0 0 0) (gl:clear :color-buffer) (gl:flush))
Running glut:main-loop in a separate thread seems to confuse GLUT, so when you need GLUT's help to handle some window event, you can call glut:main-loop-event which only handles at most one event per call, IIUC.
HTH