src/video/SDL_video.c
changeset 8145 663d7d9de9bf
parent 8117 988502081380
child 8149 681eb46b8ac4
     1.1 --- a/src/video/SDL_video.c	Thu Jan 30 12:30:40 2014 -0800
     1.2 +++ b/src/video/SDL_video.c	Wed Jan 29 18:38:13 2014 -0800
     1.3 @@ -477,39 +477,7 @@
     1.4      /* Set some very sane GL defaults */
     1.5      _this->gl_config.driver_loaded = 0;
     1.6      _this->gl_config.dll_handle = NULL;
     1.7 -    _this->gl_config.red_size = 3;
     1.8 -    _this->gl_config.green_size = 3;
     1.9 -    _this->gl_config.blue_size = 2;
    1.10 -    _this->gl_config.alpha_size = 0;
    1.11 -    _this->gl_config.buffer_size = 0;
    1.12 -    _this->gl_config.depth_size = 16;
    1.13 -    _this->gl_config.stencil_size = 0;
    1.14 -    _this->gl_config.double_buffer = 1;
    1.15 -    _this->gl_config.accum_red_size = 0;
    1.16 -    _this->gl_config.accum_green_size = 0;
    1.17 -    _this->gl_config.accum_blue_size = 0;
    1.18 -    _this->gl_config.accum_alpha_size = 0;
    1.19 -    _this->gl_config.stereo = 0;
    1.20 -    _this->gl_config.multisamplebuffers = 0;
    1.21 -    _this->gl_config.multisamplesamples = 0;
    1.22 -    _this->gl_config.retained_backing = 1;
    1.23 -    _this->gl_config.accelerated = -1;  /* accelerated or not, both are fine */
    1.24 -    _this->gl_config.profile_mask = 0;
    1.25 -#if SDL_VIDEO_OPENGL
    1.26 -    _this->gl_config.major_version = 2;
    1.27 -    _this->gl_config.minor_version = 1;
    1.28 -#elif SDL_VIDEO_OPENGL_ES2
    1.29 -    _this->gl_config.major_version = 2;
    1.30 -    _this->gl_config.minor_version = 0;
    1.31 -    _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES;   
    1.32 -#elif SDL_VIDEO_OPENGL_ES
    1.33 -    _this->gl_config.major_version = 1;
    1.34 -    _this->gl_config.minor_version = 1;
    1.35 -    _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES;
    1.36 -#endif
    1.37 -    _this->gl_config.flags = 0;
    1.38 -    
    1.39 -    _this->gl_config.share_with_current_context = 0;
    1.40 +    SDL_GL_ResetAttributes();
    1.41  
    1.42      _this->current_glwin_tls = SDL_TLSCreate();
    1.43      _this->current_glctx_tls = SDL_TLSCreate();
    1.44 @@ -2547,6 +2515,49 @@
    1.45  #endif
    1.46  }
    1.47  
    1.48 +void
    1.49 +SDL_GL_ResetAttributes()
    1.50 +{
    1.51 +    if (!_this) {
    1.52 +        return;
    1.53 +    }
    1.54 +
    1.55 +    _this->gl_config.red_size = 3;
    1.56 +    _this->gl_config.green_size = 3;
    1.57 +    _this->gl_config.blue_size = 2;
    1.58 +    _this->gl_config.alpha_size = 0;
    1.59 +    _this->gl_config.buffer_size = 0;
    1.60 +    _this->gl_config.depth_size = 16;
    1.61 +    _this->gl_config.stencil_size = 0;
    1.62 +    _this->gl_config.double_buffer = 1;
    1.63 +    _this->gl_config.accum_red_size = 0;
    1.64 +    _this->gl_config.accum_green_size = 0;
    1.65 +    _this->gl_config.accum_blue_size = 0;
    1.66 +    _this->gl_config.accum_alpha_size = 0;
    1.67 +    _this->gl_config.stereo = 0;
    1.68 +    _this->gl_config.multisamplebuffers = 0;
    1.69 +    _this->gl_config.multisamplesamples = 0;
    1.70 +    _this->gl_config.retained_backing = 1;
    1.71 +    _this->gl_config.accelerated = -1;  /* accelerated or not, both are fine */
    1.72 +    _this->gl_config.profile_mask = 0;
    1.73 +#if SDL_VIDEO_OPENGL
    1.74 +    _this->gl_config.major_version = 2;
    1.75 +    _this->gl_config.minor_version = 1;
    1.76 +#elif SDL_VIDEO_OPENGL_ES2
    1.77 +    _this->gl_config.major_version = 2;
    1.78 +    _this->gl_config.minor_version = 0;
    1.79 +    _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES;
    1.80 +#elif SDL_VIDEO_OPENGL_ES
    1.81 +    _this->gl_config.major_version = 1;
    1.82 +    _this->gl_config.minor_version = 1;
    1.83 +    _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES;
    1.84 +#endif
    1.85 +    _this->gl_config.flags = 0;
    1.86 +    _this->gl_config.framebuffer_srgb_capable = 0;
    1.87 +
    1.88 +    _this->gl_config.share_with_current_context = 0;
    1.89 +}
    1.90 +
    1.91  int
    1.92  SDL_GL_SetAttribute(SDL_GLattr attr, int value)
    1.93  {