libegl

< EGL for iOS >


Hacking Thursday 

3/14/2014

David Andreoletti

<https://github.com/davidandreoletti/libegl>

What is EGL  ?


EGL is an interface between Khronos rendering APIs (eg: OpenGL ES or OpenVG) and the underlying native platform windowing system.

EGL handles graphics context management, surface/buffer binding, rendering synchronization, and enables "high-performance, accelerated, mixed-mode 2D and 3D rendering using other Khronos APIs."


                                                               Reference on Wikipedia 

EGL in the wild


         Owner :                     Khronos Group Consortium (same as OpenGL)

         Latest   :                      EGL 1.5 (March 2014)
        
         Platforms support  : 
Android, Linux (via Mesa3D),
                                                  Raspberry Pi

        Notable Usage:     Wayland, Mir, SDL

         Missing platform:          iOS

EGL in a nutshell



EGL in a nutshell (2)


       - EGL Display (physical device display)

         - EGL Rendering Surfaces:

             - Window Surface (ie view/window + Open GL ES framebuffer/color buffer)

             - Pixmap Surface (ie image)

             - Pbuffer (Pixel buffer) Surface (ie OpenGL texture)


       - EGL Rendering Contexts:

             - Open GL, Open GL ES, OpenVG

     

EGL in a nutshell (3)


     - Get an handle to the  display 

            display = eglGetDisplay(EGL_DEFAULT_DISPLAY)

     - Select config based on criteria (eg: Window Surface support)

           eglChooseConfig(criteria, config, 1, ...)

    - Create a surface

            surface = eglCreateWindowSurface(display, ..., nativeWindow)

    - Create a rendering context

            context =  eglCreateContext(display, config, ..., attributes)

    - Bind a Surface to a Rendering Context

            eglMakeCurrent(display, surface, surface, context)

EGL in a nutshell (4)


    - Application issues Client API calls (ie OpenGL ES)

        glClearColor(1.0, 1.0, 0.0, 1.0);   // YELLOW color
        glClear(GL_COLOR_BUFFER_BIT);
        glFlush();

     - A Surface posts its color buffer (window surface) to the

       associated native window

        eglSwapBuffers(display, surface)

EGL in a nutshell (5)


     You get something displayed on the screen !!!

libegl: EGL for iOS


          Supported version :           EGL 1.4

          Supported platform:         iOS 4.3+

     

         Rendering Context support:    OpenGL ES  1.1 - 3.0

         EGL Surface Support :       Window Surface (only)

                   

         C Headers: EGL/egl.h, EGL/eglext.h

         Library: libegl.a (static library)

libegl: EGL for iOS







Demo





Thank you !


Get/play with the code

on github.com/davidandreoletti/libegl

libegl: EGL for iOS

By davidandreoletti