A Mandelbrot set pan/zoom application powered via SDL2, CUDA, OpenGL (via GLEW and GLM) and ImGUI.
Requires Cmake
Tested to work with Visual Studio 2017 both Community & Enterprise editions with the CMake extras installed.
Originally derived from https://trenki2.github.io/blog/2017/06/02/using-sdl2-with-cmake/ (Thanks!)
Cmake now downloads SDL2, GLEW, GLM and IMGUI, so Visual Studio CMake build & Project build and you should be good.
You'll need a more recent version of cmake than Ubuntu 16.04 comes with. Google for how to install that.
sudo apt-get install cmake libsdl2-dev libglew-dev
then
mkdir Debug
cd Debug
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
or
mkdir Release
cd Release
cmake -DCMAKE_BUILD_TYPE=Release ..
make
An NVIDIA graphics card is required. If you have a laptop with hybrid graphics, use the NVIDIA Control Panel's Manage 3D Settings panel and Program Settings tab to make Java choose the "High-performance NVIDIA processor".
Making the window smaller will speed up the calculations.
options:
-d N - select cuda device number N. (default = 0)
-p PATH - path to shaders & compute kernel. (default = '.')
-h - this message.
To avoid setting commandline options, run this from the source directory like ./Release/smandelbrotr
Left click to pan. Middle scroll wheel to zoom.
- ESC: quit
- TAB: show/hide information window
- d/s: (d)ouble or (s)ingle floating point precision math. Single is default. It is faster & less precise.
- f: switch to/from (f)ullscreen.
- enter: begin zoom out mode. animates un-zooming.
- 1/2/3/4: allow for N times 256 levels for determining whether in/out of mandelbrot set.
- p: (p)rint out some state.
- w: (w)rite out current screen to "save.bmp" -- careful, it will overwrite existing files.
Enjoy the old-school keyboard shortcuts and lack of a real GUI, it builds character.
Since I cobbled this code together basically by stringing existing example code together, I'll be giving this back to the community.
To the extent possible under law,
Roger Allen
has waived all copyright and related or neighboring rights to
SMandelbrotr.
This work is published from:
United States.