Skip to content

Commit

Permalink
Set an error message when SDL_GL_SetAttribute() fails because we can'…
Browse files Browse the repository at this point in the history
…t support

 the attribute on X11.
  • Loading branch information
icculus committed Aug 6, 2007
1 parent 77bebaa commit b20ee01
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/video/x11/SDL_x11gl.c
Expand Up @@ -338,7 +338,8 @@ int X11_GL_MakeCurrent(_THIS)
/* Get attribute data from glX. */
int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
{
int retval;
int retval = -1;
int unsupported = 0;
int glx_attrib = None;

switch( attrib ) {
Expand Down Expand Up @@ -398,23 +399,27 @@ int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
}
return retval;
} else {
return(-1);
unsupported = 1;
}
break;
case SDL_GL_SWAP_CONTROL:
if ( this->gl_data->glXGetSwapIntervalMESA ) {
*value = this->gl_data->glXGetSwapIntervalMESA();
return(0);
} else {
return(-1);
unsupported = 1;
}
break;
default:
return(-1);
unsupported = 1;
break;
}

retval = this->gl_data->glXGetConfig(GFX_Display, glx_visualinfo, glx_attrib, value);

if (unsupported) {
SDL_SetError("OpenGL attribute is unsupported on this system");
} else {
retval = this->gl_data->glXGetConfig(GFX_Display, glx_visualinfo, glx_attrib, value);
}
return retval;
}

Expand Down

0 comments on commit b20ee01

Please sign in to comment.