50 wxGLContext* CreateCtx( wxGLCanvas* aCanvas,
const wxGLContext* aOther =
nullptr );
59 void DestroyCtx( wxGLContext* aContext );
78 void LockCtx( wxGLContext* aContext, wxGLCanvas* aCanvas );
86 void UnlockCtx( wxGLContext* aContext );
114 template<
typename Func,
typename... Args>
121 if constexpr (std::is_void_v<decltype(aFunction(std::forward<Args>(args)...))>)
123 std::forward<Func>(aFunction)(std::forward<Args>(args)...);
124 LockCtx( currentCtx, currentCanvas );
129 auto result = std::forward<Func>(aFunction)(std::forward<Args>(args)...);
130 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.