-
Notifications
You must be signed in to change notification settings - Fork 9
EGL
From https://www.khronos.org/egl :
"EGL™ is an interface between Khronos rendering APIs such as OpenGL ES or OpenVG and the underlying native platform window system. It handles graphics context management, surface/buffer binding, and rendering synchronization and enables high-performance, accelerated, mixed-mode 2D and 3D rendering using other Khronos APIs. EGL also provides interop capability between Khronos to enable efficient transfer of data between APIs – for example between a video subsystem running OpenMAX AL and a GPU running OpenGL ES."
There are many variants of eglinfo.c floating around. We use the one discussed in the forum https://www.raspberrypi.org/forums/viewtopic.php?p=36318 and available on pastebin.
root@raspberrypi3:~# wget -O eglinfo.c https://pastebin.com/raw/Vnje5sEe
root@raspberrypi3:~# gcc -o eglinfo eglinfo.c -lEGL -lGLESv2
root@raspberrypi3:~# ./eglinfo
EGL
Vendor: Broadcom
Version: 1.4
Client APIs: OpenGL_ES OpenVG
Extensions: EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_vg_parent_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_lock_surface EGL_WL_bind_wayland_display
OpenGL ES
Vendor: Broadcom
Renderer: VideoCore IV HW
Version: OpenGL ES 2.0
GLSL version: OpenGL ES GLSL ES 1.00
Extensions: GL_OES_compressed_ETC1_RGB8_texture GL_OES_compressed_paletted_texture GL_OES_texture_npot GL_OES_depth24 GL_OES_vertex_half_float GL_OES_EGL_image GL_OES_EGL_image_external GL_EXT_discard_framebuffer GL_OES_rgb8_rgba8 GL_OES_depth32 GL_OES_mapbuffer GL_EXT_texture_format_BGRA8888 GL_APPLE_rgb_422 GL_EXT_debug_marker
Implementation limits:
GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = 8
GL_MAX_CUBE_MAP_TEXTURE_SIZE = 2048
GL_MAX_FRAGMENT_UNIFORM_VECTORS = 136
GL_MAX_RENDERBUFFER_SIZE = 2048
GL_MAX_TEXTURE_IMAGE_UNITS = 8
GL_MAX_TEXTURE_SIZE = 2048
GL_MAX_VARYING_VECTORS = 8
GL_MAX_VERTEX_ATTRIBS = 8
GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 8
GL_MAX_VERTEX_UNIFORM_VECTORS = 136
GL_MAX_VIEWPORT_DIMS = 2048, 2048
for the sake of completeness:
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
// adjustments to paths might be needed
#include <EGL/egl.h>
#include <EGL/eglplatform.h>
#include <GLES2/gl2.h>
static EGLint const attribute_list[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_NONE
};
static EGLint const context_attribute_list[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
struct gl_limit {
GLint name;
char *string;
int num_args;
};
#define EXPAND(x) x, #x
struct gl_limit limits[] = {
{EXPAND(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS), 1},
{EXPAND(GL_MAX_CUBE_MAP_TEXTURE_SIZE), 1},
{EXPAND(GL_MAX_FRAGMENT_UNIFORM_VECTORS), 1},
{EXPAND(GL_MAX_RENDERBUFFER_SIZE), 1},
{EXPAND(GL_MAX_TEXTURE_IMAGE_UNITS), 1},
{EXPAND(GL_MAX_TEXTURE_SIZE), 1},
{EXPAND(GL_MAX_VARYING_VECTORS), 1},
{EXPAND(GL_MAX_VERTEX_ATTRIBS), 1},
{EXPAND(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS), 1},
{EXPAND(GL_MAX_VERTEX_UNIFORM_VECTORS), 1},
{EXPAND(GL_MAX_VIEWPORT_DIMS), 2},
{0, NULL}
};
int main(int argc, char ** argv)
{
EGLDisplay display;
EGLConfig config;
EGLContext context;
EGLSurface surface;
EGLint num_config;
// create a pbuffer-based surface, and use it
display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(display, NULL, NULL);
eglChooseConfig(display, attribute_list, &config, 1, &num_config);
context = eglCreateContext(display, config, EGL_NO_CONTEXT,
context_attribute_list);
surface = eglCreatePbufferSurface(display, config, NULL);
eglMakeCurrent(display, surface, surface, context);
// query egl-specific strings
char *egl_vendor = (char *)eglQueryString(display, EGL_VENDOR);
char *egl_version = (char *)eglQueryString(display, EGL_VERSION);
char *egl_apis = (char *)eglQueryString(display, EGL_CLIENT_APIS);
char *egl_exts = (char *)eglQueryString(display, EGL_EXTENSIONS);
printf("EGL\n");
printf(" Vendor: %s\n", egl_vendor);
printf(" Version: %s\n", egl_version);
printf(" Client APIs: %s\n", egl_apis);
printf(" Extensions: %s\n", egl_exts);
// query strings
char *vendor = (char *)glGetString(GL_VENDOR);
char *renderer = (char *)glGetString(GL_RENDERER);
char *version = (char *)glGetString(GL_VERSION);
char *glsl_version = (char *)glGetString(GL_SHADING_LANGUAGE_VERSION);
char *exts = (char *)glGetString(GL_EXTENSIONS);
printf("OpenGL ES\n");
printf(" Vendor: %s\n", vendor);
printf(" Renderer: %s\n", renderer);
printf(" Version: %s\n", version);
printf(" GLSL version: %s\n", glsl_version);
printf(" Extensions: %s\n", exts);
printf(" Implementation limits:\n");
// query limits
int i = 0;
for (i = 0; limits[i].name != 0; i++) {
int param[2] = {0, 0};
glGetIntegerv(limits[i].name, param);
if (limits[i].num_args == 1)
printf(" %s = %d\n", limits[i].string, param[0]);
else
printf(" %s = %d, %d\n", limits[i].string, param[0], param[1]);
}
return EXIT_SUCCESS;
}