SDL2 reports no OpenGL provider with i965/mesa


#1

Running glxinfo on my system indicates OpenGL is available. I have followed the installation instructions for my distribution.

SDL_CreateWindow: No OpenGL support in video driver

#include <SDL2/SDL.h>
#include <iostream>
using namespace std;

#define WINDOW_WIDTH	640
#define WINDOW_HEIGHT	480

int
main(int argc, char *argv[])
{
	SDL_Window *window;
	SDL_GLContext context;
	SDL_Event event;

	if (SDL_Init(SDL_INIT_VIDEO)) {
		cout << "SDL_Init_Video: " << SDL_GetError() << std::endl;
		return -1;
	}

	window = SDL_CreateWindow("Console",
		SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
		WINDOW_WIDTH, WINDOW_HEIGHT,
		SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_OPENGL);
	if (!window) {
		cout << "SDL_CreateWindow: " << SDL_GetError() << std::endl;
		return -1;
	}

	cout << "Hello, world!" << std::endl;
	return 0;
}

#2

Okay, it turns out I had improperly configured SDL when compiling. However simply enabling OpenGL didn’t do it, it appears like I had to enable EGL and GLES[2].