[GL] Allow others to register GL contexts.

This makes it so that other users of emscripten can register a
context without having to copy/paste this body of code.
Merge pull request #3019 from waywardmonkeys/gl-changes

[GL] Allow others to register GL contexts.