52 wxGLContext* CreateCtx( wxGLCanvas* aCanvas,
const wxGLContext* aOther =
nullptr );
61 void DestroyCtx( wxGLContext* aContext );
80 void LockCtx( wxGLContext* aContext, wxGLCanvas* aCanvas );
88 void UnlockCtx( wxGLContext* aContext );
116 template<
typename Func,
typename... Args>
123 if constexpr (std::is_void_v<decltype(aFunction(std::forward<Args>(args)...))>)
125 std::forward<Func>(aFunction)(std::forward<Args>(args)...);
126 LockCtx( currentCtx, currentCanvas );
131 auto result = std::forward<Func>(aFunction)(std::forward<Args>(args)...);
132 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.