From 6bd708621bce11a0a5e1fc1cf8e86e443f15dbbc Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Mon, 4 Jun 2018 11:38:44 +0200 Subject: [PATCH] Early check of supported OpenGL version --- common/gal/opengl/opengl_gal.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 1c693abc7b..1d099bb33d 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -73,6 +73,13 @@ OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent, mouseListener( aMouseListener ), paintListener( aPaintListener ), currentManager( nullptr ), cachedManager( nullptr ), nonCachedManager( nullptr ), overlayManager( nullptr ), mainBuffer( 0 ), overlayBuffer( 0 ) { +#if wxCHECK_VERSION( 3, 0, 3 ) + const int attr[] = { WX_GL_MAJOR_VERSION, 2, WX_GL_MINOR_VERSION, 1, 0 }; + + if( !IsDisplaySupported( attr ) ) + throw std::runtime_error( "OpenGL 2.1 or higher is required!" ); +#endif /* wxCHECK_VERSION( 3, 0, 3 ) */ + if( glMainContext == NULL ) { glMainContext = GL_CONTEXT_MANAGER::Get().CreateCtx( this );