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

Commit

Permalink
Optimization suggested by Ryan:
Browse files Browse the repository at this point in the history
Don't set the same OpenGL context multiple times
  • Loading branch information
slouken committed Aug 15, 2007
1 parent eb6619e commit e9f192a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/video/SDL_sysvideo.h
Expand Up @@ -126,6 +126,7 @@ struct SDL_Window

int display;
SDL_Renderer *renderer;
SDL_GLContext context;

void *userdata;
void *driverdata;
Expand Down
6 changes: 6 additions & 0 deletions src/video/SDL_video.c
Expand Up @@ -2566,6 +2566,12 @@ SDL_GL_MakeCurrent(SDL_WindowID windowID, SDL_GLContext context)
if (!context) {
window = NULL;
}
if (window) {
if (window->context == context) {
return 0;
}
window->context = context;
}
return _this->GL_MakeCurrent(_this, window, context);
}

Expand Down

0 comments on commit e9f192a

Please sign in to comment.