Mincus's picture

Fun with Fractals

Recently got into writing some Mandelbrot code (courtesy of Jonathan Coulton's song Mandelbrot Set). Knocked up some C quickly and moved onto some GL shaders for both Mandelbrot and Julia.

I wanted to write an app with zooming and other features. C# obviously provides a very quick way to knock together an interface for this sort of thing, and with OpenTK I have the GLcontrol.

Seemed like a good solution and so far that has definitely been the case.
What I have so far:
- Renders Mandelbrot set to a texture through FBOs (will allow easy saving as a bitmap/whatever at a later date)
- Shows the Julia set for the mouse position in on the Mandelbrot set (will be able to do more stuff with Julia set when I get a bit more done)
- Ability to change the number of iterations (the shader model 2 shader is limited to 64, I've assumed this from using the Julia shader in the examples as a reference, lacking loop support. Currently the SM2 shaders are untested on SM2 hardware, but they work on SM3 so I'm assuming all is well for now)
- Ability to change Mandelbrot texture size (64x64 to 409x4096, mostly for future saving ability, default is 512x512)
- Shaders are kept internal to the binary using embedded resources (I'm unsure how well supported this is on Mono and I've not tested under Linux yet).

What I haven't got:
- Ability to zoom (will do this next).
- Saving images to file.
- Using a colourmap in the shaders instead of being stuck with the current stuff.
- Some form of saving/loading of positions/zoom factors.
- Some Julia stuff.

I'll post all the source when I get a bit more done.

Images