refactor opengl renderer