Search code examples
egl

EGL guide for beginners


I'd like to get into EGL. However, the "only" I've been able to find is the API reference. Searching for "egl guide", "egl tutorial" or "egl for beginners" hasn't succeeded. Does anyone know of a good resource?

EGL may not be a "library for beginners". In that case, I guess I should start from the beginning - but, what's the beginning? I just read that EGL is an abstraction layer over system-dependent drawing APIs, thus being the "correct" way to go. Wayland uses it, and so does kmscon. Looking into their source code, though, has only given me a headache.

P.S.: As a side note, I feel more comfortable with C++ (although I guess that, if it works on C, it should work too on C++). Also, I'm using the latest kernel, with the latest Mesa release, so I guess there's support available for EGL.


Solution

  • To begin learning EGL, I recommend the following resources.

    • The OpenGL ES 3.0 Programming Guide from Addison-Wesley provides a good tutorial on using EGL with OpenGL ES, complete with example code on Github. The book's text provides an introduction to the parts of EGL that are independent of operating system. To cover the operating system specific parts, the book's example code provides a complete program that works on each major operating system. (Addison-Wesley is the publisher of many well-known OpenGL books, such as The Red Book and the OpenGL SuperBible).

      Dan Ginsburg, Budirijanto Purnomo, Dave Shreiner, Aaftab Munshi. OpenGL ES 3.0 Programming Guide, 2e, Chapter 3: An Introduction to EGL. Addison-Wesley, 2014. ISBN-13: 978-0-321-93388-1, ISBN-13: 978-0-13-344016-4.

    • As you're learning, keep by your side the official EGL 1.4 Quick Reference Card.

    • (Linux only) The example code in the EGL_EXT_platform_x11 extension specification demonstrates how to create an X11 window and produce an EGLSurface from that window. (The example programs from the OpenGL ES 3.0 Programming Guide also demonstrates how to do this, but you may find the more focused treatment in the EGL_EXT_platform_x11 specification easier to follow).

    • (Linux only) Likewise, the EGL_MESA_platform_gbm extension specification demonstrates how to do the same, but for GBM, a headless EGL backend supported by opensource Linux drivers.(The OpenGL ES 3.0 Programming Guide does not touch GBM).

    Depending on your goals, you may also find useful the following low-level resources, all found in the Khronos EGL Registry.