From 12b3a7c50bbb155d17d0f6f9984883110968ad8e Mon Sep 17 00:00:00 2001 From: Hakim Hauston Date: Fri, 18 Nov 2016 12:05:50 +0800 Subject: [PATCH] Fix errors for iOS 8 --- .../Classes/GLViewController.m | 2 +- .../Classes/Hello_GLAppDelegate.m | 15 ++++++++++++++- .../Icosahedron.xcodeproj/project.pbxproj | 7 +++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Simple OpenGL ES 2.0 Example/Classes/GLViewController.m b/Simple OpenGL ES 2.0 Example/Classes/GLViewController.m index 7553795..50fd73d 100644 --- a/Simple OpenGL ES 2.0 Example/Classes/GLViewController.m +++ b/Simple OpenGL ES 2.0 Example/Classes/GLViewController.m @@ -212,7 +212,7 @@ - (void)draw glVertexAttribPointer(textureCoordinateAttribute, 2, GL_FLOAT, 0, 0, textureCoordinates); glEnableVertexAttribArray(textureCoordinateAttribute); - static const rotationVector = {1.f, 1.f, 1.f}; + static const Vector3D rotationVector = {1.f, 1.f, 1.f}; Matrix3DSetRotationByDegrees(rotationMatrix, rot, rotationVector); Matrix3DSetTranslation(translationMatrix, 0.f, 0.f, -3.f); Matrix3DMultiply(translationMatrix, rotationMatrix, modelViewMatrix); diff --git a/Simple OpenGL ES 2.0 Example/Classes/Hello_GLAppDelegate.m b/Simple OpenGL ES 2.0 Example/Classes/Hello_GLAppDelegate.m index abcf8e5..1dff77c 100644 --- a/Simple OpenGL ES 2.0 Example/Classes/Hello_GLAppDelegate.m +++ b/Simple OpenGL ES 2.0 Example/Classes/Hello_GLAppDelegate.m @@ -8,11 +8,24 @@ @implementation Hello_GLAppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - [window addSubview:rootController.view]; + //[window addSubview:rootController.view]; rootController.view.frame = window.frame; rootController.view.contentScaleFactor = window.contentScaleFactor; [window makeKeyAndVisible]; [(GLView *)rootController.view startAnimation]; + + // Set RootViewController to window + if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0) + { + // warning: addSubView doesn't work on iOS6 + [window addSubview: rootController.view]; + } + else + { + // use this method on ios6 + [window setRootViewController:rootController]; + } + [window makeKeyAndVisible]; return YES; } diff --git a/Simple OpenGL ES 2.0 Example/Icosahedron.xcodeproj/project.pbxproj b/Simple OpenGL ES 2.0 Example/Icosahedron.xcodeproj/project.pbxproj index 124ec13..16837cc 100755 --- a/Simple OpenGL ES 2.0 Example/Icosahedron.xcodeproj/project.pbxproj +++ b/Simple OpenGL ES 2.0 Example/Icosahedron.xcodeproj/project.pbxproj @@ -171,6 +171,8 @@ /* Begin PBXProject section */ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; + attributes = { + }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Icosahedron" */; compatibilityVersion = "Xcode 3.1"; developmentRegion = English; @@ -225,12 +227,15 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD)"; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Hello_GL_Prefix.pch; INFOPLIST_FILE = "Hello_GL-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + OTHER_CFLAGS = ""; PRODUCT_NAME = Icosahedron; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -240,10 +245,12 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD)"; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Hello_GL_Prefix.pch; INFOPLIST_FILE = "Hello_GL-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; PRODUCT_NAME = Icosahedron; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES;