How to create 1536x2048 framebuffer for iPad Retina sample (GLGravity)

前端 未结 4 1421
情歌与酒
情歌与酒 2021-02-01 11:06

So of course the first thing I\'m trying on my new iPad (4g) is the old GLGravity example. The only modification I\'ve made is to set the target device to \"iPad\".

Howe

4条回答
  •  悲哀的现实
    2021-02-01 11:30

    As an expansion on this answer, the GLGravity sample needs another change to ensure the GL viewport is set correctly. This is because theboundsproperty returns Quartz points, not pixels.

    -(void)setupView
    {
      ...
      CGRect rect = self.bounds;
      // new code - modify the viewport dimensions.
      rect.size.width *= self.contentScaleFactor;
      rect.size.height *= self.contentScaleFactor;
      // end of new code
      glFrustumf(-size, size, -size / (rect.size.width / rect.size.height), size / (rect.size.width / rect.size.height), zNear, zFar);
      glViewport(0, 0, rect.size.width, rect.size.height);
      ...
    }
    

提交回复
热议问题