-#define USEPBUFFER
+// We were using PBUFFER for alpha compositing on Linux before, but it does not seem to work, nor be required anymore.
+// #define USEPBUFFER
namespace gfx::drivers;
oglSystem.pfd.nVersion = 1;
oglSystem.pfd.dwFlags = PFD_DRAW_TO_WINDOW /*PFD_DRAW_TO_BITMAP*/ | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
oglSystem.pfd.iPixelType = PFD_TYPE_RGBA;
- oglSystem.pfd.cColorBits = 32;
+ oglSystem.pfd.cColorBits = 24;
+ oglSystem.pfd.cAlphaBits = 8;
oglSystem.pfd.cDepthBits = 24;
oglSystem.pfd.iLayerType = PFD_MAIN_PLANE;
oglSystem.format = pixelFormat;
wglMakeCurrent(null, null);
wglDeleteContext(oglSystem.glrc);
+
+ // *** DescribePixelFormat does not support WGL pixel formats! ***
//DescribePixelFormat(oglSystem.hdc, oglSystem.format, sizeof(oglSystem.pfd), &oglSystem.pfd);
SetPixelFormat(oglSystem.hdc, oglSystem.format, &oglSystem.pfd);
//Log("Successfully set pixel format\n");
if(this == rootWindow)
{
if(style.drawBehind || background.a)
+ {
+ int a = background.a;
+ // Premultiply alpha for clear color
+ surface.SetBackground({ (byte)a, { (byte)(a*background.color.r/255), (byte)(a*background.color.g/255), (byte)(a*background.color.b/255) } });
surface.Clear(colorBuffer);
+ surface.SetBackground(background);
+ }
}
else if(background.a)
{
}
else if(/*style.clearDepthBuffer || */background.a)
{
+ int a = background.a;
// surface.Clear((style.clearDepthBuffer ? depthBuffer : 0) | (background.a ? colorBuffer : 0));
+ // Premultiply alpha for clear color
+ surface.SetBackground({ (byte)a, { (byte)(a*background.color.r/255), (byte)(a*background.color.g/255), (byte)(a*background.color.b/255) } });
surface.Clear(colorBuffer);
+ surface.SetBackground(background);
}
}
#endif
depth = visualInfo ? visualInfo->depth : (window.alphaBlend ? 32 : xSystemDepth);
visual = visualInfo ? visualInfo->visual : (window.alphaBlend ? FindFullColorVisual (xGlobalDisplay, &depth) : xSystemVisual);
- // printf("visual: %d, depth: %d\n", visual, depth);
+ // printf("visual: %x, depth: %d\n", visualInfo ? visualInfo->visualid : 0, depth);
if(visual)
{