+ // check if swap interval value is supported
+ EGLint val;
+ eglGetConfigAttrib(display, config, EGL_MIN_SWAP_INTERVAL, &val);
+ if (i < val) {
+ fprintf(stderr, "Cannot set swap interval to %d, minimum supported value is %d\n", i, val);
+ exit(1);
+ }
+ eglGetConfigAttrib(display, config, EGL_MAX_SWAP_INTERVAL, &val);
+ if (i > val) {
+ fprintf(stderr, "Cannot set swap interval to %d, maximum supported value is %d\n", i, val);
+ exit(1);
+ }
+ // use it
+ if (eglSwapInterval(display, i) == EGL_FALSE)
+ exitEglError("Failed to set swap interval");