Trying to write simple game engine using opengl