C++17 In Detail

31 January 2014

Simple Water Simulation

See my new website at cppstories.com

Simple water simulation
Finally I have managed to publish my awesome water simulation! I know that I wrote about my intentions to publish the project some time ago but as usually there was no enough time :)
The code is quite old and was ready something like 2 years ago. As usually I wanted to polish it and thanks to that it was blocked for too long period of time. This post only introduces the project features and gives general description.


  • Water simulation done on the GPU - shaders
  • Height map based
  • Normal mapping with Phong Shading
  • Uses GPU timer queries
  • OpenGL 4.2 Core
  • FreeGLUT + SOIL + AntTweakBar + my framework
Basic flow of the animation is below:
water simulation flow

As you can see the whole process consists of updating the height map data (using double buffering) then calculating the normal map. The result is applied onto a quad (only four vertex) using normal mapping and Phong shading.

Code and Repo

Application is based on my simple framework, and whole thing can be found at


Simple Water screen 0

Simple Water screen 1

Simple Water screen 2


This is actually my first video on YouTube! :)

Todo & Ideas

  • Improve camera and add more controls/view options.
  • Add environment!
  • Reflection and refraction.
  • Surface rendering with tessellation

Links and Resources

If you want to get additional C++ resources, exlusive articles, early access content, private Discord server and weekly curated news, check out my Patreon website: (see all benefits):

© 2017, Bartlomiej Filipek, Blogger platform
Disclaimer: Any opinions expressed herein are in no way representative of those of my employers. All data and information provided on this site is for informational purposes only. I try to write complete and accurate articles, but the web-site will not be liable for any errors, omissions, or delays in this information or any losses, injuries, or damages arising from its display or use.
This site contains ads or referral links, which provide me with a commission. Thank you for your understanding.