I don't know if this is a bug in Allegro 5.0.3, but on my system, the alpha value of pixels isn't read back properly when using Direct3D and locking.
The simple example below fails to produce the expected output, which is:
a(al_get_pixel) == 40 a(locked region) == 40
Instead, it prints:
a(al_get_pixel) == 255 a(locked region) == 0
Red, green and blue values seem to work fine, it also works correctly when not using locking.
With OpenGL, there's no problem at all.
It would be nice if someone could try to reproduce this
Wouldn't you have to set the color depth before creating the display?
al_set_new_display_flags(ALLEGRO_DIRECT3D); al_set_new_display_option(ALLEGRO_DEPTH_SIZE, 32, ALLEGRO_SUGGEST); display = al_create_display(640, 480);
Verified, but here it's not a Direct3D issue: here I get the same results using OpenGL.
EDIT: Just noticed you have the last two parameters of al_lock_bitmap reversed.
So what color depth does A5 choose by default? 8 bit like A4?
32 bit.
It indeed does work with the parameters in the right order..
Ah! Thank you!