Detect if OpenGL is present/works?

BlitzMax Forums/BlitzMax Beginners Area/Detect if OpenGL is present/works?

Hi, If I'm running a game in DirectX mode and I want to change to OpenGL mode, I'll call EndGraphics, then SetGraphicsDriver GLMax2DDriver() before calling Graphics. However, what happens if the PC doesn't have the correct OpenGL drivers or it fails etc? What is the cleanest way to detect a failure, so that maybe I can show a "Failed" message and go back to DirectX mode?

Many thanks in advance for any advice.