OpenGL 500 error in cocos2D-iphone on CCRenderTexture end
Working on a drawing app for ipad and using the CCRenderTexture
as a canv开发者_开发知识库as upon which sprites are painted. The draw loop I use is based on the one in the cocos example for the render texture class.
[target begin];
float distance = ccpDistance(start, end);
if (distance > 1) {
int d = (int)distance;
float difx = end.x - start.x;
float dify = end.y - start.y;
for (float i = 0; i < d; i+=([self.currentBrush sprite].textureRect.size.width * [self.currentBrush sprite].scale)/4.0f) {
float delta = i / distance;
[[self.currentBrush sprite] setPosition:ccp(start.x + (difx * delta), start.y + (dify * delta))];
[[self.currentBrush sprite] visit];
}
} else {
[[self.currentBrush sprite] setPosition:start];
[[self.currentBrush sprite] visit];
}
[target end];
every time [target end]
is called I get a OpenGL 0x0500 error:
OpenGL error 0x0500 in -[EAGLView swapBuffers]
It seems to be based on the blending function {GL_ONE, GL_DST_COLOR}
on the sprites that I paint onto the 'canvas'. When I use {GL_ONE, GL_ONE}
or {GL_ONE, GL_ONE_MINUS_SRC_ALPHA}
(Eraser) I don't get the same issue.
The issue exists on iOS 4.2 and 4.3 both on device and simulator.
This is my first time working with OpenGL so I feel a bit lost in trying to find a solution, any help would be greatly appreciated.
[Update]
I removed all the function calls to set the blending as the GL_DST_COLOR
seemed to be the one causing the error. After removing the blending calls (Except for eraser) it still looks the same so I'm happy with that.
Came to this solution after reading a cocos2d forum post regarding the same issue.
May be It's bug in latest version of Cocos2d.It's give the warning and some time Performance is also decrease.I fetch same problem when we put Gesture on the view controller.
Below link is a my question discussion.
**http://stackoverflow.com/questions/21326063/glview-causes-opengl-error?noredirect=1#comment32164422_21326063**
精彩评论