I'm writing a piece of software involving OpenGL ES 2.0. It's just about presenting photos with some addon special effects using GLSL.
Everything worked fine and the shaders performed well on iPhone 4, iPhone 4s and iPhone 5 with IOS7. But when I tested the software with an iPhone 5S with IOS7 installed, OpenGL only gives me the clear color (able to change with glClearColor) for all the GLSL shaders I wrote. Not able to work on the latest device is certainly not acceptable.
Another abnormal phenomenon on iPhone 5S is that every first call to glDrawElements (I'm using VBO if that matters) after the used opengl program is compiled (a new opengl shader program is compiled each time the user switches the special effect), will block the current thread for about 10 seconds.
I tried to compile with XCode 5 and 4.6, and both gave the same result (Fine on all devices other than iPhone 5s).
The project work on IOS7 installed on iPhone 5, so the problem shouldn't be the os version or SDK version. I suspect that the new GPU might be the cause, but I have no idea of how to fix it or even test out where in the code is failing. It took me a whole day to only finding out that glDrawElements issue.
The code of the software is huge and it's impossible for me to post all it in my question. I will be grateful if anyone can provide me with some help or just some idea.
To make the question more consice, my OpenGL shaders seems to fail on the latest iPhone GPU. So I'm wondering if:
The latest Apple A7 GPU cut off supports to some OpenGL ES 2.0 features
There are some limitations on creating vertex buffer objects (vbo) with iPhone 5s
The use of RenderBuffer, FrameBuffer and TextureBuffer (used to perform multipass shader) have any difference on iPhone 5s
These are all the suspicious part I can think of now, but I have no idea how to test them, because I'm not getting even one rendered frame by now.
The big difference between the iPhone 5 and the 5S is the 64-bit architecture. I am seeing problems in my app now that deal with passing floats to the shaders. In 64-bit mode, when I pass in 0.8 it gets to the shader as -1.58819e-23. I am about to open a new question regarding the issue, but you might want to check your values at runtime using the OpenGL ES Frame Capture.
https://developer.apple.com/library/mac/recipes/xcode_help-debugger/articles/debugging_opengl_es_frame.html
Related
I've got a frustrating problem here in that my iPhone app seems to run fine in XCode (running in the simulator or debugging it with iPhone plugged in), but archive versions act differently.
My sprites are supposed to perform movement only in a strict grid pattern and at constant speeds, but they are sort of skipping around and moving in unexpected diagonals.
I don't think it's IOS7-related because the problem doesn't manifest in the new version (7) of the simulator.
I never saw this problem in months of development and dev testing. It only seems to have started happening since I started producing and distributing archives.
App details:
Game, cocos2D
Hardware:
MacBook Air, iPhone5, IOS7
I ended up getting some help from someone on the Apple Developer Forums, but I'd like to update this posting as well, even though it's redundant.
I've been running XCode for over 2 years and I didn't realize build configurations could cause different behaviour.
By setting the Run scheme to use the Release build configuration I was able to re-create the problem on the device.
The problem still existed of course, but this posting I found suggested turning off compiler optimizations to solve a vaguely similar problem.
That did it. Somehow the calculations that occur to control sprite vectors in my application behave strangely with compiler optimizations turned on.
My iPhone game makes heavy use of the OpenGL ES 2.0 API, and it uses only this version (it needs the shaders). Is it possible to make it only available for the iPhone 3GS+? Not allowing customers of previous versions to download it?
EDIT: I heard that the Infinity Blade runs only on iPhone4, how did they do that? Are there other games in the appstore that require OpenGL ES 2.0 and no other? If there is such a thing, how do I do that?
you can make your app on app store only visible to certain models with UIRequiredDeviceCapabilities.
check out the article.
thanks.
To expand upon mohacs' answer, if you only want to make the application available to certain classes of devices, you can set various keys within the UIRequiredDeviceCapabilities item in your Info.plist. The definitive listing of which capabilities filter for which devices can be found in Apple's iTunes Connect Developer Guide under the "Device Compatibility Matrix" section.
If you rely on OpenGL ES 2.0 support to be present for your application to run on a device, you'll want to have opengles-2 appear in your UIRequiredDeviceCapabilities. The iPhone 3G S was the first iOS device to support OpenGL ES 2.0, so this will filter out the original iPhone, iPhone 3G, and 1st and 2nd generation iPod touches. There are plenty of applications out there that require this, and with people like Marco Arment reporting that fewer than 3% of the iOS devices in the wild lack support for OpenGL ES 2.0, it's a safe filter to use.
You make mention of only supporting the iPhone 4 and up. That's a little trickier to filter out, because while you could use the gyroscope or front-facing-camera keys to target newer A4 or A5 processor devices, this will not include the original iPad, which had hardware slightly more powerful than the iPhone 4.
My recommendation is to target the iPhone 3G S and up, because the iPhone 4 isn't that much more powerful than the 3G S. Also, the iPhone 4's Retina display can mean that fill-rate-limited OpenGL ES applications could run a lot slower on in than the 3G S, due to the difference in the number of pixels you need to render.
I'm not sure that it is possible, but you can add a check on iOS version. If it's 5.0 or higher let the app run, otherwise give a feedback saying that this app requires iOS 5.0 or higher. AFAIK iOS 5.0 can only be installed on iPhone 3GS+
Hope it helps
I'm needing to purchase whatever devices are needed to do testing for iOS applications. My initial thoughts are to test on a first-generation iPod Touch and an iPhone 4. Testing on the old iPod Touch with 3.1 software will give a good indication on how the app will work with little memory, and the iPhone 4 will obviously be a test for the faster system.
What do you all typically test on before submitting an application?
At minimum, a device running the oldest OS that I list as my Deployment Target, the slowest device/OS combo that I have (e.g. a 3G running 4.0.x is likely slower than anything running a 3.x OS) and which the app supports, and the current/latest released OS.
A device which includes all the features that my app will support (e.g. mic, camera, gyro, GPS, etc., if needed.)
Optionally, an iPad if the app is Universal, or if not to see how bad 2X zoom looks.
Optionally, a device with a beta OS installed if it appears Apple is going to release it well before I plan on revising the app.
So far all the apps I've submitted have been compatible with iOS 3.1.x, and I test them on my old 1st gen iPod Touch. I also test on my 3.2.2 iPad and my 4.0.2 iPhone 3GS.
My guess is all of these answers are going to be along the same lines -- test with as wide of a variety of devices as you can that are compatible with your app (i.e. meet the Minimum Deployment Version).
This is especially important if you develop Universal Apps that support 3.1.x. You'll find a ton of bugs with the hardware that you will never get with the simulator.
right now, I test using a 3g running 3.1 (a popular build), a 3gs running 4.0.2 (latest), a touch running 3.1.3(basically 3.1), and an iPhone 4 with 4.0.2.
Mainly try to keep a 3.x device around for sure, and then obviously a device with the most up to date OS.
Based on AdMob reports...around 98% of users are upgraded to atleast 3.0 and those that aren't shouldn't be your client base anyway (unlikely to use new apps).
I'm curious about how people test their apps In general.
I recently uploaded an app and wanted to reach as many iOS' as possible so i targeted it to 3.0. I did test on iphone 3, iphone 4 and 3GS but found out that there was an obscure sizing of a button image on a specific ios version.
In general how do you guys test for different versions?
Do people actually keep 3, 3gs and 4. Then on each, do people test on the various versions of ios within each of the phones. Yuck, anything to make this easier?
For the simulator, each xcode download contains only latest os and hardware to target. It would be nice if it could keep older os versions on the simulator to test with, is this possible?
My apps are CPU demanding, so optimizing for each device is big issue for me, so I keep an 3G, 3GS, 4, a 2G iPod Touch, and an iPad around for testing.
It's not always necessary though. Most cases you probably don't have heavy, time critical code, that needs to be optimized, so an iPhone 3GS at a minimum, possibly an iPhone 4 (for high DPI testing, although the simular may be fine for this), and an iPad (if you support it) is all you need.
If you keep your device images in your XCode organizer, you can reflash your device with all the OS version you want to QA on. It really depends on what you need. Unfortunately you can't go back and find older OS versions and install them if you didn't get them before they became out of date (partly because of the checksum process that calls back to Apple after you update to a new version, that attempts to prevent downgrading or upgrading to versions with security holes).
I created a new project from SDK 3.1 and OpenGL ES template. As you know this new template has ES 1.1 and ES 2.0 implementations. I wanna deal with ES 1.1 part first :) so I changed Base SDK in project settings to Simulator 3.0 and then I changed Active SDK in upper left corner of Xcode to "Simulator 3.0 - Debug". But when I start this sample project from template - it successfully initialize OpenGL ES 2.0 renderer in code and go to ES 2.0 part. I want to simulate old devices without OpenGL ES 2.0 and test 1.1 part. How can I do that without changing code?
Thx!
Answers recieved from different sources are:
"The Simulator is not appropriate (nor has it ever been) for this kind of old-OS regression testing. Remember, the Simulator is not an emulator, has no OS, and doesn't accurately reflect the environment that your code will be running in"
and "The simulator can provide some behavioral differences based on OS. However, that is absolutely not a substitute for device testing. Additionally, iPhone OS 3.0 still supports OpenGL ES 2.0, and there is no way to disable that support in the simulator."
Make sure you select "iPhone Simulator (3.0)" in "Active Executable" as well.
Also, you can change the firmware version of the simulator in Hardware -> Version.