Browse Source

Merge pull request #1300 from umxprime/fix/ios-init-crash

Fix init crash on iPad 1st gen device with iOS 5.1.1
Juan Linietsky 10 years ago
parent
commit
f53b27dca3
1 changed files with 12 additions and 7 deletions
  1. 12 7
      platform/iphone/app_delegate.mm

+ 12 - 7
platform/iphone/app_delegate.mm

@@ -84,13 +84,11 @@ static int frame_count = 0;
 	switch (frame_count) {
 	switch (frame_count) {
 
 
 	case 0: {
 	case 0: {
-
-		int backingWidth;
-		int backingHeight;
-		glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
-		glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
-
-		iphone_main(backingWidth, backingHeight, gargc, gargv);
+        int backingWidth;
+        int backingHeight;
+        glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
+        glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
+		
 
 
 		OS::VideoMode vm;
 		OS::VideoMode vm;
 		vm.fullscreen = true;
 		vm.fullscreen = true;
@@ -198,6 +196,13 @@ static int frame_count = 0;
 	//glView.autoresizesSubviews = YES;
 	//glView.autoresizesSubviews = YES;
 	//[glView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleWidth];
 	//[glView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleWidth];
 
 
+    int backingWidth;
+    int backingHeight;
+    glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
+    glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
+    
+    iphone_main(backingWidth, backingHeight, gargc, gargv);
+    
 	view_controller = [[ViewController alloc] init];
 	view_controller = [[ViewController alloc] init];
 	view_controller.view = glView;
 	view_controller.view = glView;
 	window.rootViewController = view_controller;
 	window.rootViewController = view_controller;