src/render/opengl/SDL_render_gl.c
changeset 12377 84618d571795
parent 11958 d7582d7286aa
child 12381 dc9108cd4340
equal deleted inserted replaced
12376:cfc65d4d49ae 12377:84618d571795
   418         goto error;
   418         goto error;
   419     }
   419     }
   420 
   420 
   421     data = (GL_RenderData *) SDL_calloc(1, sizeof(*data));
   421     data = (GL_RenderData *) SDL_calloc(1, sizeof(*data));
   422     if (!data) {
   422     if (!data) {
   423         GL_DestroyRenderer(renderer);
   423         SDL_free(renderer);
   424         SDL_OutOfMemory();
   424         SDL_OutOfMemory();
   425         goto error;
   425         goto error;
   426     }
   426     }
   427 
   427 
   428     renderer->WindowEvent = GL_WindowEvent;
   428     renderer->WindowEvent = GL_WindowEvent;
   453     renderer->driverdata = data;
   453     renderer->driverdata = data;
   454     renderer->window = window;
   454     renderer->window = window;
   455 
   455 
   456     data->context = SDL_GL_CreateContext(window);
   456     data->context = SDL_GL_CreateContext(window);
   457     if (!data->context) {
   457     if (!data->context) {
   458         GL_DestroyRenderer(renderer);
   458         SDL_free(renderer);
       
   459         SDL_free(data);
   459         goto error;
   460         goto error;
   460     }
   461     }
   461     if (SDL_GL_MakeCurrent(window, data->context) < 0) {
   462     if (SDL_GL_MakeCurrent(window, data->context) < 0) {
   462         GL_DestroyRenderer(renderer);
   463         SDL_GL_DeleteContext(data->context);
       
   464         SDL_free(renderer);
       
   465         SDL_free(data);
   463         goto error;
   466         goto error;
   464     }
   467     }
   465 
   468 
   466     if (GL_LoadFunctions(data) < 0) {
   469     if (GL_LoadFunctions(data) < 0) {
   467         GL_DestroyRenderer(renderer);
   470         SDL_GL_DeleteContext(data->context);
       
   471         SDL_free(renderer);
       
   472         SDL_free(data);
   468         goto error;
   473         goto error;
   469     }
   474     }
   470 
   475 
   471 #ifdef __MACOSX__
   476 #ifdef __MACOSX__
   472     /* Enable multi-threaded rendering */
   477     /* Enable multi-threaded rendering */