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

2019-02-06 02:25发布

(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?)

2条回答
我命由我不由天
2楼-- · 2019-02-06 03:26

EGL on Android doesn’t seem to be properly explained anywhere, but I put together some notes here which hopefully should clarify things.

查看更多
虎瘦雄心在
3楼-- · 2019-02-06 03:31

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

查看更多
登录 后发表回答