gl_state_check copypasta for printing opengl state variables. Implemented under an ES 2.0 context so if you're using desktop/core/legacy/whatever then you might have to eliminate some variables.