Fix GL information fetching.
authorCarl Hetherington <cth@carlh.net>
Sat, 11 Sep 2021 23:26:47 +0000 (01:26 +0200)
committerCarl Hetherington <cth@carlh.net>
Mon, 27 Sep 2021 11:41:46 +0000 (13:41 +0200)
src/wx/gl_video_view.cc
src/wx/gl_video_view.h
src/wx/system_information_dialog.cc

index 16d42499bea1d335ed33b59cad9445c7ce48bcc8..7c26ae6169780660c66ada2c5017a5b4d15b2ee3 100644 (file)
@@ -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
index 0186417d2dbc48c65e400361aaffaee8b2296700..bac195fb18016e5758d07a629bb48b8d71514a90 100644 (file)
@@ -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;
 };
index ed93a4ab42f57e5bc7409a760b3679d4dca9af74..1c8dd8d00c2757defff1c1772739bd32aa4c1aac 100644 (file)
@@ -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);
        }