Early check of supported OpenGL version

This commit is contained in:
Maciej Suminski 2018-06-04 11:38:44 +02:00
parent 0b8cf93888
commit 6bd708621b
1 changed files with 7 additions and 0 deletions

View File

@ -73,6 +73,13 @@ OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
mouseListener( aMouseListener ), paintListener( aPaintListener ), currentManager( nullptr ), mouseListener( aMouseListener ), paintListener( aPaintListener ), currentManager( nullptr ),
cachedManager( nullptr ), nonCachedManager( nullptr ), overlayManager( nullptr ), mainBuffer( 0 ), overlayBuffer( 0 ) 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 ) if( glMainContext == NULL )
{ {
glMainContext = GL_CONTEXT_MANAGER::Get().CreateCtx( this ); glMainContext = GL_CONTEXT_MANAGER::Get().CreateCtx( this );