我可以在OSX中使用EGL吗?

时间:2021-11-28 18:59:22

I am trying to use Cairo library in a C++ application utilizing its GL acceleration in Mac. (I made same tests with its Quartz backend but the performance was disappointing.) It says it supports EGL and GLX. Use of GLX requires (externally installed) XQuartz and opens an XWindow so I lean towards EGL:

我试图在C ++应用程序中使用Cairo库,利用它在Mac中的GL加速。 (我用Quartz后端进行了相同的测试,但性能令人失望。)它说它支持EGL和GLX。使用GLX需要(外部安装)XQuartz并打开XWindow,所以我倾向于EGL:

Apple's programming guide pages tell to use NSOpenGL*, which this page and others say it uses CGL.

Apple的编程指南页面告诉使用NSOpenGL *,该页面和其他人说它使用CGL。

This (2012) page says Mac has EAGL and it is only similar to EGL (I suppose it refers to IOS, not MAC as its EAGL reference links to IOS help pages).

这个(2012)页面说Mac有EAGL,它只与EGL类似(我认为它指的是IOS,而不是MAC,因为它的EAGL参考链接到IOS帮助页面)。

Angle says it supports EGL but it is for Direct3D in windows, as I understand(?)

Angle说它支持EGL,但它适用于Windows中的Direct3D,据我所知(?)

GLFW v3 is also said to support (in future releases?) but via GLX, it is said (?).

据说GLFW v3支持(在未来的版本中?)但是通过GLX,它被称为(?)。

Mali says it has a simulator for Mac but I don't know if it is accelerated or is only for its hardware (it also says it only supports a subset of EGL on different platforms).

Mali表示它有一个适用于Mac的模拟器,但我不知道它是加速还是仅用于其硬件(它还说它只支持不同平台上的EGL子集)。

Most of the links refer to mobile when EGL is used. I am using Mac OS 10.8 and XCode 4.6. What is the current situation / How can I (if I can) use EGL in Mac (now)?

当使用EGL时,大多数链接指的是移动设备。我使用的是Mac OS 10.8和XCode 4.6。目前的情况如何/我如何(如果可以的话)在Mac(现在)中使用EGL?

3 个解决方案

#1


0  

yes. cairo has been ported to use nsopengl. I will show you howto. amd sample code if you are interested. performance is much faster than quaetz gl.

是。 cairo已被移植到使用nsopengl。我会告诉你如何。如果您有兴趣,可以使用示例代码。性能比quaetz gl快得多。

#2


0  

Here it is https://github.com/SRA-SiliconValley/cairogles/

这是https://github.com/SRA-SiliconValley/cairogles/

clone cairo, checkout branch nsgl. This cairo is our fork of cairo 1.12.14 that has the following enhancement vs the upstream cairo

clone cairo,checkout branch nsgl。这个cairo是我们的cairo 1.12.14的分支,与上游cairo相比具有以下增强功能

  1. support OpenGL ES 3.0, and support OpenGL ES 2.0 angle MSAA extension
  2. 支持OpenGL ES 3.0,并支持OpenGL ES 2.0角度MSAA扩展

  3. new convex tessellator for fill circle for msaa compositor
  4. 用于msaa合成器的填充圆的新凸曲面细分器

  5. new cairo API - cairo_rounded_rectangle() - it is optimized for MSAA compositor
  6. 新的cairo API - cairo_rounded_rectangle() - 它针对MSAA合成器进行了优化

  7. support gaussian blur for four backends: GL/GLES, quartz, xcb and image
  8. 支持四个后端的高斯模糊:GL / GLES,石英,xcb和图像

  9. support drop shadow and inset for four backends: GL/GLES, quartz, xcv and image with shaow cache
  10. 支持四个后端的投影和插入:GL / GLES,石英,xcv和带有shaow缓存的图像

  11. support faster stroke when stroke width = 1 - we call hairline stroke
  12. 当笔划宽度= 1时支持更快的笔划 - 我们称之为发际线笔画

  13. add integration for NSOpenGL
  14. 为NSOpenGL添加集成

  15. various bug fixes and optimization.
  16. 各种错误修复和优化。

On Mac OSX, you have two choices: GLX or NSOpenGL - they are mutually exclusive. You can get mesa glx from macport. 1. To compile for NSOpenGL - ./configure --prefix=your_install_location --enable-gl=yes --enable-nsgl=yes --enable-glx=no --enable-egl=no

在Mac OSX上,您有两种选择:GLX或NSOpenGL - 它们是互斥的。你可以从macport获得mesa glx。 1.编译NSOpenGL - ./configure --prefix = your_install_location --enable-gl = yes --enable-nsgl = yes --enable-glx = no --enable-egl = no

  1. To compile for GLX - ./configure --prefix=your_install_location --enable-gl=yes --enable-glx=yes --enable-nsgl=no --enable-egl=no.
  2. 要编译GLX - ./configure --prefix = your_install_location --enable-gl = yes --enable-glx = yes --enable-nsgl = no --enable-egl = no。

If you are interested in egl (no available on mac, but mesa 9.1+ on linux and various embedded platform form has egl) do ./configure --prefix=your_install_location --enable-gl=no --enable-egl=yes --enable-glesv2=yes --enable-glesv3= no ===== this compiles for gles2 drivers.

如果你对egl感兴趣(在mac上没有,但是linux上的mesa 9.1+以及各种嵌入式平台表格有egl)./configure --prefix = your_install_location --enable-gl = no --enable-egl = yes - -enable-glesv2 = yes --enable-glesv3 = no =====这为gles2驱动程序编译。

./confgure --prefix=your_install_location --enable-gl=no --enable-egl=yes --enable-glesv2=no --enable-glesv3=yes ==== this compiles for glesv3 driver (mesa 9.1+ has glesv3)

./confgure --prefix = your_install_location --enable-gl = no --enable-egl = yes --enable-glesv2 = no --enable-glesv3 = yes ====这为glesv3驱动程序编译(mesa 9.1+已经glesv3)

you can have CFLAGS="-g" for debug or CFLAGS="-O2" for optimization.

您可以使用CFLAGS =“ - g”进行调试,或者使用CFLAGS =“ - O2”进行优化。

cairo gl/gles has 3 GL compositors (rendering paths for GL/GLES backend). The default one is span compositor which is software simulation of AA and is slow. If your driver supports MSAA, use msaa compositor. To use MSAA compositor, you can export CAIRO_GL_COMPOSITOR=msaa in terminal, or you can setenv() in your program.

cairo gl / gles有3个GL合成器(GL / GLES后端的渲染路径)。默认的是span compositor,它是AA的软件模拟并且很慢。如果您的驱动程序支持MSAA,请使用msaa compositor。要使用MSAA合成器,可以在终端中导出CAIRO_GL_COMPOSITOR = msaa,也可以在程序中输出setenv()。

I have sample code to show cairo for quartz, xcv, image, glx, gel or nsgl. If you are interested, I can send you.

我有示例代码来显示石英,xcv,图像,glx,凝胶或nsgl的cairo。如果您有兴趣,我可以发给您。

Any bug reports/patches are welcome. I have not have time to get wgl (MS windows) to work yet. Additional, it would be nice to have a d3d backend for cairo, I just don't have time to do that - on the todo list.

欢迎任何错误报告/补丁。我还没有时间让wgl(MS windows)工作。另外,对于cairo有一个d3d后端会很好,我只是没有时间去做 - 在todo列表上。

Enjoy

#3


0  

You definitely can use angle:

你绝对可以使用角度:

#define GL_GLEXT_PROTOTYPES
#include <GLES2/gl2.h>
#include <EGL/egl.h>

#1


0  

yes. cairo has been ported to use nsopengl. I will show you howto. amd sample code if you are interested. performance is much faster than quaetz gl.

是。 cairo已被移植到使用nsopengl。我会告诉你如何。如果您有兴趣,可以使用示例代码。性能比quaetz gl快得多。

#2


0  

Here it is https://github.com/SRA-SiliconValley/cairogles/

这是https://github.com/SRA-SiliconValley/cairogles/

clone cairo, checkout branch nsgl. This cairo is our fork of cairo 1.12.14 that has the following enhancement vs the upstream cairo

clone cairo,checkout branch nsgl。这个cairo是我们的cairo 1.12.14的分支,与上游cairo相比具有以下增强功能

  1. support OpenGL ES 3.0, and support OpenGL ES 2.0 angle MSAA extension
  2. 支持OpenGL ES 3.0,并支持OpenGL ES 2.0角度MSAA扩展

  3. new convex tessellator for fill circle for msaa compositor
  4. 用于msaa合成器的填充圆的新凸曲面细分器

  5. new cairo API - cairo_rounded_rectangle() - it is optimized for MSAA compositor
  6. 新的cairo API - cairo_rounded_rectangle() - 它针对MSAA合成器进行了优化

  7. support gaussian blur for four backends: GL/GLES, quartz, xcb and image
  8. 支持四个后端的高斯模糊:GL / GLES,石英,xcb和图像

  9. support drop shadow and inset for four backends: GL/GLES, quartz, xcv and image with shaow cache
  10. 支持四个后端的投影和插入:GL / GLES,石英,xcv和带有shaow缓存的图像

  11. support faster stroke when stroke width = 1 - we call hairline stroke
  12. 当笔划宽度= 1时支持更快的笔划 - 我们称之为发际线笔画

  13. add integration for NSOpenGL
  14. 为NSOpenGL添加集成

  15. various bug fixes and optimization.
  16. 各种错误修复和优化。

On Mac OSX, you have two choices: GLX or NSOpenGL - they are mutually exclusive. You can get mesa glx from macport. 1. To compile for NSOpenGL - ./configure --prefix=your_install_location --enable-gl=yes --enable-nsgl=yes --enable-glx=no --enable-egl=no

在Mac OSX上,您有两种选择:GLX或NSOpenGL - 它们是互斥的。你可以从macport获得mesa glx。 1.编译NSOpenGL - ./configure --prefix = your_install_location --enable-gl = yes --enable-nsgl = yes --enable-glx = no --enable-egl = no

  1. To compile for GLX - ./configure --prefix=your_install_location --enable-gl=yes --enable-glx=yes --enable-nsgl=no --enable-egl=no.
  2. 要编译GLX - ./configure --prefix = your_install_location --enable-gl = yes --enable-glx = yes --enable-nsgl = no --enable-egl = no。

If you are interested in egl (no available on mac, but mesa 9.1+ on linux and various embedded platform form has egl) do ./configure --prefix=your_install_location --enable-gl=no --enable-egl=yes --enable-glesv2=yes --enable-glesv3= no ===== this compiles for gles2 drivers.

如果你对egl感兴趣(在mac上没有,但是linux上的mesa 9.1+以及各种嵌入式平台表格有egl)./configure --prefix = your_install_location --enable-gl = no --enable-egl = yes - -enable-glesv2 = yes --enable-glesv3 = no =====这为gles2驱动程序编译。

./confgure --prefix=your_install_location --enable-gl=no --enable-egl=yes --enable-glesv2=no --enable-glesv3=yes ==== this compiles for glesv3 driver (mesa 9.1+ has glesv3)

./confgure --prefix = your_install_location --enable-gl = no --enable-egl = yes --enable-glesv2 = no --enable-glesv3 = yes ====这为glesv3驱动程序编译(mesa 9.1+已经glesv3)

you can have CFLAGS="-g" for debug or CFLAGS="-O2" for optimization.

您可以使用CFLAGS =“ - g”进行调试,或者使用CFLAGS =“ - O2”进行优化。

cairo gl/gles has 3 GL compositors (rendering paths for GL/GLES backend). The default one is span compositor which is software simulation of AA and is slow. If your driver supports MSAA, use msaa compositor. To use MSAA compositor, you can export CAIRO_GL_COMPOSITOR=msaa in terminal, or you can setenv() in your program.

cairo gl / gles有3个GL合成器(GL / GLES后端的渲染路径)。默认的是span compositor,它是AA的软件模拟并且很慢。如果您的驱动程序支持MSAA,请使用msaa compositor。要使用MSAA合成器,可以在终端中导出CAIRO_GL_COMPOSITOR = msaa,也可以在程序中输出setenv()。

I have sample code to show cairo for quartz, xcv, image, glx, gel or nsgl. If you are interested, I can send you.

我有示例代码来显示石英,xcv,图像,glx,凝胶或nsgl的cairo。如果您有兴趣,我可以发给您。

Any bug reports/patches are welcome. I have not have time to get wgl (MS windows) to work yet. Additional, it would be nice to have a d3d backend for cairo, I just don't have time to do that - on the todo list.

欢迎任何错误报告/补丁。我还没有时间让wgl(MS windows)工作。另外,对于cairo有一个d3d后端会很好,我只是没有时间去做 - 在todo列表上。

Enjoy

#3


0  

You definitely can use angle:

你绝对可以使用角度:

#define GL_GLEXT_PROTOTYPES
#include <GLES2/gl2.h>
#include <EGL/egl.h>