我已经实现了一个高分层,现在我想在高分中突出显示一个新条目。这是我当前的绘图功能,但它不起作用并多次出现此错误:
OpenGL 错误 0x0501 在 -[CCSprite draw] 530
绘图功能:
- (void)draw {
[super draw];
if(currentScorePosition < 0) return;
ccDrawColor4F(0.0f, 0.0f, 0.0f, 0.2f);
float w = 320.0f;
float h = 27.0f;
float x = (320.0f - w) / 2.0f;
float y = 359.0f - currentScorePosition * h;
GLfloat vertices[4][2];
GLubyte indices[4] = { 0, 1, 3, 2 };
vertices[0][0] = x; vertices[0][1] = y;
vertices[1][0] = x+w; vertices[1][1] = y;
vertices[2][0] = x+w; vertices[2][1] = y+h;
vertices[3][0] = x; vertices[3][1] = y+h;
ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );
kmGLPushMatrix();
glVertexAttribPointer( currentScorePosition, 2, GL_FLOAT, GL_FALSE, vertices, 0 );
glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, indices);
kmGLPopMatrix();
ccDrawColor4F(1.0f, 1.0f, 1.0f, 1.0f);
}