Doing computer graphics is fun. So, I wrote another fractal renderer. In itself, it's rather boring. But this time, I made it a generic tool, not a specialized "mandelbrot renderer" or something like that. Instead, the main program only provides you with a GUI to set parameters. It will then run a loop and call a lua function to determine the color of each pixel. Looks something like this: locators = {"center"} color_ramps = {"outcolors"} scalars = {"escape", "nmax"} function defaults() set_locator("center", -0.5, 0, 1) set_scalar("escape", 4) set_scalar("nmax", 100) end function value_at(x, y) ... escape = scalar("escape") nmax = scalar("nmax") center_x, center_y, zoom = locator("center") x = (x * zoom) + center_x y = (y * zoom) + center_y re_c = x im_c = y for n = 0, nmax - 1, 1 do ... if sqr_abs_z > escape then ... return color_ramp("outcolors", mu) end end return 0.0, 0.0, 0.0 end This will construct a GUI on the fly to allow you to set those parameters. The point is to allow you to easily experiment with different fractal formulae. This file (`mandelbrot.lua`) is user-supplied content. Of course, this is slow as hell. Calling to lua for *every pixel* and then back to C for some things. It could be optimized a bit, but I don't think it'll be fast enough. Instead, I'll try to move everything to C. The idea is to have the user provide a single `.c` file, compile it on the fly into a shared object, and run `dlopen()` on the result. Not sure if this actually works, I've never done it before, so we'll see! ... aaaand it works. My test case in lua took about 2.4 seconds, the C version takes about 0.3 seconds. So, a lot faster, but I think/hope there's still room for improvement.