From b7d638e53d03046527fe7323bf383c2ddb44d3c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Derzsi=20D=C3=A1niel?= Date: Tue, 18 Dec 2018 16:49:00 +0200 Subject: [PATCH 1/3] pgraph: fix BillboardEffect regression with older models In older BAM files (version <= 6.42), _fixed_depth will have an uncertain value after loading, leading to incorrect transform calculations, which cause rendering issues (see issue #474) --- panda/src/pgraph/billboardEffect.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/panda/src/pgraph/billboardEffect.cxx b/panda/src/pgraph/billboardEffect.cxx index d6319021f1..ff44e11202 100644 --- a/panda/src/pgraph/billboardEffect.cxx +++ b/panda/src/pgraph/billboardEffect.cxx @@ -375,5 +375,7 @@ fillin(DatagramIterator &scan, BamReader *manager) { if (manager->get_file_minor_ver() >= 43) { _look_at.fillin(scan, manager); _fixed_depth = scan.get_bool(); + } else { + _fixed_depth = false; } } From 11526852edb23de2b42ff18371ecc05b02abe45d Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 18 Dec 2018 19:59:36 +0100 Subject: [PATCH 2/3] glgsg: add ability to get red/rg-only floating-point renderbuffers --- panda/src/glstuff/glGraphicsBuffer_src.cxx | 37 ++++++++++++++++------ 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/panda/src/glstuff/glGraphicsBuffer_src.cxx b/panda/src/glstuff/glGraphicsBuffer_src.cxx index 06c26a590d..8fbba8f79d 100644 --- a/panda/src/glstuff/glGraphicsBuffer_src.cxx +++ b/panda/src/glstuff/glGraphicsBuffer_src.cxx @@ -921,20 +921,37 @@ bind_slot(int layer, bool rb_resize, Texture **attach, RenderTexturePlane slot, if (_fb_properties.get_alpha_bits() == 0) { if (_fb_properties.get_srgb_color()) { gl_format = GL_SRGB8; + } else if (_fb_properties.get_color_bits() > 16 * 3 || + _fb_properties.get_red_bits() > 16 || + _fb_properties.get_green_bits() > 16 || + _fb_properties.get_blue_bits() > 16) { + // 32-bit, which is always floating-point. + if (_fb_properties.get_blue_bits() > 0 || + _fb_properties.get_color_bits() == 1 || + _fb_properties.get_color_bits() > 32 * 2) { + gl_format = GL_RGB32F; + } else if (_fb_properties.get_green_bits() > 0 || + _fb_properties.get_color_bits() > 32) { + gl_format = GL_RG32F; + } else { + gl_format = GL_R32F; + } } else if (_fb_properties.get_float_color()) { - if (_fb_properties.get_color_bits() > 16 * 3) { - gl_format = GL_RGB32F_ARB; + // 16-bit floating-point. + if (_fb_properties.get_blue_bits() > 0 || + _fb_properties.get_color_bits() == 1 || + _fb_properties.get_color_bits() > 16 * 2) { + gl_format = GL_RGB16F; + } else if (_fb_properties.get_green_bits() > 0 || + _fb_properties.get_color_bits() > 16) { + gl_format = GL_RG16F; } else { - gl_format = GL_RGB16F_ARB; + gl_format = GL_R16F; } + } else if (_fb_properties.get_color_bits() > 8 * 3) { + gl_format = GL_RGB16_EXT; } else { - if (_fb_properties.get_color_bits() > 16 * 3) { - gl_format = GL_RGB32F_ARB; - } else if (_fb_properties.get_color_bits() > 8 * 3) { - gl_format = GL_RGB16_EXT; - } else { - gl_format = GL_RGB; - } + gl_format = GL_RGB; } } else { if (_fb_properties.get_srgb_color()) { From 8dcb735f2b9e196394c119a7d95568dedd7af58f Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Tue, 18 Dec 2018 19:43:37 -0800 Subject: [PATCH 3/3] x11display: Release M_relative mouse when window loses focus Fixes #480 --- panda/src/x11display/x11GraphicsWindow.cxx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/panda/src/x11display/x11GraphicsWindow.cxx b/panda/src/x11display/x11GraphicsWindow.cxx index ad0f8e44dd..be28a6254f 100644 --- a/panda/src/x11display/x11GraphicsWindow.cxx +++ b/panda/src/x11display/x11GraphicsWindow.cxx @@ -508,23 +508,33 @@ process_events() { changed_properties = true; } - if (properties.has_foreground() && _properties.get_mouse_mode() == WindowProperties::M_confined) { + if (properties.has_foreground() && ( + _properties.get_mouse_mode() == WindowProperties::M_confined || + _dga_mouse_enabled)) { + x11GraphicsPipe *x11_pipe; + DCAST_INTO_V(x11_pipe, _pipe); + // Focus has changed, let's let go of the pointer if we've grabbed or re-grab it if needed if (properties.get_foreground()) { // Window is going to the foreground, re-grab the pointer X11_Cursor cursor = None; if (_properties.get_cursor_hidden()) { - x11GraphicsPipe *x11_pipe; - DCAST_INTO_V(x11_pipe, _pipe); cursor = x11_pipe->get_hidden_cursor(); } XGrabPointer(_display, _xwindow, True, 0, GrabModeAsync, GrabModeAsync, _xwindow, cursor, CurrentTime); + if (_dga_mouse_enabled) { + x11_pipe->enable_relative_mouse(); + } } else { // window is leaving the foreground, ungrab the pointer - XUngrabPointer(_display, CurrentTime); + if (_dga_mouse_enabled) { + x11_pipe->disable_relative_mouse(); + } else if (_properties.get_mouse_mode() == WindowProperties::M_confined) { + XUngrabPointer(_display, CurrentTime); + } } }