Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Allegro 4.9.4 blender issue (D3D)

This thread is locked; no one can reply to it. rss feed Print
Allegro 4.9.4 blender issue (D3D)
Todd Cope
Member #998
November 2000
avatar

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
Member #261
April 2000
avatar

Can I have the image so I can test?

Todd Cope
Member #998
November 2000
avatar

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
Member #3,861
September 2003
avatar

Yeah the rendered logo is really messed up.

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Trent Gamblin
Member #261
April 2000
avatar

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
Member #998
November 2000
avatar

What file was the change made in?

Trent Gamblin
Member #261
April 2000
avatar

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
Member #998
November 2000
avatar

Thank you! It works beautifully now!

Go to: