X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;f=WCudaMSE%2FAPI_Bilat_FreeGlut_Tools%2FINC%2FGLUTWindowManagers.h;fp=WCudaMSE%2FAPI_Bilat_FreeGlut_Tools%2FINC%2FGLUTWindowManagers.h;h=b60c4becf1b52d8d3189a751d8a96382aa00cc95;hb=8d08c12b29c2a14684f35c023ee39e694bb80d25;hp=0000000000000000000000000000000000000000;hpb=226de81f7e1f1fbf4ac79d0d089e8a05ec7159a0;p=GPU.git diff --git a/WCudaMSE/API_Bilat_FreeGlut_Tools/INC/GLUTWindowManagers.h b/WCudaMSE/API_Bilat_FreeGlut_Tools/INC/GLUTWindowManagers.h new file mode 100755 index 0000000..b60c4be --- /dev/null +++ b/WCudaMSE/API_Bilat_FreeGlut_Tools/INC/GLUTWindowManagers.h @@ -0,0 +1,77 @@ +#ifndef GLUT_WINDOW_MANAGERS_H +#define GLUT_WINDOW_MANAGERS_H + +#include "envFreeGlutTools.h" +#include "GLConfig.h" +#include "GLUTWindow.h" +#include "GLUTCallBackTools.h" + +#include + +using std::map; + +/** + * input : + * pointer to GLImage source + */ +typedef void (*FRERE_MASTER_THREAD)(void**); + +/** + * On Linux befor using GLUTWindowManagers you have to call : + * + * GLUTWindowManagers::init(&argc,argv); + * + * Otherwise OpenGL cannot open and an error message will remind you that you haven't call glutInit !! + * + */ +class CBI_FREEGLUT_TOOLS GLUTWindowManagers + { + private: + GLUTWindowManagers(); + virtual ~GLUTWindowManagers(); + public: + static void init(int argc, char** argv); + static GLUTWindowManagers* getInstance(); + /** + * Warning Bloquant tand qu'il y a au moins une GLUTWindow d'active! + * Utiliser la méthode postDisplay de la class GLUTWindowCustomiser_A pour effectuer un traitement après le 1er rendu. + * Cette méthode postDisplay est appelé dans un thread séparé du display ! + */ + void runALL(); + + /** + * Use internaly only + */ + void addWindow(GLUTWindow* glutWindow); + + /** + * Use internaly only + */ + void removeWindow(GLUTWindow* glutWindow); + + /** + * Don't use this! + * Prefering creating a Boost::thread + * then call runALL(void) + */ + void runALL(FRERE_MASTER_THREAD methodeFrereMasterThread, void** param); + + /** + * Never use! + * Used only internally! + */ + map getMapIdGlutWindow(); + + GLUTWindow* getGLUTWindow(unsigned int glutWindowID); + + private: + bool isAllDisplaying(); + static void createDummyOpenGLContext(); + + private: + map mapIdGlutWindow; + static GLUTWindowManagers* singleton; + + }; + +#endif