32 wxGLContext* context =
new wxGLContext( aCanvas, aOther );
33 wxCHECK( context,
nullptr );
35 if( !context->IsOK() )
41 m_glContexts.insert( std::make_pair( context, aCanvas ) );
80 wxCHECK( aContext &&
m_glContexts.count( aContext ) > 0, );
83 wxGLCanvas* canvas = aCanvas ? aCanvas :
m_glContexts.at( aContext );
89 if( canvas->GTKGetDrawingWindow() )
91 if( canvas->GetXWindow() )
96 canvas->SetCurrent( *aContext );
105 wxCHECK( aContext &&
m_glContexts.count( aContext ) > 0, );
114 wxFAIL_MSG( wxString::Format( wxS(
"Trying to unlock GL context mutex from "
115 "a wrong context: aContext %p m_glCtx %p" ), aContext,
m_glCtx ) );
void UnlockCtx(wxGLContext *aContext)
Allow other canvases to bind an OpenGL context.
wxGLContext * m_glCtx
Lock to prevent unexpected GL context switching.
void DestroyCtx(wxGLContext *aContext)
Destroy a managed OpenGL context.
void LockCtx(wxGLContext *aContext, wxGLCanvas *aCanvas)
Set a context as current and prevents other canvases from switching it.
std::map< wxGLContext *, wxGLCanvas * > m_glContexts
< Map of GL contexts & their parent canvases.
wxGLContext * CreateCtx(wxGLCanvas *aCanvas, const wxGLContext *aOther=nullptr)
Create a managed OpenGL context.
void DeleteAll()
Destroy all managed OpenGL contexts.