I created an empty iOS project and then added a custom GLView class which is then added to AppDelegate. I have following questions:
1) How do I enable hi-res retina mode on iPhone 4? Currently I am using the following code to check for device. The following code is from the AppDelegate where it first allocates GLView and then sets contentScale.
CGRect screenBounds = [[UIScreen mainScreen] bounds];
self.window = [[[UIWindow alloc] initWithFrame:screenBounds] autorelease];
// Override point for customization after application launch.
_view = [[GLView alloc] initWithFrame:screenBounds];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
NSLog(@"iPad detected");
}
else {
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] == 2) {
NSLog(@"iPhone4 detected");
_view.contentScaleFactor = [[UIScreen mainScreen] scale];
}
else {
NSLog(@"iPhone detected");
}
}
self.window.backgroundColor = [UIColor whiteColor];
//self.window.rootViewController = [[[UIViewController alloc] initWithNibName:nil bundle:nil] autorelease];
[self.window addSubview:_view];
But even after setting content factor it is drawing pretty poor quality polygons with jagged edges as shown in the image below:
http://farm8.staticflickr.com/7358/8725549609_e2ed1e0e2a_b.jpg
Is there any way to set the resolution to 960x640 instead of the default 480x320 ?
Please note that I can not use "[email protected]" because I am generating images at runtime in the render buffer.
2) Second problem I am having is this warning message:
"Application windows are expected to have a root view controller at the end of application launch"
Thank you for your time.
Edit: Problem solved. Set contentScale before allocating render buffer memory, i.e: inside GLView, not AppDelegate.
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
get you a backingWidth at the higher resolution? \$\endgroup\$