CCRenderTexture结束时cocos2D-iphone中的OpenGL 500错误

Aff*_*ian 5 buffer opengl-es eaglview cocos2d-iphone ios

在ipad的绘图应用程序上工作,并使用CCRenderTexture画布上绘制精灵的画布.我使用的绘制循环基于渲染纹理类的cocos示例中的绘制循环.

[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];
Run Code Online (Sandbox Code Playgroud)

每次[target end]调用我得到一个OpenGL 0x0500错误:

OpenGL error 0x0500 in -[EAGLView swapBuffers]
Run Code Online (Sandbox Code Playgroud)

它似乎是基于{GL_ONE, GL_DST_COLOR}我在'画布'上绘制的精灵上的混合功能.当我使用{GL_ONE, GL_ONE}{GL_ONE, GL_ONE_MINUS_SRC_ALPHA}(橡皮擦)时,我没有得到同样的问题.

iOS 4.2和4.3都存在设备和模拟器上的问题.

这是我第一次使用OpenGL,所以我觉得有点迷失在寻找解决方案,任何帮助将不胜感激.

[更新]

我删除了所有函数调用来设置混合,因为它GL_DST_COLOR似乎是导致错误的那个.删除混合调用后(除了橡皮擦)它仍然看起来一样,所以我很满意.

在阅读关于同一问题的cocos2d论坛帖子后,找到了这个解决方案.

Ren*_*iya 0

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**
Run Code Online (Sandbox Code Playgroud)