diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-09-12 01:26:47 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-09-27 13:41:46 +0200 |
| commit | e9ae050b0b15c91c3f591ad84938e60d271357b3 (patch) | |
| tree | 334279b2851e5b80068c4bf2669f498c0ca0cbc7 /src | |
| parent | 4f4561c4b5bb1e8a2fa8e673606d18ffa25aec6c (diff) | |
Fix GL information fetching.
Diffstat (limited to 'src')
| -rw-r--r-- | src/wx/gl_video_view.cc | 12 | ||||
| -rw-r--r-- | src/wx/gl_video_view.h | 6 | ||||
| -rw-r--r-- | src/wx/system_information_dialog.cc | 24 |
3 files changed, 35 insertions, 7 deletions
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<char const *>(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<GLenum, std::string> information () const { + return _information; + } + private: void set_image (std::shared_ptr<const Image> image); void set_image_and_draw (); @@ -86,4 +90,6 @@ private: bool _setup_shaders_done = false; std::shared_ptr<wxTimer> _timer; + + std::map<GLenum, std::string> _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<Fil add (_("OpenGL version"), true); add (_("unknown (OpenGL not enabled in DCP-o-matic)"), false); } else { - add (_("OpenGL version"), true); - auto v = reinterpret_cast<char const *>(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); } |
