我正在尝试使用openGL绘制精灵:
- (void)draw
{
// Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY
// Needed states: GL_VERTEX_ARRAY
// Unneeded states: GL_COLOR_ARRAY, GL_TEXTURE_2D, GL_TEXTURE_COORD_ARRAY
//glDisableClientState(GL_TEXTURE_COORD_ARRAY);
//glDisableClientState(GL_COLOR_ARRAY);
//glDisable(GL_TEXTURE_2D);
//glVertexPointer(2, GL_FLOAT, 0, circleVertices_);
//glColor4f(color_.r/255.0f, color_.g/255.0f, color_.b/255.0f, opacity_/255.0f);
BOOL newBlend = NO;
if( blendFunc_.src != CC_BLEND_SRC || blendFunc_.dst != CC_BLEND_DST ) {
newBlend = YES;
//glBlendFunc(blendFunc_.src, blendFunc_.dst);
}else if( opacity_ == 255 ) {
newBlend = YES;
//glBlendFunc(GL_ONE, GL_ZERO);
}else{
newBlend = YES;
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
//glDrawArrays(GL_TRIANGLE_FAN, 0, numberOfSegments);
//if( newBlend )
// glBlendFunc(CC_BLEND_SRC, CC_BLEND_DST);
// restore default GL state
//glEnableClientState(GL_TEXTURE_COORD_ARRAY);
//glEnableClientState(GL_COLOR_ARRAY);
//glEnable(GL_TEXTURE_2D);
}
如果我取消注释任何gl***
,构建并运行应用,则会出现多个打开GL错误:
OpenGL错误0x0502 in - [CCTextureAtlas drawNumberOfQuads:fromIndex:] 472
这个错误意味着什么? 我做错了什么?这是 SneakyJoystick
的一部分