Changeset - r24959:3fce56ec1a95
[Not reviewed]
master
0 1 0
Patric Stout - 3 years ago 2021-02-27 17:51:20
truebrain@openttd.org
Fix: [SDL2] set GL attributes to get the best GL context possible (#8759)
1 file changed with 11 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/video/sdl2_opengl_v.cpp
Show inline comments
 
@@ -94,6 +94,17 @@ void VideoDriver_SDL_OpenGL::DestroyCont
 

	
 
const char *VideoDriver_SDL_OpenGL::AllocateContext()
 
{
 
	SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
 
	SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
 
	SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
 
	SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
 
	SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
 
	SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
 

	
 
	if (_debug_driver_level >= 8) {
 
		SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
 
	}
 

	
 
	this->gl_context = SDL_GL_CreateContext(this->sdl_window);
 
	if (this->gl_context == nullptr) return "SDL2: Can't active GL context";
 

	
0 comments (0 inline, 0 general)