diff src/video/uikit/SDL_uikitopenglview.m @ 5212:115fff0641ee

Prefer the OpenGL ES 2.0 context when it's available, make it possible to create an OpenGL 2.0 context on iPhoneOS
author Sam Lantinga <slouken@libsdl.org>
date Sun, 06 Feb 2011 10:22:25 -0800
parents 5f09cb749d75
children b530ef003506
line wrap: on
line diff
--- a/src/video/uikit/SDL_uikitopenglview.m	Sun Feb 06 09:02:10 2011 -0800
+++ b/src/video/uikit/SDL_uikitopenglview.m	Sun Feb 06 10:22:25 2011 -0800
@@ -47,6 +47,7 @@
       bBits:(int)bBits \
       aBits:(int)aBits \
       depthBits:(int)depthBits \
+      majorVersion:(int)majorVersion \
 {
     NSString *colorFormat=nil;
     GLuint depthBufferFormat;
@@ -86,8 +87,11 @@
         eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
                                         [NSNumber numberWithBool: retained], kEAGLDrawablePropertyRetainedBacking, colorFormat, kEAGLDrawablePropertyColorFormat, nil];
         
-        context = [[EAGLContext alloc] initWithAPI: kEAGLRenderingAPIOpenGLES1];
-        
+        if (majorVersion > 1) {
+            context = [[EAGLContext alloc] initWithAPI: kEAGLRenderingAPIOpenGLES2];
+        } else {
+            context = [[EAGLContext alloc] initWithAPI: kEAGLRenderingAPIOpenGLES1];
+        }
         if (!context || ![EAGLContext setCurrentContext:context]) {
             [self release];
             return nil;