Drawing a reflective and refractive geometry using cubemaps
In real-life, transparent objects both transmit light rays, and also reflect them. If an object's surface is viewed from high angles, we see more light being reflected. Looking at an object's surface more directly, we see more light being transmitted through the object. Simulating such an effect may generate very plausible results. In this recipe, we will see how to render a geometry that is both refractive and reflective.
An example of an image generated with this recipe looks like:

Getting ready
Cubemaps are textures with images covering six sides of a cube. They usually store the view of a scene from a given position. The most common use for cubemaps are skyboxes. They are also handy when we want to map reflections on a surface of a given model. Another example of common use is to simulate transparent objects (that is made of glass), which refract light rays. Very low resolution cubemaps (in example 4x4 pixels) can even be used...