|
[A5] Problem with alpha blending. |
Desmond Taylor
Member #11,943
May 2010
|
Hi, I am using Allegro 5.0.0 (The latest release) and I am having problems with alpha blending. I used to use allegro 4.9.22 and the code I was using is below. 1al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, al_map_rgba_f(1, 1, 1, 0.3));
2al_draw_bitmap_region(gfx.player[player.gfxID], start_x, start_y, width, height, dest_x, dest_y, facing_flip);
3al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, al_map_rgba_f(1, 1, 1, 1));
Can anyone help with getting this to work under the latest release as I have been trying for 3 days now and can't get it right. Thanks in advanced. |
Dennis
Member #1,090
July 2003
|
If you look at the documentation for al_set_blender (e.g. by clicking on it inside the code you posted), you'll notice that it only takes three parameters not four. What exact problems are you having? Post the shortest possible compilable code sample which reproduces the problem and attach the bitmap you're trying to draw. --- 0xDB | @dennisbusch_de --- |
Desmond Taylor
Member #11,943
May 2010
|
Dennis said: If you look at the documentation for al_set_blender (e.g. by clicking on it inside the code you posted), you'll notice that it only takes three parameters not four. What exact problems are you having? Post the shortest possible compilable code sample which reproduces the problem and attach the bitmap you're trying to draw. I have looked at the documentation and I have tried messing with the values but get really bad effects. I can't post the Bitmap as it is in a PE file, however I will post a screen shot of what I am trying to get. The screen shot is what I get when using the code in my first post. {"name":"603527","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/b\/1bb5944471725de4ebe0306ad22d82c0.png","w":640,"h":480,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/b\/1bb5944471725de4ebe0306ad22d82c0"} |
Matthew Leverton
Supreme Loser
January 1999
|
al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, al_map_rgba_f(1, 1, 1, 0.3)); al_draw_bitmap_region(gfx.player[player.gfxID], start_x, start_y, width, height, dest_x, dest_y, facing_flip); Becomes: al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA); al_draw_tinted_bitmap_region(gfx.player[player.gfxID], al_map_rgba_f(1, 1, 1, 0.3), start_x, start_y, width, height, dest_x, dest_y, facing_flip); Or, if using the default blender: al_draw_tinted_bitmap_region(gfx.player[player.gfxID], al_map_rgba_f(1 * 0.3, 1 * 0.3, 1 * 0.3, 0.3), start_x, start_y, width, height, dest_x, dest_y, facing_flip);
|
Desmond Taylor
Member #11,943
May 2010
|
Thank you so much. I understand how this works now I used your code here. 1al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA);
2al_draw_tinted_bitmap_region(gfx.player[player.gfxID], al_map_rgba_f(1, 1, 1, 0.3), start_x, start_y, width, height, dest_x, dest_y, facing_flip);
And it worked perfectly Thanks again Guys |
|