目录

  • 一. EGL 前言
  • 二. EGL 绘制流程简介
  • 三.eglQueryContext 函数简介
  • 四.eglQueryContext 使用
  • 四.猜你喜欢

零基础 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 绘制流程简介

  1. 获取 EGL Display 对象:eglGetDisplay
  2. 初始化与 EGLDisplay 之间的连接:eglInitialize
  3. 获取 EGLConfig 对象:eglChooseConfig / eglGetConfigs
  4. 创建 EGLContext 实例:eglCreateContext
  5. 创建 EGLSurface 实例:eglCreateWindowSurface / eglCreatePbufferSurface
  6. 连接 EGLContext 和 EGLSurface 上下文 eglMakeCurrent
  7. 使用 OpenGL ES API 绘制图形:gl_*
  8. 切换 front buffer 和 back buffer 显示:eglSwapBuffer
  9. 断开并释放与 EGLSurface 关联的 EGLContext 对象:eglRelease
  10. 删除 EGLSurface 对象 eglDestroySurface
  11. 删除 EGLContext 对象 eglDestroyContext
  12. 终止与 EGLDisplay 之间的连接

三.eglQueryContext 函数简介

eglQueryContext 用于查询渲染上下文相关信息,函数声明如下:

/*描述:用于查询渲染上下文相关信息*参数:*    display:指定显示的连接*    context:EGLContext 上下文*    attribute:查询渲染上下文相关信息 EGL_CONFIG_ID、EGL_CONTEXT_CLIENT_TYPE、EGL_CONTEXT_CLIENT_VERSION*     value:(输出参数)返回查询结果*返回值:成功是返回 EGL_TRUE,失败时返回 EGL_FALSE*/EGLBoolean eglQueryContext(   EGLDisplay display,EGLContext context,EGLint attribute,EGLint * value);

attribute 可以为下面值:

EGL_CONFIG_ID
Returns the ID of the EGL frame buffer configuration with respect to which the context was created.EGL_CONTEXT_CLIENT_TYPE
Returns the type of client API which the context supports (one of EGL_OPENGL_API, EGL_OPENGL_ES_API, or EGL_OPENVG_API).EGL_CONTEXT_CLIENT_VERSION
Returns the version of the client API which the context supports, as specified at context creation time. The resulting value is only meaningful for an OpenGL ES context.EGL_RENDER_BUFFER
Returns the buffer which client API rendering via the context will use. The value returned depends on properties of both the context, and the surface to which the context is bound:If the context is bound to a pixmap surface, then EGL_SINGLE_BUFFER will be returned.If the context is bound to a pbuffer surface, then EGL_BACK_BUFFER will be returned.If the context is bound to a window surface, then either EGL_BACK_BUFFER or EGL_SINGLE_BUFFER may be returned. The value returned depends on both the buffer requested by the setting of the EGL_RENDER_BUFFER property of the surface (which may be queried by calling eglQuerySurface), and on the client API (not all client APIs support single-buffer rendering to window surfaces).If the context is not bound to a surface, such as an OpenGL ES context bound to a framebuffer object, then EGL_NONE will be returned.Notes
Attributes EGL_CONTEXT_CLIENT_TYPE and EGL_RENDER_BUFFER are supported only if the EGL version is 1.2 or greater.Attribute EGL_CONTEXT_CLIENT_VERSION is supported only if the EGL version is 1.3 or greater.

可能返回错误:

EGL_FALSE is returned on failure, EGL_TRUE otherwise. value is not modified when EGL_FALSE is returned.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.EGL_BAD_ATTRIBUTE is generated if attribute is not a valid context attribute.

类似 eglDestroyContext 摧毁上下文一样 ,eglQueryContext** 使用**之前一定要记得通过 eglMakeCurrent 绑定当前上下文;

四.eglQueryContext 使用

/******************************************************************************************/
//@Author:猿说编程
//@Blog(个人博客地址): www.codersrc.com
//@File:OpenGL ES EGL eglQueryContext
//@Time:2022/08/04 07:30
//@Motto:不积跬步无以至千里,不积小流无以成江海,程序人生的精彩需要坚持不懈地积累!
/******************************************************************************************///创建上下文
EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE };
EGLContext  context = eglCreateContext ( display , config , EGL_NO_CONTEXT, contextAttribs );//绑定上下文
eglMakeCurrent ( display , surface , surface , context )//查询 OpenGL 版本
int clientVersion;
eglQueryContext(m_eglDisplay, m_eglContext, EGL_CONTEXT_CLIENT_VERSION, &clientVersion);//clientVersion = 3
printf("EGLContext created, client version %d\n", clientVersion);//摧毁上下文
eglDestroyContext ( display , context );
eglDestroySurface ( display , surface );
eglTerminate ( display );

四.猜你喜欢

  1. OpenGL ES 简介
  2. OpenGL ES 版本介绍
  3. OpenGL ES 2.0 和 3.0 区别
  4. OpenGL ES 名词解释(一)
  5. OpenGL ES 名词解释(二)
  6. OpenGL ES GLSL 着色器使用过程
  7. OpenGL ES EGL 简介
  8. OpenGL ES EGL 名词解释
  9. OpenGL ES EGL eglGetDisplay
  10. OpenGL ES EGL eglInitialize
  11. OpenGL ES EGL eglGetConfigs
  12. OpenGL ES EGL eglChooseConfig
  13. OpenGL ES EGL eglGetError
  14. OpenGL ES EGL eglCreateContext
  15. OpenGL ES EGL eglCreateWindowSurface
  16. OpenGL ES EGL eglCreatePbufferSurface
  17. OpenGL ES EGL eglMakeCurrent
  18. OpenGL ES EGL eglSwapBuffer
  19. OpenGL ES EGL eglDestroySurface
  20. OpenGL ES EGL eglDestroyContext
  21. OpenGL ES EGL eglQueryContext

OpenGL ES EGL eglQueryContext相关推荐

  1. OpenGL ES EGL eglDestroyContext

    目录 一. EGL 前言 二. EGL 绘制流程简介 三.eglDestroyContext 函数简介 四.eglDestroyContext 使用 四.猜你喜欢 零基础 OpenGL ES 学习路线 ...

  2. OpenGL ES EGL eglCreatePbufferSurface

    目录 一. EGL 前言 二. EGL 绘制流程简介 三.eglCreatePbufferSurface 函数简介 1.eglCreatePbufferSurface 简介 2.eglCreatePb ...

  3. OpenGL ES EGL eglDestroySurface

    目录 一. EGL 前言 二. EGL 绘制流程简介 三.eglDestroySurface 函数简介 四.eglDestroySurface 使用 四.猜你喜欢 零基础 OpenGL ES 学习路线 ...

  4. OpenGL ES EGL 简介

    目录 一.EGL 简介 二.EGL 跨平台之 ANGLE 1.ANGLE 支持跨平台 2.ANGLE 支持渲染器 3.ANGLE 下载地址 三.EGL 坐标系 四.EGL 绘图步骤 五.猜你喜欢 零基 ...

  5. OpenGL ES EGL eglSwapBuffer

    目录 一. EGL 前言 二. EGL 绘制流程简介 三.eglSwapBuffer 函数简介 四.关于多个 EGLContext 五.共享 EGLContext 六.猜你喜欢 零基础 OpenGL ...

  6. OpenGL ES EGL TLS(线程局部存储) G3D

    1. 什么是EGL EGL是用来管理绘图表面的(Drawing surfaces),并且提供了如下的机制 (1) 与本地窗口系统进行通信 (2) 查找绘图表面可用的类型和配置信息 (3) 创建绘图表面 ...

  7. OpenGL ES glut glew glfw glad freeglut

    目录 一.简介 1.freeglut 2.glew 3.glut 4.glfw 5.glad 二.分类 1.窗口管理 2.函数加载 三.组合使用 1.freeglut + glew 2.glfw + ...

  8. OpenGL ES glfw 下载和使用

    目录 一.glfw 简介 二.glfw 下载 三.glfw 编译 四.glfw 使用 1.OpenGL glfw + glad 效果演示 2.OpenGL glfw + glad <源码下载&g ...

  9. OpenGL ES freeglut 下载和使用

    目录 一.freeglut 简介 二.freeglut 下载 五.猜你喜欢 零基础 OpenGL ES 学习路线推荐 : OpenGL ES 学习目录 >> OpenGL ES 基础 零基 ...

最新文章

  1. pip不是内部 pycharm_PyCharm的简单使用
  2. 详细解读Volley(二)—— ImageRequest Request简介
  3. pycharm debug 断点调试
  4. 使用Mule ESB与Groovy编排RESTful服务【转】很适合我们当前的架构
  5. 车辆工程用得到python吗_如今车辆工程真的不如以前了吗?
  6. 吞噬星空怎么会有鸿蒙,论吞噬星空与鸿蒙的关系
  7. MFCWinInet学习
  8. 解决MybatisPlus修改时空字段不修改问题
  9. wttr.in Linux 下查看天气
  10. 数据分析SQL日期维度表生成(含节假日)
  11. 各种网页播放面板代码,MediaPlayer Replayer等
  12. 小程序-JAVA服务端解密与微信绑定的手机号
  13. 阿里云服务器建站、心选建站、定制建站有什么区别,如何选择
  14. (30)zabbix Trapper 监控项配置
  15. ElasticSearch 之 Linux 安装 ElasticSearch-7.15.2(ELK、IK)
  16. vba字典重复key_字典去除重复项问题
  17. CQYZ Online Judge P2995 萨鲁曼的大军(c++)
  18. Big Brother监控安装
  19. 官方yolov5s.pt ,yolo5x.pt下载地址
  20. 数据结构 -- 数组+链表 HashMap

热门文章

  1. 如何从零开始学习软件测试
  2. 数商云B2B跨境电子商务平台综合服务解决方案
  3. idea导入子工程module
  4. WebView 视频播放,全屏按钮显示不出来,全屏后不能播放视频
  5. 主板是计算机所有部分连接的基础,计算机基础相关知识答案
  6. java通过struts实现web中的文件下载
  7. 【iOS】内存五大分区
  8. PCB塞孔和不塞孔到底有什么区别,设计时如何选择塞孔还是不塞孔?
  9. 《Web前端工程师修炼之道》学习笔记
  10. 小米会成为三星没落的因素吗?