add basic tgui ui elements
merge bugfixes
rearrange main loop to fix GL_INVALID_OPERATION