Normal mapping (also known as Bump Mapping) is a texture mapping technique used for faking the lighting of bumps and dents. It is used to add details without using more polygons. A common use of this technique is to greatly enhance the appearance and details of a low polygon model by generating a normal map from a high polygon model or height map. Normal maps are commonly stored as regular RGB images where the RGB components correspond to the X, Y, and Z coordinates, respectively, of the surface normal (more details about this technique here).
The following example was based on the code available in here.
Open in a new tabYou must use at least two 2D textures, one for the color (diffuse) map and the other to store the per-fragment normals derived from the shape of the surface as showed above. More details about the generation of the per-fragment normals are available here.