Description: The project is to simulate the water ripple effects. It used the OpenGL buffer technique. It used 2 arrays of words. ...
Description: The project is to simulate the water ripple effects. It used the OpenGL buffer technique.
It used 2 arrays of words. These arrays will hold the state of the water. One holds the current state, the other holds the state from the previous frame. It is important that to have 2 arrays, since it need to know how the water has changed since the last frame, and the frame before that.
The height of the wave two frames is proportional to the size of the arrows. So as long as the previous two frames are remembered, it is easy to work out the change in height of every part of the wave.
So, take a look at the code again. When the loop starts, Buffer1 contains the state of the water from the previous frame and Buffer2 has the state before that . Buffer2 therefore has information about the vertical velocity of the wave.
USAGES: Space-bar : To drops the ripples of water for effect.
m: Exit full screen mode
f: Full screen mode.
x: Exit program.
Project Code: Download