Home           About           Downloads

QtImagine - a skeleton project for live coding using ECL

QtImagine has been updated!

In the process of releasing QtLuaImagine, I cleaned up the code for QtImagine. All lisp code is now run through a (handler-bind) block so that error messages can be captured. What this means is that error messages are displayed in the main window, so no more need to flip between the console and the main window when an error occurs. Also, grey streams have been used to redirect trace output to the main window as well.

This project demonstrates the use of ECL in a Qt project to enable a 3D "live coding" environment.

The system calls the lisp functions (update) and (render) to update and render the frame respectively. These functions can be redefined at runtime at the REPL.

When QtImagine first starts, click the "Execute" button to load an example lisp source file containing example definitions of (update) and (render) which will produce a simple animation. Then, load the source file into your favourite text editor, make some changes, then load your freshly edited source file from the REPL by issuing the load command (load "live-render.lisp") to see the effect of your change instantly. Of course, you can also enter expressions and definitions at the REPL itself. The REPL features a command history.


  1. Many thanks, this is very useful!

    Anyway, you're a big lier:
    Since I didn't find "Visual Studio 2008" neither on my Mac nor on my Linux, I tried Qt Creator, made some trivial changes (especially to Imagine.pro), and it now runs perfectly well on all of my platforms.



  2. I've tried to build your example on linux (Qt 4.5.2, GCC 4.4.1) and I've stumbled on a few problems. The first one was on mainwindow.cpp, where void MainWindow::DoLisp() called snprintf() without including stdio.h.

    After solving that there was a long list of undefined references on mainwindow.cpp, which was caused by the Lisp.{h,cpp} files not being included in the Imagine.pro file. As soon as those files were added to the HEADERS and SOURCES list and qmake was ran again those problems vanished.

    After that the compilation process complained that it couldn't find windows.h, along with OutputDebugString(). After replacing a call to that function with fprintf(stderr,"%s",buf) the compilation resumed.

    Following that, a series of undefined references starting with cl_boot() and followed by a series of other ecl functions. That problem went away after adding LIBS += -lecl to the Imagine.pro file.

    Then a undefined reference to cbMyAdd() popped out. That problem vanished after doing to ECLCallbacks.{h,cpp}: include them in Imagine.pro.

    Finally, ECLCallbacks.cpp referenced 4 windows system-specific headers. After removing them from the source file the build process finally finished without a problem and QtImagine ran like a champ on linux.

    And by the way, great example code. Kudos!