Commit d05ada52 authored by Ryan C. Gordon's avatar Ryan C. Gordon

The SwapInterval APIs should fail without a current OpenGL context.

parent b77354e7
...@@ -2510,8 +2510,10 @@ SDL_GL_SetSwapInterval(int interval) ...@@ -2510,8 +2510,10 @@ SDL_GL_SetSwapInterval(int interval)
if (!_this) { if (!_this) {
SDL_UninitializedVideo(); SDL_UninitializedVideo();
return -1; return -1;
} } else if (_this->current_glctx == NULL) {
if (_this->GL_SetSwapInterval) { SDL_SetError("No OpenGL context has been made current");
return -1;
} else if (_this->GL_SetSwapInterval) {
return _this->GL_SetSwapInterval(_this, interval); return _this->GL_SetSwapInterval(_this, interval);
} else { } else {
SDL_SetError("Setting the swap interval is not supported"); SDL_SetError("Setting the swap interval is not supported");
...@@ -2525,8 +2527,10 @@ SDL_GL_GetSwapInterval(void) ...@@ -2525,8 +2527,10 @@ SDL_GL_GetSwapInterval(void)
if (!_this) { if (!_this) {
SDL_UninitializedVideo(); SDL_UninitializedVideo();
return -1; return -1;
} } else if (_this->current_glctx == NULL) {
if (_this->GL_GetSwapInterval) { SDL_SetError("No OpenGL context has been made current");
return -1;
} else if (_this->GL_GetSwapInterval) {
return _this->GL_GetSwapInterval(_this); return _this->GL_GetSwapInterval(_this);
} else { } else {
SDL_SetError("Getting the swap interval is not supported"); SDL_SetError("Getting the swap interval is not supported");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment