6

I found this vid: http://www.youtube.com/watch?v=eVi6ThY3LRs I wonder if that's some kind of standard effect of openGLES. I'm pretty sure it is, since I have seen this pretty often. KoiPond uses it, DuckDuckDuck uses it. A lot of games use it. They're not all astronauts. They're normal programmers ;) So how is this done? Is there any tutorial for this on the web?

Thanks
  • 40,109
  • 71
  • 208
  • 322

3 Answers3

7

For an old example have a look at the 'distort' example. Note that this is a thing created back in 1992 (just looked in distort.c).

Awesome program that causes ripples in the image wherever the mouse button is pressed. Another mode of the program acts like a sheet of rubber and can be pulled by dragging the mouse.

I managed to compile the example on my mac.

  • Rename all #include <GL/glut.h> to #include <GLUT/glut.h>
  • Add a usleep(33*1000); in the idle() function
  • Rename the file ripple_precalc.c to ripple_precalc.c.org (or just rm it)
  • Compile with "cc *.c -framework GLUT -framework OpenGL" will create an a.out
Peter O.
  • 32,158
  • 14
  • 82
  • 96
epatel
  • 45,805
  • 17
  • 110
  • 144
  • Thanks, I'll try that. Could you see if it makes use of things that are not supported in openGLES? – Thanks Apr 07 '09 at 20:35
  • I think it's basically as JeeBee describes, a mesh covered with a texture and the mesh vertices are moved with some math, I'd guess some spring dynamics. Note that you'll need to convert the code to remove glBegin()/glEnd() calls... – epatel Apr 07 '09 at 21:04
2

(off the top of my head) Maybe a mesh distortion where the texture is pinned to the vertices and hence appears to ripple as the mesh vertices are moved? By moving a set of vertex displacements around the mesh you could make a uniform ripple like a wavefront...

JeeBee
  • 17,476
  • 5
  • 50
  • 60
1

JeeBee has it right. You can base your code off this tutorial:

http://www.gamedev.net/reference/articles/article915.asp

user90950
  • 51
  • 2