"I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone."
- Bjarne Stroustrup

Framework 4 (Last updated: October 25, 2019)
Framework 3 (Last updated: February 6, 2017)
Framework 2 (Last updated: October 8, 2006)
Framework (Last updated: October 8, 2006)
Libraries (Last updated: September 16, 2004)
Really old framework (Last updated: September 16, 2004)
Refractions and reflections
Thursday, April 11, 2002 | Permalink

Executable
Source code
Refraction2.zip (990 KB)

Required:
GL_ATI_fragment_shader
GL_ARB_texture_env_dot3
GL_ARB_texture_env_crossbar or GL_NV_texture_env_combine4
GL_EXT_texture3D
GL_EXT_texture_edge_clamp
GL_SGIS_generate_mipmap
WGL_ARB_render_texture

Recommended:
GL_ARB_texture_compression
GL_EXT_texture_compression_s3tc
This is a demo of a pretty realistic water surface. The waves are created dynamically by generating a texture with some perlin noise. The refraction is done by rendering the scene to a texture and then the wave texture is used to perturb the texture coordinates on a per pixel level in a fragment shader. Similarily for the reflections, except that they are rendered to the texture with y inverted. Finally, it's combining the refraction and reflection by interpolating between them depending on the view angle.

It'll only run on Radeon 8500 card right now.

2002-05-31:
Updated to run on drivers later than 6071. A driver bug was fixed that exposed a bug in this application, which I have now fixed. It won't run on older drivers anymore though.