Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the relationship between EGL and OpenGL?

I'm writing an implementation for OpenVG and OpenGL|ES in Go, both of which depend on the Khronos EGL API, supposedly to ease portability I guess.

I'm writing an implementation of OpenVG on top of OpenGL ES for fun and educational reasons - I haven't done a lot of rendering work and I'd like to learn more about the open APIs and practice implementing well defined standards (easier to see if I got the right results).

As I understand it, EGL provides a standard API for retrieving a drawing context (or what ever it's rightly called,) instead of using one of the multiple OS provided APIs (GLX, WGL etc)

enter image description here

I have a hard time believing Khronos would go through such effort and leave the standard OpenGL out of the loop but the thing is, I haven't found how or if OpenGL (the real deal) interfaces with EGL or if it's only OpenGL ES. If OpenGL ES can use the drawing context from EGL, would standard OpenGL also work?

I'm really new to all of this which is why I'm excited but the real project I'm doing is a Go widget toolkit that utilizes OpenVG for its drawing operations and uses hardware acceleration wherever possible.

If OpenVG, OpenGL and OpenGL ES depend on EGL, I think my question can be answered with "yes" or "no". Just keep in mind that I dove into this subject head-first last night.

Does OpenGL use or depend on EGL?


Off topic, but there is no EGL tag. Should there be?

like image 533
hannson Avatar asked Aug 10 '11 20:08

hannson


People also ask

What is EGL OpenGL?

EGL (Native Platform Graphics Interface) EGL Native Platform Graphics Interface is an interface portable layer for graphics resource management - and works between rendering APIs such as OpenGL ES or OpenVG and the underlying native platform window system.

What is EGL display?

EGLDevice. EGLDevice provides a mechanism to access graphics functionality in the absence of or without reference to a native window system. It is a method to initialize EGL displays and surfaces directly on top of GPUs/devices rather than native window system objects.

What is the difference between OpenGL and OpenGL ES?

The main difference between the two is that OpenGL ES is made for embedded systems like smartphones, while OpenGL is the one on desktops. On the coding level, OpenGL ES does not support fixed-function functions like glBegin/glEnd etc... OpenGL can support fixed-function pipeline (using a compatibility profile).

What is EGL context?

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.


2 Answers

You can bind EGL_OPENGL_API as the current API for your thread, via the eglBindAPI(EGLenum api); a subsequent eglCreateContext will create an OpenGL rendering context.

From the EGL spec, p42:

Some of the functions described in this section make use of the current rendering API, which is set on a per-thread basis by calling

EGLBoolean eglBindAPI(EGLenum api);

api must specify one of the supported client APIs , either EGL_OPENGL_API, EGL_OPENGL_ES_API, or EGL_OPENVG_API

The caveat is that the EGL implementation is well within its rights not support EGL_OPENGL_API and instead generate an EGL_BAD_PARAMETER error if you try to bind it.

It's also hard to link to libGL without picking up the AGL/WGL/GLX cruft; the ABI on these platforms require that libGL provides those entry points. Depending on what platform you're playing with this may or may not be a problem.

like image 89
RAOF Avatar answered Oct 12 '22 23:10

RAOF


Does OpenGL use or depend on EGL?

No. You can run OpenGL without EGL.

But is possible to have EGL implementation capable to create desktop OpenGL context. That's because EGL's eglBindAPI(int api) allows EGL_OPENGL_API, EGL_OPENGL_ES_API, or EGL_OPENVG_API.

But if you ask:

Does OpenGL-ES use or depend on EGL?

The answer is yes, but there are exceptions.

Currently (2015), you have several implementations of OpenGL-ES that rely on EGL to create graphics context: Google ANGLE, PowerVR, ARM MALI, Adreno, AMD, Mesa, etc.

But on recent releases of NVIDIA and Intel drivers you can also request OpenGL-ES contexts directly, where extensions WGL_EXT_create_context_es_profile and WGL_EXT_create_context_es2_profile are available (Windows). Same thing on Unix platforms where GLX_EXT_create_context_es_profile and GLX_EXT_create_context_es2_profile extensions are available.

The intent of EGL is to ease developers' lives by creating a portable and standard way to initialize and get context of supported graphics API, without worrying about platform specific issues, as WGL, GLX, etc. That is a problem of EGL implementers, not final programmer.

like image 36
Alex Byrth Avatar answered Oct 13 '22 00:10

Alex Byrth