Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EGL vs GLES 2.0 on Android (e.g. Java)

(experienced c programmer, pre-shader, fixed function open gl. competent Java programmer)

I have been working with GLES on Android and have gotten the examples to run (both native and Java). In particular, the textured triangle example. What is completely confusing me is the "relationship" of Khronos EGL and the android GLES interfaces.

Are these parallel, independent interfaces (API)? Is EGL supposed to be a platform independent (neutral) interface? EGL appears to fully support GLES 1.0 and 1.1 but does not support ES 2.0 (on Android)?

So, it appears to me that EGL is supposed to be a platform neutral, parallel interface, BUT it does not fully support GLES 2.0 (on Android); So if you're writing GLES 2.0 code (on Android), you are better off just using the GLxxx API rather than the EGLxxx API (and having to resort to the GLxxx API anyway). As far as I can tell, you don't >HAVE< to use EGL for anything since it only supports a subset of the ES 2.0 API.

(Every example/book/reference either mixes the two, uses the native interface or uses only EGL 1.1 features; Am I missing something fundamental here?)

like image 467
Vanderdeckken Avatar asked Jun 28 '11 16:06

Vanderdeckken


People also ask

Does Android use EGL?

Android uses the OpenGL ES (GLES) API to render graphics. To create GLES contexts and provide a windowing system for GLES renderings, Android uses the EGL library. GLES calls render textured polygons, while EGL calls put renderings on screens.

What is EGL rendering?

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 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).

Does Android use OpenGL?

OpenGL in Android is a graphics library that is used for 2D and 3D graphics development in Android applications. OpenGL provides cross-platform APIs. It processes high-performance data transfer between CPU and GPU. OpenGL supports the android native development kit(NDK) for graphics features development.


1 Answers

EGL is a complement to OpenGL ES. EGL is used for getting surfaces to render to using functions like eglCreateWindowSurface, and you can then draw to that surface with OpenGL ES. Its role is similar to GLX/WGL/CGL.

Whether or not EGL can give you a context that supports OpenGL ES 2.0 may vary by platform, but if the Android device supports ES 2.0 and EGL, you should be able to get such a context from EGL. Take a look at the EGL_RENDERABLE_TYPE attribute and the EGL_OPENGL_ES2_BIT when requesting an EGLConfig.

http://www.khronos.org/files/egl-1-4-quick-reference-card.pdf

like image 103
sholte Avatar answered Sep 20 '22 18:09

sholte