mirror of
https://github.com/yawut/SDL.git
synced 2026-09-09 01:26:24 -05:00
Optimization suggested by Ryan:
Don't set the same OpenGL context multiple times
This commit is contained in:
@@ -126,6 +126,7 @@ struct SDL_Window
|
||||
|
||||
int display;
|
||||
SDL_Renderer *renderer;
|
||||
SDL_GLContext context;
|
||||
|
||||
void *userdata;
|
||||
void *driverdata;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user