Better support for resource management in Texture class