目錄
- 一. EGL 前言
- 二. EGL 繪制流程簡介
- 三.eglDestroySurface 函式簡介
- 四.eglDestroySurface 使用
- 四.猜你喜歡
零基礎 OpenGL ES 學習路線推薦 : OpenGL ES 學習目錄 >> OpenGL ES 基礎
零基礎 OpenGL ES 學習路線推薦 : OpenGL ES 學習目錄 >> OpenGL ES 特效
零基礎 OpenGL ES 學習路線推薦 : OpenGL ES 學習目錄 >> OpenGL ES 轉場
零基礎 OpenGL ES 學習路線推薦 : OpenGL ES 學習目錄 >> OpenGL ES 函式
零基礎 OpenGL ES 學習路線推薦 : OpenGL ES 學習目錄 >> OpenGL ES GPUImage 使用
零基礎 OpenGL ES 學習路線推薦 : OpenGL ES 學習目錄 >> OpenGL ES GLSL 編程
一. EGL 前言
EGLNativeDisplayType – 系統顯示型別,標識你所開發設備的物理螢屏,DX/OPenGL ES/Metal/Vulkan….
EGLNativeWindowType – 系統視窗,渲染顯示的視窗句柄
EGLDisplay – 關聯 EGLNativeDisplayType 系統物理螢屏的通用資料型別,是平臺上 WGL / GLX / AGL 的等價物
EGLSurface – 渲染區域,相當于 OpenGL ES 繪圖的畫布 (一塊記憶體空間),用戶想繪制的資訊首先都要先繪制到 EGLSurface 上,然后通過 EGLDisplay 顯示
EGLConfig – 對 EGLSurface 的 EGL 配置,可以理解為繪制目標 framebuffer 的配置屬性
EGLContext – OpenGL ES 圖形背景關系
二. EGL 繪制流程簡介
- 獲取 EGL Display 物件:eglGetDisplay
- 初始化與 EGLDisplay 之間的連接:eglInitialize
- 獲取 EGLConfig 物件:eglChooseConfig / eglGetConfigs
- 創建 EGLContext 實體:eglCreateContext
- 創建 EGLSurface 實體:eglCreateWindowSurface / eglCreatePbufferSurface
- 連接 EGLContext 和 EGLSurface 背景關系 eglMakeCurrent
- 使用 OpenGL ES API 繪制圖形:gl_*
- 切換 front buffer 和 back buffer 顯示:eglSwapBuffer
- 斷開并釋放與 EGLSurface 關聯的 EGLContext 物件:eglRelease
- 洗掉 EGLSurface 物件 eglDestroySurface
- 洗掉 EGLContext 物件 eglDestroyContext
- 終止與 EGLDisplay 之間的連接

三.eglDestroySurface 函式簡介
eglDestroySurface 用于銷毀渲染 EGLSurface(記憶體畫布),如果有其它執行緒使用這個 EGLSurface 時就要等到不使用時再銷毀,否則立即銷毀;
/*描述:用于銷毀渲染 EGLSurface
*引數:
* display:指定顯示的連接
* context:EGLContext 背景關系
*
*回傳值:成功是回傳 EGL_TRUE,失敗時回傳 EGL_FALSE
*/
EGLAPI EGLBoolean eglDestroySurface(EGLDisplay display,
EGLSurface surface);
可能回傳錯誤:
EGL_FALSE is returned if destruction of the context fails, EGL_TRUE otherwise.
EGL_BAD_DISPLAY is generated if display is not an EGL display connection.
EGL_NOT_INITIALIZED is generated if display has not been initialized.
EGL_BAD_SURFACE is generated if surface is not an EGL surface.
類似 eglDestroyContext 摧毀背景關系一樣 ,eglDestroySurface** 摧毀EGLSurface** 之前一定要記得通過 eglMakeCurrent 系結當前背景關系;
四.eglDestroySurface 使用
/******************************************************************************************/
//@Author:猿說編程
//@Blog(個人博客地址): www.codersrc.com
//@File:OpenGL ES EGL eglDestroySurface
//@Time:2022/08/04 07:30
//@Motto:不積跬步無以至千里,不積小流無以成江海,程式人生的精彩需要堅持不懈地積累!
/******************************************************************************************/
void egl_demo()
{
EGLDisplay display = eglGetDisplay ( EGL_DEFAULT_DISPLAY );
eglInitialize ( display , 0, 0);
EGLConfig config;
eglChooseConfig ( display , attribs , & config , 1, & numConfigs );
EGLSurface surface = eglCreateWindowSurface ( display , config , ANativeWindow , NULL );
EGLContext context = eglCreateContext ( display , config , NULL , NULL );
eglMakeCurrent ( display , surface , surface , context )
while(true){
//opengl繪制
glxx();
eglSwapBuffers ( display , surface );
}
eglDestroyContext ( display , context );
eglDestroySurface ( display , surface );
eglTerminate ( display );
}
四.猜你喜歡
- OpenGL ES 簡介
- OpenGL ES 版本介紹
- OpenGL ES 2.0 和 3.0 區別
- OpenGL ES 名詞解釋(一)
- OpenGL ES 名詞解釋(二)
- OpenGL ES GLSL 著色器使用程序
- OpenGL ES EGL 簡介
- OpenGL ES EGL 名詞解釋
- OpenGL ES EGL eglGetDisplay
- OpenGL ES EGL eglInitialize
- OpenGL ES EGL eglGetConfigs
- OpenGL ES EGL eglChooseConfig
- OpenGL ES EGL eglGetError
- OpenGL ES EGL eglCreateContext
- OpenGL ES EGL eglCreateWindowSurface
- OpenGL ES EGL eglCreatePbufferSurface
- OpenGL ES EGL eglMakeCurrent
- OpenGL ES EGL eglSwapBuffer
- OpenGL ES EGL eglDestroySurface
- OpenGL ES EGL eglDestroyContext
本文由博客 - 猿說編程 猿說編程 發布!
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/531546.html
標籤:其他
上一篇:K-最近鄰-有多少參考點/特征?
下一篇:ValueError:如果您的資料具有單個特征,則使用array.reshape(-1,1)重塑您的資料,如果它包含單個樣本,則使用array.reshape(1,-1)
