A simple fractal drawer written in C (C11 revision) using SDL2 & OpenGL 3.3.
Output for:
./fractal -w 640 -h 480 --preset 4 --speed 2.0
Building:
- GNU Compiler Collection (gcc);
- GNU Make (make);
- popt library: CLI flags parsing;
- SDL2: windowing + software rendering;
- POSIX threads (pthreads): concurrent software rendering;
- OpenGL 3.3: hardware rendering;
- GLEW: OpenGL extension loader.
git clone https://github.com/hipparcos/fractal.git
cd fractal
git submodule init
git submodule update
make
./fractal
Multithreaded rendering using pthread is optional. You can disable it when building the application:
make MT=0
To print CLI arguments usage:
./fractal -?
Benchmarks are used to assess rendering strategies for the software renderer. Benchmarks used to show important rendering time differences when short-lived threads were used.
make clean
make benchmark
fractal renders julia and mandelbrot fractals.
escape or q quit
u update display
r reset display
s switch generator
arrows move
p or + max iterations per pixel + 10 (depth)
m or - max iterations per pixel - 10 (depth)
CTRL+`+` zoom+ x1.1
CTRL+`-` zoom- x1.1
click + drag zoom (box)
Middle + drag move
Space pause (dynamic only)
a increase speed
d decrease speed
Usage: fractal [OPTIONS]
-c, --config Set config file (default: "config.toml")
-w, --width=INT Set window width in pixels
-h, --height=INT Set window height in pixels
-z, --zoom=DOUBLE Set zoom factor (density per pixel multiplier)
-t, --translate=DOUBLE Set translation factor (screen size multiplier)
-i, --iter=INT Set max iteration limit
--step=INT Set max iteration (incr|decr)ementation step
-p, --preset=INT Set fractal preset to use (index of presets, from 0)
--speed=DOUBLE Set dynamic fractals rendering speed
-s, --software=0|1 Use software renderer (hardware renderer by default)
Help options:
-?, --help Show this help message
--usage Display brief usage message
- Add a GUI (vurtun/nuklear);
- Make software renderer concurrent (pthread);
- Store presets in a config file (cktan/tomlc99).