From 0a7afb37d9a0879c4bd4f6cd0b1231d6abe135f1 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 21 Oct 2023 17:12:44 +0200 Subject: [PATCH] wgldisplay: Fix HDR framebuffers with newer NVIDIA drivers [skip ci] --- panda/src/wgldisplay/wglGraphicsStateGuardian.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/panda/src/wgldisplay/wglGraphicsStateGuardian.cxx b/panda/src/wgldisplay/wglGraphicsStateGuardian.cxx index 77521e2ff3..72c116b94b 100644 --- a/panda/src/wgldisplay/wglGraphicsStateGuardian.cxx +++ b/panda/src/wgldisplay/wglGraphicsStateGuardian.cxx @@ -336,6 +336,8 @@ choose_pixel_format(const FrameBufferProperties &properties, _supports_pixel_format = has_extension("WGL_ARB_pixel_format"); _supports_wgl_multisample = has_extension("WGL_ARB_multisample"); + bool supports_pixel_format_float = _supports_pixel_format && has_extension("WGL_ARB_pixel_format_float"); + if (has_extension("WGL_ARB_create_context")) { _wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB"); @@ -381,6 +383,10 @@ choose_pixel_format(const FrameBufferProperties &properties, iattrib_list[ni++] = WGL_PIXEL_TYPE_ARB; iattrib_list[ni++] = WGL_TYPE_RGBA_ARB; } + else if (supports_pixel_format_float) { + iattrib_list[ni++] = WGL_PIXEL_TYPE_ARB; + iattrib_list[ni++] = WGL_TYPE_RGBA_FLOAT_ARB; + } if (need_pbuffer) { iattrib_list[ni++] = WGL_DRAW_TO_PBUFFER_ARB;