From 805a781f0aea04a424bb2bc585b16d884ec955ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 1 Apr 2021 22:41:28 +0200 Subject: [PATCH] python: adapt to GL::Context changes. --- src/python/magnum/gl.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/python/magnum/gl.cpp b/src/python/magnum/gl.cpp index 262ac4a..6d897a3 100644 --- a/src/python/magnum/gl.cpp +++ b/src/python/magnum/gl.cpp @@ -26,6 +26,7 @@ #include #include /* for Mesh.buffers */ #include +#include #include #include #include @@ -384,12 +385,27 @@ void gl(py::module_& m) { /** @todo context switching (needs additions to the "who owns current context instance" variable -- a map?) */ .def_property_readonly("version", &GL::Context::version, "OpenGL version") - .def_property_readonly("vendor_string", &GL::Context::vendorString, "Vendor string") - .def_property_readonly("renderer_string", &GL::Context::rendererString, "Renderer string") - .def_property_readonly("version_string", &GL::Context::versionString, "Version string") - .def_property_readonly("shading_language_version_string", &GL::Context::shadingLanguageVersionString, "Shading language version string") - .def_property_readonly("shading_language_version_strings", &GL::Context::shadingLanguageVersionStrings, "Shading language version strings") - .def_property_readonly("extension_strings", &GL::Context::extensionStrings, "Extension strings") + /** @todo find a way to go directly to python's str */ + .def_property_readonly("vendor_string", [](GL::Context& self) { + return std::string{self.vendorString()}; + }, "Vendor string") + .def_property_readonly("renderer_string", [](GL::Context& self) { + return std::string{self.rendererString()}; + }, "Renderer string") + .def_property_readonly("version_string", [](GL::Context& self) { + return std::string{self.versionString()}; + }, "Version string") + .def_property_readonly("shading_language_version_string", [](GL::Context& self) { + return std::string{self.shadingLanguageVersionString()}; + }, "Shading language version string") + .def_property_readonly("shading_language_version_strings", [](GL::Context& self) { + const Containers::Array strings = self.shadingLanguageVersionStrings(); + return std::vector{strings.begin(), strings.end()}; + }, "Shading language version strings") + .def_property_readonly("extension_strings", [](GL::Context& self) { + Containers::Array strings = self.extensionStrings(); + return std::vector{strings.begin(), strings.end()}; + }, "Extension strings") #ifndef MAGNUM_TARGET_WEBGL .def_property_readonly("flags", &GL::Context::flags, "Context flags") #endif