title: Using Objects into a Glut Display Function
body: <p>i'm having trouble using an object in a glut DisplayFunction.</p>
  
  <pre><code>class Modelisation
  {
  private:
      int hauteur, largeur, x, y;
      Camera *Cam;
  
      void DisplayFunction ();
      static void RedisplayFunction (int, int);
  
  public:
      Modelisation (int argc, char **argv, char[]);
      ~Modelisation ();
  
      void StartMainLoop();
  };
  </code></pre>
  
  <p>Modelisation.cpp</p>
  
  <pre><code>Modelisation::Modelisation (int argc, char **argv, char windowName [])
  {
      Cam = new Camera;
      glutInit (&amp;argc, argv);
      glutInitDisplayMode (GLUT_SINGLE);
      glutCreateWindow (windowName);
  };
  void Modelisation::StartMainLoop()
  {
      glutDisplayFunc(DisplayFunction);
      glutIdleFunc(DisplayFunction);
      glutReshapeFunc(RedisplayFunction);
      glutMainLoop(); 
  }
  void Modelisation::DisplayFunction()
  {
      glClearDepth (1);
      glClearColor (0.0f, 0.0f, 0.0f, 0.0f); 
      glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);  
      glLoadIdentity ();
      Cam-&gt;Render ();
      glFlush ();
      glutSwapBuffers ();
  }
  </code></pre>
  
  <p>glutDisplayFunc(DisplayFunction);
  glutIdleFunc(DisplayFunction);</p>
  
  <p>This doesn't work.
  I know that i can declare DisplayFunction as a static member, but this won't allow me to use the Cam Object, any idea ?</p>
  
  <p>Thx !!!</p>