Animating 2D water tiles

I’m animating water tiles in Java. My code takes a 32x32 tile and makes it move across the screen. It relies heavily on the REPEAT function.

I’d show an example but the ‘insert image’ button seems to think every png, gif or jpg I give it is an invalid image file. Every file from the internet is also somehow too large…:confused:

What can I do with tiles other than making them repeat endlessly?
How can I blend two textures?
What is some good reference material to read that will tell me more about using OpenGL to animate water tiles?
Does anyone have any source code examples that might show me more ways I can animate water tiles?

I look forward to someone helping me get started in OpenGL! I am an OpenGL baby :o

You may be running into limitations which are imposed upon new accounts in order to mitigate spam. But aside from that, the “insert image” feature hasn’t been particularly reliable lately, and the image size limits are rather small IMO.

Use multiple tiles with different grid resolutions and orientations.

  • Multiple passes with blending (glEnable(GL_BLEND), glBlendFunc(), etc).
  • Multitexturing (glTexEnv() with a mode of GL_COMBINE)
  • Blend multiple textures in the fragment shader.

I wouldn’t recommend the second option. Compared to the third, it’s less flexible, harder to use, and information is harder to come by.

This paper and these slides describe using the inverse FFT to efficiently sum around a million sinusoidal waves of varying frequencies and phases to generate plausible ocean waves. Another set of slides covering the same technique can be found here. However, this is a relatively advanced technique.

This is, hands down, the most useful reply I have ever received from anyone on the internet, for anything. This paper is excellent- it never would have occurred to me to even search for something like this.