views:

120

answers:

2

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?

+8  A: 

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.

Joshua Weinberg
oooooooohhhhhhh….. aaaaahhhhhhhhhhhhhh.. I can see the light now! Thanks!
pop850
+1  A: 

Not so familiar with the CAEAGLLayer, what is the syntax to set the contentScale to 2.0?

sinsro
`layer.contentScale = 2.0f`
Joshua Weinberg
Hm, that's what I thought first, but the compiler claims it has no such member?This is my code:CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer; eaglLayer.contentScale=2.0;Also eaglLayer->contentScale=2.0;does not work... I must be missing something really stupid here...
sinsro
Ok, got it now. Seems you got a typo there, it should be layer.contentsScale=2.0f; Also, better point out this needs base SDK 4.0. :)
sinsro
then, once you've set the scale, be sure to double the glViewport size to 640x960
pop850
Whoops, worry about the typo :)
Joshua Weinberg