Better handling of rendering texture resolution.
Comments and some cleanup.
Added some transfer functions.