Skip to content

Instantly share code, notes, and snippets.

@mpersano
Created November 25, 2015 11:35
Show Gist options
  • Save mpersano/3769c3f245169bcb7305 to your computer and use it in GitHub Desktop.
Save mpersano/3769c3f245169bcb7305 to your computer and use it in GitHub Desktop.
// check if OpenGL ES 3.0 is supported
#include <cstdio>
#include <EGL/egl.h>
#ifndef EGL_OPENGL_ES3_BIT
#define EGL_OPENGL_ES3_BIT 0x40
#endif
int
main(int argc, char *argv[])
{
EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(display, 0, 0);
const EGLint attribs[] { EGL_NONE };
EGLConfig config;
EGLint num_configs;
eglChooseConfig(display, attribs, &config, 1, &num_configs);
if (!num_configs) {
fprintf(stderr, "no configs found?\n");
return 1;
}
EGLint conformant;
eglGetConfigAttrib(display, config, EGL_CONFORMANT, &conformant);
struct {
EGLint bit;
const char *name;
} conformant_bits[]
{
#define D(bit) { bit, #bit }
D(EGL_OPENGL_BIT),
D(EGL_OPENGL_ES_BIT),
D(EGL_OPENGL_ES2_BIT),
D(EGL_OPENGL_ES3_BIT),
D(EGL_OPENVG_BIT)
#undef D
};
printf("conformant:");
for (auto& b : conformant_bits) {
if (conformant & b.bit)
printf(" %s", b.name);
}
putchar('\n');
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment