I am trying to run an OpenGL code on WSL2 but am getting the following error on trying to run the executable:
GLFW error 65543: GLX: Failed to create context: GLXBadFBConfig
Unable to create GLFW window
This is the code I am using to create a window:
....
GLFWwindow* initialize() {
int glfwInitRes = glfwInit();
if (!glfwInitRes) {
fprintf(stderr, "Unable to initialize GLFW\n");
return nullptr;
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
GLFWwindow* window = glfwCreateWindow(1280, 720, "InitGL", nullptr, nullptr);
if (!window) {
fprintf(stderr, "Unable to create GLFW window\n");
glfwTerminate();
return nullptr;
}
glfwMakeContextCurrent(window);
....
return window;
}
....
GLFWwindow* window = initialize();
I am using VcxSrv as my X server.
Following is from the output for glxinfo
direct rendering: No (LIBGL_ALWAYS_INDIRECT set)
server glx vendor string: SGI
server glx version string: 1.4
client glx vendor string: Mesa Project and SGI
client glx version string: 1.4
GLX version: 1.4
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce 940MX/PCIe/SSE2
OpenGL version string: 1.4 (4.6.0 NVIDIA 457.30)
direct rendering: No
your OpenGL version is stuck at 1.4 see also, so version 3.2 features will not work for you. – Crotch