Add Fl_Gl_Window 32 bit depth buffer option.

This commit is contained in:
Matthias Melcher 2025-12-19 16:22:28 +01:00
parent 63c0ef5681
commit bad956cdd6
6 changed files with 20 additions and 5 deletions

View File

@ -1226,7 +1226,8 @@ enum Fl_Mode {
FL_MULTISAMPLE= 128,
FL_STEREO = 256,
FL_FAKE_SINGLE = 512, // Fake single buffered windows using double-buffer
FL_OPENGL3 = 1024
FL_OPENGL3 = 1024,
FL_DEPTH32 = 2048,
};
// image alpha blending

View File

@ -150,7 +150,8 @@ public:
- \c FL_DOUBLE - double buffered
- \c FL_ACCUM - accumulation buffer
- \c FL_ALPHA - alpha channel in color
- \c FL_DEPTH - depth buffer
- \c FL_DEPTH - any depth buffer (or set FL_DEPTH32 for at least 32 bits)
- \c FL_DEPTH32 - depth buffer with at least 32 bits
- \c FL_STENCIL - stencil buffer
- \c FL_MULTISAMPLE - multisample antialiasing
- \c FL_OPENGL3 - use OpenGL version 3.0 or more.

View File

@ -94,7 +94,11 @@ static NSOpenGLPixelFormat* mode_to_NSOpenGLPixelFormat(int m, const int *alistp
//list[n++] = AGL_DOUBLEBUFFER;
attribs[n++] = NSOpenGLPFADoubleBuffer;
}
if (m & FL_DEPTH) {
if (m & FL_DEPTH32) {
//list[n++] = AGL_DEPTH_SIZE; list[n++] = 32;
attribs[n++] = NSOpenGLPFADepthSize;
attribs[n++] = (NSOpenGLPixelFormatAttribute)32;
} else if (m & FL_DEPTH) {
//list[n++] = AGL_DEPTH_SIZE; list[n++] = 24;
attribs[n++] = NSOpenGLPFADepthSize;
attribs[n++] = (NSOpenGLPixelFormatAttribute)24;

View File

@ -131,7 +131,11 @@ Fl_Gl_Choice *Fl_Wayland_Gl_Window_Driver::find(int m, const int *alistp)
EGL_NONE
};
if (m & FL_DEPTH) config_attribs[11] = 1;
if (m & FL_DEPTH32)
config_attribs[11] = 32; // request at least 32 bits
else if (m & FL_DEPTH)
config_attribs[11] = 1; // accept any size
if (m & FL_MULTISAMPLE) config_attribs[13] = 1;
if (m & FL_STENCIL) config_attribs[15] = 1;
if (m & FL_ALPHA) config_attribs[17] = (m & FL_RGB8) ? 8 : 1;

View File

@ -79,7 +79,10 @@ Fl_Gl_Choice *Fl_WinAPI_Gl_Window_Driver::find(int m, const int *alistp)
if ((m & FL_ACCUM) && !pfd.cAccumBits) continue;
if ((!(m & FL_DOUBLE)) != (!(pfd.dwFlags & PFD_DOUBLEBUFFER))) continue;
if ((!(m & FL_STEREO)) != (!(pfd.dwFlags & PFD_STEREO))) continue;
// Skipt his descriptor if we want a depth buffer, but this one has none
if ((m & FL_DEPTH) && !pfd.cDepthBits) continue;
// Skipt his descriptor if we want a 32 bit depth buffer, but this one has less or none
if ((m & FL_DEPTH32) && pfd.cDepthBits < 32) continue;
if ((m & FL_STENCIL) && !pfd.cStencilBits) continue;
#if DEBUG_PFD

View File

@ -151,7 +151,9 @@ Fl_Gl_Choice *Fl_X11_Gl_Window_Driver::find(int m, const int *alistp)
if (m & FL_DOUBLE) {
list[n++] = GLX_DOUBLEBUFFER;
}
if (m & FL_DEPTH) {
if (m & FL_DEPTH32) {
list[n++] = GLX_DEPTH_SIZE; list[n++] = 32;
} else if (m & FL_DEPTH) {
list[n++] = GLX_DEPTH_SIZE; list[n++] = 1;
}
if (m & FL_STENCIL) {