48 wxGLContext* CreateCtx( wxGLCanvas* aCanvas,
const wxGLContext* aOther =
nullptr );
57 void DestroyCtx( wxGLContext* aContext );
76 void LockCtx( wxGLContext* aContext, wxGLCanvas* aCanvas );
84 void UnlockCtx( wxGLContext* aContext );
112 template<
typename Func,
typename... Args>
119 if constexpr (std::is_void_v<decltype(aFunction(std::forward<Args>(args)...))>)
121 std::forward<Func>(aFunction)(std::forward<Args>(args)...);
122 LockCtx( currentCtx, currentCanvas );
127 auto result = std::forward<Func>(aFunction)(std::forward<Args>(args)...);
128 LockCtx( currentCtx, currentCanvas );
void UnlockCtx(wxGLContext *aContext)
Allow other canvases to bind an OpenGL context.
wxGLContext * m_glCtx
Lock to prevent unexpected GL context switching.
wxGLContext * GetCurrentCtx() const
Get the currently bound GL 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.
auto RunWithoutCtxLock(Func &&aFunction, Args &&... args)
Run the given function first releasing the GL context lock, then restoring it.
wxGLCanvas * GetCurrentCanvas() const
Get the currently bound GL canvas.
wxString result
Test unit parsing edge cases and error handling.