added function to do instancing

Nothing complicated just some functions to do instance rendering. It is currently used by my code.