Problems displaying full-screen CAEAGLLayer on Retina iPad

不羁岁月 提交于 2019-12-12 16:10:25

问题


I've run into some problems getting a UIView with a large CAEAGLLayer to display properly. If the frame is above a certain size (apparently 768 in either dimension with a contentScaleFactor of 2.0), it redraws with a distorted image of previous versions of the buffer.

It's pretty easy to reproduce in Apple's GLPaint example. PaintingView.m has a hardcoded contentScaleFactor of 1.0, but if you change it to 2.0:

self.contentScaleFactor = 2.0;

and run it on a Retina iPad (not the simulator), you get something like this when you draw:

http://imgur.com/jPNqV


回答1:


This appears to be a bug with setting kEAGLDrawablePropertyRetainedBacking to YES on the Retina iPads, as reported by Orion in this question. Setting that to NO using

    eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
                                    [NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];

removes the glitched drawing, but GLPaint relies on the retained backing for its brushes, so it won't work quite right if you do so.

I've filed a bug report on this (rdar://11070429), with the modified GLPaint as a test application for this behavior.



来源:https://stackoverflow.com/questions/9757052/problems-displaying-full-screen-caeagllayer-on-retina-ipad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!