SFML community forums

General => Feature requests => Topic started by: kdmiller3 on January 18, 2008, 02:18:30 am

Title: Video mode color buffer alpha
Post by: kdmiller3 on January 18, 2008, 02:18:30 am
I noticed that there's no way to request alpha for the color buffer, even when setting a 32-bit color format.  Some OpenGL blend functions require the color buffer have an alpha channel (e.g. GL_SRC_ALPHA_SATURATE, GL_ONE required by polygon smoothing).  My renderer failedafter switching over from SDL, as the alpha-saturate blending stopped drawing anything due to the missing destination alpha.  I ended up locally modifying WindowImplWin32::CreateContex to request an alpha channel for 32-bit and 16-bit color depths, but that's obviously not ideal.  Exposing the pixel format attributes as some sort of "advanced" properties would help.  :)
Title: Video mode color buffer alpha
Post by: Laurent on January 18, 2008, 02:28:32 am
Yep, having advanced settings to customize the context creation could certainly help.

Or I could just create an alpha-channel by default if it doesn't impact the performances for regular RGB usage.
Title: Video mode color buffer alpha
Post by: kdmiller3 on January 18, 2008, 03:18:43 am
The latter should be okay short-term, but alpha bits is just one of many useful OpenGL setup properties.  SDL exposes a number of them, so there's definitely a call for that sort of thing.  The antialiasing (multisampling) parameter could then be rolled into the larger properties system.
Title: Video mode color buffer alpha
Post by: Laurent on January 18, 2008, 03:51:19 am
Yep, that's true.
Title: Probably a bug...
Post by: HighCo on February 26, 2010, 08:06:27 am
Any updates on this issue?

I think, if I create a Window with 32 bits per pixels, doesn't that always mean I want an alpha channel with it? If I didn't want an alpha channel, wouldn't I specify something like 24 bit? I think SFML should automatically add the alpha channel for 32 bit or at least give me the option to do so manually. What do you think?

I ended up locally adding this to "WindowImplWin32::CreateContex"
Code: [Select]
PixelDescriptor.cAlphaBits = Mode.BitsPerPixel==32 ? 8:0;

Will this issue be fixed in a future release?
Title: Video mode color buffer alpha
Post by: Laurent on February 26, 2010, 08:49:07 am
Thanks for reminding me.

I added your fix, it will be available in version 1.6.
Title: Video mode color buffer alpha
Post by: HighCo on February 26, 2010, 11:52:11 am
Great! Thanks.