Overview
A graphical C program that renders the Mandelbrot and Julia sets interactively, using MiniLibX only for window creation and input events. All fractal math, zooming, panning, and coloring is implemented directly in program logic rather than relying on a graphics library's built-ins. The program supports both macOS and Linux by bundling platform-specific MiniLibX backends.
Architecture
The code is organized by responsibility: argument parsing and validation select the fractal type and, for Julia, the complex seed; a shared iteration module implements the escape-time algorithm used by both fractals; a color module maps iteration counts to pixel colors; a render module draws the resulting frame; and an event-hook module wires up MiniLibX input (mouse scroll, keyboard, clicks) to trigger recomputation and redraw. A custom libftprintf utility library is used for formatted output.
Key Features
- Mandelbrot and Julia set rendering from a shared iteration engine
- Smooth real-time zooming via mouse scroll or +/- keys
- Adjustable Julia seed values passed as command-line arguments
- Mouse-click reset back to the initial view
- Cross-platform support for Linux (X11) and macOS via bundled MiniLibX backends
Technical Challenges
- Keeping zooming and panning responsive by recomputing only what's needed rather than the whole image on every frame, since the escape-time calculation is inherently per-pixel and CPU-bound
- Supporting both Linux and macOS from the same codebase, given their different MiniLibX implementations, X11-based on Linux versus OpenGL-based on macOS
Engineering Decisions
- Shared a single iteration function between the Mandelbrot and Julia renderers, since both are the same escape-time algorithm with a different starting condition, instead of duplicating the math
- Kept MiniLibX strictly to window and event handling and did all rendering logic in program code, to stay in control of performance and correctness rather than relying on library internals
Technologies Used
C with MiniLibX for windowing and event handling on both Linux (X11) and macOS, plus a custom libft-style printf implementation for output.
Lessons Learned
- Practiced translating a mathematical algorithm, complex-plane escape-time iteration, into an efficient, interactive rendering loop
- Gained experience handling low-level input events directly through a C graphics library
- Learned to write portable C across two different graphics backends behind the same interface