Creating a water effect
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.
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.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Wave tips 2d water | chrisevans1001 | 1 | 2,317 |
Dec 9, 2011 04:12 PM Last Post: OneSadCookie |
|
| Water effect | markhula | 9 | 6,979 |
May 10, 2011 12:03 AM Last Post: markhula |
|
| Odd effect on loading a .png with alpha channel. | Madrayken | 4 | 2,678 |
Jul 14, 2009 03:45 PM Last Post: Madrayken |
|
| How do the hell do the water effect in koi pond? | Najdorf | 14 | 7,409 |
Mar 23, 2009 04:21 PM Last Post: aBabyRabbit |
|
| Texture2d rainbow effect on flip | THRESHE | 15 | 6,098 |
Mar 19, 2009 08:33 AM Last Post: AnotherJake |
|

