=== modified file 'src/screen-sdl-glesv2.cpp'
@@ -45,6 +45,11 @@
return;
}
+ if (SDL_GLES_SetSwapInterval(0) != 0) {
+ fprintf(stderr, "[ Fail ] - GLES set swap interval: %s\n", SDL_GetError());
+ return;
+ }
+
#ifdef _DEBUG
{
int buf, red, green, blue, alpha, depth;
=== modified file 'src/sdlgles/SDL_gles.c'
@@ -377,6 +377,17 @@
return 0;
}
+int SDL_GLES_SetSwapInterval(int interval)
+{
+ if (!eglSwapInterval(egl_display, interval)) {
+ SDL_SetError("EGL failed to set swap interval: %s",
+ get_error_string(eglGetError()));
+ return -1;
+ }
+
+ return 0;
+}
+
void SDL_GLES_SwapBuffers()
{
eglSwapBuffers(egl_display, egl_surface);
=== modified file 'src/sdlgles/SDL_gles.h'
@@ -93,6 +93,12 @@
*/
extern DECLSPEC int SDLCALL SDL_GLES_MakeCurrent(SDL_GLES_Context *context);
+/** Sets the swap interval for the current SDL_GLES context
+ * @param interval 0 for immediate updates, 1 for updates synchronized with the vertical retrace.
+ * @return 0 if everything went OK.
+ */
+extern DECLSPEC int SDLCALL SDL_GLES_SetSwapInterval(int interval);
+
/** Equivalent to SDL_Flip(). Call when you're finished issuing GL calls
* and want to draw the color buffer contents to the window surface.
*/