Beispiel #1
0
 def __del__(self):
     egl.eglTerminate(self._display_connection)
Beispiel #2
0
print("Surface id: ", surface)

# Bind the API:
result = libegl.eglBindAPI(libegl.EGL_OPENGL_API)
assert result == 1, "Failed to bind EGL_OPENGL_API"

# Create a context:
context_attribs = (EGL_CONTEXT_MAJOR_VERSION, 2, EGL_NONE)
context_attrib_array = (libegl.EGLint * len(context_attribs))(*context_attribs)
context = libegl.eglCreateContext(display_connection, egl_config, None,
                                  context_attrib_array)
print("Context id: ", context)

# Make context current:
result = libegl.eglMakeCurrent(display_connection, surface, surface, context)
assert result == 1, "Failed to make context current"

error_code = libegl.eglGetError()
assert error_code == EGL_SUCCESS, "EGL Error code {} returned".format(
    error_code)

# Print some context details:
buffer_type = libegl.EGLint()
libegl.eglQueryContext(display_connection, context, EGL_RENDER_BUFFER,
                       buffer_type)
print("Buffer type: ", _buffer_types.get(buffer_type.value, "Unknown"))
print("API type: ", _api_types.get(libegl.eglQueryAPI(), "Unknown"))

# Terminate EGL:
libegl.eglTerminate(display_connection)