summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2025-12-19 16:22:28 +0100
committerMatthias Melcher <github@matthiasm.com>2025-12-19 16:23:46 +0100
commitbad956cdd63de444a061ff754b99c633e11438c3 (patch)
tree39669ceacac1a0224b2bea34d7cfe92e1e1f24f8 /src/drivers
parent63c0ef5681e869ceea908fe73f6c66bcd3bf442a (diff)
Add Fl_Gl_Window 32 bit depth buffer option.
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm6
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx6
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx3
-rw-r--r--src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx4
4 files changed, 16 insertions, 3 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm
index fd846f1c8..d286d46f3 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm
+++ b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm
@@ -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;
diff --git a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
index 815196af9..d20b941b7 100644
--- a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
@@ -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;
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx
index d6f1a9632..375408496 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx
@@ -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
diff --git a/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx
index 1991be316..7282528ca 100644
--- a/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx
+++ b/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx
@@ -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) {