Re: [AD] al_get_num_display_modes and al_get_display_mode

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


On Tue, 2009-03-17 at 09:44 -0600, Trent Gamblin wrote:
> On Tue, March 17, 2009 9:27 am, Elias Pschernig said:
> >> the user sets up his desired graphics mode entirely first and I'm not sure it will work even then. I suggest we
> >> remove
> >> the dependancy on certain formats, refresh rates, and flags, and simply return _all_ of the available fullscreen
> >> display modes allowed. The ALLEGRO_DISPLAY_MODE structure would be unchanged, I think.
> >
> > What would the "format" field in ALLEGRO_DISPLAY_MODE be used for then?
> 
> If it's possible with OpenGL, it would return the backbuffer format for a given mode.

So then the user would have to extract R/G/B sizes from that and
construct calls to al_set_new_display_option? And how would it work with
windowed modes?

I think we should remove the pixel format.

Then later we could introduce new functions:

int al_get_num_pixel_formats()
al_get_pixel_format(int i, ALLEGRO_PIXEL_FORMAT *format_info)
al_set_new_display_pixel_format(int i)

How you would use them in your game:

int width = config.width
int height = config.height

if (want_fullscreen) {
   ALLEGRO_DISPLAY_MODE mode;
   for (int i = 0; i < al_get_num_display_modes(); i++) {
      al_get_display_mode(i, &mode);
   }
   al_set_new_display_refresh_rate(mode.refresh_rate)
}

for (int i = 0; i < al_get_num_pixel_formats(); i++) {
   ALLEGRO_PIXEL_FORMAT format;
   al_get_pixel_format(i, &format);
}
al_set_new_display_pixel_format(i);

al_create_display(width, height)

Basically, right now, al_get_display_mode is limited to fullscreen
modes. However, any pixel format selection is just as relevant if you
use windowed mode. So we clearly need something better.

With the above, fullscreen modes and pixel formats would be two separate
things. ALLEGRO_PIXEL_FORMAT in the case of GLX would wrap around GLX
visuals, that is, each visual would correspond to an
ALLEGRO_PIXEL_FORMAT, and we would expose as much information as
possible to users. That way, if they care, they can do their own
selection of the best video mode. Else they can just use
al_set_new_display_option() or even better just use the default mode.

-- 
Elias Pschernig <elias@xxxxxxxxxx>





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