Added guards to detect background OpenGL use