-
Initialization: Glamor initializes EGL by creating an EGL display connection to the underlying graphics hardware. This is typically done using the eglGetDisplay() function, which takes a native display handle as an argument. For example, on Linux, this could be an EGLNativeDisplayType obtained from the X server.
-
Configuring EGL: Glamor then configures EGL by selecting an appropriate EGL configuration that matches the desired pixel format, color depth, and other attributes. This is done using the eglChooseConfig() function. The selected configuration is then used to create an EGL surface for rendering.
-
Creating EGL surfaces: Glamor creates an EGL window surface using the eglCreateWindowSurface() function, passing in the native window handle (e.g., an X window ID) and the selected EGL configuration. This surface will be used to render the graphics and display them on the screen.
-
Creating EGL contexts: Glamor creates an EGL context using the eglCreateContext() function, which is associated with the EGL display and the selected EGL configuration. The context is used to manage the OpenGL state and rendering commands.
-
Rendering: Glamor uses OpenGL or OpenGL ES functions to render graphics onto the EGL surface. The rendering commands are issued within the EGL context, and the results are stored in the EGL surface's buffer.
-
Displaying: To display the rendered graphics on the screen, Glamor calls the eglSwapBuffers() function, which swaps the front and back buffers of the EGL surface, making the rendered content visible on the screen.
-
Cleanup: When Glamor is done rendering and displaying graphics, it cleans up the EGL resources by destroying the EGL context, surface, and display connection using the eglDestroyContext(), eglDestroySurface(), and eglTerminate() functions, respectively.