Re: [AD] Missing system vtable entries on OS X

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


(sent again)
On 28 Jan 2010, at 11:49 , Elias Pschernig wrote:
> Well, most games will want something like a settings screen where you
> can select the monitor resolution and amount of super-sampling and so on
> - in our current API the way to do that is to first get a list of the
> available formats with al_get_num_display_formats() then check whether
> it's a usable mode with al_get_display_format_option().

Ok, see, that's where I get confused.
I don't know what any of the other ports do because I only ever use the OS X port, so all I have to go on is the documentation and the OS X port itself. It's quite possible that either one of those is wrong or incomplete and if so I need someone else to tell me.
So, first of all there is al_get_num_display_modes()/al_get_display_mode() and then there is al_get_num_display_formats()/al_get_display_format().
The first of these, on OS X, gives all available resolutions and all available colour depths for those resolutions. The output of ex_monitorinfo, which calls those functions, on my laptop right now is
1 adapters found...
Adapter 0: (0, 0) - (1280, 800)
  Available fullscreen display modes:
  Mode   0: 1280 x  800, 0 Hz
  Mode   1: 1280 x  800, 0 Hz
  Mode   2: 1280 x  800, 0 Hz
  Mode   3: 1152 x  720, 0 Hz
  Mode   4: 1152 x  720, 0 Hz
  Mode   5: 1152 x  720, 0 Hz
  Mode   6: 1024 x  768, 0 Hz
  Mode   7: 1024 x  768, 0 Hz
  Mode   8: 1024 x  768, 0 Hz
  Mode   9: 1024 x  768, 0 Hz
  Mode  10: 1024 x  768, 0 Hz
  Mode  11: 1024 x  768, 0 Hz
  Mode  12: 1024 x  640, 0 Hz
  Mode  13: 1024 x  640, 0 Hz
  Mode  14: 1024 x  640, 0 Hz
  Mode  15:  800 x  600, 0 Hz
  Mode  16:  800 x  600, 0 Hz
  Mode  17:  800 x  600, 0 Hz
  Mode  18:  800 x  600, 0 Hz
  Mode  19:  800 x  600, 0 Hz
  Mode  20:  800 x  600, 0 Hz
  Mode  21:  800 x  500, 0 Hz
  Mode  22:  800 x  500, 0 Hz
  Mode  23:  800 x  500, 0 Hz
  Mode  24:  640 x  480, 0 Hz
  Mode  25:  640 x  480, 0 Hz
  Mode  26:  640 x  480, 0 Hz
  Mode  27:  640 x  480, 0 Hz
  Mode  28:  640 x  480, 0 Hz
  Mode  29:  640 x  480, 0 Hz
  Mode  30:  720 x  480, 0 Hz
  Mode  31:  720 x  480, 0 Hz
  Mode  32:  720 x  480, 0 Hz
  Mode  33:  720 x  480, 0 Hz
  Mode  34:  720 x  480, 0 Hz
  Mode  35:  720 x  480, 0 Hz

See the attached allegro.log for information that is not shown by the example (colour depth, for instance, although there are only 3 of those so I don't know why 30-35 all look identical; there must be some other difference but I don't know what it is).
Then there's al_get_display_format(), which if I understand correctly should return a list of pixel attributes that is supported by the system.
As I said, on OS X, you cannot ask for the full list of valid combinations of pixel attributes, probably because you don't have to: the system will try to match what you ask and do the best it can if it can't give you exactly what you ask for.
You can ask what displays a particular combination is compatible with (eg http://developer.apple.com/mac/library/documentation/GraphicsImaging/Reference/CGL_OpenGL/Reference/reference.html#//apple_ref/c/func/CGLChoosePixelFormat) and you can ask what the current settings are (http://developer.apple.com/mac/library/documentation/cocoa/Reference/ApplicationKit/Classes/NSOpenGLPixelFormat_Class/Reference/Reference.html#//apple_ref/occ/instm/NSOpenGLPixelFormat/getValues:forAttribute:forVirtualScreen:), but you cannot ask for a list of supported combinations (again, unless I'm missing the function in which case someone will have to point it out to me).
In terms of configuration screens, the user can input a value for the amount of super sampling and you can check whether that will work (or be silently ignored when you try to set it), but you cannot ask for a list of possibilities.

So anyway, question: does al_get_display_mode() work as intended here? I get the impression from what you said that perhaps it doesn't.

> If you say those two functions can't work in OSX, then there's no point
> having them in A5 and we should replace them with an alternative which
> works. I haven't looked at the code yet, but from what you said can we
> maybe do something like this?
> 
> n = al_can_create_display(w, h)
> 
> And it would work just like al_create_display (using all the flags which
> were set), but instead of trying to create a display just return how
> many possible formats there are (OSX could always return 1). After that
> al_get_display_format_option() could be used to query the actual values.

That would probably work, but I'm not sure I see the advantage to doing things that way.
I think it probably makes things more awkward on other platforms right now and I still don't think it makes all that much sense to do on OS X.
So I still think the easiest thing to do is to document that you may not be able to query before hand what pixelformats are available on any given system. If you ask for the information and it's there, great. If not, you can still try setting a pixel format and check afterwards what you end up with.

Anyway, maybe the first thing to check is that my understanding of what these different functions should do is right.

Evert

Attachment: allegro.log.gz
Description: GNU Zip compressed data



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/