How To Tell If Fullscreen Will Work With Any Given DisplayMode...

thaeez
Unregistered
 
Post: #1
My app displays a list of full screen modes on startup - when I compile this list, each available display mode (from CGDisplayAvailableModes(display)) is examined and if it matches the desktop bits per pixel and kCGDisplayModeIsSafeForHardware returns YES, I include it in my list of available modes.

The problem is, even though all the modes in the list are 'safeForHardware', some of them give me a black screen (no OpenGL context available for mode). Is there a way to make sure that I can get a full screen OpenGL context with a given display mode?
Thanks in advance,

thaeez
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
No sure way other than to try it, but I'd be surprised if the failure was due to anything but a lack of VRAM or a lack of hardware acceleration in general, so you could probably make an educated guess...

"SafeForHardware" means that it's known not to damage the monitor, I believe.
Quote this message in a reply
Sage
Posts: 1,234
Joined: 2002.10
Post: #3
Give us an example of the mode that is failing, your context creation pixelformat, and your hardware info.
Quote this message in a reply
thaeez
Unregistered
 
Post: #4
The modes that are failing are the 'higher' resolution ones (ie. larger than 1280 * 1024 on my G4 400's). My guess is that it has to do with video card memory, (the higher resolution formats will not load because they require more memory than my video card has to offer). This is OK. I understand that there will be some variability in which macs can support which resolutions at full screen but I can't for the life of me figure out how to programatically (at launch time) determine which modes will be OK and which will not other than by hand selecting resolutions that for sure will work on all macs (ie. 640 * 480, 800 * 600, etc.). There must be an easy way... Right?

thaeez
Quote this message in a reply
Sage
Posts: 1,234
Joined: 2002.10
Post: #5
Try calculating the VRAM requirements for your framebuffer. If you're not using FSAA it is pretty straightforwards:
(colorsize + depthsize + stencilsize + accumsize) * width * height * number_of_buffers

Note that colorsize, depthsize etc might not be the values you ask for in your pixel format. They always are cast to some value that the hardware actually supports, for example no ATI/nvidia hardware renderer supports a 24bpp color buffer, you will always get 32bpp.

Then compare with the amount of VRAM available on the card driving the display you're trying to go fullscreen on. You can get the VRAM with CGLDescribeRenderer(rend, i, kCGLRPVideoMemory, &value);

That only works if you're capturing the display, though. Otherwise you don't own all of the VRAM; the window manager keeps the front framebuffer in addition to your context. Also, if you have multiple displays connected the VRAM is split among them, so you have to divide by the number of displays attached to the card.

Also, it's best to be conservative in your compare, because if the framebuffer just barely fits in VRAM, you won't have any space for textures/display lists etc and performance will be really bad due to AGP thrashing.
Quote this message in a reply
Post Reply