Created
November 25, 2015 11:35
-
-
Save mpersano/3769c3f245169bcb7305 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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