Fixed bug 1342 - SDL_CreateRenderer creates OpenGL ES 2.0 renderer in iPhone 3G using default index (-1)
authorSam Lantinga
Sat, 07 Jan 2012 22:34:51 -0500
changeset 6179a83eb92704f3
parent 6178 1fc633857667
child 6180 744ae9bdf5da
Fixed bug 1342 - SDL_CreateRenderer creates OpenGL ES 2.0 renderer in iPhone 3G using default index (-1)

The uikit code wasn't checking to make sure the context was successfully created.
src/video/uikit/SDL_uikitopengles.m
src/video/uikit/SDL_uikitopenglview.m
     1.1 --- a/src/video/uikit/SDL_uikitopengles.m	Sat Jan 07 22:33:58 2012 -0500
     1.2 +++ b/src/video/uikit/SDL_uikitopengles.m	Sat Jan 07 22:34:51 2012 -0500
     1.3 @@ -115,6 +115,9 @@
     1.4                                      depthBits: _this->gl_config.depth_size
     1.5                                      stencilBits: _this->gl_config.stencil_size
     1.6                                      majorVersion: _this->gl_config.major_version];
     1.7 +    if (!view) {
     1.8 +        return NULL;
     1.9 +    }
    1.10  
    1.11      data->view = view;
    1.12      view->viewcontroller = data->viewcontroller;
     2.1 --- a/src/video/uikit/SDL_uikitopenglview.m	Sat Jan 07 22:33:58 2012 -0500
     2.2 +++ b/src/video/uikit/SDL_uikitopenglview.m	Sat Jan 07 22:34:51 2012 -0500
     2.3 @@ -75,6 +75,7 @@
     2.4          }
     2.5          if (!context || ![EAGLContext setCurrentContext:context]) {
     2.6              [self release];
     2.7 +            SDL_SetError("OpenGL ES %d not supported", majorVersion);
     2.8              return nil;
     2.9          }
    2.10