Refactoring of openGL display