日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

OpenGL ES EGL eglDestroyContext

發(fā)布時間:2024/3/13 编程问答 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 OpenGL ES EGL eglDestroyContext 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

目錄

  • 一. EGL 前言
  • 二. EGL 繪制流程簡介
  • 三.eglDestroyContext 函數(shù)簡介
  • 四.eglDestroyContext 使用
  • 四.猜你喜歡

零基礎 OpenGL ES 學習路線推薦 : OpenGL ES 學習目錄 >> OpenGL ES 基礎

零基礎 OpenGL ES 學習路線推薦 : OpenGL ES 學習目錄 >> OpenGL ES 特效

零基礎 OpenGL ES 學習路線推薦 : OpenGL ES 學習目錄 >> OpenGL ES 轉(zhuǎn)場

零基礎 OpenGL ES 學習路線推薦 : OpenGL ES 學習目錄 >> OpenGL ES 函數(shù)

零基礎 OpenGL ES 學習路線推薦 : OpenGL ES 學習目錄 >> OpenGL ES GPUImage 使用

零基礎 OpenGL ES 學習路線推薦 : OpenGL ES 學習目錄 >> OpenGL ES GLSL 編程

一. EGL 前言

EGLNativeDisplayType – 系統(tǒng)顯示類型,標識你所開發(fā)設備的物理屏幕,DX/OPenGL ES/Metal/Vulkan….

EGLNativeWindowType – 系統(tǒng)窗口,渲染顯示的窗口句柄

EGLDisplay – 關(guān)聯(lián) EGLNativeDisplayType 系統(tǒng)物理屏幕的通用數(shù)據(jù)類型,是平臺上 WGL / GLX / AGL 的等價物

EGLSurface – 渲染區(qū)域,相當于 OpenGL ES 繪圖的畫布 (一塊內(nèi)存空間),用戶想繪制的信息首先都要先繪制到 EGLSurface 上,然后通過 EGLDisplay 顯示

EGLConfig – 對 EGLSurface 的 EGL 配置,可以理解為繪制目標 framebuffer 的配置屬性

EGLContext – OpenGL ES 圖形上下文

二. EGL 繪制流程簡介

  • 獲取 EGL Display 對象:eglGetDisplay
  • 初始化與 EGLDisplay 之間的連接:eglInitialize
  • 獲取 EGLConfig 對象:eglChooseConfig / eglGetConfigs
  • 創(chuàng)建 EGLContext 實例:eglCreateContext
  • 創(chuàng)建 EGLSurface 實例:eglCreateWindowSurface / eglCreatePbufferSurface
  • 連接 EGLContext 和 EGLSurface 上下文 eglMakeCurrent
  • 使用 OpenGL ES API 繪制圖形:gl_*
  • 切換 front buffer 和 back buffer 顯示:eglSwapBuffer
  • 斷開并釋放與 EGLSurface 關(guān)聯(lián)的 EGLContext 對象:eglRelease
  • 刪除 EGLSurface 對象 eglDestroySurface
  • 刪除 EGLContext 對象 eglDestroyContext
  • 終止與 EGLDisplay 之間的連接
  • 三.eglDestroyContext 函數(shù)簡介

    eglDestroyContext 用于銷毀渲染 Context 上下文,如果有其它線程使用這個 Context 上下文時就要等到不使用時再銷毀,否則立即銷毀;

    /*描述:用于銷毀渲染 EGLContext*參數(shù):* display:指定顯示的連接* context:EGLContext 上下文**返回值:成功是返回 EGL_TRUE,失敗時返回 EGL_FALSE*/EGLAPI EGLBoolean eglDestroyContext(EGLDisplay display,EGLContext context);

    可能返回錯誤:

    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_CONTEXT is generated if context is not an EGL rendering context.

    在使用 eglDestroyContext 摧毀上下文之前一定要記得通過 eglMakeCurrent 綁定當前上下文;

    四.eglDestroyContext 使用

    /******************************************************************************************/ //@Author:猿說編程 //@Blog(個人博客地址): www.codersrc.com //@File:OpenGL ES EGL eglDestroyContext //@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 區(qū)別
  • 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
  • 總結(jié)

    以上是生活随笔為你收集整理的OpenGL ES EGL eglDestroyContext的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。