GL cleanup and optimizations.

Optimizes GL emulation layer to avoid last detected duplicate redundant calls to GL. Cleans up GL library a bit by using 'GLImmediate' and 'GLctx' global names instead of routing though GL. and Module.

Still has a minor cleanup pending for used #ifdef macros, which needs #1969. A few places would like to use #if defined(FULL_ES2) || defined(LEGACY_GL_EMULATION) but the code had to duplicate that since the support for that isn't present.