I want to make a game that uses retro-style graphics, and it all looks good on the simulator or non-retina device. However, on the retina display, it doesn't stay "crisp" when it scales up. I'm doing most of my drawing with OpenGL, if that matters. Thanks!
Using nearest-neighbor scaling for retina display?
(3 posts) (2 voices)-
Posted 8 months ago #
-
Yeah, this has been discussed before, the retina devices don't scale up properly, and it's most noticeable with pixel art. See this post for example:
http://www.cocos2d-iphone.org/forum/topic/7493
I assume you are not providing HD graphics. So you have three options:
1) the one suggested on that post:
[[CCDirector sharedDirector] openGLView].layer.magnificationFilter = kCAFilterNearest; [[CCDirector sharedDirector] openGLView].layer.contentsRect = CGRectMake(0.0001, 0.0001, 1, 1);Do this just before pushing your main scene, on your main app delegate class. This trick was suggested by an Apple engineer, we didn't made up. It will make your pixel art to look perfect on retina device. BUT IMPORTANT! don't do this on iPad iOS 4.2 as it will mess the whole screen. So if you want to apply this, be sure you detect he device type and only apply to iPhone 4 or iPod touch 4G.
2) enable the retina support on main delegate:
[director enableRetinaDisplay:YES]And then scale up all your pixel art. Lot of work but you only need one set of graphics.
3) Maybe this is the best option, enable retina support AND duplicate all your graphics scaled up previously and added the "-hd" to the file name. If you use Photoshop for example, be sure you use the nearest neighbour method to scale up the graphics.
Posted 8 months ago # -
Awesome, thanks. I ended up going with the first method, since I'm using OpenGL drawing (not images) for most of the app.
Posted 8 months ago #
Reply
You must log in to post.