Is it possible to set the code to only use -hd for iphone 4 or rather remove the usage of -hd for itouch4 and default it to use the normal atlases/resources?
Thanks
A fast, easy to use, free, and community supported 2D game engine
Is it possible to set the code to only use -hd for iphone 4 or rather remove the usage of -hd for itouch4 and default it to use the normal atlases/resources?
Thanks
I would very much doubt this is possible, you either support retina or you don't, the question I would be asking is why would you need to do this?
We are having memory issues with an itouch, using pvr.ccz it still seems to be reallocing on texture loading. So a memory warning level 2 is received. Apparently this realloc issue was fixed with the ccz format, but it still seems to be doing it.
I believe both devices have the same 24mb reserved for textures, you may not be getting a warning on the iPhone because it has a bigger ram overall but that doesn't mean you are not crossing the 24mb texture line.
You may want to look here for a few tips: http://allseeing-i.com/Performance-tips-for-Cocos2d-for-iPhone
You should be able to get the device using this code:
- (NSString *) platform{
size_t size;
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char *machine = malloc(size);
sysctlbyname("hw.machine", machine, &size, NULL, 0);
NSString *platform = [NSString stringWithCString:machine];
free(machine);
return platform;
}
- (NSString *) platformString
{
NSString *platform = [self platform];
if ([platform isEqualToString:@"iPhone1,1"]) return @"iPhone 1G";
if ([platform isEqualToString:@"iPhone1,2"]) return @"iPhone 3G";
if ([platform isEqualToString:@"iPhone2,1"]) return @"iPhone 3GS";
if ([platform isEqualToString:@"iPhone3,1"]) return @"iPhone 4";
if ([platform isEqualToString:@"iPod1,1"]) return @"iPod Touch 1G";
if ([platform isEqualToString:@"iPod2,1"]) return @"iPod Touch 2G";
if ([platform isEqualToString:@"iPod3,1"]) return @"iPod Touch 3G";
if ([platform isEqualToString:@"iPod4,1"]) return @"iPod Touch 4G";
if ([platform isEqualToString:@"i386"]) return @"iPhone Simulator";
return platform;
}
and in the AppDelegate
if ([self platformString] != @"iPod Touch 4G")
{
[director enableRetinaDisplay:YES];
}
Btw iPod Touch 4G is better than iPhone 4G.
@unrealaz - The iPod Touch 4 has only 256mb of RAM while the iPhone has double that.
If @jarrydios is stepping over the 24mb texture limit then it is likely trying to leech RAM from elsewhere and the iPod Touch doesn't have much to spare, while the iPhone could possibly give a little leeway due to the increased RAM space.
I would say that supplying iPod Touch owners with a crippled version will not fix the underlying cause, as most likely it will crash on the iPhone 4 at some point anyway as it tries to claim back that memory that you are using for textures.
You could also try using RGBA 4444 dithering
With the pixel density Retina display it's not really possible to see the dithering at all ;)
@varedis, i think that 24mb limit is bad information. that was a limit on older devices (PowerVR MBX) such as 3G. I believe it is now unified memory on the PowrVR SGX. so i think jarrydios has a valid approach.
http://www.cocos2d-iphone.org/forum/topic/4958
I am trying to track down accurate info on this topic as well. So please, anyone, correct me if i am wrong.
http://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/OpenGLESPlatforms/OpenGLESPlatforms.html#//apple_ref/doc/uid/TP40008793-CH106-SW3
@jarrydios, i am looking into the same approach, though i am checking the textureMemory available with Erica Sadun's UIDevice-hardware extensions which you can get from github.
I am not setting retina enabled if the memory is less than 400MB. very similar to unrealz approach, though not checking the string
Please someone let me know if i am wrong about this, as i am just trying to figure it out too :)
You must log in to post.