File: egl_ext_enumerate.py

package info (click to toggle)
pyopengl 3.1.10%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,024 kB
  • sloc: python: 108,056; sh: 13; makefile: 8
file content (36 lines) | stat: -rw-r--r-- 1,168 bytes parent folder | download | duplicates (2)
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
33
34
35
36
from os_egl import egl_context
from OpenGL import EGL
from OpenGL.EGL.EXT import device_query, device_enumeration
from OpenGL.GL import GLint


def main():
    with egl_context(output=None, pbuffer=True) as context:
        display, context, surface = context
        print("Vendor: %s" % (EGL.eglQueryString(display, EGL.EGL_VENDOR)))
        print("Version: %s" % (EGL.eglQueryString(display, EGL.EGL_VERSION)))
        print("Extensions: %s" % (EGL.eglQueryString(display, EGL.EGL_EXTENSIONS),))
        print(
            "Client Extensions: %s"
            % (EGL.eglQueryString(display, EGL.EGL_CLIENT_APIS),)
        )
        if device_enumeration.eglQueryDevicesEXT:
            devices = (device_query.EGLDeviceEXT * 5)()
            count = GLint()
            device_enumeration.eglQueryDevicesEXT(
                5,
                devices,
                count,
            )
            for device in devices[: count.value]:
                print(device)
        else:
            print('No device_query extension available')
        print('OK')


if __name__ == "__main__":
    import logging

    logging.basicConfig(level=logging.DEBUG)
    main()