src/video/SDL_video.c
changeset 7091 ff07fad908f8
parent 7089 257fc4e541e1
child 7107 2fcf7bf1d2b2
equal deleted inserted replaced
7090:c4ac8be0065b 7091:ff07fad908f8
  2688 int
  2688 int
  2689 SDL_GL_MakeCurrent(SDL_Window * window, SDL_GLContext ctx)
  2689 SDL_GL_MakeCurrent(SDL_Window * window, SDL_GLContext ctx)
  2690 {
  2690 {
  2691     int retval;
  2691     int retval;
  2692 
  2692 
  2693     CHECK_WINDOW_MAGIC(window, -1);
       
  2694 
       
  2695     if (!(window->flags & SDL_WINDOW_OPENGL)) {
       
  2696         return SDL_SetError("The specified window isn't an OpenGL window");
       
  2697     }
       
  2698     if (!ctx) {
  2693     if (!ctx) {
  2699         window = NULL;
  2694         window = NULL;
       
  2695     } else {
       
  2696         CHECK_WINDOW_MAGIC(window, -1);
       
  2697 
       
  2698         if (!(window->flags & SDL_WINDOW_OPENGL)) {
       
  2699             return SDL_SetError("The specified window isn't an OpenGL window");
       
  2700         }
  2700     }
  2701     }
  2701 
  2702 
  2702     if ((window == _this->current_glwin) && (ctx == _this->current_glctx)) {
  2703     if ((window == _this->current_glwin) && (ctx == _this->current_glctx)) {
  2703         retval = 0;  /* we're already current. */
  2704         retval = 0;  /* we're already current. */
  2704     } else {
  2705     } else {
  2756 SDL_GL_DeleteContext(SDL_GLContext context)
  2757 SDL_GL_DeleteContext(SDL_GLContext context)
  2757 {
  2758 {
  2758     if (!_this || !context) {
  2759     if (!_this || !context) {
  2759         return;
  2760         return;
  2760     }
  2761     }
  2761     _this->GL_MakeCurrent(_this, NULL, NULL);
  2762 
       
  2763     if (_this->current_glctx == context) {
       
  2764         SDL_GL_MakeCurrent(NULL, NULL);
       
  2765     }
       
  2766 
  2762     _this->GL_DeleteContext(_this, context);
  2767     _this->GL_DeleteContext(_this, context);
  2763 }
  2768 }
  2764 
  2769 
  2765 #if 0                           // FIXME
  2770 #if 0                           // FIXME
  2766 /*
  2771 /*