-1

我正在制作 android 版本的 cocos2dx iOS 游戏。在 iOS 中,cocos2dx 不支持少数 gl api,因为我们使用的是原生 iOS api。现在,当我在 andorid 上运行相同的代码库时,那些不受支持的 API 会出错。以下是在 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。

4

1 回答 1

0
kmGLPushMatrix();
kmGLPopMatrix();

Gles2.0 doesn't have these functions, try to use kazmath instead.

于 2013-07-08T14:26:46.053 回答