From: Carl Hetherington Date: Sat, 11 Sep 2021 23:26:47 +0000 (+0200) Subject: Fix GL information fetching. X-Git-Tag: v2.15.163~1^2~21 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=e9ae050b0b15c91c3f591ad84938e60d271357b3;p=dcpomatic.git Fix GL information fetching. --- diff --git a/src/wx/gl_video_view.cc b/src/wx/gl_video_view.cc index 16d42499b..7c26ae616 100644 --- a/src/wx/gl_video_view.cc +++ b/src/wx/gl_video_view.cc @@ -277,6 +277,18 @@ GLVideoView::setup_shaders () } #endif + auto get_information = [this](GLenum name) { + auto s = glGetString (name); + if (s) { + _information[name] = std::string (reinterpret_cast(s)); + } + }; + + get_information (GL_VENDOR); + get_information (GL_RENDERER); + get_information (GL_VERSION); + get_information (GL_SHADING_LANGUAGE_VERSION); + unsigned int indices[] = { 0, 1, 3, // texture triangle #1 1, 2, 3, // texture triangle #2 diff --git a/src/wx/gl_video_view.h b/src/wx/gl_video_view.h index 0186417d2..bac195fb1 100644 --- a/src/wx/gl_video_view.h +++ b/src/wx/gl_video_view.h @@ -53,6 +53,10 @@ public: return _vsync_enabled; } + std::map information () const { + return _information; + } + private: void set_image (std::shared_ptr image); void set_image_and_draw (); @@ -86,4 +90,6 @@ private: bool _setup_shaders_done = false; std::shared_ptr _timer; + + std::map _information; }; diff --git a/src/wx/system_information_dialog.cc b/src/wx/system_information_dialog.cc index ed93a4ab4..1c8dd8d00 100644 --- a/src/wx/system_information_dialog.cc +++ b/src/wx/system_information_dialog.cc @@ -52,13 +52,23 @@ SystemInformationDialog::SystemInformationDialog (wxWindow* parent, weak_ptr(glGetString(GL_VERSION)); - if (v) { - add (std_to_wx(v), false); - } else { - add (_("unknown"), false); - } + + auto information = gl->information(); + auto add_string = [this, &information](GLenum name, wxString label) { + add (label, true); + auto i = information.find(name); + if (i != information.end()) { + add (std_to_wx(i->second), false); + } else { + add (_("unknown"), false); + } + }; + + add_string (GL_VENDOR, _("Vendor")); + add_string (GL_RENDERER, _("Renderer")); + add_string (GL_VERSION, _("Version")); + add_string (GL_SHADING_LANGUAGE_VERSION, _("Shading language version")); + add (_("vsync"), true); add (gl->vsync_enabled() ? _("enabled") : _("not enabled"), false); }