src/video/x11/SDL_x11opengl.c
changeset 10173 5b0a869a9946
parent 10170 ccdb4d0934e9
equal deleted inserted replaced
10172:b4316ed0c72c 10173:5b0a869a9946
   693     rc = _this->gl_data->glXMakeCurrent(display, drawable, glx_context);
   693     rc = _this->gl_data->glXMakeCurrent(display, drawable, glx_context);
   694     X11_XSetErrorHandler(handler);
   694     X11_XSetErrorHandler(handler);
   695 
   695 
   696     if (errorCode != Success) {   /* uhoh, an X error was thrown! */
   696     if (errorCode != Success) {   /* uhoh, an X error was thrown! */
   697         return -1;  /* the error handler called SDL_SetError() already. */
   697         return -1;  /* the error handler called SDL_SetError() already. */
   698     } else if (!rc) {  /* glxMakeCurrent() failed without throwing an X error */
   698     } else if (!rc) {  /* glXMakeCurrent() failed without throwing an X error */
   699         return SDL_SetError("Unable to make GL context current");
   699         return SDL_SetError("Unable to make GL context current");
   700     }
   700     }
   701 
   701 
   702     return 0;
   702     return 0;
   703 }
   703 }
   704 
   704 
   705 /*
   705 /*
   706    0 is a valid argument to glxSwapInterval(MESA|EXT) and setting it to 0
   706    0 is a valid argument to glXSwapInterval(MESA|EXT) and setting it to 0
   707    will undo the effect of a previous call with a value that is greater
   707    will undo the effect of a previous call with a value that is greater
   708    than zero (or at least that is what the docs say). OTOH, 0 is an invalid
   708    than zero (or at least that is what the docs say). OTOH, 0 is an invalid
   709    argument to glxSwapIntervalSGI and it returns an error if you call it
   709    argument to glXSwapIntervalSGI and it returns an error if you call it
   710    with 0 as an argument.
   710    with 0 as an argument.
   711 */
   711 */
   712 
   712 
   713 static int swapinterval = 0;
   713 static int swapinterval = 0;
   714 int
   714 int
   740         status = 0;
   740         status = 0;
   741         swapinterval = interval;
   741         swapinterval = interval;
   742     } else if (_this->gl_data->glXSwapIntervalMESA) {
   742     } else if (_this->gl_data->glXSwapIntervalMESA) {
   743         status = _this->gl_data->glXSwapIntervalMESA(interval);
   743         status = _this->gl_data->glXSwapIntervalMESA(interval);
   744         if (status != 0) {
   744         if (status != 0) {
   745             SDL_SetError("glxSwapIntervalMESA failed");
   745             SDL_SetError("glXSwapIntervalMESA failed");
   746         } else {
   746         } else {
   747             swapinterval = interval;
   747             swapinterval = interval;
   748         }
   748         }
   749     } else if (_this->gl_data->glXSwapIntervalSGI) {
   749     } else if (_this->gl_data->glXSwapIntervalSGI) {
   750         status = _this->gl_data->glXSwapIntervalSGI(interval);
   750         status = _this->gl_data->glXSwapIntervalSGI(interval);
   751         if (status != 0) {
   751         if (status != 0) {
   752             SDL_SetError("glxSwapIntervalSGI failed");
   752             SDL_SetError("glXSwapIntervalSGI failed");
   753         } else {
   753         } else {
   754             swapinterval = interval;
   754             swapinterval = interval;
   755         }
   755         }
   756     } else {
   756     } else {
   757         SDL_Unsupported();
   757         SDL_Unsupported();