Cocos2dx开放gl问题

时间:2012-09-19 14:36:04

标签: android opengl-es cocos2d-iphone

我正在制作android版cocos2dx iOS游戏。在iOS中,由于我们使用了原生的iOS apis,因此cocos2dx并没有支持gl apis。现在,当我在andorid上运行相同的代码时,那些不受支持的API会出错。 followiing是在Xcode项目上运行purfact的代码,并给出错误(在相应的行中提到)elcipse:

glPushMatrix(); //ERROR: 'glPopMatrix' was not declared in this scope
glTranslatef(x, y, 0.0); //ERROR: 'glPopMatrix' was not declared in this scope

float angle = 360.0 / sparkleNum;

int idx, opacity;
idx = index % FIREWORK_TYPE_NUM;

opacity = (1.0 - step) * 255;

for(int i = 0; i < sparkleNum; ++i)
{
    glPushMatrix();
    glRotatef(i * angle, 0.0, 0.0, 1.0); //ERROR: 'glPopMatrix' was not declared in this scope
    glTranslatef(0.0, dist, 0.0);
    glScalef(scalar, scalar, scalar);//ERROR: 'glPopMatrix' was not declared in this scope

    firework[idx]->setOpacity(opacity);
    firework[idx]->draw();

    glPopMatrix(); //ERROR: 'glPopMatrix' was not declared in this scope
}

glPopMatrix(); //ERROR: 'glPopMatrix' was not declared in this scope

帮我删除这些错误并成功使用gl apis。

1 个答案:

答案 0 :(得分:0)

kmGLPushMatrix();
kmGLPopMatrix();

Gles2.0没有这些功能,请尝试使用kazmath。