title: Calling Multiple display functions in glut
body: <p>I am trying to render different menus in GLUT by using different booleans but the problem is when the first boolean is made false and the second one is made true. The second menu isn't rendered. I am making the first boolean false when the enter key is pressed and the second true at the same. Here is my main</p>
  <pre><code>int main(int argc, char *argv[])
  {
  
      int width = 1920, height = 1080;              // i have set my window size to be 800 x 600
      InitRandomizer();                             // seed the random number generator...
      glutInit(&amp;argc, argv);                        // initialize the graphics library...
      glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA); // we will be using color display mode
      glutInitWindowPosition(50, 50);               // set the initial position of our window
      glutInitWindowSize(width, height);            // set the size of our window
      glutCreateWindow(&quot;Rush Hour by Ahmad Rafiq&quot;); // set the title of our game window
      SetCanvasSize(width, height);                 // set the number of pixels...
      // Register your functions to the library,
      // you are telling the library names of function to call for different tasks.
      //glutDisplayFunc(display); // tell library which function to call for drawing Canvas.
      if (DisplayMenu)
          glutDisplayFunc(Menu);
      if (DisplayTaxiMenu)
      {
          glutDisplayFunc(TaxiSelection);
      }
      if (Proceed)
          glutDisplayFunc(GameDisplay); // tell library which function to call for drawing Canvas.
      glutSpecialFunc(NonPrintableKeys); // tell library which function to call for non-printable ASCII characters
      glutKeyboardFunc(PrintableKeys);   // tell library which function to call for printable ASCII characters
      // This function tells the library to call our Timer function after 1000.0/FPS milliseconds...
      glutTimerFunc(1000.0, Timer, 0);
  
      glutMouseFunc(MouseClicked);
      glutPassiveMotionFunc(MouseMoved);    // Mouse
      glutMotionFunc(MousePressedAndMoved); // Mouse
      
  
      // now handle the control to library and it will call our registered functions when
      // it deems necessary...
      glutMainLoop();
      return 1;
  // Updating the booleans like so
  if (key == '\n' || key == 13)
      {
          cout &lt;&lt; &quot;Enter key pressed\n&quot;;
          if (DisplayMenu)
          {
              DisplayMenu = false;
              DisplayTaxiMenu = true;
          }
      }
  }```
    
  </code></pre>