This simplified program illustrates the problem, as it is, I get
r: /home/prog/allegro-5.0.8/src/bitmap.c:210: _bitmap_drawer: Assertion `bitmap != dest && bitmap != dest->parent' failed. Aborted
I also tried getting the texture ID and drawing it with glBegin(GL_QUADS), but it only showed a black rectangle instead of the light gray and dark gray associated with blank alpha backgrounds.
Cookies await!
On line 101 you're trying to draw the backbuffer to the backbuffer. I think you meant al_draw_bitmap(alphaback....
I didn't see that, pushing too hard, I guess. OTOH, it still doesn't draw anything (in the main program). That square in the middle is a bevel drawn separately, the image should be inside it.
{"name":"607079","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/8\/a8fa7c20a81b822305211b24a444479f.png","w":809,"h":633,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/8\/a8fa7c20a81b822305211b24a444479f"}
[EDIT]
Whoopsy, I tried it in the example program just for completeness, and it showed the squares! I should be able to figure it out now. Thanks, Trent!
[EDIT2]
Well, no. I'll just malloc a block, set some "pixels" and glBindTexture() it like the FSM intended.
Well, no. I'll just malloc a block, set some "pixels" and glBindTexture() it like the FSM intended.
Could also al_lock_bitmap and access the raw bitmap data. But I think you're just doing something odd.
Ah, that looks like a WinXP window border? The real thing? Because on Windows with DirectX you can't lock the backbuffer IIRC. Though I'm not sure you're doing that anyway. Just sayin'. You could try al_set_new_display_flags(ALLEGRO_OPENGL) before creating the display if you ARE on Windows, and see if that helps.
It's not windows, it's xfce with RedmondXP style and something called "Raleigh". But for what it's worth, the code specifies OpenGL and even inits the primitive addon.
[EDIT]
Well, I just tried it again, (since the font shows OK), and I could load and display an image file just fine. Then I tried using al_map_rgba() like in the example instead of using my pre-defined array of 4 float colors and it worked! This array of colors is used for drawing everything else without problems, including the font, and all the alphas in it are 1.0.
[EDIT2]
Looking some more, there's a function "zz_init_gui()" that initializes these colors, and somehow I forgot about it and tried to draw to the alphaback bitmap before zz_init_gui() was called. Where's the blushing embarrassed smiley?
There is no shame in fixing bugs in your programs. Only in giving up. </stuff you already know>
I was getting in too much of a hurry. Drawing to a bitmap with A5 seemed weird, and I knew it needed to be done after creating a display, so I put it as the very next thing. I was snagged by this zz_init_gui() another time a couple of months ago, so maybe I should make a wrapper func that creates a display and initializes these colors transparently.
Hell, there isn't even shame in giving up. Just do what makes you happy. D:
EDIT: I'm trying not to sound philosophical here, but I think I'm failing.
If I was going to give up on anything, it'd be A5 (which I've threatened to do before), but since the core library is being tested on hundreds of computers, I couldn't hope to match that with my own stuff based on NeHe tutorials.
The nice thing about A5, is the more time goes on, and the more people like you we have using it, the better it'll get.
I find it sad when we get a new user who can't seem to get it work for them, and then has to switch back to whatever they were using due to time constraints or frustration overload.
That reminds me, someone was having issues with shaders and multi texturing. He just couldn't get allegro to work when setting up multiple textures which were then passed into his shader.
Maybe we should make ex_shader use two bitmaps. I'd expect that all you need is:
al_set_shader_sampler(shader, "my_bitmap_1", my_bitmap_1, 0); al_set_shader_sampler(shader, "my_bitmap_2", my_bitmap_2, 1);
So quite trivial. But if someone has problems with it, can never hurt to have it in an example.