可以从程序员的角度实现EGL吗?

use*_*612 5 opengl freeglut egl

EGL 看起来像是有史以来记录最差的 Khronos 项目,我确实找不到有关该项目的任何具体信息,但它看起来很有前途,最后有一个 GLUT/FreeGlut 的标准化替代方案。

我的观点是,假设我想要在 linux 桌面上的窗口中或没有窗口(没有装饰)的应用程序中使用 EGL 上下文,作为程序员,我应该向谁咨询以获得该 EGL 上下文?例如,如果我使用 QT,那么 QT 是否应该实现 EGL?奥格?我?

gen*_*ult 3

Mesa的 EGL 实现似乎有效。

我在 X11 和 Win32(至少到并包括 Mesa 10.4.7)上将其与 SDL 1.2 一起使用来获取 OpenGL ES 1.1 和 2.0 上下文:

SDL_Surface* display = SDL_SetVideoMode( ..., SDL_SWSURFACE );

SDL_SysWMinfo sysInfo;
SDL_VERSION( &sysInfo.version );
SDL_GetWMInfo( &sysInfo );

// use natDisplay with eglGetDisplay();
// use natWindow with eglCreateWindowSurface();

// X11
sysInfo.info.x11.lock_func();
NativeDisplayType natDisplay = sysInfo.info.x11.display;
NativeWindowType natWindow = sysInfo.info.x11.window;
// do EGL context init here
sysInfo.info.x11.unlock_func();

// Win32
NativeDisplayType natDisplay = GetDC(sysInfo.window);
NativeWindowType natWindow = sysInfo.window;
// do EGL context init here
Run Code Online (Sandbox Code Playgroud)