52 wxGLContext* CreateCtx( wxGLCanvas* aCanvas,
const wxGLContext* aOther =
nullptr );
61 void DestroyCtx( wxGLContext* aContext );
83 bool LockCtx( wxGLContext* aContext, wxGLCanvas* aCanvas );
91 void UnlockCtx( wxGLContext* aContext );
129 template<
typename Func,
typename... Args>
136 if constexpr (std::is_void_v<decltype(aFunction(std::forward<Args>(args)...))>)
138 std::forward<Func>(aFunction)(std::forward<Args>(args)...);
139 LockCtx( currentCtx, currentCanvas );
144 auto result = std::forward<Func>(aFunction)(std::forward<Args>(args)...);
145 LockCtx( currentCtx, currentCanvas );
void UnlockCtx(wxGLContext *aContext)
Allow other canvases to bind an OpenGL context.
wxGLContext * m_glCtx
Currently bound GL context.
std::mutex m_glCtxMutex
Lock to prevent unexpected GL context switching.
std::set< const wxGLContext * > m_loseOnResetContexts
Contexts created with the lose-on-reset notification strategy.
wxGLContext * GetCurrentCtx() const
Get the currently bound GL context.
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.
bool LockCtx(wxGLContext *aContext, wxGLCanvas *aCanvas)
Set a context as current and prevents other canvases from switching it.
wxGLCanvas * GetCurrentCanvas() const
Get the currently bound GL canvas.
bool IsLoseOnReset(const wxGLContext *aContext) const
wxString result
Test unit parsing edge cases and error handling.