st/gui: Refactor a few OpenGL drawing code into helper.