KOalaDelYtaPLaYa
KOalaDelYtaPLaYa

Reputation: 157

Please explain to me what exactly is EGL in Android?

Recently I am working with bigflake.com CameraToMpeg example where we can see how to make use of OpenGLES. One of the last steps is to initialize EGL14 to record the current OPNEGLES context and swap it to MediaCodec.

My question is however: What is exactly EGL14? Why EGL14 is a mechanism for creating surfaces onto which OPENGLES can render, since when in a simple OPENGLES I never initialize EGL14? Is it an additional class, or indispensable for OPENGLES operations? How does EGL know what is the current OPENGLES context? What else can I do with that, for example am I able to make a context with a concrete texture in OPENGLES? Where to find some more documentation about it - books?

Upvotes: 8

Views: 3477

Answers (1)

Vlad
Vlad

Reputation: 5847

The OpenGL, or OpenGL ES - is everything about rendering within some environment. It doesn't know or care about what exactly that environment is. As long as it provides required list of compliant functions that can be called to achieve desired result - that's OpenGL for you.

Now how do you create that environment? Since it's not OpenGL's responsibility, it has to be done by someone else, and it has to be done in a way that is compliant with rules of the system that hosts the rendering application.

That's where the EGL place is - it defines an API that gets translated to underlying windowing system calls by some library. Like GLX and WGL is responsible for creation of OpenGL context on Linux and Windows, EGL is responsible for creation of OpenGL ES context in embedded systems. Android is not the only platform that's using EGL, pretty much all the Linux-capable single-SoC ARM computers will expose EGL API, so apps would be able to create a valid rendering context.

If you never used EGL api - then it means you never wrote the native applications for Android, or some other java class (like GLSurfaceView) is wrapping up things for you. Look at the basic GLES examples, you'll find lots of references to EGL stuff. At the minimum you'd be asked to provide the EGLConfigChooser, or at least give some parameters to implicitly created EGLConfigChoser.

Upvotes: 9

Related Questions