compilation fix for wxOSX/Cocoa: don't use Carbon functions in common to all OS X ports OpenGL code

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61306 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2009-07-03 12:22:40 +00:00
parent 83c23edb02
commit b6ccc13c2f
4 changed files with 23 additions and 9 deletions

View File

@ -24,6 +24,7 @@
WXDLLIMPEXP_GL WXGLContext WXGLCreateContext( WXGLPixelFormat pixelFormat, WXGLContext shareContext );
WXDLLIMPEXP_GL void WXGLDestroyContext( WXGLContext context );
WXDLLIMPEXP_GL WXGLContext WXGLGetCurrentContext();
WXDLLIMPEXP_GL bool WXGLSetCurrentContext(WXGLContext context);
WXDLLIMPEXP_GL void WXGLSwapBuffers( WXGLContext context );
WXDLLIMPEXP_GL WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList);

View File

@ -87,6 +87,17 @@ WXGLContext WXGLGetCurrentContext()
return aglGetCurrentContext();
}
bool WXGLSetCurrentContext(WXGLContext context)
{
if ( !aglSetCurrentContext(context) )
{
wxLogAGLError("aglSetCurrentContext");
return false;
}
return true;
}
void WXGLDestroyPixelFormat( WXGLPixelFormat pixelFormat )
{
if ( pixelFormat )
@ -266,12 +277,7 @@ bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
return false;
}
if ( !aglSetCurrentContext(m_glContext) )
{
wxLogAGLError("aglSetCurrentContext");
return false;
}
return true;
return WXGLSetCurrentContext(m_glContext);
}
// ----------------------------------------------------------------------------

View File

@ -61,6 +61,13 @@ WXGLContext WXGLGetCurrentContext()
return [NSOpenGLContext currentContext];
}
bool WXGLSetCurrentContext(WXGLContext context)
{
[context makeCurrentContext];
return true;
}
void WXGLDestroyPixelFormat( WXGLPixelFormat pixelFormat )
{
if ( pixelFormat )

View File

@ -164,12 +164,12 @@ bool wxGLCanvasBase::IsExtensionSupported(const char *extension)
if ( !ctx )
return false;
WXGLContext ctxOld = aglGetCurrentContext();
aglSetCurrentContext(ctx);
WXGLContext ctxOld = WXGLGetCurrentContext();
WXGLSetCurrentContext(ctx);
wxString extensions = wxString::FromAscii(glGetString(GL_EXTENSIONS));
aglSetCurrentContext(ctxOld);
WXGLSetCurrentContext(ctxOld);
WXGLDestroyPixelFormat(fmt);
WXGLDestroyContext(ctx);