Perhaps there is a library, I could not find it. However, Patrick Murris has created a terrain viewer that uses the DEM file to enhance the terrain, you can download the source here: http://www.alpix.com/3d/TerrainViewer/
I did not check the quality of its code, but perhaps it is useful to you.
source share