X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4c51a665c649f7579fb39e62070cef4f66b3210d..f2c757c5cc31459c1f8adfd321a9cf9fcd429f53:/src/osx/carbon/glcanvas.cpp diff --git a/src/osx/carbon/glcanvas.cpp b/src/osx/carbon/glcanvas.cpp index 9d6e009241..8268a38ae6 100644 --- a/src/osx/carbon/glcanvas.cpp +++ b/src/osx/carbon/glcanvas.cpp @@ -257,19 +257,29 @@ bool wxGLContext::SetCurrent(const wxGLCanvas& win) const if ( !m_glContext ) return false; - AGLDrawable drawable = (AGLDrawable)GetWindowPort( - MAC_WXHWND(win.MacGetTopLevelWindowRef())); - GLint bufnummer = win.GetAglBufferName(); aglSetInteger(m_glContext, AGL_BUFFER_NAME, &bufnummer); //win.SetLastContext(m_glContext); const_cast(win).SetViewport(); - if ( !aglSetDrawable(m_glContext, drawable) ) + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 + if ( UMAGetSystemVersion() >= 0x1050 ) { - wxLogAGLError("aglSetDrawable"); - return false; + aglSetWindowRef(m_glContext, win.MacGetTopLevelWindowRef()); + } + else +#endif + { + AGLDrawable drawable = (AGLDrawable)GetWindowPort( + MAC_WXHWND(win.MacGetTopLevelWindowRef())); + + if ( !aglSetDrawable(m_glContext, drawable) ) + { + wxLogAGLError("aglSetDrawable"); + return false; + } } return WXGLSetCurrentContext(m_glContext); @@ -345,8 +355,17 @@ bool wxGLCanvas::Create(wxWindow *parent, m_bufferName = gCurrentBufferName++; aglSetInteger (m_dummyContext, AGL_BUFFER_NAME, &m_bufferName); - AGLDrawable drawable = (AGLDrawable)GetWindowPort(MAC_WXHWND(MacGetTopLevelWindowRef())); - aglSetDrawable(m_dummyContext, drawable); +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 + if ( UMAGetSystemVersion() >= 0x1050 ) + { + aglSetWindowRef(m_dummyContext, MacGetTopLevelWindowRef()); + } + else +#endif + { + AGLDrawable drawable = (AGLDrawable)GetWindowPort(MAC_WXHWND(MacGetTopLevelWindowRef())); + aglSetDrawable(m_dummyContext, drawable); + } m_macCanvasIsShown = true;