00001
00002
00003
00004
00005
00006
00007
00008 #ifndef GLUTWINDOW_H_
00009 #define GLUTWINDOW_H_
00010
00011 #include <WindowFV.h>
00012 #include <GL/freeglut.h>
00013
00014 namespace FemViewer {
00015 namespace GlutGUI {
00016
00017 static inline bool Init(int argc,char **argv) {
00018 if (! (glutGet(GLUT_INIT_STATE)==1)) {
00019 glutInit(&argc,argv);
00020 }
00021 return true;
00022 }
00023
00024 class GlutWindow : public Window
00025 {
00026 public:
00027 static GlutWindow& GetInstance(void);
00028 static void Run(void);
00030
00031 ~GlutWindow(void);
00032
00033 virtual void DoInit(void);
00034 virtual void RefreshScreen(void);
00035 virtual void Show(bool show = true);
00036
00037 int MainLoop(void);
00038 private:
00039 GlutWindow(int posX,int posY,int width,int height,const char* title);
00040 friend class FemViewerApp;
00042 int _wndId;
00043
00044 void InitGL(void);
00046 GlutWindow(const GlutWindow&);
00047 GlutWindow& operator=(const GlutWindow&);
00048
00049 static void IdleFunc(void);
00050
00051 static void DisplayFunc(void);
00052
00053 static void ResizeFunc(int width,int height);
00054
00055 static void MouseFunc(int button,int state,int x,int y);
00056
00057 static void MouseMotionFunc(int x,int y);
00058
00059 static void MenuFunc(int option);
00060
00061
00062
00063
00064
00065
00066
00067 static void KeyboardFunc(unsigned char key,int x,int y);
00068
00069 };
00070
00071 }
00072 }
00073
00074 #endif