Allegro 4.9.4 blender issue (D3D)
Todd Cope

Here is a picture of the issue:
http://www.allegro.cc/files/attachment/596337

The problem is exhibited most clearly in the logo image at the top. I am using this code:

    al_clear(al_map_rgb(64, 64, 128));
    al_store_state(&old_state, ALLEGRO_STATE_BLENDER);
    al_set_blender(ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, al_map_rgba(255, 255, 255, 128));
    al_draw_bitmap(lingo_image[LINGO_IMAGE_LOGO], 28, 28, 0);
    al_restore_state(&old_state);
    ...

For some reason the alpha value of the blender is applying to the 0-alpha pixels in the ALLEGRO_BITMAP. The lower the alpha value I use the darker the 0-alpha pixels are drawn. I don't believe this is the way it is supposed to work.

Trent Gamblin

Can I have the image so I can test?

Todd Cope

Attached. It's not just that image, though. Any image I draw with that kind of blending gives the same effect. That's why there are dark boxes around the menu lettering, too. I am drawing the shadows at half opacity.

GullRaDriel

Yeah the rendered logo is really messed up.

Trent Gamblin

Thanks Todd for reporting the problem. It was a one line fix but it took a while to get it right. SVN should behave as expected now.

Todd Cope

What file was the change made in?

Trent Gamblin

src/win/d3d_disp.cpp

-d3d_display->device->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_BLENDDIFFUSEALPHA);
+d3d_display->device->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);

Todd Cope

Thank you! It works beautifully now!

Thread #597660. Printed from Allegro.cc