为了方便深入研究OpenGL与EGL的关系,下面最简流程,可以理一下思路.
OpenGL与EGL最基本流程
//1.获取显示器
EGLDisplay display = eglGetDisplay (EGL_DEFAULT_DISPLAY);
//2.初始化显示器
eglInitialize(display , 0, 0);
EGLConfig config;
//3.初始化配置
eglChooseConfig(display , attribs, & config, 1, &numConfigs );
//4.创建surface
EGLSurface surface = eglCreateWindowSurface(display, config, ANativeWindow , NULL);
//5.创建场景
EGLContext context = eglCreateContext (display, config, NULL , NULL);
eglMakeCurrent (display, surface, surface , context);//绑定线程
while(true){
//6.opengl绘制
glxx();
eglSwapBuffers(display , surface );
}
//7.销毁surface
eglDestroyContext( display , context );
//8.销毁场景
eglDestroySurface(display , surface );
eglTerminate(display );