Re: [AD] OpenGL unlock fix and discussion |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Wed, 2010-02-17 at 10:53 -0700, Trent Gamblin wrote:
> It's debatable whether or not set_current_display
> should set the target or not, but it seems natural to me so
> I'm in favor of keeping it the way it is, unless someone
> has a good reason to change it.
>
Yes. We should add a note about this to both al_set_target_bitmap and
al_set_current_display as it's not obvious at all.
Basically, our state system looks like this, with the extra hack that
the target bitmap is set to the backbuffer whenever the current display
changes:
global
active system driver
current config
per thread
current display
current transformation
deferred drawing
current target bitmap
current clipping rectangle
bitmap locking
current blending
new bitmap params
new display params
active file interface
errno
This reveals another serious problem - the current transformation is
per-display. So it's impossible right now to change the transformation
when you draw into a memory bitmap but never create a display. I can see
three solutions:
1. An easy solution would be to put the current transformation into TLS,
just like blending.
2. Another solution would be to always require an active display for all
drawing operations. It would be conceptually cleanest (and we would have
a lot less TLS state since blending and target bitmap would fall away),
but I think we decided against it in the past as it would require to
always create a display before using any graphics operations. (We could
just provide a function which creates a dummy display, so it would not
be that hard to do.)
3. A third solution would be to leave things like they are, that is
require an active display for using transformations and deferred
drawing, but allow other graphics operations and things like clipping or
blending without a display. It wouldn't be very well designed though so
I don't think we want it.
--
Elias Pschernig <elias.pschernig@xxxxxxxxxx>