Messing with rendering and textures

So I didn't get it to work 100% but I didn't want to think about math.
Most of what you need is here though.