问题
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