3d: Replace glFinish with glFlush

glFinish is meant to ensure every aspect of the screen is fully-drawn
before continuing.  This causes issues with certain chipsets (Intel
4-8k)

glFlush is more of a suggestion that CPU work is complete and the GPU
should complete its work in a "timely" fashion.

We add an additional glFinish call before getting a screenshot as this
will copy the actual data from the card buffer.

Fixes: lp:1775976
* https://bugs.launchpad.net/kicad/+bug/1775976
This commit is contained in:
Seth Hillbrand 2018-06-13 06:11:21 -07:00
parent 4dd2de9057
commit f6bd6b1360
2 changed files with 6 additions and 3 deletions

View File

@ -218,7 +218,7 @@ C_OGL_3DMODEL::C_OGL_3DMODEL( const S3DMODEL &a3DModel,
glDisableClientState( GL_NORMAL_ARRAY );
glDisableClientState( GL_VERTEX_ARRAY );
glFinish();
glFlush();
delete [] pColorRGBA;
}
@ -319,7 +319,7 @@ C_OGL_3DMODEL::C_OGL_3DMODEL( const S3DMODEL &a3DModel,
for( unsigned int mesh_i = 0; mesh_i < a3DModel.m_MeshesSize; ++mesh_i )
m_model_bbox.Union( m_meshs_bbox[mesh_i] );
glFinish();
glFlush();
}
}

View File

@ -50,6 +50,9 @@ void OGL_GetScreenshot( wxImage &aDstImage )
// Alphabuffer was causing some transparency problems on some systems (Windows)
// unsigned char* alphabuffer = (unsigned char*) malloc( viewport.x * viewport.y );
// Call glFinish before screenshot to ensure everything is fully drawn.
glFinish();
glPixelStorei( GL_PACK_ALIGNMENT, 1 );
glReadBuffer( GL_BACK_LEFT );
@ -130,7 +133,7 @@ GLuint OGL_LoadTexture( const CIMAGE &aImage )
glBindTexture( GL_TEXTURE_2D, 0 );
glFinish();
glFlush();
free( rgbaBuffer );