GLBasic forum

Main forum => GLBasic - en => Topic started by: Qube on 2010-Aug-20

Title: iPad 2D & 3D slow with GLB v8 beta
Post by: Qube on 2010-Aug-20
Been having some fun with the new v8 beta while developing my latest game for the iPad. Howver, I've come across some serious speed issues with the iPad side of things :(

3D slowness

A simple 1500 poly object rotating around all 3 axis, one ambient light, one camera, basically the bear essentials. On the iPhone this runs at 60 fps solid, but change resolution to 1024x768 and install for iPad the framerate drops to 37.

2D slowness

I wouldn't say the 2D side is slow on the iPad but there is an issue when it comes to fullscreen goodness. Using polyvector only there appears to be no way to do 60 fps with a full resolution background and 20+ small sprites.

Using the same methods on the iPhone you are able to shunt around dozens and dozens of sprites (with polyvector) with a fullscreen image no problems.

I've tried splitting the background draw into 2, 4, 8, 16 quads but no drastic increase in speed. I have managed to get full screen with 10 sprites at 60 fps but that's the max limit before the fps drops.

My thoughts are the iPad has to draw a hell of a lot of data compared to the iPhone so for 2D is there anything that can be done to speed up fullscreen background drawing?

My main concern is the 3D side of things though. Has anyone else used the latest v8 beta with the iPad and found speed issues?
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: fjsantosb on 2010-Aug-20
Indeed,

I got same problems moving Noid for iPhone to iPad (same code, bigger graphics, but double processor on iPad).

On iPhone got 60 fps constants; on Ipad only 40 fps :S.

Kinda Strange.

King Regards, fjsantos.
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: matchy on 2010-Aug-20
Let's hope the OpenGL ES Enhancements to OS4 for iPad will help also.  :bed:
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: Kitty Hello on 2010-Aug-20
iPad really gets slow when you're forced to render to a screen nd rotate tha then.
I think a call to glRotate of the projection matrix is a better idea. I'll post code when I find time.
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: Qube on 2010-Aug-21
That'll be great, Kitty, any speed boosting tips & code most appreciated  =D

I also found out tonight that the ipads GPU is the same as the iPhone 3GS which helps to explain a lot of speed issues considering the iPad has to fill 5x the amount of pixels for full screen.

With that I revisited my 3d code, set it for 30 fps and added some nice little time stepping code  :good: so now it runs very well at 30 fps and in busy busy scenes adjusts accordingly to keep things flowing well. I should of done this from the beginning but I expected the iPad to out perform the iPhone 3GS, which it does but I miss calculated the huge difference in pixel real-estate the iPad has to do. 
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: bigsofty on 2010-Aug-21
The iPad has a faster core and a 64 bit data bus for the SGX, it's quite a bit faster than the 3GS, when running raw OpenGL natively, even with the larger screen.

GLB seems to be running a little slow for me too on the iPad I am afraid.

Cheers,


Ian
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: Ozden79 on 2010-Aug-21
I might suggest something about the IPad slowness...

I've used GLBasic and now using Objective-C + Cocos2d on our games and in Cocos2D world, trying to have a one piece background image causes slow framerate on IPad as well. It seems this is related with the GPU's fill rate. The solution at there is to break the image into 4 pieces and than draw each of them at the appropriate positions to make the whole image drawn.

Don't know if it'll be helpfull but somebody might give it a try to let us all know? ;)
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: Qube on 2010-Aug-21
Quote
Don't know if it'll be helpfull but somebody might give it a try to let us all know?

Already tried that (see my 1st post) and found that (via polyvector) splitting it into 256x256 chunks worked quicker than 4 512x384 chunks which worked the best for those using cocos2d iPhone.

I hope there's some tweaking Kitty can come up with to aid in both 2D and 3D side of GLB  :good:
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: ketil on 2010-Aug-21
Perhaps problem with the dualcore support ?
Maybe only one core used ?
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: MrTAToad on 2010-Aug-21
Or perhaps rendering needs to be done slightly differently ?
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: Slydog on 2010-Aug-24
For the 2D, are you using only one tile texture file for all tiles?
Then also only using one initial STARTPOLY and one final ENDPOLY, and using POLYNEWSTRIP for each new tile?
This should get your draw calls down to one for the map, about as fast as you can get.
Maybe tighten up your map drawing routine/loop.

Just curious, do textures files of size power-of-two versus not power-of-two make any speed difference?  (ie: 512x512 versus 500x500)

And for the 3D, if you are using X_CULLMODE 0 (for 'both') try using '1' for front, or '-1' for back.
This may save some processing.

Just some random thoughts.

[Edit]
But still doesn't explain why the iPad is slower.
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: Cartoonkicker on 2010-Sep-28
i have developed my game on/for iPod Touch 2G and it runs with >60 FPS. Last weekend i bought the new generation (4.) of the iPod Touch. I tried it with the same code and the same Resolution 480x320  (btw 960x640 isn't supported by GLBasic so far ;)) and i only got 18-20 FPS. there seems to be a problem with the new hardware.
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: matchy on 2010-Sep-28
One of my games runs at 30-50fps on iPod Touch 3G (iOS 4.2) but 60fps on 4G (iOS4.1) and only 20fps on iPad (iOS4.2) but another game designed differently run 60fps on all.  :whistle:
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: Cartoonkicker on 2010-Sep-28
Did you change something in the XCode-Options? May i have to change something there? i thought that my game would speed up on the new hardware (iOS4.1)
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: Wampus on 2010-Sep-29
Quote from: matchy on 2010-Sep-28
One of my games runs at 30-50fps on iPod Touch 3G (iOS 4.2) but 60fps on 4G (iOS4.1) and only 20fps on iPad (iOS4.2) but another game designed differently run 60fps on all.  :whistle:
So...the other game that was designed differently...you going to give away your secret?  :)
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: MrTAToad on 2010-Sep-29
Anyone setting a limit to LIMITFPS ?  Or is -1 being used ?
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: matchy on 2010-Sep-29
There's no secret as is all a matter of inner game-play calculations, drawn objects and textures. For example in the case of a Minecraft clone, simply drawing blocks just doesn't work for mass amounts. Thus the idea of forming shelled objects of many blocks may be a theoretical solution to this (as discussed on the other thread).

Is there a standard piece of code we can benchmark with?
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: Cartoonkicker on 2010-Sep-29
Quote from: MrTAToad on 2010-Sep-29
Anyone setting a limit to LIMITFPS ?  Or is -1 being used ?

i've tried with and without LIMITFPS. The same result.
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: ampos on 2010-Oct-06
Any idea about this?

My game. 2 versions, 3 (480x320) and iPad (1024x768)

Iphone 4:
v3: 60 fps
vIpad: I only see 1/4 of the screen (botton right) but it seems to be at 60 fps.

iPad:
v3: 60 fps
vIpad: 12 fps.

Any idea why?
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: Kitty Hello on 2010-Oct-06
you run the iphone version on ipad with 60 fps, and the ipad version with 12 fps? Are you using a lot of screen coppies/high fill rate (createscreen e.g)
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: ampos on 2010-Oct-06
No, at the beginning of the code a LOADBMP for the background, and then filling the background with polyvector using a pattern of 32x32 pixels and around 30 80x80 sprites.

As I have not the ipad, but a friend, testing is not inmediate.

If we remove the 32x32 pattern, the polyvector is ignored, or just take the same time, as it stills draw a "empty" sprite?
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: ampos on 2010-Oct-06
Oh, in the iphone version I am using too a 32x32 pattern, so the "litle" version has to draw less images (using polyvector)
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: Kitty Hello on 2010-Oct-06
are you rendering the polyvectors in one batch (startpoly/endpoly)? If not, you have your answer. The number of glDrawArrays is very limited on iPhone/iPad.
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: ampos on 2010-Oct-06
Yes, I just did

x1&y1 are top left corners, x2,y2 are botton right

Code (glbasic) Select
v=x2-x1;v=v/32
h=y2-y1;h=h/32
STARTPOLY sp_suelo
POLYVECTOR 0,0,xsuelo,ysuelo,RGB(r[0][0],r[0][1],r[0][2])
POLYVECTOR 0,y2-y1,xsuelo,(32*h)+ysuelo,RGB(r[1][0],r[1][1],r[1][2])
POLYVECTOR x2-x1+tr,y2-y1,(32*v)+xsuelo,(32*h)+ysuelo,RGB(r[2][0],r[2][1],r[2][2])
POLYVECTOR x2-x1+tr,0,(32*v)+xsuelo,ysuelo,RGB(r[3][0],r[3][1],r[3][2])
ENDPOLY
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: monono on 2010-Oct-06
I think Kitty means something like
Code (glbasic) Select

STARTPOLY...
  FOR i = 1 TO 30
     POLYVECTOR..
     POLYVECTOR..
     POLYVECTOR..
     POLYVECTOR..
     POLYNEWSTRIP
  NEXT
ENDPOLY


One massive polyvector is sometimes faster than 30 small ones. Right?
Title: Re: iPad 2D & 3D slow with GLB v8 beta
Post by: Millerszone on 2010-Nov-05
Quote from: Kitty Hello on 2010-Aug-20
iPad really gets slow when you're forced to render to a screen nd rotate tha then.
I think a call to glRotate of the projection matrix is a better idea. I'll post code when I find time.

I'd like this code when you have time. :rtfm: