Page 1 of 1

OpenWindowedScreen() and alpha transparency

Posted: Fri Jan 23, 2026 9:05 am
by Mindphazer
It seems there's a problem with alpha tranparency in a OpenWindowedScreen on MacOS.
The sample code below displays 20 squares with increasing alpha transparency.
It works fine on Windows
But on MacOS (MacBook pro M4, MacOS 26.2, PB 6.21), all squares are white, no transparency is applied.

Code: Select all

InitSprite()
OpenWindow(0, 0, 0, 330, 160, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, DesktopScaledX(330), DesktopScaledY(160))

Repeat
  Repeat
    Event = WindowEvent()
    If event = #PB_Event_CloseWindow
      End 
    EndIf
  Until Event = 0
  If StartDrawing(ScreenOutput())
    DrawingMode(#PB_2DDrawing_AlphaBlend)
    For i = 1 To 20
      Box(DesktopScaledX(i * 15), DesktopScaledY(50), DesktopScaledX(14), DesktopScaledY(14), RGBA(255, 255, 255, 255 - (i * 10)))
    Next i
    StopDrawing()
  EndIf
  FlipBuffers() 
  ClearScreen(0)
ForEver
Can anybody else confirm ?

Re: OpenWindowedScreen() and alpha transparency

Posted: Sat Jan 24, 2026 4:00 pm
by mrbungle
Confirmed on macOS 15.73 (Seqouia)

Re: OpenWindowedScreen() and alpha transparency

Posted: Fri Jan 30, 2026 9:41 am
by Mindphazer
I re-read the doc (!!)
Drawingmode(#PB_2DDrawing_AlphaBlend) is supposed to work only with ImageOutput(), CanvasOutput() and SpriteOutput()
So my code is not supposed to work :mrgreen:
I guess it's pure luck if it works on Windows :wink:

Re: OpenWindowedScreen() and alpha transparency

Posted: Fri Jan 30, 2026 2:49 pm
by moulder61
@Mindphazer,

It works on Linux. :P

Having said that, the help on ScreenOutput() says, under "Remarks" :
On Linux and OS X, ScreenOutput() copies the whole screen buffer back to main memory to do 2D drawing operations (OpenGL doesn't allow direct buffer access). Therefore drawing on a screen is very slow and should be avoided. ScreenOutput() has to be called in the same thread where OpenScreen() was called.
The use of InitEngine3D() is forbidden, ScreenOutput() returns 0.
Would that make a difference?

Moulder.