given up on textures for now and implemented simple nearest neighbours instead so I can move on and have a running system again
Fixed a whole bunch of memory leaks