GL_CONTEXT_MANAGER: Call SetCurrent() only when a different context is used.
This commit is contained in:
parent
71af77b5f3
commit
aa9681e979
|
@ -74,8 +74,12 @@ void GL_CONTEXT_MANAGER::LockCtx( wxGLContext* aContext, wxGLCanvas* aCanvas )
|
||||||
|
|
||||||
m_glCtxMutex.lock();
|
m_glCtxMutex.lock();
|
||||||
wxGLCanvas* canvas = aCanvas ? aCanvas : m_glContexts.at( aContext );
|
wxGLCanvas* canvas = aCanvas ? aCanvas : m_glContexts.at( aContext );
|
||||||
canvas->SetCurrent( *aContext );
|
|
||||||
m_glCtx = aContext;
|
if( aContext != m_glCtx )
|
||||||
|
{
|
||||||
|
canvas->SetCurrent( *aContext );
|
||||||
|
m_glCtx = aContext;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,7 +87,8 @@ void GL_CONTEXT_MANAGER::UnlockCtx( wxGLContext* aContext )
|
||||||
{
|
{
|
||||||
assert( m_glContexts.count( aContext ) > 0 );
|
assert( m_glContexts.count( aContext ) > 0 );
|
||||||
|
|
||||||
if( m_glCtx == aContext ){
|
if( m_glCtx == aContext )
|
||||||
|
{
|
||||||
m_glCtxMutex.unlock();
|
m_glCtxMutex.unlock();
|
||||||
m_glCtx = NULL;
|
m_glCtx = NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue