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

社会主义新天地 提交于 2019-11-29 11:36:21

问题


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


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/6509588/egl-vs-gles-2-0-on-android-e-g-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!