SDL_OPENGLBLIT and alpha blended surfaces problem

Hi

After some back and forth with Alex from ParaGUI there seems to be a
problem with alpha blended surfaces blitted onto a GL window.

My problem is that a label created in paragui apparently uses an alpha
blended surface and this one does not show up in the GL window when
blitted. Alex says this is a bug/problem in SDL and I have not seen any
postings on this here.

So is this new, or is anyone already working on this? Is this solvable?

Sorry if this is a FAQ, but as said - I haven’t seen this one before on
the list.

Maybe this explains the problem that Scott Russell wrote about yesterday.

/Thomas

Thomas Lund wrote:

After some back and forth with Alex from ParaGUI there seems to be a
problem with alpha blended surfaces blitted onto a GL window.

Yeah, I had the same problem on Ver 1.1.6 when experimenting with GL and SDL
surfaces.

Ciao
Andreas–
| Andreas Schiffler aschiffler at home.com |
| Senior Systems Engineer - Deskplayer Inc., Buffalo |
| 4707 Eastwood Cres., Niagara Falls, Ont L2E 1B4, Canada |
| +1-905-371-3652 (private) - +1-905-371-8834 (work/fax) |

Thomas Lund wrote:

After some back and forth with Alex from ParaGUI there seems to be a
problem with alpha blended surfaces blitted onto a GL window.

Yeah, I had the same problem on Ver 1.1.6 when experimenting with GL and SDL
surfaces.

Do either of you have a simple test program I can use to reproduce the
problem? Please post a link publicly, so Mattias can take a look as well.

Thanks!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

I have a test script using paragui. Alex hacked the latest paragui (cvs)
to not use alpha blended surfaces for labels, so you will need the 0.6.3
from his homepage.

The problem:

Button shows up fine
label does not show at all
radiobutton - button shows up and text when moving mouse over it

Code compiles by writing:

g++ test.cpp -o test -I/usr/include/SDL -I/usr/include/paragui -lSDL
-lparagui -lGL -lpthread -lGLU

on a RedHat 6.2 with SDL 1.1.7, paragui 0.6.4 from CVS (before Alex’
hack) and Mesa 3.2

Source for test program attached.

/Thomas

Sam Lantinga wrote:

Thomas Lund wrote:

After some back and forth with Alex from ParaGUI there seems to be a
problem with alpha blended surfaces blitted onto a GL window.

Yeah, I had the same problem on Ver 1.1.6 when experimenting with GL and SDL
surfaces.

Do either of you have a simple test program I can use to reproduce the
problem? Please post a link publicly, so Mattias can take a look as well.

Thanks!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

-------------- next part --------------
A non-text attachment was scrubbed…
Name: test.cpp
Type: text/cpp
Size: 6811 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20010124/03dd5106/attachment.bin

I have a test script using paragui. Alex hacked the latest paragui (cvs)
to not use alpha blended surfaces for labels, so you will need the 0.6.3
from his homepage.

The problem:

Button shows up fine
label does not show at all
radiobutton - button shows up and text when moving mouse over it

Okay, the problem is easily fixed by noting the new alpha blit semantics
in the WhatsNew file. The relevant sections follow:

    The blit semantics for surfaces with and without alpha and colorkey
    have now been defined:                                                  

    RGB->RGBA:
        SDL_SRCALPHA set:
            alpha-blend (using the source per-surface alpha value);
            set destination alpha to opaque.
        SDL_SRCALPHA not set:
            copy RGB, set destination alpha to opaque.
        both:
            if SDL_SRCCOLORKEY set, only copy the pixels matching the
            source colour key.

    RGBA->RGBA:
        SDL_SRCALPHA set:
            alpha-blend (using the source alpha channel) the RGB values;
            leave destination alpha untouched. [Note: is this correct?]
            SDL_SRCCOLORKEY ignored.
        SDL_SRCALPHA not set:
            copy all of RGBA to the destination.
            if SDL_SRCCOLORKEY set, only copy the pixels matching the
            RGB values of the source colour key, ignoring alpha in the
            comparison.                                                     

Okay, so what you want is for SDL_SRCALPHA to not be set in the labels
so that the alpha is copied to the SDL screen texture.

Okay, so much for being smart. :slight_smile: I just tried your test program with
the ParaGUI 1.6.3 from the web page, and everything looked fine. The
label showed up, and the radiobutton and text looked fine. Did Alex
backport his fix to ParaGUI 1.6.3?

I just double-checked against ParaGUI 1.6.4, and the behavior is exactly
the same with SDL CVS and both versions of ParaGUI.

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software