Skip to content

Commit

Permalink
Try to create script to query the egl device enumerations
Browse files Browse the repository at this point in the history
  • Loading branch information
mcfletch committed Dec 29, 2019
1 parent 41e6f57 commit 2487c21
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
27 changes: 27 additions & 0 deletions tests/egl_ext_enumerate.py
Original file line number Diff line number Diff line change
@@ -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()
5 changes: 3 additions & 2 deletions tests/os_egl.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,19 @@ 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)
# eglSwapBuffers( display, surface )

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()

0 comments on commit 2487c21

Please # to comment.