我定义一个CCRenderTexture对象以后,用openGL进行渲染
在windows下运行没用问题
但是在真机测试时会闪退
在xcode看了错误是Cocos2d: OpenGL error 0x0502 in CCSprite.cpp draw 584
这是OpenGL版本问题?
请问有人知道是怎么回事么 我的2d-x版本是2.2.0…
下面是我渲染的代码
this->renderTexture->begin();
glBindTexture(GL_TEXTURE_2D, (GLuint)this->renderTexture);
glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
glColorMask(0.0f, 0.0f, 0.0f, 1.0f);
// Pass the colors of the vertices to draw to OpenGL
glEnableVertexAttribArray(kCCVertexAttribFlag_Color);
glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, colors);
// Pass the verticies to draw texture
glEnableVertexAttribArray(kCCVertexAttribFlag_TexCoords);
glVertexAttribPointer(kCCVertexAttribFlag_TexCoords, 2, GL_FLOAT, GL_TRUE, 0, coordinates);
// Pass the verticies to draw to OpenGL
glEnableVertexAttribArray(kCCVertexAttribFlag_Position);
glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_TRUE, 0, vertices);
glDrawArrays(GL_TRIANGLE_FAN, 0, segs);
glColorMask(1.0f, 1.0f, 1.0f, 1.0f);
glBlendFunc(CC_BLEND_SRC, CC_BLEND_DST);
this->renderTexture->end();