/////////////////////////////////////////////////////////////////////////
//                                                                     //
// This file contains the declaration of the CGLUTContext class.       //
//                                                                     //
/////////////////////////////////////////////////////////////////////////
#ifndef __CGLUTCONTEXT_HPP__
#define __CGLUTCONTEXT_HPP__


#include "real.hpp"

class CScene;


/////////////////////////////////////////////////////////////////////////
//                                                                     //
// This class is a singleton that sets up a OpenGL context and handle  //
// GLUT-specific events.                                               //
//                                                                     //
/////////////////////////////////////////////////////////////////////////
class CGLUTContext
{
public:
  static CGLUTContext* getInstance();
  void init(int *argc, char** argv, CScene& scene);
  void show();

private:
  CGLUTContext();
  CGLUTContext(const CGLUTContext&); // Not defined, should never be called
  ~CGLUTContext();

  void initGL();

  // GLUT callbacks
  static void displayFunc(void);
  static void reshapeFunc(int width, int height);
  static void keyboardFunc(unsigned char key, int x, int y);
  static void specialFunc(int key, int x, int y);

  CScene *m_pScene;
  real_t  m_angle;

  enum ENUM_DISPLAY_MODE { E_SMOOTH, E_FLAT, E_LINES };
  ENUM_DISPLAY_MODE m_displayMode;
};


#endif // __CGLUTCONTEXT_HPP__
