2

Since I've installed the Xcode 6.0.1 I'm having my OpenGL ES 1 layer displayed incorrectly on any simulated device (as well as on real hardware: iPhone 4S with iOS 8) – wrong size and position of the layer.

Changing the glViewport parameters doesn't make any difference. I can actually comment it out and it'll look the same.

PARTIAL SOLUTION:

I've checked and then unchecked the "Use Auto Layout" box so that Xcode updated my window to newer version requirements. Now everything looks okay on iPhone 4S, but still the size of the window on other devices is messed.

Anyone got their OpenGL ES 1 code updated to new devices?

Tom
  • 261
  • 2
  • 17

3 Answers3

1

One possible workaround is to get the dimensions (width & height) and decide on real width depending on which dimension is bigger something like this:

CGRect screenBounds = [[UIScreen mainScreen] bounds];
float scale = [UIScreen mainScreen].scale;
float width = screenBounds.size.width;
float height = screenBounds.size.height;

NSLog(@"scale: %f, width: %f, height: %f", scale, width, height);

float w = width > height ? width : height;

if (scale == 2.0f && w == 568.0f) { ...
robert
  • 5,742
  • 7
  • 28
  • 37
0

I've managed to display the render buffer properly by minding the fact that [[UIScreen mainScreen] bounds].size is orientation dependent on iOS 8 and coding the view programmatically. So my delegate looks like this:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *) {

CGRect screenBound = [[UIScreen mainScreen] bounds];
CGSize screenSize = screenBound.size;

screenHeight = screenSize.height;
screenWidth = screenSize.width;

window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, screenWidth, screenHeight)];
window.bounds = CGRectMake(0, 0, screenWidth, screenHeight);

MainViewController = [[UIViewController alloc] init];

glView = [[EAGLView alloc] initWithFrame:CGRectMake(0, 0, screenWidth, screenHeight)];
glView.bounds = CGRectMake(0, 0, screenWidth, screenHeight);

MainViewController.view = glView;

window.rootViewController = MainViewController;
[window makeKeyAndVisible];

[glView setupGame];
[glView startAnimation];

return YES;

}
Tom
  • 261
  • 2
  • 17
0

I have the similar problem with my OpenGL ES 1 app. The following code always returns the renderbuffer size in Portrait mode (shouldAutorotate is NO, so autorotate is disabled in my app):

glGetRenderbufferParameterivOES( GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth );
glGetRenderbufferParameterivOES( GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight );

But now (Xcode 6.0.1, iOS8) this size depends on the device orientation. So i get the wrong renderbuffer size.

"Use Auto Layout" check+uncheck didn't help me.

NightRadio
  • 101
  • 1
  • 4
  • I'm using the same code. In my case everything looks OK in both orientations on iPhone 4 and 5, but on 6 and 6 Plus it gets messed if I initiate my app in landscape mode (a bug to report?). Maybe try initiating your app in portrait and on load put the code to rotate it if you need it? – Tom Sep 25 '14 at 15:11
  • I only tested it on iPad Mini Retina. Just sent a request to Apple. Now waiting for an official answer... – NightRadio Sep 25 '14 at 18:31