Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect iPhone hardware older than 3GS

I have a rendering intensive game and using png it's too slow to run on 3G phones. But it runs fast using pvrtc so I need to know what model I'm running on.

Question: how can I detect the hardware I'm running on?

Many thanks for your help!

like image 418
Matt N. Avatar asked Dec 12 '25 17:12

Matt N.


2 Answers

What you're probably actually interested is whether you're on PowerVR MBX hardware (as in the 3G, the original iPhone, the first and second generation iPod Touches and the low-end third generation iPod) or PowerVR SGX hardware (as in the 3GS and iPhone 4, both iPads and the iPod Touches not in the above list).

With that in mind, how about just:

EAGLContext *testContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];

BOOL isSGX = testContext ? YES : NO;
[testContext release];

return isSGX;

The SGX is a programmable part that can support ES 2, the MBX isn't. The MBX is also limited to 16mb of VRAM whereas the SGX isn't, which is probably why your app runs poorly with full fat textures but fine with pvrtc.

like image 126
Tommy Avatar answered Dec 14 '25 11:12

Tommy


You could use this class by Erica Sadun.

like image 32
Henrik P. Hessel Avatar answered Dec 14 '25 11:12

Henrik P. Hessel