How to detect if fullscreen is possible?

BlitzMax Forums/OpenGL Module/How to detect if fullscreen is possible?

ImaginaryHuman(Posted 2006) [#1]
I am making an OpenGL-based game and am using GLGraphics() to open a window or screen. On some computers, for example the older ibooks, their OpenGL drivers does not support full-screen mode. It also only has a software renderer (no hardware acceleration).

I need to detect when full-screen mode is not available, so that I don't try to open it, or having tried to open it, I detect that it failed and take action to open a window.

The problem is finding a way to detect if full-screen is supported. If the OpenGL driver does not support full-screen mode, when you try to open a full-screen context it creates an exception and the Max application crashes out. I have tried using Try/Catch to trap the exception but it did not prevent the crash.

How can I detect if full-screen is available so that I can either avoid trying to open it or come back from attempting to open it without crashing?

One idea I had was to try opening full-screen and if it fails then open a window, but as I said it makes an exception that I couldn't trap.

Another idea was to find how much video memory there is and find out the highest screen mode and then compute how much memory that mode takes, and if it would not be possible to open a double-buffered full-screen within the amount of video memory available, assume that the driver won't allow full-screen mode and then take action. However, there is no way to get the video ram availability. There is an OpenGL thing called proxy textures, which tells you if there would be enough space to store a texture of a given size, so maybe I could use that to create a dummy double-buffered-screen-size texture and see if there is enough memory, and if not assume it won't allow fullscreen? I'm not sure if that would work, the manual said something about it would return different values if other textures were already loaded or something.

Any advice/ideas how I can get around this and safely only open fullscreen when it's supported?


ImaginaryHuman(Posted 2006) [#2]
I found that trying to get the maximum texture size with the proxy call or by quering the maximum allowed texture size, doesn't work because even if you only have 4MB graphics mem like I do, it will let you have textures that take up more memory than the video mem - because it puts them in main memory due to being a software driver. So even if it supports 4096x4096 which is 16 megs of data, it allows it rather than saying it wont fit in video ram. Maybe the proxy texture would tell you if there's enough mem to store a given texture size, but then your query has to be a power of 2 which would not be accurate.

Any other solutions?

Would be nice if BRL added a command to return the video mem amount or to query stuff from the graphics driver, such as if fullscreen is supported