public void onSurfaceCreated(GL10 unused, EGLConfig config) { // if onSurfaceCreated is called while resuming from pause, // it means the GL context was lost paused.compareAndSet(1, -1); // assign high priority to the rendering thread java.lang.Thread.currentThread() .setPriority(java.lang.Thread.MAX_PRIORITY); // set swap interval if (swapInterval != 1) { var eglDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY); EGL14.eglSwapInterval(eglDisplay, swapInterval); } }