iDevGames Forums

Full Version: Creating a water effect
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All,

I'm sure this must have been covered somewhere already. I've implemented a water ripple effect based on the code here (there are similar samples over the web):

http://www.neilwallis.com/java/water.html

The basic algorithm computes a set of ripple heights. These are then used to create a image where the pixels are taken from a source image with an offset applied based on the ripple height.

I've got this running reasonably fast just creating a bitmap in memory and turning that in a CGImage for display using core graphics.

Does anyone have any suggestions on how to go about doing this in OpenGL? Should I keep my current code for generated the distorted image and upload that as a texture for each frame?

I did think that I could draw the image with a bunch of triangles and modifiy the texture coordinates to point to the right bits of the source image - but that sounds like it would be a lot of triangles.

Or is there something cleverer I can do?

Thanks
Chris.
Reference URL's