All textures must be stored somewhere, and several copies may be stored in several places (e.g. the host memory or memory onboard the graphics card). Sh abstracts this by providing an ShMemory class. Such a class only represents memory, it is connected to other objects (ShStorages) that take care of where the memory is stored. The system automatically keeps track of how up-to-date each storage is, and only transfers memory from one storage to another if necessary. Setting up a texture that shares memory with another texture is as simple as writing texture2.memory(texture1.memory());. Sh also provides an ShImage class that can be used to load PNG image files and then attach the image’s memory to a texture. For example:
Like most objects in Sh, memory is reference counted, and so it will stay around as long as the texture is used in an existing shader, even if the instance of the ShImage class used to load the image goes away.
Note: This manual is available as a bound book from AK Peters, including better formatting, in-depth examples, and about 200 pages not available on-line.