diff --git a/tests/egl_ext_enumerate.py b/tests/egl_ext_enumerate.py new file mode 100644 index 00000000..29042bbf --- /dev/null +++ b/tests/egl_ext_enumerate.py @@ -0,0 +1,27 @@ +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) 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[:int(count)]: + print(device) + else: + print('No device_query extension available') + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/tests/os_egl.py b/tests/os_egl.py index f5140675..1f90f8a9 100644 --- a/tests/os_egl.py +++ b/tests/os_egl.py @@ -85,7 +85,7 @@ def egl_context( if ctx == EGL_NO_CONTEXT: raise RuntimeError( 'Unable to create context' ) eglMakeCurrent( display, surface, surface, ctx ) - yield ctx,surface + yield display,ctx,surface content = glReadPixelsub(0,0, width, height, GL_RGB, outputType=None) if output: write_ppm(content, output) @@ -93,10 +93,11 @@ def egl_context( def main(): with egl_context() as setup: - ctx,surface = setup + display,ctx,surface = setup glClearColor(1.0,1.0,1.0,1.0) glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) + if __name__ == '__main__': logging.basicConfig(level=logging.INFO) main()