在Retina iPad上显示全屏CAEAGLLayer时出现问题 [英] Problems displaying full-screen CAEAGLLayer on Retina iPad
问题描述
我遇到了一些问题,无法使带有大型CAEAGLLayer的UIView正确显示.如果该帧大于某个大小(contentScaleFactor为2.0,则在任一维度上显然为768),那么它将使用先前版本的缓冲区的变形图像进行重新绘制.
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.
在Apple的GLPaint示例中很容易重现. PaintingView.m的硬编码contentScaleFactor为1.0,但是如果将其更改为2.0:
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;
并在Retina iPad(而不是模拟器)上运行它,绘制时会得到类似的东西:
and run it on a Retina iPad (not the simulator), you get something like this when you draw:
推荐答案
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];
删除了出现毛刺的图形,但是GLPaint依靠其保留的笔刷来支持它,因此如果这样做,它将无法正常工作.
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.
我已对此提交了一个错误报告(rdar://11070429),并将修改后的GLPaint用作此行为的测试应用程序.
I've filed a bug report on this (rdar://11070429), with the modified GLPaint as a test application for this behavior.
这篇关于在Retina iPad上显示全屏CAEAGLLayer时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!