【问题标题】:Black background appears on the last scene最后一个场景出现黑色背景
【发布时间】:2019-01-08 11:37:36
【问题描述】:

我有一个问题,一旦热气球到达地面,就会出现黑色背景。

// a switch case based on state with appropriate calls
switch (state) {
// scene 1
case 1:     
    drawBackground1(); // the first background to appear
    drawSlogan1(); // display the first slogan
    break;
// scene 2
case 2:     
    drawBackground2(); // the second background to appear
    drawSlogan2(); // display the second slogan
    break;
// scene 3
case 3:     
    drawBackground1(); // the third background to appear
    drawSlogan3(); // display the last slogan
    break;
}

我在这里显示此代码是因为这是我更改的唯一代码,它使黑色背景出现。

Click here to see the full code

【问题讨论】:

    标签: c++ opengl glut


    【解决方案1】:

    当气球到达最终位置时,state 为 0。如果state == 0 也需要绘制背景:

    switch (state) {
    case 0: 
        drawBackground1(); // the third background to appear
        break;
    case 1:     
        drawBackground1(); // the first background to appear
        drawSlogan1(); // display the first slogan
        break;
    case 2:     
        drawBackground2(); // the second background to appear
        drawSlogan2(); // display the second slogan
        break;
    case 3:     
        drawBackground1(); // the third background to appear
        drawSlogan3(); // display the last slogan
        break;
    }
    

    【讨论】:

      猜你喜欢
      • 2014-01-30
      • 1970-01-01
      • 2014-11-07
      • 2012-02-29
      • 2022-07-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多