opengl: refactor renderer creation and destruction