[Libreoffice-commits] core.git: Branch 'feature/mac-opengl-fixes' - include/vcl vcl/source

Markus Mohrhard markus.mohrhard at googlemail.com
Sun Aug 31 17:01:43 PDT 2014


 include/vcl/opengl/OpenGLContext.hxx |    5 +++++
 vcl/source/opengl/OpenGLContext.cxx  |   14 ++++++++++++++
 2 files changed, 19 insertions(+)

New commits:
commit de9c53e9577f6cac1c168b998512642ec6fabacb
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Sep 1 01:59:57 2014 +0200

    working OSX OpenGLContext
    
    In contrast to the CGL solution this renders not only to a FBO but to a
    rendering context.
    
    Change-Id: I083795cab5ea6372efac312a1f5e0053066121ea

diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index c8ace97..ece37f6 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -31,6 +31,7 @@
 #include <GL/wglext.h>
 #elif defined( MACOSX )
 #include <OpenGL/OpenGL.h>
+ at class NSOpenGLView;
 #elif defined( IOS )
 #elif defined( ANDROID )
 #elif defined( UNX )
@@ -180,6 +181,10 @@ private:
     SAL_DLLPRIVATE bool initWindow();
     SAL_DLLPRIVATE bool ImplInit();
 
+#if defined(MACOSX)
+    NSOpenGLView* getOpenGLView();
+#endif
+
     GLWindow m_aGLWin;
     boost::scoped_ptr<Window> m_pWindow;
     Window* mpWindow; //points to m_pWindow or the parent window, don't delete it
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 3161cf8..2ae0317 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -483,6 +483,8 @@ bool OpenGLContext::ImplInit()
 
 #elif defined( MACOSX )
 
+    NSOpenGLView* pView = getOpenGLView();
+    OpenGLWrapper::makeCurrent(pView);
 
 #elif defined( IOS )
 
@@ -832,6 +834,8 @@ void OpenGLContext::makeCurrent()
         SAL_WARN("vcl.opengl", "OpenGLContext::makeCurrent(): wglMakeCurrent failed: " << GetLastError());
     }
 #elif defined( MACOSX )
+    NSOpenGLView* pView = getOpenGLView();
+    OpenGLWrapper::makeCurrent(pView);
 #elif defined( IOS ) || defined( ANDROID )
     // nothing
 #elif defined( UNX )
@@ -844,6 +848,7 @@ void OpenGLContext::resetCurrent()
 #if defined( WNT )
     wglMakeCurrent( m_aGLWin.hDC, 0 );
 #elif defined( MACOSX )
+    OpenGLWrapper::resetCurrent();
 #elif defined( IOS ) || defined( ANDROID )
     // nothing
 #elif defined( UNX )
@@ -856,6 +861,8 @@ void OpenGLContext::swapBuffers()
 #if defined( WNT )
     SwapBuffers(m_aGLWin.hDC);
 #elif defined( MACOSX )
+    NSOpenGLView* pView = getOpenGLView();
+    OpenGLWrapper::swapBuffers(pView);
 #elif defined( IOS ) || defined( ANDROID )
     // nothing
 #elif defined( UNX )
@@ -893,4 +900,11 @@ const SystemChildWindow* OpenGLContext::getChildWindow() const
     return m_pChildWindow;
 }
 
+#if defined(MACOSX)
+NSOpenGLView* OpenGLContext::getOpenGLView()
+{
+    return reinterpret_cast<NSOpenGLView*>(m_pChildWindow->GetSystemData()->mpNSView);
+}
+#endif
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list