mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-30 17:00:05 +00:00 
			
		
		
		
	Use glad instead of GLEW to load OpenGL
This commit is contained in:
		
							parent
							
								
									6cb668f546
								
							
						
					
					
						commit
						d5cda9b353
					
				
					 5 changed files with 26 additions and 12 deletions
				
			
		|  | @ -57,21 +57,21 @@ void GlContext::Impl::InitializeGL() | |||
|       return; | ||||
|    } | ||||
| 
 | ||||
|    const GLenum error = glewInit(); | ||||
|    if (error != GLEW_OK) | ||||
|    const int gladVersion = gladLoaderLoadGL(); | ||||
|    if (!gladVersion) | ||||
|    { | ||||
|       auto glewErrorString = | ||||
|          reinterpret_cast<const char*>(glewGetErrorString(error)); | ||||
|       logger_->error("glewInit failed: {}", glewErrorString); | ||||
|       logger_->error("gladLoaderLoadGL failed"); | ||||
| 
 | ||||
|       QMessageBox::critical( | ||||
|          nullptr, | ||||
|          "Supercell Wx", | ||||
|          QString("Unable to initialize OpenGL: %1").arg(glewErrorString)); | ||||
|          nullptr, "Supercell Wx", "Unable to initialize OpenGL"); | ||||
| 
 | ||||
|       throw std::runtime_error("Unable to initialize OpenGL"); | ||||
|    } | ||||
| 
 | ||||
|    logger_->info("GLAD initialization complete: OpenGL {}.{}", | ||||
|                  GLAD_VERSION_MAJOR(gladVersion), | ||||
|                  GLAD_VERSION_MINOR(gladVersion)); | ||||
| 
 | ||||
|    auto glVersion  = reinterpret_cast<const char*>(glGetString(GL_VERSION)); | ||||
|    auto glVendor   = reinterpret_cast<const char*>(glGetString(GL_VENDOR)); | ||||
|    auto glRenderer = reinterpret_cast<const char*>(glGetString(GL_RENDERER)); | ||||
|  | @ -86,7 +86,7 @@ void GlContext::Impl::InitializeGL() | |||
|    glGetIntegerv(GL_MAJOR_VERSION, &major); | ||||
|    glGetIntegerv(GL_MINOR_VERSION, &minor); | ||||
| 
 | ||||
|    if (major < 3 || (major == 3 && minor < 3)) | ||||
|    if (major < 3 || (major == 3 && minor < 3) || !GLAD_GL_VERSION_3_3) | ||||
|    { | ||||
|       logger_->error( | ||||
|          "OpenGL 3.3 or greater is required, found {}.{}", major, minor); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat