More robust OpenGL version fetching.

I stole code from ekmett/quine.