smallstepforman
smallstepforman

Reputation: 23

Setting the GLKView renderbuffer size

I'm developing an iPad OpenGL ES 2.0 application and require a backing frame buffer of 1024x768. I use GLKView and iOS 5.1 to manage creation of backend frame/render buffers (using code from the autogenerated OpenGL Game template provided by XCode). I get acceptable performance on iPad2, and life is good.

However, during testing I got my hands on a iPad 3 with Retina display, and when my application is recompiled/installed to the iPad3, the backend frame/render buffers are running at 2048x1536, and this is crippling my performance.

Now for my questions:

1) How do I force the GLKView autogenerated frame buffer to default to 1024x768 instead of 2048x1536.

Bonus question:

2) How come I'm not getting the x2 scaling button? Is this because I've recompiled the app with the iPad3 attached, and Xcode doing some behind the scenes modifications? If I only compile the app with my iPad2 attached and submit the application to the AppStore, will the end user running an iPad3 actually get the x2 scaling button then?

Upvotes: 1

Views: 2186

Answers (1)

Tommy
Tommy

Reputation: 100652

In order to force a GLKView not to use full retina resolution, just set the contentScaleFactor to 1.0.

The contentScaleFactor is the number of pixels per point. All iPads have a screen resolution of 1024x768 points so a full-screen view with a content scale factor of 1.0 will have 1024x768 pixels. The scale factor will otherwise default to 2.0 on a retina device and 1.0 otherwise.

Upvotes: 3

Related Questions