From 9d22923ce98addc7492952338a16cdb558ccc5d0 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 1 Aug 2021 13:40:13 +0200 Subject: Add opengl-info.py I've been needing this for various issues now, see #5730, #5313, #1476 --- scripts/opengl-info.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 scripts/opengl-info.py (limited to 'scripts') diff --git a/scripts/opengl-info.py b/scripts/opengl-info.py new file mode 100644 index 000000000..2c9f886be --- /dev/null +++ b/scripts/opengl-info.py @@ -0,0 +1,26 @@ +from PyQt5.QtGui import QOpenGLContext, QOpenGLVersionProfile, QOffscreenSurface, QGuiApplication + +app = QGuiApplication([]) + +surface = QOffscreenSurface() +surface.create() + +ctx = QOpenGLContext() +ok = ctx.create() +assert ok + +ok = ctx.makeCurrent(surface) +assert ok + +print("GLES: {}".format(ctx.isOpenGLES())) + +vp = QOpenGLVersionProfile() +vp.setVersion(2, 0) + +vf = ctx.versionFunctions(vp) +print("Vendor: {}".format(vf.glGetString(vf.GL_VENDOR))) +print("Renderer: {}".format(vf.glGetString(vf.GL_RENDERER))) +print("Version: {}".format(vf.glGetString(vf.GL_VERSION))) +print("Shading language version: {}".format(vf.glGetString(vf.GL_SHADING_LANGUAGE_VERSION))) + +ctx.doneCurrent() -- cgit v1.2.3-54-g00ecf