|
Memory bitmaps fail in Allegro-4.9.8 |
Todd Cope
Member #998
November 2000
|
Today I downloaded Revision 11566 from the snapshot. The build went smooth so I installed it and rebuilt my game linking to it instead of 4.7.1. Aside from having to change my fshook calls to match the API changes everything worked fine until it got to the point in my code where I am using a memory bitmap. When I use this code: al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); fimage = al_iio_load(fn); ... my program crashes at "fimage = al_iio_load(fn)." If I comment out "al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP)" the program runs. I looked in the examples and found "ex_membpm" so I tried it and sure enough it crashes. I tried "ex_membmp" in 4.9.7.1 just to be sure and it works there. Bottom line is memory bitmaps do not work in the current SVN version. |
SiegeLord
Member #7,827
October 2006
|
What system are you testing this on? Incidentally, everything works fine on my system (Linux). "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Todd Cope
Member #998
November 2000
|
Windows I've been trying other snapshots to see if I can pinpoint where the problem came up but so far all have the same issue. Edit: I got the oldest snapshot available (11398) and it still crashes on memory bitmaps. |
ImLeftFooted
Member #3,935
October 2003
|
I hear ginseng helps with that... or maybe a memory game. |
Trent Gamblin
Member #261
April 2000
|
Memory bitmaps work fine for me with the latest svn and I haven't noticed them not working in my game, which I've kept up to date with Allegro. Maybe you can pinpoint the problem a little further so we can fix it? A backtrace might be helpful.
|
Todd Cope
Member #998
November 2000
|
I built the debug version and got this when I ran "ex_membmp:" Edit: gdb doesn't produce a backtrace when I run "ex_membmp" through it, it just shows the same error I quoted above. Edit2: I've looked deep into the source and I think the issue is with this function:
Particularly, when format is "ALLEGRO_PIXEL_FORMAT_ANY" (which it is by default from what I can tell) a detailed pixel format is not selected. There should be case for "ALLEGRO_PIXEL_FORMAT_ANY" although I don't really know what should go there. Edit3: I set the pixel format to ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA before the memory bitmaps in my program and the crash is gone so I believe I am right about where the bug lies. |
Trent Gamblin
Member #261
April 2000
|
Thanks for tracking that down. It should be fixed in SVN, if that was all that was wrong.
|
Todd Cope
Member #998
November 2000
|
Works fine now. |
Matthew Leverton
Supreme Loser
January 1999
|
SVN log said:
Added ALLEGRO_PIXEL_FORMAT_ANY.
|
Todd Cope
Member #998
November 2000
|
I see, when ALLEGRO_PIXEL_FORMAT_ANY was added, the default pixel format was changed from ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA. Is there a reason the default is to not use alpha? I think it breaks continuity a little. When I load an image with an alpha channel as a display bitmap the alpha channel is enabled there, but when I switch to memory bitmaps suddenly I have to force the alpha channel with an extra function call. |
Elias
Member #358
May 2000
|
I agree, we should have a format with alpha as default - but probably there's some good reason it was changed. -- |
Matthew Leverton
Supreme Loser
January 1999
|
ALLEGRO_PIXEL_FORMAT_ANY is not ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA. |
Elias
Member #358
May 2000
|
Ok, so ALLEGRO_PIXEL_FORMAT_ANY should still create a bitmap with alpha for memory bitmaps - only if no alpha is available (as can happen when creating the "screen" bitmap) it will not fail because of that and use a bitmap without alpha. -- |
Todd Cope
Member #998
November 2000
|
In regards to creating new bitmaps ALLEGRO_PIXEL_FORMAT_ANY and ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA are identical. bitmap_new.c said:
case ALLEGRO_PIXEL_FORMAT_ANY: case ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA: case ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA: format = ALLEGRO_PIXEL_FORMAT_XRGB_8888; break;
Edit: what Elias said. |
Trent Gamblin
Member #261
April 2000
|
You're right, I put it in the wrong place. Fixed again.
|
Matthew Leverton
Supreme Loser
January 1999
|
But will ALLEGRO_PIXEL_FORMAT_ARGB_8888 fail in places where ALLEGRO_PIXEL_FORMAT_XRGB_8888 does not? If so, then the decision is conditional. |
Trent Gamblin
Member #261
April 2000
|
Probably not for normal bitmaps. The only issue is display backbuffers, which in many cases cannot have alpha in them. The D3D code chooses smartly in both cases (at least it's supposed to).
|
|