Kaydet (Commit) 4f321bd2 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

working OSX OpenGLContext

In contrast to the CGL solution this renders not only to a FBO but to a
rendering context.

Change-Id: I083795cab5ea6372efac312a1f5e0053066121ea
üst e65acd2e
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <GL/wglext.h> #include <GL/wglext.h>
#elif defined( MACOSX ) #elif defined( MACOSX )
#include <OpenGL/OpenGL.h> #include <OpenGL/OpenGL.h>
@class NSOpenGLView;
#elif defined( IOS ) #elif defined( IOS )
#elif defined( ANDROID ) #elif defined( ANDROID )
#elif defined( UNX ) #elif defined( UNX )
...@@ -182,6 +183,10 @@ private: ...@@ -182,6 +183,10 @@ private:
SAL_DLLPRIVATE bool initWindow(); SAL_DLLPRIVATE bool initWindow();
SAL_DLLPRIVATE bool ImplInit(); SAL_DLLPRIVATE bool ImplInit();
#if defined(MACOSX)
NSOpenGLView* getOpenGLView();
#endif
GLWindow m_aGLWin; GLWindow m_aGLWin;
boost::scoped_ptr<Window> m_pWindow; boost::scoped_ptr<Window> m_pWindow;
Window* mpWindow; //points to m_pWindow or the parent window, don't delete it Window* mpWindow; //points to m_pWindow or the parent window, don't delete it
......
...@@ -488,6 +488,8 @@ bool OpenGLContext::ImplInit() ...@@ -488,6 +488,8 @@ bool OpenGLContext::ImplInit()
#elif defined( MACOSX ) #elif defined( MACOSX )
NSOpenGLView* pView = getOpenGLView();
OpenGLWrapper::makeCurrent(pView);
#elif defined( IOS ) #elif defined( IOS )
...@@ -837,6 +839,8 @@ void OpenGLContext::makeCurrent() ...@@ -837,6 +839,8 @@ void OpenGLContext::makeCurrent()
SAL_WARN("vcl.opengl", "OpenGLContext::makeCurrent(): wglMakeCurrent failed: " << GetLastError()); SAL_WARN("vcl.opengl", "OpenGLContext::makeCurrent(): wglMakeCurrent failed: " << GetLastError());
} }
#elif defined( MACOSX ) #elif defined( MACOSX )
NSOpenGLView* pView = getOpenGLView();
OpenGLWrapper::makeCurrent(pView);
#elif defined( IOS ) || defined( ANDROID ) #elif defined( IOS ) || defined( ANDROID )
// nothing // nothing
#elif defined( UNX ) #elif defined( UNX )
...@@ -849,6 +853,7 @@ void OpenGLContext::resetCurrent() ...@@ -849,6 +853,7 @@ void OpenGLContext::resetCurrent()
#if defined( WNT ) #if defined( WNT )
wglMakeCurrent( m_aGLWin.hDC, 0 ); wglMakeCurrent( m_aGLWin.hDC, 0 );
#elif defined( MACOSX ) #elif defined( MACOSX )
OpenGLWrapper::resetCurrent();
#elif defined( IOS ) || defined( ANDROID ) #elif defined( IOS ) || defined( ANDROID )
// nothing // nothing
#elif defined( UNX ) #elif defined( UNX )
...@@ -861,6 +866,8 @@ void OpenGLContext::swapBuffers() ...@@ -861,6 +866,8 @@ void OpenGLContext::swapBuffers()
#if defined( WNT ) #if defined( WNT )
SwapBuffers(m_aGLWin.hDC); SwapBuffers(m_aGLWin.hDC);
#elif defined( MACOSX ) #elif defined( MACOSX )
NSOpenGLView* pView = getOpenGLView();
OpenGLWrapper::swapBuffers(pView);
#elif defined( IOS ) || defined( ANDROID ) #elif defined( IOS ) || defined( ANDROID )
// nothing // nothing
#elif defined( UNX ) #elif defined( UNX )
...@@ -903,5 +910,11 @@ bool OpenGLContext::supportMultiSampling() const ...@@ -903,5 +910,11 @@ bool OpenGLContext::supportMultiSampling() const
return m_aGLWin.bMultiSampleSupported; return m_aGLWin.bMultiSampleSupported;
} }
#if defined(MACOSX)
NSOpenGLView* OpenGLContext::getOpenGLView()
{
return reinterpret_cast<NSOpenGLView*>(m_pChildWindow->GetSystemData()->mpNSView);
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment