Manual merge of OpenGL detection code, untested