Updated to SDK4, CADisplayLink layer now sized wrong on iPad - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: Updated to SDK4, CADisplayLink layer now sized wrong on iPad (/thread-17.html)
Updated to SDK4, CADisplayLink layer now sized wrong on iPad - michaeltoy - Jun 28, 2010 02:23 PM
I updated to SDK4, and now when I run my universal app on the iPad, all the OpenGL rendering happens in an iPhone sized window in the corner of the iPad.
I re-downloaded the GLES2Sample app that I modeled my code after, and it has the exact same behavior when run in the ipad simulator.
the init method for the gl view from the sample starts like this:
if you look at eaglLayer.bounds.size at this point, it seems to be 480x320 at all times. before i updated to SDK4, it was 480x320 when i run the app on the iPhone and 1024x768 when I run the app on the iPad.
Anyone have any idea how I get the "self.layer" resized properly?
Updated to SDK4, CADisplayLink layer now sized wrong on iPad - michaeltoy - Jun 28, 2010 03:41 PM
As often happens, as soon as I had asked the question I knew the answer. It turns out that the automagically generated "MainWindow-iPad.xib" which is used by the sample app, and my cousin of the sample app, have the size of the EAGLView set to 480x320. Opening up I.B. and setting the size of the EAGLView to be the size of an iPad fixed the sample app, and my app as well.
Curious about why or how it ever worked without this.
[ EDITED LATER ]
Actually, that ended up NOT working in all cases of launching my app (sometimes I mess with the view hierarchy before starting the animation on the glview). For some reason I don't understand, no matter what size the view is in the NIB, it can get resized and/or repositioned oddly. Im heading in to work this morning planning to do something very like what MercuryBen says below.
Updated to SDK4, CADisplayLink layer now sized wrong on iPad - MercuryBen - Jun 28, 2010 07:21 PM
I had the same problem today. I ended up having to reset the dimensions manually. I put this in applicationDidFinishLaunching:
Then you have to make sure the frame buffer is resized as well, so put this at the beginning of your EAGLView createFrameBuffer method.
I don't know if you really need to set both the frame and bounds, but figured it couldn't hurt. These changes seemed to fix the problem for me.
Updated to SDK4, CADisplayLink layer now sized wrong on iPad - michaeltoy - Jun 29, 2010 11:37 AM
Although I am hounded by the idea that somehow if I made my nib files "right" I wouldn't be having this problem, I have given up on that, and, like ben, just resize the gl view just before I setRootView: the view controller (which I select at run time depending on which device is being used).
Updated to SDK4, CADisplayLink layer now sized wrong on iPad - iamflimflam1 - Jun 30, 2010 08:15 AM
This seems to work for me. My view expands to fit whatever it is put in.
RE: Updated to SDK4, CADisplayLink layer now sized wrong on iPad - Rasterman - Jul 16, 2010 11:28 AM
THANK YOU FOR THIS POST!!!
Adding the code fixed my display issues. I am converting my app from iPhone to iPad, followed the Apple docs, resizing and editing nibs, all yielding no results, Apple needs to add this info to their tutorial, as many game developers could care less about nibs,objective-c etc as they only use it as a means to end to get their game on the platform. Dealing with these issues all day is a test of my insanity.
ok i need to vent, please bare with me lol. Let me start from the beginning, on leopard, xcode 3.1, successful iphone app done and happy, hm lets do an ipad version, search google and apple for tutorials on how to do this, come up with garbage, only tutorial which looks good is apples, first step click the "upgrade current target for ipad" menu option. hm it doesn't exist, i must need the new sdk, ok so lets go download it, 2GB downloaded and 40 minutes later. "you fool, you need SNOW leopard to install this SDK". apple.com/buymorestuff hm no download version of snow leopard exists, off to best buy, all of out single user licenses! but they have 25 copies of the family pack, oh well $20 more no big deal right. installing snow leopard, 1 hour later, install all OS updates, 30 minutes later, install 4.0 SDK, 20 minutes later, ok now im ready to start the ipad version lol! i hate dealing with compiler and os issues, it seems like such a waste of time. OMG and i forgot about the provisioning and code signing problems lol, another 2 hours wasted.
RE: Updated to SDK4, CADisplayLink layer now sized wrong on iPad - Madrayken - Jul 19, 2010 12:39 AM
@Rasterman: you don't say exactly which post 'did it' for you. I'm presuming the code example rather than the .nib file fix?
Yup - the changeover is a major, massive pain. I lost about a week to it due to various errors - mostly caused by XCode 3.2.3's 'install-over-old-xcode' procedure being fundamentally flawed. After nuking the entire developer directory using the console (read the instructions in the XCode directory) I reinstalled to find things working... and slow.
Snow Leopard: slow.
My app, which was running at a lovely 50fps now runs considerably slower, pushing my optimisation stage to the fore. Not good. Hopefully now Shark will now work again, having stopped working for some black magic reason on 3.2.2.