Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11gl.c @ 4092:2b32a416d202 SDL-1.2
Set an error message when SDL_GL_SetAttribute() fails because we can't support
the attribute on X11.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Mon, 06 Aug 2007 18:36:46 +0000 |
parents | 5ec68276e4de |
children | a1b03ba2fcd0 |
comparison
equal
deleted
inserted
replaced
4091:98b219f9ff17 | 4092:2b32a416d202 |
---|---|
336 } | 336 } |
337 | 337 |
338 /* Get attribute data from glX. */ | 338 /* Get attribute data from glX. */ |
339 int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value) | 339 int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value) |
340 { | 340 { |
341 int retval; | 341 int retval = -1; |
342 int unsupported = 0; | |
342 int glx_attrib = None; | 343 int glx_attrib = None; |
343 | 344 |
344 switch( attrib ) { | 345 switch( attrib ) { |
345 case SDL_GL_RED_SIZE: | 346 case SDL_GL_RED_SIZE: |
346 glx_attrib = GLX_RED_SIZE; | 347 glx_attrib = GLX_RED_SIZE; |
396 } else { | 397 } else { |
397 *value = SDL_TRUE; | 398 *value = SDL_TRUE; |
398 } | 399 } |
399 return retval; | 400 return retval; |
400 } else { | 401 } else { |
401 return(-1); | 402 unsupported = 1; |
402 } | 403 } |
403 break; | 404 break; |
404 case SDL_GL_SWAP_CONTROL: | 405 case SDL_GL_SWAP_CONTROL: |
405 if ( this->gl_data->glXGetSwapIntervalMESA ) { | 406 if ( this->gl_data->glXGetSwapIntervalMESA ) { |
406 *value = this->gl_data->glXGetSwapIntervalMESA(); | 407 *value = this->gl_data->glXGetSwapIntervalMESA(); |
407 return(0); | 408 return(0); |
408 } else { | 409 } else { |
409 return(-1); | 410 unsupported = 1; |
410 } | 411 } |
411 break; | 412 break; |
412 default: | 413 default: |
413 return(-1); | 414 unsupported = 1; |
414 } | 415 break; |
415 | 416 } |
416 retval = this->gl_data->glXGetConfig(GFX_Display, glx_visualinfo, glx_attrib, value); | 417 |
417 | 418 if (unsupported) { |
419 SDL_SetError("OpenGL attribute is unsupported on this system"); | |
420 } else { | |
421 retval = this->gl_data->glXGetConfig(GFX_Display, glx_visualinfo, glx_attrib, value); | |
422 } | |
418 return retval; | 423 return retval; |
419 } | 424 } |
420 | 425 |
421 void X11_GL_SwapBuffers(_THIS) | 426 void X11_GL_SwapBuffers(_THIS) |
422 { | 427 { |