I'm learning how to use OpenGL ES. I'm not sure if I have clearly understood how the architecture is done when going from drawing something to displaying it. In particular I want to use:
- EGLSurface
- EGL
- SurfaceView
There is a component called GLSurfaceView which ties all these components together. But I prefer to work with each of these independently so that I have a better understanding of how the pieces work.
Correct me if I am wrong about how this works:
EGLSurface is a component created by EGL. You use OpenGL ES (GLES) to draw on the EGLSurface. In order for EGL to create an EGLSurface, you must provide it with a Surface. A SurfaceView provides that Surface but it also provides a view that is eventually used to display what is drawn on the EGLSurface. You use EGL and call the eglCreateWindowSurface function and pass it a Surface that comes from a SurfaceView. EGL then creates an EGLSurface and binds it to the Surface that it was provided. From that point on, when you draw on the EGLSurface and then call eglSwapBuffers, the frame that gets drawn is sent to the Surface which in turn sends it to the SurfaceView where it is displayed.