Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Video mode color buffer alpha  (Read 14150 times)

0 Members and 1 Guest are viewing this topic.

kdmiller3

  • Newbie
  • *
  • Posts: 5
    • View Profile
Video mode color buffer alpha
« 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.  :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Video mode color buffer alpha
« Reply #1 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.
Laurent Gomila - SFML developer

kdmiller3

  • Newbie
  • *
  • Posts: 5
    • View Profile
Video mode color buffer alpha
« Reply #2 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Video mode color buffer alpha
« Reply #3 on: January 18, 2008, 03:51:19 am »
Yep, that's true.
Laurent Gomila - SFML developer

HighCo

  • Newbie
  • *
  • Posts: 2
    • View Profile
Probably a bug...
« Reply #4 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Video mode color buffer alpha
« Reply #5 on: February 26, 2010, 08:49:07 am »
Thanks for reminding me.

I added your fix, it will be available in version 1.6.
Laurent Gomila - SFML developer

HighCo

  • Newbie
  • *
  • Posts: 2
    • View Profile
Video mode color buffer alpha
« Reply #6 on: February 26, 2010, 11:52:11 am »
Great! Thanks.

 

anything