title: Question about drawing rectangle on opengl
body: <p>The question asks to draw the rectangle when I press "r" in the keyboard. I try to write a function to draw this rectangle. The character call back function is correct and it gives me feedback that I already press "r". I don't know how to make the triangle appear. I added this line <strong><code>glfwSwapBuffers(window)</code></strong> in the function, but it's still not working. Thanks for help in advance. </p>
  
  <pre><code>#define GLEW_STATIC
  #include &lt;GL/glew.h&gt;
  #include &lt;GLFW/glfw3.h&gt;
  #include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;cmath&gt;
  #include &lt;iostream&gt; 
  
  #define WINDOW_WIDTH 900
  #define WINDOW_HEIGHT 600
  
  float frameBuffer[WINDOW_HEIGHT][WINDOW_WIDTH][3];
  bool mask[WINDOW_HEIGHT][WINDOW_WIDTH];
  GLFWwindow *window;
  void display()
  {
      glColor3f(1.0, 0.0, 0.0);
      glBegin(GL_POLYGON);
      glVertex2i(50, 90);
      glVertex2i(100, 90);
      glVertex2i(100, 150);
      glVertex2i(50, 150);
      glEnd();
      glFlush();
  }
  void CharacterCallback(GLFWwindow* lWindow, unsigned int key)
  {
      if(char(key) == 'r')
         display();
  }
  
  
   void Init()
  {
      glfwInit();
      glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
      window = glfwCreateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "- &lt;xx&gt;", NULL, NULL);
      glfwMakeContextCurrent(window);
      glfwSetCharCallback(window, CharacterCallback);
      glewExperimental = GL_TRUE;
      glewInit();
      glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
      ClearFrameBuffer();
  }
  
  int main()
  {   
      Init();
      while (glfwWindowShouldClose(window) == 0)
      {
          glClear(GL_COLOR_BUFFER_BIT);
          Display();
          glFlush();
          glfwSwapBuffers(window);
          glfwPollEvents();
      }
  
      glfwTerminate();
      return 0;
  }
  </code></pre>