diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-09-01 23:59:24 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-09-02 01:08:54 +0200 |
commit | 8b384c946cb6725d691123152f5e7c6ac0692185 (patch) | |
tree | bcdb61ec3c578afec8d2261733bc32f3090cfcde | |
parent | 6626d135299f91c20b338a858af8f42f4e3d07d0 (diff) |
support legacy and core context on OSX
Change-Id: Ib8cadb3f182ce49c0ca8b6ccaa95960eb8e5f9ae
-rw-r--r-- | include/vcl/opengl/OpenGLContext.hxx | 2 | ||||
-rw-r--r-- | include/vcl/sysdata.hxx | 1 | ||||
-rw-r--r-- | vcl/osx/salobj.cxx | 38 | ||||
-rw-r--r-- | vcl/source/opengl/OpenGLContext.cxx | 12 |
4 files changed, 39 insertions, 14 deletions
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx index 7ce6763c488f..79f97fc5610d 100644 --- a/include/vcl/opengl/OpenGLContext.hxx +++ b/include/vcl/opengl/OpenGLContext.hxx @@ -181,7 +181,7 @@ public: bool supportMultiSampling() const; - static SystemWindowData generateWinData(Window* pParent); + static SystemWindowData generateWinData(Window* pParent, bool bRequestLegacyContext); private: SAL_DLLPRIVATE bool initWindow(); diff --git a/include/vcl/sysdata.hxx b/include/vcl/sysdata.hxx index 8ac816a1a261..4cfc7378b596 100644 --- a/include/vcl/sysdata.hxx +++ b/include/vcl/sysdata.hxx @@ -178,6 +178,7 @@ struct SystemWindowData #if defined( WNT ) // meaningless on Windows #elif defined( MACOSX ) bool bOpenGL; // create a OpenGL providing NSView + bool bLegacy; // create a 2.1 legacy context, only valid if bOpenGL == true // Nothing #elif defined( ANDROID ) // Nothing diff --git a/vcl/osx/salobj.cxx b/vcl/osx/salobj.cxx index 7c7ad5d41129..816eaf10e9bb 100644 --- a/vcl/osx/salobj.cxx +++ b/vcl/osx/salobj.cxx @@ -49,17 +49,39 @@ AquaSalObject::AquaSalObject( AquaSalFrame* pFrame, SystemWindowData* pWindowDat } if (pWindowData->bOpenGL) { - NSOpenGLPixelFormatAttribute aAttributes[] = + NSOpenGLPixelFormat* pixFormat = NULL; + + if (pWindowData->bLegacy) + { + NSOpenGLPixelFormatAttribute aAttributes[] = + { + NSOpenGLPFADoubleBuffer, + NSOpenGLPFAAlphaSize, 8, + NSOpenGLPFAColorSize, 24, + NSOpenGLPFAMultisample, + NSOpenGLPFASampleBuffers, (NSOpenGLPixelFormatAttribute)1, + NSOpenGLPFASamples, (NSOpenGLPixelFormatAttribute)4, + 0 + }; + pixFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:aAttributes]; + } + else { - NSOpenGLPFADoubleBuffer, - NSOpenGLPFAAlphaSize, 8, - NSOpenGLPFAColorSize, 24, - 0 - }; + NSOpenGLPixelFormatAttribute aAttributes[] = + { + NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core, + NSOpenGLPFADoubleBuffer, + NSOpenGLPFAAlphaSize, 8, + NSOpenGLPFAColorSize, 24, + NSOpenGLPFAMultisample, + NSOpenGLPFASampleBuffers, (NSOpenGLPixelFormatAttribute)1, + NSOpenGLPFASamples, (NSOpenGLPixelFormatAttribute)4, + 0 + }; + pixFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:aAttributes]; + } - NSOpenGLPixelFormat* pixFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:aAttributes]; maSysData.mpNSView = [[NSOpenGLView alloc] initWithFrame: aInitFrame pixelFormat:pixFormat]; - } else { diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index d7ea0ee6d070..18e0a0248474 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -615,7 +615,7 @@ bool OpenGLContext::initWindow() { if( !m_pChildWindow ) { - SystemWindowData winData = generateWinData(mpWindow); + SystemWindowData winData = generateWinData(mpWindow, false); m_pChildWindow = new SystemChildWindow(mpWindow, 0, &winData, false); m_pChildWindowGC.reset(m_pChildWindow); } @@ -642,7 +642,7 @@ bool OpenGLContext::initWindow() { if( !m_pChildWindow ) { - SystemWindowData winData = generateWinData(mpWindow); + SystemWindowData winData = generateWinData(mpWindow, mbRequestLegacyContext); m_pChildWindow = new SystemChildWindow(mpWindow, 0, &winData, false); m_pChildWindowGC.reset(m_pChildWindow); } @@ -673,7 +673,7 @@ bool OpenGLContext::initWindow() bool OpenGLContext::initWindow() { const SystemEnvData* pChildSysData = 0; - SystemWindowData winData = generateWinData(mpWindow); + SystemWindowData winData = generateWinData(mpWindow, false); if( winData.pVisual ) { if( !m_pChildWindow ) @@ -725,11 +725,13 @@ bool OpenGLContext::initWindow() #if defined( WNT ) || defined( MACOSX ) || defined( IOS ) || defined( ANDROID ) -SystemWindowData OpenGLContext::generateWinData(Window* /*pParent*/) +SystemWindowData OpenGLContext::generateWinData(Window* /*pParent*/, bool bRequestLegacyContext) { + (void) bRequestLegacyContext; SystemWindowData aWinData; #if defined(MACOSX) aWinData.bOpenGL = true; + aWinData.bLegacy = bRequestLegacyContext; #endif aWinData.nSize = sizeof(aWinData); return aWinData; @@ -750,7 +752,7 @@ void initOpenGLFunctionPointers() } -SystemWindowData OpenGLContext::generateWinData(Window* pParent) +SystemWindowData OpenGLContext::generateWinData(Window* pParent, bool) { SystemWindowData aWinData; aWinData.nSize = sizeof(aWinData); |