issue #7 refactoring of opengl stuff