菜单显示不正确?(Opengl,C++)

pdolor 发布于 2019-03-09 c++ 最后更新 2019-03-09 14:41 0 浏览

使用: OpenGL,C++,Microsoft Visual C++ 2010 Express。 游戏开始时,屏幕上没有任何东西。我可以按'd'进入游戏,游戏中的一切都很好,我按下“逃脱”,屏幕变黑,但没有图像显示。 这里是代码菜单应该显示的地方。

void drawMenus(double a[2], double b[2], double c[2], double d[2]){
glBindTexture(GL_TEXTURE_2D, texture[1]);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_DECAL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_DECAL);
glBegin(GL_QUADS);
    glTexCoord2d(0.0,0.0);
    glVertex2dv(a);
    glTexCoord2d(-1.0,0.0);
    glVertex2dv(d);
    glTexCoord2d(-1.0,-1.0);
    glVertex2dv(c);
    glTexCoord2d(0.0,-1.0);
    glVertex2dv(b);
glEnd();
}
void menuControler(){
double a[2] = {0,0};
      double b[2] = {0,MAPHEIGHT};
      double c[2] = {MAPDEPTH,MAPHEIGHT};
      double d[2] = {MAPDEPTH,0};
      drawMenus(a,b,c,d);
}
void createMainMenu(){
glClearColor(0.0f, 0.0f, 0.0f, 1.0f );
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//glMatrixMode(GL_PROJECTION);
//glEnable(GL_DEPTH_TEST);
//glFlush();
//glMatrixMode(GL_MODELVIEW);
menuControler();
glLoadIdentity();
//glMatrixMode(GL_MODELVIEW);
glutSwapBuffers();
//glutPostRedisplay();
}
void toMainMenu(){
gameState = 0;
}
void checkState(){
switch(gameState){
    case 0:
        createMainMenu();
        break;
    default:
        break;
}
} 有什么建议么?
已邀请: