GlReadPixel has stopped working with the beta version of iOS6

Possible duplicate:
Why does glReadPixels () not work in this code in iOS 6.0?

I currently have an application in the Appstore that uses the Cocos2D framework. To detect collisions, I use glReadPixels. The screen has only white and black pixels and the detection of black pixels means a collision. Everything works fine until iOS 5.1.1, but in the beta version of iOS6 (all of them) glReadPixels stopped working. Now the RGB values ​​returned by glReadPixels are always 0,0,0.

Does anyone know what went wrong or how to fix it?

Your help is much appreciated!

+4
source share
2 answers

Thanks for suggesting a private apple list - that I found a solution to this problem.

In the Cocos2D class "EAGLView.m" I set the variable "preserveBackbuffer" to "YES" in the init method. Now it works again in the beta version of iOS 6.

+4
source

Changing this parameter to EAGLView.m is done for me!

- (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; } 
+7
source

All Articles