GL_CONTEXT_MANAGER: Call SetCurrent() only when a different context is used.

This commit is contained in:
Maciej Suminski 2016-06-09 13:44:59 +02:00
parent 71af77b5f3
commit aa9681e979
1 changed files with 8 additions and 3 deletions

View File

@ -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;
} }