[ 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] OpenGL
- From: Evert Glebbeek <eglebbk@xxxxxxxxxx>
- Date: Tue, 25 Jul 2006 14:03:22 +0200
- Organization: SIU
On Tuesday 25 July 2006 13:44, Elias Pschernig wrote:
> Does it seam feasible to somehow merge in all of AllegroGL, just so we
> have working OpenGL again in 4.3, and then worry about refining this to
> a new graphics driver structure later?
>
> Or is it maybe better to start a clean OpenGL driver from scratch?
>
> The former probably would be rather messy, but once it compiles, would
> mean we get all the features already in AllegroGL. The latter means,
> we'd initially start with only a minimal implementation, and then would
> need to add the required features again step by step (probably peeking
> at the AllegroGL code).
What I would prefer in terms of the graphics drivers is to change the existing
vtables now and adapt the code to use the new drivers.
The real problem I had with that (which I brought up before and was discussed,
without reaching some final consensus) is that right now, changing the
graphics drivers will break all other drivers on all other platforms. Now
maybe we should just Not Care and allow things to break and then fix them
later.
> What I expect in the end is, that I simply can do:
>
> display = al_create_display(640, 480, AL_AUTODETECT, AL_OPENGL);
> glClearColor(0, 0, 1, 1);
> glClear();
> al_flip_display(display);
I would hide any refence to OpenGL and use a dummy `bitmap':
display = al_create_display(..., AL_ACCELERATED, ...);
bmp = al_get_buffer(display);
al_clear_bitmap(bmp, 0,0,1,1); // or whatever colour format
al_flip_display(display);
that way, code can be written with complete ignorance of the underlying driver
and work properly. Sure, one can still use the normal OpenGL commands (and we
must make sure that this does work), but the second example should work too.
In case of OpenGL, the returned bitmap from al_get_buffer could just have a
flag set to say `use OpenGL commands instead of drawing to me', or better
yet, the drawing operations in the vtable could be directly mapped to OpenGL
commands:
al_clear_bitmap(bmp, ...) gets translated to
bmp->vtable->clear(bmp, ...);
which is a reference to
al_opengl_clear_bmp(BITMAP *dummy, ...)
{
glClearColor(...);
glClear();
}
> Each graphics driver would have a capability flag telling if it can
> provide an OpenGL context or not. And graphics drivers would see in
> their initialization function if OpenGL is requested, and initialize an
> OpenGL context if so.
I think a generic AL_ACCELERATED flag would be better. Internally it would
work as you describe anyway.
Evert