Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
The SwapInterval APIs should fail without a current OpenGL context.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jul 18, 2011
1 parent 6662f4d commit 379fcdc
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/video/SDL_video.c
Expand Up @@ -2510,8 +2510,10 @@ SDL_GL_SetSwapInterval(int interval)
if (!_this) {
SDL_UninitializedVideo();
return -1;
}
if (_this->GL_SetSwapInterval) {
} else if (_this->current_glctx == NULL) {
SDL_SetError("No OpenGL context has been made current");
return -1;
} else if (_this->GL_SetSwapInterval) {
return _this->GL_SetSwapInterval(_this, interval);
} else {
SDL_SetError("Setting the swap interval is not supported");
Expand All @@ -2525,8 +2527,10 @@ SDL_GL_GetSwapInterval(void)
if (!_this) {
SDL_UninitializedVideo();
return -1;
}
if (_this->GL_GetSwapInterval) {
} else if (_this->current_glctx == NULL) {
SDL_SetError("No OpenGL context has been made current");
return -1;
} else if (_this->GL_GetSwapInterval) {
return _this->GL_GetSwapInterval(_this);
} else {
SDL_SetError("Getting the swap interval is not supported");
Expand Down

0 comments on commit 379fcdc

Please sign in to comment.