Detecting failure to open a context

BlitzMax Forums/BlitzMax Programming/Detecting failure to open a context

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

In my lowly iBook, it has support for an OpenGL window as large as you like, even larger than the desktop, but it does not have support for full-screen mode by the hardware. The OpenGL driver is software only and cannot apparently handle proper fullscreen.

When trying to open a screen in full-screen mode, it just simply doesn't open and Max complains about invalid pixel format and some other such. Basically it makes an error because it can't do it.

That's fine. I want to be able to detect when this error occurs, however, so that if my app tries to open a full-screen display and fails, it will automatically try opening in a window. I would also like to sense when window mode fails so I can try opening fullscreen, on platforms that have fullscreen support.

I tried using something like:

Try
Context=CreateGraphics(640,480,32,60,GRAPHICS_BACKBUFFER)
Catch err:Object
Context=CreateGraphics(640,480,0,60,GRAPHICS_BACKBUFFER)
EndTry

But this does not actually catch the exception. The context fails to open and the app exits with the usual error message.

How can I detect this failure to open a context, and still remain in the running app so I can try a different angle?