- Zhang Qiuyi, 12330402
- Kuang Jiahao, 12330152
- Li Jianhua, 12330165
- freeglut (local library, included in the project)
- FreeImage (local library, included in the project)
- OpenGL and GLU
A fountain built with OpenGL fixed piepline.
Note: this can look quite different on different machines:
- The computational power(or, the optimization performed by the compiler) will affect the frame rate, therefore affect the speed of the fountain water. If your computer is powerful enough, the frame rate will be around 58fps.
- The resolution of the screen will affect the overall experience, including font size, texture, and the size of water particles.
Under normal resolution, it looks like this:
Under HiDPI, it looks like this:
- First person camera(see "Operation" below for information about the keyboard controls)
- Texture(basin, ground, skybox)
- Lighting(two-side)
- Skybox
- Simulated water(particles)
- Simulated waves(oscillators)
- Display list(skybox, ground, fountain basin)
- Fonts and text(there is a frame rate counter at the bottom left)
- The water is just semi-transparent particles(points) moving along calculated parabolas.
- The waves are simulated by oscillators. They change the vertices of the pool and update the normals accordingly to create ripples. The position of these oscillatiors are affected by their neighbors, and the oscillators on the edge will always have a constant
y
. Therefore the waves will bounce back when they reach the edge.
Look closer and take a screenshot, then you will know what is going on. For more information, checkout Fountain.cpp
and Pool.cpp
and read the comments.
To lower down the burden on the CPU, the preset shapes are rather simple(with not many rays per level or drops per ray). If you want to see some fancier shapes, you can go tweak the initializers in main.cpp
.
- 1 - 8: Change the shape of the fountain
- f: Toggle fullscreen mode
- c: Toggle mouse mode
- ESC: exit
- →, ←: Turn camera right / left
- ↑, ↓: Move camera forward / backword
- r, v: Turn camera up / down
- w, s: Move camera up / down
- a, d: Move camera left / right
- Mouse move: Rotate camera
- Mouse scroll: tMove forward / backward
- doc // report goes here
- include // header files
- lib // static libraries
- resource // e.g. textures
- src // source code
- screenshot // screenshots
// dynamic library for the prebuilt executable
- freeglut.dll
- FreeImage.dll
- libstdc++-6.dll
- libgcc_s_dw2-1.dll
- Fountain.sln // VS2013 project file
- Fountain.exe // prebuilt executable
- premake5.lua // premake5 script
// preview of this demo
- normal-preview.jpg
- hidpi-preview.jpg
- README.md // you are reading it :)
The executable is built for Windows with MinGW, the necessary libraries are all bundled inside this project. Just run Fountain.exe
to see it at work.
If you want to run it under Linux, you need to build it from source.
You can build it with VS2013 and above, Make and MinGW(or just Make and g++
under Linux), or anything that premake5 supports and has some C++11
support(VS2010 or above should do the trick).
This has been tested under:
- Windows 8.1 + VS2013
- Windows 8.1 + MinGW(
g++
(GCC) 4.8.1) + GNU Make 3.81(Win32 port) - Ubuntu 14.04 +
g++
4.8.2 + GNU Make 3.81
If you are using Windows, you don't need to copy any file to any location. All libraries files(.h, .lib and .dll) are locally included. Note that it is the libraries under include
and lib
that will actually get linked, not your global libraries.
Open the Fountain.sln
with VS and build the Fountain
target. The executable will appear under the project directory, named Fountain.exe
.
Download premake5 from here, extract the executable in the archive(e.g. premake5.exe
), and put the path to the executable in your PATH
environment variables. Then open cmd and run premake5 --help
to see what project files you can generate. I've written the premake script premake5.lua
to generate the proper project files.
For example, to generate the project files for VS2012, simply run premake5 vs2012
under the project directory, then open Fountain.sln
with your VS and build the Fountain
target. The executable will appear under the project directory, named Fountain.exe
.
You need to install freeglut and FreeImage first. For example, if you are using Ubuntu, run
$ sudo apt-get install build-essential freeglut3 freeglut3-dev binutils-gold
$ sudo apt-get install libfreeimage3 libfreeimage-dev
Download premake5 from here, extract the executable in the archive(e.g. premake5
), and put the path to the executable in your PATH
environment variables(e.g. extract the file to /usr/local/bin
with root permission so you don't have to touch PATH
). To generate the project files for make, simply run premake5 gmake
, then run make
to build it. The executable will appear under the project directory, named Fountain
.