3D-Viewer: check for minimum required version of OpenGL
Fixes https://gitlab.com/kicad/code/kicad/issues/5286
This commit is contained in:
parent
00baaaa831
commit
1cbe8fcc1f
|
@ -101,6 +101,7 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow* aParent, const int* aAttribList, BOARD*
|
||||||
m_parentInfoBar( nullptr ),
|
m_parentInfoBar( nullptr ),
|
||||||
m_glRC( nullptr ),
|
m_glRC( nullptr ),
|
||||||
m_is_opengl_initialized( false ),
|
m_is_opengl_initialized( false ),
|
||||||
|
m_is_opengl_version_supported( true ),
|
||||||
m_mouse_is_moving( false ),
|
m_mouse_is_moving( false ),
|
||||||
m_mouse_was_moved( false ),
|
m_mouse_was_moved( false ),
|
||||||
m_camera_is_moving( false ),
|
m_camera_is_moving( false ),
|
||||||
|
@ -112,7 +113,7 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow* aParent, const int* aAttribList, BOARD*
|
||||||
m_boardAdapter( aBoardAdapter ),
|
m_boardAdapter( aBoardAdapter ),
|
||||||
m_camera( aCamera ),
|
m_camera( aCamera ),
|
||||||
m_3d_render( nullptr ),
|
m_3d_render( nullptr ),
|
||||||
m_opengl_supports_raytracing( false ),
|
m_opengl_supports_raytracing( true ),
|
||||||
m_render_raytracing_was_requested( false ),
|
m_render_raytracing_was_requested( false ),
|
||||||
m_accelerator3DShapes( nullptr ),
|
m_accelerator3DShapes( nullptr ),
|
||||||
m_currentIntersectedBoardItem( nullptr )
|
m_currentIntersectedBoardItem( nullptr )
|
||||||
|
@ -253,8 +254,6 @@ bool EDA_3D_CANVAS::initializeOpenGL()
|
||||||
|
|
||||||
wxStringTokenizer tokenizer( version );
|
wxStringTokenizer tokenizer( version );
|
||||||
|
|
||||||
m_opengl_supports_raytracing = true;
|
|
||||||
|
|
||||||
if( tokenizer.HasMoreTokens() )
|
if( tokenizer.HasMoreTokens() )
|
||||||
{
|
{
|
||||||
long major = 0;
|
long major = 0;
|
||||||
|
@ -270,7 +269,7 @@ bool EDA_3D_CANVAS::initializeOpenGL()
|
||||||
if( tokenizer.HasMoreTokens() )
|
if( tokenizer.HasMoreTokens() )
|
||||||
tokenizer.GetNextToken().ToLong( &minor );
|
tokenizer.GetNextToken().ToLong( &minor );
|
||||||
|
|
||||||
if( major < 2 || ( (major == 2 ) && (minor < 1) ) )
|
if( major < 2 || ( ( major == 2 ) && ( minor < 1 ) ) )
|
||||||
{
|
{
|
||||||
wxLogTrace( m_logTrace, "EDA_3D_CANVAS::%s OpenGL ray tracing not supported.",
|
wxLogTrace( m_logTrace, "EDA_3D_CANVAS::%s OpenGL ray tracing not supported.",
|
||||||
__WXFUNCTION__ );
|
__WXFUNCTION__ );
|
||||||
|
@ -283,6 +282,14 @@ bool EDA_3D_CANVAS::initializeOpenGL()
|
||||||
|
|
||||||
m_opengl_supports_raytracing = false;
|
m_opengl_supports_raytracing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( ( major == 1 ) && ( minor < 5 ) )
|
||||||
|
{
|
||||||
|
wxLogTrace( m_logTrace, "EDA_3D_CANVAS::%s OpenGL not supported.",
|
||||||
|
__WXFUNCTION__ );
|
||||||
|
|
||||||
|
m_is_opengl_version_supported = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_UTILS::SetSwapInterval( -1 );
|
GL_UTILS::SetSwapInterval( -1 );
|
||||||
|
@ -410,6 +417,26 @@ void EDA_3D_CANVAS::DoRePaint()
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !m_is_opengl_version_supported )
|
||||||
|
{
|
||||||
|
warningReporter.Report( _( "Your OpenGL version is not supported. Minimum required is 1.5" ),
|
||||||
|
RPT_SEVERITY_WARNING );
|
||||||
|
|
||||||
|
warningReporter.Finalize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !m_is_opengl_version_supported )
|
||||||
|
{
|
||||||
|
glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||||
|
glClear( GL_COLOR_BUFFER_BIT );
|
||||||
|
|
||||||
|
SwapBuffers();
|
||||||
|
|
||||||
|
GL_CONTEXT_MANAGER::Get().UnlockCtx( m_glRC );
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't attend to ray trace if OpenGL doesn't support it.
|
// Don't attend to ray trace if OpenGL doesn't support it.
|
||||||
|
|
|
@ -244,6 +244,7 @@ private:
|
||||||
|
|
||||||
wxGLContext* m_glRC; // Current OpenGL context
|
wxGLContext* m_glRC; // Current OpenGL context
|
||||||
bool m_is_opengl_initialized;
|
bool m_is_opengl_initialized;
|
||||||
|
bool m_is_opengl_version_supported;
|
||||||
|
|
||||||
wxTimer m_editing_timeout_timer; // Expires after some time signalling that
|
wxTimer m_editing_timeout_timer; // Expires after some time signalling that
|
||||||
// the mouse / keyboard movements are over
|
// the mouse / keyboard movements are over
|
||||||
|
|
Loading…
Reference in New Issue