SDL: Clean up GL context

This commit is contained in:
Jeffrey Pfau 2015-06-26 02:15:05 -07:00
parent 8e8ca17ba3
commit bd2c472cb3
4 changed files with 6 additions and 2 deletions

View File

@ -84,6 +84,7 @@ Misc:
- GBA: More accurate cycle estimation for ROM prefetch and flash save chips
- ARM7: Reduce the size of the Thumb instruction table
- GBA: Don't include GBACLIDebugger struct unless needed
- SDL: Clean up GL context
0.2.1: (2015-05-13)
Bugfixes:

View File

@ -51,7 +51,7 @@ bool GBASDLGLInit(struct SDLSoftwareRenderer* renderer) {
#if SDL_VERSION_ATLEAST(2, 0, 0)
renderer->window = SDL_CreateWindow(projectName, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, renderer->viewportWidth, renderer->viewportHeight, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | (SDL_WINDOW_FULLSCREEN_DESKTOP * renderer->player.fullscreen));
SDL_GL_CreateContext(renderer->window);
renderer->glCtx = SDL_GL_CreateContext(renderer->window);
SDL_GL_SetSwapInterval(1);
SDL_GetWindowSize(renderer->window, &renderer->viewportWidth, &renderer->viewportHeight);
renderer->player.window = renderer->window;
@ -109,4 +109,7 @@ void GBASDLGLDeinit(struct SDLSoftwareRenderer* renderer) {
renderer->gl.d.deinit(&renderer->gl.d);
}
free(renderer->d.outputBuffer);
#if SDL_VERSION_ATLEAST(2, 0, 0)
SDL_GL_DeleteContext(renderer->glCtx);
#endif
}

View File

@ -176,5 +176,4 @@ static void GBASDLDeinit(struct SDLSoftwareRenderer* renderer) {
renderer->deinit(renderer);
SDL_Quit();
}

View File

@ -45,6 +45,7 @@ struct SDLSoftwareRenderer {
SDL_Window* window;
SDL_Texture* sdlTex;
SDL_Renderer* sdlRenderer;
SDL_GLContext* glCtx;
#endif
int viewportWidth;