Overhauled build files and moved functions to opengl.{c,h}