title: Draw a Line with double buffer and pre-determined frame rate in Open GL
body: <p>I want to write a program with two buffers and have a frame rate of 30 frames per second showing in the console. I'm using Open GL - C++</p>
  
  <pre><code>    Display()
      {
        glutSwapBuffers();
      }
  </code></pre>
  
  <p>Timer for fps:</p>
  
  <pre><code>     void mytimer(int fps)
       {
         glutTimerFunc(1000/30 , mytimer, 0);
         glutPostRedisplay();
       }
  </code></pre>
  
  <p>This code draws a line but I want to draw a line at a frame rate 30 fps.</p>
  
  <pre><code>      void drawScene (void){
          glClear(GL_COLOR_BUFFER_BIT);
          glBegin(GL_LINES);
          glVertex2f(0.0,0.0);
          glVertex2f(120.0,120.0);
          glEnd();
          glFlush();
        }
  
       int main (int argc ,char** argv){
         glutInit(&amp;argc,argv);
         glutInitDisplayMode(GLUT_RGB);
         glutInitWindowSize(360,360);
         glutCreateWindow("mohammad");
         initRendering();
         mytimer(fps);
         //glutDisplayFunc(drawScene);
         glutDisplayFunc(Display);
         glutMainLoop();
         return (0);
       }
  </code></pre>