[GEM-cvs] Gem/src/Base GemMan.cpp, 1.74, 1.75 GemWinCreate.h, 1.15, 1.16 GemWinCreateMac.cpp, 1.37,
Brought to you by:
zmoelnig
From: IOhannes m z. <zmo...@us...> - 2008-03-10 16:48:58
|
Update of /cvsroot/pd-gem/Gem/src/Base In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21394/Base Modified Files: GemMan.cpp GemWinCreate.h GemWinCreateMac.cpp GemWinCreateNT.cpp GemWinCreateXWin.cpp Log Message: moved setup of context-sharing into GemWinCreate<OS> Index: GemWinCreateNT.cpp =================================================================== RCS file: /cvsroot/pd-gem/Gem/src/Base/GemWinCreateNT.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GemWinCreateNT.cpp 10 Mar 2008 16:20:30 -0000 1.10 --- GemWinCreateNT.cpp 10 Mar 2008 16:48:58 -0000 1.11 *************** *** 632,634 **** --- 632,642 ---- } + + GEM_EXTERN void initWin_sharedContext(WindowInfo &info, WindowHints &hints) + { + // myHints.shared = constInfo.context; + hints.shared = NULL; + } + + #endif Index: GemMan.cpp =================================================================== RCS file: /cvsroot/pd-gem/Gem/src/Base/GemMan.cpp,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** GemMan.cpp 10 Mar 2008 16:33:56 -0000 1.74 --- GemMan.cpp 10 Mar 2008 16:48:58 -0000 1.75 *************** *** 101,108 **** bool GemMan::pleaseDestroy=false; - #ifdef __APPLE__ - AGLContext GemMan::masterContext = NULL; - #endif - // static data static const int NUM_LIGHTS = 8; // the maximum number of lights --- 101,104 ---- *************** *** 367,371 **** s_windowClock = clock_new(NULL, (t_method)dispatchGemWindowMessages); - if (!m_windowContext && !createConstWindow(disp)) { --- 363,366 ---- *************** *** 447,478 **** m_motionBlur = 0.f; - initGemWin(); - - #ifdef __APPLE__ - // This is to create a "master context" on Gem initialization, with - // the hope that we can then share it with later context's created - // when opening new rendering windows, and thereby share resources - // - no window will be directly associate with this context! - // - should remove the need for GemMan::HaveValidContext() - GLint attrib[] = {AGL_RGBA, AGL_DOUBLEBUFFER, AGL_NO_RECOVERY, AGL_NONE}; - - // GDHandle display = GetMainDevice(); - // AGLPixelFormat aglPixFmt = aglChoosePixelFormat( &display, 1, attrib ); - AGLPixelFormat aglPixFmt = aglChoosePixelFormat( NULL, 0, attrib ); - GLenum err = aglGetError(); - if (AGL_NO_ERROR != err) - post((char *)aglErrorString(err)); - GemMan::masterContext = aglCreateContext( aglPixFmt, NULL ); - err = aglGetError(); - if (AGL_NO_ERROR != err) - post((char *)aglErrorString(err)); - aglSetCurrentContext( masterContext); - - // AGL_MACRO_DECLARE_VARIABLES() - - aglDestroyPixelFormat( aglPixFmt ); - #endif - } --- 442,446 ---- *************** *** 1328,1340 **** myHints.height = GemMan::m_height; ! // TODO: ! // masterContext for all platforms? ! #ifndef __APPLE__ ! myHints.shared = NULL; ! #else ! // myHints.shared = constInfo.context; ! constInfo.context = GemMan::masterContext; ! myHints.shared = GemMan::masterContext; ! #endif myHints.actuallyDisplay = 0; myHints.fullscreen = 0; --- 1296,1301 ---- myHints.height = GemMan::m_height; ! initWin_sharedContext(constInfo, myHints); ! myHints.actuallyDisplay = 0; myHints.fullscreen = 0; Index: GemWinCreateXWin.cpp =================================================================== RCS file: /cvsroot/pd-gem/Gem/src/Base/GemWinCreateXWin.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** GemWinCreateXWin.cpp 10 Mar 2008 16:33:56 -0000 1.26 --- GemWinCreateXWin.cpp 10 Mar 2008 16:48:58 -0000 1.27 *************** *** 406,408 **** --- 406,416 ---- } + + GEM_EXTERN void initWin_sharedContext(WindowInfo &info, WindowHints &hints) + { + // myHints.shared = constInfo.context; + hints.shared = NULL; + } + + #endif // unix Index: GemWinCreateMac.cpp =================================================================== RCS file: /cvsroot/pd-gem/Gem/src/Base/GemWinCreateMac.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** GemWinCreateMac.cpp 10 Mar 2008 16:33:56 -0000 1.37 --- GemWinCreateMac.cpp 10 Mar 2008 16:48:58 -0000 1.38 *************** *** 62,65 **** --- 62,68 ---- typedef struct structGLWindowInfo * pstructGLWindowInfo; + // the master context associated with no window and shared by all other contexts + AGLContext masterContext = NULL; + // globals (internal/private) ----------------------------------------------- *************** *** 1548,1553 **** --- 1551,1586 ---- return 0; } + // This is to create a "master context" on Gem initialization, with + // the hope that we can then share it with later context's created + // when opening new rendering windows, and thereby share resources + // - no window will be directly associate with this context! + // - should remove the need for GemMan::HaveValidContext() + GLint attrib[] = {AGL_RGBA, AGL_DOUBLEBUFFER, AGL_NO_RECOVERY, AGL_NONE}; + + // GDHandle display = GetMainDevice(); + // AGLPixelFormat aglPixFmt = aglChoosePixelFormat( &display, 1, attrib ); + AGLPixelFormat aglPixFmt = aglChoosePixelFormat( NULL, 0, attrib ); + GLenum err = aglGetError(); + if (AGL_NO_ERROR != err) + post((char *)aglErrorString(err)); + masterContext = aglCreateContext( aglPixFmt, NULL ); + err = aglGetError(); + if (AGL_NO_ERROR != err) + post((char *)aglErrorString(err)); + aglSetCurrentContext( masterContext); + + // AGL_MACRO_DECLARE_VARIABLES() + + aglDestroyPixelFormat( aglPixFmt ); + return 1; } + GEM_EXTERN void initWin_sharedContext(WindowInfo &info, WindowHints &hints) + { + // myHints.shared = constInfo.context; + info.context = masterContext; + hints.shared = masterContext; + } + #endif Index: GemWinCreate.h =================================================================== RCS file: /cvsroot/pd-gem/Gem/src/Base/GemWinCreate.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** GemWinCreate.h 10 Mar 2008 16:18:08 -0000 1.15 --- GemWinCreate.h 10 Mar 2008 16:48:58 -0000 1.16 *************** *** 210,212 **** --- 210,216 ---- GEM_EXTERN extern bool initGemWin(void); + ///////// + // prepare a WindowInfo for context-sharing + GEM_EXTERN void initWin_sharedContext(WindowInfo &info, WindowHints &hints); + #endif // for header file |