可能重复: 为什么glReadPixels()在iOS 6.0中的代码中失败?
我目前在使用Cocos2D框架的Appstore中有一个App。 对于碰撞检测,我使用glReadPixels。 屏幕仅具有白色和黑色像素,并且检测黑色像素意味着碰撞。 一切工作正常的iOS 5.1.1,但在iOS6 Beta(所有这些)glReadPixels停止工作。 现在glReadPixels返回的RGB值总是0,0,0。
有没有人有一个想法出了什么问题或如何解决?
非常感谢您的帮助!
Possible Duplicate: Why is glReadPixels() failing in this code in iOS 6.0?
I currently have an App in Appstore that uses the Cocos2D framework. For collision detection I am using glReadPixels. The screen only has white and black pixels and detecting a black pixel means collision. Everything works fine up to iOS 5.1.1 but in iOS6 Beta (all of them) glReadPixels stopped working. Now the RGB values returned by glReadPixels are always 0,0,0.
Does anyone have an idea what went wrong or how to fix that?
Your help is much appreciated!
最满意答案
对EAGLView.m进行更改会为我运行!
- (id)initWithCoder:(NSCoder*)coder { self = [super initWithCoder:coder]; if (self) { CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer; eaglLayer.opaque = TRUE; eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil]; // YES self.contentScaleFactor = [UIScreen mainScreen].scale; } return self; }Thanks for the apple private list suggestion - that's where I found the solution to that problem.
In the Cocos2D Class "EAGLView.m" I was setting the "preserveBackbuffer" variable to "YES" at the init method. It now works again also in iOS 6 Beta.
更多推荐
发布评论