I’m having a problem using multisampling with SDL2 on Linux. The SDL error message I’m receiving is “Could not find matching GLX visual”. The code I am using before create window is as follows:
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); // or 2, 8, 16, none work
I’m running Ubuntu 16.04 64 bit with the proprietary 381.09 nvidia drivers. My graphics card is a GeForce 750 Ti.
I’ve had this problem in the past on another machine with a previous build of SDL2 and different hardware. What’s the deal?
Interesting how all the multisample visuals and configs are non-conformant.
Try to match the attributes more closely:
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_ALPHA_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 32);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); // or 0 if you don't need it.
Do not set SDL_GL_ACCELERATED_VISUAL to anything above -1 or, I think, it will not consider the non-conformant ones.
It looks like it uses the GLX route. Perhaps you have more success with EGL. Set the SDL_OPENGL_ES_DRIVER environment variable to 1 and check if anything changes. I’m not that familiar with the X11 code in SDL, this may not do anything.