Re: [AD] multiple windows |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: Coordination of admins/developers of the game programming library Allegro <alleg-developers@xxxxxxxxxx>
- Subject: Re: [AD] multiple windows
- From: Elias Pschernig <elias@xxxxxxxxxx>
- Date: Mon, 21 Aug 2006 13:03:21 +0200
On Mon, 2006-08-21 at 11:38 +0100, Peter Hull wrote:
> In Quartz, on OS X, the equivalent of a BITMAP is NSImage. NSImage
> isn't an image; it's just a container for 'representations,' which are
> the actual bitmaps. The idea is that the OS picks the best rep for the
> job, and automatically adds its own cached representations (e.g. it
> can rasterise a PDF). We'd have to do something like that, which would
> be in the spirit of our 'it just works' philosophy, but I guess it
> would not be fast.
Yes. I think the better approach is when an AL_BITMAP would simply be a
thin wrapper around NSImage in that case, or e.g. in the GLX case it
would be nothing more than an OpenGL texture id.
> Anyway, most games as far as I know do not have multiple windows, so
> the user would not be burdened too much.
Yeah, so lets not add a lot of cruft into Allegro for this. As Bob said,
a higher level library like OpenLayer can do this just as easy - as long
as we have a way to expose all needed information.
> In the implementation, we could assign an unique integer ID to each
> _incompatible_ OpenGL context (I think there is a way on Macs to
> determine whether two contexts can share texture names etc, is this
> generally available?) and check that the bitmap's ID matched. I assume
> this would be a benefit in the most common case which is multiple
> windows with the same pixel format. If it doesn't match, would the
> blit fail or just work non-accelerated?
Not sure. Maybe this can be a global config variable, something like:
set_config_int("/allegro/blit/auto_convert", 1);
And that would mean blit() automatically will do (slow) conversion to a
temporary memory bitmap.
> Finally we'd need something like
> BITMAP* create_compatible_bitmap(DISPLAY*, BITMAP*)
> which would copy a bitmap but in a form suitable for accelerated
> blitting on that display.
>
Yes, and also a function in the other direction, so maybe:
BITMAP* from_compatible_bitmap(DISPLAY*, BITMAP*)
BITMAP* to_compatible_bitmap(DISPLAY*, BITMAP*)
The first one returns an AL_BITMAP to be used on the display (or
compatible ones) only (it is just an NSImage/OpenGL texure), and the
second will take such an AL_BITMAP and always return a "memory bitmap",
i.e. a bitmap in one of Allegro's platform independent formats (such as
AL_RGB_8_8_8_8 or AL_FLOAT_32_32_32_32), residing in standard memory.
--
Elias Pschernig