Fix setting the background color in OPENGL_GAL

Fixes: lp:1669098
* https://bugs.launchpad.net/kicad/+bug/1669098
This commit is contained in:
Maciej Suminski 2017-03-02 09:32:00 +01:00
parent 458b0e75e0
commit ca985791bc
2 changed files with 3 additions and 3 deletions

View File

@ -285,6 +285,7 @@ void OPENGL_COMPOSITOR::SetBuffer( unsigned int aBufferHandle )
} }
else else
{ {
glDrawBuffer( GL_FRONT_AND_BACK );
glViewport( 0, 0, GetScreenSize().x, GetScreenSize().y ); glViewport( 0, 0, GetScreenSize().x, GetScreenSize().y );
} }
} }
@ -293,7 +294,7 @@ void OPENGL_COMPOSITOR::SetBuffer( unsigned int aBufferHandle )
void OPENGL_COMPOSITOR::ClearBuffer() void OPENGL_COMPOSITOR::ClearBuffer()
{ {
assert( m_initialized ); assert( m_initialized );
// Compositor requires transparent backgrounds to work correctly
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
} }
@ -324,7 +325,7 @@ void OPENGL_COMPOSITOR::DrawBuffer( unsigned int aSourceHandle, unsigned int aDe
assert( aDestHandle <= usedBuffers() ); assert( aDestHandle <= usedBuffers() );
// Switch to the destination buffer and blit the scene // Switch to the destination buffer and blit the scene
SetBuffer ( aDestHandle ); SetBuffer( aDestHandle );
// Depth test has to be disabled to make transparency working // Depth test has to be disabled to make transparency working
glDisable( GL_DEPTH_TEST ); glDisable( GL_DEPTH_TEST );

View File

@ -1031,7 +1031,6 @@ void OPENGL_GAL::Flush()
void OPENGL_GAL::ClearScreen( const COLOR4D& aColor ) void OPENGL_GAL::ClearScreen( const COLOR4D& aColor )
{ {
// Clear screen
compositor->SetBuffer( OPENGL_COMPOSITOR::DIRECT_RENDERING ); compositor->SetBuffer( OPENGL_COMPOSITOR::DIRECT_RENDERING );
glClearColor( aColor.r, aColor.g, aColor.b, aColor.a ); glClearColor( aColor.r, aColor.g, aColor.b, aColor.a );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );