title: Scene refresh frozen
body: <p>I render the 2D (tiles-based) scene and register keypresses. When arrow keys are pressed I move the camera. Although keypresses are registered just fine, <strong>my scene does not update until I swap to another window and go back</strong>.</p>
  
  <p>Can you give me a clue about what is causing the problem?</p>
  
  <p>PS. I'm working on <em>Linux</em>, developing <em>OpenGL</em> application with a help of <em>glut</em> (<em>freeglut</em>).</p>
  
  <p>My rendering function:</p>
  
  <pre><code>void render() {
      glClear(GL_COLOR_BUFFER_BIT);
      glLoadIdentity();
  
      if (s_map)
      for (int i = s_iCameraX; i &lt; sc_iTilesY + s_iCameraY &amp;&amp; i &lt; s_map-&gt;usiHeight; i++)
      {
          for (int j = s_iCameraY; j &lt; sc_iTilesX + s_iCameraX &amp;&amp; j &lt; s_map-&gt;usiWidth; j++)
          {
              short val = s_map-&gt;data[i][j];              
              if (val == 0x0010) glBindTexture(GL_TEXTURE_2D, texture[0]);
              else if (val == 0x0020) glBindTexture(GL_TEXTURE_2D, texture[1]);
  
              glBegin(GL_QUADS);
                  glTexCoord2f(0.0f, 0.0f);   glVertex2f(j-s_iCameraX, i-s_iCameraY);
                  glTexCoord2f(1.0f, 0.0f);   glVertex2f(j-s_iCameraX+1.0f, i-s_iCameraY);
                  glTexCoord2f(1.0f, 1.0f);   glVertex2f(j-s_iCameraX+1.0f, i-s_iCameraY+1.0f);
                  glTexCoord2f(0.0f, 1.0f);   glVertex2f(j-s_iCameraX, i-s_iCameraY+1.0f);
              glEnd();
          }
      }
  
  glutSwapBuffers();
  } 
  </code></pre>
  
  <p>My special key processing function:</p>
  
  <pre><code>void keyproc(int key, int x, int y) {
      switch (key)
      {
      case GLUT_KEY_UP:
          printf("UP: %d %d\n", s_iCameraX, s_iCameraY);
          if (s_iCameraY - 1 &gt;= 0) s_iCameraY--;
          break;
  
      case GLUT_KEY_DOWN:
          printf("DOWN: %d %d\n", s_iCameraX, s_iCameraY);
          if (s_map &amp;&amp; s_iCameraY + 1 &lt; s_map-&gt;usiHeight) s_iCameraY++;
          break;
  
      case GLUT_KEY_RIGHT:
          printf("RIGHT: %d %d\n", s_iCameraX, s_iCameraY);
          if (s_map &amp;&amp; s_iCameraX + 1 &lt; s_map-&gt;usiWidth) s_iCameraX++;
          break;
  
      case GLUT_KEY_LEFT:
          printf("LEFT: %d %d\n", s_iCameraX, s_iCameraY);
          if (s_iCameraX - 1 &gt;= 0) s_iCameraX--;
          break;
  
      default: break;
      }
  }
  </code></pre>