File: glinfo.py

package info (click to toggle)
python-pyqtgraph 0.14.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 8,168 kB
  • sloc: python: 54,831; makefile: 128; ansic: 40; sh: 2
file content (32 lines) | stat: -rw-r--r-- 901 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from ..Qt import QtGui
from ..Qt import OpenGLConstants as GLC
from ..Qt import OpenGLHelpers


def print_version(funcs):
    glGetString = funcs.glGetString
    print('VENDOR:', glGetString(GLC.GL_VENDOR))
    print('RENDERER:', glGetString(GLC.GL_RENDERER))
    print('VERSION:', glGetString(GLC.GL_VERSION))
    print('GLSL_VERSION:', glGetString(GLC.GL_SHADING_LANGUAGE_VERSION))


def print_extensions(ctx):
    extensions = sorted([ext.data().decode() for ext in ctx.extensions()])
    print("Extensions:")
    for ext in extensions:
        print(f"   {ext}")


app = QtGui.QGuiApplication([])
surf = QtGui.QOffscreenSurface()
surf.create()
ctx = QtGui.QOpenGLContext()
ctx.create()
ctx.makeCurrent(surf)

print("openGLModuleType:", QtGui.QOpenGLContext.openGLModuleType())
print('isOpenGLES:', ctx.isOpenGLES())
glfn = OpenGLHelpers.getFunctions(ctx)
print_version(glfn)
print_extensions(ctx)