2014/08/21

OpenGL setting for Retina display

About settings to show a view for the Retina display in OpenGL. You may not have to think about it when you use GLKit. This is a way without GLKit.
Only three lines.

(1) Set contentsScale for a CAEAGLLayer object as the same way when you set it for a CALayer object.
{
    eaglLayer.contentsScale = [UIScreen mainScreen].scale;
}

(2) Make the storage size for depth buffer double.
{
    glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, self.frame.size.width*2.0, self.frame.size.height*2.0);
}

(3) Set the size for display double.
{
    glViewport(0, 0, self.frame.size.width*2.0, self.frame.size.height*2.0);
}

Develop | Comments(0) | Trackback(0)
Comment

管理者のみに表示