I recently ported a project from Cocos2d 1.1 to 2.0. So far everything is working great, but I've noticed that the frame rate drops from 60 fps to around 40-50 fps on the iPhone 4 and the iPod Touch 4. Other devices I have tried (iPads 1 & 3, iPhone 4s) still run at 60.
At first I thought I had too many draw calls, but after reducing the calls from 54 to 17, I still had the same fps on both devices. I should note that I don't have this problem on the default Hello World template, nor do I have any openGL errors in the console. My memory footprint is around 50mb, so I don't think that's the problem either. Any ideas?
Looks like you have a simple performance problem. The other devices running at 60 fps (at least iPad 3 and iPhone 4S) have more computing power and better graphics processors than the iPhone 4 and iPod Touch 4.
Since this happened after upgrading from cocos2d 1.1 to 2.0, there's the possibility that the 4th generation iPhone devices don't run OpenGL ES 2.0 code (shaders) as fast as the other devices. It could also be an issue with cocos2d 2.0 itself. Unless you really need to use a feature of cocos2d 2.0 (ie shaders) the easiest approach would be to simply go back to cocos2d 1.1. If you aren't writing shaders, cocos2d v1.1 is just the same as 2.0 in terms of features (at this point in time).
Finally, test performance only with release builds. If you run Debug builds things like logging and assertions can totally skew any performance results.
Related
We have this project using OpenCV and at first we developed for iPad2.
Everything ran smooth and an computer vision object recognition iteration was taking a little under 1 second.
So far so good. Now we are testing the app for iPhone on both 4 and 4S. Of course we did our research as the results were stating the iPhone4S performance was almost as fast as the iPad2.
The results of the iPhone 4 are terrible, one iteration takes 15 seconds. In the iPhone 4S on iteration takes 8 seconds.
So with our algorithms:
iPhone4 is 15x slower than an iPad2
iPhone4S is 7-8x slower than an iPad2
Does anybody know if this is true? Is there something the iPhone is doing differently than the iPad2? Isn't the processor of the same type?
Anybody who can point us in the right direction?
Similar processors, different camera's. The iPad's camera has less MP's than the iPhone's one. On the iPhone, make sure you downsize your image to an acceptable size before processing.
We developing an app for iOS with Unity (Basic version).
On iPhone 4 we have low fps.
We want to use non-retina 320*480 screen size on iPhone 4 (and render buffer 320*480).
We think that will increase performance on iPhone 4.
We know how to do this in iOS app through code (as for example shown here openGL ES retina support).
How can we do this through Unity?
Are there any ways?
Open Unity3d and go to Player Setting of iOS:
Setting for iOS > Other Setting > Target Resolution > Select 320(iPhone).
If your app is not using Accelerometer then Disable Accelerometer Frequency.
Also in Optimisation : Script Call Optimization = Fast but no Exception.
I am writing an application which contains some graphs drawn in OpenGL ES. each of these graphs are in a table cell, when I press some of those graphs, it is being opened in full screen mode.
Everything worked perfectly since I upgraded to iOS4.2. Now the problem is in simulator, I can't see the drawn graph in cells, but in full screen mode I do see the chart. There are no changes no the device, it is only on the simulator and only in a case.
The behavior is the same for other Mac's here.
Does anyone have a clue?
As explained in this answer to this similar question, there has been a change in the way that 4.2 handles renderbuffers in Core Animation layers. From the OpenGL ES Programming Guide:
In iOS 4.2 and later, the performance
of Core Animation rotations of
renderbuffers have been significantly
improved, and are now the preferred
way to rotate content between
landscape and portrait mode. For best
performance, ensure the renderbuffer’s
height and width are each a multiple
of 32 pixels.
It appears that if your renderbuffer isn't an even multiple of 32 pixels, it doesn't display in the Simulator. This is a bug in the Simulator, but you should probably make your renderbuffer a multiple of 32 in either dimension in any case to improve performance.
Same things with my App. My textures are broken sporadically on the simulator (4.2). On the hardware everything looks fine.
I don't know if this helps much, but I've seen all manner of strange behaviour on the simulator implementation of OpenGL ES: spurious images appearing; strange lighting on the first render pass; broken rendering to bitmaps, depending on when I call it. I'm no expert in OpenGL programming, so I could just be writing crap code, but there is definitely a noticeable difference in the behaviour of the simulator vs the real hardware.
Your experience suggests that maybe my problems aren't entirely my fault. :-)
While testing my openGL ES app on the new iPhone 4, it seemed as if the openGL wasn't using all 326 ppi, rather the 163 ppi found on the 3G, because of noticeable pixelation. I realize there are 4 times more pixels to calculate, but shouldn't the A4 chip compensate for this?
I'm sure there is a way to take advantage of the stunning resolution, as I have seen in apps on the iTunes Store, but how?
Yes, its quite easy too actually. By default the OpenGL view uses the old scale mode as to not break existing applications because it is a pixel based API rather than a point based API.
To fix this, set the contentsScale of your CAEAGLLayer to 2.0 and bask in the glory.
Not so familiar with the CAEAGLLayer, what is the syntax to set the contentScale to 2.0?
I did an wave animation to explore features of sgx chip which is tile-based rendering (TBR) architecture by comparing the performance on iphone and laptop.
An advantage of TBR architecture is it allows the GPU to perform hidden surface removal before fragments are processed, so I draw many overlaped layers of animated waves, and only the wave in the top layer is visible.
I did this program on both iphone 3gs (using gles 2.0) and my laptop, a macbook pro(using opengl 2.0). I recorded the fps numbers of different layers, and I assume trends of fps changes on iphone and laptop are different. I guess the performance's decreasing of iphone should be slower than on laptop, when the number of layers is increased. But they have very similar trends.
I have 2 questions.
1. why it doesn't show the advantage of TBR architecture, while there are alot of overlapped triangles
2. why the performance of iphone simulator is much much much much slower than just running on laptop(without simulator)? As documentations say the simulator does not enforce the memory limitations of MBX and SGX and take the advantage of laptop's CPU, i guess its performance should keep up with the laptop.
anyone can help?
thanks alot
The OpenGL ES implementation in the iPhone Simulator is a software rasterizer and does not use the GPU in your MacBook.
What kind of framerate trends are you seeing, and in what way is only the wave on the top layer visible? Your primitives typically need to have framebuffer blending disabled and not issue discards in the fragment shader in order for hidden surface removal to skip fragment processing for what’s underneath.