20c75c05e70e9ed2d4dff847aea4e9262d92fb33
[mandelwow.git] / README.md
1 # MandelWow
2
3 ## Overview
4
5 MandelWow is a generalized version of Mandelbrot & Julia in which both C and Z0 vary in a 4-dimensional space.
6 On each frame we render a 3D slice of the MandelWow, varying the remaining dimension through time.
7
8 I wrote this demo to learn Rust & basic GLSL. Mind the mess.
9
10
11 ## Requirements
12
13 The native binary requires OpenGL 3.1. Should perform well on reasonably modern
14 hardware. Tested on:
15
16  * Linux with NVidia GTX 970 (Mesa 17.1 Nouveau driver)
17  * Linux with Intel HD Graphics 4000 (Ivy Bridge)
18  * Windows 10 with NVidia GTX 970
19  * The asmjs and WebAssembly build works on Chromium 57 and Firefox 53
20
21 ## Building from source
22
23 ### Linux
24
25 Install cargo (either your distro's packaged version or via rustup), then go to the source root and type:
26
27 ```
28 cd mandelwow
29 git submodule init
30 git submodule update
31 cargo run --release
32 ```
33
34 ### Windows
35
36 Mandelwow depends on [libxm](https://github.com/nukep/libxm-rs) and [SDL2](https://github.com/AngryLawyer/rust-sdl2) for sound.
37 Both are tricky to build using Rust's MSVC toolchain because they assume GCC, so I recommend using the GNU toolchain instead.
38 I followed these steps to build a native Windows binary:
39
40 * Install Cargo via [rustup](https://www.rustup.rs).
41 * Install mingw-w64. The [MSYS2](http://www.msys2.org/) installer provides the basic shell environment and the package manager.
42 * From the MSYS2 console, install the W64 native toolchain and libSDL2:
43   ```
44   pacman -Sy
45   pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2
46   ```
47 * While you're at it, you may also want to install the git package: `pacman -S git`
48 * I had to manually add the mingw-w64 toolchain to your path:
49   ```
50   export PATH="/mingw64/bin:$PATH"
51   export LIBRARY_PATH=/mingw64/lib
52   ```
53 * In case `cargo` and `rustup` aren't in the shell path, add `$USERPROFILE/.cargo/bin` too.
54 * Next, install the Rust toolchain targeting GCC:
55   ```
56   rustup toolchain install stable-x86_64-pc-windows-gnu
57   rustup default stable-x86_64-pc-windows-gnu
58   ```
59 * Now you can proceed to mandelwow's source tree and build a native Windows binary without further hassles:
60   ```
61   cargo run --release
62   ```
63
64 ### WebAssembly / asm.js
65
66 Install emsdk:
67
68 ```
69 cd ~
70 curl -O https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz
71 tar xf emsdk-portable.tar.gz
72 source emsdk-portable/emsdk_env.sh
73 emsdk install emscripten-1.37.9 --build=MinSizeRel
74 emsdk activate emscripten-1.37.9 --build=MinSizeRel
75 ```
76
77 Install rustc:
78
79 ```
80 cd ~
81 curl https://sh.rustup.rs -sSf | sh
82 source ~/.cargo/env
83 rustup toolchain install nightly
84 rustup default nightly
85 rustup target install asmjs-unknown-emscripten
86 rustup target install wasm32-unknown-emscripten
87 ```
88
89 Build and run mandelwow:
90
91 ```
92 cd mandelwow
93 ./release_asmjs.sh
94 ```
95
96 Build the WebAssembly binary:
97
98 ```
99 cd mandelwow
100 ./release_wasm.sh
101 ```
102
103 ## License
104
105 This project is GPL 3.0.
106 The support/ directory contains some code forked from Glium, which was originally Apache 2.0.