summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FL/Enumerations.H3
-rw-r--r--FL/Fl_Gl_Window.H3
-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
6 files changed, 20 insertions, 5 deletions
diff --git a/FL/Enumerations.H b/FL/Enumerations.H
index 92cfac612..a2434bb19 100644
--- a/FL/Enumerations.H
+++ b/FL/Enumerations.H
@@ -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
diff --git a/FL/Fl_Gl_Window.H b/FL/Fl_Gl_Window.H
index 65ae1b12c..e81fa212d 100644
--- a/FL/Fl_Gl_Window.H
+++ b/FL/Fl_Gl_Window.H
@@ -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.
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) {